diff --git a/Makefile.in b/Makefile.in new file mode 100644 index 0000000000000000000000000000000000000000..bc6140097d99db70c438034ff89434d9e869abe6 --- /dev/null +++ b/Makefile.in @@ -0,0 +1,978 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 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@ +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +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@ +subdir = . +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = \ + $(top_srcdir)/m4/acx_assert_lang_is_fortran_variant.m4 \ + $(top_srcdir)/m4/acx_c_package.m4 \ + $(top_srcdir)/m4/acx_cfortran_flags.m4 \ + $(top_srcdir)/m4/acx_check_cfortran.m4 \ + $(top_srcdir)/m4/acx_check_strptr_convert.m4 \ + $(top_srcdir)/m4/acx_execinfo.m4 \ + $(top_srcdir)/m4/acx_fortran_check_include.m4 \ + $(top_srcdir)/m4/acx_fortran_include_flag.m4 \ + $(top_srcdir)/m4/acx_fortran_package.m4 \ + $(top_srcdir)/m4/acx_lang_check_include.m4 \ + $(top_srcdir)/m4/acx_lang_package.m4 \ + $(top_srcdir)/m4/acx_lt_problems.m4 \ + $(top_srcdir)/m4/acx_m4_list_to_quoted_strings.m4 \ + $(top_srcdir)/m4/acx_mpirun.m4 $(top_srcdir)/m4/acx_mv_obj.m4 \ + $(top_srcdir)/m4/acx_option_search_libs.m4 \ + $(top_srcdir)/m4/acx_options.m4 \ + $(top_srcdir)/m4/acx_prog_cc_posix.m4 \ + $(top_srcdir)/m4/acx_sl_fc_mod_path_flag.m4 \ + $(top_srcdir)/m4/acx_sl_mod_suffix.m4 \ + $(top_srcdir)/m4/acx_tls_xlc_retry.m4 \ + $(top_srcdir)/m4/acx_use_libtool_configuration.m4 \ + $(top_srcdir)/m4/acx_uuid.m4 $(top_srcdir)/m4/asx_tr_arg.m4 \ + $(top_srcdir)/m4/asx_unset.m4 $(top_srcdir)/m4/ax_pthread.m4 \ + $(top_srcdir)/m4/ax_python_devel.m4 $(top_srcdir)/m4/ax_tls.m4 \ + $(top_srcdir)/m4/kpse_libtool.m4 $(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/pkg.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/m4/ac_lang_program_fortran.m4 \ + $(top_srcdir)/m4/acx_lang_fortran_check_include.m4 \ + $(top_srcdir)/m4/acx_lang_c_check_include.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \ + $(am__configure_deps) $(am__DIST_COMMON) +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ + configure.lineno config.status.lineno +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/src/config.h +CONFIG_CLEAN_FILES = cdi.settings \ + src/cmake/cdi/cdi-config-version.cmake \ + src/cmake/cdi/cdi-config.cmake src/pkgconfig/cdi.pc \ + src/pkgconfig/cdi_f2003.pc src/pkgconfig/cdipio.pc \ + tables/gen_tableheaderfile +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 distdir-am dist dist-all distcheck +am__extra_recursive_targets = examples-recursive +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)` +DIST_SUBDIRS = $(SUBDIRS) +am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/cdi.settings.in \ + $(top_srcdir)/config/compile $(top_srcdir)/config/config.guess \ + $(top_srcdir)/config/config.sub \ + $(top_srcdir)/config/install-sh $(top_srcdir)/config/ltmain.sh \ + $(top_srcdir)/config/missing \ + $(top_srcdir)/src/cmake/cdi/cdi-config-version.cmake.in \ + $(top_srcdir)/src/cmake/cdi/cdi-config.cmake.in \ + $(top_srcdir)/src/pkgconfig/cdi.pc.in \ + $(top_srcdir)/src/pkgconfig/cdi_f2003.pc.in \ + $(top_srcdir)/src/pkgconfig/cdipio.pc.in \ + $(top_srcdir)/tables/gen_tableheaderfile.in AUTHORS COPYING \ + ChangeLog INSTALL NEWS README config/compile \ + config/config.guess config/config.sub config/install-sh \ + config/ltmain.sh config/missing +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 +# Exists only to be overridden by the user if desired. +AM_DISTCHECK_DVI_TARGET = dvi +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@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DCE_UUIDROOT = @DCE_UUIDROOT@ +DCE_UUID_C_INCLUDE = @DCE_UUID_C_INCLUDE@ +DCE_UUID_C_LIB = @DCE_UUID_C_LIB@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECCODES_INCLUDE = @ECCODES_INCLUDE@ +ECCODES_LIBS = @ECCODES_LIBS@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ENABLE_ACROSS = @ENABLE_ACROSS@ +ENABLE_CDI_LIB = @ENABLE_CDI_LIB@ +ENABLE_CGRIBEX = @ENABLE_CGRIBEX@ +ENABLE_EXTRA = @ENABLE_EXTRA@ +ENABLE_GRIB = @ENABLE_GRIB@ +ENABLE_IEG = @ENABLE_IEG@ +ENABLE_MPI = @ENABLE_MPI@ +ENABLE_NC2 = @ENABLE_NC2@ +ENABLE_NC4 = @ENABLE_NC4@ +ENABLE_NC4HDF5 = @ENABLE_NC4HDF5@ +ENABLE_NC4SZLIB = @ENABLE_NC4SZLIB@ +ENABLE_NETCDF = @ENABLE_NETCDF@ +ENABLE_SERVICE = @ENABLE_SERVICE@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FC = @FC@ +FCFLAGS = @FCFLAGS@ +FCFLAGS_f90 = @FCFLAGS_f90@ +FCMODCASE = @FCMODCASE@ +FCMODEXT = @FCMODEXT@ +FC_DEFINE = @FC_DEFINE@ +FC_MOD_FLAG = @FC_MOD_FLAG@ +FC_OPTINC = @FC_OPTINC@ +FDB5_INCLUDE = @FDB5_INCLUDE@ +FDB5_LIBS = @FDB5_LIBS@ +FFLAGS = @FFLAGS@ +FGREP = @FGREP@ +GREP = @GREP@ +GRIB_API_INCLUDE = @GRIB_API_INCLUDE@ +GRIB_API_LIBS = @GRIB_API_LIBS@ +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@ +LIBRT = @LIBRT@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +MPIROOT = @MPIROOT@ +MPI_C_INCLUDE = @MPI_C_INCLUDE@ +MPI_C_LIB = @MPI_C_LIB@ +MPI_FC_LIB = @MPI_FC_LIB@ +MPI_FC_MOD = @MPI_FC_MOD@ +MPI_LAUNCH = @MPI_LAUNCH@ +NC_CONFIG = @NC_CONFIG@ +NETCDF_INCLUDE = @NETCDF_INCLUDE@ +NETCDF_LIBS = @NETCDF_LIBS@ +NETCDF_ROOT = @NETCDF_ROOT@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OPENMP_CFLAGS = @OPENMP_CFLAGS@ +OSSP_UUIDROOT = @OSSP_UUIDROOT@ +OSSP_UUID_C_INCLUDE = @OSSP_UUID_C_INCLUDE@ +OSSP_UUID_C_LIB = @OSSP_UUID_C_LIB@ +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@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PPM_CORE_C_INCLUDE = @PPM_CORE_C_INCLUDE@ +PPM_CORE_C_LIB = @PPM_CORE_C_LIB@ +PTHREAD_CC = @PTHREAD_CC@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +PYTHON = @PYTHON@ +PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ +PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ +PYTHON_LIBS = @PYTHON_LIBS@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PLATFORM_SITE_PKG = @PYTHON_PLATFORM_SITE_PKG@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +RUBY = @RUBY@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +SWIG = @SWIG@ +SYSTEM_TYPE = @SYSTEM_TYPE@ +SZLIB_INCLUDE = @SZLIB_INCLUDE@ +SZLIB_LIBS = @SZLIB_LIBS@ +THREADS_INCLUDE = @THREADS_INCLUDE@ +THREADS_LIBS = @THREADS_LIBS@ +UTIL_LINUX_UUIDROOT = @UTIL_LINUX_UUIDROOT@ +UTIL_LINUX_UUID_C_INCLUDE = @UTIL_LINUX_UUID_C_INCLUDE@ +UTIL_LINUX_UUID_C_LIB = @UTIL_LINUX_UUID_C_LIB@ +UUID_C_INCLUDE = @UUID_C_INCLUDE@ +UUID_C_LIB = @UUID_C_LIB@ +VERSION = @VERSION@ +YAXT_C_INCLUDE = @YAXT_C_INCLUDE@ +YAXT_C_LIB = @YAXT_C_LIB@ +YAXT_FC_LIB = @YAXT_FC_LIB@ +YAXT_FC_MOD = @YAXT_FC_MOD@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_F77 = @ac_ct_F77@ +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@ +ax_pthread_config = @ax_pthread_config@ +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@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ +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@ +SUBDIRS = src interfaces app examples tests +EXTRA_DIST = \ + LICENSE \ + config/interface.rb \ + doc/cdi_cman.pdf \ + doc/cdi_fman.pdf \ + src/cfortran.doc + +ACLOCAL_AMFLAGS = -I m4 +all: all-recursive + +.SUFFIXES: +am--refresh: Makefile + @: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.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 +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__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles);; \ + esac; + +$(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): +cdi.settings: $(top_builddir)/config.status $(srcdir)/cdi.settings.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +src/cmake/cdi/cdi-config-version.cmake: $(top_builddir)/config.status $(top_srcdir)/src/cmake/cdi/cdi-config-version.cmake.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +src/cmake/cdi/cdi-config.cmake: $(top_builddir)/config.status $(top_srcdir)/src/cmake/cdi/cdi-config.cmake.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +src/pkgconfig/cdi.pc: $(top_builddir)/config.status $(top_srcdir)/src/pkgconfig/cdi.pc.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +src/pkgconfig/cdi_f2003.pc: $(top_builddir)/config.status $(top_srcdir)/src/pkgconfig/cdi_f2003.pc.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +src/pkgconfig/cdipio.pc: $(top_builddir)/config.status $(top_srcdir)/src/pkgconfig/cdipio.pc.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +tables/gen_tableheaderfile: $(top_builddir)/config.status $(top_srcdir)/tables/gen_tableheaderfile.in + cd $(top_builddir) && $(SHELL) ./config.status $@ + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool config.lt + +# 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" +examples-local: + +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: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(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) | eval GZIP= gzip $(GZIP_ENV) -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-zstd: distdir + tardir=$(distdir) && $(am__tar) | zstd -c $${ZSTD_CLEVEL-$${ZSTD_OPT--19}} >$(distdir).tar.zst + $(am__post_remove_distdir) + +dist-tarZ: distdir + @echo WARNING: "Support for distribution archives compressed with" \ + "legacy program 'compress' is deprecated." >&2 + @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 + tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z + $(am__post_remove_distdir) + +dist-shar: distdir + @echo WARNING: "Support for shar distribution archives is" \ + "deprecated." >&2 + @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 + shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -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*) \ + eval GZIP= gzip $(GZIP_ENV) -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*) \ + eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\ + *.zip*) \ + unzip $(distdir).zip ;;\ + *.tar.zst*) \ + zstd -dc $(distdir).tar.zst | $(am__untar) ;;\ + esac + chmod -R a-w $(distdir) + chmod u+w $(distdir) + mkdir $(distdir)/_build $(distdir)/_build/sub $(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/sub \ + && ../../configure \ + $(AM_DISTCHECK_CONFIGURE_FLAGS) \ + $(DISTCHECK_CONFIGURE_FLAGS) \ + --srcdir=../.. --prefix="$$dc_install_base" \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) $(AM_DISTCHECK_DVI_TARGET) \ + && $(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: + +examples: examples-recursive + +examples-am: examples-local + +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 dist-zstd distcheck distclean \ + distclean-generic distclean-libtool distclean-tags \ + distcleancheck distdir distuninstallcheck dvi dvi-am \ + examples-am examples-local 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 + +.PRECIOUS: Makefile + + +# The pdf files below cannot be created in parallel: +doc/cdi_cman.pdf: doc/cdi_fman.pdf + +doc/cdi_cman.pdf: + $(AM_V_GEN)$(am__cd) $(top_srcdir)/doc/tex && ./makepdf_c && mv cdi_cman.pdf .. && ./cleanup + +doc/cdi_fman.pdf: + $(AM_V_GEN)$(am__cd) $(top_srcdir)/doc/tex && ./makepdf_f && mv cdi_fman.pdf .. && ./cleanup + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/aclocal.m4 b/aclocal.m4 new file mode 100644 index 0000000000000000000000000000000000000000..6855042898e1ca8f69410e66105466531ca20d52 --- /dev/null +++ b/aclocal.m4 @@ -0,0 +1,1583 @@ +# generated automatically by aclocal 1.16.5 -*- Autoconf -*- + +# Copyright (C) 1996-2021 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-2021 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.16' +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.16.5], [], + [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.16.5])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-2021 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], +[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl +# Expand $ac_aux_dir to an absolute path. +am_aux_dir=`cd "$ac_aux_dir" && pwd` +]) + +# AM_CONDITIONAL -*- Autoconf -*- + +# Copyright (C) 1997-2021 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-2021 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-2021 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. + # TODO: see whether this extra hack can be removed once we start + # requiring Autoconf 2.70 or later. + AS_CASE([$CONFIG_FILES], + [*\'*], [eval set x "$CONFIG_FILES"], + [*], [set x $CONFIG_FILES]) + shift + # Used to flag and report bootstrapping failures. + am_rc=0 + for am_mf + do + # Strip MF so we end up with the name of the file. + am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile which includes + # dependency-tracking related rules and includes. + # Grep'ing the whole file directly is not great: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ + || continue + am_dirpart=`AS_DIRNAME(["$am_mf"])` + am_filepart=`AS_BASENAME(["$am_mf"])` + AM_RUN_LOG([cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles]) || am_rc=$? + done + if test $am_rc -ne 0; then + AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments + for automatic dependency tracking. If GNU make was not used, consider + re-running the configure script with MAKE="gmake" (or whatever is + necessary). You can also try re-running configure with the + '--disable-dependency-tracking' option to at least be able to build + the package (albeit without support for automatic dependency tracking).]) + fi + AS_UNSET([am_dirpart]) + AS_UNSET([am_filepart]) + AS_UNSET([am_mf]) + AS_UNSET([am_rc]) + rm -f conftest-deps.mk +} +])# _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. +# This creates each '.Po' and '.Plo' makefile fragment that we'll 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" MAKE="${MAKE-make}"])]) + +# AM_EXTRA_RECURSIVE_TARGETS -*- Autoconf -*- + +# Copyright (C) 2012-2021 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_EXTRA_RECURSIVE_TARGETS +# -------------------------- +# Define the list of user recursive targets. This macro exists only to +# be traced by Automake, which will ensure that a proper definition of +# user-defined recursive targets (and associated rules) is propagated +# into all the generated Makefiles. +# TODO: We should really reject non-literal arguments here... +AC_DEFUN([AM_EXTRA_RECURSIVE_TARGETS], []) + +# Do all the work for Automake. -*- Autoconf -*- + +# Copyright (C) 1996-2021 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. + +dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O. +m4_define([AC_PROG_CC], +m4_defn([AC_PROG_CC]) +[_AM_PROG_CC_C_O +]) + +# 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 +m4_ifdef([_$0_ALREADY_INIT], + [m4_fatal([$0 expanded multiple times +]m4_defn([_$0_ALREADY_INIT]))], + [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])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_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([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: +# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html> +# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html> +AC_SUBST([mkdir_p], ['$(MKDIR_P)']) +# We need awk for the "check" target (and possibly the TAP driver). 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 +]) +# Variables for tags utilities; see am/tags.am +if test -z "$CTAGS"; then + CTAGS=ctags +fi +AC_SUBST([CTAGS]) +if test -z "$ETAGS"; then + ETAGS=etags +fi +AC_SUBST([ETAGS]) +if test -z "$CSCOPE"; then + CSCOPE=cscope +fi +AC_SUBST([CSCOPE]) + +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 + +# POSIX will say in a future version that running "rm -f" with no argument +# is OK; and we want to be able to make that assumption in our Makefile +# recipes. So use an aggressive probe to check that the usage we want is +# actually supported "in the wild" to an acceptable degree. +# See automake bug#10828. +# To make any issue more visible, cause the running configure to be aborted +# by default if the 'rm' program in use doesn't match our expectations; the +# user can still override this though. +if rm -f && rm -fr && rm -rf; then : OK; else + cat >&2 <<'END' +Oops! + +Your 'rm' program seems unable to run without file operands specified +on the command line, even when the '-f' option is present. This is contrary +to the behaviour of most rm programs out there, and not conforming with +the upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542> + +Please tell bug-automake@gnu.org about your system, including the value +of your $PATH and any error possibly output before this message. This +can help us improve future automake versions. + +END + if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then + echo 'Configuration will proceed anyway, since you have set the' >&2 + echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 + echo >&2 + else + cat >&2 <<'END' +Aborting the configuration process, to ensure you take notice of the issue. + +You can download and install GNU coreutils to get an 'rm' implementation +that behaves properly: <https://www.gnu.org/software/coreutils/>. + +If you want to complete the configuration process using your problematic +'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM +to "yes", and re-run configure. + +END + AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) + fi +fi +dnl The trailing newline in this macro's definition is deliberate, for +dnl backward compatibility and to allow trailing 'dnl'-style comments +dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841. +]) + +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-2021 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+set}" != 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-2021 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-2021 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-2021 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 whether make has an 'include' directive that can support all +# the idioms we need for our automatic dependency tracking code. +AC_DEFUN([AM_MAKE_INCLUDE], +[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive]) +cat > confinc.mk << 'END' +am__doit: + @echo this is the am__doit target >confinc.out +.PHONY: am__doit +END +am__include="#" +am__quote= +# BSD make does it like this. +echo '.include "confinc.mk" # ignored' > confmf.BSD +# Other make implementations (GNU, Solaris 10, AIX) do it like this. +echo 'include confinc.mk # ignored' > confmf.GNU +_am_result=no +for s in GNU BSD; do + AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out]) + AS_CASE([$?:`cat confinc.out 2>/dev/null`], + ['0:this is the am__doit target'], + [AS_CASE([$s], + [BSD], [am__include='.include' am__quote='"'], + [am__include='include' am__quote=''])]) + if test "$am__include" != "#"; then + _am_result="yes ($s style)" + break + fi +done +rm -f confinc.* confmf.* +AC_MSG_RESULT([${_am_result}]) +AC_SUBST([am__include])]) +AC_SUBST([am__quote])]) + +# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- + +# Copyright (C) 1997-2021 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 + MISSING="\${SHELL} '$am_aux_dir/missing'" +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-2021 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])]) + +# Copyright (C) 1999-2021 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_CC_C_O +# --------------- +# Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC +# to automatically call this. +AC_DEFUN([_AM_PROG_CC_C_O], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([compile])dnl +AC_LANG_PUSH([C])dnl +AC_CACHE_CHECK( + [whether $CC understands -c and -o together], + [am_cv_prog_cc_c_o], + [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])]) + # Make sure it works both with $CC and with simple cc. + # Following AC_PROG_CC_C_O, we do the test twice because some + # compilers refuse to overwrite an existing .o file with -o, + # though they will create one. + am_cv_prog_cc_c_o=yes + for am_i in 1 2; do + if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \ + && test -f conftest2.$ac_objext; then + : OK + else + am_cv_prog_cc_c_o=no + break + fi + done + rm -f core conftest* + unset am_i]) +if test "$am_cv_prog_cc_c_o" != yes; then + # Losing compiler, so override with the script. + # FIXME: It is wrong to rewrite CC. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__CC in this case, + # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" + CC="$am_aux_dir/compile $CC" +fi +AC_LANG_POP([C])]) + +# For backward compatibility. +AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) + +# Copyright (C) 1999-2021 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_PATH_PYTHON([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# --------------------------------------------------------------------------- +# Adds support for distributing Python modules and packages. To +# install modules, copy them to $(pythondir), using the python_PYTHON +# automake variable. To install a package with the same name as the +# automake package, install to $(pkgpythondir), or use the +# pkgpython_PYTHON automake variable. +# +# The variables $(pyexecdir) and $(pkgpyexecdir) are provided as +# locations to install python extension modules (shared libraries). +# Another macro is required to find the appropriate flags to compile +# extension modules. +# +# If your package is configured with a different prefix to python, +# users will have to add the install directory to the PYTHONPATH +# environment variable, or create a .pth file (see the python +# documentation for details). +# +# If the MINIMUM-VERSION argument is passed, AM_PATH_PYTHON will +# cause an error if the version of python installed on the system +# doesn't meet the requirement. MINIMUM-VERSION should consist of +# numbers and dots only. +AC_DEFUN([AM_PATH_PYTHON], + [ + dnl Find a Python interpreter. Python versions prior to 2.0 are not + dnl supported. (2.0 was released on October 16, 2000). + m4_define_default([_AM_PYTHON_INTERPRETER_LIST], +[python python2 python3 dnl + python3.9 python3.8 python3.7 python3.6 python3.5 python3.4 python3.3 dnl + python3.2 python3.1 python3.0 dnl + python2.7 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 dnl + python2.0]) + + AC_ARG_VAR([PYTHON], [the Python interpreter]) + + m4_if([$1],[],[ + dnl No version check is needed. + # Find any Python interpreter. + if test -z "$PYTHON"; then + AC_PATH_PROGS([PYTHON], _AM_PYTHON_INTERPRETER_LIST, :) + fi + am_display_PYTHON=python + ], [ + dnl A version check is needed. + if test -n "$PYTHON"; then + # If the user set $PYTHON, use it and don't search something else. + AC_MSG_CHECKING([whether $PYTHON version is >= $1]) + AM_PYTHON_CHECK_VERSION([$PYTHON], [$1], + [AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no]) + AC_MSG_ERROR([Python interpreter is too old])]) + am_display_PYTHON=$PYTHON + else + # Otherwise, try each interpreter until we find one that satisfies + # VERSION. + AC_CACHE_CHECK([for a Python interpreter with version >= $1], + [am_cv_pathless_PYTHON],[ + for am_cv_pathless_PYTHON in _AM_PYTHON_INTERPRETER_LIST none; do + test "$am_cv_pathless_PYTHON" = none && break + AM_PYTHON_CHECK_VERSION([$am_cv_pathless_PYTHON], [$1], [break]) + done]) + # Set $PYTHON to the absolute path of $am_cv_pathless_PYTHON. + if test "$am_cv_pathless_PYTHON" = none; then + PYTHON=: + else + AC_PATH_PROG([PYTHON], [$am_cv_pathless_PYTHON]) + fi + am_display_PYTHON=$am_cv_pathless_PYTHON + fi + ]) + + if test "$PYTHON" = :; then + dnl Run any user-specified action, or abort. + m4_default([$3], [AC_MSG_ERROR([no suitable Python interpreter found])]) + else + + dnl Query Python for its version number. Although site.py simply uses + dnl sys.version[:3], printing that failed with Python 3.10, since the + dnl trailing zero was eliminated. So now we output just the major + dnl and minor version numbers, as numbers. Apparently the tertiary + dnl version is not of interest. + dnl + AC_CACHE_CHECK([for $am_display_PYTHON version], [am_cv_python_version], + [am_cv_python_version=`$PYTHON -c "import sys; print ('%u.%u' % sys.version_info[[:2]])"`]) + AC_SUBST([PYTHON_VERSION], [$am_cv_python_version]) + + dnl At times, e.g., when building shared libraries, you may want + dnl to know which OS platform Python thinks this is. + dnl + AC_CACHE_CHECK([for $am_display_PYTHON platform], [am_cv_python_platform], + [am_cv_python_platform=`$PYTHON -c "import sys; sys.stdout.write(sys.platform)"`]) + AC_SUBST([PYTHON_PLATFORM], [$am_cv_python_platform]) + + dnl emacs-page + dnl If --with-python-sys-prefix is given, use the values of sys.prefix + dnl and sys.exec_prefix for the corresponding values of PYTHON_PREFIX + dnl and PYTHON_EXEC_PREFIX. Otherwise, use the GNU ${prefix} and + dnl ${exec_prefix} variables. + dnl + dnl The two are made distinct variables so they can be overridden if + dnl need be, although general consensus is that you shouldn't need + dnl this separation. + dnl + dnl Also allow directly setting the prefixes via configure options, + dnl overriding any default. + dnl + if test "x$prefix" = xNONE; then + am__usable_prefix=$ac_default_prefix + else + am__usable_prefix=$prefix + fi + + # Allow user to request using sys.* values from Python, + # instead of the GNU $prefix values. + AC_ARG_WITH([python-sys-prefix], + [AS_HELP_STRING([--with-python-sys-prefix], + [use Python's sys.prefix and sys.exec_prefix values])], + [am_use_python_sys=:], + [am_use_python_sys=false]) + + # Allow user to override whatever the default Python prefix is. + AC_ARG_WITH([python_prefix], + [AS_HELP_STRING([--with-python_prefix], + [override the default PYTHON_PREFIX])], + [am_python_prefix_subst=$withval + am_cv_python_prefix=$withval + AC_MSG_CHECKING([for explicit $am_display_PYTHON prefix]) + AC_MSG_RESULT([$am_cv_python_prefix])], + [ + if $am_use_python_sys; then + # using python sys.prefix value, not GNU + AC_CACHE_CHECK([for python default $am_display_PYTHON prefix], + [am_cv_python_prefix], + [am_cv_python_prefix=`$PYTHON -c "import sys; sys.stdout.write(sys.prefix)"`]) + + dnl If sys.prefix is a subdir of $prefix, replace the literal value of + dnl $prefix with a variable reference so it can be overridden. + case $am_cv_python_prefix in + $am__usable_prefix*) + am__strip_prefix=`echo "$am__usable_prefix" | sed 's|.|.|g'` + am_python_prefix_subst=`echo "$am_cv_python_prefix" | sed "s,^$am__strip_prefix,\\${prefix},"` + ;; + *) + am_python_prefix_subst=$am_cv_python_prefix + ;; + esac + else # using GNU prefix value, not python sys.prefix + am_python_prefix_subst='${prefix}' + am_python_prefix=$am_python_prefix_subst + AC_MSG_CHECKING([for GNU default $am_display_PYTHON prefix]) + AC_MSG_RESULT([$am_python_prefix]) + fi]) + # Substituting python_prefix_subst value. + AC_SUBST([PYTHON_PREFIX], [$am_python_prefix_subst]) + + # emacs-page Now do it all over again for Python exec_prefix, but with yet + # another conditional: fall back to regular prefix if that was specified. + AC_ARG_WITH([python_exec_prefix], + [AS_HELP_STRING([--with-python_exec_prefix], + [override the default PYTHON_EXEC_PREFIX])], + [am_python_exec_prefix_subst=$withval + am_cv_python_exec_prefix=$withval + AC_MSG_CHECKING([for explicit $am_display_PYTHON exec_prefix]) + AC_MSG_RESULT([$am_cv_python_exec_prefix])], + [ + # no explicit --with-python_exec_prefix, but if + # --with-python_prefix was given, use its value for python_exec_prefix too. + AS_IF([test -n "$with_python_prefix"], + [am_python_exec_prefix_subst=$with_python_prefix + am_cv_python_exec_prefix=$with_python_prefix + AC_MSG_CHECKING([for python_prefix-given $am_display_PYTHON exec_prefix]) + AC_MSG_RESULT([$am_cv_python_exec_prefix])], + [ + # Set am__usable_exec_prefix whether using GNU or Python values, + # since we use that variable for pyexecdir. + if test "x$exec_prefix" = xNONE; then + am__usable_exec_prefix=$am__usable_prefix + else + am__usable_exec_prefix=$exec_prefix + fi + # + if $am_use_python_sys; then # using python sys.exec_prefix, not GNU + AC_CACHE_CHECK([for python default $am_display_PYTHON exec_prefix], + [am_cv_python_exec_prefix], + [am_cv_python_exec_prefix=`$PYTHON -c "import sys; sys.stdout.write(sys.exec_prefix)"`]) + dnl If sys.exec_prefix is a subdir of $exec_prefix, replace the + dnl literal value of $exec_prefix with a variable reference so it can + dnl be overridden. + case $am_cv_python_exec_prefix in + $am__usable_exec_prefix*) + am__strip_prefix=`echo "$am__usable_exec_prefix" | sed 's|.|.|g'` + am_python_exec_prefix_subst=`echo "$am_cv_python_exec_prefix" | sed "s,^$am__strip_prefix,\\${exec_prefix},"` + ;; + *) + am_python_exec_prefix_subst=$am_cv_python_exec_prefix + ;; + esac + else # using GNU $exec_prefix, not python sys.exec_prefix + am_python_exec_prefix_subst='${exec_prefix}' + am_python_exec_prefix=$am_python_exec_prefix_subst + AC_MSG_CHECKING([for GNU default $am_display_PYTHON exec_prefix]) + AC_MSG_RESULT([$am_python_exec_prefix]) + fi])]) + # Substituting python_exec_prefix_subst. + AC_SUBST([PYTHON_EXEC_PREFIX], [$am_python_exec_prefix_subst]) + + # Factor out some code duplication into this shell variable. + am_python_setup_sysconfig="\ +import sys +# Prefer sysconfig over distutils.sysconfig, for better compatibility +# with python 3.x. See automake bug#10227. +try: + import sysconfig +except ImportError: + can_use_sysconfig = 0 +else: + can_use_sysconfig = 1 +# Can't use sysconfig in CPython 2.7, since it's broken in virtualenvs: +# <https://github.com/pypa/virtualenv/issues/118> +try: + from platform import python_implementation + if python_implementation() == 'CPython' and sys.version[[:3]] == '2.7': + can_use_sysconfig = 0 +except ImportError: + pass" + + dnl emacs-page Set up 4 directories: + + dnl 1. pythondir: where to install python scripts. This is the + dnl site-packages directory, not the python standard library + dnl directory like in previous automake betas. This behavior + dnl is more consistent with lispdir.m4 for example. + dnl Query distutils for this directory. + dnl + AC_CACHE_CHECK([for $am_display_PYTHON script directory (pythondir)], + [am_cv_python_pythondir], + [if test "x$am_cv_python_prefix" = x; then + am_py_prefix=$am__usable_prefix + else + am_py_prefix=$am_cv_python_prefix + fi + am_cv_python_pythondir=`$PYTHON -c " +$am_python_setup_sysconfig +if can_use_sysconfig: + sitedir = sysconfig.get_path('purelib', vars={'base':'$am_py_prefix'}) +else: + from distutils import sysconfig + sitedir = sysconfig.get_python_lib(0, 0, prefix='$am_py_prefix') +sys.stdout.write(sitedir)"` + # + case $am_cv_python_pythondir in + $am_py_prefix*) + am__strip_prefix=`echo "$am_py_prefix" | sed 's|.|.|g'` + am_cv_python_pythondir=`echo "$am_cv_python_pythondir" | sed "s,^$am__strip_prefix,\\${PYTHON_PREFIX},"` + ;; + *) + case $am_py_prefix in + /usr|/System*) ;; + *) am_cv_python_pythondir="\${PYTHON_PREFIX}/lib/python$PYTHON_VERSION/site-packages" + ;; + esac + ;; + esac + ]) + AC_SUBST([pythondir], [$am_cv_python_pythondir]) + + dnl 2. pkgpythondir: $PACKAGE directory under pythondir. Was + dnl PYTHON_SITE_PACKAGE in previous betas, but this naming is + dnl more consistent with the rest of automake. + dnl + AC_SUBST([pkgpythondir], [\${pythondir}/$PACKAGE]) + + dnl 3. pyexecdir: directory for installing python extension modules + dnl (shared libraries). + dnl Query distutils for this directory. + dnl + AC_CACHE_CHECK([for $am_display_PYTHON extension module directory (pyexecdir)], + [am_cv_python_pyexecdir], + [if test "x$am_cv_python_exec_prefix" = x; then + am_py_exec_prefix=$am__usable_exec_prefix + else + am_py_exec_prefix=$am_cv_python_exec_prefix + fi + am_cv_python_pyexecdir=`$PYTHON -c " +$am_python_setup_sysconfig +if can_use_sysconfig: + sitedir = sysconfig.get_path('platlib', vars={'platbase':'$am_py_exec_prefix'}) +else: + from distutils import sysconfig + sitedir = sysconfig.get_python_lib(1, 0, prefix='$am_py_exec_prefix') +sys.stdout.write(sitedir)"` + # + case $am_cv_python_pyexecdir in + $am_py_exec_prefix*) + am__strip_prefix=`echo "$am_py_exec_prefix" | sed 's|.|.|g'` + am_cv_python_pyexecdir=`echo "$am_cv_python_pyexecdir" | sed "s,^$am__strip_prefix,\\${PYTHON_EXEC_PREFIX},"` + ;; + *) + case $am_py_exec_prefix in + /usr|/System*) ;; + *) am_cv_python_pyexecdir="\${PYTHON_EXEC_PREFIX}/lib/python$PYTHON_VERSION/site-packages" + ;; + esac + ;; + esac + ]) + AC_SUBST([pyexecdir], [$am_cv_python_pyexecdir]) + + dnl 4. pkgpyexecdir: $(pyexecdir)/$(PACKAGE) + dnl + AC_SUBST([pkgpyexecdir], [\${pyexecdir}/$PACKAGE]) + + dnl Run any user-specified action. + $2 + fi +]) + + +# AM_PYTHON_CHECK_VERSION(PROG, VERSION, [ACTION-IF-TRUE], [ACTION-IF-FALSE]) +# --------------------------------------------------------------------------- +# Run ACTION-IF-TRUE if the Python interpreter PROG has version >= VERSION. +# Run ACTION-IF-FALSE otherwise. +# This test uses sys.hexversion instead of the string equivalent (first +# word of sys.version), in order to cope with versions such as 2.2c1. +# This supports Python 2.0 or higher. (2.0 was released on October 16, 2000). +AC_DEFUN([AM_PYTHON_CHECK_VERSION], + [prog="import sys +# split strings by '.' and convert to numeric. Append some zeros +# because we need at least 4 digits for the hex conversion. +# map returns an iterator in Python 3.0 and a list in 2.x +minver = list(map(int, '$2'.split('.'))) + [[0, 0, 0]] +minverhex = 0 +# xrange is not present in Python 3.0 and range returns an iterator +for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[[i]] +sys.exit(sys.hexversion < minverhex)" + AS_IF([AM_RUN_LOG([$1 -c "$prog"])], [$3], [$4])]) + +# Copyright (C) 2001-2021 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_RUN_LOG(COMMAND) +# ------------------- +# Run COMMAND, save the exit status in ac_status, and log it. +# (This has been adapted from Autoconf's _AC_RUN_LOG macro.) +AC_DEFUN([AM_RUN_LOG], +[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD + ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + (exit $ac_status); }]) + +# Check to make sure that the build environment is sane. -*- Autoconf -*- + +# Copyright (C) 1996-2021 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-2021 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-2021 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-2021 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-2021 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 <conftest.tar]) + AM_RUN_LOG([cat conftest.dir/file]) + grep GrepMe conftest.dir/file >/dev/null 2>&1 && break + fi + done + rm -rf conftest.dir + + AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) + AC_MSG_RESULT([$am_cv_prog_tar_$1])]) + +AC_SUBST([am__tar]) +AC_SUBST([am__untar]) +]) # _AM_PROG_TAR + +m4_include([m4/acx_assert_lang_is_fortran_variant.m4]) +m4_include([m4/acx_c_package.m4]) +m4_include([m4/acx_cfortran_flags.m4]) +m4_include([m4/acx_check_cfortran.m4]) +m4_include([m4/acx_check_strptr_convert.m4]) +m4_include([m4/acx_execinfo.m4]) +m4_include([m4/acx_fortran_check_include.m4]) +m4_include([m4/acx_fortran_include_flag.m4]) +m4_include([m4/acx_fortran_package.m4]) +m4_include([m4/acx_lang_check_include.m4]) +m4_include([m4/acx_lang_package.m4]) +m4_include([m4/acx_lt_problems.m4]) +m4_include([m4/acx_m4_list_to_quoted_strings.m4]) +m4_include([m4/acx_mpirun.m4]) +m4_include([m4/acx_mv_obj.m4]) +m4_include([m4/acx_option_search_libs.m4]) +m4_include([m4/acx_options.m4]) +m4_include([m4/acx_prog_cc_posix.m4]) +m4_include([m4/acx_sl_fc_mod_path_flag.m4]) +m4_include([m4/acx_sl_mod_suffix.m4]) +m4_include([m4/acx_tls_xlc_retry.m4]) +m4_include([m4/acx_use_libtool_configuration.m4]) +m4_include([m4/acx_uuid.m4]) +m4_include([m4/asx_tr_arg.m4]) +m4_include([m4/asx_unset.m4]) +m4_include([m4/ax_pthread.m4]) +m4_include([m4/ax_python_devel.m4]) +m4_include([m4/ax_tls.m4]) +m4_include([m4/kpse_libtool.m4]) +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]) +m4_include([m4/pkg.m4]) +m4_include([acinclude.m4]) diff --git a/app/Makefile.in b/app/Makefile.in new file mode 100644 index 0000000000000000000000000000000000000000..ac7819dc1c70c8ae7df1144f0d85aeda803559c0 --- /dev/null +++ b/app/Makefile.in @@ -0,0 +1,844 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 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@ + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +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@ +bin_PROGRAMS = $(am__EXEEXT_1) +noinst_PROGRAMS = $(am__EXEEXT_3) $(am__EXEEXT_4) $(am__EXEEXT_5) +check_PROGRAMS = $(am__EXEEXT_2) +@ENABLE_CDI_APP_TRUE@@ENABLE_CDI_LIB_TRUE@am__append_1 = cdi +@ENABLE_CDI_APP_TRUE@@ENABLE_CDI_LIB_FALSE@am__append_2 = cdi +@ENABLE_CDI_APP_TRUE@am__append_3 = createtable +@ENABLE_CDI_APP_FALSE@@with_on_demand_check_programs_TRUE@am__append_4 = cdi +@ENABLE_CDI_APP_FALSE@@with_on_demand_check_programs_FALSE@am__append_5 = cdi +@ENABLE_ALL_STATIC_TRUE@am__append_6 = -all-static +subdir = app +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = \ + $(top_srcdir)/m4/acx_assert_lang_is_fortran_variant.m4 \ + $(top_srcdir)/m4/acx_c_package.m4 \ + $(top_srcdir)/m4/acx_cfortran_flags.m4 \ + $(top_srcdir)/m4/acx_check_cfortran.m4 \ + $(top_srcdir)/m4/acx_check_strptr_convert.m4 \ + $(top_srcdir)/m4/acx_execinfo.m4 \ + $(top_srcdir)/m4/acx_fortran_check_include.m4 \ + $(top_srcdir)/m4/acx_fortran_include_flag.m4 \ + $(top_srcdir)/m4/acx_fortran_package.m4 \ + $(top_srcdir)/m4/acx_lang_check_include.m4 \ + $(top_srcdir)/m4/acx_lang_package.m4 \ + $(top_srcdir)/m4/acx_lt_problems.m4 \ + $(top_srcdir)/m4/acx_m4_list_to_quoted_strings.m4 \ + $(top_srcdir)/m4/acx_mpirun.m4 $(top_srcdir)/m4/acx_mv_obj.m4 \ + $(top_srcdir)/m4/acx_option_search_libs.m4 \ + $(top_srcdir)/m4/acx_options.m4 \ + $(top_srcdir)/m4/acx_prog_cc_posix.m4 \ + $(top_srcdir)/m4/acx_sl_fc_mod_path_flag.m4 \ + $(top_srcdir)/m4/acx_sl_mod_suffix.m4 \ + $(top_srcdir)/m4/acx_tls_xlc_retry.m4 \ + $(top_srcdir)/m4/acx_use_libtool_configuration.m4 \ + $(top_srcdir)/m4/acx_uuid.m4 $(top_srcdir)/m4/asx_tr_arg.m4 \ + $(top_srcdir)/m4/asx_unset.m4 $(top_srcdir)/m4/ax_pthread.m4 \ + $(top_srcdir)/m4/ax_python_devel.m4 $(top_srcdir)/m4/ax_tls.m4 \ + $(top_srcdir)/m4/kpse_libtool.m4 $(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/pkg.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/m4/ac_lang_program_fortran.m4 \ + $(top_srcdir)/m4/acx_lang_fortran_check_include.m4 \ + $(top_srcdir)/m4/acx_lang_c_check_include.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/src/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +@ENABLE_CDI_APP_TRUE@@ENABLE_CDI_LIB_TRUE@am__EXEEXT_1 = cdi$(EXEEXT) +am__installdirs = "$(DESTDIR)$(bindir)" +@ENABLE_CDI_APP_FALSE@@with_on_demand_check_programs_TRUE@am__EXEEXT_2 = cdi$(EXEEXT) +@ENABLE_CDI_APP_TRUE@@ENABLE_CDI_LIB_FALSE@am__EXEEXT_3 = \ +@ENABLE_CDI_APP_TRUE@@ENABLE_CDI_LIB_FALSE@ cdi$(EXEEXT) +@ENABLE_CDI_APP_TRUE@am__EXEEXT_4 = createtable$(EXEEXT) +@ENABLE_CDI_APP_FALSE@@with_on_demand_check_programs_FALSE@am__EXEEXT_5 = cdi$(EXEEXT) +PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS) +am_cdi_OBJECTS = cdi.$(OBJEXT) printinfo.$(OBJEXT) +cdi_OBJECTS = $(am_cdi_OBJECTS) +cdi_LDADD = $(LDADD) +cdi_DEPENDENCIES = $(top_builddir)/src/libcdi.la +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_createtable_OBJECTS = createtable.$(OBJEXT) +createtable_OBJECTS = $(am_createtable_OBJECTS) +createtable_LDADD = $(LDADD) +createtable_DEPENDENCIES = $(top_builddir)/src/libcdi.la +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)/src +depcomp = $(SHELL) $(top_srcdir)/config/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/cdi.Po ./$(DEPDIR)/createtable.Po \ + ./$(DEPDIR)/printinfo.Po +am__mv = mv -f +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 = $(cdi_SOURCES) $(createtable_SOURCES) +DIST_SOURCES = $(cdi_SOURCES) $(createtable_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__extra_recursive_targets = examples-recursive +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)` +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/config/depcomp +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@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DCE_UUIDROOT = @DCE_UUIDROOT@ +DCE_UUID_C_INCLUDE = @DCE_UUID_C_INCLUDE@ +DCE_UUID_C_LIB = @DCE_UUID_C_LIB@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECCODES_INCLUDE = @ECCODES_INCLUDE@ +ECCODES_LIBS = @ECCODES_LIBS@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ENABLE_ACROSS = @ENABLE_ACROSS@ +ENABLE_CDI_LIB = @ENABLE_CDI_LIB@ +ENABLE_CGRIBEX = @ENABLE_CGRIBEX@ +ENABLE_EXTRA = @ENABLE_EXTRA@ +ENABLE_GRIB = @ENABLE_GRIB@ +ENABLE_IEG = @ENABLE_IEG@ +ENABLE_MPI = @ENABLE_MPI@ +ENABLE_NC2 = @ENABLE_NC2@ +ENABLE_NC4 = @ENABLE_NC4@ +ENABLE_NC4HDF5 = @ENABLE_NC4HDF5@ +ENABLE_NC4SZLIB = @ENABLE_NC4SZLIB@ +ENABLE_NETCDF = @ENABLE_NETCDF@ +ENABLE_SERVICE = @ENABLE_SERVICE@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FC = @FC@ +FCFLAGS = @FCFLAGS@ +FCFLAGS_f90 = @FCFLAGS_f90@ +FCMODCASE = @FCMODCASE@ +FCMODEXT = @FCMODEXT@ +FC_DEFINE = @FC_DEFINE@ +FC_MOD_FLAG = @FC_MOD_FLAG@ +FC_OPTINC = @FC_OPTINC@ +FDB5_INCLUDE = @FDB5_INCLUDE@ +FDB5_LIBS = @FDB5_LIBS@ +FFLAGS = @FFLAGS@ +FGREP = @FGREP@ +GREP = @GREP@ +GRIB_API_INCLUDE = @GRIB_API_INCLUDE@ +GRIB_API_LIBS = @GRIB_API_LIBS@ +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@ +LIBRT = @LIBRT@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +MPIROOT = @MPIROOT@ +MPI_C_INCLUDE = @MPI_C_INCLUDE@ +MPI_C_LIB = @MPI_C_LIB@ +MPI_FC_LIB = @MPI_FC_LIB@ +MPI_FC_MOD = @MPI_FC_MOD@ +MPI_LAUNCH = @MPI_LAUNCH@ +NC_CONFIG = @NC_CONFIG@ +NETCDF_INCLUDE = @NETCDF_INCLUDE@ +NETCDF_LIBS = @NETCDF_LIBS@ +NETCDF_ROOT = @NETCDF_ROOT@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OPENMP_CFLAGS = @OPENMP_CFLAGS@ +OSSP_UUIDROOT = @OSSP_UUIDROOT@ +OSSP_UUID_C_INCLUDE = @OSSP_UUID_C_INCLUDE@ +OSSP_UUID_C_LIB = @OSSP_UUID_C_LIB@ +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@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PPM_CORE_C_INCLUDE = @PPM_CORE_C_INCLUDE@ +PPM_CORE_C_LIB = @PPM_CORE_C_LIB@ +PTHREAD_CC = @PTHREAD_CC@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +PYTHON = @PYTHON@ +PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ +PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ +PYTHON_LIBS = @PYTHON_LIBS@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PLATFORM_SITE_PKG = @PYTHON_PLATFORM_SITE_PKG@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +RUBY = @RUBY@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +SWIG = @SWIG@ +SYSTEM_TYPE = @SYSTEM_TYPE@ +SZLIB_INCLUDE = @SZLIB_INCLUDE@ +SZLIB_LIBS = @SZLIB_LIBS@ +THREADS_INCLUDE = @THREADS_INCLUDE@ +THREADS_LIBS = @THREADS_LIBS@ +UTIL_LINUX_UUIDROOT = @UTIL_LINUX_UUIDROOT@ +UTIL_LINUX_UUID_C_INCLUDE = @UTIL_LINUX_UUID_C_INCLUDE@ +UTIL_LINUX_UUID_C_LIB = @UTIL_LINUX_UUID_C_LIB@ +UUID_C_INCLUDE = @UUID_C_INCLUDE@ +UUID_C_LIB = @UUID_C_LIB@ +VERSION = @VERSION@ +YAXT_C_INCLUDE = @YAXT_C_INCLUDE@ +YAXT_C_LIB = @YAXT_C_LIB@ +YAXT_FC_LIB = @YAXT_FC_LIB@ +YAXT_FC_MOD = @YAXT_FC_MOD@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_F77 = @ac_ct_F77@ +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@ +ax_pthread_config = @ax_pthread_config@ +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@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ +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@ +AM_CPPFLAGS = -I$(top_srcdir)/src +AM_LDFLAGS = $(am__append_6) +LDADD = $(top_builddir)/src/libcdi.la +cdi_SOURCES = \ + cdi.c \ + printinfo.c \ + printinfo.h + +createtable_SOURCES = createtable.c + +# Compile programs using Libtool: +COMPILE = $(LTCOMPILE) +FCCOMPILE = $(LTFCCOMPILE) +PPFCCOMPILE = $(LTPPFCCOMPILE) +CXXCOMPILE = $(LTCXXCOMPILE) + +# Compile *.F90 without CPPFLAGS, which are normally meant for the C compiler +# and might not be compatible with the Fortran compiler: +LTPPFCCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=FC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) + + +# Avoid compiling twice by running Libtool with '-static' +# This is safe because all Libtool libraries in this directory are +# static-only and contain PIC objects: +AM_CFLAGS = -static +AM_FCFLAGS = -static +AM_CXXFLAGS = -static +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.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 app/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign app/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__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(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-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p \ + || test -f $$p1 \ + ; then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' \ + -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' \ + `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(bindir)" && rm -f $$files + +clean-binPROGRAMS: + @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +clean-checkPROGRAMS: + @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +cdi$(EXEEXT): $(cdi_OBJECTS) $(cdi_DEPENDENCIES) $(EXTRA_cdi_DEPENDENCIES) + @rm -f cdi$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(cdi_OBJECTS) $(cdi_LDADD) $(LIBS) + +createtable$(EXEEXT): $(createtable_OBJECTS) $(createtable_DEPENDENCIES) $(EXTRA_createtable_DEPENDENCIES) + @rm -f createtable$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(createtable_OBJECTS) $(createtable_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdi.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/createtable.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/printinfo.Po@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.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 -o $@ $< + +.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 -o $@ `$(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 +examples-local: + +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: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) +check: check-am +all-am: Makefile $(PROGRAMS) +installdirs: + for dir in "$(DESTDIR)$(bindir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-binPROGRAMS clean-checkPROGRAMS clean-generic \ + clean-libtool clean-local clean-noinstPROGRAMS mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/cdi.Po + -rm -f ./$(DEPDIR)/createtable.Po + -rm -f ./$(DEPDIR)/printinfo.Po + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +examples: examples-am + +examples-am: examples-local + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-binPROGRAMS + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/cdi.Po + -rm -f ./$(DEPDIR)/createtable.Po + -rm -f ./$(DEPDIR)/printinfo.Po + -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-binPROGRAMS + +.MAKE: check-am install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-binPROGRAMS clean-checkPROGRAMS clean-generic \ + clean-libtool clean-local clean-noinstPROGRAMS cscopelist-am \ + ctags ctags-am distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am \ + examples-am examples-local html html-am info info-am install \ + install-am install-binPROGRAMS install-data install-data-am \ + install-dvi install-dvi-am install-exec install-exec-am \ + install-html install-html-am install-info install-info-am \ + install-man install-pdf install-pdf-am install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ + uninstall-am uninstall-binPROGRAMS + +.PRECIOUS: Makefile + + +clean-local: + -rm -rf *.dSYM + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/config/compile b/config/compile new file mode 100755 index 0000000000000000000000000000000000000000..df363c8fbfbcbba9df21d8c9455b58c038697b61 --- /dev/null +++ b/config/compile @@ -0,0 +1,348 @@ +#! /bin/sh +# Wrapper for compilers which do not understand '-c -o'. + +scriptversion=2018-03-07.03; # UTC + +# Copyright (C) 1999-2021 Free Software Foundation, Inc. +# Written by Tom Tromey <tromey@cygnus.com>. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. + +# 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 <bug-automake@gnu.org> or send patches to +# <automake-patches@gnu.org>. + +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* | MSYS*) + 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/* | msys/*) + 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 <bug-automake@gnu.org>. +EOF + exit $? + ;; + -v | --v*) + echo "compile $scriptversion" + exit $? + ;; + cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \ + icl | *[/\\]icl | icl.exe | *[/\\]icl.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 'before-save-hook 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC0" +# time-stamp-end: "; # UTC" +# End: diff --git a/config/config.guess b/config/config.guess new file mode 100755 index 0000000000000000000000000000000000000000..69188da73d74371bc500cc82b4d00a583e21ef3d --- /dev/null +++ b/config/config.guess @@ -0,0 +1,1774 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright 1992-2023 Free Software Foundation, Inc. + +# shellcheck disable=SC2006,SC2268 # see below for rationale + +timestamp='2023-01-01' + +# 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 <https://www.gnu.org/licenses/>. +# +# 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; maintained since 2000 by Ben Elliston. +# +# You can get the latest version of this script from: +# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess +# +# Please send patches to <config-patches@gnu.org>. + + +# The "shellcheck disable" line above the timestamp inhibits complaints +# about features and limitations of the classic Bourne shell that were +# superseded or lifted in POSIX. However, this script identifies a wide +# variety of pre-POSIX systems that do not have POSIX shells at all, and +# even some reasonably current systems (Solaris 10 as case-in-point) still +# have a pre-POSIX /bin/sh. + + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Options: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to <config-patches@gnu.org>." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright 1992-2023 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 + +# Just in case it came from the environment. +GUESS= + +# 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. + +tmp= +# shellcheck disable=SC2172 +trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15 + +set_cc_for_build() { + # prevent multiple calls if $tmp is already set + test "$tmp" && return 0 + : "${TMPDIR=/tmp}" + # shellcheck disable=SC2039,SC3028 + { 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" 2>/dev/null) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } + dummy=$tmp/dummy + case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in + ,,) echo "int x;" > "$dummy.c" + for driver in cc gcc c89 c99 ; do + if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then + CC_FOR_BUILD=$driver + 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 +} + +# 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 ; 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/*) + LIBC=unknown + + set_cc_for_build + cat <<-EOF > "$dummy.c" + #include <features.h> + #if defined(__UCLIBC__) + LIBC=uclibc + #elif defined(__dietlibc__) + LIBC=dietlibc + #elif defined(__GLIBC__) + LIBC=gnu + #else + #include <stdarg.h> + /* First heuristic to detect musl libc. */ + #ifdef __DEFINED_va_list + LIBC=musl + #endif + #endif + EOF + cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` + eval "$cc_set_libc" + + # Second heuristic to detect musl libc. + if [ "$LIBC" = unknown ] && + command -v ldd >/dev/null && + ldd --version 2>&1 | grep -q ^musl; then + LIBC=musl + fi + + # If the system lacks a compiler, then just pick glibc. + # We could probably try harder. + if [ "$LIBC" = unknown ]; then + LIBC=gnu + fi + ;; +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". + UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ + /sbin/sysctl -n hw.machine_arch 2>/dev/null || \ + /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \ + echo unknown)` + case $UNAME_MACHINE_ARCH in + aarch64eb) machine=aarch64_be-unknown ;; + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + sh5el) machine=sh5le-unknown ;; + earmv*) + arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'` + endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'` + machine=${arch}${endian}-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) and ABI. + case $UNAME_MACHINE_ARCH in + earm*) + os=netbsdelf + ;; + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + 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 + # Determine ABI tags. + case $UNAME_MACHINE_ARCH in + earm*) + expr='s/^earmv[0-9]/-eabi/;s/eb$//' + abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"` + ;; + 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/[-_].*//' | cut -d. -f1,2` + ;; + esac + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + GUESS=$machine-${os}${release}${abi-} + ;; + *:Bitrig:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` + GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE + ;; + *:OpenBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE + ;; + *:SecBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'` + GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE + ;; + *:LibertyBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` + GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE + ;; + *:MidnightBSD:*:*) + GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE + ;; + *:ekkoBSD:*:*) + GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE + ;; + *:SolidBSD:*:*) + GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE + ;; + *:OS108:*:*) + GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE + ;; + macppc:MirBSD:*:*) + GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE + ;; + *:MirBSD:*:*) + GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE + ;; + *:Sortix:*:*) + GUESS=$UNAME_MACHINE-unknown-sortix + ;; + *:Twizzler:*:*) + GUESS=$UNAME_MACHINE-unknown-twizzler + ;; + *:Redox:*:*) + GUESS=$UNAME_MACHINE-unknown-redox + ;; + mips:OSF1:*.*) + GUESS=mips-dec-osf1 + ;; + alpha:OSF1:*:*) + # Reset EXIT trap before exiting to avoid spurious non-zero exit code. + trap '' 0 + 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. + OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` + GUESS=$UNAME_MACHINE-dec-osf$OSF_REL + ;; + Amiga*:UNIX_System_V:4.0:*) + GUESS=m68k-unknown-sysv4 + ;; + *:[Aa]miga[Oo][Ss]:*:*) + GUESS=$UNAME_MACHINE-unknown-amigaos + ;; + *:[Mm]orph[Oo][Ss]:*:*) + GUESS=$UNAME_MACHINE-unknown-morphos + ;; + *:OS/390:*:*) + GUESS=i370-ibm-openedition + ;; + *:z/VM:*:*) + GUESS=s390-ibm-zvmoe + ;; + *:OS400:*:*) + GUESS=powerpc-ibm-os400 + ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + GUESS=arm-acorn-riscix$UNAME_RELEASE + ;; + arm*:riscos:*:*|arm*:RISCOS:*:*) + GUESS=arm-unknown-riscos + ;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + GUESS=hppa1.1-hitachi-hiuxmpp + ;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + case `(/bin/universe) 2>/dev/null` in + att) GUESS=pyramid-pyramid-sysv3 ;; + *) GUESS=pyramid-pyramid-bsd ;; + esac + ;; + NILE*:*:*:dcosx) + GUESS=pyramid-pyramid-svr4 + ;; + DRS?6000:unix:4.0:6*) + GUESS=sparc-icl-nx6 + ;; + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) GUESS=sparc-icl-nx7 ;; + esac + ;; + s390x:SunOS:*:*) + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL + ;; + sun4H:SunOS:5.*:*) + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=sparc-hal-solaris2$SUN_REL + ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=sparc-sun-solaris2$SUN_REL + ;; + i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) + GUESS=i386-pc-auroraux$UNAME_RELEASE + ;; + i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) + 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 test "$CC_FOR_BUILD" != no_compiler_found; then + if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -m64 -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + SUN_ARCH=x86_64 + fi + fi + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=$SUN_ARCH-pc-solaris2$SUN_REL + ;; + 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. + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=sparc-sun-solaris3$SUN_REL + ;; + 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'. + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'` + GUESS=sparc-sun-sunos$SUN_REL + ;; + sun3*:SunOS:*:*) + GUESS=m68k-sun-sunos$UNAME_RELEASE + ;; + 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) + GUESS=m68k-sun-sunos$UNAME_RELEASE + ;; + sun4) + GUESS=sparc-sun-sunos$UNAME_RELEASE + ;; + esac + ;; + aushp:SunOS:*:*) + GUESS=sparc-auspex-sunos$UNAME_RELEASE + ;; + # 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:*:*) + GUESS=m68k-atari-mint$UNAME_RELEASE + ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + GUESS=m68k-atari-mint$UNAME_RELEASE + ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + GUESS=m68k-atari-mint$UNAME_RELEASE + ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + GUESS=m68k-milan-mint$UNAME_RELEASE + ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + GUESS=m68k-hades-mint$UNAME_RELEASE + ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + GUESS=m68k-unknown-mint$UNAME_RELEASE + ;; + m68k:machten:*:*) + GUESS=m68k-apple-machten$UNAME_RELEASE + ;; + powerpc:machten:*:*) + GUESS=powerpc-apple-machten$UNAME_RELEASE + ;; + RISC*:Mach:*:*) + GUESS=mips-dec-mach_bsd4.3 + ;; + RISC*:ULTRIX:*:*) + GUESS=mips-dec-ultrix$UNAME_RELEASE + ;; + VAX*:ULTRIX*:*:*) + GUESS=vax-dec-ultrix$UNAME_RELEASE + ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + GUESS=clipper-intergraph-clix$UNAME_RELEASE + ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + set_cc_for_build + sed 's/^ //' << EOF > "$dummy.c" +#ifdef __cplusplus +#include <stdio.h> /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD -o "$dummy" "$dummy.c" && + dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`"$dummy" "$dummyarg"` && + { echo "$SYSTEM_NAME"; exit; } + GUESS=mips-mips-riscos$UNAME_RELEASE + ;; + Motorola:PowerMAX_OS:*:*) + GUESS=powerpc-motorola-powermax + ;; + Motorola:*:4.3:PL8-*) + GUESS=powerpc-harris-powermax + ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + GUESS=powerpc-harris-powermax + ;; + Night_Hawk:Power_UNIX:*:*) + GUESS=powerpc-harris-powerunix + ;; + m88k:CX/UX:7*:*) + GUESS=m88k-harris-cxux7 + ;; + m88k:*:4*:R4*) + GUESS=m88k-motorola-sysv4 + ;; + m88k:*:3*:R3*) + GUESS=m88k-motorola-sysv3 + ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110 + then + if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \ + test "$TARGET_BINARY_INTERFACE"x = x + then + GUESS=m88k-dg-dgux$UNAME_RELEASE + else + GUESS=m88k-dg-dguxbcs$UNAME_RELEASE + fi + else + GUESS=i586-dg-dgux$UNAME_RELEASE + fi + ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + GUESS=m88k-dolphin-sysv3 + ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + GUESS=m88k-motorola-sysv3 + ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + GUESS=m88k-tektronix-sysv3 + ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + GUESS=m68k-tektronix-bsd + ;; + *:IRIX*:*:*) + IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'` + GUESS=mips-sgi-irix$IRIX_REL + ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + GUESS=romp-ibm-aix # uname -m gives an 8 hex-code CPU id + ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + GUESS=i386-ibm-aix + ;; + ia64:AIX:*:*) + if test -x /usr/bin/oslevel ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=$UNAME_VERSION.$UNAME_RELEASE + fi + GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV + ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + set_cc_for_build + sed 's/^ //' << EOF > "$dummy.c" + #include <sys/systemcfg.h> + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` + then + GUESS=$SYSTEM_NAME + else + GUESS=rs6000-ibm-aix3.2.5 + fi + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + GUESS=rs6000-ibm-aix3.2.4 + else + GUESS=rs6000-ibm-aix3.2 + fi + ;; + *: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 test -x /usr/bin/lslpp ; then + IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \ + awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` + else + IBM_REV=$UNAME_VERSION.$UNAME_RELEASE + fi + GUESS=$IBM_ARCH-ibm-aix$IBM_REV + ;; + *:AIX:*:*) + GUESS=rs6000-ibm-aix + ;; + ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*) + GUESS=romp-ibm-bsd4.4 + ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + GUESS=romp-ibm-bsd$UNAME_RELEASE # 4.3 with uname added to + ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + GUESS=rs6000-bull-bosx + ;; + DPX/2?00:B.O.S.:*:*) + GUESS=m68k-bull-sysv3 + ;; + 9000/[34]??:4.3bsd:1.*:*) + GUESS=m68k-hp-bsd + ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + GUESS=m68k-hp-bsd4.4 + ;; + 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 test -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 test "$HP_ARCH" = ""; then + set_cc_for_build + sed 's/^ //' << EOF > "$dummy.c" + + #define _HPUX_SOURCE + #include <stdlib.h> + #include <unistd.h> + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"` + test -z "$HP_ARCH" && HP_ARCH=hppa + fi ;; + esac + if test "$HP_ARCH" = hppa2.0w + then + 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 + GUESS=$HP_ARCH-hp-hpux$HPUX_REV + ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'` + GUESS=ia64-hp-hpux$HPUX_REV + ;; + 3050*:HI-UX:*:*) + set_cc_for_build + sed 's/^ //' << EOF > "$dummy.c" + #include <unistd.h> + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` && + { echo "$SYSTEM_NAME"; exit; } + GUESS=unknown-hitachi-hiuxwe2 + ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*) + GUESS=hppa1.1-hp-bsd + ;; + 9000/8??:4.3bsd:*:*) + GUESS=hppa1.0-hp-bsd + ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + GUESS=hppa1.0-hp-mpeix + ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*) + GUESS=hppa1.1-hp-osf + ;; + hp8??:OSF1:*:*) + GUESS=hppa1.0-hp-osf + ;; + i*86:OSF1:*:*) + if test -x /usr/sbin/sysversion ; then + GUESS=$UNAME_MACHINE-unknown-osf1mk + else + GUESS=$UNAME_MACHINE-unknown-osf1 + fi + ;; + parisc*:Lites*:*:*) + GUESS=hppa1.1-hp-lites + ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + GUESS=c1-convex-bsd + ;; + 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*:*) + GUESS=c34-convex-bsd + ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + GUESS=c38-convex-bsd + ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + GUESS=c4-convex-bsd + ;; + CRAY*Y-MP:*:*:*) + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=ymp-cray-unicos$CRAY_REL + ;; + 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:*:*:*) + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=t90-cray-unicos$CRAY_REL + ;; + CRAY*T3E:*:*:*) + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=alphaev5-cray-unicosmk$CRAY_REL + ;; + CRAY*SV1:*:*:*) + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=sv1-cray-unicos$CRAY_REL + ;; + *:UNICOS/mp:*:*) + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=craynv-cray-unicosmp$CRAY_REL + ;; + 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/ /_/'` + GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL} + ;; + 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/ /_/'` + GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL} + ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE + ;; + sparc*:BSD/OS:*:*) + GUESS=sparc-unknown-bsdi$UNAME_RELEASE + ;; + *:BSD/OS:*:*) + GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE + ;; + arm:FreeBSD:*:*) + UNAME_PROCESSOR=`uname -p` + set_cc_for_build + if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_PCS_VFP + then + FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi + else + FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf + fi + ;; + *:FreeBSD:*:*) + UNAME_PROCESSOR=`/usr/bin/uname -p` + case $UNAME_PROCESSOR in + amd64) + UNAME_PROCESSOR=x86_64 ;; + i386) + UNAME_PROCESSOR=i586 ;; + esac + FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL + ;; + i*:CYGWIN*:*) + GUESS=$UNAME_MACHINE-pc-cygwin + ;; + *:MINGW64*:*) + GUESS=$UNAME_MACHINE-pc-mingw64 + ;; + *:MINGW*:*) + GUESS=$UNAME_MACHINE-pc-mingw32 + ;; + *:MSYS*:*) + GUESS=$UNAME_MACHINE-pc-msys + ;; + i*:PW*:*) + GUESS=$UNAME_MACHINE-pc-pw32 + ;; + *:SerenityOS:*:*) + GUESS=$UNAME_MACHINE-pc-serenity + ;; + *:Interix*:*) + case $UNAME_MACHINE in + x86) + GUESS=i586-pc-interix$UNAME_RELEASE + ;; + authenticamd | genuineintel | EM64T) + GUESS=x86_64-unknown-interix$UNAME_RELEASE + ;; + IA64) + GUESS=ia64-unknown-interix$UNAME_RELEASE + ;; + esac ;; + i*:UWIN*:*) + GUESS=$UNAME_MACHINE-pc-uwin + ;; + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) + GUESS=x86_64-pc-cygwin + ;; + prep*:SunOS:5.*:*) + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=powerpcle-unknown-solaris2$SUN_REL + ;; + *:GNU:*:*) + # the GNU system + GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'` + GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'` + GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL + ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"` + GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC + ;; + x86_64:[Mm]anagarm:*:*|i?86:[Mm]anagarm:*:*) + GUESS="$UNAME_MACHINE-pc-managarm-mlibc" + ;; + *:[Mm]anagarm:*:*) + GUESS="$UNAME_MACHINE-unknown-managarm-mlibc" + ;; + *:Minix:*:*) + GUESS=$UNAME_MACHINE-unknown-minix + ;; + aarch64:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + aarch64_be:Linux:*:*) + UNAME_MACHINE=aarch64_be + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` 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 + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + arm*:Linux:*:*) + set_cc_for_build + if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_EABI__ + then + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + else + if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_PCS_VFP + then + GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi + else + GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf + fi + fi + ;; + avr32*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + cris:Linux:*:*) + GUESS=$UNAME_MACHINE-axis-linux-$LIBC + ;; + crisv32:Linux:*:*) + GUESS=$UNAME_MACHINE-axis-linux-$LIBC + ;; + e2k:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + frv:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + hexagon:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + i*86:Linux:*:*) + GUESS=$UNAME_MACHINE-pc-linux-$LIBC + ;; + ia64:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + k1om:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + loongarch32:Linux:*:* | loongarch64:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + m32r*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + m68*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + mips:Linux:*:* | mips64:Linux:*:*) + set_cc_for_build + IS_GLIBC=0 + test x"${LIBC}" = xgnu && IS_GLIBC=1 + sed 's/^ //' << EOF > "$dummy.c" + #undef CPU + #undef mips + #undef mipsel + #undef mips64 + #undef mips64el + #if ${IS_GLIBC} && defined(_ABI64) + LIBCABI=gnuabi64 + #else + #if ${IS_GLIBC} && defined(_ABIN32) + LIBCABI=gnuabin32 + #else + LIBCABI=${LIBC} + #endif + #endif + + #if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 + CPU=mipsisa64r6 + #else + #if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 + CPU=mipsisa32r6 + #else + #if defined(__mips64) + CPU=mips64 + #else + CPU=mips + #endif + #endif + #endif + + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + MIPS_ENDIAN=el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + MIPS_ENDIAN= + #else + MIPS_ENDIAN= + #endif + #endif +EOF + cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'` + eval "$cc_set_vars" + test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; } + ;; + mips64el:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + openrisc*:Linux:*:*) + GUESS=or1k-unknown-linux-$LIBC + ;; + or32:Linux:*:* | or1k*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + padre:Linux:*:*) + GUESS=sparc-unknown-linux-$LIBC + ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + GUESS=hppa64-unknown-linux-$LIBC + ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;; + PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;; + *) GUESS=hppa-unknown-linux-$LIBC ;; + esac + ;; + ppc64:Linux:*:*) + GUESS=powerpc64-unknown-linux-$LIBC + ;; + ppc:Linux:*:*) + GUESS=powerpc-unknown-linux-$LIBC + ;; + ppc64le:Linux:*:*) + GUESS=powerpc64le-unknown-linux-$LIBC + ;; + ppcle:Linux:*:*) + GUESS=powerpcle-unknown-linux-$LIBC + ;; + riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + s390:Linux:*:* | s390x:Linux:*:*) + GUESS=$UNAME_MACHINE-ibm-linux-$LIBC + ;; + sh64*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + sh*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + tile*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + vax:Linux:*:*) + GUESS=$UNAME_MACHINE-dec-linux-$LIBC + ;; + x86_64:Linux:*:*) + set_cc_for_build + CPU=$UNAME_MACHINE + LIBCABI=$LIBC + if test "$CC_FOR_BUILD" != no_compiler_found; then + ABI=64 + sed 's/^ //' << EOF > "$dummy.c" + #ifdef __i386__ + ABI=x86 + #else + #ifdef __ILP32__ + ABI=x32 + #endif + #endif +EOF + cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'` + eval "$cc_set_abi" + case $ABI in + x86) CPU=i686 ;; + x32) LIBCABI=${LIBC}x32 ;; + esac + fi + GUESS=$CPU-pc-linux-$LIBCABI + ;; + xtensa*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + 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. + GUESS=i386-sequent-sysv4 + ;; + 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. + GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION + ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + GUESS=$UNAME_MACHINE-pc-os2-emx + ;; + i*86:XTS-300:*:STOP) + GUESS=$UNAME_MACHINE-unknown-stop + ;; + i*86:atheos:*:*) + GUESS=$UNAME_MACHINE-unknown-atheos + ;; + i*86:syllable:*:*) + GUESS=$UNAME_MACHINE-pc-syllable + ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) + GUESS=i386-unknown-lynxos$UNAME_RELEASE + ;; + i*86:*DOS:*:*) + GUESS=$UNAME_MACHINE-pc-msdosdjgpp + ;; + i*86:*:4.*:*) + UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL + else + GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL + fi + ;; + 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 + GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name` + GUESS=$UNAME_MACHINE-pc-isc$UNAME_REL + elif /bin/uname -X 2>/dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL + else + GUESS=$UNAME_MACHINE-pc-sysv32 + fi + ;; + 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 configure will decide that + # this is a cross-build. + GUESS=i586-pc-msdosdjgpp + ;; + Intel:Mach:3*:*) + GUESS=i386-pc-mach3 + ;; + paragon:*:*:*) + GUESS=i860-intel-osf1 + ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + GUESS=i860-stardent-sysv$UNAME_RELEASE # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + GUESS=i860-unknown-sysv$UNAME_RELEASE # Unknown i860-SVR4 + fi + ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + GUESS=m68010-convergent-sysv + ;; + mc68k:UNIX:SYSTEM5:3.51m) + GUESS=m68k-convergent-sysv + ;; + M680?0:D-NIX:5.3:*) + GUESS=m68k-diab-dnix + ;; + 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*:*) + GUESS=m68k-unknown-lynxos$UNAME_RELEASE + ;; + mc68030:UNIX_System_V:4.*:*) + GUESS=m68k-atari-sysv4 + ;; + TSUNAMI:LynxOS:2.*:*) + GUESS=sparc-unknown-lynxos$UNAME_RELEASE + ;; + rs6000:LynxOS:2.*:*) + GUESS=rs6000-unknown-lynxos$UNAME_RELEASE + ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) + GUESS=powerpc-unknown-lynxos$UNAME_RELEASE + ;; + SM[BE]S:UNIX_SV:*:*) + GUESS=mips-dde-sysv$UNAME_RELEASE + ;; + RM*:ReliantUNIX-*:*:*) + GUESS=mips-sni-sysv4 + ;; + RM*:SINIX-*:*:*) + GUESS=mips-sni-sysv4 + ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + GUESS=$UNAME_MACHINE-sni-sysv4 + else + GUESS=ns32k-sni-sysv + fi + ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says <Richard.M.Bartel@ccMail.Census.GOV> + GUESS=i586-unisys-sysv4 + ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes <hewes@openmarket.com>. + # How about differentiating between stratus architectures? -djm + GUESS=hppa1.1-stratus-sysv4 + ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + GUESS=i860-stratus-sysv4 + ;; + i*86:VOS:*:*) + # From Paul.Green@stratus.com. + GUESS=$UNAME_MACHINE-stratus-vos + ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + GUESS=hppa1.1-stratus-vos + ;; + mc68*:A/UX:*:*) + GUESS=m68k-apple-aux$UNAME_RELEASE + ;; + news*:NEWS-OS:6*:*) + GUESS=mips-sony-newsos6 + ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if test -d /usr/nec; then + GUESS=mips-nec-sysv$UNAME_RELEASE + else + GUESS=mips-unknown-sysv$UNAME_RELEASE + fi + ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + GUESS=powerpc-be-beos + ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + GUESS=powerpc-apple-beos + ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + GUESS=i586-pc-beos + ;; + BePC:Haiku:*:*) # Haiku running on Intel PC compatible. + GUESS=i586-pc-haiku + ;; + ppc:Haiku:*:*) # Haiku running on Apple PowerPC + GUESS=powerpc-apple-haiku + ;; + *:Haiku:*:*) # Haiku modern gcc (not bound by BeOS compat) + GUESS=$UNAME_MACHINE-unknown-haiku + ;; + SX-4:SUPER-UX:*:*) + GUESS=sx4-nec-superux$UNAME_RELEASE + ;; + SX-5:SUPER-UX:*:*) + GUESS=sx5-nec-superux$UNAME_RELEASE + ;; + SX-6:SUPER-UX:*:*) + GUESS=sx6-nec-superux$UNAME_RELEASE + ;; + SX-7:SUPER-UX:*:*) + GUESS=sx7-nec-superux$UNAME_RELEASE + ;; + SX-8:SUPER-UX:*:*) + GUESS=sx8-nec-superux$UNAME_RELEASE + ;; + SX-8R:SUPER-UX:*:*) + GUESS=sx8r-nec-superux$UNAME_RELEASE + ;; + SX-ACE:SUPER-UX:*:*) + GUESS=sxace-nec-superux$UNAME_RELEASE + ;; + Power*:Rhapsody:*:*) + GUESS=powerpc-apple-rhapsody$UNAME_RELEASE + ;; + *:Rhapsody:*:*) + GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE + ;; + arm64:Darwin:*:*) + GUESS=aarch64-apple-darwin$UNAME_RELEASE + ;; + *:Darwin:*:*) + UNAME_PROCESSOR=`uname -p` + case $UNAME_PROCESSOR in + unknown) UNAME_PROCESSOR=powerpc ;; + esac + if command -v xcode-select > /dev/null 2> /dev/null && \ + ! xcode-select --print-path > /dev/null 2> /dev/null ; then + # Avoid executing cc if there is no toolchain installed as + # cc will be a stub that puts up a graphical alert + # prompting the user to install developer tools. + CC_FOR_BUILD=no_compiler_found + else + set_cc_for_build + fi + if test "$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 + # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc + if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_PPC >/dev/null + then + UNAME_PROCESSOR=powerpc + fi + elif test "$UNAME_PROCESSOR" = i386 ; then + # uname -m returns i386 or x86_64 + UNAME_PROCESSOR=$UNAME_MACHINE + fi + GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE + ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = x86; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE + ;; + *:QNX:*:4*) + GUESS=i386-pc-qnx + ;; + NEO-*:NONSTOP_KERNEL:*:*) + GUESS=neo-tandem-nsk$UNAME_RELEASE + ;; + NSE-*:NONSTOP_KERNEL:*:*) + GUESS=nse-tandem-nsk$UNAME_RELEASE + ;; + NSR-*:NONSTOP_KERNEL:*:*) + GUESS=nsr-tandem-nsk$UNAME_RELEASE + ;; + NSV-*:NONSTOP_KERNEL:*:*) + GUESS=nsv-tandem-nsk$UNAME_RELEASE + ;; + NSX-*:NONSTOP_KERNEL:*:*) + GUESS=nsx-tandem-nsk$UNAME_RELEASE + ;; + *:NonStop-UX:*:*) + GUESS=mips-compaq-nonstopux + ;; + BS2000:POSIX*:*:*) + GUESS=bs2000-siemens-sysv + ;; + DS/*:UNIX_System_V:*:*) + GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE + ;; + *: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 + elif test "x${cputype-}" != x; then + UNAME_MACHINE=$cputype + fi + GUESS=$UNAME_MACHINE-unknown-plan9 + ;; + *:TOPS-10:*:*) + GUESS=pdp10-unknown-tops10 + ;; + *:TENEX:*:*) + GUESS=pdp10-unknown-tenex + ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + GUESS=pdp10-dec-tops20 + ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + GUESS=pdp10-xkl-tops20 + ;; + *:TOPS-20:*:*) + GUESS=pdp10-unknown-tops20 + ;; + *:ITS:*:*) + GUESS=pdp10-unknown-its + ;; + SEI:*:*:SEIUX) + GUESS=mips-sei-seiux$UNAME_RELEASE + ;; + *:DragonFly:*:*) + DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL + ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case $UNAME_MACHINE in + A*) GUESS=alpha-dec-vms ;; + I*) GUESS=ia64-dec-vms ;; + V*) GUESS=vax-dec-vms ;; + esac ;; + *:XENIX:*:SysV) + GUESS=i386-pc-xenix + ;; + i*86:skyos:*:*) + SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'` + GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL + ;; + i*86:rdos:*:*) + GUESS=$UNAME_MACHINE-pc-rdos + ;; + i*86:Fiwix:*:*) + GUESS=$UNAME_MACHINE-pc-fiwix + ;; + *:AROS:*:*) + GUESS=$UNAME_MACHINE-unknown-aros + ;; + x86_64:VMkernel:*:*) + GUESS=$UNAME_MACHINE-unknown-esx + ;; + amd64:Isilon\ OneFS:*:*) + GUESS=x86_64-unknown-onefs + ;; + *:Unleashed:*:*) + GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE + ;; +esac + +# Do we have a guess based on uname results? +if test "x$GUESS" != x; then + echo "$GUESS" + exit +fi + +# No uname command or uname output not recognized. +set_cc_for_build +cat > "$dummy.c" <<EOF +#ifdef _SEQUENT_ +#include <sys/types.h> +#include <sys/utsname.h> +#endif +#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) +#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) +#include <signal.h> +#if defined(_SIZE_T_) || defined(SIGLOST) +#include <sys/utsname.h> +#endif +#endif +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include <sys/param.h> + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); +#endif + +#if defined (vax) +#if !defined (ultrix) +#include <sys/param.h> +#if defined (BSD) +#if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +#else +#if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +#else + printf ("vax-dec-bsd\n"); exit (0); +#endif +#endif +#else + printf ("vax-dec-bsd\n"); exit (0); +#endif +#else +#if defined(_SIZE_T_) || defined(SIGLOST) + struct utsname un; + uname (&un); + printf ("vax-dec-ultrix%s\n", un.release); exit (0); +#else + printf ("vax-dec-ultrix\n"); exit (0); +#endif +#endif +#endif +#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) +#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) +#if defined(_SIZE_T_) || defined(SIGLOST) + struct utsname *un; + uname (&un); + printf ("mips-dec-ultrix%s\n", un.release); exit (0); +#else + printf ("mips-dec-ultrix\n"); exit (0); +#endif +#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; } + +echo "$0: unable to guess system type" >&2 + +case $UNAME_MACHINE:$UNAME_SYSTEM in + mips:Linux | mips64:Linux) + # If we got here on MIPS GNU/Linux, output extra information. + cat >&2 <<EOF + +NOTE: MIPS GNU/Linux systems require a C compiler to fully recognize +the system type. Please install a C compiler and try again. +EOF + ;; +esac + +cat >&2 <<EOF + +This script (version $timestamp), has failed to recognize the +operating system you are using. If your script is old, overwrite *all* +copies of config.guess and config.sub with the latest versions from: + + https://git.savannah.gnu.org/cgit/config.git/plain/config.guess +and + https://git.savannah.gnu.org/cgit/config.git/plain/config.sub +EOF + +our_year=`echo $timestamp | sed 's,-.*,,'` +thisyear=`date +%Y` +# shellcheck disable=SC2003 +script_age=`expr "$thisyear" - "$our_year"` +if test "$script_age" -lt 3 ; then + cat >&2 <<EOF + +If $0 has already been updated, send the following data and any +information you think might be pertinent to config-patches@gnu.org to +provide the necessary 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 +fi + +exit 1 + +# Local variables: +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/config/config.sub b/config/config.sub new file mode 100755 index 0000000000000000000000000000000000000000..de4259e4047972f77ffc089796b32e325636c207 --- /dev/null +++ b/config/config.sub @@ -0,0 +1,1907 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright 1992-2023 Free Software Foundation, Inc. + +# shellcheck disable=SC2006,SC2268 # see below for rationale + +timestamp='2023-01-21' + +# 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 <https://www.gnu.org/licenses/>. +# +# 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 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: +# https://git.savannah.gnu.org/cgit/config.git/plain/config.sub + +# 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. + +# The "shellcheck disable" line above the timestamp inhibits complaints +# about features and limitations of the classic Bourne shell that were +# superseded or lifted in POSIX. However, this script identifies a wide +# variety of pre-POSIX systems that do not have POSIX shells at all, and +# even some reasonably current systems (Solaris 10 as case-in-point) still +# have a pre-POSIX /bin/sh. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS + +Canonicalize a configuration name. + +Options: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to <config-patches@gnu.org>." + +version="\ +GNU config.sub ($timestamp) + +Copyright 1992-2023 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 ;; + + *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 + +# Split fields of configuration type +# shellcheck disable=SC2162 +saved_IFS=$IFS +IFS="-" read field1 field2 field3 field4 <<EOF +$1 +EOF +IFS=$saved_IFS + +# Separate into logical components for further validation +case $1 in + *-*-*-*-*) + echo Invalid configuration \`"$1"\': more than four components >&2 + exit 1 + ;; + *-*-*-*) + basic_machine=$field1-$field2 + basic_os=$field3-$field4 + ;; + *-*-*) + # Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two + # parts + maybe_os=$field2-$field3 + case $maybe_os in + nto-qnx* | linux-* | uclinux-uclibc* \ + | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \ + | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \ + | storm-chaos* | os2-emx* | rtmk-nova* | managarm-*) + basic_machine=$field1 + basic_os=$maybe_os + ;; + android-linux) + basic_machine=$field1-unknown + basic_os=linux-android + ;; + *) + basic_machine=$field1-$field2 + basic_os=$field3 + ;; + esac + ;; + *-*) + # A lone config we happen to match not fitting any pattern + case $field1-$field2 in + decstation-3100) + basic_machine=mips-dec + basic_os= + ;; + *-*) + # Second component is usually, but not always the OS + case $field2 in + # Prevent following clause from handling this valid os + sun*os*) + basic_machine=$field1 + basic_os=$field2 + ;; + zephyr*) + basic_machine=$field1-unknown + basic_os=$field2 + ;; + # Manufacturers + dec* | mips* | sequent* | encore* | pc533* | 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* | sim | cisco \ + | oki | wec | wrs | winbond) + basic_machine=$field1-$field2 + basic_os= + ;; + *) + basic_machine=$field1 + basic_os=$field2 + ;; + esac + ;; + esac + ;; + *) + # Convert single-component short-hands not valid as part of + # multi-component configurations. + case $field1 in + 386bsd) + basic_machine=i386-pc + basic_os=bsd + ;; + a29khif) + basic_machine=a29k-amd + basic_os=udi + ;; + adobe68k) + basic_machine=m68010-adobe + basic_os=scout + ;; + alliant) + basic_machine=fx80-alliant + basic_os= + ;; + altos | altos3068) + basic_machine=m68k-altos + basic_os= + ;; + am29k) + basic_machine=a29k-none + basic_os=bsd + ;; + amdahl) + basic_machine=580-amdahl + basic_os=sysv + ;; + amiga) + basic_machine=m68k-unknown + basic_os= + ;; + amigaos | amigados) + basic_machine=m68k-unknown + basic_os=amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + basic_os=sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + basic_os=sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + basic_os=bsd + ;; + aros) + basic_machine=i386-pc + basic_os=aros + ;; + aux) + basic_machine=m68k-apple + basic_os=aux + ;; + balance) + basic_machine=ns32k-sequent + basic_os=dynix + ;; + blackfin) + basic_machine=bfin-unknown + basic_os=linux + ;; + cegcc) + basic_machine=arm-unknown + basic_os=cegcc + ;; + convex-c1) + basic_machine=c1-convex + basic_os=bsd + ;; + convex-c2) + basic_machine=c2-convex + basic_os=bsd + ;; + convex-c32) + basic_machine=c32-convex + basic_os=bsd + ;; + convex-c34) + basic_machine=c34-convex + basic_os=bsd + ;; + convex-c38) + basic_machine=c38-convex + basic_os=bsd + ;; + cray) + basic_machine=j90-cray + basic_os=unicos + ;; + crds | unos) + basic_machine=m68k-crds + basic_os= + ;; + da30) + basic_machine=m68k-da30 + basic_os= + ;; + decstation | pmax | pmin | dec3100 | decstatn) + basic_machine=mips-dec + basic_os= + ;; + delta88) + basic_machine=m88k-motorola + basic_os=sysv3 + ;; + dicos) + basic_machine=i686-pc + basic_os=dicos + ;; + djgpp) + basic_machine=i586-pc + basic_os=msdosdjgpp + ;; + ebmon29k) + basic_machine=a29k-amd + basic_os=ebmon + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + basic_os=ose + ;; + gmicro) + basic_machine=tron-gmicro + basic_os=sysv + ;; + go32) + basic_machine=i386-pc + basic_os=go32 + ;; + h8300hms) + basic_machine=h8300-hitachi + basic_os=hms + ;; + h8300xray) + basic_machine=h8300-hitachi + basic_os=xray + ;; + h8500hms) + basic_machine=h8500-hitachi + basic_os=hms + ;; + harris) + basic_machine=m88k-harris + basic_os=sysv3 + ;; + hp300 | hp300hpux) + basic_machine=m68k-hp + basic_os=hpux + ;; + hp300bsd) + basic_machine=m68k-hp + basic_os=bsd + ;; + hppaosf) + basic_machine=hppa1.1-hp + basic_os=osf + ;; + hppro) + basic_machine=hppa1.1-hp + basic_os=proelf + ;; + i386mach) + basic_machine=i386-mach + basic_os=mach + ;; + isi68 | isi) + basic_machine=m68k-isi + basic_os=sysv + ;; + m68knommu) + basic_machine=m68k-unknown + basic_os=linux + ;; + magnum | m3230) + basic_machine=mips-mips + basic_os=sysv + ;; + merlin) + basic_machine=ns32k-utek + basic_os=sysv + ;; + mingw64) + basic_machine=x86_64-pc + basic_os=mingw64 + ;; + mingw32) + basic_machine=i686-pc + basic_os=mingw32 + ;; + mingw32ce) + basic_machine=arm-unknown + basic_os=mingw32ce + ;; + monitor) + basic_machine=m68k-rom68k + basic_os=coff + ;; + morphos) + basic_machine=powerpc-unknown + basic_os=morphos + ;; + moxiebox) + basic_machine=moxie-unknown + basic_os=moxiebox + ;; + msdos) + basic_machine=i386-pc + basic_os=msdos + ;; + msys) + basic_machine=i686-pc + basic_os=msys + ;; + mvs) + basic_machine=i370-ibm + basic_os=mvs + ;; + nacl) + basic_machine=le32-unknown + basic_os=nacl + ;; + ncr3000) + basic_machine=i486-ncr + basic_os=sysv4 + ;; + netbsd386) + basic_machine=i386-pc + basic_os=netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + basic_os=linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + basic_os=newsos + ;; + news1000) + basic_machine=m68030-sony + basic_os=newsos + ;; + necv70) + basic_machine=v70-nec + basic_os=sysv + ;; + nh3000) + basic_machine=m68k-harris + basic_os=cxux + ;; + nh[45]000) + basic_machine=m88k-harris + basic_os=cxux + ;; + nindy960) + basic_machine=i960-intel + basic_os=nindy + ;; + mon960) + basic_machine=i960-intel + basic_os=mon960 + ;; + nonstopux) + basic_machine=mips-compaq + basic_os=nonstopux + ;; + os400) + basic_machine=powerpc-ibm + basic_os=os400 + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + basic_os=ose + ;; + os68k) + basic_machine=m68k-none + basic_os=os68k + ;; + paragon) + basic_machine=i860-intel + basic_os=osf + ;; + parisc) + basic_machine=hppa-unknown + basic_os=linux + ;; + psp) + basic_machine=mipsallegrexel-sony + basic_os=psp + ;; + pw32) + basic_machine=i586-unknown + basic_os=pw32 + ;; + rdos | rdos64) + basic_machine=x86_64-pc + basic_os=rdos + ;; + rdos32) + basic_machine=i386-pc + basic_os=rdos + ;; + rom68k) + basic_machine=m68k-rom68k + basic_os=coff + ;; + sa29200) + basic_machine=a29k-amd + basic_os=udi + ;; + sei) + basic_machine=mips-sei + basic_os=seiux + ;; + sequent) + basic_machine=i386-sequent + basic_os= + ;; + sps7) + basic_machine=m68k-bull + basic_os=sysv2 + ;; + st2000) + basic_machine=m68k-tandem + basic_os= + ;; + stratus) + basic_machine=i860-stratus + basic_os=sysv4 + ;; + sun2) + basic_machine=m68000-sun + basic_os= + ;; + sun2os3) + basic_machine=m68000-sun + basic_os=sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + basic_os=sunos4 + ;; + sun3) + basic_machine=m68k-sun + basic_os= + ;; + sun3os3) + basic_machine=m68k-sun + basic_os=sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + basic_os=sunos4 + ;; + sun4) + basic_machine=sparc-sun + basic_os= + ;; + sun4os3) + basic_machine=sparc-sun + basic_os=sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + basic_os=sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + basic_os=solaris2 + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + basic_os= + ;; + sv1) + basic_machine=sv1-cray + basic_os=unicos + ;; + symmetry) + basic_machine=i386-sequent + basic_os=dynix + ;; + t3e) + basic_machine=alphaev5-cray + basic_os=unicos + ;; + t90) + basic_machine=t90-cray + basic_os=unicos + ;; + toad1) + basic_machine=pdp10-xkl + basic_os=tops20 + ;; + tpf) + basic_machine=s390x-ibm + basic_os=tpf + ;; + udi29k) + basic_machine=a29k-amd + basic_os=udi + ;; + ultra3) + basic_machine=a29k-nyu + basic_os=sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + basic_os=none + ;; + vaxv) + basic_machine=vax-dec + basic_os=sysv + ;; + vms) + basic_machine=vax-dec + basic_os=vms + ;; + vsta) + basic_machine=i386-pc + basic_os=vsta + ;; + vxworks960) + basic_machine=i960-wrs + basic_os=vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + basic_os=vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + basic_os=vxworks + ;; + xbox) + basic_machine=i686-pc + basic_os=mingw32 + ;; + ymp) + basic_machine=ymp-cray + basic_os=unicos + ;; + *) + basic_machine=$1 + basic_os= + ;; + esac + ;; +esac + +# Decode 1-component or ad-hoc basic machines +case $basic_machine in + # 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) + cpu=hppa1.1 + vendor=winbond + ;; + op50n) + cpu=hppa1.1 + vendor=oki + ;; + op60c) + cpu=hppa1.1 + vendor=oki + ;; + ibm*) + cpu=i370 + vendor=ibm + ;; + orion105) + cpu=clipper + vendor=highlevel + ;; + mac | mpw | mac-mpw) + cpu=m68k + vendor=apple + ;; + pmac | pmac-mpw) + cpu=powerpc + vendor=apple + ;; + + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + cpu=m68000 + vendor=att + ;; + 3b*) + cpu=we32k + vendor=att + ;; + bluegene*) + cpu=powerpc + vendor=ibm + basic_os=cnk + ;; + decsystem10* | dec10*) + cpu=pdp10 + vendor=dec + basic_os=tops10 + ;; + decsystem20* | dec20*) + cpu=pdp10 + vendor=dec + basic_os=tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + cpu=m68k + vendor=motorola + ;; + dpx2*) + cpu=m68k + vendor=bull + basic_os=sysv3 + ;; + encore | umax | mmax) + cpu=ns32k + vendor=encore + ;; + elxsi) + cpu=elxsi + vendor=elxsi + basic_os=${basic_os:-bsd} + ;; + fx2800) + cpu=i860 + vendor=alliant + ;; + genix) + cpu=ns32k + vendor=ns + ;; + h3050r* | hiux*) + cpu=hppa1.1 + vendor=hitachi + basic_os=hiuxwe2 + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + cpu=hppa1.0 + vendor=hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + cpu=m68000 + vendor=hp + ;; + hp9k3[2-9][0-9]) + cpu=m68k + vendor=hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + cpu=hppa1.0 + vendor=hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + cpu=hppa1.1 + vendor=hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + cpu=hppa1.1 + vendor=hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + cpu=hppa1.1 + vendor=hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + cpu=hppa1.1 + vendor=hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + cpu=hppa1.0 + vendor=hp + ;; + i*86v32) + cpu=`echo "$1" | sed -e 's/86.*/86/'` + vendor=pc + basic_os=sysv32 + ;; + i*86v4*) + cpu=`echo "$1" | sed -e 's/86.*/86/'` + vendor=pc + basic_os=sysv4 + ;; + i*86v) + cpu=`echo "$1" | sed -e 's/86.*/86/'` + vendor=pc + basic_os=sysv + ;; + i*86sol2) + cpu=`echo "$1" | sed -e 's/86.*/86/'` + vendor=pc + basic_os=solaris2 + ;; + j90 | j90-cray) + cpu=j90 + vendor=cray + basic_os=${basic_os:-unicos} + ;; + iris | iris4d) + cpu=mips + vendor=sgi + case $basic_os in + irix*) + ;; + *) + basic_os=irix4 + ;; + esac + ;; + miniframe) + cpu=m68000 + vendor=convergent + ;; + *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*) + cpu=m68k + vendor=atari + basic_os=mint + ;; + news-3600 | risc-news) + cpu=mips + vendor=sony + basic_os=newsos + ;; + next | m*-next) + cpu=m68k + vendor=next + case $basic_os in + openstep*) + ;; + nextstep*) + ;; + ns2*) + basic_os=nextstep2 + ;; + *) + basic_os=nextstep3 + ;; + esac + ;; + np1) + cpu=np1 + vendor=gould + ;; + op50n-* | op60c-*) + cpu=hppa1.1 + vendor=oki + basic_os=proelf + ;; + pa-hitachi) + cpu=hppa1.1 + vendor=hitachi + basic_os=hiuxwe2 + ;; + pbd) + cpu=sparc + vendor=tti + ;; + pbb) + cpu=m68k + vendor=tti + ;; + pc532) + cpu=ns32k + vendor=pc532 + ;; + pn) + cpu=pn + vendor=gould + ;; + power) + cpu=power + vendor=ibm + ;; + ps2) + cpu=i386 + vendor=ibm + ;; + rm[46]00) + cpu=mips + vendor=siemens + ;; + rtpc | rtpc-*) + cpu=romp + vendor=ibm + ;; + sde) + cpu=mipsisa32 + vendor=sde + basic_os=${basic_os:-elf} + ;; + simso-wrs) + cpu=sparclite + vendor=wrs + basic_os=vxworks + ;; + tower | tower-32) + cpu=m68k + vendor=ncr + ;; + vpp*|vx|vx-*) + cpu=f301 + vendor=fujitsu + ;; + w65) + cpu=w65 + vendor=wdc + ;; + w89k-*) + cpu=hppa1.1 + vendor=winbond + basic_os=proelf + ;; + none) + cpu=none + vendor=none + ;; + leon|leon[3-9]) + cpu=sparc + vendor=$basic_machine + ;; + leon-*|leon[3-9]-*) + cpu=sparc + vendor=`echo "$basic_machine" | sed 's/-.*//'` + ;; + + *-*) + # shellcheck disable=SC2162 + saved_IFS=$IFS + IFS="-" read cpu vendor <<EOF +$basic_machine +EOF + IFS=$saved_IFS + ;; + # 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) + cpu=$basic_machine + vendor=pc + ;; + # These rules are duplicated from below for sake of the special case above; + # i.e. things that normalized to x86 arches should also default to "pc" + pc98) + cpu=i386 + vendor=pc + ;; + x64 | amd64) + cpu=x86_64 + vendor=pc + ;; + # Recognize the basic CPU types without company name. + *) + cpu=$basic_machine + vendor=unknown + ;; +esac + +unset -v basic_machine + +# Decode basic machines in the full and proper CPU-Company form. +case $cpu-$vendor in + # Here we handle the default manufacturer of certain CPU types in canonical form. It is in + # some cases the only manufacturer, in others, it is the most popular. + craynv-unknown) + vendor=cray + basic_os=${basic_os:-unicosmp} + ;; + c90-unknown | c90-cray) + vendor=cray + basic_os=${Basic_os:-unicos} + ;; + fx80-unknown) + vendor=alliant + ;; + romp-unknown) + vendor=ibm + ;; + mmix-unknown) + vendor=knuth + ;; + microblaze-unknown | microblazeel-unknown) + vendor=xilinx + ;; + rs6000-unknown) + vendor=ibm + ;; + vax-unknown) + vendor=dec + ;; + pdp11-unknown) + vendor=dec + ;; + we32k-unknown) + vendor=att + ;; + cydra-unknown) + vendor=cydrome + ;; + i370-ibm*) + vendor=ibm + ;; + orion-unknown) + vendor=highlevel + ;; + xps-unknown | xps100-unknown) + cpu=xps100 + vendor=honeywell + ;; + + # Here we normalize CPU types with a missing or matching vendor + armh-unknown | armh-alt) + cpu=armv7l + vendor=alt + basic_os=${basic_os:-linux-gnueabihf} + ;; + dpx20-unknown | dpx20-bull) + cpu=rs6000 + vendor=bull + basic_os=${basic_os:-bosx} + ;; + + # Here we normalize CPU types irrespective of the vendor + amd64-*) + cpu=x86_64 + ;; + blackfin-*) + cpu=bfin + basic_os=linux + ;; + c54x-*) + cpu=tic54x + ;; + c55x-*) + cpu=tic55x + ;; + c6x-*) + cpu=tic6x + ;; + e500v[12]-*) + cpu=powerpc + basic_os=${basic_os}"spe" + ;; + mips3*-*) + cpu=mips64 + ;; + ms1-*) + cpu=mt + ;; + m68knommu-*) + cpu=m68k + basic_os=linux + ;; + m9s12z-* | m68hcs12z-* | hcs12z-* | s12z-*) + cpu=s12z + ;; + openrisc-*) + cpu=or32 + ;; + parisc-*) + cpu=hppa + basic_os=linux + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + cpu=i586 + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-* | athlon_*-*) + cpu=i686 + ;; + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) + cpu=i686 + ;; + pentium4-*) + cpu=i786 + ;; + pc98-*) + cpu=i386 + ;; + ppc-* | ppcbe-*) + cpu=powerpc + ;; + ppcle-* | powerpclittle-*) + cpu=powerpcle + ;; + ppc64-*) + cpu=powerpc64 + ;; + ppc64le-* | powerpc64little-*) + cpu=powerpc64le + ;; + sb1-*) + cpu=mipsisa64sb1 + ;; + sb1el-*) + cpu=mipsisa64sb1el + ;; + sh5e[lb]-*) + cpu=`echo "$cpu" | sed 's/^\(sh.\)e\(.\)$/\1\2e/'` + ;; + spur-*) + cpu=spur + ;; + strongarm-* | thumb-*) + cpu=arm + ;; + tx39-*) + cpu=mipstx39 + ;; + tx39el-*) + cpu=mipstx39el + ;; + x64-*) + cpu=x86_64 + ;; + xscale-* | xscalee[bl]-*) + cpu=`echo "$cpu" | sed 's/^xscale/arm/'` + ;; + arm64-* | aarch64le-*) + cpu=aarch64 + ;; + + # Recognize the canonical CPU Types that limit and/or modify the + # company names they are paired with. + cr16-*) + basic_os=${basic_os:-elf} + ;; + crisv32-* | etraxfs*-*) + cpu=crisv32 + vendor=axis + ;; + cris-* | etrax*-*) + cpu=cris + vendor=axis + ;; + crx-*) + basic_os=${basic_os:-elf} + ;; + neo-tandem) + cpu=neo + vendor=tandem + ;; + nse-tandem) + cpu=nse + vendor=tandem + ;; + nsr-tandem) + cpu=nsr + vendor=tandem + ;; + nsv-tandem) + cpu=nsv + vendor=tandem + ;; + nsx-tandem) + cpu=nsx + vendor=tandem + ;; + mipsallegrexel-sony) + cpu=mipsallegrexel + vendor=sony + ;; + tile*-*) + basic_os=${basic_os:-linux-gnu} + ;; + + *) + # Recognize the canonical CPU types that are allowed with any + # company name. + case $cpu in + 1750a | 580 \ + | a29k \ + | aarch64 | aarch64_be \ + | abacus \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] \ + | alphapca5[67] | alpha64pca5[67] \ + | am33_2.0 \ + | amdgcn \ + | arc | arceb | arc32 | arc64 \ + | arm | arm[lb]e | arme[lb] | armv* \ + | avr | avr32 \ + | asmjs \ + | ba \ + | be32 | be64 \ + | bfin | bpf | bs2000 \ + | c[123]* | c30 | [cjt]90 | c4x \ + | c8051 | clipper | craynv | csky | cydra \ + | d10v | d30v | dlx | dsp16xx \ + | e2k | elxsi | epiphany \ + | f30[01] | f700 | fido | fr30 | frv | ft32 | fx80 \ + | h8300 | h8500 \ + | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | hexagon \ + | i370 | i*86 | i860 | i960 | ia16 | ia64 \ + | ip2k | iq2000 \ + | k1om \ + | le32 | le64 \ + | lm32 \ + | loongarch32 | loongarch64 \ + | m32c | m32r | m32rle \ + | m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \ + | m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \ + | m88110 | m88k | maxq | mb | mcore | mep | metag \ + | microblaze | microblazeel \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64eb | mips64el \ + | mips64octeon | mips64octeonel \ + | mips64orion | mips64orionel \ + | mips64r5900 | mips64r5900el \ + | mips64vr | mips64vrel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mips64vr5900 | mips64vr5900el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa32r3 | mipsisa32r3el \ + | mipsisa32r5 | mipsisa32r5el \ + | mipsisa32r6 | mipsisa32r6el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64r3 | mipsisa64r3el \ + | mipsisa64r5 | mipsisa64r5el \ + | mipsisa64r6 | mipsisa64r6el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipsr5900 | mipsr5900el \ + | mipstx39 | mipstx39el \ + | mmix \ + | mn10200 | mn10300 \ + | moxie \ + | mt \ + | msp430 \ + | nds32 | nds32le | nds32be \ + | nfp \ + | nios | nios2 | nios2eb | nios2el \ + | none | np1 | ns16k | ns32k | nvptx \ + | open8 \ + | or1k* \ + | or32 \ + | orion \ + | picochip \ + | pdp10 | pdp11 | pj | pjl | pn | power \ + | powerpc | powerpc64 | powerpc64le | powerpcle | powerpcspe \ + | pru \ + | pyramid \ + | riscv | riscv32 | riscv32be | riscv64 | riscv64be \ + | rl78 | romp | rs6000 | rx \ + | s390 | s390x \ + | score \ + | sh | shl \ + | sh[1234] | sh[24]a | sh[24]ae[lb] | sh[23]e | she[lb] | sh[lb]e \ + | sh[1234]e[lb] | sh[12345][lb]e | sh[23]ele | sh64 | sh64le \ + | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet \ + | sparclite \ + | sparcv8 | sparcv9 | sparcv9b | sparcv9v | sv1 | sx* \ + | spu \ + | tahoe \ + | thumbv7* \ + | tic30 | tic4x | tic54x | tic55x | tic6x | tic80 \ + | tron \ + | ubicom32 \ + | v70 | v850 | v850e | v850e1 | v850es | v850e2 | v850e2v3 \ + | vax \ + | visium \ + | w65 \ + | wasm32 | wasm64 \ + | we32k \ + | x86 | x86_64 | xc16x | xgate | xps100 \ + | xstormy16 | xtensa* \ + | ymp \ + | z8k | z80) + ;; + + *) + echo Invalid configuration \`"$1"\': machine \`"$cpu-$vendor"\' not recognized 1>&2 + exit 1 + ;; + esac + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $vendor in + digital*) + vendor=dec + ;; + commodore*) + vendor=cbm + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if test x$basic_os != x +then + +# First recognize some ad-hoc cases, or perhaps split kernel-os, or else just +# set os. +case $basic_os in + gnu/linux*) + kernel=linux + os=`echo "$basic_os" | sed -e 's|gnu/linux|gnu|'` + ;; + os2-emx) + kernel=os2 + os=`echo "$basic_os" | sed -e 's|os2-emx|emx|'` + ;; + nto-qnx*) + kernel=nto + os=`echo "$basic_os" | sed -e 's|nto-qnx|qnx|'` + ;; + *-*) + # shellcheck disable=SC2162 + saved_IFS=$IFS + IFS="-" read kernel os <<EOF +$basic_os +EOF + IFS=$saved_IFS + ;; + # Default OS when just kernel was specified + nto*) + kernel=nto + os=`echo "$basic_os" | sed -e 's|nto|qnx|'` + ;; + linux*) + kernel=linux + os=`echo "$basic_os" | sed -e 's|linux|gnu|'` + ;; + managarm*) + kernel=managarm + os=`echo "$basic_os" | sed -e 's|managarm|mlibc|'` + ;; + *) + kernel= + os=$basic_os + ;; +esac + +# Now, normalize the OS (knowing we just have one component, it's not a kernel, +# etc.) +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 + ;; + bluegene*) + os=cnk + ;; + solaris1 | solaris1.*) + os=`echo "$os" | sed -e 's|solaris1|sunos4|'` + ;; + solaris) + os=solaris2 + ;; + unixware*) + os=sysv4.2uw + ;; + # es1800 is here to avoid being matched by es* (a different OS) + es1800*) + os=ose + ;; + # Some version numbers need modification + chorusos*) + os=chorusos + ;; + isc) + os=isc2.2 + ;; + sco6) + os=sco5v6 + ;; + sco5) + os=sco3.2v5 + ;; + sco4) + os=sco3.2v4 + ;; + sco3.2.[4-9]*) + os=`echo "$os" | sed -e 's/sco3.2./sco3.2v/'` + ;; + sco*v* | scout) + # Don't match below + ;; + sco*) + os=sco3.2v2 + ;; + psos*) + os=psos + ;; + qnx*) + os=qnx + ;; + hiux*) + os=hiuxwe2 + ;; + lynx*178) + os=lynxos178 + ;; + lynx*5) + os=lynxos5 + ;; + lynxos*) + # don't get caught up in next wildcard + ;; + lynx*) + os=lynxos + ;; + mac[0-9]*) + os=`echo "$os" | sed -e 's|mac|macos|'` + ;; + opened*) + os=openedition + ;; + os400*) + os=os400 + ;; + sunos5*) + os=`echo "$os" | sed -e 's|sunos5|solaris2|'` + ;; + sunos6*) + os=`echo "$os" | sed -e 's|sunos6|solaris3|'` + ;; + wince*) + os=wince + ;; + 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 + ;; + # 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 + ;; + ose*) + os=ose + ;; + *mint | mint[0-9]* | *MiNT | MiNT[0-9]*) + os=mint + ;; + dicos*) + os=dicos + ;; + pikeos*) + # Until real need of OS specific support for + # particular features comes up, bare metal + # configurations are quite functional. + case $cpu in + arm*) + os=eabi + ;; + *) + os=elf + ;; + esac + ;; + *) + # No normalization, but not necessarily accepted, that comes below. + ;; +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. + +kernel= +case $cpu-$vendor in + score-*) + os=elf + ;; + spu-*) + os=elf + ;; + *-acorn) + os=riscix1.2 + ;; + arm*-rebel) + kernel=linux + os=gnu + ;; + arm*-semi) + os=aout + ;; + c4x-* | tic4x-*) + os=coff + ;; + c8051-*) + os=elf + ;; + clipper-intergraph) + os=clix + ;; + 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 + ;; + or32-*) + os=coff + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=sysv3 + ;; + sparc-* | *-sun) + os=sunos4.1.1 + ;; + pru-*) + os=elf + ;; + *-be) + os=beos + ;; + *-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 + ;; + *-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 + ;; + *-wrs) + os=vxworks + ;; + *) + os=none + ;; +esac + +fi + +# Now, validate our (potentially fixed-up) OS. +case $os in + # Sometimes we do "kernel-libc", so those need to count as OSes. + musl* | newlib* | relibc* | uclibc*) + ;; + # Likewise for "kernel-abi" + eabi* | gnueabi*) + ;; + # VxWorks passes extra cpu info in the 4th filed. + simlinux | simwindows | spe) + ;; + # Now accept the basic system types. + # The portable systems comes first. + # Each alternative MUST end in a * to match a version number. + gnu* | android* | bsd* | mach* | minix* | genix* | ultrix* | irix* \ + | *vms* | esix* | aix* | cnk* | sunos | sunos[34]* \ + | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \ + | sym* | plan9* | psp* | sim* | xray* | os68k* | v88r* \ + | hiux* | abug | nacl* | netware* | windows* \ + | os9* | macos* | osx* | ios* \ + | mpw* | magic* | mmixware* | mon960* | lnews* \ + | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \ + | aos* | aros* | cloudabi* | sortix* | twizzler* \ + | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \ + | clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \ + | mirbsd* | netbsd* | dicos* | openedition* | ose* \ + | bitrig* | openbsd* | secbsd* | solidbsd* | libertybsd* | os108* \ + | ekkobsd* | freebsd* | riscix* | lynxos* | os400* \ + | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \ + | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \ + | udi* | lites* | ieee* | go32* | aux* | hcos* \ + | chorusrdb* | cegcc* | glidix* | serenity* \ + | cygwin* | msys* | pe* | moss* | proelf* | rtems* \ + | midipix* | mingw32* | mingw64* | mint* \ + | uxpv* | beos* | mpeix* | udk* | moxiebox* \ + | interix* | uwin* | mks* | rhapsody* | darwin* \ + | openstep* | oskit* | conix* | pw32* | nonstopux* \ + | storm-chaos* | tops10* | tenex* | tops20* | its* \ + | os2* | vos* | palmos* | uclinux* | nucleus* | morphos* \ + | scout* | superux* | sysv* | rtmk* | tpf* | windiss* \ + | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \ + | skyos* | haiku* | rdos* | toppers* | drops* | es* \ + | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \ + | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \ + | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr* \ + | fiwix* | mlibc* ) + ;; + # This one is extra strict with allowed versions + sco3.2v2 | sco3.2v[4-9]* | sco5v6*) + # Don't forget version if it is 3.2v4 or newer. + ;; + none) + ;; + kernel* ) + # Restricted further below + ;; + *) + echo Invalid configuration \`"$1"\': OS \`"$os"\' not recognized 1>&2 + exit 1 + ;; +esac + +# As a final step for OS-related things, validate the OS-kernel combination +# (given a valid OS), if there is a kernel. +case $kernel-$os in + linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* \ + | linux-musl* | linux-relibc* | linux-uclibc* | linux-mlibc* ) + ;; + uclinux-uclibc* ) + ;; + managarm-mlibc* | managarm-kernel* ) + ;; + -dietlibc* | -newlib* | -musl* | -relibc* | -uclibc* | -mlibc* ) + # These are just libc implementations, not actual OSes, and thus + # require a kernel. + echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2 + exit 1 + ;; + -kernel* ) + echo "Invalid configuration \`$1': \`$os' needs explicit kernel." 1>&2 + exit 1 + ;; + *-kernel* ) + echo "Invalid configuration \`$1': \`$kernel' does not support \`$os'." 1>&2 + exit 1 + ;; + kfreebsd*-gnu* | kopensolaris*-gnu*) + ;; + vxworks-simlinux | vxworks-simwindows | vxworks-spe) + ;; + nto-qnx*) + ;; + os2-emx) + ;; + *-eabi* | *-gnueabi*) + ;; + -*) + # Blank kernel with real OS is always fine. + ;; + *-*) + echo "Invalid configuration \`$1': Kernel \`$kernel' not known to work with OS \`$os'." 1>&2 + exit 1 + ;; +esac + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +case $vendor in + unknown) + case $cpu-$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 + ;; + *-clix*) + vendor=intergraph + ;; + *-mvs* | *-opened*) + vendor=ibm + ;; + *-os400*) + vendor=ibm + ;; + s390-* | s390x-*) + 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 + ;; +esac + +echo "$cpu-$vendor-${kernel:+$kernel-}$os" +exit + +# Local variables: +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/config/depcomp b/config/depcomp new file mode 100755 index 0000000000000000000000000000000000000000..715e34311ed2d2dbff881aedc7e25b81db54614c --- /dev/null +++ b/config/depcomp @@ -0,0 +1,791 @@ +#! /bin/sh +# depcomp - compile a program generating dependencies as side-effects + +scriptversion=2018-03-07.03; # UTC + +# Copyright (C) 1999-2021 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 <https://www.gnu.org/licenses/>. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>. + +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 <bug-automake@gnu.org>. +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 'before-save-hook 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC0" +# time-stamp-end: "; # UTC" +# End: diff --git a/config/install-sh b/config/install-sh new file mode 100755 index 0000000000000000000000000000000000000000..ec298b53740270ce82b326c4c2deaa5dcdec4596 --- /dev/null +++ b/config/install-sh @@ -0,0 +1,541 @@ +#!/bin/sh +# install - install a program, script, or datafile + +scriptversion=2020-11-14.01; # 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. + +tab=' ' +nl=' +' +IFS=" $tab$nl" + +# Set DOITPROG to "echo" to test this script. + +doit=${DOITPROG-} +doit_exec=${doit:-exec} + +# 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_mkdir= + +# Desired mode of installed file. +mode=0755 + +# Create dirs (including intermediate dirs) using mode 755. +# This is like GNU 'install' as of coreutils 8.32 (2020). +mkdir_umask=22 + +backupsuffix= +chgrpcmd= +chmodcmd=$chmodprog +chowncmd= +mvcmd=$mvprog +rmcmd="$rmprog -f" +stripcmd= + +src= +dst= +dir_arg= +dst_arg= + +copy_on_change=false +is_target_a_directory=possibly + +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 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. + -p pass -p to $cpprog. + -s $stripprog installed files. + -S SUFFIX attempt to back up existing files, with suffix SUFFIX. + -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 + +By default, rm is invoked with -f; when overridden with RMPROG, +it's up to you to specify -f if you want it. + +If -S is not specified, no backups are attempted. + +Email bug reports to bug-automake@gnu.org. +Automake home page: https://www.gnu.org/software/automake/ +" + +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 + *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*) + echo "$0: invalid mode: $mode" >&2 + exit 1;; + esac + shift;; + + -o) chowncmd="$chownprog $2" + shift;; + + -p) cpprog="$cpprog -p";; + + -s) stripcmd=$stripprog;; + + -S) backupsuffix="$2" + shift;; + + -t) + is_target_a_directory=always + dst_arg=$2 + # Protect names problematic for 'test' and other utilities. + case $dst_arg in + -* | [=\(\)!]) dst_arg=./$dst_arg;; + esac + shift;; + + -T) is_target_a_directory=never;; + + --version) echo "$0 $scriptversion"; exit $?;; + + --) shift + break;; + + -*) echo "$0: invalid option: $1" >&2 + exit 1;; + + *) break;; + esac + shift +done + +# We allow the use of options -d and -T together, by making -d +# take the precedence; this is for compatibility with GNU install. + +if test -n "$dir_arg"; then + if test -n "$dst_arg"; then + echo "$0: target directory not allowed when installing a directory." >&2 + exit 1 + fi +fi + +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 + if test $# -gt 1 || test "$is_target_a_directory" = always; then + if test ! -d "$dst_arg"; then + echo "$0: $dst_arg: Is not a directory." >&2 + exit 1 + fi + fi +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=$? + # Don't chown directories that already exist. + if test $dstdir_status = 0; then + chowncmd="" + fi + 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. + if test -d "$dst"; then + if test "$is_target_a_directory" = never; then + echo "$0: $dst_arg: Is a directory" >&2 + exit 1 + fi + dstdir=$dst + dstbase=`basename "$src"` + case $dst in + */) dst=$dst$dstbase;; + *) dst=$dst/$dstbase;; + esac + dstdir_status=0 + else + dstdir=`dirname "$dst"` + test -d "$dstdir" + dstdir_status=$? + fi + fi + + case $dstdir in + */) dstdirslash=$dstdir;; + *) dstdirslash=$dstdir/;; + esac + + obsolete_mkdir_used=false + + if test $dstdir_status != 0; then + case $posix_mkdir in + '') + # 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 + # The $RANDOM variable is not portable (e.g., dash). Use it + # here however when possible just to lower collision chance. + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + + trap ' + ret=$? + rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null + exit $ret + ' 0 + + # Because "mkdir -p" follows existing symlinks and we likely work + # directly in world-writeable /tmp, make sure that the '$tmpdir' + # directory is successfully created first before we actually test + # 'mkdir -p'. + if (umask $mkdir_umask && + $mkdirprog $mkdir_mode "$tmpdir" && + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/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. + test_tmpdir="$tmpdir/a" + ls_ld_tmpdir=`ls -ld "$test_tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && + $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { + ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi + rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" + else + # Remove any dirs left behind by ancient mkdir implementations. + rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null + fi + trap '' 0;; + esac + + if + $posix_mkdir && ( + umask $mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" + ) + then : + else + + # 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 + + oIFS=$IFS + IFS=/ + set -f + set fnord $dstdir + shift + 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=${dstdirslash}_inst.$$_ + rmtmp=${dstdirslash}_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 && + { test -z "$stripcmd" || { + # Create $dsttmp read-write so that cp doesn't create it read-only, + # which would cause strip to fail. + if test -z "$doit"; then + : >"$dsttmp" # No need to fork-exec 'touch'. + else + $doit touch "$dsttmp" + fi + } + } && + $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` && + set -f && + set X $old && old=:$2:$4:$5:$6 && + set X $new && new=:$2:$4:$5:$6 && + set +f && + test "$old" = "$new" && + $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 + then + rm -f "$dsttmp" + else + # If $backupsuffix is set, and the file being installed + # already exists, attempt a backup. Don't worry if it fails, + # e.g., if mv doesn't support -f. + if test -n "$backupsuffix" && test -f "$dst"; then + $doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null + fi + + # 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 "$dst" 2>/dev/null || + { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && + { $doit $rmcmd "$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 'before-save-hook 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC0" +# time-stamp-end: "; # UTC" +# End: diff --git a/config/ltmain.sh b/config/ltmain.sh new file mode 100644 index 0000000000000000000000000000000000000000..5f5e7a13ca95fa7bcb82853d2e1102fd0197be56 --- /dev/null +++ b/config/ltmain.sh @@ -0,0 +1,11267 @@ +#! /bin/sh +## DO NOT EDIT - This file generated from ./build-aux/ltmain.in +## by inline-source v2014-01-03.01 + +# libtool (GNU libtool) 2.4.6 +# Provide generalized library-building support services. +# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 + +# Copyright (C) 1996-2015 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 this program. If not, see <http://www.gnu.org/licenses/>. + + +PROGRAM=libtool +PACKAGE=libtool +VERSION=2.4.6 +package_revision=2.4.6 + + +## ------ ## +## Usage. ## +## ------ ## + +# Run './libtool --help' for help with using this script from the +# command line. + + +## ------------------------------- ## +## User overridable command paths. ## +## ------------------------------- ## + +# After configure completes, it has a better idea of some of the +# shell tools we need than the defaults used by the functions shared +# with bootstrap, so set those here where they can still be over- +# ridden by the user, but otherwise take precedence. + +: ${AUTOCONF="autoconf"} +: ${AUTOMAKE="automake"} + + +## -------------------------- ## +## Source external libraries. ## +## -------------------------- ## + +# Much of our low-level functionality needs to be sourced from external +# libraries, which are installed to $pkgauxdir. + +# Set a version string for this script. +scriptversion=2015-01-20.17; # UTC + +# General shell script boiler plate, and helper functions. +# Written by Gary V. Vaughan, 2004 + +# Copyright (C) 2004-2015 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. + +# 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 3 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. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNES 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 <http://www.gnu.org/licenses/>. + +# Please report bugs or propose patches to gary@gnu.org. + + +## ------ ## +## Usage. ## +## ------ ## + +# Evaluate this file near the top of your script to gain access to +# the functions and variables defined here: +# +# . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh +# +# If you need to override any of the default environment variable +# settings, do that before evaluating this file. + + +## -------------------- ## +## Shell normalisation. ## +## -------------------- ## + +# Some shells need a little help to be as Bourne compatible as possible. +# Before doing anything else, make sure all that help has been provided! + +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 + +# NLS nuisances: We save the old values in case they are required later. +_G_user_locale= +_G_safe_locale= +for _G_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES +do + eval "if test set = \"\${$_G_var+set}\"; then + save_$_G_var=\$$_G_var + $_G_var=C + export $_G_var + _G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\" + _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\" + fi" +done + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +# Make sure IFS has a sensible default +sp=' ' +nl=' +' +IFS="$sp $nl" + +# There are apparently some retarded systems that use ';' as a PATH separator! +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 + + + +## ------------------------- ## +## Locate command utilities. ## +## ------------------------- ## + + +# func_executable_p FILE +# ---------------------- +# Check that FILE is an executable regular file. +func_executable_p () +{ + test -f "$1" && test -x "$1" +} + + +# func_path_progs PROGS_LIST CHECK_FUNC [PATH] +# -------------------------------------------- +# Search for either a program that responds to --version with output +# containing "GNU", or else returned by CHECK_FUNC otherwise, by +# trying all the directories in PATH with each of the elements of +# PROGS_LIST. +# +# CHECK_FUNC should accept the path to a candidate program, and +# set $func_check_prog_result if it truncates its output less than +# $_G_path_prog_max characters. +func_path_progs () +{ + _G_progs_list=$1 + _G_check_func=$2 + _G_PATH=${3-"$PATH"} + + _G_path_prog_max=0 + _G_path_prog_found=false + _G_save_IFS=$IFS; IFS=${PATH_SEPARATOR-:} + for _G_dir in $_G_PATH; do + IFS=$_G_save_IFS + test -z "$_G_dir" && _G_dir=. + for _G_prog_name in $_G_progs_list; do + for _exeext in '' .EXE; do + _G_path_prog=$_G_dir/$_G_prog_name$_exeext + func_executable_p "$_G_path_prog" || continue + case `"$_G_path_prog" --version 2>&1` in + *GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;; + *) $_G_check_func $_G_path_prog + func_path_progs_result=$func_check_prog_result + ;; + esac + $_G_path_prog_found && break 3 + done + done + done + IFS=$_G_save_IFS + test -z "$func_path_progs_result" && { + echo "no acceptable sed could be found in \$PATH" >&2 + exit 1 + } +} + + +# We want to be able to use the functions in this file before configure +# has figured out where the best binaries are kept, which means we have +# to search for them ourselves - except when the results are already set +# where we skip the searches. + +# Unless the user overrides by setting SED, search the path for either GNU +# sed, or the sed that truncates its output the least. +test -z "$SED" && { + _G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ + for _G_i in 1 2 3 4 5 6 7; do + _G_sed_script=$_G_sed_script$nl$_G_sed_script + done + echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed + _G_sed_script= + + func_check_prog_sed () + { + _G_path_prog=$1 + + _G_count=0 + printf 0123456789 >conftest.in + while : + do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo '' >> conftest.nl + "$_G_path_prog" -f conftest.sed <conftest.nl >conftest.out 2>/dev/null || break + diff conftest.out conftest.nl >/dev/null 2>&1 || break + _G_count=`expr $_G_count + 1` + if test "$_G_count" -gt "$_G_path_prog_max"; then + # Best one so far, save it but keep looking for a better one + func_check_prog_result=$_G_path_prog + _G_path_prog_max=$_G_count + fi + # 10*(2^10) chars as input seems more than enough + test 10 -lt "$_G_count" && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out + } + + func_path_progs "sed gsed" func_check_prog_sed $PATH:/usr/xpg4/bin + rm -f conftest.sed + SED=$func_path_progs_result +} + + +# Unless the user overrides by setting GREP, search the path for either GNU +# grep, or the grep that truncates its output the least. +test -z "$GREP" && { + func_check_prog_grep () + { + _G_path_prog=$1 + + _G_count=0 + _G_path_prog_max=0 + printf 0123456789 >conftest.in + while : + do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo 'GREP' >> conftest.nl + "$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' <conftest.nl >conftest.out 2>/dev/null || break + diff conftest.out conftest.nl >/dev/null 2>&1 || break + _G_count=`expr $_G_count + 1` + if test "$_G_count" -gt "$_G_path_prog_max"; then + # Best one so far, save it but keep looking for a better one + func_check_prog_result=$_G_path_prog + _G_path_prog_max=$_G_count + fi + # 10*(2^10) chars as input seems more than enough + test 10 -lt "$_G_count" && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out + } + + func_path_progs "grep ggrep" func_check_prog_grep $PATH:/usr/xpg4/bin + GREP=$func_path_progs_result +} + + +## ------------------------------- ## +## User overridable command paths. ## +## ------------------------------- ## + +# All uppercase variable names are used for environment variables. These +# variables can be overridden by the user before calling a script that +# uses them if a suitable command of that name is not already available +# in the command search PATH. + +: ${CP="cp -f"} +# work around bug in libtool which raises an error when running in a +# parallel make that should have been handled in printf internally +printf() +{ + while ! builtin printf "$@" ; do + errcode=$? + # errcode might be EAGAIN=11 which means to simply try again + if [ $errcode != 11 ]; then + return $errcode + fi + done +} +: ${ECHO="printf %s\n"} +: ${EGREP="$GREP -E"} +: ${FGREP="$GREP -F"} +: ${LN_S="ln -s"} +: ${MAKE="make"} +: ${MKDIR="mkdir"} +: ${MV="mv -f"} +: ${RM="rm -f"} +: ${SHELL="${CONFIG_SHELL-/bin/sh}"} + + +## -------------------- ## +## Useful sed snippets. ## +## -------------------- ## + +sed_dirname='s|/[^/]*$||' +sed_basename='s|^.*/||' + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +sed_quote_subst='s|\([`"$\\]\)|\\\1|g' + +# Same as above, but do not quote variable references. +sed_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 +# that contains forward slashes, into one that contains +# (escaped) backslashes. A very naive implementation. +sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' + +# Re-'\' parameter expansions in output of sed_double_quote_subst that +# were '\'-ed in input to the same. If an odd number of '\' preceded a +# '$' in input to sed_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 '$'. +_G_bs='\\' +_G_bs2='\\\\' +_G_bs4='\\\\\\\\' +_G_dollar='\$' +sed_double_backslash="\ + s/$_G_bs4/&\\ +/g + s/^$_G_bs2$_G_dollar/$_G_bs&/ + s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g + s/\n//g" + + +## ----------------- ## +## Global variables. ## +## ----------------- ## + +# Except for the global variables explicitly listed below, the following +# functions in the '^func_' namespace, and the '^require_' namespace +# variables initialised in the 'Resource management' section, sourcing +# this file will not pollute your global namespace with anything +# else. There's no portable way to scope variables in Bourne shell +# though, so actually running these functions will sometimes place +# results into a variable named after the function, and often use +# temporary variables in the '^_G_' namespace. If you are careful to +# avoid using those namespaces casually in your sourcing script, things +# should continue to work as you expect. And, of course, you can freely +# overwrite any of the functions or variables defined here before +# calling anything to customize them. + +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. + +# Allow overriding, eg assuming that you follow the convention of +# putting '$debug_cmd' at the start of all your functions, you can get +# bash to show function call trace with: +# +# debug_cmd='eval echo "${FUNCNAME[0]} $*" >&2' bash your-script-name +debug_cmd=${debug_cmd-":"} +exit_cmd=: + +# By convention, finish your script with: +# +# exit $exit_status +# +# so that you can set exit_status to non-zero if you want to indicate +# something went wrong during execution without actually bailing out at +# the point of failure. +exit_status=$EXIT_SUCCESS + +# 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 + +# The name of this program. +progname=`$ECHO "$progpath" |$SED "$sed_basename"` + +# Make sure we have an absolute progpath for reexecution: +case $progpath in + [\\/]*|[A-Za-z]:\\*) ;; + *[\\/]*) + progdir=`$ECHO "$progpath" |$SED "$sed_dirname"` + progdir=`cd "$progdir" && pwd` + progpath=$progdir/$progname + ;; + *) + _G_IFS=$IFS + IFS=${PATH_SEPARATOR-:} + for progdir in $PATH; do + IFS=$_G_IFS + test -x "$progdir/$progname" && break + done + IFS=$_G_IFS + test -n "$progdir" || progdir=`pwd` + progpath=$progdir/$progname + ;; +esac + + +## ----------------- ## +## Standard options. ## +## ----------------- ## + +# The following options affect the operation of the functions defined +# below, and should be set appropriately depending on run-time para- +# meters passed on the command line. + +opt_dry_run=false +opt_quiet=false +opt_verbose=false + +# Categories 'all' and 'none' are always available. Append any others +# you will pass as the first argument to func_warning from your own +# code. +warning_categories= + +# By default, display warnings according to 'opt_warning_types'. Set +# 'warning_func' to ':' to elide all warnings, or func_fatal_error to +# treat the next displayed warning as a fatal error. +warning_func=func_warn_and_continue + +# Set to 'all' to display all warnings, 'none' to suppress all +# warnings, or a space delimited list of some subset of +# 'warning_categories' to display only the listed warnings. +opt_warning_types=all + + +## -------------------- ## +## Resource management. ## +## -------------------- ## + +# This section contains definitions for functions that each ensure a +# particular resource (a file, or a non-empty configuration variable for +# example) is available, and if appropriate to extract default values +# from pertinent package files. Call them using their associated +# 'require_*' variable to ensure that they are executed, at most, once. +# +# It's entirely deliberate that calling these functions can set +# variables that don't obey the namespace limitations obeyed by the rest +# of this file, in order that that they be as useful as possible to +# callers. + + +# require_term_colors +# ------------------- +# Allow display of bold text on terminals that support it. +require_term_colors=func_require_term_colors +func_require_term_colors () +{ + $debug_cmd + + test -t 1 && { + # COLORTERM and USE_ANSI_COLORS environment variables take + # precedence, because most terminfo databases neglect to describe + # whether color sequences are supported. + test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"} + + if test 1 = "$USE_ANSI_COLORS"; then + # Standard ANSI escape sequences + tc_reset='[0m' + tc_bold='[1m'; tc_standout='[7m' + tc_red='[31m'; tc_green='[32m' + tc_blue='[34m'; tc_cyan='[36m' + else + # Otherwise trust the terminfo database after all. + test -n "`tput sgr0 2>/dev/null`" && { + tc_reset=`tput sgr0` + test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold` + tc_standout=$tc_bold + test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso` + test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1` + test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2` + test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4` + test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5` + } + fi + } + + require_term_colors=: +} + + +## ----------------- ## +## Function library. ## +## ----------------- ## + +# This section contains a variety of useful functions to call in your +# scripts. Take note of the portable wrappers for features provided by +# some modern shells, which will fall back to slower equivalents on +# less featureful shells. + + +# func_append VAR VALUE +# --------------------- +# Append VALUE onto the existing contents of VAR. + + # We should try to minimise forks, especially on Windows where they are + # unreasonably slow, so skip the feature probes when bash or zsh are + # being used: + if test set = "${BASH_VERSION+set}${ZSH_VERSION+set}"; then + : ${_G_HAVE_ARITH_OP="yes"} + : ${_G_HAVE_XSI_OPS="yes"} + # The += operator was introduced in bash 3.1 + case $BASH_VERSION in + [12].* | 3.0 | 3.0*) ;; + *) + : ${_G_HAVE_PLUSEQ_OP="yes"} + ;; + esac + fi + + # _G_HAVE_PLUSEQ_OP + # Can be empty, in which case the shell is probed, "yes" if += is + # useable or anything else if it does not work. + test -z "$_G_HAVE_PLUSEQ_OP" \ + && (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev/null \ + && _G_HAVE_PLUSEQ_OP=yes + +if test yes = "$_G_HAVE_PLUSEQ_OP" +then + # This is an XSI compatible shell, allowing a faster implementation... + eval 'func_append () + { + $debug_cmd + + eval "$1+=\$2" + }' +else + # ...otherwise fall back to using expr, which is often a shell builtin. + func_append () + { + $debug_cmd + + eval "$1=\$$1\$2" + } +fi + + +# func_append_quoted VAR VALUE +# ---------------------------- +# Quote VALUE and append to the end of shell variable VAR, separated +# by a space. +if test yes = "$_G_HAVE_PLUSEQ_OP"; then + eval 'func_append_quoted () + { + $debug_cmd + + func_quote_for_eval "$2" + eval "$1+=\\ \$func_quote_for_eval_result" + }' +else + func_append_quoted () + { + $debug_cmd + + func_quote_for_eval "$2" + eval "$1=\$$1\\ \$func_quote_for_eval_result" + } +fi + + +# func_append_uniq VAR VALUE +# -------------------------- +# Append unique VALUE onto the existing contents of VAR, assuming +# entries are delimited by the first character of VALUE. For example: +# +# func_append_uniq options " --another-option option-argument" +# +# will only append to $options if " --another-option option-argument " +# is not already present somewhere in $options already (note spaces at +# each end implied by leading space in second argument). +func_append_uniq () +{ + $debug_cmd + + eval _G_current_value='`$ECHO $'$1'`' + _G_delim=`expr "$2" : '\(.\)'` + + case $_G_delim$_G_current_value$_G_delim in + *"$2$_G_delim"*) ;; + *) func_append "$@" ;; + esac +} + + +# func_arith TERM... +# ------------------ +# Set func_arith_result to the result of evaluating TERMs. + test -z "$_G_HAVE_ARITH_OP" \ + && (eval 'test 2 = $(( 1 + 1 ))') 2>/dev/null \ + && _G_HAVE_ARITH_OP=yes + +if test yes = "$_G_HAVE_ARITH_OP"; then + eval 'func_arith () + { + $debug_cmd + + func_arith_result=$(( $* )) + }' +else + func_arith () + { + $debug_cmd + + func_arith_result=`expr "$@"` + } +fi + + +# func_basename FILE +# ------------------ +# Set func_basename_result to FILE with everything up to and including +# the last / stripped. +if test yes = "$_G_HAVE_XSI_OPS"; then + # If this shell supports suffix pattern removal, then use it to avoid + # forking. Hide the definitions single quotes in case the shell chokes + # on unsupported syntax... + _b='func_basename_result=${1##*/}' + _d='case $1 in + */*) func_dirname_result=${1%/*}$2 ;; + * ) func_dirname_result=$3 ;; + esac' + +else + # ...otherwise fall back to using sed. + _b='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`' + _d='func_dirname_result=`$ECHO "$1" |$SED "$sed_dirname"` + if test "X$func_dirname_result" = "X$1"; then + func_dirname_result=$3 + else + func_append func_dirname_result "$2" + fi' +fi + +eval 'func_basename () +{ + $debug_cmd + + '"$_b"' +}' + + +# func_dirname FILE APPEND NONDIR_REPLACEMENT +# ------------------------------------------- +# Compute the dirname of FILE. If nonempty, add APPEND to the result, +# otherwise set result to NONDIR_REPLACEMENT. +eval 'func_dirname () +{ + $debug_cmd + + '"$_d"' +}' + + +# 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" +# For efficiency, we do not delegate to the functions above but instead +# duplicate the functionality here. +eval 'func_dirname_and_basename () +{ + $debug_cmd + + '"$_b"' + '"$_d"' +}' + + +# func_echo ARG... +# ---------------- +# Echo program name prefixed message. +func_echo () +{ + $debug_cmd + + _G_message=$* + + func_echo_IFS=$IFS + IFS=$nl + for _G_line in $_G_message; do + IFS=$func_echo_IFS + $ECHO "$progname: $_G_line" + done + IFS=$func_echo_IFS +} + + +# func_echo_all ARG... +# -------------------- +# Invoke $ECHO with all args, space-separated. +func_echo_all () +{ + $ECHO "$*" +} + + +# func_echo_infix_1 INFIX ARG... +# ------------------------------ +# Echo program name, followed by INFIX on the first line, with any +# additional lines not showing INFIX. +func_echo_infix_1 () +{ + $debug_cmd + + $require_term_colors + + _G_infix=$1; shift + _G_indent=$_G_infix + _G_prefix="$progname: $_G_infix: " + _G_message=$* + + # Strip color escape sequences before counting printable length + for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan" + do + test -n "$_G_tc" && { + _G_esc_tc=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"` + _G_indent=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"` + } + done + _G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`" " ## exclude from sc_prohibit_nested_quotes + + func_echo_infix_1_IFS=$IFS + IFS=$nl + for _G_line in $_G_message; do + IFS=$func_echo_infix_1_IFS + $ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2 + _G_prefix=$_G_indent + done + IFS=$func_echo_infix_1_IFS +} + + +# func_error ARG... +# ----------------- +# Echo program name prefixed message to standard error. +func_error () +{ + $debug_cmd + + $require_term_colors + + func_echo_infix_1 " $tc_standout${tc_red}error$tc_reset" "$*" >&2 +} + + +# func_fatal_error ARG... +# ----------------------- +# Echo program name prefixed message to standard error, and exit. +func_fatal_error () +{ + $debug_cmd + + func_error "$*" + exit $EXIT_FAILURE +} + + +# func_grep EXPRESSION FILENAME +# ----------------------------- +# Check whether EXPRESSION matches any line of FILENAME, without output. +func_grep () +{ + $debug_cmd + + $GREP "$1" "$2" >/dev/null 2>&1 +} + + +# func_len STRING +# --------------- +# Set func_len_result to the length of STRING. STRING may not +# start with a hyphen. + test -z "$_G_HAVE_XSI_OPS" \ + && (eval 'x=a/b/c; + test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \ + && _G_HAVE_XSI_OPS=yes + +if test yes = "$_G_HAVE_XSI_OPS"; then + eval 'func_len () + { + $debug_cmd + + func_len_result=${#1} + }' +else + func_len () + { + $debug_cmd + + func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len` + } +fi + + +# func_mkdir_p DIRECTORY-PATH +# --------------------------- +# Make sure the entire path to DIRECTORY-PATH is available. +func_mkdir_p () +{ + $debug_cmd + + _G_directory_path=$1 + _G_dir_list= + + if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then + + # Protect directory names starting with '-' + case $_G_directory_path in + -*) _G_directory_path=./$_G_directory_path ;; + esac + + # While some portion of DIR does not yet exist... + while test ! -d "$_G_directory_path"; do + # ...make a list in topmost first order. Use a colon delimited + # list incase some portion of path contains whitespace. + _G_dir_list=$_G_directory_path:$_G_dir_list + + # If the last portion added has no slash in it, the list is done + case $_G_directory_path in */*) ;; *) break ;; esac + + # ...otherwise throw away the child directory and loop + _G_directory_path=`$ECHO "$_G_directory_path" | $SED -e "$sed_dirname"` + done + _G_dir_list=`$ECHO "$_G_dir_list" | $SED 's|:*$||'` + + func_mkdir_p_IFS=$IFS; IFS=: + for _G_dir in $_G_dir_list; do + IFS=$func_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 "$_G_dir" 2>/dev/null || : + done + IFS=$func_mkdir_p_IFS + + # Bail out if we (or some other process) failed to create a directory. + test -d "$_G_directory_path" || \ + func_fatal_error "Failed to create '$1'" + fi +} + + +# func_mktempdir [BASENAME] +# ------------------------- +# Make a temporary directory that won't clash with other running +# libtool processes, and avoids race conditions if possible. If +# given, BASENAME is the basename for that directory. +func_mktempdir () +{ + $debug_cmd + + _G_template=${TMPDIR-/tmp}/${1-$progname} + + if test : = "$opt_dry_run"; then + # Return a directory name, but don't create it in dry-run mode + _G_tmpdir=$_G_template-$$ + else + + # If mktemp works, use that first and foremost + _G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null` + + if test ! -d "$_G_tmpdir"; then + # Failing that, at least try and use $RANDOM to avoid a race + _G_tmpdir=$_G_template-${RANDOM-0}$$ + + func_mktempdir_umask=`umask` + umask 0077 + $MKDIR "$_G_tmpdir" + umask $func_mktempdir_umask + fi + + # If we're not in dry-run mode, bomb out on failure + test -d "$_G_tmpdir" || \ + func_fatal_error "cannot create temporary directory '$_G_tmpdir'" + fi + + $ECHO "$_G_tmpdir" +} + + +# 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. +func_normal_abspath () +{ + $debug_cmd + + # These SED scripts presuppose an absolute path with a trailing slash. + _G_pathcar='s|^/\([^/]*\).*$|\1|' + _G_pathcdr='s|^/[^/]*||' + _G_removedotparts=':dotsl + s|/\./|/|g + t dotsl + s|/\.$|/|' + _G_collapseslashes='s|/\{1,\}|/|g' + _G_finalslash='s|/*$|/|' + + # 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 "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_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 "$_G_pathcar"` + func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ + -e "$_G_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_append 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_notquiet ARG... +# -------------------- +# Echo program name prefixed message only when not in quiet mode. +func_notquiet () +{ + $debug_cmd + + $opt_quiet || 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_relative_path SRCDIR DSTDIR +# -------------------------------- +# Set func_relative_path_result to the relative path from SRCDIR to DSTDIR. +func_relative_path () +{ + $debug_cmd + + 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 -z "$func_relative_path_tlibdir"; 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 -n "$func_stripname_result"; then + func_append func_relative_path_result "/$func_stripname_result" + fi + + # Normalisation. If bindir is libdir, return '.' else relative path. + if test -n "$func_relative_path_result"; then + func_stripname './' '' "$func_relative_path_result" + func_relative_path_result=$func_stripname_result + fi + + test -n "$func_relative_path_result" || func_relative_path_result=. + + : +} + + +# func_quote_for_eval ARG... +# -------------------------- +# Aesthetically quote ARGs to be evaled later. +# This function returns two values: +# i) func_quote_for_eval_result +# double-quoted, suitable for a subsequent eval +# ii) func_quote_for_eval_unquoted_result +# has all characters that are still active within double +# quotes backslashified. +func_quote_for_eval () +{ + $debug_cmd + + func_quote_for_eval_unquoted_result= + func_quote_for_eval_result= + while test 0 -lt $#; do + case $1 in + *[\\\`\"\$]*) + _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;; + *) + _G_unquoted_arg=$1 ;; + esac + if test -n "$func_quote_for_eval_unquoted_result"; then + func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg" + else + func_append func_quote_for_eval_unquoted_result "$_G_unquoted_arg" + fi + + case $_G_unquoted_arg in + # Double-quote args containing shell metacharacters to delay + # word splitting, command substitution and variable expansion + # for a subsequent eval. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + _G_quoted_arg=\"$_G_unquoted_arg\" + ;; + *) + _G_quoted_arg=$_G_unquoted_arg + ;; + esac + + if test -n "$func_quote_for_eval_result"; then + func_append func_quote_for_eval_result " $_G_quoted_arg" + else + func_append func_quote_for_eval_result "$_G_quoted_arg" + fi + shift + done +} + + +# 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 () +{ + $debug_cmd + + case $1 in + *[\\\`\"]*) + _G_arg=`$ECHO "$1" | $SED \ + -e "$sed_double_quote_subst" -e "$sed_double_backslash"` ;; + *) + _G_arg=$1 ;; + esac + + case $_G_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. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + _G_arg=\"$_G_arg\" + ;; + esac + + func_quote_for_expand_result=$_G_arg +} + + +# func_stripname PREFIX SUFFIX NAME +# --------------------------------- +# strip PREFIX and SUFFIX from NAME, and store in func_stripname_result. +# 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). +if test yes = "$_G_HAVE_XSI_OPS"; then + eval 'func_stripname () + { + $debug_cmd + + # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are + # positional parameters, so assign one to ordinary variable first. + func_stripname_result=$3 + func_stripname_result=${func_stripname_result#"$1"} + func_stripname_result=${func_stripname_result%"$2"} + }' +else + func_stripname () + { + $debug_cmd + + case $2 in + .*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;; + *) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;; + esac + } +fi + + +# func_show_eval CMD [FAIL_EXP] +# ----------------------------- +# Unless opt_quiet 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 () +{ + $debug_cmd + + _G_cmd=$1 + _G_fail_exp=${2-':'} + + func_quote_for_expand "$_G_cmd" + eval "func_notquiet $func_quote_for_expand_result" + + $opt_dry_run || { + eval "$_G_cmd" + _G_status=$? + if test 0 -ne "$_G_status"; then + eval "(exit $_G_status); $_G_fail_exp" + fi + } +} + + +# func_show_eval_locale CMD [FAIL_EXP] +# ------------------------------------ +# Unless opt_quiet 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 () +{ + $debug_cmd + + _G_cmd=$1 + _G_fail_exp=${2-':'} + + $opt_quiet || { + func_quote_for_expand "$_G_cmd" + eval "func_echo $func_quote_for_expand_result" + } + + $opt_dry_run || { + eval "$_G_user_locale + $_G_cmd" + _G_status=$? + eval "$_G_safe_locale" + if test 0 -ne "$_G_status"; then + eval "(exit $_G_status); $_G_fail_exp" + 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 () +{ + $debug_cmd + + case $1 in + [0-9]* | *[!a-zA-Z0-9_]*) + func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'` + ;; + * ) + func_tr_sh_result=$1 + ;; + esac +} + + +# func_verbose ARG... +# ------------------- +# Echo program name prefixed message in verbose mode only. +func_verbose () +{ + $debug_cmd + + $opt_verbose && func_echo "$*" + + : +} + + +# func_warn_and_continue ARG... +# ----------------------------- +# Echo program name prefixed warning message to standard error. +func_warn_and_continue () +{ + $debug_cmd + + $require_term_colors + + func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2 +} + + +# func_warning CATEGORY ARG... +# ---------------------------- +# Echo program name prefixed warning message to standard error. Warning +# messages can be filtered according to CATEGORY, where this function +# elides messages where CATEGORY is not listed in the global variable +# 'opt_warning_types'. +func_warning () +{ + $debug_cmd + + # CATEGORY must be in the warning_categories list! + case " $warning_categories " in + *" $1 "*) ;; + *) func_internal_error "invalid warning category '$1'" ;; + esac + + _G_category=$1 + shift + + case " $opt_warning_types " in + *" $_G_category "*) $warning_func ${1+"$@"} ;; + esac +} + + +# func_sort_ver VER1 VER2 +# ----------------------- +# 'sort -V' is not generally available. +# Note this deviates from the version comparison in automake +# in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a +# but this should suffice as we won't be specifying old +# version formats or redundant trailing .0 in bootstrap.conf. +# If we did want full compatibility then we should probably +# use m4_version_compare from autoconf. +func_sort_ver () +{ + $debug_cmd + + printf '%s\n%s\n' "$1" "$2" \ + | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n -k 5,5n -k 6,6n -k 7,7n -k 8,8n -k 9,9n +} + +# func_lt_ver PREV CURR +# --------------------- +# Return true if PREV and CURR are in the correct order according to +# func_sort_ver, otherwise false. Use it like this: +# +# func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..." +func_lt_ver () +{ + $debug_cmd + + test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q` +} + + +# Local variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" +# time-stamp-time-zone: "UTC" +# End: +#! /bin/sh + +# Set a version string for this script. +scriptversion=2014-01-07.03; # UTC + +# A portable, pluggable option parser for Bourne shell. +# Written by Gary V. Vaughan, 2010 + +# Copyright (C) 2010-2015 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. + +# 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 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 <http://www.gnu.org/licenses/>. + +# Please report bugs or propose patches to gary@gnu.org. + + +## ------ ## +## Usage. ## +## ------ ## + +# This file is a library for parsing options in your shell scripts along +# with assorted other useful supporting features that you can make use +# of too. +# +# For the simplest scripts you might need only: +# +# #!/bin/sh +# . relative/path/to/funclib.sh +# . relative/path/to/options-parser +# scriptversion=1.0 +# func_options ${1+"$@"} +# eval set dummy "$func_options_result"; shift +# ...rest of your script... +# +# In order for the '--version' option to work, you will need to have a +# suitably formatted comment like the one at the top of this file +# starting with '# Written by ' and ending with '# warranty; '. +# +# For '-h' and '--help' to work, you will also need a one line +# description of your script's purpose in a comment directly above the +# '# Written by ' line, like the one at the top of this file. +# +# The default options also support '--debug', which will turn on shell +# execution tracing (see the comment above debug_cmd below for another +# use), and '--verbose' and the func_verbose function to allow your script +# to display verbose messages only when your user has specified +# '--verbose'. +# +# After sourcing this file, you can plug processing for additional +# options by amending the variables from the 'Configuration' section +# below, and following the instructions in the 'Option parsing' +# section further down. + +## -------------- ## +## Configuration. ## +## -------------- ## + +# You should override these variables in your script after sourcing this +# file so that they reflect the customisations you have added to the +# option parser. + +# The usage line for option parsing errors and the start of '-h' and +# '--help' output messages. You can embed shell variables for delayed +# expansion at the time the message is displayed, but you will need to +# quote other shell meta-characters carefully to prevent them being +# expanded when the contents are evaled. +usage='$progpath [OPTION]...' + +# Short help message in response to '-h' and '--help'. Add to this or +# override it after sourcing this library to reflect the full set of +# options your script accepts. +usage_message="\ + --debug enable verbose shell tracing + -W, --warnings=CATEGORY + report the warnings falling in CATEGORY [all] + -v, --verbose verbosely report processing + --version print version information and exit + -h, --help print short or long help message and exit +" + +# Additional text appended to 'usage_message' in response to '--help'. +long_help_message=" +Warning categories include: + 'all' show all warnings + 'none' turn off all the warnings + 'error' warnings are treated as fatal errors" + +# Help message printed before fatal option parsing errors. +fatal_help="Try '\$progname --help' for more information." + + + +## ------------------------- ## +## Hook function management. ## +## ------------------------- ## + +# This section contains functions for adding, removing, and running hooks +# to the main code. A hook is just a named list of of function, that can +# be run in order later on. + +# func_hookable FUNC_NAME +# ----------------------- +# Declare that FUNC_NAME will run hooks added with +# 'func_add_hook FUNC_NAME ...'. +func_hookable () +{ + $debug_cmd + + func_append hookable_fns " $1" +} + + +# func_add_hook FUNC_NAME HOOK_FUNC +# --------------------------------- +# Request that FUNC_NAME call HOOK_FUNC before it returns. FUNC_NAME must +# first have been declared "hookable" by a call to 'func_hookable'. +func_add_hook () +{ + $debug_cmd + + case " $hookable_fns " in + *" $1 "*) ;; + *) func_fatal_error "'$1' does not accept hook functions." ;; + esac + + eval func_append ${1}_hooks '" $2"' +} + + +# func_remove_hook FUNC_NAME HOOK_FUNC +# ------------------------------------ +# Remove HOOK_FUNC from the list of functions called by FUNC_NAME. +func_remove_hook () +{ + $debug_cmd + + eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`' +} + + +# func_run_hooks FUNC_NAME [ARG]... +# --------------------------------- +# Run all hook functions registered to FUNC_NAME. +# It is assumed that the list of hook functions contains nothing more +# than a whitespace-delimited list of legal shell function names, and +# no effort is wasted trying to catch shell meta-characters or preserve +# whitespace. +func_run_hooks () +{ + $debug_cmd + + case " $hookable_fns " in + *" $1 "*) ;; + *) func_fatal_error "'$1' does not support hook funcions.n" ;; + esac + + eval _G_hook_fns=\$$1_hooks; shift + + for _G_hook in $_G_hook_fns; do + eval $_G_hook '"$@"' + + # store returned options list back into positional + # parameters for next 'cmd' execution. + eval _G_hook_result=\$${_G_hook}_result + eval set dummy "$_G_hook_result"; shift + done + + func_quote_for_eval ${1+"$@"} + func_run_hooks_result=$func_quote_for_eval_result +} + + + +## --------------- ## +## Option parsing. ## +## --------------- ## + +# In order to add your own option parsing hooks, you must accept the +# full positional parameter list in your hook function, remove any +# options that you action, and then pass back the remaining unprocessed +# options in '<hooked_function_name>_result', escaped suitably for +# 'eval'. Like this: +# +# my_options_prep () +# { +# $debug_cmd +# +# # Extend the existing usage message. +# usage_message=$usage_message' +# -s, --silent don'\''t print informational messages +# ' +# +# func_quote_for_eval ${1+"$@"} +# my_options_prep_result=$func_quote_for_eval_result +# } +# func_add_hook func_options_prep my_options_prep +# +# +# my_silent_option () +# { +# $debug_cmd +# +# # Note that for efficiency, we parse as many options as we can +# # recognise in a loop before passing the remainder back to the +# # caller on the first unrecognised argument we encounter. +# while test $# -gt 0; do +# opt=$1; shift +# case $opt in +# --silent|-s) opt_silent=: ;; +# # Separate non-argument short options: +# -s*) func_split_short_opt "$_G_opt" +# set dummy "$func_split_short_opt_name" \ +# "-$func_split_short_opt_arg" ${1+"$@"} +# shift +# ;; +# *) set dummy "$_G_opt" "$*"; shift; break ;; +# esac +# done +# +# func_quote_for_eval ${1+"$@"} +# my_silent_option_result=$func_quote_for_eval_result +# } +# func_add_hook func_parse_options my_silent_option +# +# +# my_option_validation () +# { +# $debug_cmd +# +# $opt_silent && $opt_verbose && func_fatal_help "\ +# '--silent' and '--verbose' options are mutually exclusive." +# +# func_quote_for_eval ${1+"$@"} +# my_option_validation_result=$func_quote_for_eval_result +# } +# func_add_hook func_validate_options my_option_validation +# +# You'll alse need to manually amend $usage_message to reflect the extra +# options you parse. It's preferable to append if you can, so that +# multiple option parsing hooks can be added safely. + + +# func_options [ARG]... +# --------------------- +# All the functions called inside func_options are hookable. See the +# individual implementations for details. +func_hookable func_options +func_options () +{ + $debug_cmd + + func_options_prep ${1+"$@"} + eval func_parse_options \ + ${func_options_prep_result+"$func_options_prep_result"} + eval func_validate_options \ + ${func_parse_options_result+"$func_parse_options_result"} + + eval func_run_hooks func_options \ + ${func_validate_options_result+"$func_validate_options_result"} + + # save modified positional parameters for caller + func_options_result=$func_run_hooks_result +} + + +# func_options_prep [ARG]... +# -------------------------- +# All initialisations required before starting the option parse loop. +# Note that when calling hook functions, we pass through the list of +# positional parameters. If a hook function modifies that list, and +# needs to propogate that back to rest of this script, then the complete +# modified list must be put in 'func_run_hooks_result' before +# returning. +func_hookable func_options_prep +func_options_prep () +{ + $debug_cmd + + # Option defaults: + opt_verbose=false + opt_warning_types= + + func_run_hooks func_options_prep ${1+"$@"} + + # save modified positional parameters for caller + func_options_prep_result=$func_run_hooks_result +} + + +# func_parse_options [ARG]... +# --------------------------- +# The main option parsing loop. +func_hookable func_parse_options +func_parse_options () +{ + $debug_cmd + + func_parse_options_result= + + # this just eases exit handling + while test $# -gt 0; do + # Defer to hook functions for initial option parsing, so they + # get priority in the event of reusing an option name. + func_run_hooks func_parse_options ${1+"$@"} + + # Adjust func_parse_options positional parameters to match + eval set dummy "$func_run_hooks_result"; shift + + # Break out of the loop if we already parsed every option. + test $# -gt 0 || break + + _G_opt=$1 + shift + case $_G_opt in + --debug|-x) debug_cmd='set -x' + func_echo "enabling shell trace mode" + $debug_cmd + ;; + + --no-warnings|--no-warning|--no-warn) + set dummy --warnings none ${1+"$@"} + shift + ;; + + --warnings|--warning|-W) + test $# = 0 && func_missing_arg $_G_opt && break + case " $warning_categories $1" in + *" $1 "*) + # trailing space prevents matching last $1 above + func_append_uniq opt_warning_types " $1" + ;; + *all) + opt_warning_types=$warning_categories + ;; + *none) + opt_warning_types=none + warning_func=: + ;; + *error) + opt_warning_types=$warning_categories + warning_func=func_fatal_error + ;; + *) + func_fatal_error \ + "unsupported warning category: '$1'" + ;; + esac + shift + ;; + + --verbose|-v) opt_verbose=: ;; + --version) func_version ;; + -\?|-h) func_usage ;; + --help) func_help ;; + + # Separate optargs to long options (plugins may need this): + --*=*) func_split_equals "$_G_opt" + set dummy "$func_split_equals_lhs" \ + "$func_split_equals_rhs" ${1+"$@"} + shift + ;; + + # Separate optargs to short options: + -W*) + func_split_short_opt "$_G_opt" + set dummy "$func_split_short_opt_name" \ + "$func_split_short_opt_arg" ${1+"$@"} + shift + ;; + + # Separate non-argument short options: + -\?*|-h*|-v*|-x*) + func_split_short_opt "$_G_opt" + set dummy "$func_split_short_opt_name" \ + "-$func_split_short_opt_arg" ${1+"$@"} + shift + ;; + + --) break ;; + -*) func_fatal_help "unrecognised option: '$_G_opt'" ;; + *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;; + esac + done + + # save modified positional parameters for caller + func_quote_for_eval ${1+"$@"} + func_parse_options_result=$func_quote_for_eval_result +} + + +# func_validate_options [ARG]... +# ------------------------------ +# Perform any sanity checks on option settings and/or unconsumed +# arguments. +func_hookable func_validate_options +func_validate_options () +{ + $debug_cmd + + # Display all warnings if -W was not given. + test -n "$opt_warning_types" || opt_warning_types=" $warning_categories" + + func_run_hooks func_validate_options ${1+"$@"} + + # Bail if the options were screwed! + $exit_cmd $EXIT_FAILURE + + # save modified positional parameters for caller + func_validate_options_result=$func_run_hooks_result +} + + + +## ----------------- ## +## Helper functions. ## +## ----------------- ## + +# This section contains the helper functions used by the rest of the +# hookable option parser framework in ascii-betical order. + + +# func_fatal_help ARG... +# ---------------------- +# Echo program name prefixed message to standard error, followed by +# a help hint, and exit. +func_fatal_help () +{ + $debug_cmd + + eval \$ECHO \""Usage: $usage"\" + eval \$ECHO \""$fatal_help"\" + func_error ${1+"$@"} + exit $EXIT_FAILURE +} + + +# func_help +# --------- +# Echo long help message to standard output and exit. +func_help () +{ + $debug_cmd + + func_usage_message + $ECHO "$long_help_message" + exit 0 +} + + +# func_missing_arg ARGNAME +# ------------------------ +# Echo program name prefixed message to standard error and set global +# exit_cmd. +func_missing_arg () +{ + $debug_cmd + + func_error "Missing argument for '$1'." + exit_cmd=exit +} + + +# func_split_equals STRING +# ------------------------ +# Set func_split_equals_lhs and func_split_equals_rhs shell variables after +# splitting STRING at the '=' sign. +test -z "$_G_HAVE_XSI_OPS" \ + && (eval 'x=a/b/c; + test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \ + && _G_HAVE_XSI_OPS=yes + +if test yes = "$_G_HAVE_XSI_OPS" +then + # This is an XSI compatible shell, allowing a faster implementation... + eval 'func_split_equals () + { + $debug_cmd + + func_split_equals_lhs=${1%%=*} + func_split_equals_rhs=${1#*=} + test "x$func_split_equals_lhs" = "x$1" \ + && func_split_equals_rhs= + }' +else + # ...otherwise fall back to using expr, which is often a shell builtin. + func_split_equals () + { + $debug_cmd + + func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'` + func_split_equals_rhs= + test "x$func_split_equals_lhs" = "x$1" \ + || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'` + } +fi #func_split_equals + + +# 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. +if test yes = "$_G_HAVE_XSI_OPS" +then + # This is an XSI compatible shell, allowing a faster implementation... + eval 'func_split_short_opt () + { + $debug_cmd + + func_split_short_opt_arg=${1#??} + func_split_short_opt_name=${1%"$func_split_short_opt_arg"} + }' +else + # ...otherwise fall back to using expr, which is often a shell builtin. + func_split_short_opt () + { + $debug_cmd + + func_split_short_opt_name=`expr "x$1" : 'x-\(.\)'` + func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'` + } +fi #func_split_short_opt + + +# func_usage +# ---------- +# Echo short help message to standard output and exit. +func_usage () +{ + $debug_cmd + + func_usage_message + $ECHO "Run '$progname --help |${PAGER-more}' for full usage" + exit 0 +} + + +# func_usage_message +# ------------------ +# Echo short help message to standard output. +func_usage_message () +{ + $debug_cmd + + eval \$ECHO \""Usage: $usage"\" + echo + $SED -n 's|^# || + /^Written by/{ + x;p;x + } + h + /^Written by/q' < "$progpath" + echo + eval \$ECHO \""$usage_message"\" +} + + +# func_version +# ------------ +# Echo version message to standard output and exit. +func_version () +{ + $debug_cmd + + printf '%s\n' "$progname $scriptversion" + $SED -n ' + /(C)/!b go + :more + /\./!{ + N + s|\n# | | + b more + } + :go + /^# Written by /,/# warranty; / { + s|^# || + s|^# *$|| + s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2| + p + } + /^# Written by / { + s|^# || + p + } + /^warranty; /q' < "$progpath" + + exit $? +} + + +# Local variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" +# time-stamp-time-zone: "UTC" +# End: + +# Set a version string. +scriptversion='(GNU libtool) 2.4.6' + + +# func_echo ARG... +# ---------------- +# Libtool also displays the current mode in messages, so override +# funclib.sh func_echo with this custom definition. +func_echo () +{ + $debug_cmd + + _G_message=$* + + func_echo_IFS=$IFS + IFS=$nl + for _G_line in $_G_message; do + IFS=$func_echo_IFS + $ECHO "$progname${opt_mode+: $opt_mode}: $_G_line" + done + IFS=$func_echo_IFS +} + + +# func_warning ARG... +# ------------------- +# Libtool warnings are not categorized, so override funclib.sh +# func_warning with this simpler definition. +func_warning () +{ + $debug_cmd + + $warning_func ${1+"$@"} +} + + +## ---------------- ## +## Options parsing. ## +## ---------------- ## + +# Hook in the functions to make sure our own options are parsed during +# the option parsing loop. + +usage='$progpath [OPTION]... [MODE-ARG]...' + +# Short help message in response to '-h'. +usage_message="Options: + --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 + --no-warnings equivalent to '-Wnone' + --preserve-dup-deps don't remove duplicate dependency libraries + --quiet, --silent don't print informational messages + --tag=TAG use configuration variables from tag TAG + -v, --verbose print more informational messages than default + --version print version information + -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all] + -h, --help, --help-all print short, long, or detailed help message +" + +# Additional text appended to 'usage_message' in response to '--help'. +func_help () +{ + $debug_cmd + + func_usage_message + $ECHO "$long_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) + version: $progname (GNU libtool) 2.4.6 + automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q` + autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q` + +Report bugs to <bug-libtool@gnu.org>. +GNU libtool home page: <http://www.gnu.org/software/libtool/>. +General help using GNU software: <http://www.gnu.org/gethelp/>." + exit 0 +} + + +# func_lo2o OBJECT-NAME +# --------------------- +# Transform OBJECT-NAME from a '.lo' suffix to the platform specific +# object suffix. + +lo2o=s/\\.lo\$/.$objext/ +o2lo=s/\\.$objext\$/.lo/ + +if test yes = "$_G_HAVE_XSI_OPS"; then + eval 'func_lo2o () + { + case $1 in + *.lo) func_lo2o_result=${1%.lo}.$objext ;; + * ) func_lo2o_result=$1 ;; + esac + }' + + # func_xform LIBOBJ-OR-SOURCE + # --------------------------- + # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise) + # suffix to a '.lo' libtool-object suffix. + eval 'func_xform () + { + func_xform_result=${1%.*}.lo + }' +else + # ...otherwise fall back to using sed. + func_lo2o () + { + func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"` + } + + func_xform () + { + func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'` + } +fi + + +# func_fatal_configuration ARG... +# ------------------------------- +# Echo program name prefixed message to standard error, followed by +# a configuration failure hint, and exit. +func_fatal_configuration () +{ + func__fatal_error ${1+"$@"} \ + "See the $PACKAGE documentation for more information." \ + "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 yes = "$build_libtool_libs"; then + echo "enable shared libraries" + else + echo "disable shared libraries" + fi + if test yes = "$build_old_libs"; 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 +} + + +# libtool_options_prep [ARG]... +# ----------------------------- +# Preparation for options parsed by libtool. +libtool_options_prep () +{ + $debug_mode + + # Option defaults: + opt_config=false + opt_dlopen= + opt_dry_run=false + opt_help=false + opt_mode= + opt_preserve_dup_deps=false + opt_quiet=false + + nonopt= + preserve_args= + + # 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 + + # Pass back the list of options. + func_quote_for_eval ${1+"$@"} + libtool_options_prep_result=$func_quote_for_eval_result +} +func_add_hook func_options_prep libtool_options_prep + + +# libtool_parse_options [ARG]... +# --------------------------------- +# Provide handling for libtool specific options. +libtool_parse_options () +{ + $debug_cmd + + # Perform our own loop to consume as many options as possible in + # each iteration. + while test $# -gt 0; do + _G_opt=$1 + shift + case $_G_opt in + --dry-run|--dryrun|-n) + opt_dry_run=: + ;; + + --config) func_config ;; + + --dlopen|-dlopen) + opt_dlopen="${opt_dlopen+$opt_dlopen +}$1" + shift + ;; + + --preserve-dup-deps) + opt_preserve_dup_deps=: ;; + + --features) func_features ;; + + --finish) set dummy --mode finish ${1+"$@"}; shift ;; + + --help) opt_help=: ;; + + --help-all) opt_help=': help-all' ;; + + --mode) test $# = 0 && func_missing_arg $_G_opt && break + opt_mode=$1 + case $1 in + # Valid mode arguments: + clean|compile|execute|finish|install|link|relink|uninstall) ;; + + # Catch anything else as an error + *) func_error "invalid argument for $_G_opt" + exit_cmd=exit + break + ;; + esac + shift + ;; + + --no-silent|--no-quiet) + opt_quiet=false + func_append preserve_args " $_G_opt" + ;; + + --no-warnings|--no-warning|--no-warn) + opt_warning=false + func_append preserve_args " $_G_opt" + ;; + + --no-verbose) + opt_verbose=false + func_append preserve_args " $_G_opt" + ;; + + --silent|--quiet) + opt_quiet=: + opt_verbose=false + func_append preserve_args " $_G_opt" + ;; + + --tag) test $# = 0 && func_missing_arg $_G_opt && break + opt_tag=$1 + func_append preserve_args " $_G_opt $1" + func_enable_tag "$1" + shift + ;; + + --verbose|-v) opt_quiet=false + opt_verbose=: + func_append preserve_args " $_G_opt" + ;; + + # An option not handled by this hook function: + *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;; + esac + done + + + # save modified positional parameters for caller + func_quote_for_eval ${1+"$@"} + libtool_parse_options_result=$func_quote_for_eval_result +} +func_add_hook func_parse_options libtool_parse_options + + + +# libtool_validate_options [ARG]... +# --------------------------------- +# Perform any sanity checks on option settings and/or unconsumed +# arguments. +libtool_validate_options () +{ + # save first non-option argument + if test 0 -lt $#; then + nonopt=$1 + shift + fi + + # preserve --debug + test : = "$debug_cmd" || func_append preserve_args " --debug" + + case $host in + # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452 + # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788 + *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*) + # 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 + + test yes != "$build_libtool_libs" \ + && test yes != "$build_old_libs" \ + && func_fatal_configuration "not configured to build any kind of library" + + # Darwin sucks + eval std_shrext=\"$shrext_cmds\" + + # Only execute mode is allowed to have -dlopen flags. + if test -n "$opt_dlopen" && test execute != "$opt_mode"; 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." + } + + # Pass back the unparsed argument list + func_quote_for_eval ${1+"$@"} + libtool_validate_options_result=$func_quote_for_eval_result +} +func_add_hook func_validate_options libtool_validate_options + + +# Process options as early as possible so that --help and --version +# can return quickly. +func_options ${1+"$@"} +eval set dummy "$func_options_result"; shift + + + +## ----------- ## +## Main. ## +## ----------- ## + +magic='%%%MAGIC variable%%%' +magic_exe='%%%MAGIC EXE variable%%%' + +# Global variables. +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= + + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +$1 +_LTECHO_EOF' +} + +# func_generated_by_libtool +# True iff stdin has been generated by Libtool. This function is only +# a basic sanity check; it will hardly flush out determined imposters. +func_generated_by_libtool_p () +{ + $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 +} + +# 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 | func_generated_by_libtool_p +} + +# 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 yes = "$lalib_p" +} + +# 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 () +{ + test -f "$1" && + $lt_truncate_bin < "$1" 2>/dev/null | func_generated_by_libtool_p +} + +# 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 () +{ + $debug_cmd + + save_ifs=$IFS; IFS='~' + for cmd in $1; do + IFS=$sp$nl + eval cmd=\"$cmd\" + IFS=$save_ifs + 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 () +{ + $debug_cmd + + 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 () +{ + $debug_cmd + + 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 yes = "$build_libtool_libs"; then + write_lobj=\'$2\' + else + write_lobj=none + fi + + if test yes = "$build_old_libs"; then + write_oldobj=\'$3\' + else + write_oldobj=none + fi + + $opt_dry_run || { + cat >${write_libobj}T <<EOF +# $write_libobj - a libtool object file +# Generated by $PROGRAM (GNU $PACKAGE) $VERSION +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# Name of the PIC object. +pic_object=$write_lobj + +# Name of the non-PIC object +non_pic_object=$write_oldobj + +EOF + $MV "${write_libobj}T" "$write_libobj" + } +} + + +################################################## +# FILE NAME AND PATH CONVERSION HELPER FUNCTIONS # +################################################## + +# func_convert_core_file_wine_to_w32 ARG +# Helper function used by file name conversion functions when $build is *nix, +# and $host is mingw, cygwin, or some other w32 environment. Relies on a +# correctly configured wine environment available, with the winepath program +# in $build's $PATH. +# +# ARG is the $build file name to be converted to w32 format. +# Result is available in $func_convert_core_file_wine_to_w32_result, and will +# be empty on error (or when ARG is empty) +func_convert_core_file_wine_to_w32 () +{ + $debug_cmd + + func_convert_core_file_wine_to_w32_result=$1 + if test -n "$1"; then + # Unfortunately, winepath does not exit with a non-zero error code, so we + # are forced to check the contents of stdout. On the other hand, if the + # command is not found, the shell will set an exit code of 127 and print + # *an error message* to stdout. So we must check for both error code of + # zero AND non-empty stdout, which explains the odd construction: + func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null` + if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then + func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | + $SED -e "$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 () +{ + $debug_cmd + + # 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 () +{ + $debug_cmd + + 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 () +{ + $debug_cmd + + # awkward: cmd appends spaces to result + func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | + $SED -e 's/[ ]*$//' -e "$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 () +{ + $debug_cmd + + 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 () +{ + $debug_cmd + + 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 () +{ + $debug_cmd + + 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 () +{ + $debug_cmd + + $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 () +{ + $debug_cmd + + 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 () +{ + $debug_cmd + + 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 () +{ + $debug_cmd + + 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 () +{ + $debug_cmd + + 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 () +{ + $debug_cmd + + 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 () +{ + $debug_cmd + + 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 () +{ + $debug_cmd + + 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 () +{ + $debug_cmd + + 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 () +{ + $debug_cmd + + 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 () +{ + $debug_cmd + + 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 () +{ + $debug_cmd + + 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 () +{ + $debug_cmd + + 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_add2xrpath () +{ + dir="$1" + # 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 +} + +# 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 () +{ + $debug_cmd + + 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_dll_def_p FILE +# True iff FILE is a Windows DLL '.def' file. +# Keep in sync with _LT_DLL_DEF_P in libtool.m4 +func_dll_def_p () +{ + $debug_cmd + + func_dll_def_p_tmp=`$SED -n \ + -e 's/^[ ]*//' \ + -e '/^\(;.*\)*$/d' \ + -e 's/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p' \ + -e q \ + "$1"` + test DEF = "$func_dll_def_p_tmp" +} + + +# func_mode_compile arg... +func_mode_compile () +{ + $debug_cmd + + # 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=$srcfile + srcfile=$arg + arg_mode=normal + ;; + + target ) + libobj=$arg + arg_mode=normal + continue + ;; + + skip ) + lastarg= + 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 + ;; + + -Xlinker | -XCClinker) + arg_mode=skip # the next one is ignored for compile mode + 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 yes = "$build_libtool_libs" \ + || func_fatal_configuration "cannot 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 yes = "$build_old_libs"; 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 no = "$pic_mode" && test pass_all != "$deplibs_check_method"; 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 no = "$compiler_c_o"; 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 yes = "$need_locks"; 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 warn = "$need_locks"; 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 yes = "$build_libtool_libs"; then + # Without this assignment, base_compile gets emptied. + fbsd_hideous_sh_bug=$base_compile + + if test no != "$pic_mode"; 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 warn = "$need_locks" && + 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 yes = "$suppress_opt"; then + suppress_output=' >/dev/null 2>&1' + fi + fi + + # Only build a position-dependent object if we build old libraries. + if test yes = "$build_old_libs"; then + if test yes != "$pic_mode"; then + # Don't build PIC code + command="$base_compile $qsrcfile$pie_flag" + else + command="$base_compile $qsrcfile $pic_flag" + fi + if test yes = "$compiler_c_o"; 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 warn = "$need_locks" && + 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 no != "$need_locks"; then + removelist=$lockfile + $RM "$lockfile" + fi + } + + exit $EXIT_SUCCESS +} + +$opt_help || { + test compile = "$opt_mode" && 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 + -os2dllname NAME force a short DLL name on OS/2 (no effect on other OSes) + -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 () +{ + $debug_cmd + + # 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 $opt_dry_run; then + # 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 + else + 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 + fi +} + +test execute = "$opt_mode" && func_mode_execute ${1+"$@"} + + +# func_mode_finish arg... +func_mode_finish () +{ + $debug_cmd + + 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_quiet && 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 finish = "$opt_mode" && func_mode_finish ${1+"$@"} + + +# func_mode_install arg... +func_mode_install () +{ + $debug_cmd + + # There may be an optional sh(1) argument at the beginning of + # install_prog (especially on Windows NT). + if test "$SHELL" = "$nonopt" || test /bin/sh = "$nonopt" || + # 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=false + 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=: ;; + -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-m = "X$prev" && 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=: + if $isdir; 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 + ;; + os2*) + 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 yes = "$build_old_libs"; 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=: + 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'` + if test -n "$libdir" && test ! -f "$libfile"; then + func_warning "'$lib' has not been installed in '$libdir'" + finalize=false + fi + done + + relink_command= + func_source "$wrapper" + + outputname= + if test no = "$fast_install" && test -n "$relink_command"; then + $opt_dry_run || { + if $finalize; 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_quiet || { + 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 install = "$opt_mode" && 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 () +{ + $debug_cmd + + my_outputname=$1 + my_originator=$2 + my_pic_p=${3-false} + my_prefix=`$ECHO "$my_originator" | $SED 's%[^a-zA-Z0-9]%_%g'` + my_dlsyms= + + if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; 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) $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 can'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 + +#define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0) + +/* External symbol declarations for the compiler. */\ +" + + if test yes = "$dlself"; then + func_verbose "generating symbol list for '$output'" + + $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" + + # Add our own program objects to the symbol list. + progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` + for progfile in $progfiles; do + func_to_tool_file "$progfile" func_convert_file_msys_to_w32 + func_verbose "extracting global C symbols from '$func_to_tool_file_result'" + $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" + done + + if test -n "$exclude_expsyms"; then + $opt_dry_run || { + eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + } + fi + + if test -n "$export_symbols_regex"; then + $opt_dry_run || { + eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + } + fi + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + export_symbols=$output_objdir/$outputname.exp + $opt_dry_run || { + $RM $export_symbols + eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' + case $host in + *cygwin* | *mingw* | *cegcc* ) + eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' + eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' + ;; + esac + } + else + $opt_dry_run || { + eval "$SED -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' + eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + case $host in + *cygwin* | *mingw* | *cegcc* ) + eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' + eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' + ;; + esac + } + fi + fi + + for dlprefile in $dlprefiles; do + func_verbose "extracting global C symbols from '$dlprefile'" + func_basename "$dlprefile" + name=$func_basename_result + case $host in + *cygwin* | *mingw* | *cegcc* ) + # if an import library, we need to obtain dlname + if func_win32_import_lib_p "$dlprefile"; then + func_tr_sh "$dlprefile" + eval "curr_lafile=\$libfile_$func_tr_sh_result" + dlprefile_dlbasename= + if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then + # Use subshell, to avoid clobbering current variable values + dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` + if test -n "$dlprefile_dlname"; then + func_basename "$dlprefile_dlname" + dlprefile_dlbasename=$func_basename_result + else + # no lafile. user explicitly requested -dlpreopen <import library>. + $sharedlib_from_linklib_cmd "$dlprefile" + dlprefile_dlbasename=$sharedlib_from_linklib_result + fi + fi + $opt_dry_run || { + if test -n "$dlprefile_dlbasename"; then + eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' + else + func_warning "Could not compute DLL name from $name" + eval '$ECHO ": $name " >> "$nlist"' + fi + func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 + eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | + $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" + } + else # not an import lib + $opt_dry_run || { + eval '$ECHO ": $name " >> "$nlist"' + func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 + eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" + } + fi + ;; + *) + $opt_dry_run || { + eval '$ECHO ": $name " >> "$nlist"' + func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 + eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" + } + ;; + esac + done + + $opt_dry_run || { + # Make sure we have at least an empty file. + test -f "$nlist" || : > "$nlist" + + if test -n "$exclude_expsyms"; then + $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T + $MV "$nlist"T "$nlist" + fi + + # Try sorting and uniquifying the output. + if $GREP -v "^: " < "$nlist" | + if sort -k 3 </dev/null >/dev/null 2>&1; then + sort -k 3 + else + sort +2 + fi | + uniq > "$nlist"S; then + : + else + $GREP -v "^: " < "$nlist" > "$nlist"S + fi + + if test -f "$nlist"S; then + eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' + else + echo '/* NONE */' >> "$output_objdir/$my_dlsyms" + fi + + func_show_eval '$RM "${nlist}I"' + if test -n "$global_symbol_to_import"; then + eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I' + 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[];\ +" + + if test -s "$nlist"I; then + echo >> "$output_objdir/$my_dlsyms" "\ +static void lt_syminit(void) +{ + LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols; + for (; symbol->name; ++symbol) + {" + $SED 's/.*/ if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/' < "$nlist"I >> "$output_objdir/$my_dlsyms" + echo >> "$output_objdir/$my_dlsyms" "\ + } +}" + fi + echo >> "$output_objdir/$my_dlsyms" "\ +LT_DLSYM_CONST lt_dlsymlist +lt_${my_prefix}_LTX_preloaded_symbols[] = +{ {\"$my_originator\", (void *) 0}," + + if test -s "$nlist"I; then + echo >> "$output_objdir/$my_dlsyms" "\ + {\"@INIT@\", (void *) <_syminit}," + fi + + 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" ;; + *) + $my_pic_p && pic_flag_for_symtable=" $pic_flag" + ;; + 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" "${nlist}I"' + + # 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_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 () +{ + $debug_cmd + + 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 () +{ + $debug_cmd + + 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_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 () +{ + $debug_cmd + + 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 + case $nm_interface in + "MS dumpbin") + if func_cygming_ms_implib_p "$1" || + func_cygming_gnu_implib_p "$1" + then + win32_nmres=import + else + win32_nmres= + fi + ;; + *) + 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 + } + }'` + ;; + esac + 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 () +{ + $debug_cmd + + 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 () +{ + $debug_cmd + + 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 that possess that section. Heuristic: eliminate + # all those that 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_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 () +{ + $debug_cmd + + 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 () +{ + $debug_cmd + + f_ex_an_ar_dir=$1; shift + f_ex_an_ar_oldlib=$1 + if test yes = "$lock_old_archive_extraction"; 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 yes = "$lock_old_archive_extraction"; 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 () +{ + $debug_cmd + + 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` + func_basename "$darwin_archive" + darwin_base_archive=$func_basename_result + 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 "$sed_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 where 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) $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/ that is used only on +# windows platforms, and (c) all begin with the string "--lt-" +# (application programs are unlikely to have options that 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) $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 yes = "$fast_install"; 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 yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then + $ECHO "\ + # Add our own library path to $shlibpath_var + $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" + + # Some systems cannot cope with colon-terminated $shlibpath_var + # The second colon is a workaround for a bug in BeOS R4 sed + $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` + + export $shlibpath_var +" + fi + + $ECHO "\ + if test \"\$libtool_execute_magic\" != \"$magic\"; then + # Run the actual program with our arguments. + func_exec_program \${1+\"\$@\"} + fi + else + # The program doesn't exist. + \$ECHO \"\$0: error: '\$progdir/\$program' does not exist\" 1>&2 + \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 + \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 + exit 1 + fi +fi\ +" +} + + +# func_emit_cwrapperexe_src +# emit the source code for a wrapper executable on stdout +# Must ONLY be called from within func_mode_link because +# it depends on a number of variable set therein. +func_emit_cwrapperexe_src () +{ + cat <<EOF + +/* $cwrappersource - temporary wrapper executable for $objdir/$outputname + Generated by $PROGRAM (GNU $PACKAGE) $VERSION + + The $output program cannot be directly executed until all the libtool + libraries that it depends on are installed. + + This wrapper executable should never be moved out of the build directory. + If it is, it will not operate correctly. +*/ +EOF + cat <<"EOF" +#ifdef _MSC_VER +# define _CRT_SECURE_NO_DEPRECATE 1 +#endif +#include <stdio.h> +#include <stdlib.h> +#ifdef _MSC_VER +# include <direct.h> +# include <process.h> +# include <io.h> +#else +# include <unistd.h> +# include <stdint.h> +# ifdef __CYGWIN__ +# include <io.h> +# endif +#endif +#include <malloc.h> +#include <stdarg.h> +#include <assert.h> +#include <string.h> +#include <ctype.h> +#include <errno.h> +#include <fcntl.h> +#include <sys/stat.h> + +#define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0) + +/* 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_platform || defined ... */ +#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 +#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 (stale); stale = 0; } \ +} while (0) + +#if defined LT_DEBUGWRAPPER +static int lt_debug = 1; +#else +static int lt_debug = 0; +#endif + +const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ + +void *xmalloc (size_t num); +char *xstrdup (const char *string); +const char *base_name (const char *name); +char *find_executable (const char *wrapper); +char *chase_symlinks (const char *pathspec); +int make_executable (const char *path); +int check_executable (const char *path); +char *strendzap (char *str, const char *pat); +void lt_debugprintf (const char *file, int line, const char *fmt, ...); +void lt_fatal (const char *file, int line, const char *message, ...); +static const char *nonnull (const char *s); +static const char *nonempty (const char *s); +void lt_setenv (const char *name, const char *value); +char *lt_extend_str (const char *orig_value, const char *add, int to_end); +void lt_update_exe_path (const char *name, const char *value); +void lt_update_lib_path (const char *name, const char *value); +char **prepare_spawn (char **argv); +void lt_dump_script (FILE *f); +EOF + + cat <<EOF +#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5) +# define externally_visible volatile +#else +# define externally_visible __attribute__((externally_visible)) volatile +#endif +externally_visible const char * MAGIC_EXE = "$magic_exe"; +const char * LIB_PATH_VARNAME = "$shlibpath_var"; +EOF + + if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then + func_to_host_path "$temp_rpath" + cat <<EOF +const char * LIB_PATH_VALUE = "$func_to_host_path_result"; +EOF + else + cat <<"EOF" +const char * LIB_PATH_VALUE = ""; +EOF + fi + + if test -n "$dllsearchpath"; then + func_to_host_path "$dllsearchpath:" + cat <<EOF +const char * EXE_PATH_VARNAME = "PATH"; +const char * EXE_PATH_VALUE = "$func_to_host_path_result"; +EOF + else + cat <<"EOF" +const char * EXE_PATH_VARNAME = ""; +const char * EXE_PATH_VALUE = ""; +EOF + fi + + if test yes = "$fast_install"; then + cat <<EOF +const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */ +EOF + else + cat <<EOF +const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */ +EOF + fi + + + cat <<"EOF" + +#define LTWRAPPER_OPTION_PREFIX "--lt-" + +static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX; +static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script"; +static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug"; + +int +main (int argc, char *argv[]) +{ + char **newargz; + int newargc; + char *tmp_pathspec; + char *actual_cwrapper_path; + char *actual_cwrapper_name; + char *target_name; + char *lt_argv_zero; + int rval = 127; + + int i; + + program_name = (char *) xstrdup (base_name (argv[0])); + newargz = XMALLOC (char *, (size_t) argc + 1); + + /* very simple arg parsing; don't want to rely on getopt + * also, copy all non cwrapper options to newargz, except + * argz[0], which is handled differently + */ + newargc=0; + for (i = 1; i < argc; i++) + { + if (STREQ (argv[i], dumpscript_opt)) + { +EOF + case $host in + *mingw* | *cygwin* ) + # make stdout use "unix" line endings + echo " setmode(1,_O_BINARY);" + ;; + esac + + cat <<"EOF" + lt_dump_script (stdout); + return 0; + } + if (STREQ (argv[i], debug_opt)) + { + lt_debug = 1; + continue; + } + if (STREQ (argv[i], ltwrapper_option_prefix)) + { + /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX + namespace, but it is not one of the ones we know about and + have already dealt with, above (inluding dump-script), then + report an error. Otherwise, targets might begin to believe + they are allowed to use options in the LTWRAPPER_OPTION_PREFIX + namespace. The first time any user complains about this, we'll + need to make LTWRAPPER_OPTION_PREFIX a configure-time option + or a configure.ac-settable value. + */ + lt_fatal (__FILE__, __LINE__, + "unrecognized %s option: '%s'", + ltwrapper_option_prefix, argv[i]); + } + /* otherwise ... */ + newargz[++newargc] = xstrdup (argv[i]); + } + newargz[++newargc] = NULL; + +EOF + cat <<EOF + /* The GNU banner must be the first non-error debug message */ + lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE) $VERSION\n"); +EOF + cat <<"EOF" + lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]); + lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name); + + tmp_pathspec = find_executable (argv[0]); + if (tmp_pathspec == NULL) + lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]); + lt_debugprintf (__FILE__, __LINE__, + "(main) found exe (before symlink chase) at: %s\n", + tmp_pathspec); + + actual_cwrapper_path = chase_symlinks (tmp_pathspec); + lt_debugprintf (__FILE__, __LINE__, + "(main) found exe (after symlink chase) at: %s\n", + actual_cwrapper_path); + XFREE (tmp_pathspec); + + actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path)); + strendzap (actual_cwrapper_path, actual_cwrapper_name); + + /* wrapper name transforms */ + strendzap (actual_cwrapper_name, ".exe"); + tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1); + XFREE (actual_cwrapper_name); + actual_cwrapper_name = tmp_pathspec; + tmp_pathspec = 0; + + /* target_name transforms -- use actual target program name; might have lt- prefix */ + target_name = xstrdup (base_name (TARGET_PROGRAM_NAME)); + strendzap (target_name, ".exe"); + tmp_pathspec = lt_extend_str (target_name, ".exe", 1); + XFREE (target_name); + target_name = tmp_pathspec; + tmp_pathspec = 0; + + lt_debugprintf (__FILE__, __LINE__, + "(main) libtool target name: %s\n", + target_name); +EOF + + cat <<EOF + newargz[0] = + XMALLOC (char, (strlen (actual_cwrapper_path) + + strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1)); + strcpy (newargz[0], actual_cwrapper_path); + strcat (newargz[0], "$objdir"); + strcat (newargz[0], "/"); +EOF + + cat <<"EOF" + /* stop here, and copy so we don't have to do this twice */ + tmp_pathspec = xstrdup (newargz[0]); + + /* do NOT want the lt- prefix here, so use actual_cwrapper_name */ + strcat (newargz[0], actual_cwrapper_name); + + /* DO want the lt- prefix here if it exists, so use target_name */ + lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1); + XFREE (tmp_pathspec); + tmp_pathspec = NULL; +EOF + + case $host_os in + mingw*) + cat <<"EOF" + { + char* p; + while ((p = strchr (newargz[0], '\\')) != NULL) + { + *p = '/'; + } + while ((p = strchr (lt_argv_zero, '\\')) != NULL) + { + *p = '/'; + } + } +EOF + ;; + esac + + cat <<"EOF" + XFREE (target_name); + XFREE (actual_cwrapper_path); + XFREE (actual_cwrapper_name); + + lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */ + lt_setenv ("DUALCASE", "1"); /* for MSK sh */ + /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must + be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath) + because on Windows, both *_VARNAMEs are PATH but uninstalled + libraries must come first. */ + lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE); + lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE); + + lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n", + nonnull (lt_argv_zero)); + for (i = 0; i < newargc; i++) + { + lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n", + i, nonnull (newargz[i])); + } + +EOF + + case $host_os in + mingw*) + cat <<"EOF" + /* execv doesn't actually work on mingw as expected on unix */ + newargz = prepare_spawn (newargz); + rval = (int) _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz); + if (rval == -1) + { + /* failed to start process */ + lt_debugprintf (__FILE__, __LINE__, + "(main) failed to launch target \"%s\": %s\n", + lt_argv_zero, nonnull (strerror (errno))); + return 127; + } + return rval; +EOF + ;; + *) + cat <<"EOF" + execv (lt_argv_zero, newargz); + return rval; /* =127, but avoids unused variable warning */ +EOF + ;; + esac + + cat <<"EOF" +} + +void * +xmalloc (size_t num) +{ + void *p = (void *) malloc (num); + if (!p) + lt_fatal (__FILE__, __LINE__, "memory exhausted"); + + return p; +} + +char * +xstrdup (const char *string) +{ + return string ? strcpy ((char *) xmalloc (strlen (string) + 1), + string) : NULL; +} + +const char * +base_name (const char *name) +{ + const char *base; + +#if defined HAVE_DOS_BASED_FILE_SYSTEM + /* Skip over the disk name in MSDOS pathnames. */ + if (isalpha ((unsigned char) name[0]) && name[1] == ':') + name += 2; +#endif + + for (base = name; *name; name++) + if (IS_DIR_SEPARATOR (*name)) + base = name + 1; + return base; +} + +int +check_executable (const char *path) +{ + struct stat st; + + lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n", + nonempty (path)); + if ((!path) || (!*path)) + return 0; + + if ((stat (path, &st) >= 0) + && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) + return 1; + else + return 0; +} + +int +make_executable (const char *path) +{ + int rval = 0; + struct stat st; + + lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", + nonempty (path)); + if ((!path) || (!*path)) + return 0; + + if (stat (path, &st) >= 0) + { + rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); + } + return rval; +} + +/* Searches for the full path of the wrapper. Returns + newly allocated full path name if found, NULL otherwise + Does not chase symlinks, even on platforms that support them. +*/ +char * +find_executable (const char *wrapper) +{ + int has_slash = 0; + const char *p; + const char *p_next; + /* static buffer for getcwd */ + char tmp[LT_PATHMAX + 1]; + size_t 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 = (size_t) (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 (STREQ (str, pat)) + *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 + size_t 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) + { + size_t orig_value_len = strlen (orig_value); + size_t 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 #' */ + size_t len = strlen (new_value); + while ((len > 0) && IS_PATH_SEPARATOR (new_value[len-1])) + { + new_value[--len] = '\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 () +{ + $debug_cmd + + case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in + *import*) : ;; + *) false ;; + esac +} + +# func_suncc_cstd_abi +# !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!! +# Several compiler flags select an ABI that is incompatible with the +# Cstd library. Avoid specifying it if any are in CXXFLAGS. +func_suncc_cstd_abi () +{ + $debug_cmd + + case " $compile_command " in + *" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*) + suncc_use_cstd_abi=no + ;; + *) + suncc_use_cstd_abi=yes + ;; + esac +} + +# func_mode_link arg... +func_mode_link () +{ + $debug_cmd + + 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 + # what 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 that 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= + os2dllname= + non_pic_objects= + precious_files_regex= + prefer_static_libs=no + preload=false + 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 yes != "$build_libtool_libs" \ + && func_fatal_configuration "cannot build a shared library" + build_old_libs=no + break + ;; + -all-static | -static | -static-libtool-libs) + case $arg in + -all-static) + if test yes = "$build_libtool_libs" && 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) + $preload || { + # Add the symbol object into the linking commands. + func_append compile_command " @SYMFILE@" + func_append finalize_command " @SYMFILE@" + preload=: + } + case $arg in + *.la | *.lo) ;; # We handle these cases below. + force) + if test no = "$dlself"; then + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + self) + if test dlprefiles = "$prev"; then + dlself=yes + elif test dlfiles = "$prev" && test yes != "$dlopen_self"; then + dlself=yes + else + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + *) + if test dlfiles = "$prev"; 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 + ;; + mllvm) + # Clang does not use LLVM to link, so we can simply discard any + # '-mllvm $arg' options when doing the link step. + 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 none = "$pic_object" && + test none = "$non_pic_object"; 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 none != "$pic_object"; then + # Prepend the subdirectory the object is found in. + pic_object=$xdir$pic_object + + if test dlfiles = "$prev"; then + if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; 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 dlprefiles = "$prev"; 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 none != "$non_pic_object"; 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 none = "$pic_object"; 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 + ;; + os2dllname) + os2dllname=$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 rpath = "$prev"; 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-export-symbols = "X$arg"; 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-lc = "X$arg" || test X-lm = "X$arg"; 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-lc = "X$arg" && continue + ;; + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*) + # Do not include libc due to us having libc/libc_r. + test X-lc = "X$arg" && 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-lc = "X$arg" && continue + ;; + *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) + # Compiler inserts libc in the correct place for threads to work + test X-lc = "X$arg" && continue + ;; + esac + elif test X-lc_r = "X$arg"; then + case $host in + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*) + # Do not include libc_r directly, use -pthread flag. + continue + ;; + esac + fi + func_append deplibs " $arg" + continue + ;; + + -mllvm) + prev=mllvm + 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 + ;; + + -os2dllname) + prev=os2dllname + 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. + func_add2xrpath "$dir" + 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,--start-group|-Wl,--end-group|-Wl,-\(|-Wl,-\)) + func_append deplibs " $arg" + continue + ;; + + -Wl,*) + wlprefix=`expr x"$wl" : '.*' - 1` + wlprefix=`expr x"$arg" : 'x\(.\{'"$wlprefix"'\}\)'` + if test x"$wlprefix" = x"$wl" -a x"$wl" != x"-Wl,"; then + func_append compiler_flags " $arg" + func_append compile_command " $arg" + func_append finalize_command " $arg" + if expr "x$arg" : '^x'"$wl"'-rpath,,' >/dev/null ; then + func_stripname "$wl"'-rpath,,' '' "$arg" + dir=$func_stripname_result + func_add2xrpath "$dir" + elif expr "x$arg" : '^x'"$wl"'-rpath$' >/dev/null ; then + func_stripname "$wl" '' "$1" + dir=$func_stripname_result + if ! expr "x$1" : '^x'"$wl" >/dev/null \ + || ! test -d "$dir" ; then + func_fatal_error "$wl"'-rpath must be followed by '"$wl"'-escaped directory' + fi + shift + func_add2xrpath "$dir" + continue + else + func_stripname "$wl" '' "$arg" + func_append new_inherited_linker_flags " -Wl,$func_stripname_result" + fi + continue + elif expr "x$arg" : '^x-Wl,-rpath,' >/dev/null ; then + func_stripname '-Wl,-rpath,' '' "$arg" + dir=$func_stripname_result + func_add2xrpath "$dir" + continue + elif expr "x$arg" : '^x-Wl,-rpath$' >/dev/null ; then + func_stripname '-Wl,' '' "$1" + dir=$func_stripname_result + if ! expr "x$1" : '^x-Wl,' >/dev/null \ + || ! test -d "$dir" ; then + func_fatal_error '-Wl,-rpath must be followed by -Wl-escaped directory' + fi + func_quote_for_eval "$1" + func_append libtool_args " $func_quote_for_eval_result" + shift + func_add2xrpath "$dir" + continue + fi + 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 + # -fstack-protector* stack protector flags for GCC + # @file GCC response files + # -tp=* Portland pgcc target processor selection + # --sysroot=* for sysroot support + # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization + # -stdlib=* select c++ std lib with clang + -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*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*) + 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 + ;; + + -Z*) + if test os2 = "`expr $host : '.*\(os2\)'`"; then + # OS/2 uses -Zxxx to specify OS/2-specific options + compiler_flags="$compiler_flags $arg" + func_append compile_command " $arg" + func_append finalize_command " $arg" + case $arg in + -Zlinker | -Zstack) + prev=xcompiler + ;; + esac + continue + else + # Otherwise treat like 'Some other compiler flag' below + func_quote_for_eval "$arg" + arg=$func_quote_for_eval_result + fi + ;; + + # 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 none = "$pic_object" && + test none = "$non_pic_object"; then + func_fatal_error "cannot find name of object for '$arg'" + fi + + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir=$func_dirname_result + + test none = "$pic_object" || { + # Prepend the subdirectory the object is found in. + pic_object=$xdir$pic_object + + if test dlfiles = "$prev"; then + if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; 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 dlprefiles = "$prev"; then + # Preload the old-style object. + func_append dlprefiles " $pic_object" + prev= + fi + + # A PIC object. + func_append libobjs " $pic_object" + arg=$pic_object + } + + # Non-PIC object. + if test none != "$non_pic_object"; 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 none = "$pic_object"; 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 dlfiles = "$prev"; then + # This library was specified with -dlopen. + func_append dlfiles " $func_resolve_sysroot_result" + prev= + elif test dlprefiles = "$prev"; 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 yes = "$export_dynamic" && 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\" + + # Definition is injected by LT_CONFIG during libtool generation. + func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH" + + 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 lib = "$linkmode"; 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=false + 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 lib,link = "$linkmode,$pass"; 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 lib,link = "$linkmode,$pass" || + test prog,scan = "$linkmode,$pass"; then + libs=$deplibs + deplibs= + fi + if test prog = "$linkmode"; then + case $pass in + dlopen) libs=$dlfiles ;; + dlpreopen) libs=$dlprefiles ;; + link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; + esac + fi + if test lib,dlpreopen = "$linkmode,$pass"; 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 dlopen = "$pass"; then + # Collect dlpreopened libraries + save_deplibs=$deplibs + deplibs= + fi + + for deplib in $libs; do + lib= + found=false + case $deplib in + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ + |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) + if test prog,link = "$linkmode,$pass"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + func_append compiler_flags " $deplib" + if test lib = "$linkmode"; then + case "$new_inherited_linker_flags " in + *" $deplib "*) ;; + * ) func_append new_inherited_linker_flags " $deplib" ;; + esac + fi + fi + continue + ;; + -l*) + if test lib != "$linkmode" && test prog != "$linkmode"; then + func_warning "'-l' is ignored for archives/objects" + continue + fi + func_stripname '-l' '' "$deplib" + name=$func_stripname_result + if test lib = "$linkmode"; 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 .la = "$search_ext"; then + found=: + else + found=false + fi + break 2 + fi + done + done + if $found; then + # 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 yes = "$allow_libtool_libs_with_static_runtimes"; 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=false + func_dirname "$lib" "" "." + ladir=$func_dirname_result + lib=$ladir/$old_library + if test prog,link = "$linkmode,$pass"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs" + fi + continue + fi + fi + ;; + *) ;; + esac + fi + else + # deplib doesn't seem to be a libtool library + if test prog,link = "$linkmode,$pass"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs" + fi + continue + fi + ;; # -l + *.ltframework) + if test prog,link = "$linkmode,$pass"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + if test lib = "$linkmode"; 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 conv = "$pass" && 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 conv = "$pass"; then + deplibs="$deplib $deplibs" + continue + fi + if test scan = "$pass"; 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 link = "$pass"; 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 conv = "$pass"; 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=false + 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=: + fi + ;; + pass_all) + valid_a_lib=: + ;; + esac + if $valid_a_lib; then + echo + $ECHO "*** Warning: Linking the shared library $output against the" + $ECHO "*** static library $deplib is not portable!" + deplibs="$deplib $deplibs" + else + 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." + fi + ;; + esac + continue + ;; + prog) + if test link != "$pass"; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + continue + ;; + esac # linkmode + ;; # *.$libext + *.lo | *.$objext) + if test conv = "$pass"; then + deplibs="$deplib $deplibs" + elif test prog = "$linkmode"; then + if test dlpreopen = "$pass" || test yes != "$dlopen_support" || test no = "$build_libtool_libs"; 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=: + continue + ;; + -Wl,--start-group|-Wl,--end-group|-Wl,-\(|-Wl,-\)) + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + fi + continue + ;; + esac # case $deplib + + $found || test -f "$lib" \ + || func_fatal_error "cannot find the library '$lib' or unhandled argument '$deplib'" + + # 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'` + + # Additionally convert " -pthread" to " -Wl,-pthread" for nagfor + if test yes = "$with_nagfor" ; then + tmp_inherited_linker_flags=`$ECHO " $tmp_inherited_linker_flags" | $SED 's/ -pthread\b/ -Wl,-pthread/g'` + fi + + 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 lib,link = "$linkmode,$pass" || + test prog,scan = "$linkmode,$pass" || + { test prog != "$linkmode" && test lib != "$linkmode"; }; then + test -n "$dlopen" && func_append dlfiles " $dlopen" + test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" + fi + + if test conv = "$pass"; 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 prog != "$linkmode" && test lib != "$linkmode"; 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 yes = "$prefer_static_libs" || + test built,no = "$prefer_static_libs,$installed"; }; 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 dlopen = "$pass"; then + test -z "$libdir" \ + && func_fatal_error "cannot -dlopen a convenience library: '$lib'" + if test -z "$dlname" || + test yes != "$dlopen_support" || + test no = "$build_libtool_libs" + 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 yes = "$installed"; 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 yes = "$hardcode_automatic" && 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 dlpreopen = "$pass"; then + if test -z "$libdir" && test prog = "$linkmode"; 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 lib = "$linkmode"; then + deplibs="$dir/$old_library $deplibs" + elif test prog,link = "$linkmode,$pass"; 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 prog = "$linkmode" && test link != "$pass"; then + func_append newlib_search_path " $ladir" + deplibs="$lib $deplibs" + + linkalldeplibs=false + if test no != "$link_all_deplibs" || test -z "$library_names" || + test no = "$build_libtool_libs"; then + linkalldeplibs=: + 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 $linkalldeplibs; 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 prog,link = "$linkmode,$pass"; then + if test -n "$library_names" && + { { test no = "$prefer_static_libs" || + test built,yes = "$prefer_static_libs,$installed"; } || + 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 $alldeplibs && + { test pass_all = "$deplibs_check_method" || + { test yes = "$build_libtool_libs" && + 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 built = "$use_static_libs" && test yes = "$installed"; then + use_static_libs=no + fi + if test -n "$library_names" && + { test no = "$use_static_libs" || test -z "$old_library"; }; then + case $host in + *cygwin* | *mingw* | *cegcc* | *os2*) + # No point in relinking DLLs because paths are not encoded + func_append notinst_deplibs " $lib" + need_relink=no + ;; + *) + if test no = "$installed"; 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 yes = "$shouldnotlink" && test link = "$pass"; then + echo + if test prog = "$linkmode"; 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 lib = "$linkmode" && + test yes = "$hardcode_into_libs"; 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* | *os2*) + 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 prog = "$linkmode" || test relink != "$opt_mode"; then + add_shlibpath= + add_dir= + add= + lib_linked=yes + case $hardcode_action in + immediate | unsupported) + if test no = "$hardcode_direct"; 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 cannot + # 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 no = "$hardcode_minus_L"; then + case $host in + *-*-sunos*) add_shlibpath=$dir ;; + esac + add_dir=-L$dir + add=-l$name + elif test no = "$hardcode_shlibpath_var"; then + add_shlibpath=$dir + add=-l$name + else + lib_linked=no + fi + ;; + relink) + if test yes = "$hardcode_direct" && + test no = "$hardcode_direct_absolute"; then + add=$dir/$linklib + elif test yes = "$hardcode_minus_L"; 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 yes = "$hardcode_shlibpath_var"; then + add_shlibpath=$dir + add=-l$name + else + lib_linked=no + fi + ;; + *) lib_linked=no ;; + esac + + if test yes != "$lib_linked"; 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 prog = "$linkmode"; 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 yes != "$hardcode_direct" && + test yes != "$hardcode_minus_L" && + test yes = "$hardcode_shlibpath_var"; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) func_append finalize_shlibpath "$libdir:" ;; + esac + fi + fi + fi + + if test prog = "$linkmode" || test relink = "$opt_mode"; then + add_shlibpath= + add_dir= + add= + # Finalize command for both is simple: just hardcode it. + if test yes = "$hardcode_direct" && + test no = "$hardcode_direct_absolute"; then + add=$libdir/$linklib + elif test yes = "$hardcode_minus_L"; then + add_dir=-L$libdir + add=-l$name + elif test yes = "$hardcode_shlibpath_var"; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) func_append finalize_shlibpath "$libdir:" ;; + esac + add=-l$name + elif test yes = "$hardcode_automatic"; 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 prog = "$linkmode"; 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 prog = "$linkmode"; 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 unsupported != "$hardcode_direct"; 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 yes = "$build_libtool_libs"; then + # Not a shared library + if test pass_all != "$deplibs_check_method"; 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 cannot 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 yes = "$module"; 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 no = "$build_old_libs"; 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 lib = "$linkmode"; then + if test -n "$dependency_libs" && + { test yes != "$hardcode_into_libs" || + test yes = "$build_old_libs" || + test yes = "$link_static"; }; 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 no = "$link_static" && 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 no != "$link_all_deplibs"; 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 link = "$pass"; then + if test prog = "$linkmode"; 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 dlpreopen = "$pass"; then + # Link the dlpreopened libraries before other libraries + for deplib in $save_deplibs; do + deplibs="$deplib $deplibs" + done + fi + if test dlopen != "$pass"; then + test conv = "$pass" || { + # 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= + } + + if test prog,link = "$linkmode,$pass"; then + vars="compile_deplibs finalize_deplibs" + else + vars=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*) + func_stripname '-R' '' "$deplib" + func_add2xrpath "$func_stripname_result" + ;; + *) + # 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 + + # Add Sun CC postdeps if required: + test CXX = "$tagname" && { + case $host_os in + linux*) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) # Sun C++ 5.9 + func_suncc_cstd_abi + + if test no != "$suncc_use_cstd_abi"; then + func_append postdeps ' -library=Cstd -library=Crun' + fi + ;; + esac + ;; + + solaris*) + func_cc_basename "$CC" + case $func_cc_basename_result in + CC* | sunCC*) + func_suncc_cstd_abi + + if test no != "$suncc_use_cstd_abi"; then + func_append postdeps ' -library=Cstd -library=Crun' + fi + ;; + esac + ;; + esac + } + + # 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 prog = "$linkmode"; then + dlfiles=$newdlfiles + fi + if test prog = "$linkmode" || test lib = "$linkmode"; then + dlprefiles=$newdlprefiles + fi + + case $linkmode in + oldlib) + if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; 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 no = "$module" \ + && func_fatal_help "libtool library '$output' must begin with 'lib'" + + if test no != "$need_lib_prefix"; 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 pass_all != "$deplibs_check_method"; 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 no = "$dlself" \ + || func_warning "'-dlopen self' is ignored for libtool libraries" + + set dummy $rpath + shift + test 1 -lt "$#" \ + && func_warning "ignoring multiple '-rpath's for a libtool library" + + install_libdir=$1 + + oldlibs= + if test -z "$rpath"; then + if test yes = "$build_libtool_libs"; 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 + # that has an extra 1 added just for fun + # + case $version_type in + # correct linux to gnu/linux during the next big refactor + darwin|freebsd-elf|linux|osf|windows|none) + func_arith $number_major + $number_minor + current=$func_arith_result + age=$number_minor + revision=$number_revision + ;; + freebsd-aout|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" + # On Darwin other compilers + case $with_nagfor in + yes) + verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision" + ;; + *) + verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" + ;; + esac + ;; + + freebsd-aout) + major=.$current + versuffix=.$current.$revision + ;; + + freebsd-elf) + func_arith $current - $age + major=.$func_arith_result + versuffix=$major.$age.$revision + ;; + + irix | nonstopux) + if test no = "$lt_irix_increment"; 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 0 -ne "$loop"; 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 0 -ne "$loop"; 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 + ;; + + sco) + major=.$current + versuffix=.$current + ;; + + sunos) + major=.$current + versuffix=.$current.$revision + ;; + + windows) + # Use '-' rather than '.', since we only want one + # extension on DOS 8.3 file systems. + 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 no = "$need_version"; then + versuffix= + else + versuffix=.0.0 + fi + fi + + # Remove version info from name if versioning should be avoided + if test yes,no = "$avoid_version,$need_version"; then + major= + versuffix= + verstring= + fi + + # Check to see if the archive will have undefined symbols. + if test yes = "$allow_undefined"; then + if test unsupported = "$allow_undefined_flag"; then + if test yes = "$build_old_libs"; then + func_warning "undefined symbols not allowed in $host shared libraries; building static only" + build_libtool_libs=no + else + func_fatal_error "can't build $host shared library unless -no-undefined is specified" + fi + fi + else + # Don't allow undefined symbols. + allow_undefined_flag=$no_undefined_flag + fi + + fi + + func_generate_dlsyms "$libname" "$libname" : + func_append libobjs " $symfileobj" + test " " = "$libobjs" && libobjs= + + if test relink != "$opt_mode"; 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 -n "$precious_files_regex"; 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 yes = "$build_old_libs" && test convenience != "$build_libtool_libs"; 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 yes != "$hardcode_into_libs" || test yes = "$build_old_libs"; 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 yes = "$build_libtool_libs"; 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 yes = "$build_libtool_need_lc"; then + func_append deplibs " -lc" + fi + ;; + esac + fi + + # Transform deplibs into only deplibs that can be linked in shared. + name_save=$name + libname_save=$libname + release_save=$release + versuffix_save=$versuffix + major_save=$major + # I'm not sure if I'm treating the release correctly. I think + # release should show up in the -l (ie -lgmp5) so we don't want to + # add it in twice. Is that correct? + release= + versuffix= + major= + newdeplibs= + droppeddeps=no + case $deplibs_check_method in + pass_all) + # Don't check for shared/static. Everything works. + # This might be a little naive. We might want to check + # whether the library exists or not. But this is on + # osf3 & osf4 and I'm not really sure... Just + # implementing what was already the behavior. + newdeplibs=$deplibs + ;; + test_compile) + # This code stresses the "libraries are programs" paradigm to its + # limits. Maybe even breaks it. We compile a program, linking it + # against the deplibs as a proxy for the library. Then we can check + # whether they linked in statically or dynamically with ldd. + $opt_dry_run || $RM conftest.c + cat > conftest.c <<EOF + int main() { return 0; } +EOF + $opt_dry_run || $RM conftest + if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then + ldd_output=`ldd conftest` + for i in $deplibs; do + case $i in + -l*) + func_stripname -l '' "$i" + name=$func_stripname_result + if test yes = "$allow_libtool_libs_with_static_runtimes"; then + case " $predeps $postdeps " in + *" $i "*) + func_append newdeplibs " $i" + i= + ;; + esac + fi + if test -n "$i"; then + libname=`eval "\\$ECHO \"$libname_spec\""` + deplib_matches=`eval "\\$ECHO \"$library_names_spec\""` + set dummy $deplib_matches; shift + deplib_match=$1 + if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then + func_append newdeplibs " $i" + else + droppeddeps=yes + echo + $ECHO "*** Warning: dynamic linker does not accept needed library $i." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which I believe you do not have" + echo "*** because a test_compile did reveal that the linker did not use it for" + echo "*** its dynamic dependency list that programs get resolved with at runtime." + fi + fi + ;; + *) + func_append newdeplibs " $i" + ;; + esac + done + else + # Error occurred in the first compile. Let's try to salvage + # the situation: Compile a separate program for each library. + for i in $deplibs; do + case $i in + -l*) + func_stripname -l '' "$i" + name=$func_stripname_result + $opt_dry_run || $RM conftest + if $LTCC $LTCFLAGS -o conftest conftest.c $i; then + ldd_output=`ldd conftest` + if test yes = "$allow_libtool_libs_with_static_runtimes"; then + case " $predeps $postdeps " in + *" $i "*) + func_append newdeplibs " $i" + i= + ;; + esac + fi + if test -n "$i"; then + libname=`eval "\\$ECHO \"$libname_spec\""` + deplib_matches=`eval "\\$ECHO \"$library_names_spec\""` + set dummy $deplib_matches; shift + deplib_match=$1 + if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then + func_append newdeplibs " $i" + else + droppeddeps=yes + echo + $ECHO "*** Warning: dynamic linker does not accept needed library $i." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because a test_compile did reveal that the linker did not use this one" + echo "*** as a dynamic dependency that programs can get resolved with at runtime." + fi + fi + else + droppeddeps=yes + echo + $ECHO "*** Warning! Library $i is needed by this library but I was not able to" + echo "*** make it link in! You will probably need to install it or some" + echo "*** library that it depends on before this library will be fully" + echo "*** functional. Installing it before continuing would be even better." + fi + ;; + *) + func_append newdeplibs " $i" + ;; + esac + done + fi + ;; + file_magic*) + set dummy $deplibs_check_method; shift + file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` + for a_deplib in $deplibs; do + case $a_deplib in + -l*) + func_stripname -l '' "$a_deplib" + name=$func_stripname_result + if test yes = "$allow_libtool_libs_with_static_runtimes"; then + case " $predeps $postdeps " in + *" $a_deplib "*) + func_append newdeplibs " $a_deplib" + a_deplib= + ;; + esac + fi + if test -n "$a_deplib"; then + libname=`eval "\\$ECHO \"$libname_spec\""` + if test -n "$file_magic_glob"; then + libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob` + else + libnameglob=$libname + fi + test yes = "$want_nocaseglob" && nocaseglob=`shopt -p nocaseglob` + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do + if test yes = "$want_nocaseglob"; then + shopt -s nocaseglob + potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` + $nocaseglob + else + potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` + fi + for potent_lib in $potential_libs; do + # Follow soft links. + if ls -lLd "$potent_lib" 2>/dev/null | + $GREP " -> " >/dev/null; then + continue + fi + # The statement above tries to avoid entering an + # endless loop below, in case of cyclic links. + # We might still enter an endless loop, since a link + # loop can be closed while we follow links, + # but so what? + potlib=$potent_lib + while test -h "$potlib" 2>/dev/null; do + potliblink=`ls -ld $potlib | $SED 's/.* -> //'` + case $potliblink in + [\\/]* | [A-Za-z]:[\\/]*) potlib=$potliblink;; + *) potlib=`$ECHO "$potlib" | $SED 's|[^/]*$||'`"$potliblink";; + esac + done + if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | + $SED -e 10q | + $EGREP "$file_magic_regex" > /dev/null; then + func_append newdeplibs " $a_deplib" + a_deplib= + break 2 + fi + done + done + fi + if test -n "$a_deplib"; then + droppeddeps=yes + echo + $ECHO "*** Warning: linker path does not have real file for library $a_deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because I did check the linker path looking for a file starting" + if test -z "$potlib"; then + $ECHO "*** with $libname but no candidates were found. (...for file magic test)" + else + $ECHO "*** with $libname and none of the candidates passed a file format test" + $ECHO "*** using a file magic. Last file checked: $potlib" + fi + fi + ;; + *) + # Add a -L argument. + func_append newdeplibs " $a_deplib" + ;; + esac + done # Gone through all deplibs. + ;; + match_pattern*) + set dummy $deplibs_check_method; shift + match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` + for a_deplib in $deplibs; do + case $a_deplib in + -l*) + func_stripname -l '' "$a_deplib" + name=$func_stripname_result + if test yes = "$allow_libtool_libs_with_static_runtimes"; 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 yes = "$allow_libtool_libs_with_static_runtimes"; 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 none = "$deplibs_check_method"; 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 yes = "$droppeddeps"; then + if test yes = "$module"; 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 no = "$build_old_libs"; 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 no = "$allow_undefined"; 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 no = "$build_old_libs"; 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 + + # Time to revert the changes made for nagfor. This might be required if + # we need to make the output '*.la' file to be correctly interpreted for + # gcc (e.g. the output library that we are linking now with nagfor needs + # to be linked by gcc later). In this case, the libtool script of a + # package that will try to link our library will have to make similar + # non-standard nagfor-specific modifications of the '-pthread' flag. + # Thus, if we are creating a Fortran library for nagfor only, it is + # better not to revert the changes, otherwise, uncomment the following + # lines. + + if test yes = "$with_nagfor" ; then + new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's/ -Wl,-pthread\b/ -pthread/g;s/^ *//'` + fi + + # 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 + ;; + -Wl,*) + func_stripname -Wl, '' "$deplib" + func_append new_libs " $wl$func_stripname_result" + ;; + *) 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 yes = "$build_libtool_libs"; then + # Remove $wl instances when linking with ld. + # FIXME: should test the right _cmds variable. + case $archive_cmds in + *\$LD\ *) wl= ;; + esac + if test yes = "$hardcode_into_libs"; then + # Hardcode the library paths + hardcode_libdirs= + dep_rpath= + rpath=$finalize_rpath + test relink = "$opt_mode" || 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 relink = "$opt_mode" || 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 + func_dll_def_p "$export_symbols" || { + # 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 + ;; + esac + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + if test yes = "$always_export_symbols" || 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 yes = "$try_normal_branch" \ + && { 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 : != "$skipped_export"; 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 : != "$skipped_export" && 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 yes = "$compiler_needs_object" && + 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 yes = "$thread_safe" && 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 relink = "$opt_mode"; 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 yes = "$module" && 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 : != "$skipped_export" && + 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 : != "$skipped_export" && test yes = "$with_gnu_ld"; 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 : != "$skipped_export" && test -n "$file_list_spec"; then + output=$output_objdir/$output_la.lnk + func_verbose "creating linker input file list: $output" + : > $output + set x $save_libobjs + shift + firstobj= + if test yes = "$compiler_needs_object"; 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 -z "$objlist" || + 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 1 -eq "$k"; 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 + + ${skipped_export-false} && { + 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 + } + + 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_quiet || { + 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 relink = "$opt_mode"; 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 + + ${skipped_export-false} && { + 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 + } + + 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 yes = "$module" && 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=$sp$nl + eval cmd=\"$cmd\" + IFS=$save_ifs + $opt_quiet || { + 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 relink = "$opt_mode"; 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 relink = "$opt_mode"; 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 yes = "$module" || test yes = "$export_dynamic"; then + # On all known operating systems, these are identical. + dlname=$soname + fi + fi + ;; + + obj) + if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; 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= + # if reload_cmds runs $LD directly, get rid of -Wl from + # whole_archive_flag_spec and hope we can get by with turning comma + # into space. + case $reload_cmds in + *\$LD[\ \$]*) wl= ;; + esac + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" + test -n "$wl" || tmp_whole_archive_flags=`$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` + reload_conv_objs=$reload_objs\ $tmp_whole_archive_flags + 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 yes = "$build_libtool_libs" || 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 + + 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 + + test yes = "$build_libtool_libs" || { + 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 + } + + if test -n "$pic_flag" || test default != "$pic_mode"; 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" + + $preload \ + && test unknown,unknown,unknown = "$dlopen_support,$dlopen_self,$dlopen_self_static" \ + && 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 CXX = "$tagname"; 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 + ;; + -Wl,-pthread) + func_append new_libs " $deplib" ;; + -Wl,*) + func_stripname -Wl, '' "$deplib" + func_append new_libs " $wl$func_stripname_result" + ;; + *) 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 yes = "$build_old_libs"; 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@" false + + # template prelinking step + if test -n "$prelink_cmds"; then + func_execute_cmds "$prelink_cmds" 'exit $?' + fi + + wrappers_required=: + case $host in + *cegcc* | *mingw32ce*) + # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. + wrappers_required=false + ;; + *cygwin* | *mingw* ) + test yes = "$build_libtool_libs" || wrappers_required=false + ;; + *) + if test no = "$need_relink" || test yes != "$build_libtool_libs"; then + wrappers_required=false + fi + ;; + esac + $wrappers_required || { + # 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 + } + + 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 yes = "$no_install"; 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 + + case $hardcode_action,$fast_install in + relink,*) + # 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" + ;; + *,yes) + link_command=$finalize_var$compile_command$finalize_rpath + relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` + ;; + *,no) + link_command=$compile_var$compile_command$compile_rpath + relink_command=$finalize_var$finalize_command$finalize_rpath + ;; + *,needless) + link_command=$finalize_var$compile_command$finalize_rpath + relink_command= + ;; + esac + + # 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 + + case $build_libtool_libs in + convenience) + oldobjs="$libobjs_save $symfileobj" + addlibs=$convenience + build_libtool_libs=no + ;; + module) + oldobjs=$libobjs_save + addlibs=$old_convenience + build_libtool_libs=no + ;; + *) + oldobjs="$old_deplibs $non_pic_objects" + $preload && test -f "$symfileobj" \ + && func_append oldobjs " $symfileobj" + addlibs=$old_convenience + ;; + esac + + 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 yes = "$build_libtool_libs"; 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 -z "$oldobjs"; 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 yes = "$build_old_libs" && 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 yes = "$hardcode_automatic"; then + relink_command= + fi + + # Only create the output if not a dry run. + $opt_dry_run || { + for installed in no yes; do + if test yes = "$installed"; 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 -n "$bindir"; 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) $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 cannot 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 no,yes = "$installed,$need_relink"; 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 +} + +if test link = "$opt_mode" || test relink = "$opt_mode"; then + func_mode_link ${1+"$@"} +fi + + +# func_mode_uninstall arg... +func_mode_uninstall () +{ + $debug_cmd + + RM=$nonopt + files= + rmforce=false + 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=: ;; + -*) 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 . = "$dir"; then + odir=$objdir + else + odir=$dir/$objdir + fi + func_basename "$file" + name=$func_basename_result + test uninstall = "$opt_mode" && odir=$dir + + # Remember odir for removal later, being careful to avoid duplicates + if test clean = "$opt_mode"; 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 $rmforce; 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" '$rmforce || exit_status=1' + fi + + if test -n "$old_library"; then + # Do each command in the old_postuninstall commands. + func_execute_cmds "$old_postuninstall_cmds" '$rmforce || 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 none != "$pic_object"; 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 none != "$non_pic_object"; then + func_append rmfiles " $dir/$non_pic_object" + fi + fi + ;; + + *) + if test clean = "$opt_mode"; 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 yes = "$fast_install" && 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 +} + +if test uninstall = "$opt_mode" || test clean = "$opt_mode"; then + func_mode_uninstall ${1+"$@"} +fi + +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 +# where 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: diff --git a/config/missing b/config/missing new file mode 100755 index 0000000000000000000000000000000000000000..1fe1611f18514b7174f3529145b56cdc51d48c7c --- /dev/null +++ b/config/missing @@ -0,0 +1,215 @@ +#! /bin/sh +# Common wrapper for a few potentially missing GNU programs. + +scriptversion=2018-03-07.03; # UTC + +# Copyright (C) 1996-2021 Free Software Foundation, Inc. +# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. + +# 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 <bug-automake@gnu.org>." + 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=https://www.perl.org/ +flex_URL=https://github.com/westes/flex +gnu_software_URL=https://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 'autom4te' 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 'before-save-hook 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC0" +# time-stamp-end: "; # UTC" +# End: diff --git a/config/py-compile b/config/py-compile new file mode 100755 index 0000000000000000000000000000000000000000..81b122b0a546ca34b2e6bad824ea2fd2d2bb5610 --- /dev/null +++ b/config/py-compile @@ -0,0 +1,189 @@ +#!/bin/sh +# py-compile - Compile a Python program + +scriptversion=2021-02-27.01; # UTC + +# Copyright (C) 2000-2021 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 <https://www.gnu.org/licenses/>. + +# 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 <bug-automake@gnu.org> or send patches to +# <automake-patches@gnu.org>. + +if test -z "$PYTHON"; then + PYTHON=python +fi + +me=py-compile + +usage_error () +{ + echo "$me: $*" >&2 + echo "Try '$me --help' for more information." >&2 + exit 1 +} + +basedir= +destdir= +while test $# -ne 0; do + case "$1" in + --basedir) + if test $# -lt 2; then + usage_error "option '--basedir' requires an argument" + else + basedir=$2 + fi + shift + ;; + --destdir) + if test $# -lt 2; then + usage_error "option '--destdir' requires an argument" + else + destdir=$2 + fi + shift + ;; + -h|--help) + cat <<\EOF +Usage: py-compile [--help] [--version] [--basedir DIR] [--destdir DIR] FILES..." + +Byte compile some python scripts FILES. Use --destdir to specify any +leading directory path to the FILES that you don't want to include in the +byte compiled file. Specify --basedir for any additional path information you +do want to be shown in the byte compiled file. + +Example: + py-compile --destdir /tmp/pkg-root --basedir /usr/share/test test.py test2.py + +Report bugs to <bug-automake@gnu.org>. +EOF + exit $? + ;; + -v|--version) + echo "$me $scriptversion" + exit $? + ;; + --) + shift + break + ;; + -*) + usage_error "unrecognized option '$1'" + ;; + *) + break + ;; + esac + shift +done + +files=$* +if test -z "$files"; then + usage_error "no files given" +fi + +# if basedir was given, then it should be prepended to filenames before +# byte compilation. +if test -z "$basedir"; then + pathtrans="path = file" +else + pathtrans="path = os.path.join('$basedir', file)" +fi + +# if destdir was given, then it needs to be prepended to the filename to +# byte compile but not go into the compiled file. +if test -z "$destdir"; then + filetrans="filepath = path" +else + filetrans="filepath = os.path.normpath('$destdir' + os.sep + path)" +fi + +python_major=`$PYTHON -V 2>&1 | sed -e 's/.* //;s/\..*$//;1q'` +if test -z "$python_major"; then + echo "$me: could not determine $PYTHON major version, guessing 3" >&2 + python_major=3 +fi + +# The old way to import libraries was deprecated. +if test "$python_major" -le 2; then + import_lib=imp + import_test="hasattr(imp, 'get_tag')" + import_call=imp.cache_from_source + import_arg2=', False' # needed in one call and not the other +else + import_lib=importlib + import_test="hasattr(sys.implementation, 'cache_tag')" + import_call=importlib.util.cache_from_source + import_arg2= +fi + +$PYTHON -c " +import sys, os, py_compile, $import_lib + +files = '''$files''' + +sys.stdout.write('Byte-compiling python modules...\n') +for file in files.split(): + $pathtrans + $filetrans + if not os.path.exists(filepath) or not (len(filepath) >= 3 + and filepath[-3:] == '.py'): + continue + sys.stdout.write(file) + sys.stdout.flush() + if $import_test: + py_compile.compile(filepath, $import_call(filepath), path) + else: + py_compile.compile(filepath, filepath + 'c', path) +sys.stdout.write('\n')" || exit $? + +# this will fail for python < 1.5, but that doesn't matter ... +$PYTHON -O -c " +import sys, os, py_compile, $import_lib + +# pypy does not use .pyo optimization +if hasattr(sys, 'pypy_translation_info'): + sys.exit(0) + +files = '''$files''' +sys.stdout.write('Byte-compiling python modules (optimized versions) ...\n') +for file in files.split(): + $pathtrans + $filetrans + if not os.path.exists(filepath) or not (len(filepath) >= 3 + and filepath[-3:] == '.py'): + continue + sys.stdout.write(file) + sys.stdout.flush() + if $import_test: + py_compile.compile(filepath, $import_call(filepath$import_arg2), path) + else: + py_compile.compile(filepath, filepath + 'o', path) +sys.stdout.write('\n')" 2>/dev/null || exit $? + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC0" +# time-stamp-end: "; # UTC" +# End: diff --git a/config/test-driver b/config/test-driver new file mode 100755 index 0000000000000000000000000000000000000000..be73b80adf95515f3fc7cdc504facb29bc12e6b3 --- /dev/null +++ b/config/test-driver @@ -0,0 +1,153 @@ +#! /bin/sh +# test-driver - basic testsuite driver script. + +scriptversion=2018-03-07.03; # UTC + +# Copyright (C) 2011-2021 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 <https://www.gnu.org/licenses/>. + +# 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 <bug-automake@gnu.org> or send patches to +# <automake-patches@gnu.org>. + +# 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 <<END +Usage: + test-driver --test-name NAME --log-file PATH --trs-file PATH + [--expect-failure {yes|no}] [--color-tests {yes|no}] + [--enable-hard-errors {yes|no}] [--] + TEST-SCRIPT [TEST-SCRIPT-ARGUMENTS] + +The '--test-name', '--log-file' and '--trs-file' options are mandatory. +See the GNU Automake documentation for information. +END +} + +test_name= # Used for reporting. +log_file= # Where to save the output of the test script. +trs_file= # Where to save the metadata of the test run. +expect_failure=no +color_tests=no +enable_hard_errors=yes +while test $# -gt 0; do + case $1 in + --help) print_usage; exit $?;; + --version) echo "test-driver $scriptversion"; exit $?;; + --test-name) test_name=$2; shift;; + --log-file) log_file=$2; shift;; + --trs-file) trs_file=$2; shift;; + --color-tests) color_tests=$2; shift;; + --expect-failure) expect_failure=$2; shift;; + --enable-hard-errors) enable_hard_errors=$2; shift;; + --) shift; break;; + -*) usage_error "invalid option: '$1'";; + *) break;; + esac + shift +done + +missing_opts= +test x"$test_name" = x && missing_opts="$missing_opts --test-name" +test x"$log_file" = x && missing_opts="$missing_opts --log-file" +test x"$trs_file" = x && missing_opts="$missing_opts --trs-file" +if test x"$missing_opts" != x; then + usage_error "the following mandatory options are missing:$missing_opts" +fi + +if test $# -eq 0; then + usage_error "missing argument" +fi + +if test $color_tests = yes; then + # Keep this in sync with 'lib/am/check.am:$(am__tty_colors)'. + red='[0;31m' # Red. + grn='[0;32m' # Green. + lgn='[1;32m' # Light green. + blu='[1;34m' # Blue. + mgn='[0;35m' # Magenta. + std='[m' # No color. +else + red= grn= lgn= blu= mgn= std= +fi + +do_exit='rm -f $log_file $trs_file; (exit $st); exit $st' +trap "st=129; $do_exit" 1 +trap "st=130; $do_exit" 2 +trap "st=141; $do_exit" 13 +trap "st=143; $do_exit" 15 + +# Test script is run here. We create the file first, then append to it, +# to ameliorate tests themselves also writing to the log file. Our tests +# don't, but others can (automake bug#35762). +: >"$log_file" +"$@" >>"$log_file" 2>&1 +estatus=$? + +if test $enable_hard_errors = no && test $estatus -eq 99; then + tweaked_estatus=1 +else + tweaked_estatus=$estatus +fi + +case $tweaked_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 the test outcome and exit status in the logs, so that one can +# know whether the test passed or failed simply by looking at the '.log' +# file, without the need of also peaking into the corresponding '.trs' +# file (automake bug#11814). +echo "$res $test_name (exit status: $estatus)" >>"$log_file" + +# 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 'before-save-hook 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC0" +# time-stamp-end: "; # UTC" +# End: diff --git a/configure b/configure new file mode 100755 index 0000000000000000000000000000000000000000..0f7feeeef3e391317b67dbc4c19a4c457fbf2c44 --- /dev/null +++ b/configure @@ -0,0 +1,38139 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.69 for cdi 2.2.0. +# +# Report bugs to <https://mpimet.mpg.de/cdi>. +# +# +# 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 +$0: https://mpimet.mpg.de/cdi about your system, including +$0: any error possibly output before this message. Then +$0: install a modern shell, or manually run the script +$0: under such a shell if you do 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} + +as_awk_strverscmp=' + # Use only awk features that work with 7th edition Unix awk (1978). + # My, what an old awk you have, Mr. Solaris! + END { + while (length(v1) && length(v2)) { + # Set d1 to be the next thing to compare from v1, and likewise for d2. + # Normally this is a single character, but if v1 and v2 contain digits, + # compare them as integers and fractions as strverscmp does. + if (v1 ~ /^[0-9]/ && v2 ~ /^[0-9]/) { + # Split v1 and v2 into their leading digit string components d1 and d2, + # and advance v1 and v2 past the leading digit strings. + for (len1 = 1; substr(v1, len1 + 1) ~ /^[0-9]/; len1++) continue + for (len2 = 1; substr(v2, len2 + 1) ~ /^[0-9]/; len2++) continue + d1 = substr(v1, 1, len1); v1 = substr(v1, len1 + 1) + d2 = substr(v2, 1, len2); v2 = substr(v2, len2 + 1) + if (d1 ~ /^0/) { + if (d2 ~ /^0/) { + # Compare two fractions. + while (d1 ~ /^0/ && d2 ~ /^0/) { + d1 = substr(d1, 2); len1-- + d2 = substr(d2, 2); len2-- + } + if (len1 != len2 && ! (len1 && len2 && substr(d1, 1, 1) == substr(d2, 1, 1))) { + # The two components differ in length, and the common prefix + # contains only leading zeros. Consider the longer to be less. + d1 = -len1 + d2 = -len2 + } else { + # Otherwise, compare as strings. + d1 = "x" d1 + d2 = "x" d2 + } + } else { + # A fraction is less than an integer. + exit 1 + } + } else { + if (d2 ~ /^0/) { + # An integer is greater than a fraction. + exit 2 + } else { + # Compare two integers. + d1 += 0 + d2 += 0 + } + } + } else { + # The normal case, without worrying about digits. + d1 = substr(v1, 1, 1); v1 = substr(v1, 2) + d2 = substr(v2, 1, 1); v2 = substr(v2, 2) + } + if (d1 < d2) exit 1 + if (d1 > d2) exit 2 + } + # Beware Solaris /usr/xgp4/bin/awk (at least through Solaris 10), + # which mishandles some comparisons of empty strings to integers. + if (length(v2)) exit 1 + if (length(v1)) exit 2 + } +' + +test -n "$DJDIR" || exec 7<&0 </dev/null +exec 6>&1 + +# Name of the host. +# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_clean_files= +ac_config_libobj_dir=. +LIBOBJS= +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= + +# Identity of this package. +PACKAGE_NAME='cdi' +PACKAGE_TARNAME='cdi' +PACKAGE_VERSION='2.2.0' +PACKAGE_STRING='cdi 2.2.0' +PACKAGE_BUGREPORT='https://mpimet.mpg.de/cdi' +PACKAGE_URL='' + +# Factoring default headers for most tests. +ac_includes_default="\ +#include <stdio.h> +#ifdef HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif +#ifdef HAVE_SYS_STAT_H +# include <sys/stat.h> +#endif +#ifdef STDC_HEADERS +# include <stdlib.h> +# include <stddef.h> +#else +# ifdef HAVE_STDLIB_H +# include <stdlib.h> +# endif +#endif +#ifdef HAVE_STRING_H +# if !defined STDC_HEADERS && defined HAVE_MEMORY_H +# include <memory.h> +# endif +# include <string.h> +#endif +#ifdef HAVE_STRINGS_H +# include <strings.h> +#endif +#ifdef HAVE_INTTYPES_H +# include <inttypes.h> +#endif +#ifdef HAVE_STDINT_H +# include <stdint.h> +#endif +#ifdef HAVE_UNISTD_H +# include <unistd.h> +#endif" + +ac_header_list= +ac_subst_vars='am__EXEEXT_FALSE +am__EXEEXT_TRUE +LTLIBOBJS +ENABLE_PYTHON_INTERFACE +ENABLE_RUBY_INTERFACE +HAVE_PARALLEL_NC4 +ENABLE_MPI +BUILD_F77 +BUILD_FC +BUILD_CXX +BUILD_CC +BUILD_MPI_FC_LIB +BUILD_MPI_C_LIB +BUILD_LIBS +BUILD_LDFLAGS +BUILD_FCFLAGS +BUILD_CFLAGS +with_example_programs_FALSE +with_example_programs_TRUE +with_concurrent_mpi_checks_FALSE +with_concurrent_mpi_checks_TRUE +with_on_demand_check_programs_FALSE +with_on_demand_check_programs_TRUE +ENABLE_PYTHON_INTERFACE_FALSE +ENABLE_PYTHON_INTERFACE_TRUE +PYTHON_EXTRA_LDFLAGS +PYTHON_EXTRA_LIBS +PYTHON_PLATFORM_SITE_PKG +PYTHON_SITE_PKG +PYTHON_LIBS +PYTHON_CPPFLAGS +pkgpyexecdir +pyexecdir +pkgpythondir +pythondir +PYTHON_EXEC_PREFIX +PYTHON_PREFIX +PYTHON_PLATFORM +PYTHON_VERSION +PYTHON +ENABLE_RUBY_INTERFACE_FALSE +ENABLE_RUBY_INTERFACE_TRUE +RUBY +SWIG +HAVE_PARALLEL_NC4_FALSE +HAVE_PARALLEL_NC4_TRUE +ENABLE_MPI_FALSE +ENABLE_MPI_TRUE +BUILD_PIO_FC_PROGRAMS_FALSE +BUILD_PIO_FC_PROGRAMS_TRUE +LIBRT +PPM_CORE_C_LIB +PPM_CORE_C_INCLUDE +YAXT_FC_LIB +YAXT_FC_MOD +YAXT_C_LIB +YAXT_C_INCLUDE +PKG_CONFIG_LIBDIR +PKG_CONFIG_PATH +PKG_CONFIG +MPI_FC_LIB +MPI_FC_MOD +MPI_LAUNCH +MPI_C_LIB +MPI_C_INCLUDE +MPIROOT +HAVE_PPM_DIST_ARRAY +SYSTEM_TYPE +ENABLE_NETCDF_FALSE +ENABLE_NETCDF_TRUE +ENABLE_CDI_APP_FALSE +ENABLE_CDI_APP_TRUE +ENABLE_HIRLAM_EXTENSIONS_FALSE +ENABLE_HIRLAM_EXTENSIONS_TRUE +ENABLE_ALL_STATIC_FALSE +ENABLE_ALL_STATIC_TRUE +ENABLE_CDI_LIB +ENABLE_CDI_LIB_FALSE +ENABLE_CDI_LIB_TRUE +ENABLE_IEG +ENABLE_EXTRA +ENABLE_SERVICE +ENABLE_CGRIBEX +ENABLE_ACROSS +ENABLE_GRIB +HAVE_LIBGRIB_API_FALSE +HAVE_LIBGRIB_API_TRUE +GRIB_API_LIBS +GRIB_API_INCLUDE +ECCODES_LIBS +ECCODES_INCLUDE +NETCDF_LIBS +NETCDF_INCLUDE +NETCDF_ROOT +ENABLE_NC4SZLIB +ENABLE_NC4HDF5 +ENABLE_NC4 +ENABLE_NC2 +ENABLE_NETCDF +NC_CONFIG +SZLIB_LIBS +SZLIB_INCLUDE +FDB5_LIBS +FDB5_INCLUDE +THREADS_LIBS +THREADS_INCLUDE +PTHREAD_CFLAGS +PTHREAD_LIBS +PTHREAD_CC +ax_pthread_config +UUID_C_LIB +UUID_C_INCLUDE +DCE_UUID_C_LIB +DCE_UUID_C_INCLUDE +DCE_UUIDROOT +OSSP_UUID_C_LIB +OSSP_UUID_C_INCLUDE +OSSP_UUIDROOT +UTIL_LINUX_UUID_C_LIB +UTIL_LINUX_UUID_C_INCLUDE +UTIL_LINUX_UUIDROOT +LIBOBJS +CXXCPP +CPP +LT_SYS_LIBRARY_PATH +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 +LIBTOOL +OPENMP_CFLAGS +am__fastdepCXX_FALSE +am__fastdepCXX_TRUE +CXXDEPMODE +ac_ct_CXX +CXXFLAGS +CXX +ENABLE_CF_INTERFACE_FALSE +ENABLE_CF_INTERFACE_TRUE +ac_ct_F77 +FFLAGS +F77 +BUILD_FC_PROGRAMS_FALSE +BUILD_FC_PROGRAMS_TRUE +FC_MOD_UPPERCASE_FALSE +FC_MOD_UPPERCASE_TRUE +FC_DEFINE +FCMODCASE +FCMODEXT +FC_OPTINC +FC_MOD_FLAG +FCFLAGS_f90 +ac_ct_FC +FCFLAGS +FC +ENABLE_ISOC_INTERFACE_FALSE +ENABLE_ISOC_INTERFACE_TRUE +am__fastdepCC_FALSE +am__fastdepCC_TRUE +CCDEPMODE +am__nodep +AMDEPBACKSLASH +AMDEP_FALSE +AMDEP_TRUE +am__include +DEPDIR +OBJEXT +EXEEXT +ac_ct_CC +CPPFLAGS +LDFLAGS +CFLAGS +CC +MAINT +MAINTAINER_MODE_FALSE +MAINTAINER_MODE_TRUE +AM_BACKSLASH +AM_DEFAULT_VERBOSITY +AM_DEFAULT_V +AM_V +CSCOPE +ETAGS +CTAGS +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 +host_os +host_vendor +host_cpu +host +build_os +build_vendor +build_cpu +build +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 +am__quote' +ac_subst_files='' +ac_user_opts=' +enable_option_checking +enable_silent_rules +enable_maintainer_mode +enable_dependency_tracking +enable_mpi +enable_iso_c_interface +enable_cf_interface +enable_ruby_interface +enable_python_interface +enable_openmp +with_pic +enable_shared +enable_static +enable_fast_install +with_aix_soname +with_gnu_ld +with_sysroot +enable_libtool_lock +enable_largefile +enable_util_linux_uuid +enable_ossp_uuid +enable_dce_uuid +with_util_linux_uuid +with_ossp_uuid +with_dce_uuid +with_util_linux_uuid_root +with_util_linux_uuid_include +with_util_linux_uuid_lib +with_ossp_uuid_root +with_ossp_uuid_include +with_ossp_uuid_lib +with_dce_uuid_root +with_dce_uuid_include +with_dce_uuid_lib +with_threads +with_fdb5 +with_szlib +with_netcdf +with_eccodes +with_grib_api +enable_grib +enable_across +enable_cgribex +enable_service +enable_extra +enable_ieg +enable_all_static +enable_hirlam_extensions +enable_cdi_app +enable_ppm_dist_array +with_mpi_root +with_mpi_include +with_mpi_lib +with_mpi_fc_mod +with_mpi_fc_lib +with_python_sys_prefix +with_python_prefix +with_python_exec_prefix +with_on_demand_check_programs +with_concurrent_mpi_checks +with_example_programs +' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +LIBS +CPPFLAGS +FC +FCFLAGS +FCMODEXT +F77 +FFLAGS +CXX +CXXFLAGS +CCC +LT_SYS_LIBRARY_PATH +CPP +CXXCPP +UTIL_LINUX_UUID_C_INCLUDE +UTIL_LINUX_UUID_C_LIB +OSSP_UUID_C_INCLUDE +OSSP_UUID_C_LIB +DCE_UUID_C_INCLUDE +DCE_UUID_C_LIB +MPI_C_INCLUDE +MPI_C_LIB +MPI_LAUNCH +MPI_FC_MOD +MPI_FC_LIB +PKG_CONFIG +PKG_CONFIG_PATH +PKG_CONFIG_LIBDIR +YAXT_C_INCLUDE +YAXT_C_LIB +YAXT_FC_MOD +YAXT_FC_LIB +PPM_CORE_C_INCLUDE +PPM_CORE_C_LIB +RUBY +PYTHON +PYTHON_VERSION +BUILD_CFLAGS +BUILD_FCFLAGS +BUILD_LDFLAGS +BUILD_LIBS +BUILD_MPI_C_LIB +BUILD_MPI_FC_LIB +BUILD_CC +BUILD_CXX +BUILD_FC +BUILD_F77' + + +# 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 cdi 2.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/cdi] + --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 cdi 2.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") + --disable-maintainer-mode + disable make rules and dependencies not useful (and + sometimes confusing) to the casual installer + --enable-dependency-tracking + do not reject slow dependency extractors + --disable-dependency-tracking + speeds up one-time build + --enable-mpi enable parallel I/O with MPI [default=no] + --enable-iso-c-interface + create Fortran 90 interface using Fortran 2003 + ISO_C_BINDING facility [default=no] + --enable-cf-interface create Fortran 77 interface using cfortran.h + [default=auto] + --enable-ruby-interface create Ruby language interface (EXPERIMENTAL) + [default=no] + --enable-python-interface + create Python language interface (EXPERIMENTAL) + [default=no] + --enable-openmp enable OpenMP support [default=no] + --enable-shared[=PKGS] build shared libraries [default=yes] + --enable-static[=PKGS] build static libraries [default=yes] + --enable-fast-install[=PKGS] + optimize for fast installation [default=yes] + --disable-libtool-lock avoid locking (might break parallel builds) + --disable-largefile omit support for large files + --disable-util-linux-uuid + Do not test for the util-linux UUID library, use + OSSP or DCE versions instead + --disable-ossp-uuid Do not test for the OSSP UUID library, use + util-linux or DCE versions instead + --disable-dce-uuid Do not test for the DCE UUID library, use util-linux + or OSSP versions instead + --enable-grib GRIB support [default=yes] + --enable-across ACROSS support [default=yes] + --enable-cgribex Use the CGRIBEX library [default=yes] + --enable-service Use the service library [default=yes] + --enable-extra Use the extra library [default=yes] + --enable-ieg Use the ieg library [default=yes] + --enable-all-static build a completely statically linked CDO binary + [default=no] + --enable-hirlam-extensions + HIRLAM extensions [default=no] + --enable-cdi-app build and install CDI application [default=yes] + --enable-ppm-dist-array enable usage of the PPM distributed array + [default=auto] + +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-aix-soname=aix|svr4|both + shared library versioning (aka "SONAME") variant to + provide on AIX, [default=aix]. + --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-util-linux-uuid[=yes|no|directory>] + Use util-linux UUID library, do not test for OSSP + UUID library. + --with-ossp-uuid[=yes|no|directory>] + Use OSSP UUID library, do not test for the + util-linux UUID library. + --with-dce-uuid[=yes|no|directory>] + Use DCE UUID library, do not test for the util-linux + UUID library. + --with-util-linux-uuid-root + set directory to search for util-linux-uuid headers + and library + --with-util-linux-uuid-include + specifically set directory to search for + util-linux-uuid headers, + [default=$with_util_linux_uuid_root/include] + --with-util-linux-uuid-lib + specifically set directory to search for + util-linux-uuid library, + [default=$with_util_linux_uuid_root/lib] + --with-ossp-uuid-root set directory to search for ossp-uuid headers and + library + --with-ossp-uuid-include + specifically set directory to search for ossp-uuid + headers, [default=$with_ossp_uuid_root/include] + --with-ossp-uuid-lib specifically set directory to search for ossp-uuid + library, [default=$with_ossp_uuid_root/lib] + --with-dce-uuid-root set directory to search for dce-uuid headers and + library + --with-dce-uuid-include specifically set directory to search for dce-uuid + headers, [default=$with_dce_uuid_root/include] + --with-dce-uuid-lib specifically set directory to search for dce-uuid + library, [default=$with_dce_uuid_root/lib] + --with-threads=<yes/no/directory> + Compile + link for multithreading [default=yes] + --with-fdb5=<yes|no|directory> (default=no) + location of fdb5 library (optional) + --with-szlib=<yes|no|directory> (default=no) + location of szlib library, optional for GRIB1 and + NETCDF4 compression + --with-netcdf=<yes|no|directory> (default=no) + location of NetCDF library (lib and include subdirs) + --with-eccodes=<yes|no|directory> + location of ECCODES library for grib2 + encoding/decoding (lib and include subdirs) + --with-grib_api=<yes|no|directory> + location of GRIB_API library for grib2 + encoding/decoding (lib and include subdirs) + --with-mpi-root set directory to search for MPI headers and library + --with-mpi-include specifically set directory to search for MPI + headers, [default=$with_mpi_root/include] + --with-mpi-lib specifically set directory to search for MPI + library, [default=$with_mpi_root/lib] + --with-mpi-fc-mod specifically set directory to search for MPI module, + [default=$with_mpi_root/include] + --with-mpi-fc-lib specifically set directory to search for MPI + library, [default=$with_mpi_root/lib] + --with-python-sys-prefix + use Python's sys.prefix and sys.exec_prefix values + --with-python_prefix override the default PYTHON_PREFIX + --with-python_exec_prefix + override the default PYTHON_EXEC_PREFIX + --with-on-demand-check-programs + only build test programs when calling 'make check' + [default: build during 'make all'] + --with-concurrent-mpi-checks + allow for simultaneous runs of MPI tests [default: + run MPI test programs one after another] + --without-example-programs + only build example programs when calling 'make + examples' [default: build during 'make all'] + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a + nonstandard directory <lib dir> + LIBS libraries to pass to the linker, e.g. -l<library> + CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if + you have headers in a nonstandard directory <include dir> + FC Fortran compiler command + FCFLAGS Fortran compiler flags + FCMODEXT file extension of compiled Fortran module files + F77 Fortran 77 compiler command + FFLAGS Fortran 77 compiler flags + CXX C++ compiler command + CXXFLAGS C++ compiler flags + LT_SYS_LIBRARY_PATH + User-defined run-time library search path. + CPP C preprocessor + CXXCPP C++ preprocessor + UTIL_LINUX_UUID_C_INCLUDE + specifically set flags to use when compiling sources using + util-linux-uuid includes. + UTIL_LINUX_UUID_C_LIB + specifically set flags to use when linking util-linux-uuid. + OSSP_UUID_C_INCLUDE + specifically set flags to use when compiling sources using + ossp-uuid includes. + OSSP_UUID_C_LIB + specifically set flags to use when linking ossp-uuid. + DCE_UUID_C_INCLUDE + specifically set flags to use when compiling sources using + dce-uuid includes. + DCE_UUID_C_LIB + specifically set flags to use when linking dce-uuid. + MPI_C_INCLUDE + specifically set flags to use when compiling sources using MPI + includes. + MPI_C_LIB specifically set flags to use when linking MPI. + MPI_LAUNCH absolute path to launcher for MPI programs, must be working + unless configuring in cross-compilation mode + MPI_FC_MOD flags to enable 'USE MPI' in Fortran program. + MPI_FC_LIB specifically set flags to use when linking MPI. + PKG_CONFIG path to pkg-config utility + PKG_CONFIG_PATH + directories to add to pkg-config's search path + PKG_CONFIG_LIBDIR + path overriding pkg-config's built-in search path + YAXT_C_INCLUDE + specifically set flags to use when compiling sources using YAXT + includes. + YAXT_C_LIB specifically set flags to use when linking YAXT. + YAXT_FC_MOD flags to enable 'USE YAXT' in Fortran program. + YAXT_FC_LIB specifically set flags to use when linking YAXT. + PPM_CORE_C_INCLUDE + specifically set flags to use when compiling sources using + PPM_CORE includes. + PPM_CORE_C_LIB + specifically set flags to use when linking PPM_CODE. + RUBY the Ruby interpreter + PYTHON the Python interpreter + PYTHON_VERSION + The installed Python version to use, for example '2.3'. This + string will be appended to the Python interpreter canonical + name. + BUILD_CFLAGS + append to CFLAGS during build but not in configure phase + BUILD_FCFLAGS + append to FCFLAGS during build but not in configure phase + BUILD_LDFLAGS + append to LDFLAGS during build but not in configure phase + BUILD_LIBS append to LIBS during build but not in configure phase + BUILD_MPI_C_LIB + append to MPI_C_LIB during build but not in configure phase + BUILD_MPI_FC_LIB + append to MPI_FC_LIB during build but not in configure phase + BUILD_CC replace CC with expansion of $BUILD_CC during build but not in + configure phase + BUILD_CXX replace CXX with expansion of $BUILD_CXX during build but not in + configure phase + BUILD_FC replace FC with expansion of $BUILD_FC during build but not in + configure phase + BUILD_F77 replace F77 with expansion of $BUILD_F77 during build but not in + configure phase + +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 <https://mpimet.mpg.de/cdi>. +_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 +cdi configure 2.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_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_run LINENO +# ----------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes +# that executables *can* be run. +ac_fn_fc_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_fc_try_run + +# 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_f77_try_compile LINENO +# ---------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_f77_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_f77_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_f77_try_compile + +# ac_fn_f77_try_run LINENO +# ------------------------ +# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes +# that executables *can* be run. +ac_fn_f77_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_f77_try_run + +# ac_fn_mv_obj LINENO FROM TO +# --------------------------- +# Rename FROM.$ac_ext to TO.$ac_ext, and return whether this succeeded. +acx_fn_mv_obj () +{ +as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + acx_path_from=`echo "$2" | sed -e 's!/\{0,1\}[^/]*$!!'` + test -z "$acx_path_from" && unset acx_path_from + acx_fn_from=`echo "$2" | sed -e 's@^.*/@@'` + acx_path_to=`echo "$3" | sed -e 's!/\{0,1\}[^/]*$!!'` + test -z "$acx_path_to" && unset acx_path_to + acx_fn_to=`echo "$3" | sed -e 's@^.*/@@'` + if expr "$ac_compile" : '.*/libtool --mode=compile' >/dev/null; then : + { { $as_echo "$as_me:${as_lineno-$LINENO}: Renaming object file $2.$ac_objext to $3.$ac_objext." >&5; } >&5 + (sed 's@\(pic_object='"'\)"'\(\(.libs/\)\{0,1\}\)'"$acx_fn_from"'\.o'"'"'@\1\2'"$acx_fn_to"'.o'"'"'@' "$2.$ac_objext" >"$3.$ac_objext" && rm "$2.$ac_objext" && if test -f "$2.$OBJEXT" ; then mv "$2.$OBJEXT" "$3.$OBJEXT" ; fi && if test -f "${acx_path_from+$acx_path_from/}.libs/$acx_fn_from.$OBJEXT" ; then as_dir="${acx_path_to-.}/.libs" as_fn_mkdir_p ; mv "${acx_path_from+$acx_path_from/}.libs/$acx_fn_from.$OBJEXT" "${acx_path_to+$acx_path_to/}.libs/$acx_fn_to.$OBJEXT" ; fi) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: Renaming object file $2.$ac_objext to $3.$ac_objext." >&5; } >&5 + (mv "$2.$ac_objext" "$3.$ac_objext") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_status +} # acx_fn_mv_obj + +# 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_cxx_try_compile LINENO +# ---------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_cxx_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_cxx_try_compile + +# ac_fn_cxx_try_link LINENO +# ------------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_cxx_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + test -x conftest$ac_exeext + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_cxx_try_link + +# ac_fn_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 <limits.h> declares $2. + For example, HP-UX 11i <limits.h> declares gettimeofday. */ +#define $2 innocuous_$2 + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $2 (); below. + Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + <limits.h> exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + +#undef $2 + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $2 (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$2 || defined __stub___$2 +choke me +#endif + +int +main () +{ +return $2 (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_func + +# ac_fn_cxx_try_cpp LINENO +# ------------------------ +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_cxx_try_cpp () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } > conftest.i && { + test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || + test ! -s conftest.err + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_cxx_try_cpp + +# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES +# ---------------------------------------------------- +# Tries to find if the field MEMBER exists in type AGGR, after including +# INCLUDES, setting cache variable VAR accordingly. +ac_fn_c_check_member () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 +$as_echo_n "checking for $2.$3... " >&6; } +if eval \${$4+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$5 +int +main () +{ +static $2 ac_aggr; +if (ac_aggr.$3) +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$4=yes" +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$5 +int +main () +{ +static $2 ac_aggr; +if (sizeof ac_aggr.$3) +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$4=yes" +else + eval "$4=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 +eval ac_res=\$$4 + { $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_member + +# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES +# --------------------------------------------- +# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR +# accordingly. +ac_fn_c_check_decl () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + as_decl_name=`echo $2|sed 's/ *(.*//'` + as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 +$as_echo_n "checking whether $as_decl_name is declared... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +#ifndef $as_decl_name +#ifdef __cplusplus + (void) $as_decl_use; +#else + (void) $as_decl_name; +#endif +#endif + + ; + return 0; +} +_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_decl + +# 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 <stdio.h> +#include <stdlib.h> +int +main () +{ + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + return 1; + if (($2) < 0) + { + long int i = longval (); + if (i != ($2)) + return 1; + fprintf (f, "%ld", i); + } + else + { + unsigned long int i = ulongval (); + if (i != ($2)) + return 1; + fprintf (f, "%lu", i); + } + /* Do not output a trailing newline, as this causes \r\n confusion + on some platforms. */ + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + echo >>conftest.val; read $3 <conftest.val; ac_retval=0 +else + ac_retval=1 +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f conftest.val + + fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_compute_int +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by cdi $as_me 2.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 + +as_fn_append ac_header_list " stdlib.h" +as_fn_append ac_header_list " unistd.h" +as_fn_append ac_header_list " sys/param.h" +# 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 + + + +cat >>confdefs.h <<_ACEOF +#define CDI "$PACKAGE_VERSION" +_ACEOF + + +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. + + + + +# 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 + + + + +am__api_version='1.16' + +# 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 + MISSING="\${SHELL} '$am_aux_dir/missing'" +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+set}" != 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='cdi' + VERSION='2.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: +# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html> +# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html> +mkdir_p='$(MKDIR_P)' + +# We need awk for the "check" target (and possibly the TAP driver). 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 -' + + + + + +# Variables for tags utilities; see am/tags.am +if test -z "$CTAGS"; then + CTAGS=ctags +fi + +if test -z "$ETAGS"; then + ETAGS=etags +fi + +if test -z "$CSCOPE"; then + CSCOPE=cscope +fi + + + +# POSIX will say in a future version that running "rm -f" with no argument +# is OK; and we want to be able to make that assumption in our Makefile +# recipes. So use an aggressive probe to check that the usage we want is +# actually supported "in the wild" to an acceptable degree. +# See automake bug#10828. +# To make any issue more visible, cause the running configure to be aborted +# by default if the 'rm' program in use doesn't match our expectations; the +# user can still override this though. +if rm -f && rm -fr && rm -rf; then : OK; else + cat >&2 <<'END' +Oops! + +Your 'rm' program seems unable to run without file operands specified +on the command line, even when the '-f' option is present. This is contrary +to the behaviour of most rm programs out there, and not conforming with +the upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542> + +Please tell bug-automake@gnu.org about your system, including the value +of your $PATH and any error possibly output before this message. This +can help us improve future automake versions. + +END + if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then + echo 'Configuration will proceed anyway, since you have set the' >&2 + echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 + echo >&2 + else + cat >&2 <<'END' +Aborting the configuration process, to ensure you take notice of the issue. + +You can download and install GNU coreutils to get an 'rm' implementation +that behaves properly: <https://www.gnu.org/software/coreutils/>. + +If you want to complete the configuration process using your problematic +'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM +to "yes", and re-run configure. + +END + as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 + fi +fi + + +{ $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=yes +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 + + + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } + +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +$as_echo_n "checking whether the C compiler works... " >&6; } +ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` + +# The possible output files: +ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" + +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { { ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; + esac +done +test "$ac_cv_exeext" = no && ac_cv_exeext= + +else + ac_file='' +fi +if test -z "$ac_file"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "C compiler cannot create executables +See \`config.log' for more details" "$LINENO" 5; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +$as_echo_n "checking for C compiler default output file name... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +$as_echo "$ac_file" >&6; } +ac_exeext=$ac_cv_exeext + +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +$as_echo_n "checking for suffix of executables... " >&6; } +if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest conftest$ac_cv_exeext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +$as_echo "$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <stdio.h> +int +main () +{ +FILE *f = fopen ("conftest.out", "w"); + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +ac_clean_files="$ac_clean_files conftest.out" +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +$as_echo_n "checking whether we are cross compiling... " >&6; } +if test "$cross_compiling" != yes; then + { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if { ac_try='./conftest$ac_cv_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details" "$LINENO" 5; } + fi + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +$as_echo "$cross_compiling" >&6; } + +rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +$as_echo_n "checking for suffix of object files... " >&6; } +if ${ac_cv_objext+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of object files: cannot compile +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +$as_echo "$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if ${ac_cv_c_compiler_gnu+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_compiler_gnu=yes +else + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if ${ac_cv_prog_cc_g+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +else + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$ac_cv_prog_cc_g" >&6; } +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +rm -rf conftest.dSYM # needed when configured on MacOS with CFLAGS='-g' + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C99" >&5 +$as_echo_n "checking for $CC option to accept ISO C99... " >&6; } +if ${ac_cv_prog_cc_c99+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c99=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <stdarg.h> +#include <stdbool.h> +#include <stdlib.h> +#include <wchar.h> +#include <stdio.h> + +// Check varargs macros. These examples are taken from C99 6.10.3.5. +#define debug(...) fprintf (stderr, __VA_ARGS__) +#define showlist(...) puts (#__VA_ARGS__) +#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) +static void +test_varargs_macros (void) +{ + int x = 1234; + int y = 5678; + debug ("Flag"); + debug ("X = %d\n", x); + showlist (The first, second, and third items.); + report (x>y, "x is %d but y is %d", x, y); +} + +// Check long long types. +#define BIG64 18446744073709551615ull +#define BIG32 4294967295ul +#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) +#if !BIG_OK + your preprocessor is broken; +#endif +#if BIG_OK +#else + your preprocessor is broken; +#endif +static long long int bignum = -9223372036854775807LL; +static unsigned long long int ubignum = BIG64; + +struct incomplete_array +{ + int datasize; + double data[]; +}; + +struct named_init { + int number; + const wchar_t *name; + double average; +}; + +typedef const char *ccp; + +static inline int +test_restrict (ccp restrict text) +{ + // See if C++-style comments work. + // Iterate through items via the restricted pointer. + // Also check for declarations in for loops. + for (unsigned int i = 0; *(text+i) != '\0'; ++i) + continue; + return 0; +} + +// Check varargs and va_copy. +static void +test_varargs (const char *format, ...) +{ + va_list args; + va_start (args, format); + va_list args_copy; + va_copy (args_copy, args); + + const char *str; + int number; + float fnumber; + + while (*format) + { + switch (*format++) + { + case 's': // string + str = va_arg (args_copy, const char *); + break; + case 'd': // int + number = va_arg (args_copy, int); + break; + case 'f': // float + fnumber = va_arg (args_copy, double); + break; + default: + break; + } + } + va_end (args_copy); + va_end (args); +} + +int +main () +{ + + // Check bool. + _Bool success = false; + + // Check restrict. + if (test_restrict ("String literal") == 0) + success = true; + char *restrict newvar = "Another string"; + + // Check varargs. + test_varargs ("s, d' f .", "string", 65, 34.234); + test_varargs_macros (); + + // Check flexible array members. + struct incomplete_array *ia = + malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); + ia->datasize = 10; + for (int i = 0; i < ia->datasize; ++i) + ia->data[i] = i * 1.234; + + // Check named initializers. + struct named_init ni = { + .number = 34, + .name = L"Test wide string", + .average = 543.34343, + }; + + ni.number = 58; + + int dynamic_array[ni.number]; + dynamic_array[ni.number - 1] = 543; + + // work around unused variable warnings + return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x' + || dynamic_array[ni.number - 1] != 543); + + ; + return 0; +} +_ACEOF +for ac_arg in '' -std=gnu99 -std=c99 -c99 -AC99 -D_STDC_C99= -qlanglvl=extc99 +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c99=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c99" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c99" 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_c99" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 +$as_echo "$ac_cv_prog_cc_c99" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c99" != xno; 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 compiler does not support ISO C99 +See \`config.log' for more details" "$LINENO" 5; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +ac_ext=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 whether $CC understands -c and -o together" >&5 +$as_echo_n "checking whether $CC understands -c and -o together... " >&6; } +if ${am_cv_prog_cc_c_o+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF + # Make sure it works both with $CC and with simple cc. + # Following AC_PROG_CC_C_O, we do the test twice because some + # compilers refuse to overwrite an existing .o file with -o, + # though they will create one. + am_cv_prog_cc_c_o=yes + for am_i in 1 2; do + if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 + ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } \ + && test -f conftest2.$ac_objext; then + : OK + else + am_cv_prog_cc_c_o=no + break + fi + done + rm -f core conftest* + unset am_i +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 +$as_echo "$am_cv_prog_cc_c_o" >&6; } +if test "$am_cv_prog_cc_c_o" != yes; then + # Losing compiler, so override with the script. + # FIXME: It is wrong to rewrite CC. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__CC in this case, + # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" + CC="$am_aux_dir/compile $CC" +fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +DEPDIR="${am__leading_dot}deps" + +ac_config_commands="$ac_config_commands depfiles" + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5 +$as_echo_n "checking whether ${MAKE-make} supports the include directive... " >&6; } +cat > confinc.mk << 'END' +am__doit: + @echo this is the am__doit target >confinc.out +.PHONY: am__doit +END +am__include="#" +am__quote= +# BSD make does it like this. +echo '.include "confinc.mk" # ignored' > confmf.BSD +# Other make implementations (GNU, Solaris 10, AIX) do it like this. +echo 'include confinc.mk # ignored' > confmf.GNU +_am_result=no +for s in GNU BSD; do + { echo "$as_me:$LINENO: ${MAKE-make} -f confmf.$s && cat confinc.out" >&5 + (${MAKE-make} -f confmf.$s && cat confinc.out) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + case $?:`cat confinc.out 2>/dev/null` in #( + '0:this is the am__doit target') : + case $s in #( + BSD) : + am__include='.include' am__quote='"' ;; #( + *) : + am__include='include' am__quote='' ;; +esac ;; #( + *) : + ;; +esac + if test "$am__include" != "#"; then + _am_result="yes ($s style)" + break + fi +done +rm -f confinc.* confmf.* +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5 +$as_echo "${_am_result}" >&6; } + +# Check whether --enable-dependency-tracking was given. +if test "${enable_dependency_tracking+set}" = set; then : + enableval=$enable_dependency_tracking; +fi + +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' + am__nodep='_no' +fi + if test "x$enable_dependency_tracking" != xno; then + AMDEP_TRUE= + AMDEP_FALSE='#' +else + AMDEP_TRUE='#' + AMDEP_FALSE= +fi + + + +depcc="$CC" am_compiler_list= + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +$as_echo_n "checking dependency style of $depcc... " >&6; } +if ${am_cv_CC_dependencies_compiler_type+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named 'D' -- because '-MD' means "put the output + # in D". + rm -rf conftest.dir + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + am__universal=false + case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with + # Solaris 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with '-c' and '-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle '-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs. + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # After this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested. + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok '-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 +$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type + + if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' +else + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= +fi + + + +acx_prog_cc_posix_version_value=200112 + acx_prog_cc_posix_version_print="POSIX.1-2001" + 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 conformance to ${acx_prog_cc_posix_version_print}." >&5 +$as_echo_n "checking For conformance to ${acx_prog_cc_posix_version_print}.... " >&6; } +if ${acx_cv_cc_posix_support2001+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <unistd.h> +int +main () +{ + int n[(_POSIX_VERSION >= ${acx_prog_cc_posix_version_value}L) * 2 - 1]; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + acx_cv_cc_posix_support2001=yes +else + acx_cv_cc_posix_support2001=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_cc_posix_support2001" >&5 +$as_echo "$acx_cv_cc_posix_support2001" >&6; } + if test "x$acx_cv_cc_posix_support2001" = xno; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: It seems your system does not define _POSIX_VERSION to a value +greater-or-equal ${acx_prog_cc_posix_version_value}. This is typically the case when the +compiler is instructed to make ISO C features available only, +e.g. when using gcc -std=c99" >&5 +$as_echo "$as_me: It seems your system does not define _POSIX_VERSION to a value +greater-or-equal ${acx_prog_cc_posix_version_value}. This is typically the case when the +compiler is instructed to make ISO C features available only, +e.g. when using gcc -std=c99" >&6;} + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "${acx_prog_cc_posix_version_print} profile required +See \`config.log' for more details" "$LINENO" 5; } +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C/C++ restrict keyword" >&5 +$as_echo_n "checking for C/C++ restrict keyword... " >&6; } +if ${ac_cv_c_restrict+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_c_restrict=no + # The order here caters to the fact that C++ does not require restrict. + for ac_kw in __restrict __restrict__ _Restrict restrict; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +typedef int * int_ptr; + int foo (int_ptr $ac_kw ip) { + return ip[0]; + } +int +main () +{ +int s[1]; + int * $ac_kw t = s; + t[0] = 0; + return foo(t) + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_restrict=$ac_kw +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + test "$ac_cv_c_restrict" != no && break + done + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_restrict" >&5 +$as_echo "$ac_cv_c_restrict" >&6; } + + case $ac_cv_c_restrict in + restrict) ;; + no) $as_echo "#define restrict /**/" >>confdefs.h + ;; + *) cat >>confdefs.h <<_ACEOF +#define restrict $ac_cv_c_restrict +_ACEOF + ;; + esac + + +# Check whether --enable-mpi was given. +if test "${enable_mpi+set}" = set; then : + enableval=$enable_mpi; test "x$enableval" != xno && enable_mpi=yes +else + enable_mpi=no +fi + + +# Check whether --enable-iso-c-interface was given. +if test "${enable_iso_c_interface+set}" = set; then : + enableval=$enable_iso_c_interface; test "x$enableval" != xno && enable_iso_c_interface=yes +else + enable_iso_c_interface=no +fi + + if test "x$enable_iso_c_interface" = xyes; then + ENABLE_ISOC_INTERFACE_TRUE= + ENABLE_ISOC_INTERFACE_FALSE='#' +else + ENABLE_ISOC_INTERFACE_TRUE='#' + ENABLE_ISOC_INTERFACE_FALSE= +fi + + +# Check whether --enable-cf-interface was given. +if test "${enable_cf_interface+set}" = set; then : + enableval=$enable_cf_interface; if test "x$enableval" != xno && test "x$enableval" != xauto; then : + enable_cf_interface=yes +fi +else + enable_cf_interface=auto +fi + +if test "x${enable_mpi}${enable_cf_interface}" = xnoauto; then : + enable_cf_interface=no +fi + +if test "x$enable_iso_c_interface" = xyes || \ + test "x$enable_cf_interface" != xno; then + if test "x$FC" != xno; then + 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 conftest +#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 conftest + + 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 + + test -z $FC 2>/dev/null && FC=no + +if test "x$FC" != xno; then : + 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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Fortran flag to compile .f90 files" >&5 +$as_echo_n "checking for Fortran flag to compile .f90 files... " >&6; } +if ${ac_cv_fc_srcext_f90+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_ext=f90 +ac_fcflags_srcext_save=$ac_fcflags_srcext +ac_fcflags_srcext= +ac_cv_fc_srcext_f90=unknown +case $ac_ext in #( + [fF]77) ac_try=f77;; #( + *) ac_try=f95;; +esac +for ac_flag in none -qsuffix=f=f90 -Tf "-x $ac_try"; do + test "x$ac_flag" != xnone && ac_fcflags_srcext="$ac_flag" + cat > conftest.$ac_ext <<_ACEOF + program conftest + + end +_ACEOF +if ac_fn_fc_try_compile "$LINENO"; then : + ac_cv_fc_srcext_f90=$ac_flag; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest.$ac_objext conftest.f90 +ac_fcflags_srcext=$ac_fcflags_srcext_save + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_fc_srcext_f90" >&5 +$as_echo "$ac_cv_fc_srcext_f90" >&6; } +if test "x$ac_cv_fc_srcext_f90" = xunknown; then + FC=no +else + ac_fc_srcext=f90 + if test "x$ac_cv_fc_srcext_f90" = xnone; then + ac_fcflags_srcext="" + FCFLAGS_f90="" + else + ac_fcflags_srcext=$ac_cv_fc_srcext_f90 + FCFLAGS_f90=$ac_cv_fc_srcext_f90 + fi + + +fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +fi + if test "x$FC" != xno; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the Fortran compiler works" >&5 +$as_echo_n "checking whether the Fortran compiler works... " >&6; } +if ${acx_cv_fc_works+:} false; then : + $as_echo_n "(cached) " >&6 +else + acx_cv_fc_works=no + 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 "$cross_compiling" = yes; then : + acx_cv_fc_works=yes +else + cat > conftest.$ac_ext <<_ACEOF + program conftest + + end +_ACEOF +if ac_fn_fc_try_run "$LINENO"; then : + acx_cv_fc_works=yes +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_fc_works" >&5 +$as_echo "$acx_cv_fc_works" >&6; } + if test "x$acx_cv_fc_works" = xno; then : + FC=no +fi +fi + if test "x$FC" != xno; then : + 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 + + + + unset acx_sl_cv_fc_mod_path_flag_fc + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for flag to alter module search path" >&5 +$as_echo_n "checking for flag to alter module search path... " >&6; } +if ${acx_sl_cv_fc_mod_path_flag_fc+:} false; then : + $as_echo_n "(cached) " >&6 +else + mkdir conftestdir + cd conftestdir + cat > conftest.$ac_ext <<_ACEOF + module cnftst + implicit none + integer, public :: i + end module cnftst +_ACEOF +if ac_fn_fc_try_compile "$LINENO"; then : + +else + as_fn_error $? "Cannot compile fortran modules" "$LINENO" 5 +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + cd .. + for i in -I -M -module -p; do + FCFLAGS_save=$FCFLAGS + FCFLAGS="$FCFLAGS ${i}conftestdir" + cat > conftest.$ac_ext <<_ACEOF + program conftest + use cnftst + implicit none + i = 0 + end +_ACEOF +if ac_fn_fc_try_compile "$LINENO"; then : + acx_sl_cv_fc_mod_path_flag_fc=$i ; FCFLAGS=$FCFLAGS_save ; break +else + : +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + FCFLAGS=$FCFLAGS_save + done + FCFLAGS=$FCFLAGS_save + rm -rf conftestdir + if ${acx_sl_cv_fc_mod_path_flag_fc+:} false; then : + : +else + FC_MOD_FLAG=-I +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_sl_cv_fc_mod_path_flag_fc" >&5 +$as_echo "$acx_sl_cv_fc_mod_path_flag_fc" >&6; } + FC_MOD_FLAG=$acx_sl_cv_fc_mod_path_flag_fc + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Fortran compiler flag needed to specify search paths for the \"INCLUDE\" statement" >&5 +$as_echo_n "checking for Fortran compiler flag needed to specify search paths for the \"INCLUDE\" statement... " >&6; } +if ${acx_cv_fc_ftn_include_flag+:} false; then : + $as_echo_n "(cached) " >&6 +else + acx_cv_fc_ftn_include_flag=unknown + as_dir=conftest.dir; as_fn_mkdir_p + cat > conftest.$ac_ext <<_ACEOF + program conftest + + end +_ACEOF + mv conftest.$ac_ext conftest.dir/conftest.inc + cat > conftest.$ac_ext <<_ACEOF + include "conftest.inc" +_ACEOF + acx_save_FCFLAGS=$FCFLAGS + for acx_flag in -I '-I '; do + FCFLAGS="$acx_save_FCFLAGS ${acx_flag}conftest.dir" + if ac_fn_fc_try_link "$LINENO"; then : + acx_cv_fc_ftn_include_flag=$acx_flag +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + test "x$acx_cv_fc_ftn_include_flag" != xunknown && break + done + FCFLAGS=$acx_save_FCFLAGS + rm -rf conftest.$ac_ext conftest.dir +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_fc_ftn_include_flag" >&5 +$as_echo "$acx_cv_fc_ftn_include_flag" >&6; } + if test "x$acx_cv_fc_ftn_include_flag" = xunknown; then : + FC_OPTINC=-I +else + FC_OPTINC=$acx_cv_fc_ftn_include_flag + +fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for conftest_module module file name" >&5 +$as_echo_n "checking for conftest_module module file name... " >&6; } +if ${acx_cv_fc_mod_name+:} false; then : + $as_echo_n "(cached) " >&6 +else + 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 + module conftest_module + implicit none + integer :: i + end module conftest_module +_ACEOF +if ac_fn_fc_try_compile "$LINENO"; then : + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + while :; do + acx_cv_fc_mod_name= + if test -n "conftest_module.$FCMODEXT" -a -f "conftest_module.$FCMODEXT"; then : + acx_cv_fc_mod_name="conftest_module.$FCMODEXT" ; break +fi + if test -n "conftest_module.mod" -a -f "conftest_module.mod"; then : + acx_cv_fc_mod_name="conftest_module.mod" ; break +fi + if test -n "conftest_module.MOD" -a -f "conftest_module.MOD"; then : + acx_cv_fc_mod_name="conftest_module.MOD" ; break +fi + if test -n "conftest_module.M" -a -f "conftest_module.M"; then : + acx_cv_fc_mod_name="conftest_module.M" ; break +fi + if test -n "CONFTEST_MODULE.MOD" -a -f "CONFTEST_MODULE.MOD"; then : + acx_cv_fc_mod_name="CONFTEST_MODULE.MOD" ; break +fi + if test -n "CONFTEST_MODULE.mod" -a -f "CONFTEST_MODULE.mod"; then : + acx_cv_fc_mod_name="CONFTEST_MODULE.mod" ; break +fi + + break + done + rm -f conftest_module* CONFTEST_MODULE* + if expr "$ac_compile" : '.*/libtool --mode=compile' >/dev/null; then : + if test -n "$objdir"; then : + rm -f "$objdir"/conftest_module* "$objdir"/CONFTEST_MODULE* +fi +fi + 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 + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_fc_mod_name" >&5 +$as_echo "$acx_cv_fc_mod_name" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of module files" >&5 +$as_echo_n "checking for suffix of module files... " >&6; } + ac_fc_mod_uppercase=no + case $acx_cv_fc_mod_name in #( + conftest_module.$FCMODEXT) : + : ;; #( + CONFTEST_MODULE.$FCMODEXT) : + ac_fc_mod_uppercase=yes ;; #( + conftest_module.mod) : + FCMODEXT=mod ;; #( + conftest_module.MOD) : + FCMODEXT=MOD ;; #( + conftest_module.M) : + FCMODEXT=M ;; #( + CONFTEST_MODULE.MOD) : + FCMODEXT=MOD ; ac_fc_mod_uppercase=yes ;; #( + CONFTEST_MODULE.mod) : + FCMODEXT=mod ; ac_fc_mod_uppercase=yes ;; #( + *) : + ;; +esac + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${FCMODEXT-not found}" >&5 +$as_echo "${FCMODEXT-not found}" >&6; } + ${FCMODEXT+:} false + if test $ac_fc_mod_uppercase = yes; then : + FCMODCASE=uc + { $as_echo "$as_me:${as_lineno-$LINENO}: Fortran module filenames are uppercase." >&5 +$as_echo "$as_me: Fortran module filenames are uppercase." >&6;} +else + FCMODCASE=lc +fi + + + + saved_ac_fc_srcext=$ac_fc_srcext + ac_fc_srcext='F90' + 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 +ac_fc_pp_define_srcext_save=$ac_fc_srcext + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to define symbols for preprocessed Fortran" >&5 +$as_echo_n "checking how to define symbols for preprocessed Fortran... " >&6; } +if ${ac_cv_fc_pp_define+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_fc_pp_define_srcext_save=$ac_fc_srcext +ac_cv_fc_pp_define=unknown +ac_fc_pp_define_FCFLAGS_save=$FCFLAGS +for ac_flag in -D -WF,-D -Wp,-D -Wc,-D +do + FCFLAGS="$ac_fc_pp_define_FCFLAGS_save ${ac_flag}FOOBAR ${ac_flag}ZORK=42" + cat > conftest.$ac_ext <<_ACEOF + program conftest + +#ifndef FOOBAR + choke me +#endif +#if ZORK != 42 + choke me +#endif + end +_ACEOF +if ac_fn_fc_try_compile "$LINENO"; then : + ac_cv_fc_pp_define=$ac_flag +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + test x"$ac_cv_fc_pp_define" != xunknown && break +done +FCFLAGS=$ac_fc_pp_define_FCFLAGS_save + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_fc_pp_define" >&5 +$as_echo "$ac_cv_fc_pp_define" >&6; } +ac_fc_srcext=$ac_fc_pp_define_srcext_save +if test "x$ac_cv_fc_pp_define" = xunknown; then + FC_DEFINE= + FC_DEFINE=-D +else + FC_DEFINE=$ac_cv_fc_pp_define + +fi +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 + + ac_fc_srcext=$saved_ac_fc_srcext + + 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 + fi +else + FC=no +fi + if test "x$FCMODCASE" = xuc; then + FC_MOD_UPPERCASE_TRUE= + FC_MOD_UPPERCASE_FALSE='#' +else + FC_MOD_UPPERCASE_TRUE='#' + FC_MOD_UPPERCASE_FALSE= +fi + +if test "x$enable_iso_c_interface" = xyes; then : + if test "x$FC" != xno; then : + 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 + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if Fortran compiler can handle complex CHARACTER interoperability" >&5 +$as_echo_n "checking if Fortran compiler can handle complex CHARACTER interoperability... " >&6; } + cat > conftest.$ac_ext <<_ACEOF +module conftest_mod + use iso_c_binding + implicit none + private + public :: errstr +contains + function errstr(errno) + integer, intent(in) :: errno + interface + function strerror(errno) bind(c, name='strerror') + import :: c_int, c_ptr + integer(c_int), value, intent(in) :: errno + type(c_ptr) :: strerror + end function strerror + function strlen(s) bind(c, name='strlen') + import :: c_ptr, c_size_t + type(c_ptr), value, intent(in) :: s + integer(c_size_t) :: strlen + end function strlen + end interface + type(c_ptr) :: cptr + character(kind=c_char), dimension(:), pointer :: buf + character(len=:), pointer :: errstr + integer :: i, rv_shape(1) + + cptr = strerror(int(errno, c_int)) + rv_shape(1) = int(strlen(cptr)) + call c_f_pointer(cptr, buf, rv_shape) + allocate(character(rv_shape(1)) :: errstr) + do i = 1, rv_shape(1) + errstr(i:i) = buf(i) + end do + end function errstr +end module conftest_mod + +program conftest + use conftest_mod, only: errstr + implicit none + character(len=:), pointer :: msg + msg => errstr(42) + write (0, '(a)') msg +end program conftest +_ACEOF +if ac_fn_fc_try_compile "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +FC=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + rm -f conftest_mod* CONFTEST_MOD* + 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 + if test "x$FC" = xno; 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 $? "the Fortran 2003 interface is requested but the Fortran compiler is disabled, missing or lacks the required features +See \`config.log' for more details" "$LINENO" 5; } +fi +fi + if test "x$FC" != xno; then + BUILD_FC_PROGRAMS_TRUE= + BUILD_FC_PROGRAMS_FALSE='#' +else + BUILD_FC_PROGRAMS_TRUE='#' + BUILD_FC_PROGRAMS_FALSE= +fi + + +if test "x$enable_cf_interface" != xno; then + if test -n "$F77" && test "x$F77" != xno; then : + requested_F77=yes +else + requested_F77=no +fi + if test "x$FC" = xno || test "x$requested_F77" = xyes; then + ac_ext=f +ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' +ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_f77_compiler_gnu +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 + + test -z $F77 2>/dev/null && F77=no + +if test "x$F77" != xno; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the Fortran 77 compiler works" >&5 +$as_echo_n "checking whether the Fortran 77 compiler works... " >&6; } +if ${acx_cv_f77_works+:} false; then : + $as_echo_n "(cached) " >&6 +else + acx_cv_f77_works=no + 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 "$cross_compiling" = yes; then : + acx_cv_f77_works=yes +else + cat > conftest.$ac_ext <<_ACEOF + program main + + end +_ACEOF +if ac_fn_f77_try_run "$LINENO"; then : + acx_cv_f77_works=yes +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_f77_works" >&5 +$as_echo "$acx_cv_f77_works" >&6; } + if test "x$acx_cv_f77_works" = xno; then : + F77=no +fi +fi + else + F77=no + fi + if test "x$F77" = xno && test "x$requested_F77" = xyes; 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 $? "the explicitly requested Fortran 77 compiler is missing or lacks the required features +See \`config.log' for more details" "$LINENO" 5; } +fi + { requested_F77=; unset requested_F77;} +else + F77=no +fi +if test "x$enable_cf_interface" != xno; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking C preprocessor flags for Fortran calling convention cfortran.h" >&5 +$as_echo_n "checking C preprocessor flags for Fortran calling convention cfortran.h... " >&6; } +if ${acx_cv_cf_flag+:} false; then : + $as_echo_n "(cached) " >&6 +else + acx_cv_cf_flag='' + for macro in pgiFortran NAGf90Fortran f2cFortran hpuxFortran apolloFortran sunFortran IBMR2Fortran CRAYFortran PATHSCALE_COMPILER gFortran mipsFortran DECFortran vmsFortran CONVEXFortran PowerStationFortran AbsoftUNIXFortran AbsoftProFortran SXFortran +do : + acx_temp=`echo "$CPPFLAGS $CFLAGS" | sed -n 's/^\(.* \)*-D\('"$macro"'\)\( .*\)*$/\2/;t print +b +: print +p'` + if test x"$acx_temp" != x; then : + if test x"$acx_cv_cf_flag" = x; then : + acx_cv_cf_flag="$acx_temp (user-specified)" +else + acx_failure_msg="multiple specification of cfortran.h flags: "`echo "$acx_cv_cf_flag" | sed 's/ (user-specified)$//'`" $acx_temp" + acx_cv_cf_flag='error' + break +fi +fi +done + if test x"$acx_cv_cf_flag" = x; then : + if test -n "$FC" -a X"$FC" != Xno; then : + 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 + + + + + case $host in #( + x86_64-*-linux-*|i*86-*-linux-*|*-apple-darwin*|ia64-*-linux-*|x86_64-*-freebsd*|i*86-*-freebsd*) : + acx_temp=`$FC -V 2>&1 | sed -n 1,5p` + if echo "$acx_temp" | grep '^Copyright.*\(The Portland Group\|NVIDIA CORPORATION\)' >/dev/null; then : + acx_cv_fc_cf_flag=-DgFortran +elif echo "$acx_temp" | grep '^NAG Fortran Compiler Release' >/dev/null; then : + acx_cv_fc_cf_flag=-DNAGf90Fortran +elif echo "$acx_temp" | grep '^Intel(R) Fortran.*Compiler' >/dev/null; then : + acx_cv_fc_cf_flag=-DgFortran +elif echo "$acx_temp" | grep '^Cray Fortran' >/dev/null; then : + acx_cv_fc_cf_flag=-DgFortran +elif acx_temp=`$FC --version 2>&1 | sed -n 1,5p` \ + && echo $acx_temp | grep '^GNU Fortran' >/dev/null; then : + if echo $acx_temp | grep g77 >/dev/null; then : + acx_cv_fc_cf_flag=-Dg77Fortran +else + if echo "$FCFLAGS" | grep '^\(.* \)*-ff2c\( .*\)*$' >/dev/null; then : + acx_cv_fc_cf_flag=-Df2cFortran +else + acx_cv_fc_cf_flag=-DgFortran +fi +fi +elif echo $acx_temp | grep '^G95' >/dev/null; then : + acx_cv_fc_cf_flag=-DNAGf90Fortran +elif $FC -v 2>&1 | sed -n 1,5p | grep '^f2c' >/dev/null; then : + acx_cv_fc_cf_flag=-Df2cFortran +fi ;; #( + powerpc64-*-linux-*|powerpc-*-linux-*) : + if $FC -qversion 2>&1 | sed -n 1,5p | grep '^IBM XL Fortran' >/dev/null; then : + acx_cv_fc_cf_flag=-DIBMR2Fortran +fi ;; #( + *-ibm-aix*) : + if $CC -qversion 2>&1 | grep '^IBM XL C' >/dev/null; then : + +else + acx_cv_fc_cf_flag=-DIBMR2Fortran +fi + ;; #( + *-*-hpux*) : + acx_cv_fc_cf_flag=-DhpuxFortran ;; #( + sx*-*-*|es*-*-*) : + acx_cv_fc_cf_flag=-DSXFortran ;; #( + *) : + ;; +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 + +fi + if test -n "$F77" -a X"$F77" != Xno; then : + ac_ext=f +ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' +ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_f77_compiler_gnu + + + + + case $host in #( + x86_64-*-linux-*|i*86-*-linux-*|*-apple-darwin*|ia64-*-linux-*|x86_64-*-freebsd*|i*86-*-freebsd*) : + acx_temp=`$F77 -V 2>&1 | sed -n 1,5p` + if echo "$acx_temp" | grep '^Copyright.*\(The Portland Group\|NVIDIA CORPORATION\)' >/dev/null; then : + acx_cv_f77_cf_flag=-DgFortran +elif echo "$acx_temp" | grep '^NAG Fortran Compiler Release' >/dev/null; then : + acx_cv_f77_cf_flag=-DNAGf90Fortran +elif echo "$acx_temp" | grep '^Intel(R) Fortran.*Compiler' >/dev/null; then : + acx_cv_f77_cf_flag=-DgFortran +elif echo "$acx_temp" | grep '^Cray Fortran' >/dev/null; then : + acx_cv_f77_cf_flag=-DgFortran +elif acx_temp=`$F77 --version 2>&1 | sed -n 1,5p` \ + && echo $acx_temp | grep '^GNU Fortran' >/dev/null; then : + if echo $acx_temp | grep g77 >/dev/null; then : + acx_cv_f77_cf_flag=-Dg77Fortran +else + if echo "$FFLAGS" | grep '^\(.* \)*-ff2c\( .*\)*$' >/dev/null; then : + acx_cv_f77_cf_flag=-Df2cFortran +else + acx_cv_f77_cf_flag=-DgFortran +fi +fi +elif echo $acx_temp | grep '^G95' >/dev/null; then : + acx_cv_f77_cf_flag=-DNAGf90Fortran +elif $F77 -v 2>&1 | sed -n 1,5p | grep '^f2c' >/dev/null; then : + acx_cv_f77_cf_flag=-Df2cFortran +fi ;; #( + powerpc64-*-linux-*|powerpc-*-linux-*) : + if $F77 -qversion 2>&1 | sed -n 1,5p | grep '^IBM XL Fortran' >/dev/null; then : + acx_cv_f77_cf_flag=-DIBMR2Fortran +fi ;; #( + *-ibm-aix*) : + if $CC -qversion 2>&1 | grep '^IBM XL C' >/dev/null; then : + +else + acx_cv_f77_cf_flag=-DIBMR2Fortran +fi + ;; #( + *-*-hpux*) : + acx_cv_f77_cf_flag=-DhpuxFortran ;; #( + sx*-*-*|es*-*-*) : + acx_cv_f77_cf_flag=-DSXFortran ;; #( + *) : + ;; +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 + +fi + if test -z "$FC" -o X"$FC" != Xno; then : + acx_cv_cf_flag="$acx_cv_fc_cf_flag (probed)" +elif test -z "$F77" -o X"$F77" != Xno; then : + acx_cv_cf_flag="$acx_cv_f77_cf_flag (probed)" +else + if test x"$acx_cv_f77_cf_flag" = x"$acx_cv_fc_cf_flag"; then : + acx_cv_cf_flag="$acx_cv_f77_cf_flag (probed)" +else + acx_failure_msg="cfortran.h flag for $F77 does not match the flag for $FC. +Did you configure compatible compilers?" + acx_cv_cf_flag='error' +fi +fi +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_cf_flag" >&5 +$as_echo "$acx_cv_cf_flag" >&6; } + if test x"$acx_cv_cf_flag" = xerror; then : + as_fn_error $? "$acx_failure_msg" "$LINENO" 5 +fi + if echo "$acx_cv_cf_flag" | grep ' (probed)$' >/dev/null; then : + CPPFLAGS="${CPPFLAGS+$CPPFLAGS }"`echo "$acx_cv_cf_flag" | sed 's/ (probed)$//'` +fi + + case $host in #( + *-ibm-aix*|powerpc64-*-linux-*|powerpc-*-linux-*) : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if -Dappendus needs to be added to CPPFLAGS for cfortran.h" >&5 +$as_echo_n "checking if -Dappendus needs to be added to CPPFLAGS for cfortran.h... " >&6; } + if $CC -qversion 2>&1 | sed -n 1,5p | grep '^IBM XL C' >/dev/null; then : + acx_temp_qextname_f77flags=`echo "$FFLAGS" | sed -n '/-qextname/{ s/^\(.* \)*-qextname\( .*\)*$/-qextname/;p;}'` + acx_temp_qextname_fcflags=`echo "$FCFLAGS" | sed -n '/-qextname/{ s/^\(.* \)*-qextname\( .*\)*$/-qextname/;p;}'` + + if $FC -qversion 2>&1 | grep '^IBM XL Fortran' >/dev/null; then : + +else + acx_temp_qextname_fcflags=-qextname +fi + case x"$acx_temp_qextname_fcflags$acx_temp_qextname_f77flags" in #( + x-qextname) : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: error" >&5 +$as_echo "error" >&6; } + acx_failure_msg="option -qextname must be provided consistently to F77 and FC" + as_fn_error $? "$acx_failure_msg" "$LINENO" 5 ;; #( + x-qextname-qextname) : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + CPPFLAGS="${CPPFLAGS+$CPPFLAGS }-Dappendus" ;; #( + *) : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } ;; +esac + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi ;; #( + *) : + ;; +esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if C externals constructed with cfortran.h work" >&5 +$as_echo_n "checking if C externals constructed with cfortran.h work... " >&6; } +if ${acx_cv_cfortran_works+:} false; then : + $as_echo_n "(cached) " >&6 +else + acx_cv_cfortran_works=no + save_CPPFLAGS=$CPPFLAGS + CPPFLAGS="-I$srcdir/src $CPPFLAGS" + 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. */ +#include "cfortran.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> + +PROTOCCALLSFFUN1(FLOAT,CFTSTF,cftstf,FLOAT) +#define conftest_F(v) \ + CCALLSFFUN1(CFTSTF,cftstf,FLOAT,(v)); + +static float +cftstC(int i, float v, int *p, float *q) +{ + float f; + *p = (int)roundf(v * i); + *q = f = conftest_F(v * i); + return f; +} + +FCALLSCFUN4(FLOAT,cftstC,CFTSTC,cftstc,INT,FLOAT,PINT,PFLOAT) + +/* test string returns */ +static const char * +conftest_str_C(void) +{ + static const char msg[100] = "AAAAAAAAAAAAAAAAAAAA" + "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"; + return msg; +} + +FCALLSCFUN0(STRING,conftest_str_C,CHTST,chtst) + +/* This function is required simply because some Fortran compilers + * won't stop with exit code n when encountering STOP n */ +static void +errExit(void) +{ + exit(1); +} + +FCALLSCSUB0(errExit,ERR_EXIT,err_exit) + + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + acx_fn_mv_obj "$LINENO" conftest conftest_c + if test -n "$FC" -a X"$FC" != Xno; then : + 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 + MODULE conftest_data + IMPLICIT NONE + PRIVATE + REAL :: ri + PUBLIC :: ri + END MODULE conftest_data + + FUNCTION cftstf(v) RESULT(r) + USE conftest_data, ONLY: ri + REAL, INTENT(in) :: v + REAL :: r + r = v * 100.0 + ri = 1.0 / v + END FUNCTION cftstf +_ACEOF +if ac_fn_fc_try_compile "$LINENO"; then : + acx_fn_mv_obj "$LINENO" conftest conftest_f + save_LIBS=$LIBS + LIBS="conftest_c.$ac_objext conftest_f.$ac_objext $LIBS" + case $FC_FPP_FLAG in #( + -x\ f??-cpp-input) : + LIBS="-x none $LIBS" ;; #( + *) : + ;; +esac + if test "$cross_compiling" = yes; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: Skipping run test for cfortran.h in cross-compilation mode," >&5 +$as_echo "$as_me: Skipping run test for cfortran.h in cross-compilation mode," >&6;} + { $as_echo "$as_me:${as_lineno-$LINENO}: cfortran.h link test succeeded for $FC." >&5 +$as_echo "$as_me: cfortran.h link test succeeded for $FC." >&6;} + acx_cv_cfortran_works=yes +else + cat > conftest.$ac_ext <<_ACEOF + program conftest + USE conftest_data, ONLY: ri + IMPLICIT NONE + INTERFACE + FUNCTION cftstc(i, v, p, q) RESULT(f) + INTEGER, INTENT(in) :: i + REAL, INTENT(in) :: v + INTEGER, INTENT(out) :: p + REAL, INTENT(out) :: q + REAL :: f + END FUNCTION cftstc + FUNCTION chtst() result(s) + CHARACTER(99) :: s + END FUNCTION chtst + END INTERFACE + REAL, PARAMETER :: eps = 10e-6 + REAL :: foo, boo, too + INTEGER :: bar, baz, i + CHARACTER(99) :: aaaaaa + bar = 5 + foo = 0.3 + too = cftstc(bar, foo, baz, boo) + IF (ABS(baz - NINT(bar * foo)) /= 0) THEN + WRITE (0, '(2(a,i0))') "error checking, when baz, baz=", baz, & + ", NINT(bar * foo) =", NINT(bar * foo) + FLUSH(0) + CALL err_exit + END IF + IF (ABS((ri - 1.0 / (bar * foo)) / ABS(ri)) > eps) THEN + WRITE (0, '(2(a,g24.15))') "error checking ri, ri=", ri, ", 1.0 / & + &(bar * foo) = ", 1.0 / (bar * foo) + FLUSH(0) + CALL err_exit + END IF + IF (ABS((boo - (bar * foo * 100.0))/ABS(boo)) > eps) THEN + WRITE (0, '(2(a,g24.15))') "error checking boo, boo=", boo, & + ", bar * foo * 100.0 = ", bar * foo * 100.0 + FLUSH(0) + CALL err_exit + END IF + IF (too /= boo) THEN + WRITE (0, '(2(a,g24.15))') "error checking too vs. boo, too=", too, & + ", boo = ", boo + FLUSH(0) + CALL err_exit + END IF + aaaaaa = chtst() + DO i = 1, 99 + IF (aaaaaa(i:i) /= 'A') THEN + WRITE (0, '(a,i0,a)') "error checking aaaaaa(", i, ")=", & + aaaaaa(i:i) + FLUSH(0) + CALL err_exit + END IF + END DO + end +_ACEOF +if ac_fn_fc_try_run "$LINENO"; then : + acx_cv_cfortran_works=yes +else + acx_cv_cfortran_works="error" +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + rm -f "conftest_f.$ac_objext" "conftest_f.$OBJEXT" + rm -f conftest_data* CONFTEST_DATA* 2>/dev/null + LIBS=$save_LIBS +else + acx_cv_cfortran_works="error compiling Fortran subroutine" +fi +rm -f core conftest.err conftest.$ac_objext 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 + +else + acx_cv_cfortran_works=${acx_cv_cfortran_works-yes} +fi + if test -n "$F77" -a X"$F77" != Xno -a \( x"$acx_cv_cfortran_works" = xyes -o -z "$FC" -o X"$FC" = Xno \); then : + ac_ext=f +ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' +ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_f77_compiler_gnu + + cat > conftest.$ac_ext <<_ACEOF + REAL FUNCTION CFTSTF(v) + REAL RI + COMMON /CFTSTD/ RI + REAL V + REAL R + CFTSTF = V * 100.0 + RI = 1.0 / V + END FUNCTION CFTSTF +_ACEOF +if ac_fn_f77_try_compile "$LINENO"; then : + acx_fn_mv_obj "$LINENO" conftest conftest_f + save_LIBS=$LIBS + LIBS="conftest_c.$ac_objext conftest_f.$ac_objext $LIBS" + case $FC_FPP_FLAG in #( + -x\ f??-cpp-input) : + LIBS="-x none $LIBS" ;; #( + *) : + ;; +esac + if test "$cross_compiling" = yes; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: Skipping run test for cfortran.h in cross-compilation mode," >&5 +$as_echo "$as_me: Skipping run test for cfortran.h in cross-compilation mode," >&6;} + { $as_echo "$as_me:${as_lineno-$LINENO}: cfortran.h link test succeeded for $F77." >&5 +$as_echo "$as_me: cfortran.h link test succeeded for $F77." >&6;} + acx_cv_cfortran_works=yes +else + cat > conftest.$ac_ext <<_ACEOF + program main + REAL RI + COMMON /CFTSTD/ RI + REAL EPS + PARAMETER(EPS=10E-6) + REAL FOO, BOO, TOO + INTEGER BAR, BAZ, I + CHARACTER(99) AAAAAA + EXTERNAL CFTSTC, CFTSTF, CHTST, ERR_EXIT + REAL CFTSTC, CFTSTF + CHARACTER(99) CHTST + BAR = 5 + FOO = 0.3 + TOO = CFTSTC(BAR, FOO, BAZ, BOO) + IF (ABS(BAZ - NINT(BAR * FOO)) /= 0) THEN + WRITE (0, '(2(A,I0))') "ERROR CHECKING, WHEN BAZ, BAZ=", BAZ, + & ", NINT(BAR * FOO) =", NINT(BAR * FOO) + CALL ERR_EXIT + END IF + IF (ABS((RI - 1.0 / (BAR * FOO)) / ABS(RI)) > EPS) THEN + WRITE (0, '(2(A,F24.15))') "ERROR CHECKING RI, RI=", RI, ", + & 1.0 / (BAR * FOO) = ", 1.0 / (BAR * FOO) + CALL err_exit + END IF + IF (ABS((BOO - (BAR * FOO * 100.0))/ABS(BOO)) > EPS) THEN + WRITE (0, '(2(A,F24.15))') "ERROR CHECKING BOO, BOO=", BOO, + & ", BAR * FOO * 100.0 = ", BAR * FOO * 100.0 + CALL ERR_EXIT + END IF + IF (TOO /= BOO) THEN + WRITE (0, '(2(A,F24.15))') "ERROR CHECKING TOO VS. BOO, TOO=", + & TOO, ", BOO = ", BOO + CALL ERR_EXIT + END IF + AAAAAA = CHTST() + DO i = 1, 99 + IF (AAAAAA(I:I) /= 'A') THEN + WRITE (0, '(A,I0,2A)') "ERROR CHECKING AAAAAA(", I, ")=", + & AAAAAA(I:I) + CALL ERR_EXIT + END IF + END DO + end +_ACEOF +if ac_fn_f77_try_run "$LINENO"; then : + acx_cv_cfortran_works=yes +else + acx_cv_cfortran_works="error" +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + rm -f "conftest_f.$ac_objext" "conftest_f.$OBJEXT" + LIBS=$save_LIBS +else + acx_cv_cfortran_works="error compiling Fortran subroutine" +fi +rm -f core conftest.err conftest.$ac_objext 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 + rm -f "conftest_c.$ac_objext" "conftest_c.$OBJEXT" + +else + acx_cv_cfortran_works="compiling with cfortran.h failed" +fi +rm -f core conftest.err conftest.$ac_objext 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 + + CPPFLAGS=$save_CPPFLAGS + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_cfortran_works" >&5 +$as_echo "$acx_cv_cfortran_works" >&6; } + case x"$acx_cv_cfortran_works" in #( + x"error") : + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "Linking/Running with C EXTERNAL built with cfortran.h does not work! +See \`config.log' for more details" "$LINENO" 5; } ;; #( + x"compiling with cfortran.h failed") : + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "Compilation with cfortran.h is not working! +See \`config.log' for more details" "$LINENO" 5; } ;; #( + x"error compiling Fortran subroutine") : + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "compilation of simple Fortran source failed! +See \`config.log' for more details" "$LINENO" 5; } ;; #( + xyes) : + +$as_echo "#define HAVE_CF_INTERFACE 1" >>confdefs.h + ;; #( + *) : + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "Unexpected error when linking C and Fortran via cfortran.h! +See \`config.log' for more details" "$LINENO" 5; } ;; +esac + + if test "x$F77" != xno; then : + ac_ext=f +ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' +ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_f77_compiler_gnu + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Fortran 77 compiler flag needed to specify search paths for the \"INCLUDE\" statement" >&5 +$as_echo_n "checking for Fortran 77 compiler flag needed to specify search paths for the \"INCLUDE\" statement... " >&6; } +if ${acx_cv_f77_ftn_include_flag+:} false; then : + $as_echo_n "(cached) " >&6 +else + acx_cv_f77_ftn_include_flag=unknown + as_dir=conftest.dir; as_fn_mkdir_p + cat > conftest.$ac_ext <<_ACEOF + program main + + end +_ACEOF + mv conftest.$ac_ext conftest.dir/conftest.inc + cat > conftest.$ac_ext <<_ACEOF + include "conftest.inc" +_ACEOF + acx_save_FFLAGS=$FFLAGS + for acx_flag in -I '-I '; do + FFLAGS="$acx_save_FFLAGS ${acx_flag}conftest.dir" + if ac_fn_f77_try_link "$LINENO"; then : + acx_cv_f77_ftn_include_flag=$acx_flag +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + test "x$acx_cv_f77_ftn_include_flag" != xunknown && break + done + FFLAGS=$acx_save_FFLAGS + rm -rf conftest.$ac_ext conftest.dir +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_f77_ftn_include_flag" >&5 +$as_echo "$acx_cv_f77_ftn_include_flag" >&6; } + if test "x$acx_cv_f77_ftn_include_flag" = xunknown; 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 $? "unable to detect Fortran 77 compiler flag needed to specify search paths for the \"INCLUDE\" statement +See \`config.log' for more details" "$LINENO" 5; } +fi + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + if test "x$FC" != xno && test "x$acx_cv_f77_ftn_include_flag" != "x$FC_OPTINC"; then : + as_fn_error $? "Fortran and Fortran 77 compilers require different flags needed to specify search paths for the \"INCLUDE\" statements" "$LINENO" 5 +fi +fi + if test "x$FC" = xno && test "x$F77" = xno; then : + if test "x$enable_cf_interface" = xauto; then : + enable_cf_interface=no +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 $? "the Fortran 77 interface is requested but both Fortran and Fortran 77 compilers are disabled, missing or lack the required features +See \`config.log' for more details" "$LINENO" 5; } +fi +fi +fi +if test "x$enable_cf_interface" = xauto; then : + enable_cf_interface=yes +fi + if test "x$enable_cf_interface" = xyes; then + ENABLE_CF_INTERFACE_TRUE= + ENABLE_CF_INTERFACE_FALSE='#' +else + ENABLE_CF_INTERFACE_TRUE='#' + ENABLE_CF_INTERFACE_FALSE= +fi + + +# Check whether --enable-ruby-interface was given. +if test "${enable_ruby_interface+set}" = set; then : + enableval=$enable_ruby_interface; test "x$enableval" != xno && enable_ruby_interface=yes +else + enable_ruby_interface=no +fi + + +# Check whether --enable-python-interface was given. +if test "${enable_python_interface+set}" = set; then : + enableval=$enable_python_interface; test "x$enableval" != xno && enable_python_interface=yes +else + enable_python_interface=no +fi + + +if test "x$enable_ruby_interface" = xyes || \ + test "x$enable_python_interface" = xyes; then + if test "x$CXX" != xno; then + ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +if test -z "$CXX"; then + if test -n "$CCC"; then + CXX=$CCC + else + if test -n "$ac_tool_prefix"; then + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CXX"; then + ac_cv_prog_CXX="$CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CXX=$ac_cv_prog_CXX +if test -n "$CXX"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 +$as_echo "$CXX" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CXX" && break + done +fi +if test -z "$CXX"; then + ac_ct_CXX=$CXX + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CXX"; then + ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CXX="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CXX=$ac_cv_prog_ac_ct_CXX +if test -n "$ac_ct_CXX"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 +$as_echo "$ac_ct_CXX" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CXX" && break +done + + if test "x$ac_ct_CXX" = x; then + CXX="g++" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CXX=$ac_ct_CXX + fi +fi + + fi +fi +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5 +$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } +if ${ac_cv_cxx_compiler_gnu+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_compiler_gnu=yes +else + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_cxx_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 +$as_echo "$ac_cv_cxx_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GXX=yes +else + GXX= +fi +ac_test_CXXFLAGS=${CXXFLAGS+set} +ac_save_CXXFLAGS=$CXXFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 +$as_echo_n "checking whether $CXX accepts -g... " >&6; } +if ${ac_cv_prog_cxx_g+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_save_cxx_werror_flag=$ac_cxx_werror_flag + ac_cxx_werror_flag=yes + ac_cv_prog_cxx_g=no + CXXFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_cv_prog_cxx_g=yes +else + CXXFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + +else + ac_cxx_werror_flag=$ac_save_cxx_werror_flag + CXXFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_cv_prog_cxx_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_cxx_werror_flag=$ac_save_cxx_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 +$as_echo "$ac_cv_prog_cxx_g" >&6; } +if test "$ac_test_CXXFLAGS" = set; then + CXXFLAGS=$ac_save_CXXFLAGS +elif test $ac_cv_prog_cxx_g = yes; then + if test "$GXX" = yes; then + CXXFLAGS="-g -O2" + else + CXXFLAGS="-g" + fi +else + if test "$GXX" = yes; then + CXXFLAGS="-O2" + else + CXXFLAGS= + fi +fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +depcc="$CXX" am_compiler_list= + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +$as_echo_n "checking dependency style of $depcc... " >&6; } +if ${am_cv_CXX_dependencies_compiler_type+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named 'D' -- because '-MD' means "put the output + # in D". + rm -rf conftest.dir + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CXX_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + am__universal=false + case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with + # Solaris 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with '-c' and '-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle '-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs. + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # After this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested. + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok '-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CXX_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CXX_dependencies_compiler_type=none +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5 +$as_echo "$am_cv_CXX_dependencies_compiler_type" >&6; } +CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type + + if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then + am__fastdepCXX_TRUE= + am__fastdepCXX_FALSE='#' +else + am__fastdepCXX_TRUE='#' + am__fastdepCXX_FALSE= +fi + + + test -z $CXX 2>/dev/null && CXX=no + +if test "x$CXX" != xno; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C++ compiler works" >&5 +$as_echo_n "checking whether the C++ compiler works... " >&6; } +if ${acx_cv_cxx_works+:} false; then : + $as_echo_n "(cached) " >&6 +else + acx_cv_cxx_works=no + ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + acx_cv_cxx_works=yes +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: $acx_cv_cxx_works" >&5 +$as_echo "$acx_cv_cxx_works" >&6; } + if test "x$acx_cv_cxx_works" = xno; then : + CXX=no +fi +fi + fi + if test "x$CXX" = xno; 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 $? "either the Ruby or the Python interface is requested but the C++ compiler is disabled, missing or lacks the required features +See \`config.log' for more details" "$LINENO" 5; } +fi +else + CXX=no + if false; then + am__fastdepCXX_TRUE= + am__fastdepCXX_FALSE='#' +else + am__fastdepCXX_TRUE='#' + am__fastdepCXX_FALSE= +fi + +fi + + + +# Check whether --enable-openmp was given. +if test "${enable_openmp+set}" = set; then : + enableval=$enable_openmp; test "x$enableval" != xno && enable_openmp=yes +else + enable_openmp=no +fi + + + OPENMP_CFLAGS= + + if test "$enable_openmp" != no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to support OpenMP" >&5 +$as_echo_n "checking for $CC option to support OpenMP... " >&6; } +if ${ac_cv_prog_c_openmp+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifndef _OPENMP + choke me +#endif +#include <omp.h> +int main () { return omp_get_num_threads (); } + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_prog_c_openmp='none needed' +else + ac_cv_prog_c_openmp='unsupported' + for ac_option in -fopenmp -xopenmp -openmp -mp -omp -qsmp=omp -homp \ + -Popenmp --openmp; do + ac_save_CFLAGS=$CFLAGS + CFLAGS="$CFLAGS $ac_option" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifndef _OPENMP + choke me +#endif +#include <omp.h> +int main () { return omp_get_num_threads (); } + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_prog_c_openmp=$ac_option +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + CFLAGS=$ac_save_CFLAGS + if test "$ac_cv_prog_c_openmp" != unsupported; then + break + fi + done +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_prog_c_openmp" >&5 +$as_echo "$ac_cv_prog_c_openmp" >&6; } + case $ac_cv_prog_c_openmp in #( + "none needed" | unsupported) + ;; #( + *) + OPENMP_CFLAGS=$ac_cv_prog_c_openmp ;; + esac + fi + + +if test "x$enable_openmp" = xno; then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + +#ifndef _OPENMP + choke me +#endif + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + as_fn_error $? "OpenMP support is disabled but the compiler enables it by default: change CFLAGS to disable it" "$LINENO" 5 +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +elif test "x$ac_cv_prog_c_openmp" = xunsupported; 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 link C OpenMP programs +See \`config.log' for more details" "$LINENO" 5; } +elif test -n "$OPENMP_CFLAGS"; then : + as_fn_append CFLAGS " $OPENMP_CFLAGS" +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: setting up libtool" >&5 +$as_echo "$as_me: setting up libtool" >&6;} +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.6' +macro_revision='2.4.6' + + + + + + + + + + + + + +ltmain=$ac_aux_dir/ltmain.sh + +# Backslashify metacharacters that are still active within +# double-quoted strings. +sed_quote_subst='s/\(["`$\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\(["`\\]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to delay expansion of an escaped single quote. +delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' + +ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 +$as_echo_n "checking how to print strings... " >&6; } +# Test print first, because it will be a builtin if present. +if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ + test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='print -r --' +elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='printf %s\n' +else + # Use this function as a fallback that always works. + func_fallback_echo () + { + eval 'cat <<_LTECHO_EOF +$1 +_LTECHO_EOF' + } + ECHO='func_fallback_echo' +fi + +# func_echo_all arg... +# Invoke $ECHO with all args, space-separated. +func_echo_all () +{ + $ECHO "" +} + +case $ECHO in + printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 +$as_echo "printf" >&6; } ;; + print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 +$as_echo "print -r" >&6; } ;; + *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 +$as_echo "cat" >&6; } ;; +esac + + + + + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 +$as_echo_n "checking for a sed that does not truncate output... " >&6; } +if ${ac_cv_path_SED+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ + for ac_i in 1 2 3 4 5 6 7; do + ac_script="$ac_script$as_nl$ac_script" + done + echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed + { ac_script=; unset ac_script;} + if test -z "$SED"; then + ac_path_SED_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_SED" || continue +# Check for GNU ac_path_SED and select it if it is found. + # Check for GNU $ac_path_SED +case `"$ac_path_SED" --version 2>&1` in +*GNU*) + ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo '' >> "conftest.nl" + "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_SED_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_SED="$ac_path_SED" + ac_path_SED_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_SED_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_SED"; then + as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 + fi +else + ac_cv_path_SED=$SED +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 +$as_echo "$ac_cv_path_SED" >&6; } + SED="$ac_cv_path_SED" + rm -f conftest.sed + +test -z "$SED" && SED=sed +Xsed="$SED -e 1s/^X//" + + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +$as_echo_n "checking for grep that handles long lines and -e... " >&6; } +if ${ac_cv_path_GREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$GREP"; then + ac_path_GREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_GREP" || continue +# Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_GREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_GREP"; then + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_GREP=$GREP +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +$as_echo "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +$as_echo_n "checking for egrep... " >&6; } +if ${ac_cv_path_EGREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + ac_path_EGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_EGREP" || continue +# Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_EGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP"; then + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_EGREP=$EGREP +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +$as_echo "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 +$as_echo_n "checking for fgrep... " >&6; } +if ${ac_cv_path_FGREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 + then ac_cv_path_FGREP="$GREP -F" + else + if test -z "$FGREP"; then + ac_path_FGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in fgrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_FGREP" || continue +# Check for GNU ac_path_FGREP and select it if it is found. + # Check for GNU $ac_path_FGREP +case `"$ac_path_FGREP" --version 2>&1` in +*GNU*) + ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'FGREP' >> "conftest.nl" + "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_FGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_FGREP="$ac_path_FGREP" + ac_path_FGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_FGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_FGREP"; then + as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_FGREP=$FGREP +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 +$as_echo "$ac_cv_path_FGREP" >&6; } + FGREP="$ac_cv_path_FGREP" + + +test -z "$GREP" && GREP=grep + + + + + + + + + + + + + + + + + + + +# Check whether --with-gnu-ld was given. +if test "${with_gnu_ld+set}" = set; then : + withval=$with_gnu_ld; test no = "$withval" || with_gnu_ld=yes +else + with_gnu_ld=no +fi + +ac_prog=ld +if test yes = "$GCC"; 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 yes = "$with_gnu_ld"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 +$as_echo_n "checking for GNU ld... " >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 +$as_echo_n "checking for non-GNU ld... " >&6; } +fi +if ${lt_cv_path_LD+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$LD"; then + lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS=$lt_save_ifs + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD=$ac_dir/$ac_prog + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in + *GNU* | *'with BFD'*) + test no != "$with_gnu_ld" && break + ;; + *) + test yes != "$with_gnu_ld" && break + ;; + esac + fi + done + IFS=$lt_save_ifs +else + lt_cv_path_LD=$LD # Let the user override the test with a path. +fi +fi + +LD=$lt_cv_path_LD +if test -n "$LD"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5 +$as_echo "$LD" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 +$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } +if ${lt_cv_prog_gnu_ld+:} false; then : + $as_echo_n "(cached) " >&6 +else + # I'd rather use --version here, but apparently some GNU lds only accept -v. +case `$LD -v 2>&1 </dev/null` in +*GNU* | *'with BFD'*) + lt_cv_prog_gnu_ld=yes + ;; +*) + lt_cv_prog_gnu_ld=no + ;; +esac +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_gnu_ld" >&5 +$as_echo "$lt_cv_prog_gnu_ld" >&6; } +with_gnu_ld=$lt_cv_prog_gnu_ld + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 +$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } +if ${lt_cv_path_NM+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM=$NM +else + lt_nm_to_check=${ac_tool_prefix}nm + if test -n "$ac_tool_prefix" && test "$build" = "$host"; then + lt_nm_to_check="$lt_nm_to_check nm" + fi + for lt_tmp_nm in $lt_nm_to_check; do + lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do + IFS=$lt_save_ifs + test -z "$ac_dir" && ac_dir=. + tmp_nm=$ac_dir/$lt_tmp_nm + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext"; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the 'sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty + case $build_os in + mingw*) lt_bad_file=conftest.nm/nofile ;; + *) lt_bad_file=/dev/null ;; + esac + case `"$tmp_nm" -B $lt_bad_file 2>&1 | sed '1q'` in + *$lt_bad_file* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break 2 + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break 2 + ;; + *) + 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 no != "$lt_cv_path_NM"; 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 -headers /dev/null 2>&1 | sed '1q'` in + *COFF*) + DUMPBIN="$DUMPBIN -symbols -headers" + ;; + *) + 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; + ;; + + bitrig* | darwin* | dragonfly* | freebsd* | netbsd* | openbsd*) + # 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" && \ + test undefined != "$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 17 != "$i" # 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"} + +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 yes != "$GCC"; then + reload_cmds=false + fi + ;; + darwin*) + if test yes = "$GCC"; 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 +# that 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. + if ( 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 + ;; + +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 | 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* | bitrig*) + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; 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 + ;; +os2*) + 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 one 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 0 -eq "$ac_status"; 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 0 -ne "$ac_status"; 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 no = "$lt_cv_ar_at_file"; 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 + bitrig* | 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 ia64 = "$host_cpu"; 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 + +if test "$lt_cv_nm_interface" = "MS dumpbin"; then + # Gets list of data symbols to import. + lt_cv_sys_global_symbol_to_import="sed -n -e 's/^I .* \(.*\)$/\1/p'" + # Adjust the below global symbol transforms to fixup imported variables. + lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'" + lt_c_name_hook=" -e 's/^I .* \(.*\)$/ {\"\1\", (void *) 0},/p'" + lt_c_name_lib_hook="\ + -e 's/^I .* \(lib.*\)$/ {\"\1\", (void *) 0},/p'\ + -e 's/^I .* \(.*\)$/ {\"lib\1\", (void *) 0},/p'" +else + # Disable hooks by default. + lt_cv_sys_global_symbol_to_import= + lt_cdecl_hook= + lt_c_name_hook= + lt_c_name_lib_hook= +fi + +# 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"\ +$lt_cdecl_hook\ +" -e 's/^T .* \(.*\)$/extern int \1();/p'"\ +" -e 's/^$symcode$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"\ +$lt_c_name_hook\ +" -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ +" -e 's/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/p'" + +# Transform an extracted symbol line into symbol name with lib prefix and +# symbol address. +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n"\ +$lt_c_name_lib_hook\ +" -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ +" -e 's/^$symcode$symcode* .* \(lib.*\)$/ {\"\1\", (void *) \&\1},/p'"\ +" -e 's/^$symcode$symcode* .* \(.*\)$/ {\"lib\1\", (void *) \&\1},/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, + # D for any global variable and I for any imported 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};"\ +" /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\ +" /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\ +" /^ *Type *: data/{print \"I\",si,substr(si,length(prfx))};"\ +" \$ 0!~/External *\|/{next};"\ +" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ +" {if(hide[section]) next};"\ +" {f=\"D\"}; \$ 0~/\(\).*\|/{f=\"T\"};"\ +" {split(\$ 0,a,/\||\r/); split(a[2],s)};"\ +" s[1]~/^[@?]/{print f,s[1],s[1]; next};"\ +" s[1]~prfx {split(s[1],t,\"@\"); print f,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 can'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* .* \(.*\)$/ {\"\1\", (void *) \&\1},/" < "$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 yes = "$pipe_works"; 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 yes = "$GCC"; 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; } + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a working dd" >&5 +$as_echo_n "checking for a working dd... " >&6; } +if ${ac_cv_path_lt_DD+:} false; then : + $as_echo_n "(cached) " >&6 +else + printf 0123456789abcdef0123456789abcdef >conftest.i +cat conftest.i conftest.i >conftest2.i +: ${lt_DD:=$DD} +if test -z "$lt_DD"; then + ac_path_lt_DD_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 dd; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_lt_DD="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_lt_DD" || continue +if "$ac_path_lt_DD" bs=32 count=1 <conftest2.i >conftest.out 2>/dev/null; then + cmp -s conftest.i conftest.out \ + && ac_cv_path_lt_DD="$ac_path_lt_DD" ac_path_lt_DD_found=: +fi + $ac_path_lt_DD_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_lt_DD"; then + : + fi +else + ac_cv_path_lt_DD=$lt_DD +fi + +rm -f conftest.i conftest2.i conftest.out +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_lt_DD" >&5 +$as_echo "$ac_cv_path_lt_DD" >&6; } + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to truncate binary pipes" >&5 +$as_echo_n "checking how to truncate binary pipes... " >&6; } +if ${lt_cv_truncate_bin+:} false; then : + $as_echo_n "(cached) " >&6 +else + printf 0123456789abcdef0123456789abcdef >conftest.i +cat conftest.i conftest.i >conftest2.i +lt_cv_truncate_bin= +if "$ac_cv_path_lt_DD" bs=32 count=1 <conftest2.i >conftest.out 2>/dev/null; then + cmp -s conftest.i conftest.out \ + && lt_cv_truncate_bin="$ac_cv_path_lt_DD bs=4096 count=1" +fi +rm -f conftest.i conftest2.i conftest.out +test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_truncate_bin" >&5 +$as_echo "$lt_cv_truncate_bin" >&6; } + + + + + + + +# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. +func_cc_basename () +{ + for cc_temp in $*""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac + done + func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` +} + +# Check whether --enable-libtool-lock was given. +if test "${enable_libtool_lock+set}" = set; then : + enableval=$enable_libtool_lock; +fi + +test no = "$enable_libtool_lock" || 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 what ABI is being produced by ac_compile, and set mode + # options accordingly. + 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 what ABI is being produced by ac_compile, and set linker + # options accordingly. + 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 yes = "$lt_cv_prog_gnu_ld"; 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* + ;; + +mips64*-*linux*) + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. + 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 + emul=elf + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + emul="${emul}32" + ;; + *64-bit*) + emul="${emul}64" + ;; + esac + case `/usr/bin/file conftest.$ac_objext` in + *MSB*) + emul="${emul}btsmip" + ;; + *LSB*) + emul="${emul}ltsmip" + ;; + esac + case `/usr/bin/file conftest.$ac_objext` in + *N32*) + emul="${emul}n32" + ;; + esac + LD="${LD-ld} -m $emul" + fi + rm -rf conftest* + ;; + +x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ +s390*-*linux*|s390*-*tpf*|sparc*-*linux*) + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. Note that the listed cases only cover the + # situations where additional linker options are needed (such as when + # doing 32-bit compilation for a host where ld defaults to 64-bit, or + # vice versa); the common cases where no linker options are needed do + # not appear in the list. + 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*) + case `/usr/bin/file conftest.o` in + *x86-64*) + LD="${LD-ld} -m elf32_x86_64" + ;; + *) + LD="${LD-ld} -m elf_i386" + ;; + esac + ;; + powerpc64le-*linux*) + LD="${LD-ld} -m elf32lppclinux" + ;; + 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" + ;; + powerpcle-*linux*) + LD="${LD-ld} -m elf64lppc" + ;; + 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 yes != "$lt_cv_cc_needs_belf"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS=$SAVE_CFLAGS + fi + ;; +*-*solaris*) + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. + 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*|x86_64-*-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 yes != "$lt_cv_path_mainfest_tool"; 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 0 = "$_lt_result"; 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 0 = "$_lt_result" && $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 yes = "$lt_cv_apple_cc_single_mod"; then + _lt_dar_single_mod='$single_module' + fi + if test yes = "$lt_cv_ld_exported_symbols_list"; 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 no = "$lt_cv_ld_force_load"; then + _lt_dsymutil='~$DSYMUTIL $lib || :' + else + _lt_dsymutil= + fi + ;; + esac + +# func_munge_path_list VARIABLE PATH +# ----------------------------------- +# VARIABLE is name of variable containing _space_ separated list of +# directories to be munged by the contents of PATH, which is string +# having a format: +# "DIR[:DIR]:" +# string "DIR[ DIR]" will be prepended to VARIABLE +# ":DIR[:DIR]" +# string "DIR[ DIR]" will be appended to VARIABLE +# "DIRP[:DIRP]::[DIRA:]DIRA" +# string "DIRP[ DIRP]" will be prepended to VARIABLE and string +# "DIRA[ DIRA]" will be appended to VARIABLE +# "DIR[:DIR]" +# VARIABLE will be replaced by "DIR[ DIR]" +func_munge_path_list () +{ + case x$2 in + x) + ;; + *:) + eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" + ;; + x:*) + eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" + ;; + *::*) + eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" + eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" + ;; + *) + eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" + ;; + 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 <limits.h> to <assert.h> if __STDC__ is defined, since + # <limits.h> exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <ac_nonexistent.h> +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +$as_echo "$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + # <limits.h> exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <ac_nonexistent.h> +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if ${ac_cv_header_stdc+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <stdlib.h> +#include <stdarg.h> +#include <string.h> +#include <float.h> + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_stdc=yes +else + ac_cv_header_stdc=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <string.h> + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <stdlib.h> + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then : + : +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <ctype.h> +#include <stdlib.h> +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + +else + ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +$as_echo "#define STDC_HEADERS 1" >>confdefs.h + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_header in dlfcn.h +do : + ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default +" +if test "x$ac_cv_header_dlfcn_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_DLFCN_H 1 +_ACEOF + +fi + +done + + + +func_stripname_cnf () +{ + case $2 in + .*) func_stripname_result=`$ECHO "$3" | $SED "s%^$1%%; s%\\\\$2\$%%"`;; + *) func_stripname_result=`$ECHO "$3" | $SED "s%^$1%%; s%$2\$%%"`;; + esac +} # func_stripname_cnf + + if test x"$enable_shared" != xno; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking any compiler has problems building shared objects" >&5 +$as_echo_n "checking any compiler has problems building shared objects... " >&6; } +if ${acx_cv_disable_shared+:} false; then : + $as_echo_n "(cached) " >&6 +else + acx_cv_disable_shared=no + 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 + + $as_echo "$as_me:${as_lineno-$LINENO}: testing if $FC cannot build working shared objects" >&5 + case $host in #( + *-ibm-aix*) : + if $FC -G -v 2>&1 | grep ' -binitfini:poe_remote_main ' >/dev/null; then : + acx_cv_disable_shared=yes +fi ;; #( + x86_64-*-linux-*|i*86-*-linux-*|*-apple-darwin*|ia64-*-linux-*|x86_64-*-freebsd*|i*86-*-freebsd*) : + if $FC -V 2>&1 | grep '^Intel(R).*Fortran.*Compiler.*Version 15.0.[123]' >/dev/null; then : + case " $FCFLAGS $LDFLAGS " in #( + *\ -Qlocation,ld,*\ *) : + acx_cv_disable_shared=yes ;; #( + *) : + FCFLAGS="$FCFLAGS -Qlocation,ld,$ac_abs_confdir/util/icomp15" ;; +esac +fi ;; #( + *) : + ;; +esac + $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_disable_shared" >&5 + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + ac_ext=f +ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' +ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_f77_compiler_gnu + + $as_echo "$as_me:${as_lineno-$LINENO}: testing if $F77 cannot build working shared objects" >&5 + case $host in #( + *-ibm-aix*) : + if $F77 -G -v 2>&1 | grep ' -binitfini:poe_remote_main ' >/dev/null; then : + acx_cv_disable_shared=yes +fi ;; #( + x86_64-*-linux-*|i*86-*-linux-*|*-apple-darwin*|ia64-*-linux-*|x86_64-*-freebsd*|i*86-*-freebsd*) : + if $F77 -V 2>&1 | grep '^Intel(R).*Fortran.*Compiler.*Version 15.0.[123]' >/dev/null; then : + case " $FFLAGS $LDFLAGS " in #( + *\ -Qlocation,ld,*\ *) : + acx_cv_disable_shared=yes ;; #( + *) : + FFLAGS="$FFLAGS -Qlocation,ld,$ac_abs_confdir/util/icomp15" ;; +esac +fi ;; #( + *) : + ;; +esac + $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_disable_shared" >&5 + 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=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}: testing if $CC cannot build working shared objects" >&5 + case $host in #( + *-ibm-aix*) : + if $CC -G -v 2>&1 | grep ' -binitfini:poe_remote_main ' >/dev/null; then : + acx_cv_disable_shared=yes +fi ;; #( + x86_64-*-linux-*|i*86-*-linux-*|*-apple-darwin*|ia64-*-linux-*|x86_64-*-freebsd*|i*86-*-freebsd*) : + if $CC -V 2>&1 | grep '^Intel(R).*Fortran.*Compiler.*Version 15.0.[123]' >/dev/null; then : + case " $CFLAGS $LDFLAGS " in #( + *\ -Qlocation,ld,*\ *) : + acx_cv_disable_shared=yes ;; #( + *) : + CFLAGS="$CFLAGS -Qlocation,ld,$ac_abs_confdir/util/icomp15" ;; +esac +fi ;; #( + *) : + ;; +esac + $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_disable_shared" >&5 + 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: $acx_cv_disable_shared" >&5 +$as_echo "$acx_cv_disable_shared" >&6; } + if test x"$acx_cv_disable_shared" = xyes; then : + enable_shared=no +fi +fi + + + + +# Set options + +# 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=yes +fi + + + + + + + + + + enable_dlopen=no + + + enable_win32_dll=no + + + # 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=yes +fi + + + + + + + + + + # 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 --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 + + + + + + + + + shared_archive_member_spec= +case $host,$enable_shared in +power*-*-aix[5-9]*,yes) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking which variant of shared library versioning to provide" >&5 +$as_echo_n "checking which variant of shared library versioning to provide... " >&6; } + +# Check whether --with-aix-soname was given. +if test "${with_aix_soname+set}" = set; then : + withval=$with_aix_soname; case $withval in + aix|svr4|both) + ;; + *) + as_fn_error $? "Unknown argument to --with-aix-soname" "$LINENO" 5 + ;; + esac + lt_cv_with_aix_soname=$with_aix_soname +else + if ${lt_cv_with_aix_soname+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_with_aix_soname=aix +fi + + with_aix_soname=$lt_cv_with_aix_soname +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_aix_soname" >&5 +$as_echo "$with_aix_soname" >&6; } + if test aix != "$with_aix_soname"; then + # For the AIX way of multilib, we name the shared archive member + # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o', + # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File. + # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag, + # the AIX toolchain works better with OBJECT_MODE set (default 32). + if test 64 = "${OBJECT_MODE-32}"; then + shared_archive_member_spec=shr_64 + else + shared_archive_member_spec=shr + fi + fi + ;; +*) + with_aix_soname=aix + ;; +esac + + + + + + + + + + +# 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 set != "${COLLECT_NAMES+set}"; 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 + +func_cc_basename $compiler +cc_basename=$func_cc_basename_result + + +# 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 yes = "$GCC"; 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" ## exclude from sc_useless_quotes_in_assignment + # 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 yes = "$lt_cv_prog_compiler_rtti_exceptions"; 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 yes = "$GCC"; then + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_static='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test ia64 = "$host_cpu"; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static='-Bstatic' + fi + lt_prog_compiler_pic='-fPIC' + ;; + + 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' + case $host_os in + os2*) + lt_prog_compiler_static='$wl-static' + ;; + esac + ;; + + 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 ia64 = "$host_cpu"; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static='-Bstatic' + else + lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic='-fno-common' + case $cc_basename in + nagfor*) + # NAG Fortran compiler + lt_prog_compiler_wl='-Wl,-Wl,,' + lt_prog_compiler_pic='-PIC' + lt_prog_compiler_static='-Bstatic' + ;; + esac + ;; + + 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' + case $host_os in + os2*) + lt_prog_compiler_static='$wl-static' + ;; + esac + ;; + + 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 | 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' + ;; + tcc*) + # Fabrice Bellard et al's Tiny C Compiler + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fPIC' + lt_prog_compiler_static='-static' + ;; + 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 -n 1,5p` 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' + ;; #( + *NAG\ Fortran\ Compiler*) + lt_prog_compiler_wl='-Wl,-Wl,,' + lt_prog_compiler_pic='-PIC' + lt_prog_compiler_static='-Bstatic' + ;; + *PGI\ Compilers\ and\ Tools*|*NVIDIA\ Compilers\ and\ Tools*|*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 that 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" ## exclude from sc_useless_quotes_in_assignment + # 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 yes = "$lt_cv_prog_compiler_pic_works"; 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 yes = "$lt_cv_prog_compiler_static_works"; 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 no = "$lt_cv_prog_compiler_c_o" && test no != "$need_locks"; 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 no = "$hard_links"; 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 yes != "$GCC"; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; + openbsd* | bitrig*) + 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 yes = "$with_gnu_ld"; 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 yes = "$lt_use_gnu_ld_interface"; 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 | $SED -e 's/(^)\+)\s\+//' 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 ia64 != "$host_cpu"; then + ld_shlibs=no + cat <<_LT_EOF 1>&2 + +*** Warning: the GNU linker, at least up to release 2.19, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to install binutils +*** 2.20 or above, or modify your PATH so that a non-GNU linker is found. +*** You will then need to restart the configuration process. + +_LT_EOF + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds='' + ;; + m68k) + archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + esac + ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag=unsupported + # Joseph Beckenbach <jrb3@best.com> says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + else + ld_shlibs=no + fi + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + export_dynamic_flag_spec='$wl--export-all-symbols' + allow_undefined_flag=unsupported + always_export_symbols=no + enable_shared_with_static_runtimes=yes + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' + exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file, use it as + # is; otherwise, prepend EXPORTS... + archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; 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 + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + shrext_cmds=.dll + archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + prefix_cmds="$SED"~ + if test EXPORTS = "`$SED 1q $export_symbols`"; then + prefix_cmds="$prefix_cmds -e 1d"; + fi~ + prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ + cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' + enable_shared_with_static_runtimes=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 linux-dietlibc = "$host_os"; 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 no = "$tmp_diet" + then + tmp_addflag=' $pic_flag' + tmp_sharedflag='-shared' + tmp_compiler_flags='$compiler_flags' + 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' ;; + nagfor*) # NAGFOR 5.3 + tmp_sharedflag='-Wl,-shared' + tmp_compiler_flags='`echo $compiler_flags | sed -e '"'"'s/ -W[cl],-no-pie\b//g'"'"'`' ;; + 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 -n 1,5p` 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' ;; + *NAG\ Fortran\ Compiler*) + tmp_sharedflag='-Wl,-shared' + tmp_compiler_flags='`echo $compiler_flags | sed -e '"'"'s/ -W[cl],-no-pie\b//g'"'"'`' ;; + esac + archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs '"$tmp_compiler_flags"' $wl-soname $wl$soname -o $lib' + + if test yes = "$supports_anon_versioning"; 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 '"$tmp_compiler_flags"' $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' + fi + + case $cc_basename in + tcc*) + export_dynamic_flag_spec='-rdynamic' + ;; + 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 yes = "$supports_anon_versioning"; 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 cannot +*** 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 no = "$ld_shlibs"; 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 yes = "$GCC" && 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 ia64 = "$host_cpu"; 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 GNU nm, but means don't demangle to AIX nm. + # Without the "-l" option, or with the "-B" option, AIX nm treats + # weak defined symbols like other global defined symbols, whereas + # GNU nm marks them as "W". + # While the 'weak' keyword is ignored in the Export File, we need + # it in the Import File for the 'aix-soname' feature, so we have + # to replace the "-B" option with "-P" for AIX nm. + 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) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | 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 + # have runtime linking enabled, and use it for executables. + # For shared libraries, we enable/disable runtime linking + # depending on the kind of the shared library created - + # when "with_aix_soname,aix_use_runtimelinking" is: + # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables + # "aix,yes" lib.so shared, rtl:yes, for executables + # lib.a static archive + # "both,no" lib.so.V(shr.o) shared, rtl:yes + # lib.a(lib.so.V) shared, rtl:no, for executables + # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables + # lib.a(lib.so.V) shared, rtl:no + # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables + # lib.a static archive + case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) + for ld_flag in $LDFLAGS; do + if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then + aix_use_runtimelinking=yes + break + fi + done + if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then + # With aix-soname=svr4, we create the lib.so.V shared archives only, + # so we don't have lib.a shared libs to link our executables. + # We have to force runtime linking in this case. + aix_use_runtimelinking=yes + LDFLAGS="$LDFLAGS -Wl,-brtl" + fi + ;; + 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,' + case $with_aix_soname,$aix_use_runtimelinking in + aix,*) ;; # traditional, no import file + svr4,* | *,yes) # use import file + # The Import File defines what to hardcode. + hardcode_direct=no + hardcode_direct_absolute=no + ;; + esac + + if test yes = "$GCC"; 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 yes = "$aix_use_runtimelinking"; then + shared_flag="$shared_flag "'$wl-G' + fi + # Need to ensure runtime linking is disabled for the traditional + # shared library, or the linker may eventually find shared libraries + # /with/ Import File - we do not want to mix them. + shared_flag_aix='-shared' + shared_flag_svr4='-shared $wl-G' + else + # not using gcc + if test ia64 = "$host_cpu"; 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 yes = "$aix_use_runtimelinking"; then + shared_flag='$wl-G' + else + shared_flag='$wl-bM:SRE' + fi + shared_flag_aix='$wl-bM:SRE' + shared_flag_svr4='$wl-G' + 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,yes = "$with_aix_soname,$aix_use_runtimelinking"; 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 set = "${lt_cv_aix_libpath+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 -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag + else + if test ia64 = "$host_cpu"; 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 set = "${lt_cv_aix_libpath+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 yes = "$with_gnu_ld"; 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 + archive_expsym_cmds='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' + # -brtl affects multiple linker settings, -berok does not and is overridden later + compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([, ]\\)%-berok\\1%g"`' + if test svr4 != "$with_aix_soname"; then + # This is similar to how AIX traditionally builds its shared libraries. + archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' + fi + if test aix != "$with_aix_soname"; then + archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' + else + # used by -dlpreopen to get the symbols + archive_expsym_cmds="$archive_expsym_cmds"'~$MV $output_objdir/$realname.d/$soname $output_objdir' + fi + archive_expsym_cmds="$archive_expsym_cmds"'~$RM -r $output_objdir/$realname.d' + 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,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' + archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then + cp "$export_symbols" "$output_objdir/$soname.def"; + echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; + else + $SED -e '\''s/^/-link -EXPORT:/'\'' < $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 yes = "$lt_cv_ld_force_load"; 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*|nagfor*) _lt_dar_can_shared=yes ;; + *) _lt_dar_can_shared=$GCC ;; + esac + if test yes = "$_lt_dar_can_shared"; 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 yes = "$GCC"; 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 "x$output_objdir/$soname" = "x$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 "x$output_objdir/$soname" = "x$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 yes,no = "$GCC,$with_gnu_ld"; 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 no = "$with_gnu_ld"; 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 yes,no = "$GCC,$with_gnu_ld"; 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 yes = "$lt_cv_prog_compiler__b"; 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 no = "$with_gnu_ld"; 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 yes = "$GCC"; 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 yes = "$lt_cv_irix_exported_symbol"; 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 + ;; + + linux*) + case $cc_basename in + tcc*) + # Fabrice Bellard et al's Tiny C Compiler + ld_shlibs=yes + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + + 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* | bitrig*) + 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__`"; 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 + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='$wl-rpath,$libdir' + fi + else + ld_shlibs=no + fi + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + shrext_cmds=.dll + archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + prefix_cmds="$SED"~ + if test EXPORTS = "`$SED 1q $export_symbols`"; then + prefix_cmds="$prefix_cmds -e 1d"; + fi~ + prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ + cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' + enable_shared_with_static_runtimes=yes + ;; + + osf3*) + if test yes = "$GCC"; 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 yes = "$GCC"; 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 yes = "$GCC"; 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 yes = "$GCC"; 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 sequent = "$host_vendor"; 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 yes = "$GCC"; 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 CANNOT 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 yes = "$GCC"; 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 sni = "$host_vendor"; 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 no = "$ld_shlibs" && 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 yes,yes = "$GCC,$enable_shared"; 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 yes = "$GCC"; 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` + # ...but if some path component already ends with the multilib dir we assume + # that all is fine and trust -print-search-dirs as is (GCC 4.2? or newer). + case "$lt_multi_os_dir; $lt_search_path_spec " in + "/; "* | "/.; "* | "/./; "* | *"$lt_multi_os_dir "* | *"$lt_multi_os_dir/ "*) + lt_multi_os_dir= + ;; + esac + 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" + elif test -n "$lt_multi_os_dir"; then + 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 ia64 = "$host_cpu"; 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 + # Using Import Files as archive members, it is possible to support + # filename-based versioning of shared library archives on AIX. While + # this would work for both with and without runtime linking, it will + # prevent static linking of such archives. So we do filename-based + # shared library versioning with .so extension only, which is used + # when both runtime linking and shared linking is enabled. + # Unfortunately, runtime linking may impact performance, so we do + # not want this to be the default eventually. Also, we use the + # versioned .so libs for executables only if there is the -brtl + # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. + # To allow for filename-based versioning support, we need to create + # libNAME.so.V as an archive file, containing: + # *) an Import File, referring to the versioned filename of the + # archive as well as the shared archive member, telling the + # bitwidth (32 or 64) of that shared object, and providing the + # list of exported symbols of that shared object, eventually + # decorated with the 'weak' keyword + # *) the shared object with the F_LOADONLY flag set, to really avoid + # it being seen by the linker. + # At run time we better use the real file rather than another symlink, + # but for link time we create the symlink libNAME.so -> libNAME.so.V + + case $with_aix_soname,$aix_use_runtimelinking in + # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + aix,yes) # traditional libtool + dynamic_linker='AIX unversionable lib.so' + # If using run time linking (on AIX 4.2 or later) use lib<name>.so + # instead of lib<name>.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + ;; + aix,no) # traditional AIX only + dynamic_linker='AIX lib.a(lib.so.V)' + # 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' + ;; + svr4,*) # full svr4 only + dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o)" + library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' + # We do not specify a path in Import Files, so LIBPATH fires. + shlibpath_overrides_runpath=yes + ;; + *,yes) # both, prefer svr4 + dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o), lib.a(lib.so.V)" + library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' + # unpreferred sharedlib libNAME.a needs extra handling + postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' + postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' + # We do not specify a path in Import Files, so LIBPATH fires. + shlibpath_overrides_runpath=yes + ;; + *,no) # both, prefer aix + dynamic_linker="AIX lib.a(lib.so.V), lib.so.V($shared_archive_member_spec.o)" + library_names_spec='$libname$release.a $libname.a' + soname_spec='$libname$release$shared_ext$major' + # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling + postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' + postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' + ;; + esac + 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%'\''`; $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$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + 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 + ;; + +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=no + 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 32 = "$HPUX_IA64_MODE"; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + sys_lib_dlsearch_path_spec=/usr/lib/hpux32 + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + sys_lib_dlsearch_path_spec=/usr/lib/hpux64 + fi + ;; + 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 yes = "$lt_cv_prog_gnu_ld"; 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 + ;; + +linux*android*) + version_type=none # Android doesn't support versioned libraries. + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext' + soname_spec='$libname$release$shared_ext' + finish_cmds= + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + + # 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 + + dynamic_linker='Android linker' + # Don't embed -rpath directories since the linker doesn't support them. + hardcode_libdir_flag_spec='-L$libdir' + ;; + +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu | 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 + + # Ideally, we could use ldconfig to report *all* directores which are + # searched for libraries, however this is still not possible. Aside from not + # being certain /sbin/ldconfig is available, command + # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, + # even though it is searched at run-time. Try to do the best guess by + # appending ld.so.conf contents (and includes) to the search path. + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +*nto* | *qnx*) + version_type=qnx + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='ldqnx.so' + ;; + +openbsd* | bitrig*) + version_type=sunos + sys_lib_dlsearch_path_spec=/usr/lib + need_lib_prefix=no + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then + need_version=no + else + need_version=yes + fi + 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 + shlibpath_overrides_runpath=yes + ;; + +os2*) + libname_spec='$name' + version_type=windows + shrext_cmds=.dll + need_version=no + need_lib_prefix=no + # OS/2 can only load a DLL with a base name of 8 characters or less. + soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; + v=$($ECHO $release$versuffix | tr -d .-); + n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); + $ECHO $n$v`$shared_ext' + library_names_spec='${libname}_dll.$libext' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=BEGINLIBPATH + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + 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' + ;; + +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 yes = "$with_gnu_ld"; 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=sco + 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 yes = "$with_gnu_ld"; 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 no = "$dynamic_linker" && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test yes = "$GCC"; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then + sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec +fi + +if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then + sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec +fi + +# remember unaugmented sys_lib_dlsearch_path content for libtool script decls... +configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec + +# ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code +func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" + +# to be used as default LT_SYS_LIBRARY_PATH value in generated libtool +configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $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 yes = "$hardcode_automatic"; then + + # We can hardcode non-existent directories. + if test no != "$hardcode_direct" && + # 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 no != "$_LT_TAGVAR(hardcode_shlibpath_var, )" && + test no != "$hardcode_minus_L"; 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 relink = "$hardcode_action" || + test yes = "$inherit_rpath"; then + # Fast installation is not supported + enable_fast_install=no +elif test yes = "$shlibpath_overrides_runpath" || + test no = "$enable_shared"; then + # Fast installation is not necessary + enable_fast_install=needless +fi + + + + + + + if test yes != "$enable_dlopen"; 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 + + ;; + + tpf*) + # Don't try to run any link tests for TPF. We know it's impossible + # because TPF is a cross-compiler, and we know how we open DSOs. + lt_cv_dlopen=dlopen + lt_cv_dlopen_libs= + lt_cv_dlopen_self=no + ;; + + *) + 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 no = "$lt_cv_dlopen"; then + enable_dlopen=no + else + enable_dlopen=yes + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS=$CPPFLAGS + test yes = "$ac_cv_header_dlfcn_h" && 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 yes = "$cross_compiling"; then : + lt_cv_dlopen_self=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +#line $LINENO "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include <dlfcn.h> +#endif + +#include <stdio.h> + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +/* When -fvisibility=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 yes = "$lt_cv_dlopen_self"; 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 yes = "$cross_compiling"; then : + lt_cv_dlopen_self_static=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +#line $LINENO "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include <dlfcn.h> +#endif + +#include <stdio.h> + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +/* When -fvisibility=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 what 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 no = "$can_build_shared" && 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 yes = "$enable_shared" && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + + aix[4-9]*) + if test ia64 != "$host_cpu"; then + case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in + yes,aix,yes) ;; # shared object as lib.so file only + yes,svr4,*) ;; # shared object as lib.so archive member only + yes,*) enable_static=no ;; # shared object in lib.a archive as well + esac + 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 yes = "$enable_shared" || enable_static=yes + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 +$as_echo "$enable_static" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether this is the NAG Fortran compiler" >&5 +$as_echo_n "checking whether this is the NAG Fortran compiler... " >&6; } + $CC -V 2>&1 | grep '^NAG Fortran Compiler Release' >/dev/null 2>&1 + _lt_result=$? + if test $_lt_result -eq 0; then : + _lt_result=yes +else + _lt_result=no +fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_lt_result" >&5 +$as_echo "$_lt_result" >&6; } + acx_is_nagfor=$_lt_result + + + +fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +CC=$lt_save_CC + + if test -n "$CXX" && ( test no != "$CXX" && + ( (test g++ = "$CXX" && `g++ -v >/dev/null 2>&1` ) || + (test g++ != "$CXX"))); then + ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5 +$as_echo_n "checking how to run the C++ preprocessor... " >&6; } +if test -z "$CXXCPP"; then + if ${ac_cv_prog_CXXCPP+:} false; then : + $as_echo_n "(cached) " >&6 +else + # Double quotes because CXXCPP needs to be expanded + for CXXCPP in "$CXX -E" "/lib/cpp" + do + ac_preproc_ok=false +for ac_cxx_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + # <limits.h> exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + Syntax error +_ACEOF +if ac_fn_cxx_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <ac_nonexistent.h> +_ACEOF +if ac_fn_cxx_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + break +fi + + done + ac_cv_prog_CXXCPP=$CXXCPP + +fi + CXXCPP=$ac_cv_prog_CXXCPP +else + ac_cv_prog_CXXCPP=$CXXCPP +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXXCPP" >&5 +$as_echo "$CXXCPP" >&6; } +ac_preproc_ok=false +for ac_cxx_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + # <limits.h> exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + Syntax error +_ACEOF +if ac_fn_cxx_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <ac_nonexistent.h> +_ACEOF +if ac_fn_cxx_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C++ preprocessor \"$CXXCPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +else + _lt_caught_CXX_error=yes +fi + +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + +archive_cmds_need_lc_CXX=no +allow_undefined_flag_CXX= +always_export_symbols_CXX=no +archive_expsym_cmds_CXX= +compiler_needs_object_CXX=no +export_dynamic_flag_spec_CXX= +hardcode_direct_CXX=no +hardcode_direct_absolute_CXX=no +hardcode_libdir_flag_spec_CXX= +hardcode_libdir_separator_CXX= +hardcode_minus_L_CXX=no +hardcode_shlibpath_var_CXX=unsupported +hardcode_automatic_CXX=no +inherit_rpath_CXX=no +module_cmds_CXX= +module_expsym_cmds_CXX= +link_all_deplibs_CXX=unknown +old_archive_cmds_CXX=$old_archive_cmds +reload_flag_CXX=$reload_flag +reload_cmds_CXX=$reload_cmds +no_undefined_flag_CXX= +whole_archive_flag_spec_CXX= +enable_shared_with_static_runtimes_CXX=no + +# Source file extension for C++ test sources. +ac_ext=cpp + +# Object file extension for compiled C++ test sources. +objext=o +objext_CXX=$objext + +# No sense in running all these tests if we already determined that +# the CXX compiler isn't working. Some variables (like enable_shared) +# are currently assumed to apply to all compilers on this platform, +# and will be corrupted by setting them based on a non-working compiler. +if test yes != "$_lt_caught_CXX_error"; then + # Code to be used in simple compile tests + lt_simple_compile_test_code="int some_variable = 0;" + + # Code to be used in simple link tests + lt_simple_link_test_code='int main(int, char *[]) { return(0); }' + + # ltmain only uses $CC for tagged configurations so make sure $CC is set. + + + + + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + + # save warnings/boilerplate of simple test code + ac_outfile=conftest.$ac_objext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$RM conftest* + + ac_outfile=conftest.$ac_objext +echo "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$RM -r conftest* + + + # Allow CC to be a program name with arguments. + lt_save_CC=$CC + lt_save_CFLAGS=$CFLAGS + lt_save_LD=$LD + lt_save_GCC=$GCC + GCC=$GXX + lt_save_with_gnu_ld=$with_gnu_ld + lt_save_path_LD=$lt_cv_path_LD + if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then + lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx + else + $as_unset lt_cv_prog_gnu_ld + fi + if test -n "${lt_cv_path_LDCXX+set}"; then + lt_cv_path_LD=$lt_cv_path_LDCXX + else + $as_unset lt_cv_path_LD + fi + test -z "${LDCXX+set}" || LD=$LDCXX + CC=${CXX-"c++"} + CFLAGS=$CXXFLAGS + compiler=$CC + compiler_CXX=$CC + func_cc_basename $compiler +cc_basename=$func_cc_basename_result + + + if test -n "$compiler"; then + # We don't want -fno-exception when compiling C++ code, so set the + # no_builtin_flag separately + if test yes = "$GXX"; then + lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin' + else + lt_prog_compiler_no_builtin_flag_CXX= + fi + + if test yes = "$GXX"; then + # Set up default GNU C++ configuration + + + +# Check whether --with-gnu-ld was given. +if test "${with_gnu_ld+set}" = set; then : + withval=$with_gnu_ld; test no = "$withval" || with_gnu_ld=yes +else + with_gnu_ld=no +fi + +ac_prog=ld +if test yes = "$GCC"; 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 yes = "$with_gnu_ld"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 +$as_echo_n "checking for GNU ld... " >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 +$as_echo_n "checking for non-GNU ld... " >&6; } +fi +if ${lt_cv_path_LD+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$LD"; then + lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS=$lt_save_ifs + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD=$ac_dir/$ac_prog + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in + *GNU* | *'with BFD'*) + test no != "$with_gnu_ld" && break + ;; + *) + test yes != "$with_gnu_ld" && break + ;; + esac + fi + done + IFS=$lt_save_ifs +else + lt_cv_path_LD=$LD # Let the user override the test with a path. +fi +fi + +LD=$lt_cv_path_LD +if test -n "$LD"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5 +$as_echo "$LD" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 +$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } +if ${lt_cv_prog_gnu_ld+:} false; then : + $as_echo_n "(cached) " >&6 +else + # I'd rather use --version here, but apparently some GNU lds only accept -v. +case `$LD -v 2>&1 </dev/null` in +*GNU* | *'with BFD'*) + lt_cv_prog_gnu_ld=yes + ;; +*) + lt_cv_prog_gnu_ld=no + ;; +esac +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_gnu_ld" >&5 +$as_echo "$lt_cv_prog_gnu_ld" >&6; } +with_gnu_ld=$lt_cv_prog_gnu_ld + + + + + + + + # Check if GNU C++ uses GNU ld as the underlying linker, since the + # archiving commands below assume that GNU ld is being used. + if test yes = "$with_gnu_ld"; then + archive_cmds_CXX='$CC $pic_flag -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC $pic_flag -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + + hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' + export_dynamic_flag_spec_CXX='$wl--export-dynamic' + + # If archive_cmds runs LD, not CC, wlarc should be empty + # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to + # investigate it a little bit more. (MM) + wlarc='$wl' + + # ancient GNU ld didn't support --whole-archive et. al. + if eval "`$CC -print-prog-name=ld` --help 2>&1" | + $GREP 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec_CXX=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' + else + whole_archive_flag_spec_CXX= + fi + else + with_gnu_ld=no + wlarc= + + # A generic and very simple default shared library creation + # command for GNU C++ for the case where it uses the native + # linker, instead of GNU ld. If possible, this setting should + # overridden to take advantage of the native linker features on + # the platform it is being used on. + archive_cmds_CXX='$CC -shared $libobjs $deplibs $compiler_flags -o $lib' + fi + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + + else + GXX=no + with_gnu_ld=no + wlarc= + fi + + # PORTME: fill in a description of your system's C++ link characteristics + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } + ld_shlibs_CXX=yes + case $host_os in + aix3*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + aix[4-9]*) + if test ia64 = "$host_cpu"; 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 + # have runtime linking enabled, and use it for executables. + # For shared libraries, we enable/disable runtime linking + # depending on the kind of the shared library created - + # when "with_aix_soname,aix_use_runtimelinking" is: + # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables + # "aix,yes" lib.so shared, rtl:yes, for executables + # lib.a static archive + # "both,no" lib.so.V(shr.o) shared, rtl:yes + # lib.a(lib.so.V) shared, rtl:no, for executables + # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables + # lib.a(lib.so.V) shared, rtl:no + # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables + # lib.a static archive + 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 + if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then + # With aix-soname=svr4, we create the lib.so.V shared archives only, + # so we don't have lib.a shared libs to link our executables. + # We have to force runtime linking in this case. + aix_use_runtimelinking=yes + LDFLAGS="$LDFLAGS -Wl,-brtl" + fi + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds_CXX='' + hardcode_direct_CXX=yes + hardcode_direct_absolute_CXX=yes + hardcode_libdir_separator_CXX=':' + link_all_deplibs_CXX=yes + file_list_spec_CXX='$wl-f,' + case $with_aix_soname,$aix_use_runtimelinking in + aix,*) ;; # no import file + svr4,* | *,yes) # use import file + # The Import File defines what to hardcode. + hardcode_direct_CXX=no + hardcode_direct_absolute_CXX=no + ;; + esac + + if test yes = "$GXX"; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`$CC -print-prog-name=collect2` + if test -f "$collect2name" && + strings "$collect2name" | $GREP resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + hardcode_direct_CXX=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L_CXX=yes + hardcode_libdir_flag_spec_CXX='-L$libdir' + hardcode_libdir_separator_CXX= + fi + esac + shared_flag='-shared' + if test yes = "$aix_use_runtimelinking"; then + shared_flag=$shared_flag' $wl-G' + fi + # Need to ensure runtime linking is disabled for the traditional + # shared library, or the linker may eventually find shared libraries + # /with/ Import File - we do not want to mix them. + shared_flag_aix='-shared' + shared_flag_svr4='-shared $wl-G' + else + # not using gcc + if test ia64 = "$host_cpu"; 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 yes = "$aix_use_runtimelinking"; then + shared_flag='$wl-G' + else + shared_flag='$wl-bM:SRE' + fi + shared_flag_aix='$wl-bM:SRE' + shared_flag_svr4='$wl-G' + fi + fi + + export_dynamic_flag_spec_CXX='$wl-bexpall' + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to + # export. + always_export_symbols_CXX=yes + if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + # The "-G" linker flag allows undefined symbols. + no_undefined_flag_CXX='-bernotok' + # Determine the default libpath from the value encoded in an empty + # executable. + if test set = "${lt_cv_aix_libpath+set}"; then + aix_libpath=$lt_cv_aix_libpath +else + if ${lt_cv_aix_libpath__CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + + lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }' + lt_cv_aix_libpath__CXX=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$lt_cv_aix_libpath__CXX"; then + lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test -z "$lt_cv_aix_libpath__CXX"; then + lt_cv_aix_libpath__CXX=/usr/lib:/lib + fi + +fi + + aix_libpath=$lt_cv_aix_libpath__CXX +fi + + hardcode_libdir_flag_spec_CXX='$wl-blibpath:$libdir:'"$aix_libpath" + + archive_expsym_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag + else + if test ia64 = "$host_cpu"; then + hardcode_libdir_flag_spec_CXX='$wl-R $libdir:/usr/lib:/lib' + allow_undefined_flag_CXX="-z nodefs" + archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an + # empty executable. + if test set = "${lt_cv_aix_libpath+set}"; then + aix_libpath=$lt_cv_aix_libpath +else + if ${lt_cv_aix_libpath__CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + + lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }' + lt_cv_aix_libpath__CXX=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$lt_cv_aix_libpath__CXX"; then + lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test -z "$lt_cv_aix_libpath__CXX"; then + lt_cv_aix_libpath__CXX=/usr/lib:/lib + fi + +fi + + aix_libpath=$lt_cv_aix_libpath__CXX +fi + + hardcode_libdir_flag_spec_CXX='$wl-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag_CXX=' $wl-bernotok' + allow_undefined_flag_CXX=' $wl-berok' + if test yes = "$with_gnu_ld"; then + # We only use this code for GNU lds that support --whole-archive. + whole_archive_flag_spec_CXX='$wl--whole-archive$convenience $wl--no-whole-archive' + else + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec_CXX='$convenience' + fi + archive_cmds_need_lc_CXX=yes + archive_expsym_cmds_CXX='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' + # -brtl affects multiple linker settings, -berok does not and is overridden later + compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([, ]\\)%-berok\\1%g"`' + if test svr4 != "$with_aix_soname"; then + # This is similar to how AIX traditionally builds its shared + # libraries. Need -bnortl late, we may have -brtl in LDFLAGS. + archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' + fi + if test aix != "$with_aix_soname"; then + archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' + else + # used by -dlpreopen to get the symbols + archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$MV $output_objdir/$realname.d/$soname $output_objdir' + fi + archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$RM -r $output_objdir/$realname.d' + fi + fi + ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag_CXX=unsupported + # Joseph Beckenbach <jrb3@best.com> says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + else + ld_shlibs_CXX=no + fi + ;; + + chorus*) + case $cc_basename in + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + + cygwin* | mingw* | pw32* | cegcc*) + case $GXX,$cc_basename in + ,cl* | no,cl*) + # Native MSVC + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec_CXX=' ' + allow_undefined_flag_CXX=unsupported + always_export_symbols_CXX=yes + file_list_spec_CXX='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=.dll + # FIXME: Setting linknames here is a bad hack. + archive_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' + archive_expsym_cmds_CXX='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then + cp "$export_symbols" "$output_objdir/$soname.def"; + echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; + else + $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, CXX)='true' + enable_shared_with_static_runtimes_CXX=yes + # Don't use ranlib + old_postinstall_cmds_CXX='chmod 644 $oldlib' + postlink_cmds_CXX='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile=$lt_outputfile.exe + lt_tool_outputfile=$lt_tool_outputfile.exe + ;; + esac~ + func_to_tool_file "$lt_outputfile"~ + if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # g++ + # _LT_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec_CXX='-L$libdir' + export_dynamic_flag_spec_CXX='$wl--export-all-symbols' + allow_undefined_flag_CXX=unsupported + always_export_symbols_CXX=no + enable_shared_with_static_runtimes_CXX=yes + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + archive_cmds_CXX='$CC -shared $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, use it as + # is; otherwise, prepend EXPORTS... + archive_expsym_cmds_CXX='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + ld_shlibs_CXX=no + fi + ;; + esac + ;; + darwin* | rhapsody*) + + + archive_cmds_need_lc_CXX=no + hardcode_direct_CXX=no + hardcode_automatic_CXX=yes + hardcode_shlibpath_var_CXX=unsupported + if test yes = "$lt_cv_ld_force_load"; then + whole_archive_flag_spec_CXX='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' + + else + whole_archive_flag_spec_CXX='' + fi + link_all_deplibs_CXX=yes + allow_undefined_flag_CXX=$_lt_dar_allow_undefined + case $cc_basename in + ifort*|nagfor*) _lt_dar_can_shared=yes ;; + *) _lt_dar_can_shared=$GCC ;; + esac + if test yes = "$_lt_dar_can_shared"; then + output_verbose_link_cmd=func_echo_all + archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" + module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" + archive_expsym_cmds_CXX="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" + module_expsym_cmds_CXX="sed -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" + if test yes != "$lt_cv_apple_cc_single_mod"; then + archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dsymutil" + archive_expsym_cmds_CXX="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dar_export_syms$_lt_dsymutil" + fi + + else + ld_shlibs_CXX=no + fi + + ;; + + os2*) + hardcode_libdir_flag_spec_CXX='-L$libdir' + hardcode_minus_L_CXX=yes + allow_undefined_flag_CXX=unsupported + shrext_cmds=.dll + archive_cmds_CXX='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + archive_expsym_cmds_CXX='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + prefix_cmds="$SED"~ + if test EXPORTS = "`$SED 1q $export_symbols`"; then + prefix_cmds="$prefix_cmds -e 1d"; + fi~ + prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ + cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + old_archive_From_new_cmds_CXX='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' + enable_shared_with_static_runtimes_CXX=yes + ;; + + dgux*) + case $cc_basename in + ec++*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + ghcx*) + # Green Hills C++ Compiler + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + + freebsd2.*) + # C++ shared libraries reported to be fairly broken before + # switch to ELF + ld_shlibs_CXX=no + ;; + + freebsd-elf*) + archive_cmds_need_lc_CXX=no + ;; + + freebsd* | dragonfly*) + # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF + # conventions + ld_shlibs_CXX=yes + ;; + + haiku*) + archive_cmds_CXX='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + link_all_deplibs_CXX=yes + ;; + + hpux9*) + hardcode_libdir_flag_spec_CXX='$wl+b $wl$libdir' + hardcode_libdir_separator_CXX=: + export_dynamic_flag_spec_CXX='$wl-E' + hardcode_direct_CXX=yes + hardcode_minus_L_CXX=yes # Not in the search PATH, + # but as the default + # location of the library. + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + aCC*) + archive_cmds_CXX='$RM $output_objdir/$soname~$CC -b $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$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 yes = "$GXX"; then + archive_cmds_CXX='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + + hpux10*|hpux11*) + if test no = "$with_gnu_ld"; then + hardcode_libdir_flag_spec_CXX='$wl+b $wl$libdir' + hardcode_libdir_separator_CXX=: + + case $host_cpu in + hppa*64*|ia64*) + ;; + *) + export_dynamic_flag_spec_CXX='$wl-E' + ;; + esac + fi + case $host_cpu in + hppa*64*|ia64*) + hardcode_direct_CXX=no + hardcode_shlibpath_var_CXX=no + ;; + *) + hardcode_direct_CXX=yes + hardcode_direct_absolute_CXX=yes + hardcode_minus_L_CXX=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + esac + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + aCC*) + case $host_cpu in + hppa*64*) + archive_cmds_CXX='$CC -b $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + archive_cmds_CXX='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + archive_cmds_CXX='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + ;; + *) + if test yes = "$GXX"; then + if test no = "$with_gnu_ld"; then + case $host_cpu in + hppa*64*) + archive_cmds_CXX='$CC -shared -nostdlib -fPIC $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + archive_cmds_CXX='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + archive_cmds_CXX='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + fi + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + + interix[3-9]*) + hardcode_direct_CXX=no + hardcode_shlibpath_var_CXX=no + hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' + export_dynamic_flag_spec_CXX='$wl-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + archive_cmds_CXX='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + archive_expsym_cmds_CXX='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + irix5* | irix6*) + case $cc_basename in + CC*) + # SGI C++ + archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + + # Archives containing C++ object files must be created using + # "CC -ar", where "CC" is the IRIX C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs' + ;; + *) + if test yes = "$GXX"; then + if test no = "$with_gnu_ld"; then + archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + else + archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` -o $lib' + fi + fi + link_all_deplibs_CXX=yes + ;; + esac + hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' + hardcode_libdir_separator_CXX=: + inherit_rpath_CXX=yes + ;; + + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib $wl-retain-symbols-file,$export_symbols; mv \$templib $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + + hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' + export_dynamic_flag_spec_CXX='$wl--export-dynamic' + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' + ;; + icpc* | ecpc* ) + # Intel C++ + with_gnu_ld=yes + # version 8.0 and above of icpc choke on multiply defined symbols + # if we add $predep_objects and $postdep_objects, however 7.1 and + # earlier do not add the objects themselves. + case `$CC -V 2>&1` in + *"Version 7."*) + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + ;; + *) # Version 8.0 or newer + tmp_idyn= + case $host_cpu in + ia64*) tmp_idyn=' -i_dynamic';; + esac + archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + ;; + esac + archive_cmds_need_lc_CXX=no + hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' + export_dynamic_flag_spec_CXX='$wl--export-dynamic' + whole_archive_flag_spec_CXX='$wl--whole-archive$convenience $wl--no-whole-archive' + ;; + pgCC* | pgcpp* | pgc++* ) + # Portland Group C++ compiler + case `$CC -V` in + *pgCC\ [1-5].* | *pgcpp\ [1-5].*) + prelink_cmds_CXX='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ + compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' + old_archive_cmds_CXX='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ + $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ + $RANLIB $oldlib' + archive_cmds_CXX='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ + $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ + $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + ;; + *) # Version 6 and above use weak symbols + archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + ;; + esac + + hardcode_libdir_flag_spec_CXX='$wl--rpath $wl$libdir' + export_dynamic_flag_spec_CXX='$wl--export-dynamic' + whole_archive_flag_spec_CXX='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + ;; + cxx*) + # Compaq C++ + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib $wl-retain-symbols-file $wl$export_symbols' + + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec_CXX='-rpath $libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' + ;; + xl* | mpixl* | bgxl*) + # IBM XL 8.0 on PPC, with GNU ld + hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' + export_dynamic_flag_spec_CXX='$wl--export-dynamic' + archive_cmds_CXX='$CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + if test yes = "$supports_anon_versioning"; then + archive_expsym_cmds_CXX='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' + fi + ;; + *) + case `$CC -V 2>&1 | sed -n 1,5p` in + *Sun\ C*) + # Sun C++ 5.9 + no_undefined_flag_CXX=' -zdefs' + archive_cmds_CXX='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + archive_expsym_cmds_CXX='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file $wl$export_symbols' + hardcode_libdir_flag_spec_CXX='-R$libdir' + whole_archive_flag_spec_CXX='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + compiler_needs_object_CXX=yes + + # Not sure whether something based on + # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 + # would be better. + output_verbose_link_cmd='func_echo_all' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' + ;; + esac + ;; + esac + ;; + + lynxos*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + + m88k*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + + mvs*) + case $cc_basename in + cxx*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + archive_cmds_CXX='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' + wlarc= + hardcode_libdir_flag_spec_CXX='-R$libdir' + hardcode_direct_CXX=yes + hardcode_shlibpath_var_CXX=no + fi + # Workaround some broken pre-1.5 toolchains + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' + ;; + + *nto* | *qnx*) + ld_shlibs_CXX=yes + ;; + + openbsd* | bitrig*) + if test -f /usr/libexec/ld.so; then + hardcode_direct_CXX=yes + hardcode_shlibpath_var_CXX=no + hardcode_direct_absolute_CXX=yes + archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`"; then + archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file,$export_symbols -o $lib' + export_dynamic_flag_spec_CXX='$wl-E' + whole_archive_flag_spec_CXX=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' + fi + output_verbose_link_cmd=func_echo_all + else + ld_shlibs_CXX=no + fi + ;; + + osf3* | osf4* | osf5*) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' + hardcode_libdir_separator_CXX=: + + # Archives containing C++ object files must be created using + # the KAI C++ compiler. + case $host in + osf3*) old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; + *) old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' ;; + esac + ;; + RCC*) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + cxx*) + case $host in + osf3*) + allow_undefined_flag_CXX=' $wl-expect_unresolved $wl\*' + archive_cmds_CXX='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $soname `test -n "$verstring" && func_echo_all "$wl-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' + ;; + *) + allow_undefined_flag_CXX=' -expect_unresolved \*' + archive_cmds_CXX='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ + echo "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname $wl-input $wl$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~ + $RM $lib.exp' + hardcode_libdir_flag_spec_CXX='-rpath $libdir' + ;; + esac + + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + ;; + *) + if test yes,no = "$GXX,$with_gnu_ld"; then + allow_undefined_flag_CXX=' $wl-expect_unresolved $wl\*' + case $host in + osf3*) + archive_cmds_CXX='$CC -shared -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + ;; + *) + archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + ;; + esac + + hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + + psos*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + lcc*) + # Lucid + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + + solaris*) + case $cc_basename in + CC* | sunCC*) + # Sun C++ 4.2, 5.x and Centerline C++ + archive_cmds_need_lc_CXX=yes + no_undefined_flag_CXX=' -zdefs' + archive_cmds_CXX='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G$allow_undefined_flag $wl-M $wl$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + hardcode_libdir_flag_spec_CXX='-R$libdir' + hardcode_shlibpath_var_CXX=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands '-z linker_flag'. + # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec_CXX='-z allextract$convenience -z defaultextract' + ;; + esac + link_all_deplibs_CXX=yes + + output_verbose_link_cmd='func_echo_all' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' + ;; + gcx*) + # Green Hills C++ Compiler + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' + + # The C++ compiler must be used to create the archive. + old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs' + ;; + *) + # GNU C++ compiler with Solaris linker + if test yes,no = "$GXX,$with_gnu_ld"; then + no_undefined_flag_CXX=' $wl-z ${wl}defs' + if $CC --version | $GREP -v '^2\.7' > /dev/null; then + archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' + archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -shared $pic_flag -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + else + # g++ 2.7 appears to require '-G' NOT '-shared' on this + # platform. + archive_cmds_CXX='$CC -G -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' + archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + fi + + hardcode_libdir_flag_spec_CXX='$wl-R $wl$libdir' + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + whole_archive_flag_spec_CXX='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' + ;; + esac + fi + ;; + esac + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) + no_undefined_flag_CXX='$wl-z,text' + archive_cmds_need_lc_CXX=no + hardcode_shlibpath_var_CXX=no + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + archive_cmds_CXX='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_CXX='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds_CXX='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_CXX='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We CANNOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + no_undefined_flag_CXX='$wl-z,text' + allow_undefined_flag_CXX='$wl-z,nodefs' + archive_cmds_need_lc_CXX=no + hardcode_shlibpath_var_CXX=no + hardcode_libdir_flag_spec_CXX='$wl-R,$libdir' + hardcode_libdir_separator_CXX=':' + link_all_deplibs_CXX=yes + export_dynamic_flag_spec_CXX='$wl-Bexport' + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + archive_cmds_CXX='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_CXX='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + old_archive_cmds_CXX='$CC -Tprelink_objects $oldobjs~ + '"$old_archive_cmds_CXX" + reload_cmds_CXX='$CC -Tprelink_objects $reload_objs~ + '"$reload_cmds_CXX" + ;; + *) + archive_cmds_CXX='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_CXX='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + + vxworks*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 +$as_echo "$ld_shlibs_CXX" >&6; } + test no = "$ld_shlibs_CXX" && can_build_shared=no + + GCC_CXX=$GXX + LD_CXX=$LD + + ## CAVEAT EMPTOR: + ## There is no encapsulation within the following macros, do not change + ## the running order or otherwise move them around unless you know exactly + ## what you are doing... + { output_verbose_link_cmd=; unset output_verbose_link_cmd;} + # Dependencies to place before and after the object being linked: +predep_objects_CXX= +postdep_objects_CXX= +predeps_CXX= +postdeps_CXX= +compiler_lib_search_path_CXX= + +cat > conftest.$ac_ext <<_LT_EOF +class Foo +{ +public: + Foo (void) { a = 0; } +private: + int a; +}; +_LT_EOF + + +_lt_libdeps_save_CFLAGS=$CFLAGS +case "$CC $CFLAGS " in #( +*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; +*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; +*\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;; +esac + +if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + # Parse the compiler output and extract the necessary + # objects, libraries and library flags. + + # Sentinel used to keep track of whether or not we are before + # the conftest object file. + pre_test_object_deps_done=no + + for p in `eval "$output_verbose_link_cmd"`; do + case $prev$p in + + -L* | -R* | -l*) + # Some compilers place space between "-{L,R}" and the path. + # Remove the space. + if test x-L = x"$p" || + test x-R = x"$p" || + test x-l = x"$p"; 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 no = "$pre_test_object_deps_done"; then + case $prev in + -L | -R) + # Internal compiler library paths should come after those + # provided the user. The postdeps already come after the + # user supplied libs so there is no need to process them. + if test -z "$compiler_lib_search_path_CXX"; then + compiler_lib_search_path_CXX=$prev$p + else + compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} $prev$p" + fi + ;; + # The "-l" case would never come before the object being + # linked, so don't bother handling this case. + esac + else + if test -z "$postdeps_CXX"; then + postdeps_CXX=$prev$p + else + postdeps_CXX="${postdeps_CXX} $prev$p" + fi + fi + prev= + ;; + + *.lto.$objext) ;; # Ignore GCC LTO objects + *.$objext) + # This assumes that the test object file only shows up + # once in the compiler output. + if test "$p" = "conftest.$objext"; then + pre_test_object_deps_done=yes + continue + fi + + if test no = "$pre_test_object_deps_done"; then + if test -z "$predep_objects_CXX"; then + predep_objects_CXX=$p + else + predep_objects_CXX="$predep_objects_CXX $p" + fi + else + if test -z "$postdep_objects_CXX"; then + postdep_objects_CXX=$p + else + postdep_objects_CXX="$postdep_objects_CXX $p" + fi + fi + ;; + + *) ;; # Ignore the rest. + + esac + done + + # Clean up. + rm -f a.out a.exe +else + echo "libtool.m4: error: problem compiling CXX test program" +fi + +$RM -f confest.$objext +CFLAGS=$_lt_libdeps_save_CFLAGS + +# PORTME: override above test on systems where it is broken +case $host_os in +interix[3-9]*) + # Interix 3.5 installs completely hosed .la files for C++, so rather than + # hack all around it, let's just trust "g++" to DTRT. + predep_objects_CXX= + postdep_objects_CXX= + postdeps_CXX= + ;; +esac + + +case " $postdeps_CXX " in +*" -lc "*) archive_cmds_need_lc_CXX=no ;; +esac + compiler_lib_search_dirs_CXX= +if test -n "${compiler_lib_search_path_CXX}"; then + compiler_lib_search_dirs_CXX=`echo " ${compiler_lib_search_path_CXX}" | $SED -e 's! -L! !g' -e 's!^ !!'` +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + lt_prog_compiler_wl_CXX= +lt_prog_compiler_pic_CXX= +lt_prog_compiler_static_CXX= + + + # C++ specific cases for pic, static, wl, etc. + if test yes = "$GXX"; then + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test ia64 = "$host_cpu"; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_CXX='-Bstatic' + fi + lt_prog_compiler_pic_CXX='-fPIC' + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + lt_prog_compiler_pic_CXX='-fPIC' + ;; + m68k) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the '-m68020' flag to GCC prevents building anything better, + # like '-m68040'. + lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4' + ;; + esac + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + mingw* | cygwin* | os2* | pw32* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + lt_prog_compiler_pic_CXX='-DDLL_EXPORT' + case $host_os in + os2*) + lt_prog_compiler_static_CXX='$wl-static' + ;; + esac + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic_CXX='-fno-common' + ;; + *djgpp*) + # DJGPP does not support shared libraries at all + lt_prog_compiler_pic_CXX= + ;; + haiku*) + # PIC is the default for Haiku. + # The "-static" flag exists, but is broken. + lt_prog_compiler_static_CXX= + ;; + interix[3-9]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic_CXX=-Kconform_pic + fi + ;; + hpux*) + # PIC is the default for 64-bit PA HP-UX, but not for 32-bit + # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag + # sets the default TLS model and affects inlining. + case $host_cpu in + hppa*64*) + ;; + *) + lt_prog_compiler_pic_CXX='-fPIC' + ;; + esac + ;; + *qnx* | *nto*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + lt_prog_compiler_pic_CXX='-fPIC -shared' + ;; + *) + lt_prog_compiler_pic_CXX='-fPIC' + ;; + esac + else + case $host_os in + aix[4-9]*) + # All AIX code is PIC. + if test ia64 = "$host_cpu"; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_CXX='-Bstatic' + else + lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp' + fi + ;; + chorus*) + case $cc_basename in + cxch68*) + # Green Hills C++ Compiler + # _LT_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" + ;; + esac + ;; + mingw* | cygwin* | os2* | pw32* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic_CXX='-DDLL_EXPORT' + ;; + dgux*) + case $cc_basename in + ec++*) + lt_prog_compiler_pic_CXX='-KPIC' + ;; + ghcx*) + # Green Hills C++ Compiler + lt_prog_compiler_pic_CXX='-pic' + ;; + *) + ;; + esac + ;; + freebsd* | dragonfly*) + # FreeBSD uses GNU C++ + ;; + hpux9* | hpux10* | hpux11*) + case $cc_basename in + CC*) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX='$wl-a ${wl}archive' + if test ia64 != "$host_cpu"; then + lt_prog_compiler_pic_CXX='+Z' + fi + ;; + aCC*) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX='$wl-a ${wl}archive' + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic_CXX='+Z' + ;; + esac + ;; + *) + ;; + esac + ;; + interix*) + # This is c89, which is MS Visual C++ (no shared libs) + # Anyone wants to do a port? + ;; + irix5* | irix6* | nonstopux*) + case $cc_basename in + CC*) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX='-non_shared' + # CC pic flag -KPIC is the default. + ;; + *) + ;; + esac + ;; + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + case $cc_basename in + KCC*) + # KAI C++ Compiler + lt_prog_compiler_wl_CXX='--backend -Wl,' + lt_prog_compiler_pic_CXX='-fPIC' + ;; + ecpc* ) + # old Intel C++ for x86_64, which still supported -KPIC. + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_pic_CXX='-KPIC' + lt_prog_compiler_static_CXX='-static' + ;; + icpc* ) + # Intel C++, used to be incompatible with GCC. + # ICC 10 doesn't accept -KPIC any more. + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_pic_CXX='-fPIC' + lt_prog_compiler_static_CXX='-static' + ;; + pgCC* | pgcpp* | pgc++* ) + # Portland Group C++ compiler + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_pic_CXX='-fpic' + lt_prog_compiler_static_CXX='-Bstatic' + ;; + cxx*) + # Compaq C++ + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + lt_prog_compiler_pic_CXX= + lt_prog_compiler_static_CXX='-non_shared' + ;; + xlc* | xlC* | bgxl[cC]* | mpixl[cC]*) + # IBM XL 8.0, 9.0 on PPC and BlueGene + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_pic_CXX='-qpic' + lt_prog_compiler_static_CXX='-qstaticlink' + ;; + *) + case `$CC -V 2>&1 | sed -n 1,5p` in + *Sun\ C*) + # Sun C++ 5.9 + lt_prog_compiler_pic_CXX='-KPIC' + lt_prog_compiler_static_CXX='-Bstatic' + lt_prog_compiler_wl_CXX='-Qoption ld ' + ;; + esac + ;; + esac + ;; + lynxos*) + ;; + m88k*) + ;; + mvs*) + case $cc_basename in + cxx*) + lt_prog_compiler_pic_CXX='-W c,exportall' + ;; + *) + ;; + esac + ;; + netbsd*) + ;; + *qnx* | *nto*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + lt_prog_compiler_pic_CXX='-fPIC -shared' + ;; + osf3* | osf4* | osf5*) + case $cc_basename in + KCC*) + lt_prog_compiler_wl_CXX='--backend -Wl,' + ;; + RCC*) + # Rational C++ 2.4.1 + lt_prog_compiler_pic_CXX='-pic' + ;; + cxx*) + # Digital/Compaq C++ + lt_prog_compiler_wl_CXX='-Wl,' + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + lt_prog_compiler_pic_CXX= + lt_prog_compiler_static_CXX='-non_shared' + ;; + *) + ;; + esac + ;; + psos*) + ;; + solaris*) + case $cc_basename in + CC* | sunCC*) + # Sun C++ 4.2, 5.x and Centerline C++ + lt_prog_compiler_pic_CXX='-KPIC' + lt_prog_compiler_static_CXX='-Bstatic' + lt_prog_compiler_wl_CXX='-Qoption ld ' + ;; + gcx*) + # Green Hills C++ Compiler + lt_prog_compiler_pic_CXX='-PIC' + ;; + *) + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + lt_prog_compiler_pic_CXX='-pic' + lt_prog_compiler_static_CXX='-Bstatic' + ;; + lcc*) + # Lucid + lt_prog_compiler_pic_CXX='-pic' + ;; + *) + ;; + esac + ;; + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + case $cc_basename in + CC*) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_pic_CXX='-KPIC' + lt_prog_compiler_static_CXX='-Bstatic' + ;; + esac + ;; + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + lt_prog_compiler_pic_CXX='-KPIC' + ;; + *) + ;; + esac + ;; + vxworks*) + ;; + *) + lt_prog_compiler_can_build_shared_CXX=no + ;; + esac + fi + +case $host_os in + # For platforms that do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic_CXX= + ;; + *) + lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC" + ;; +esac + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 +$as_echo_n "checking for $compiler option to produce PIC... " >&6; } +if ${lt_cv_prog_compiler_pic_CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_pic_CXX=$lt_prog_compiler_pic_CXX +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_CXX" >&5 +$as_echo "$lt_cv_prog_compiler_pic_CXX" >&6; } +lt_prog_compiler_pic_CXX=$lt_cv_prog_compiler_pic_CXX + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic_CXX"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5 +$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... " >&6; } +if ${lt_cv_prog_compiler_pic_works_CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_pic_works_CXX=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC" ## exclude from sc_useless_quotes_in_assignment + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_pic_works_CXX=yes + fi + fi + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works_CXX" >&5 +$as_echo "$lt_cv_prog_compiler_pic_works_CXX" >&6; } + +if test yes = "$lt_cv_prog_compiler_pic_works_CXX"; then + case $lt_prog_compiler_pic_CXX in + "" | " "*) ;; + *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;; + esac +else + lt_prog_compiler_pic_CXX= + lt_prog_compiler_can_build_shared_CXX=no +fi + +fi + + + + + +# +# Check to make sure the static flag actually works. +# +wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\" +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 +$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } +if ${lt_cv_prog_compiler_static_works_CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_static_works_CXX=no + save_LDFLAGS=$LDFLAGS + LDFLAGS="$LDFLAGS $lt_tmp_static_flag" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_static_works_CXX=yes + fi + else + lt_cv_prog_compiler_static_works_CXX=yes + fi + fi + $RM -r conftest* + LDFLAGS=$save_LDFLAGS + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works_CXX" >&5 +$as_echo "$lt_cv_prog_compiler_static_works_CXX" >&6; } + +if test yes = "$lt_cv_prog_compiler_static_works_CXX"; then + : +else + lt_prog_compiler_static_CXX= +fi + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if ${lt_cv_prog_compiler_c_o_CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_c_o_CXX=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o_CXX=yes + fi + fi + chmod u+w . 2>&5 + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5 +$as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; } + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if ${lt_cv_prog_compiler_c_o_CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_c_o_CXX=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o_CXX=yes + fi + fi + chmod u+w . 2>&5 + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5 +$as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; } + + + + +hard_links=nottested +if test no = "$lt_cv_prog_compiler_c_o_CXX" && test no != "$need_locks"; 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 no = "$hard_links"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5 +$as_echo "$as_me: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } + + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' + case $host_os in + aix[4-9]*) + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to GNU nm, but means don't demangle to AIX nm. + # Without the "-l" option, or with the "-B" option, AIX nm treats + # weak defined symbols like other global defined symbols, whereas + # GNU nm marks them as "W". + # While the 'weak' keyword is ignored in the Export File, we need + # it in the Import File for the 'aix-soname' feature, so we have + # to replace the "-B" option with "-P" for AIX nm. + if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then + export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds_CXX='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' + fi + ;; + pw32*) + export_symbols_cmds_CXX=$ltdll_cmds + ;; + cygwin* | mingw* | cegcc*) + case $cc_basename in + cl*) + exclude_expsyms_CXX='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' + ;; + *) + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' + exclude_expsyms_CXX='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' + ;; + esac + ;; + *) + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + ;; + esac + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 +$as_echo "$ld_shlibs_CXX" >&6; } +test no = "$ld_shlibs_CXX" && can_build_shared=no + +with_gnu_ld_CXX=$with_gnu_ld + + + + + + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc_CXX" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc_CXX=yes + + if test yes,yes = "$GCC,$enable_shared"; then + case $archive_cmds_CXX in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 +$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } +if ${lt_cv_archive_cmds_need_lc_CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else + $RM conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl_CXX + pic_flag=$lt_prog_compiler_pic_CXX + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag_CXX + allow_undefined_flag_CXX= + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 + (eval $archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + then + lt_cv_archive_cmds_need_lc_CXX=no + else + lt_cv_archive_cmds_need_lc_CXX=yes + fi + allow_undefined_flag_CXX=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc_CXX" >&5 +$as_echo "$lt_cv_archive_cmds_need_lc_CXX" >&6; } + archive_cmds_need_lc_CXX=$lt_cv_archive_cmds_need_lc_CXX + ;; + esac + fi + ;; +esac + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 +$as_echo_n "checking dynamic linker characteristics... " >&6; } + +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=.so +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + + + +case $host_os in +aix3*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='$libname$release$shared_ext$major' + ;; + +aix[4-9]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test ia64 = "$host_cpu"; 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 + # Using Import Files as archive members, it is possible to support + # filename-based versioning of shared library archives on AIX. While + # this would work for both with and without runtime linking, it will + # prevent static linking of such archives. So we do filename-based + # shared library versioning with .so extension only, which is used + # when both runtime linking and shared linking is enabled. + # Unfortunately, runtime linking may impact performance, so we do + # not want this to be the default eventually. Also, we use the + # versioned .so libs for executables only if there is the -brtl + # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. + # To allow for filename-based versioning support, we need to create + # libNAME.so.V as an archive file, containing: + # *) an Import File, referring to the versioned filename of the + # archive as well as the shared archive member, telling the + # bitwidth (32 or 64) of that shared object, and providing the + # list of exported symbols of that shared object, eventually + # decorated with the 'weak' keyword + # *) the shared object with the F_LOADONLY flag set, to really avoid + # it being seen by the linker. + # At run time we better use the real file rather than another symlink, + # but for link time we create the symlink libNAME.so -> libNAME.so.V + + case $with_aix_soname,$aix_use_runtimelinking in + # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + aix,yes) # traditional libtool + dynamic_linker='AIX unversionable lib.so' + # If using run time linking (on AIX 4.2 or later) use lib<name>.so + # instead of lib<name>.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + ;; + aix,no) # traditional AIX only + dynamic_linker='AIX lib.a(lib.so.V)' + # 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' + ;; + svr4,*) # full svr4 only + dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o)" + library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' + # We do not specify a path in Import Files, so LIBPATH fires. + shlibpath_overrides_runpath=yes + ;; + *,yes) # both, prefer svr4 + dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o), lib.a(lib.so.V)" + library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' + # unpreferred sharedlib libNAME.a needs extra handling + postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' + postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' + # We do not specify a path in Import Files, so LIBPATH fires. + shlibpath_overrides_runpath=yes + ;; + *,no) # both, prefer aix + dynamic_linker="AIX lib.a(lib.so.V), lib.so.V($shared_archive_member_spec.o)" + library_names_spec='$libname$release.a $libname.a' + soname_spec='$libname$release$shared_ext$major' + # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling + postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' + postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' + ;; + esac + 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%'\''`; $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$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + 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 + ;; + +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=no + 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 32 = "$HPUX_IA64_MODE"; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + sys_lib_dlsearch_path_spec=/usr/lib/hpux32 + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + sys_lib_dlsearch_path_spec=/usr/lib/hpux64 + fi + ;; + 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 yes = "$lt_cv_prog_gnu_ld"; 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 + ;; + +linux*android*) + version_type=none # Android doesn't support versioned libraries. + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext' + soname_spec='$libname$release$shared_ext' + finish_cmds= + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + + # 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 + + dynamic_linker='Android linker' + # Don't embed -rpath directories since the linker doesn't support them. + hardcode_libdir_flag_spec_CXX='-L$libdir' + ;; + +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + + # Some binutils ld are patched to set DT_RUNPATH + if ${lt_cv_shlibpath_overrides_runpath+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_shlibpath_overrides_runpath=no + save_LDFLAGS=$LDFLAGS + save_libdir=$libdir + eval "libdir=/foo; wl=\"$lt_prog_compiler_wl_CXX\"; \ + LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec_CXX\"" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : + lt_cv_shlibpath_overrides_runpath=yes +fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$save_LDFLAGS + libdir=$save_libdir + +fi + + shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath + + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Ideally, we could use ldconfig to report *all* directores which are + # searched for libraries, however this is still not possible. Aside from not + # being certain /sbin/ldconfig is available, command + # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, + # even though it is searched at run-time. Try to do the best guess by + # appending ld.so.conf contents (and includes) to the search path. + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +*nto* | *qnx*) + version_type=qnx + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='ldqnx.so' + ;; + +openbsd* | bitrig*) + version_type=sunos + sys_lib_dlsearch_path_spec=/usr/lib + need_lib_prefix=no + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then + need_version=no + else + need_version=yes + fi + 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 + shlibpath_overrides_runpath=yes + ;; + +os2*) + libname_spec='$name' + version_type=windows + shrext_cmds=.dll + need_version=no + need_lib_prefix=no + # OS/2 can only load a DLL with a base name of 8 characters or less. + soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; + v=$($ECHO $release$versuffix | tr -d .-); + n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); + $ECHO $n$v`$shared_ext' + library_names_spec='${libname}_dll.$libext' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=BEGINLIBPATH + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + 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' + ;; + +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 yes = "$with_gnu_ld"; 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=sco + 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 yes = "$with_gnu_ld"; 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 no = "$dynamic_linker" && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test yes = "$GCC"; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then + sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec +fi + +if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then + sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec +fi + +# remember unaugmented sys_lib_dlsearch_path content for libtool script decls... +configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec + +# ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code +func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" + +# to be used as default LT_SYS_LIBRARY_PATH value in generated libtool +configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 +$as_echo_n "checking how to hardcode library paths into programs... " >&6; } +hardcode_action_CXX= +if test -n "$hardcode_libdir_flag_spec_CXX" || + test -n "$runpath_var_CXX" || + test yes = "$hardcode_automatic_CXX"; then + + # We can hardcode non-existent directories. + if test no != "$hardcode_direct_CXX" && + # 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 no != "$_LT_TAGVAR(hardcode_shlibpath_var, CXX)" && + test no != "$hardcode_minus_L_CXX"; then + # Linking always hardcodes the temporary library directory. + hardcode_action_CXX=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action_CXX=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action_CXX=unsupported +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action_CXX" >&5 +$as_echo "$hardcode_action_CXX" >&6; } + +if test relink = "$hardcode_action_CXX" || + test yes = "$inherit_rpath_CXX"; then + # Fast installation is not supported + enable_fast_install=no +elif test yes = "$shlibpath_overrides_runpath" || + test no = "$enable_shared"; then + # Fast installation is not necessary + enable_fast_install=needless +fi + + + + + + + + fi # test -n "$compiler" + + CC=$lt_save_CC + CFLAGS=$lt_save_CFLAGS + LDCXX=$LD + LD=$lt_save_LD + GCC=$lt_save_GCC + with_gnu_ld=$lt_save_with_gnu_ld + lt_cv_path_LDCXX=$lt_cv_path_LD + lt_cv_path_LD=$lt_save_path_LD + lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld + lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld +fi # test yes != "$_lt_caught_CXX_error" + +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 no = "$F77"; 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 yes != "$_lt_disable_F77"; 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 + func_cc_basename $compiler +cc_basename=$func_cc_basename_result + + 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 no = "$can_build_shared" && 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 yes = "$enable_shared" && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + aix[4-9]*) + if test ia64 != "$host_cpu"; then + case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in + yes,aix,yes) ;; # shared object as lib.so file only + yes,svr4,*) ;; # shared object as lib.so archive member only + yes,*) enable_static=no ;; # shared object in lib.a archive as well + esac + 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 yes = "$enable_shared" || 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 yes = "$GCC"; 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 ia64 = "$host_cpu"; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_F77='-Bstatic' + fi + lt_prog_compiler_pic_F77='-fPIC' + ;; + + 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' + case $host_os in + os2*) + lt_prog_compiler_static_F77='$wl-static' + ;; + esac + ;; + + 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 ia64 = "$host_cpu"; 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 + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic_F77='-fno-common' + case $cc_basename in + nagfor*) + # NAG Fortran compiler + lt_prog_compiler_wl_F77='-Wl,-Wl,,' + lt_prog_compiler_pic_F77='-PIC' + lt_prog_compiler_static_F77='-Bstatic' + ;; + esac + ;; + + 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' + case $host_os in + os2*) + lt_prog_compiler_static_F77='$wl-static' + ;; + esac + ;; + + 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 | 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' + ;; + tcc*) + # Fabrice Bellard et al's Tiny C Compiler + lt_prog_compiler_wl_F77='-Wl,' + lt_prog_compiler_pic_F77='-fPIC' + lt_prog_compiler_static_F77='-static' + ;; + 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 -n 1,5p` 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' + ;; #( + *NAG\ Fortran\ Compiler*) + lt_prog_compiler_wl_F77='-Wl,-Wl,,' + lt_prog_compiler_pic_F77='-PIC' + lt_prog_compiler_static_F77='-Bstatic' + ;; + *PGI\ Compilers\ and\ Tools*|*NVIDIA\ Compilers\ and\ Tools*|*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 that 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" ## exclude from sc_useless_quotes_in_assignment + # 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 yes = "$lt_cv_prog_compiler_pic_works_F77"; 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 yes = "$lt_cv_prog_compiler_static_works_F77"; 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 no = "$lt_cv_prog_compiler_c_o_F77" && test no != "$need_locks"; 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 no = "$hard_links"; 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 yes != "$GCC"; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; + openbsd* | bitrig*) + 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 yes = "$with_gnu_ld"; 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 yes = "$lt_use_gnu_ld_interface"; 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 | $SED -e 's/(^)\+)\s\+//' 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 ia64 != "$host_cpu"; then + ld_shlibs_F77=no + cat <<_LT_EOF 1>&2 + +*** Warning: the GNU linker, at least up to release 2.19, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to install binutils +*** 2.20 or above, or modify your PATH so that a non-GNU linker is found. +*** You will then need to restart the configuration process. + +_LT_EOF + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds_F77='' + ;; + m68k) + archive_cmds_F77='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_minus_L_F77=yes + ;; + esac + ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag_F77=unsupported + # Joseph Beckenbach <jrb3@best.com> says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds_F77='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + else + ld_shlibs_F77=no + fi + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # _LT_TAGVAR(hardcode_libdir_flag_spec, F77) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec_F77='-L$libdir' + export_dynamic_flag_spec_F77='$wl--export-all-symbols' + allow_undefined_flag_F77=unsupported + always_export_symbols_F77=no + enable_shared_with_static_runtimes_F77=yes + export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' + exclude_expsyms_F77='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file, use it as + # is; otherwise, prepend EXPORTS... + archive_expsym_cmds_F77='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; 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 + ;; + + os2*) + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_minus_L_F77=yes + allow_undefined_flag_F77=unsupported + shrext_cmds=.dll + archive_cmds_F77='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + archive_expsym_cmds_F77='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + prefix_cmds="$SED"~ + if test EXPORTS = "`$SED 1q $export_symbols`"; then + prefix_cmds="$prefix_cmds -e 1d"; + fi~ + prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ + cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + old_archive_From_new_cmds_F77='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' + enable_shared_with_static_runtimes_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 linux-dietlibc = "$host_os"; 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 no = "$tmp_diet" + then + tmp_addflag=' $pic_flag' + tmp_sharedflag='-shared' + tmp_compiler_flags='$compiler_flags' + 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' ;; + nagfor*) # NAGFOR 5.3 + tmp_sharedflag='-Wl,-shared' + tmp_compiler_flags='`echo $compiler_flags | sed -e '"'"'s/ -W[cl],-no-pie\b//g'"'"'`' ;; + 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 -n 1,5p` 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' ;; + *NAG\ Fortran\ Compiler*) + tmp_sharedflag='-Wl,-shared' + tmp_compiler_flags='`echo $compiler_flags | sed -e '"'"'s/ -W[cl],-no-pie\b//g'"'"'`' ;; + esac + archive_cmds_F77='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs '"$tmp_compiler_flags"' $wl-soname $wl$soname -o $lib' + + if test yes = "$supports_anon_versioning"; 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 '"$tmp_compiler_flags"' $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' + fi + + case $cc_basename in + tcc*) + export_dynamic_flag_spec_F77='-rdynamic' + ;; + 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 yes = "$supports_anon_versioning"; 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 cannot +*** 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 no = "$ld_shlibs_F77"; 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 yes = "$GCC" && 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 ia64 = "$host_cpu"; 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 GNU nm, but means don't demangle to AIX nm. + # Without the "-l" option, or with the "-B" option, AIX nm treats + # weak defined symbols like other global defined symbols, whereas + # GNU nm marks them as "W". + # While the 'weak' keyword is ignored in the Export File, we need + # it in the Import File for the 'aix-soname' feature, so we have + # to replace the "-B" option with "-P" for AIX nm. + 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) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds_F77='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | 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 + # have runtime linking enabled, and use it for executables. + # For shared libraries, we enable/disable runtime linking + # depending on the kind of the shared library created - + # when "with_aix_soname,aix_use_runtimelinking" is: + # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables + # "aix,yes" lib.so shared, rtl:yes, for executables + # lib.a static archive + # "both,no" lib.so.V(shr.o) shared, rtl:yes + # lib.a(lib.so.V) shared, rtl:no, for executables + # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables + # lib.a(lib.so.V) shared, rtl:no + # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables + # lib.a static archive + case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) + for ld_flag in $LDFLAGS; do + if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then + aix_use_runtimelinking=yes + break + fi + done + if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then + # With aix-soname=svr4, we create the lib.so.V shared archives only, + # so we don't have lib.a shared libs to link our executables. + # We have to force runtime linking in this case. + aix_use_runtimelinking=yes + LDFLAGS="$LDFLAGS -Wl,-brtl" + fi + ;; + 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,' + case $with_aix_soname,$aix_use_runtimelinking in + aix,*) ;; # traditional, no import file + svr4,* | *,yes) # use import file + # The Import File defines what to hardcode. + hardcode_direct_F77=no + hardcode_direct_absolute_F77=no + ;; + esac + + if test yes = "$GCC"; 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 yes = "$aix_use_runtimelinking"; then + shared_flag="$shared_flag "'$wl-G' + fi + # Need to ensure runtime linking is disabled for the traditional + # shared library, or the linker may eventually find shared libraries + # /with/ Import File - we do not want to mix them. + shared_flag_aix='-shared' + shared_flag_svr4='-shared $wl-G' + else + # not using gcc + if test ia64 = "$host_cpu"; 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 yes = "$aix_use_runtimelinking"; then + shared_flag='$wl-G' + else + shared_flag='$wl-bM:SRE' + fi + shared_flag_aix='$wl-bM:SRE' + shared_flag_svr4='$wl-G' + 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,yes = "$with_aix_soname,$aix_use_runtimelinking"; 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 set = "${lt_cv_aix_libpath+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 -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag + else + if test ia64 = "$host_cpu"; 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 set = "${lt_cv_aix_libpath+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 yes = "$with_gnu_ld"; 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 + archive_expsym_cmds_F77='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' + # -brtl affects multiple linker settings, -berok does not and is overridden later + compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([, ]\\)%-berok\\1%g"`' + if test svr4 != "$with_aix_soname"; then + # This is similar to how AIX traditionally builds its shared libraries. + archive_expsym_cmds_F77="$archive_expsym_cmds_F77"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' + fi + if test aix != "$with_aix_soname"; then + archive_expsym_cmds_F77="$archive_expsym_cmds_F77"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' + else + # used by -dlpreopen to get the symbols + archive_expsym_cmds_F77="$archive_expsym_cmds_F77"'~$MV $output_objdir/$realname.d/$soname $output_objdir' + fi + archive_expsym_cmds_F77="$archive_expsym_cmds_F77"'~$RM -r $output_objdir/$realname.d' + 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,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' + archive_expsym_cmds_F77='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then + cp "$export_symbols" "$output_objdir/$soname.def"; + echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; + else + $SED -e '\''s/^/-link -EXPORT:/'\'' < $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 yes = "$lt_cv_ld_force_load"; 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*|nagfor*) _lt_dar_can_shared=yes ;; + *) _lt_dar_can_shared=$GCC ;; + esac + if test yes = "$_lt_dar_can_shared"; 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 yes = "$GCC"; 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 "x$output_objdir/$soname" = "x$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 "x$output_objdir/$soname" = "x$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 yes,no = "$GCC,$with_gnu_ld"; 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 no = "$with_gnu_ld"; 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 yes,no = "$GCC,$with_gnu_ld"; 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 no = "$with_gnu_ld"; 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 yes = "$GCC"; 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 yes = "$lt_cv_irix_exported_symbol"; 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 + ;; + + linux*) + case $cc_basename in + tcc*) + # Fabrice Bellard et al's Tiny C Compiler + ld_shlibs_F77=yes + archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + + 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* | bitrig*) + 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__`"; 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 + archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec_F77='$wl-rpath,$libdir' + 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 + shrext_cmds=.dll + archive_cmds_F77='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + archive_expsym_cmds_F77='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + prefix_cmds="$SED"~ + if test EXPORTS = "`$SED 1q $export_symbols`"; then + prefix_cmds="$prefix_cmds -e 1d"; + fi~ + prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ + cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + old_archive_From_new_cmds_F77='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' + enable_shared_with_static_runtimes_F77=yes + ;; + + osf3*) + if test yes = "$GCC"; 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 yes = "$GCC"; 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 yes = "$GCC"; 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 yes = "$GCC"; 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 sequent = "$host_vendor"; 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 yes = "$GCC"; 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 CANNOT 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 yes = "$GCC"; 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 sni = "$host_vendor"; 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 no = "$ld_shlibs_F77" && 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 yes,yes = "$GCC,$enable_shared"; 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 ia64 = "$host_cpu"; 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 + # Using Import Files as archive members, it is possible to support + # filename-based versioning of shared library archives on AIX. While + # this would work for both with and without runtime linking, it will + # prevent static linking of such archives. So we do filename-based + # shared library versioning with .so extension only, which is used + # when both runtime linking and shared linking is enabled. + # Unfortunately, runtime linking may impact performance, so we do + # not want this to be the default eventually. Also, we use the + # versioned .so libs for executables only if there is the -brtl + # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. + # To allow for filename-based versioning support, we need to create + # libNAME.so.V as an archive file, containing: + # *) an Import File, referring to the versioned filename of the + # archive as well as the shared archive member, telling the + # bitwidth (32 or 64) of that shared object, and providing the + # list of exported symbols of that shared object, eventually + # decorated with the 'weak' keyword + # *) the shared object with the F_LOADONLY flag set, to really avoid + # it being seen by the linker. + # At run time we better use the real file rather than another symlink, + # but for link time we create the symlink libNAME.so -> libNAME.so.V + + case $with_aix_soname,$aix_use_runtimelinking in + # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + aix,yes) # traditional libtool + dynamic_linker='AIX unversionable lib.so' + # If using run time linking (on AIX 4.2 or later) use lib<name>.so + # instead of lib<name>.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + ;; + aix,no) # traditional AIX only + dynamic_linker='AIX lib.a(lib.so.V)' + # 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' + ;; + svr4,*) # full svr4 only + dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o)" + library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' + # We do not specify a path in Import Files, so LIBPATH fires. + shlibpath_overrides_runpath=yes + ;; + *,yes) # both, prefer svr4 + dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o), lib.a(lib.so.V)" + library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' + # unpreferred sharedlib libNAME.a needs extra handling + postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' + postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' + # We do not specify a path in Import Files, so LIBPATH fires. + shlibpath_overrides_runpath=yes + ;; + *,no) # both, prefer aix + dynamic_linker="AIX lib.a(lib.so.V), lib.so.V($shared_archive_member_spec.o)" + library_names_spec='$libname$release.a $libname.a' + soname_spec='$libname$release$shared_ext$major' + # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling + postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' + postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' + ;; + esac + 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%'\''`; $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$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + 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 + ;; + +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=no + 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 32 = "$HPUX_IA64_MODE"; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + sys_lib_dlsearch_path_spec=/usr/lib/hpux32 + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + sys_lib_dlsearch_path_spec=/usr/lib/hpux64 + fi + ;; + 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 yes = "$lt_cv_prog_gnu_ld"; 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 + ;; + +linux*android*) + version_type=none # Android doesn't support versioned libraries. + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext' + soname_spec='$libname$release$shared_ext' + finish_cmds= + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + + # 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 + + dynamic_linker='Android linker' + # Don't embed -rpath directories since the linker doesn't support them. + hardcode_libdir_flag_spec_F77='-L$libdir' + ;; + +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu | 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 + + # Ideally, we could use ldconfig to report *all* directores which are + # searched for libraries, however this is still not possible. Aside from not + # being certain /sbin/ldconfig is available, command + # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, + # even though it is searched at run-time. Try to do the best guess by + # appending ld.so.conf contents (and includes) to the search path. + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +*nto* | *qnx*) + version_type=qnx + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='ldqnx.so' + ;; + +openbsd* | bitrig*) + version_type=sunos + sys_lib_dlsearch_path_spec=/usr/lib + need_lib_prefix=no + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then + need_version=no + else + need_version=yes + fi + 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 + shlibpath_overrides_runpath=yes + ;; + +os2*) + libname_spec='$name' + version_type=windows + shrext_cmds=.dll + need_version=no + need_lib_prefix=no + # OS/2 can only load a DLL with a base name of 8 characters or less. + soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; + v=$($ECHO $release$versuffix | tr -d .-); + n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); + $ECHO $n$v`$shared_ext' + library_names_spec='${libname}_dll.$libext' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=BEGINLIBPATH + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + 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' + ;; + +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 yes = "$with_gnu_ld"; 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=sco + 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 yes = "$with_gnu_ld"; 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 no = "$dynamic_linker" && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test yes = "$GCC"; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then + sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec +fi + +if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then + sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec +fi + +# remember unaugmented sys_lib_dlsearch_path content for libtool script decls... +configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec + +# ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code +func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" + +# to be used as default LT_SYS_LIBRARY_PATH value in generated libtool +configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $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 yes = "$hardcode_automatic_F77"; then + + # We can hardcode non-existent directories. + if test no != "$hardcode_direct_F77" && + # 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 no != "$_LT_TAGVAR(hardcode_shlibpath_var, F77)" && + test no != "$hardcode_minus_L_F77"; 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 relink = "$hardcode_action_F77" || + test yes = "$inherit_rpath_F77"; then + # Fast installation is not supported + enable_fast_install=no +elif test yes = "$shlibpath_overrides_runpath" || + test no = "$enable_shared"; then + # Fast installation is not necessary + enable_fast_install=needless +fi + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether this is the NAG Fortran compiler" >&5 +$as_echo_n "checking whether this is the NAG Fortran compiler... " >&6; } + $CC -V 2>&1 | grep '^NAG Fortran Compiler Release' >/dev/null 2>&1 + _lt_result=$? + if test $_lt_result -eq 0; then : + _lt_result=yes +else + _lt_result=no +fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_lt_result" >&5 +$as_echo "$_lt_result" >&6; } + acx_is_nagfor_F77=$_lt_result + + + + fi # test -n "$compiler" + + GCC=$lt_save_GCC + CC=$lt_save_CC + CFLAGS=$lt_save_CFLAGS +fi # test yes != "$_lt_disable_F77" + +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 -z "$FC" || test no = "$FC"; 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 yes != "$_lt_disable_FC"; 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 + func_cc_basename $compiler +cc_basename=$func_cc_basename_result + + + 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 no = "$can_build_shared" && 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 yes = "$enable_shared" && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + aix[4-9]*) + if test ia64 != "$host_cpu"; then + case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in + yes,aix,yes) ;; # shared object as lib.so file only + yes,svr4,*) ;; # shared object as lib.so archive member only + yes,*) enable_static=no ;; # shared object in lib.a archive as well + esac + 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 yes = "$enable_shared" || 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... + { output_verbose_link_cmd=; unset output_verbose_link_cmd;} + # 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 x-L = x"$p" || + test x-R = x"$p" || + test x-l = x"$p"; 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 no = "$pre_test_object_deps_done"; 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 no = "$pre_test_object_deps_done"; 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 yes = "$GCC"; 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 ia64 = "$host_cpu"; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_FC='-Bstatic' + fi + lt_prog_compiler_pic_FC='-fPIC' + ;; + + 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' + case $host_os in + os2*) + lt_prog_compiler_static_FC='$wl-static' + ;; + esac + ;; + + 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 ia64 = "$host_cpu"; 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 + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic_FC='-fno-common' + case $cc_basename in + nagfor*) + # NAG Fortran compiler + lt_prog_compiler_wl_FC='-Wl,-Wl,,' + lt_prog_compiler_pic_FC='-PIC' + lt_prog_compiler_static_FC='-Bstatic' + ;; + esac + ;; + + 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' + case $host_os in + os2*) + lt_prog_compiler_static_FC='$wl-static' + ;; + esac + ;; + + 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 | 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' + ;; + tcc*) + # Fabrice Bellard et al's Tiny C Compiler + lt_prog_compiler_wl_FC='-Wl,' + lt_prog_compiler_pic_FC='-fPIC' + lt_prog_compiler_static_FC='-static' + ;; + 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 -n 1,5p` 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' + ;; #( + *NAG\ Fortran\ Compiler*) + lt_prog_compiler_wl_FC='-Wl,-Wl,,' + lt_prog_compiler_pic_FC='-PIC' + lt_prog_compiler_static_FC='-Bstatic' + ;; + *PGI\ Compilers\ and\ Tools*|*NVIDIA\ Compilers\ and\ Tools*|*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 that 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" ## exclude from sc_useless_quotes_in_assignment + # 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 yes = "$lt_cv_prog_compiler_pic_works_FC"; 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 yes = "$lt_cv_prog_compiler_static_works_FC"; 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 no = "$lt_cv_prog_compiler_c_o_FC" && test no != "$need_locks"; 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 no = "$hard_links"; 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 yes != "$GCC"; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; + openbsd* | bitrig*) + 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 yes = "$with_gnu_ld"; 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 yes = "$lt_use_gnu_ld_interface"; 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 | $SED -e 's/(^)\+)\s\+//' 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 ia64 != "$host_cpu"; 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 <jrb3@best.com> 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, use it as + # is; otherwise, prepend EXPORTS... + archive_expsym_cmds_FC='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; 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 + ;; + + os2*) + hardcode_libdir_flag_spec_FC='-L$libdir' + hardcode_minus_L_FC=yes + allow_undefined_flag_FC=unsupported + shrext_cmds=.dll + archive_cmds_FC='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + archive_expsym_cmds_FC='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + prefix_cmds="$SED"~ + if test EXPORTS = "`$SED 1q $export_symbols`"; then + prefix_cmds="$prefix_cmds -e 1d"; + fi~ + prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ + cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + old_archive_From_new_cmds_FC='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' + enable_shared_with_static_runtimes_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 linux-dietlibc = "$host_os"; 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 no = "$tmp_diet" + then + tmp_addflag=' $pic_flag' + tmp_sharedflag='-shared' + tmp_compiler_flags='$compiler_flags' + 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' ;; + nagfor*) # NAGFOR 5.3 + tmp_sharedflag='-Wl,-shared' + tmp_compiler_flags='`echo $compiler_flags | sed -e '"'"'s/ -W[cl],-no-pie\b//g'"'"'`' ;; + 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 -n 1,5p` 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' ;; + *NAG\ Fortran\ Compiler*) + tmp_sharedflag='-Wl,-shared' + tmp_compiler_flags='`echo $compiler_flags | sed -e '"'"'s/ -W[cl],-no-pie\b//g'"'"'`' ;; + esac + archive_cmds_FC='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs '"$tmp_compiler_flags"' $wl-soname $wl$soname -o $lib' + + if test yes = "$supports_anon_versioning"; 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 '"$tmp_compiler_flags"' $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' + fi + + case $cc_basename in + tcc*) + export_dynamic_flag_spec_FC='-rdynamic' + ;; + 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 yes = "$supports_anon_versioning"; 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 cannot +*** 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 no = "$ld_shlibs_FC"; 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 yes = "$GCC" && 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 ia64 = "$host_cpu"; 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 GNU nm, but means don't demangle to AIX nm. + # Without the "-l" option, or with the "-B" option, AIX nm treats + # weak defined symbols like other global defined symbols, whereas + # GNU nm marks them as "W". + # While the 'weak' keyword is ignored in the Export File, we need + # it in the Import File for the 'aix-soname' feature, so we have + # to replace the "-B" option with "-P" for AIX nm. + 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) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds_FC='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | 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 + # have runtime linking enabled, and use it for executables. + # For shared libraries, we enable/disable runtime linking + # depending on the kind of the shared library created - + # when "with_aix_soname,aix_use_runtimelinking" is: + # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables + # "aix,yes" lib.so shared, rtl:yes, for executables + # lib.a static archive + # "both,no" lib.so.V(shr.o) shared, rtl:yes + # lib.a(lib.so.V) shared, rtl:no, for executables + # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables + # lib.a(lib.so.V) shared, rtl:no + # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables + # lib.a static archive + case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) + for ld_flag in $LDFLAGS; do + if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then + aix_use_runtimelinking=yes + break + fi + done + if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then + # With aix-soname=svr4, we create the lib.so.V shared archives only, + # so we don't have lib.a shared libs to link our executables. + # We have to force runtime linking in this case. + aix_use_runtimelinking=yes + LDFLAGS="$LDFLAGS -Wl,-brtl" + fi + ;; + 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,' + case $with_aix_soname,$aix_use_runtimelinking in + aix,*) ;; # traditional, no import file + svr4,* | *,yes) # use import file + # The Import File defines what to hardcode. + hardcode_direct_FC=no + hardcode_direct_absolute_FC=no + ;; + esac + + if test yes = "$GCC"; 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 yes = "$aix_use_runtimelinking"; then + shared_flag="$shared_flag "'$wl-G' + fi + # Need to ensure runtime linking is disabled for the traditional + # shared library, or the linker may eventually find shared libraries + # /with/ Import File - we do not want to mix them. + shared_flag_aix='-shared' + shared_flag_svr4='-shared $wl-G' + else + # not using gcc + if test ia64 = "$host_cpu"; 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 yes = "$aix_use_runtimelinking"; then + shared_flag='$wl-G' + else + shared_flag='$wl-bM:SRE' + fi + shared_flag_aix='$wl-bM:SRE' + shared_flag_svr4='$wl-G' + 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,yes = "$with_aix_soname,$aix_use_runtimelinking"; 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 set = "${lt_cv_aix_libpath+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 conftest + + 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 -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag + else + if test ia64 = "$host_cpu"; 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 set = "${lt_cv_aix_libpath+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 conftest + + 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 yes = "$with_gnu_ld"; 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 + archive_expsym_cmds_FC='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' + # -brtl affects multiple linker settings, -berok does not and is overridden later + compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([, ]\\)%-berok\\1%g"`' + if test svr4 != "$with_aix_soname"; then + # This is similar to how AIX traditionally builds its shared libraries. + archive_expsym_cmds_FC="$archive_expsym_cmds_FC"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' + fi + if test aix != "$with_aix_soname"; then + archive_expsym_cmds_FC="$archive_expsym_cmds_FC"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' + else + # used by -dlpreopen to get the symbols + archive_expsym_cmds_FC="$archive_expsym_cmds_FC"'~$MV $output_objdir/$realname.d/$soname $output_objdir' + fi + archive_expsym_cmds_FC="$archive_expsym_cmds_FC"'~$RM -r $output_objdir/$realname.d' + 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,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' + archive_expsym_cmds_FC='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then + cp "$export_symbols" "$output_objdir/$soname.def"; + echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; + else + $SED -e '\''s/^/-link -EXPORT:/'\'' < $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 yes = "$lt_cv_ld_force_load"; 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*|nagfor*) _lt_dar_can_shared=yes ;; + *) _lt_dar_can_shared=$GCC ;; + esac + if test yes = "$_lt_dar_can_shared"; 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 yes = "$GCC"; 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 "x$output_objdir/$soname" = "x$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 "x$output_objdir/$soname" = "x$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 yes,no = "$GCC,$with_gnu_ld"; 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 no = "$with_gnu_ld"; 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 yes,no = "$GCC,$with_gnu_ld"; 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 no = "$with_gnu_ld"; 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 yes = "$GCC"; 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 yes = "$lt_cv_irix_exported_symbol"; 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 + ;; + + linux*) + case $cc_basename in + tcc*) + # Fabrice Bellard et al's Tiny C Compiler + ld_shlibs_FC=yes + archive_cmds_FC='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + + 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* | bitrig*) + 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__`"; 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 + archive_cmds_FC='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec_FC='$wl-rpath,$libdir' + 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 + shrext_cmds=.dll + archive_cmds_FC='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + archive_expsym_cmds_FC='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + prefix_cmds="$SED"~ + if test EXPORTS = "`$SED 1q $export_symbols`"; then + prefix_cmds="$prefix_cmds -e 1d"; + fi~ + prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ + cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + old_archive_From_new_cmds_FC='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' + enable_shared_with_static_runtimes_FC=yes + ;; + + osf3*) + if test yes = "$GCC"; 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 yes = "$GCC"; 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 yes = "$GCC"; 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 yes = "$GCC"; 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 sequent = "$host_vendor"; 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 yes = "$GCC"; 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 CANNOT 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 yes = "$GCC"; 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 sni = "$host_vendor"; 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 no = "$ld_shlibs_FC" && 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 yes,yes = "$GCC,$enable_shared"; 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 ia64 = "$host_cpu"; 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 + # Using Import Files as archive members, it is possible to support + # filename-based versioning of shared library archives on AIX. While + # this would work for both with and without runtime linking, it will + # prevent static linking of such archives. So we do filename-based + # shared library versioning with .so extension only, which is used + # when both runtime linking and shared linking is enabled. + # Unfortunately, runtime linking may impact performance, so we do + # not want this to be the default eventually. Also, we use the + # versioned .so libs for executables only if there is the -brtl + # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. + # To allow for filename-based versioning support, we need to create + # libNAME.so.V as an archive file, containing: + # *) an Import File, referring to the versioned filename of the + # archive as well as the shared archive member, telling the + # bitwidth (32 or 64) of that shared object, and providing the + # list of exported symbols of that shared object, eventually + # decorated with the 'weak' keyword + # *) the shared object with the F_LOADONLY flag set, to really avoid + # it being seen by the linker. + # At run time we better use the real file rather than another symlink, + # but for link time we create the symlink libNAME.so -> libNAME.so.V + + case $with_aix_soname,$aix_use_runtimelinking in + # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + aix,yes) # traditional libtool + dynamic_linker='AIX unversionable lib.so' + # If using run time linking (on AIX 4.2 or later) use lib<name>.so + # instead of lib<name>.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + ;; + aix,no) # traditional AIX only + dynamic_linker='AIX lib.a(lib.so.V)' + # 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' + ;; + svr4,*) # full svr4 only + dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o)" + library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' + # We do not specify a path in Import Files, so LIBPATH fires. + shlibpath_overrides_runpath=yes + ;; + *,yes) # both, prefer svr4 + dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o), lib.a(lib.so.V)" + library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' + # unpreferred sharedlib libNAME.a needs extra handling + postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' + postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' + # We do not specify a path in Import Files, so LIBPATH fires. + shlibpath_overrides_runpath=yes + ;; + *,no) # both, prefer aix + dynamic_linker="AIX lib.a(lib.so.V), lib.so.V($shared_archive_member_spec.o)" + library_names_spec='$libname$release.a $libname.a' + soname_spec='$libname$release$shared_ext$major' + # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling + postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' + postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' + ;; + esac + 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%'\''`; $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$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + 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 + ;; + +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=no + 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 32 = "$HPUX_IA64_MODE"; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + sys_lib_dlsearch_path_spec=/usr/lib/hpux32 + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + sys_lib_dlsearch_path_spec=/usr/lib/hpux64 + fi + ;; + 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 yes = "$lt_cv_prog_gnu_ld"; 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 + ;; + +linux*android*) + version_type=none # Android doesn't support versioned libraries. + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext' + soname_spec='$libname$release$shared_ext' + finish_cmds= + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + + # 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 + + dynamic_linker='Android linker' + # Don't embed -rpath directories since the linker doesn't support them. + hardcode_libdir_flag_spec_FC='-L$libdir' + ;; + +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu | 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 conftest + + 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 + + # Ideally, we could use ldconfig to report *all* directores which are + # searched for libraries, however this is still not possible. Aside from not + # being certain /sbin/ldconfig is available, command + # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, + # even though it is searched at run-time. Try to do the best guess by + # appending ld.so.conf contents (and includes) to the search path. + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +*nto* | *qnx*) + version_type=qnx + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='ldqnx.so' + ;; + +openbsd* | bitrig*) + version_type=sunos + sys_lib_dlsearch_path_spec=/usr/lib + need_lib_prefix=no + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then + need_version=no + else + need_version=yes + fi + 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 + shlibpath_overrides_runpath=yes + ;; + +os2*) + libname_spec='$name' + version_type=windows + shrext_cmds=.dll + need_version=no + need_lib_prefix=no + # OS/2 can only load a DLL with a base name of 8 characters or less. + soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; + v=$($ECHO $release$versuffix | tr -d .-); + n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); + $ECHO $n$v`$shared_ext' + library_names_spec='${libname}_dll.$libext' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=BEGINLIBPATH + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + 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' + ;; + +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 yes = "$with_gnu_ld"; 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=sco + 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 yes = "$with_gnu_ld"; 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 no = "$dynamic_linker" && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test yes = "$GCC"; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then + sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec +fi + +if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then + sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec +fi + +# remember unaugmented sys_lib_dlsearch_path content for libtool script decls... +configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec + +# ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code +func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" + +# to be used as default LT_SYS_LIBRARY_PATH value in generated libtool +configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $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 yes = "$hardcode_automatic_FC"; then + + # We can hardcode non-existent directories. + if test no != "$hardcode_direct_FC" && + # 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 no != "$_LT_TAGVAR(hardcode_shlibpath_var, FC)" && + test no != "$hardcode_minus_L_FC"; 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 relink = "$hardcode_action_FC" || + test yes = "$inherit_rpath_FC"; then + # Fast installation is not supported + enable_fast_install=no +elif test yes = "$shlibpath_overrides_runpath" || + test no = "$enable_shared"; then + # Fast installation is not necessary + enable_fast_install=needless +fi + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether this is the NAG Fortran compiler" >&5 +$as_echo_n "checking whether this is the NAG Fortran compiler... " >&6; } + $CC -V 2>&1 | grep '^NAG Fortran Compiler Release' >/dev/null 2>&1 + _lt_result=$? + if test $_lt_result -eq 0; then : + _lt_result=yes +else + _lt_result=no +fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_lt_result" >&5 +$as_echo "$_lt_result" >&6; } + acx_is_nagfor_FC=$_lt_result + + + + fi # test -n "$compiler" + + GCC=$lt_save_GCC + CC=$lt_save_CC + CFLAGS=$lt_save_CFLAGS +fi # test yes != "$_lt_disable_FC" + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + + + + + + + ac_config_commands="$ac_config_commands libtool" + + + + +# Only expand once: + + + ## _KPSE_USE_LIBTOOL: Generate a libtool script for use in configure tests +: ${CONFIG_LT=./config.lt} +{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_LT" >&5 +$as_echo "$as_me: creating $CONFIG_LT" >&6;} +as_write_fail=0 +cat >"$CONFIG_LT" <<_ASEOF || as_write_fail=1 +#! $SHELL +# Generated by $as_me. +# Run this file to recreate a libtool stub with the current configuration. +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>"$CONFIG_LT" <<\_ASEOF || as_write_fail=1 +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 +## --------------------------------- ## +## Main body of "$CONFIG_LT" script. ## +## --------------------------------- ## +_ASEOF +test $as_write_fail = 0 && chmod +x "$CONFIG_LT" + +cat >>"$CONFIG_LT" <<\_LTEOF +lt_cl_silent=false +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX +} >&5 + +lt_cl_help="\ +'$as_me' creates a local libtool stub from the current configuration, +for use in further configure time tests before the real libtool is +generated. + +Usage: $0 [OPTIONS] + + -h, --help print this help, then exit + -V, --version print version number, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + +Report bugs to <bug-libtool@gnu.org>." + +lt_cl_version="\ +cdi config.lt 2.2.0 +configured by $0, generated by GNU Autoconf 2.69. + +Copyright (C) 2011 Free Software Foundation, Inc. +This config.lt script is free software; the Free Software Foundation +gives unlimited permision to copy, distribute and modify it." + +while test 0 != $# +do + case $1 in + --version | --v* | -V ) + echo "$lt_cl_version"; exit 0 ;; + --help | --h* | -h ) + echo "$lt_cl_help"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --quiet | --q* | --silent | --s* | -q ) + lt_cl_silent=: ;; + + -*) as_fn_error $? "unrecognized option: $1 +Try '$0 --help' for more information." "$LINENO" 5 ;; + + *) as_fn_error $? "unrecognized argument: $1 +Try '$0 --help' for more information." "$LINENO" 5 ;; + esac + shift +done + +if $lt_cl_silent; then + exec 6>/dev/null +fi +_LTEOF + +cat >>"$CONFIG_LT" <<_LTEOF + + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +sed_quote_subst='$sed_quote_subst' +double_quote_subst='$double_quote_subst' +delay_variable_subst='$delay_variable_subst' +macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' +macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' +pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' +enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' +enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' +enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' +shared_archive_member_spec='`$ECHO "$shared_archive_member_spec" | $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_import='`$ECHO "$lt_cv_sys_global_symbol_to_import" | $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"`' +lt_cv_nm_interface='`$ECHO "$lt_cv_nm_interface" | $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"`' +lt_cv_truncate_bin='`$ECHO "$lt_cv_truncate_bin" | $SED "$delay_single_quote_subst"`' +objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' +MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' +acx_is_nagfor='`$ECHO "$acx_is_nagfor" | $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"`' +configure_time_dlsearch_path='`$ECHO "$configure_time_dlsearch_path" | $SED "$delay_single_quote_subst"`' +configure_time_lt_sys_library_path='`$ECHO "$configure_time_lt_sys_library_path" | $SED "$delay_single_quote_subst"`' +hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' +enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' +enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' +enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' +old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' +striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' +compiler_lib_search_dirs='`$ECHO "$compiler_lib_search_dirs" | $SED "$delay_single_quote_subst"`' +predep_objects='`$ECHO "$predep_objects" | $SED "$delay_single_quote_subst"`' +postdep_objects='`$ECHO "$postdep_objects" | $SED "$delay_single_quote_subst"`' +predeps='`$ECHO "$predeps" | $SED "$delay_single_quote_subst"`' +postdeps='`$ECHO "$postdeps" | $SED "$delay_single_quote_subst"`' +compiler_lib_search_path='`$ECHO "$compiler_lib_search_path" | $SED "$delay_single_quote_subst"`' +LD_CXX='`$ECHO "$LD_CXX" | $SED "$delay_single_quote_subst"`' +LD_F77='`$ECHO "$LD_F77" | $SED "$delay_single_quote_subst"`' +LD_FC='`$ECHO "$LD_FC" | $SED "$delay_single_quote_subst"`' +reload_flag_CXX='`$ECHO "$reload_flag_CXX" | $SED "$delay_single_quote_subst"`' +reload_flag_F77='`$ECHO "$reload_flag_F77" | $SED "$delay_single_quote_subst"`' +reload_flag_FC='`$ECHO "$reload_flag_FC" | $SED "$delay_single_quote_subst"`' +reload_cmds_CXX='`$ECHO "$reload_cmds_CXX" | $SED "$delay_single_quote_subst"`' +reload_cmds_F77='`$ECHO "$reload_cmds_F77" | $SED "$delay_single_quote_subst"`' +reload_cmds_FC='`$ECHO "$reload_cmds_FC" | $SED "$delay_single_quote_subst"`' +old_archive_cmds_CXX='`$ECHO "$old_archive_cmds_CXX" | $SED "$delay_single_quote_subst"`' +old_archive_cmds_F77='`$ECHO "$old_archive_cmds_F77" | $SED "$delay_single_quote_subst"`' +old_archive_cmds_FC='`$ECHO "$old_archive_cmds_FC" | $SED "$delay_single_quote_subst"`' +compiler_CXX='`$ECHO "$compiler_CXX" | $SED "$delay_single_quote_subst"`' +compiler_F77='`$ECHO "$compiler_F77" | $SED "$delay_single_quote_subst"`' +compiler_FC='`$ECHO "$compiler_FC" | $SED "$delay_single_quote_subst"`' +GCC_CXX='`$ECHO "$GCC_CXX" | $SED "$delay_single_quote_subst"`' +GCC_F77='`$ECHO "$GCC_F77" | $SED "$delay_single_quote_subst"`' +GCC_FC='`$ECHO "$GCC_FC" | $SED "$delay_single_quote_subst"`' +acx_is_nagfor_CXX='`$ECHO "$acx_is_nagfor_CXX" | $SED "$delay_single_quote_subst"`' +acx_is_nagfor_F77='`$ECHO "$acx_is_nagfor_F77" | $SED "$delay_single_quote_subst"`' +acx_is_nagfor_FC='`$ECHO "$acx_is_nagfor_FC" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_no_builtin_flag_CXX='`$ECHO "$lt_prog_compiler_no_builtin_flag_CXX" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_no_builtin_flag_F77='`$ECHO "$lt_prog_compiler_no_builtin_flag_F77" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_no_builtin_flag_FC='`$ECHO "$lt_prog_compiler_no_builtin_flag_FC" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_pic_CXX='`$ECHO "$lt_prog_compiler_pic_CXX" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_pic_F77='`$ECHO "$lt_prog_compiler_pic_F77" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_pic_FC='`$ECHO "$lt_prog_compiler_pic_FC" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_wl_CXX='`$ECHO "$lt_prog_compiler_wl_CXX" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_wl_F77='`$ECHO "$lt_prog_compiler_wl_F77" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_wl_FC='`$ECHO "$lt_prog_compiler_wl_FC" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_static_CXX='`$ECHO "$lt_prog_compiler_static_CXX" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_static_F77='`$ECHO "$lt_prog_compiler_static_F77" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_static_FC='`$ECHO "$lt_prog_compiler_static_FC" | $SED "$delay_single_quote_subst"`' +lt_cv_prog_compiler_c_o_CXX='`$ECHO "$lt_cv_prog_compiler_c_o_CXX" | $SED "$delay_single_quote_subst"`' +lt_cv_prog_compiler_c_o_F77='`$ECHO "$lt_cv_prog_compiler_c_o_F77" | $SED "$delay_single_quote_subst"`' +lt_cv_prog_compiler_c_o_FC='`$ECHO "$lt_cv_prog_compiler_c_o_FC" | $SED "$delay_single_quote_subst"`' +archive_cmds_need_lc_CXX='`$ECHO "$archive_cmds_need_lc_CXX" | $SED "$delay_single_quote_subst"`' +archive_cmds_need_lc_F77='`$ECHO "$archive_cmds_need_lc_F77" | $SED "$delay_single_quote_subst"`' +archive_cmds_need_lc_FC='`$ECHO "$archive_cmds_need_lc_FC" | $SED "$delay_single_quote_subst"`' +enable_shared_with_static_runtimes_CXX='`$ECHO "$enable_shared_with_static_runtimes_CXX" | $SED "$delay_single_quote_subst"`' +enable_shared_with_static_runtimes_F77='`$ECHO "$enable_shared_with_static_runtimes_F77" | $SED "$delay_single_quote_subst"`' +enable_shared_with_static_runtimes_FC='`$ECHO "$enable_shared_with_static_runtimes_FC" | $SED "$delay_single_quote_subst"`' +export_dynamic_flag_spec_CXX='`$ECHO "$export_dynamic_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' +export_dynamic_flag_spec_F77='`$ECHO "$export_dynamic_flag_spec_F77" | $SED "$delay_single_quote_subst"`' +export_dynamic_flag_spec_FC='`$ECHO "$export_dynamic_flag_spec_FC" | $SED "$delay_single_quote_subst"`' +whole_archive_flag_spec_CXX='`$ECHO "$whole_archive_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' +whole_archive_flag_spec_F77='`$ECHO "$whole_archive_flag_spec_F77" | $SED "$delay_single_quote_subst"`' +whole_archive_flag_spec_FC='`$ECHO "$whole_archive_flag_spec_FC" | $SED "$delay_single_quote_subst"`' +compiler_needs_object_CXX='`$ECHO "$compiler_needs_object_CXX" | $SED "$delay_single_quote_subst"`' +compiler_needs_object_F77='`$ECHO "$compiler_needs_object_F77" | $SED "$delay_single_quote_subst"`' +compiler_needs_object_FC='`$ECHO "$compiler_needs_object_FC" | $SED "$delay_single_quote_subst"`' +old_archive_from_new_cmds_CXX='`$ECHO "$old_archive_from_new_cmds_CXX" | $SED "$delay_single_quote_subst"`' +old_archive_from_new_cmds_F77='`$ECHO "$old_archive_from_new_cmds_F77" | $SED "$delay_single_quote_subst"`' +old_archive_from_new_cmds_FC='`$ECHO "$old_archive_from_new_cmds_FC" | $SED "$delay_single_quote_subst"`' +old_archive_from_expsyms_cmds_CXX='`$ECHO "$old_archive_from_expsyms_cmds_CXX" | $SED "$delay_single_quote_subst"`' +old_archive_from_expsyms_cmds_F77='`$ECHO "$old_archive_from_expsyms_cmds_F77" | $SED "$delay_single_quote_subst"`' +old_archive_from_expsyms_cmds_FC='`$ECHO "$old_archive_from_expsyms_cmds_FC" | $SED "$delay_single_quote_subst"`' +archive_cmds_CXX='`$ECHO "$archive_cmds_CXX" | $SED "$delay_single_quote_subst"`' +archive_cmds_F77='`$ECHO "$archive_cmds_F77" | $SED "$delay_single_quote_subst"`' +archive_cmds_FC='`$ECHO "$archive_cmds_FC" | $SED "$delay_single_quote_subst"`' +archive_expsym_cmds_CXX='`$ECHO "$archive_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`' +archive_expsym_cmds_F77='`$ECHO "$archive_expsym_cmds_F77" | $SED "$delay_single_quote_subst"`' +archive_expsym_cmds_FC='`$ECHO "$archive_expsym_cmds_FC" | $SED "$delay_single_quote_subst"`' +module_cmds_CXX='`$ECHO "$module_cmds_CXX" | $SED "$delay_single_quote_subst"`' +module_cmds_F77='`$ECHO "$module_cmds_F77" | $SED "$delay_single_quote_subst"`' +module_cmds_FC='`$ECHO "$module_cmds_FC" | $SED "$delay_single_quote_subst"`' +module_expsym_cmds_CXX='`$ECHO "$module_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`' +module_expsym_cmds_F77='`$ECHO "$module_expsym_cmds_F77" | $SED "$delay_single_quote_subst"`' +module_expsym_cmds_FC='`$ECHO "$module_expsym_cmds_FC" | $SED "$delay_single_quote_subst"`' +with_gnu_ld_CXX='`$ECHO "$with_gnu_ld_CXX" | $SED "$delay_single_quote_subst"`' +with_gnu_ld_F77='`$ECHO "$with_gnu_ld_F77" | $SED "$delay_single_quote_subst"`' +with_gnu_ld_FC='`$ECHO "$with_gnu_ld_FC" | $SED "$delay_single_quote_subst"`' +allow_undefined_flag_CXX='`$ECHO "$allow_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`' +allow_undefined_flag_F77='`$ECHO "$allow_undefined_flag_F77" | $SED "$delay_single_quote_subst"`' +allow_undefined_flag_FC='`$ECHO "$allow_undefined_flag_FC" | $SED "$delay_single_quote_subst"`' +no_undefined_flag_CXX='`$ECHO "$no_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`' +no_undefined_flag_F77='`$ECHO "$no_undefined_flag_F77" | $SED "$delay_single_quote_subst"`' +no_undefined_flag_FC='`$ECHO "$no_undefined_flag_FC" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_flag_spec_CXX='`$ECHO "$hardcode_libdir_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_flag_spec_F77='`$ECHO "$hardcode_libdir_flag_spec_F77" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_flag_spec_FC='`$ECHO "$hardcode_libdir_flag_spec_FC" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_separator_CXX='`$ECHO "$hardcode_libdir_separator_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_separator_F77='`$ECHO "$hardcode_libdir_separator_F77" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_separator_FC='`$ECHO "$hardcode_libdir_separator_FC" | $SED "$delay_single_quote_subst"`' +hardcode_direct_CXX='`$ECHO "$hardcode_direct_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_direct_F77='`$ECHO "$hardcode_direct_F77" | $SED "$delay_single_quote_subst"`' +hardcode_direct_FC='`$ECHO "$hardcode_direct_FC" | $SED "$delay_single_quote_subst"`' +hardcode_direct_absolute_CXX='`$ECHO "$hardcode_direct_absolute_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_direct_absolute_F77='`$ECHO "$hardcode_direct_absolute_F77" | $SED "$delay_single_quote_subst"`' +hardcode_direct_absolute_FC='`$ECHO "$hardcode_direct_absolute_FC" | $SED "$delay_single_quote_subst"`' +hardcode_minus_L_CXX='`$ECHO "$hardcode_minus_L_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_minus_L_F77='`$ECHO "$hardcode_minus_L_F77" | $SED "$delay_single_quote_subst"`' +hardcode_minus_L_FC='`$ECHO "$hardcode_minus_L_FC" | $SED "$delay_single_quote_subst"`' +hardcode_shlibpath_var_CXX='`$ECHO "$hardcode_shlibpath_var_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_shlibpath_var_F77='`$ECHO "$hardcode_shlibpath_var_F77" | $SED "$delay_single_quote_subst"`' +hardcode_shlibpath_var_FC='`$ECHO "$hardcode_shlibpath_var_FC" | $SED "$delay_single_quote_subst"`' +hardcode_automatic_CXX='`$ECHO "$hardcode_automatic_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_automatic_F77='`$ECHO "$hardcode_automatic_F77" | $SED "$delay_single_quote_subst"`' +hardcode_automatic_FC='`$ECHO "$hardcode_automatic_FC" | $SED "$delay_single_quote_subst"`' +inherit_rpath_CXX='`$ECHO "$inherit_rpath_CXX" | $SED "$delay_single_quote_subst"`' +inherit_rpath_F77='`$ECHO "$inherit_rpath_F77" | $SED "$delay_single_quote_subst"`' +inherit_rpath_FC='`$ECHO "$inherit_rpath_FC" | $SED "$delay_single_quote_subst"`' +link_all_deplibs_CXX='`$ECHO "$link_all_deplibs_CXX" | $SED "$delay_single_quote_subst"`' +link_all_deplibs_F77='`$ECHO "$link_all_deplibs_F77" | $SED "$delay_single_quote_subst"`' +link_all_deplibs_FC='`$ECHO "$link_all_deplibs_FC" | $SED "$delay_single_quote_subst"`' +always_export_symbols_CXX='`$ECHO "$always_export_symbols_CXX" | $SED "$delay_single_quote_subst"`' +always_export_symbols_F77='`$ECHO "$always_export_symbols_F77" | $SED "$delay_single_quote_subst"`' +always_export_symbols_FC='`$ECHO "$always_export_symbols_FC" | $SED "$delay_single_quote_subst"`' +export_symbols_cmds_CXX='`$ECHO "$export_symbols_cmds_CXX" | $SED "$delay_single_quote_subst"`' +export_symbols_cmds_F77='`$ECHO "$export_symbols_cmds_F77" | $SED "$delay_single_quote_subst"`' +export_symbols_cmds_FC='`$ECHO "$export_symbols_cmds_FC" | $SED "$delay_single_quote_subst"`' +exclude_expsyms_CXX='`$ECHO "$exclude_expsyms_CXX" | $SED "$delay_single_quote_subst"`' +exclude_expsyms_F77='`$ECHO "$exclude_expsyms_F77" | $SED "$delay_single_quote_subst"`' +exclude_expsyms_FC='`$ECHO "$exclude_expsyms_FC" | $SED "$delay_single_quote_subst"`' +include_expsyms_CXX='`$ECHO "$include_expsyms_CXX" | $SED "$delay_single_quote_subst"`' +include_expsyms_F77='`$ECHO "$include_expsyms_F77" | $SED "$delay_single_quote_subst"`' +include_expsyms_FC='`$ECHO "$include_expsyms_FC" | $SED "$delay_single_quote_subst"`' +prelink_cmds_CXX='`$ECHO "$prelink_cmds_CXX" | $SED "$delay_single_quote_subst"`' +prelink_cmds_F77='`$ECHO "$prelink_cmds_F77" | $SED "$delay_single_quote_subst"`' +prelink_cmds_FC='`$ECHO "$prelink_cmds_FC" | $SED "$delay_single_quote_subst"`' +postlink_cmds_CXX='`$ECHO "$postlink_cmds_CXX" | $SED "$delay_single_quote_subst"`' +postlink_cmds_F77='`$ECHO "$postlink_cmds_F77" | $SED "$delay_single_quote_subst"`' +postlink_cmds_FC='`$ECHO "$postlink_cmds_FC" | $SED "$delay_single_quote_subst"`' +file_list_spec_CXX='`$ECHO "$file_list_spec_CXX" | $SED "$delay_single_quote_subst"`' +file_list_spec_F77='`$ECHO "$file_list_spec_F77" | $SED "$delay_single_quote_subst"`' +file_list_spec_FC='`$ECHO "$file_list_spec_FC" | $SED "$delay_single_quote_subst"`' +hardcode_action_CXX='`$ECHO "$hardcode_action_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_action_F77='`$ECHO "$hardcode_action_F77" | $SED "$delay_single_quote_subst"`' +hardcode_action_FC='`$ECHO "$hardcode_action_FC" | $SED "$delay_single_quote_subst"`' +compiler_lib_search_dirs_CXX='`$ECHO "$compiler_lib_search_dirs_CXX" | $SED "$delay_single_quote_subst"`' +compiler_lib_search_dirs_F77='`$ECHO "$compiler_lib_search_dirs_F77" | $SED "$delay_single_quote_subst"`' +compiler_lib_search_dirs_FC='`$ECHO "$compiler_lib_search_dirs_FC" | $SED "$delay_single_quote_subst"`' +predep_objects_CXX='`$ECHO "$predep_objects_CXX" | $SED "$delay_single_quote_subst"`' +predep_objects_F77='`$ECHO "$predep_objects_F77" | $SED "$delay_single_quote_subst"`' +predep_objects_FC='`$ECHO "$predep_objects_FC" | $SED "$delay_single_quote_subst"`' +postdep_objects_CXX='`$ECHO "$postdep_objects_CXX" | $SED "$delay_single_quote_subst"`' +postdep_objects_F77='`$ECHO "$postdep_objects_F77" | $SED "$delay_single_quote_subst"`' +postdep_objects_FC='`$ECHO "$postdep_objects_FC" | $SED "$delay_single_quote_subst"`' +predeps_CXX='`$ECHO "$predeps_CXX" | $SED "$delay_single_quote_subst"`' +predeps_F77='`$ECHO "$predeps_F77" | $SED "$delay_single_quote_subst"`' +predeps_FC='`$ECHO "$predeps_FC" | $SED "$delay_single_quote_subst"`' +postdeps_CXX='`$ECHO "$postdeps_CXX" | $SED "$delay_single_quote_subst"`' +postdeps_F77='`$ECHO "$postdeps_F77" | $SED "$delay_single_quote_subst"`' +postdeps_FC='`$ECHO "$postdeps_FC" | $SED "$delay_single_quote_subst"`' +compiler_lib_search_path_CXX='`$ECHO "$compiler_lib_search_path_CXX" | $SED "$delay_single_quote_subst"`' +compiler_lib_search_path_F77='`$ECHO "$compiler_lib_search_path_F77" | $SED "$delay_single_quote_subst"`' +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_import \ +lt_cv_sys_global_symbol_to_c_name_address \ +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ +lt_cv_nm_interface \ +nm_file_list_spec \ +lt_cv_truncate_bin \ +lt_prog_compiler_no_builtin_flag \ +lt_prog_compiler_pic \ +lt_prog_compiler_wl \ +lt_prog_compiler_static \ +lt_cv_prog_compiler_c_o \ +need_locks \ +MANIFEST_TOOL \ +DSYMUTIL \ +NMEDIT \ +LIPO \ +OTOOL \ +OTOOL64 \ +shrext_cmds \ +export_dynamic_flag_spec \ +whole_archive_flag_spec \ +compiler_needs_object \ +with_gnu_ld \ +allow_undefined_flag \ +no_undefined_flag \ +hardcode_libdir_flag_spec \ +hardcode_libdir_separator \ +exclude_expsyms \ +include_expsyms \ +file_list_spec \ +variables_saved_for_relink \ +libname_spec \ +library_names_spec \ +soname_spec \ +install_override_mode \ +finish_eval \ +old_striplib \ +striplib \ +compiler_lib_search_dirs \ +predep_objects \ +postdep_objects \ +predeps \ +postdeps \ +compiler_lib_search_path \ +LD_CXX \ +LD_F77 \ +LD_FC \ +reload_flag_CXX \ +reload_flag_F77 \ +reload_flag_FC \ +compiler_CXX \ +compiler_F77 \ +compiler_FC \ +lt_prog_compiler_no_builtin_flag_CXX \ +lt_prog_compiler_no_builtin_flag_F77 \ +lt_prog_compiler_no_builtin_flag_FC \ +lt_prog_compiler_pic_CXX \ +lt_prog_compiler_pic_F77 \ +lt_prog_compiler_pic_FC \ +lt_prog_compiler_wl_CXX \ +lt_prog_compiler_wl_F77 \ +lt_prog_compiler_wl_FC \ +lt_prog_compiler_static_CXX \ +lt_prog_compiler_static_F77 \ +lt_prog_compiler_static_FC \ +lt_cv_prog_compiler_c_o_CXX \ +lt_cv_prog_compiler_c_o_F77 \ +lt_cv_prog_compiler_c_o_FC \ +export_dynamic_flag_spec_CXX \ +export_dynamic_flag_spec_F77 \ +export_dynamic_flag_spec_FC \ +whole_archive_flag_spec_CXX \ +whole_archive_flag_spec_F77 \ +whole_archive_flag_spec_FC \ +compiler_needs_object_CXX \ +compiler_needs_object_F77 \ +compiler_needs_object_FC \ +with_gnu_ld_CXX \ +with_gnu_ld_F77 \ +with_gnu_ld_FC \ +allow_undefined_flag_CXX \ +allow_undefined_flag_F77 \ +allow_undefined_flag_FC \ +no_undefined_flag_CXX \ +no_undefined_flag_F77 \ +no_undefined_flag_FC \ +hardcode_libdir_flag_spec_CXX \ +hardcode_libdir_flag_spec_F77 \ +hardcode_libdir_flag_spec_FC \ +hardcode_libdir_separator_CXX \ +hardcode_libdir_separator_F77 \ +hardcode_libdir_separator_FC \ +exclude_expsyms_CXX \ +exclude_expsyms_F77 \ +exclude_expsyms_FC \ +include_expsyms_CXX \ +include_expsyms_F77 \ +include_expsyms_FC \ +file_list_spec_CXX \ +file_list_spec_F77 \ +file_list_spec_FC \ +compiler_lib_search_dirs_CXX \ +compiler_lib_search_dirs_F77 \ +compiler_lib_search_dirs_FC \ +predep_objects_CXX \ +predep_objects_F77 \ +predep_objects_FC \ +postdep_objects_CXX \ +postdep_objects_F77 \ +postdep_objects_FC \ +predeps_CXX \ +predeps_F77 \ +predeps_FC \ +postdeps_CXX \ +postdeps_F77 \ +postdeps_FC \ +compiler_lib_search_path_CXX \ +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\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes + ;; + *) + 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 \ +configure_time_dlsearch_path \ +configure_time_lt_sys_library_path \ +reload_cmds_CXX \ +reload_cmds_F77 \ +reload_cmds_FC \ +old_archive_cmds_CXX \ +old_archive_cmds_F77 \ +old_archive_cmds_FC \ +old_archive_from_new_cmds_CXX \ +old_archive_from_new_cmds_F77 \ +old_archive_from_new_cmds_FC \ +old_archive_from_expsyms_cmds_CXX \ +old_archive_from_expsyms_cmds_F77 \ +old_archive_from_expsyms_cmds_FC \ +archive_cmds_CXX \ +archive_cmds_F77 \ +archive_cmds_FC \ +archive_expsym_cmds_CXX \ +archive_expsym_cmds_F77 \ +archive_expsym_cmds_FC \ +module_cmds_CXX \ +module_cmds_F77 \ +module_cmds_FC \ +module_expsym_cmds_CXX \ +module_expsym_cmds_F77 \ +module_expsym_cmds_FC \ +export_symbols_cmds_CXX \ +export_symbols_cmds_F77 \ +export_symbols_cmds_FC \ +prelink_cmds_CXX \ +prelink_cmds_F77 \ +prelink_cmds_FC \ +postlink_cmds_CXX \ +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\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +ac_aux_dir='$ac_aux_dir' + +# See if we are running on zsh, and set the options that 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' + RM='$RM' + ofile='$ofile' + + + + + + + + + +_LTEOF + +cat >>"$CONFIG_LT" <<\_LTEOF +{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $ofile" >&5 +$as_echo "$as_me: creating $ofile" >&6;} + + + # See if we are running on zsh, and set the options that 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 +# Generated automatically by $as_me ($PACKAGE) $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. + +# Provide generalized library-building support services. +# Written by Gordon Matzigkeit, 1996 + +# Copyright (C) 2014 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 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 this program. If not, see <http://www.gnu.org/licenses/>. + + +# The names of the tagged configurations supported by this script. +available_tags='CXX F77 FC ' + +# Configured defaults for sys_lib_dlsearch_path munging. +: \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"} + +# ### BEGIN LIBTOOL CONFIG + +# Which release of libtool.m4 was used? +macro_version=$macro_version +macro_revision=$macro_revision + +# What type of objects to build. +pic_mode=$pic_mode + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# Shared archive member basename,for filename based shared library versioning on AIX. +shared_archive_member_spec=$shared_archive_member_spec + +# 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 into a list of symbols to manually relocate. +global_symbol_to_import=$lt_lt_cv_sys_global_symbol_to_import + +# 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 + +# The name lister interface. +nm_interface=$lt_lt_cv_nm_interface + +# 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 where our libraries should be installed. +lt_sysroot=$lt_sysroot + +# Command to truncate a binary pipe. +lt_truncate_bin=$lt_lt_cv_truncate_bin + +# 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 + +# Detected run-time system search path for libraries. +sys_lib_dlsearch_path_spec=$lt_configure_time_dlsearch_path + +# Explicit LT_SYS_LIBRARY_PATH set during ./configure time. +configure_time_lt_sys_library_path=$lt_configure_time_lt_sys_library_path + +# 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 + +# Is the compiler the NAG Fortran compiler? +with_nagfor=$acx_is_nagfor + +# 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 + + cat <<'_LT_EOF' >> "$cfgfile" + +# ### BEGIN FUNCTIONS SHARED WITH CONFIGURE + +# func_munge_path_list VARIABLE PATH +# ----------------------------------- +# VARIABLE is name of variable containing _space_ separated list of +# directories to be munged by the contents of PATH, which is string +# having a format: +# "DIR[:DIR]:" +# string "DIR[ DIR]" will be prepended to VARIABLE +# ":DIR[:DIR]" +# string "DIR[ DIR]" will be appended to VARIABLE +# "DIRP[:DIRP]::[DIRA:]DIRA" +# string "DIRP[ DIRP]" will be prepended to VARIABLE and string +# "DIRA[ DIRA]" will be appended to VARIABLE +# "DIR[:DIR]" +# VARIABLE will be replaced by "DIR[ DIR]" +func_munge_path_list () +{ + case x$2 in + x) + ;; + *:) + eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" + ;; + x:*) + eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" + ;; + *::*) + eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" + eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" + ;; + *) + eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" + ;; + esac +} + + +# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. +func_cc_basename () +{ + for cc_temp in $*""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac + done + func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` +} + + +# ### END FUNCTIONS SHARED WITH CONFIGURE + +_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 set != "${COLLECT_NAMES+set}"; 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) + + mv -f "$cfgfile" "$ofile" || + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" + + + cat <<_LT_EOF >> "$ofile" + +# ### BEGIN LIBTOOL TAG CONFIG: CXX + +# The linker used to build libraries. +LD=$lt_LD_CXX + +# How to create reloadable object files. +reload_flag=$lt_reload_flag_CXX +reload_cmds=$lt_reload_cmds_CXX + +# Commands used to build an old-style archive. +old_archive_cmds=$lt_old_archive_cmds_CXX + +# A language specific compiler. +CC=$lt_compiler_CXX + +# Is the compiler the GNU compiler? +with_gcc=$GCC_CXX + +# Is the compiler the NAG Fortran compiler? +with_nagfor=$acx_is_nagfor_CXX + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic_CXX + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl_CXX + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static_CXX + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_CXX + +# Whether or not to disallow shared libs when runtime libs are static. +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX + +# Whether the compiler copes with passing no objects directly. +compiler_needs_object=$lt_compiler_needs_object_CXX + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX + +# Commands used to build a shared archive. +archive_cmds=$lt_archive_cmds_CXX +archive_expsym_cmds=$lt_archive_expsym_cmds_CXX + +# Commands used to build a loadable module if different from building +# a shared archive. +module_cmds=$lt_module_cmds_CXX +module_expsym_cmds=$lt_module_expsym_cmds_CXX + +# Whether we are building with GNU ld or not. +with_gnu_ld=$lt_with_gnu_ld_CXX + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag_CXX + +# Flag that enforces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag_CXX + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX + +# Whether we need a single "-rpath" flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX + +# Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes +# DIR into the resulting binary. +hardcode_direct=$hardcode_direct_CXX + +# Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes +# DIR into the resulting binary and the resulting library dependency is +# "absolute",i.e impossible to change by setting \$shlibpath_var if the +# library is relocated. +hardcode_direct_absolute=$hardcode_direct_absolute_CXX + +# Set to "yes" if using the -LDIR flag during linking hardcodes DIR +# into the resulting binary. +hardcode_minus_L=$hardcode_minus_L_CXX + +# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR +# into the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX + +# Set to "yes" if building a shared library automatically hardcodes DIR +# into the library and all subsequent libraries and executables linked +# against it. +hardcode_automatic=$hardcode_automatic_CXX + +# Set to yes if linker adds runtime paths of dependent libraries +# to runtime path list. +inherit_rpath=$inherit_rpath_CXX + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs_CXX + +# Set to "yes" if exported symbols are required. +always_export_symbols=$always_export_symbols_CXX + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_CXX + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_CXX + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_CXX + +# Commands necessary for linking programs (against libraries) with templates. +prelink_cmds=$lt_prelink_cmds_CXX + +# Commands necessary for finishing linking programs. +postlink_cmds=$lt_postlink_cmds_CXX + +# Specify filename containing input files. +file_list_spec=$lt_file_list_spec_CXX + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action_CXX + +# The directories searched by this compiler when creating a shared library. +compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_CXX + +# Dependencies to place before and after the objects being linked to +# create a shared library. +predep_objects=$lt_predep_objects_CXX +postdep_objects=$lt_postdep_objects_CXX +predeps=$lt_predeps_CXX +postdeps=$lt_postdeps_CXX + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path_CXX + +# ### END LIBTOOL TAG CONFIG: CXX +_LT_EOF + + + cat <<_LT_EOF >> "$ofile" + +# ### BEGIN LIBTOOL TAG CONFIG: F77 + +# The linker used to build libraries. +LD=$lt_LD_F77 + +# How to create reloadable object files. +reload_flag=$lt_reload_flag_F77 +reload_cmds=$lt_reload_cmds_F77 + +# Commands used to build an old-style archive. +old_archive_cmds=$lt_old_archive_cmds_F77 + +# A language specific compiler. +CC=$lt_compiler_F77 + +# Is the compiler the GNU compiler? +with_gcc=$GCC_F77 + +# Is the compiler the NAG Fortran compiler? +with_nagfor=$acx_is_nagfor_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 + +# Is the compiler the NAG Fortran compiler? +with_nagfor=$acx_is_nagfor_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 + + +as_fn_exit 0 +_LTEOF +chmod +x "$CONFIG_LT" + +# configure is writing to config.log, but config.lt does its own redirection, +# appending to config.log, which fails on DOS, as config.log is still kept +# open by configure. Here we exec the FD to /dev/null, effectively closing +# config.log, so it can be properly (re)opened and appended to by config.lt. +lt_cl_success=: +test yes = "$silent" && + lt_config_lt_args="$lt_config_lt_args --quiet" +exec 5>/dev/null +$SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false +exec 5>>config.log +$lt_cl_success || as_fn_exit 1 + + +acx_lt_saved_ac_objext=$ac_objext +ac_objext=lo +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_link="$ac_pwd/libtool --mode=link --tag=CC $ac_link" +ac_compile="$ac_pwd/libtool --mode=compile --tag=CC $ac_compile" +ac_clean_files_save="$ac_clean_files_save $ac_pwd/$objdir" +ac_clean_files="$ac_clean_files $ac_pwd/$objdir" + + for acx_flag_var_ in CFLAGS CXXFLAGS FCFLAGS F77FLAGS LDFLAGS FCLDFLAGS +do : + if eval test x\$\{$acx_flag_var_+set\} = xset; then : + eval acx_temp="\" \$$acx_flag_var_ \"" + case $acx_temp in #( + *\ -shared-intel\ *|*\ -static-intel\ *) : + acx_temp=`echo "$acx_temp" | sed -e 's/ \(-\(shared\|static\)-intel\)\b/ -Xcompiler \1 -XCClinker \1/'` ;; #( + *) : + ;; +esac + eval $acx_flag_var_=\"`echo "$acx_temp" | sed -e 's/ -\(align\|allow\|assume\|ccdefault\|check\|convert\|debug\|debug-parameters\|diag-type\|diag-enable\|diag-disable\|double-size\|dynamic-linker\|dyncom\|export-dir\|extend-source\|fp-model\|fpscomp\|gen-interfaces\|heap-arrays\|imacros\|integer-size\|iprefix\|iquote\|iwithprefixbefore\|module\|names\|opt-report\|opt-streaming-stores\|pch-dir\|pch-use\|prof-dir\|prof-file\|real-size\|reentrancy\|stand\|tcollect-filter\|tune\|warn\|watch\) \([^-][^ ]*\)\b/ -Xcompiler -\1 -Xcompiler \2/g' -e 's/^ //;s/ $//'`\" +fi +done + if test -n "$CC" -a X"$CC" != Xno; then : + 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_link="$ac_pwd/libtool --mode=link --tag=CC $ac_link" +ac_compile="$ac_pwd/libtool --mode=compile --tag=CC $ac_compile" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether libtool can link C programs" >&5 +$as_echo_n "checking whether libtool can link C programs... " >&6; } +if ${acx_cv_libtool_c_works+:} false; then : + $as_echo_n "(cached) " >&6 +else + acx_cv_libtool_c_works=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + acx_cv_libtool_c_works=yes +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_libtool_c_works" >&5 +$as_echo "$acx_cv_libtool_c_works" >&6; } + if test "x$acx_cv_libtool_c_works" = xno; 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 $? "unable to link a C program using libtool +See \`config.log' for more details" "$LINENO" 5; } +fi + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +ac_link="$ac_pwd/libtool --mode=link --tag=CC $ac_link" +ac_compile="$ac_pwd/libtool --mode=compile --tag=CC $ac_compile" + +fi + if test -n "$FC" -a X"$FC" != Xno; then : + 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 +ac_link="$ac_pwd/libtool --mode=link --tag=FC $ac_link" +ac_compile="$ac_pwd/libtool --mode=compile --tag=FC $ac_compile" + + + + acx_temp=`$FC -V 2>&1 | sed -n 1,5p` + case "$acx_temp" in #( + *NAG\ Fortran\ Compiler\ Release*) : + if test x${FCFLAGS+set} = xset; then : + FCFLAGS=`echo "$FCFLAGS" | tr ' ' '\n' | sed -e '/^-W[lc]/{' \ +-e 's/^\(-Wl\)/-XCClinker \1/;s/^\(-Wc,\)/-Xcompiler \1/' \ +-e 's/^\(-Wc=.*\)/-Xcompiler \1 -XCClinker \1/' -e '}' \ + | tr '\n' ' ' | sed -e 's/ $//'` +fi + if test x${FCLDFLAGS+set} = xset; then : + FCLDFLAGS=`echo "$FCLDFLAGS" | tr ' ' '\n' | sed -e '/^-W[lc]/{' \ +-e 's/^\(-Wl\)/-XCClinker \1/;s/^\(-Wc,\)/-Xcompiler \1/' \ +-e 's/^\(-Wc=.*\)/-Xcompiler \1 -XCClinker \1/' -e '}' \ + | tr '\n' ' ' | sed -e 's/ $//'` +fi ;; #( + *) : + ;; +esac + case "x${FC_MODOUT}x" in #( + x'-module 'x|x'-mod 'x) : + FC_MODOUT="-Xcompiler ${FC_MODOUT}-Xcompiler " ;; #( + *) : + ;; +esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether libtool can link Fortran programs" >&5 +$as_echo_n "checking whether libtool can link Fortran programs... " >&6; } +if ${acx_cv_libtool_fc_works+:} false; then : + $as_echo_n "(cached) " >&6 +else + acx_cv_libtool_fc_works=no + cat > conftest.$ac_ext <<_ACEOF + program conftest + + end +_ACEOF +if ac_fn_fc_try_link "$LINENO"; then : + acx_cv_libtool_fc_works=yes +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_libtool_fc_works" >&5 +$as_echo "$acx_cv_libtool_fc_works" >&6; } + if test "x$acx_cv_libtool_fc_works" = xno; 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 $? "unable to link a Fortran program using libtool +See \`config.log' for more details" "$LINENO" 5; } +fi + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +ac_link="$ac_pwd/libtool --mode=link --tag=CC $ac_link" +ac_compile="$ac_pwd/libtool --mode=compile --tag=CC $ac_compile" + +fi + if test -n "$F77" -a X"$F77" != Xno; then : + ac_ext=f +ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' +ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_f77_compiler_gnu +ac_link="$ac_pwd/libtool --mode=link --tag=F77 $ac_link" +ac_compile="$ac_pwd/libtool --mode=compile --tag=F77 $ac_compile" + + + + acx_temp=`$F77 -V 2>&1 | sed -n 1,5p` + case "$acx_temp" in #( + *NAG\ Fortran\ Compiler\ Release*) : + if test x${FFLAGS+set} = xset; then : + FFLAGS=`echo "$FFLAGS" | tr ' ' '\n' | sed -e '/^-W[lc]/{' \ +-e 's/^\(-Wl\)/-XCClinker \1/;s/^\(-Wc,\)/-Xcompiler \1/' \ +-e 's/^\(-Wc=.*\)/-Xcompiler \1 -XCClinker \1/' -e '}' \ + | tr '\n' ' ' | sed -e 's/ $//'` +fi + if test x${F77LDFLAGS+set} = xset; then : + F77LDFLAGS=`echo "$F77LDFLAGS" | tr ' ' '\n' | sed -e '/^-W[lc]/{' \ +-e 's/^\(-Wl\)/-XCClinker \1/;s/^\(-Wc,\)/-Xcompiler \1/' \ +-e 's/^\(-Wc=.*\)/-Xcompiler \1 -XCClinker \1/' -e '}' \ + | tr '\n' ' ' | sed -e 's/ $//'` +fi ;; #( + *) : + ;; +esac + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether libtool can link Fortran 77 programs" >&5 +$as_echo_n "checking whether libtool can link Fortran 77 programs... " >&6; } +if ${acx_cv_libtool_f77_works+:} false; then : + $as_echo_n "(cached) " >&6 +else + acx_cv_libtool_f77_works=no + cat > conftest.$ac_ext <<_ACEOF + program main + + end +_ACEOF +if ac_fn_f77_try_link "$LINENO"; then : + acx_cv_libtool_f77_works=yes +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_libtool_f77_works" >&5 +$as_echo "$acx_cv_libtool_f77_works" >&6; } + if test "x$acx_cv_libtool_f77_works" = xno; 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 $? "unable to link a Fortran 77 program using libtool +See \`config.log' for more details" "$LINENO" 5; } +fi + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +ac_link="$ac_pwd/libtool --mode=link --tag=CC $ac_link" +ac_compile="$ac_pwd/libtool --mode=compile --tag=CC $ac_compile" + +fi + if test -n "$CXX" -a X"$CXX" != Xno; then : + ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +ac_link="$ac_pwd/libtool --mode=link --tag=CXX $ac_link" +ac_compile="$ac_pwd/libtool --mode=compile --tag=CXX $ac_compile" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether libtool can link C++ programs" >&5 +$as_echo_n "checking whether libtool can link C++ programs... " >&6; } +if ${acx_cv_libtool_cxx_works+:} false; then : + $as_echo_n "(cached) " >&6 +else + acx_cv_libtool_cxx_works=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + acx_cv_libtool_cxx_works=yes +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_libtool_cxx_works" >&5 +$as_echo "$acx_cv_libtool_cxx_works" >&6; } + if test "x$acx_cv_libtool_cxx_works" = xno; 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 $? "unable to link a C++ program using libtool +See \`config.log' for more details" "$LINENO" 5; } +fi + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +ac_link="$ac_pwd/libtool --mode=link --tag=CC $ac_link" +ac_compile="$ac_pwd/libtool --mode=compile --tag=CC $ac_compile" + +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 +$as_echo_n "checking whether byte ordering is bigendian... " >&6; } +if ${ac_cv_c_bigendian+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_c_bigendian=unknown + # See if we're dealing with a universal compiler. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifndef __APPLE_CC__ + not a universal capable compiler + #endif + typedef int dummy; + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + # Check for potential -arch flags. It is not universal unless + # there are at least two -arch flags with different values. + ac_arch= + ac_prev= + for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do + if test -n "$ac_prev"; then + case $ac_word in + i?86 | x86_64 | ppc | ppc64) + if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then + ac_arch=$ac_word + else + ac_cv_c_bigendian=universal + break + fi + ;; + esac + ac_prev= + elif test "x$ac_word" = "x-arch"; then + ac_prev=arch + fi + done +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if test $ac_cv_c_bigendian = unknown; then + # See if sys/param.h defines the BYTE_ORDER macro. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <sys/types.h> + #include <sys/param.h> + +int +main () +{ +#if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ + && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ + && LITTLE_ENDIAN) + bogus endian macros + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + # It does; now see whether it defined to BIG_ENDIAN or not. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <sys/types.h> + #include <sys/param.h> + +int +main () +{ +#if BYTE_ORDER != BIG_ENDIAN + not big endian + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_bigendian=yes +else + ac_cv_c_bigendian=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + if test $ac_cv_c_bigendian = unknown; then + # See if <limits.h> defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris). + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <limits.h> + +int +main () +{ +#if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) + bogus endian macros + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + # It does; now see whether it defined to _BIG_ENDIAN or not. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <limits.h> + +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 WORDS_BIGENDIAN 1" >>confdefs.h +;; #( + 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 + +# Check whether --enable-largefile was given. +if test "${enable_largefile+set}" = set; then : + enableval=$enable_largefile; +fi + +if test "$enable_largefile" != no; then + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5 +$as_echo_n "checking for special C compiler options needed for large files... " >&6; } +if ${ac_cv_sys_largefile_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_sys_largefile_CC=no + if test "$GCC" != yes; then + ac_save_CC=$CC + while :; do + # IRIX 6.2 and later do not support large files by default, + # so use the C compiler's -n32 option if that helps. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <sys/types.h> + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main () +{ + + ; + return 0; +} +_ACEOF + if ac_fn_c_try_compile "$LINENO"; then : + break +fi +rm -f core conftest.err conftest.$ac_objext + CC="$CC -n32" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_sys_largefile_CC=' -n32'; break +fi +rm -f core conftest.err conftest.$ac_objext + break + done + CC=$ac_save_CC + rm -f conftest.$ac_ext + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5 +$as_echo "$ac_cv_sys_largefile_CC" >&6; } + if test "$ac_cv_sys_largefile_CC" != no; then + CC=$CC$ac_cv_sys_largefile_CC + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5 +$as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; } +if ${ac_cv_sys_file_offset_bits+:} false; then : + $as_echo_n "(cached) " >&6 +else + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <sys/types.h> + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_sys_file_offset_bits=no; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#define _FILE_OFFSET_BITS 64 +#include <sys/types.h> + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_sys_file_offset_bits=64; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_cv_sys_file_offset_bits=unknown + break +done +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5 +$as_echo "$ac_cv_sys_file_offset_bits" >&6; } +case $ac_cv_sys_file_offset_bits in #( + no | unknown) ;; + *) +cat >>confdefs.h <<_ACEOF +#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits +_ACEOF +;; +esac +rm -rf conftest* + if test $ac_cv_sys_file_offset_bits = unknown; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5 +$as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; } +if ${ac_cv_sys_large_files+:} false; then : + $as_echo_n "(cached) " >&6 +else + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <sys/types.h> + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_sys_large_files=no; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#define _LARGE_FILES 1 +#include <sys/types.h> + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_sys_large_files=1; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_cv_sys_large_files=unknown + break +done +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5 +$as_echo "$ac_cv_sys_large_files" >&6; } +case $ac_cv_sys_large_files in #( + no | unknown) ;; + *) +cat >>confdefs.h <<_ACEOF +#define _LARGE_FILES $ac_cv_sys_large_files +_ACEOF +;; +esac +rm -rf conftest* + fi + + +fi + + + + + for ac_header in $ac_header_list +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_func in getpagesize +do : + ac_fn_c_check_func "$LINENO" "getpagesize" "ac_cv_func_getpagesize" +if test "x$ac_cv_func_getpagesize" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_GETPAGESIZE 1 +_ACEOF + +fi +done + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working mmap" >&5 +$as_echo_n "checking for working mmap... " >&6; } +if ${ac_cv_func_mmap_fixed_mapped+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + ac_cv_func_mmap_fixed_mapped=no +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +/* malloc might have been renamed as rpl_malloc. */ +#undef malloc + +/* Thanks to Mike Haertel and Jim Avera for this test. + Here is a matrix of mmap possibilities: + mmap private not fixed + mmap private fixed at somewhere currently unmapped + mmap private fixed at somewhere already mapped + mmap shared not fixed + mmap shared fixed at somewhere currently unmapped + mmap shared fixed at somewhere already mapped + For private mappings, we should verify that changes cannot be read() + back from the file, nor mmap's back from the file at a different + address. (There have been systems where private was not correctly + implemented like the infamous i386 svr4.0, and systems where the + VM page cache was not coherent with the file system buffer cache + like early versions of FreeBSD and possibly contemporary NetBSD.) + For shared mappings, we should conversely verify that changes get + propagated back to all the places they're supposed to be. + + Grep wants private fixed already mapped. + The main things grep needs to know about mmap are: + * does it exist and is it safe to write into the mmap'd area + * how to use it (BSD variants) */ + +#include <fcntl.h> +#include <sys/mman.h> + +#if !defined STDC_HEADERS && !defined HAVE_STDLIB_H +char *malloc (); +#endif + +/* This mess was copied from the GNU getpagesize.h. */ +#ifndef HAVE_GETPAGESIZE +# ifdef _SC_PAGESIZE +# define getpagesize() sysconf(_SC_PAGESIZE) +# else /* no _SC_PAGESIZE */ +# ifdef HAVE_SYS_PARAM_H +# include <sys/param.h> +# ifdef EXEC_PAGESIZE +# define getpagesize() EXEC_PAGESIZE +# else /* no EXEC_PAGESIZE */ +# ifdef NBPG +# define getpagesize() NBPG * CLSIZE +# ifndef CLSIZE +# define CLSIZE 1 +# endif /* no CLSIZE */ +# else /* no NBPG */ +# ifdef NBPC +# define getpagesize() NBPC +# else /* no NBPC */ +# ifdef PAGESIZE +# define getpagesize() PAGESIZE +# endif /* PAGESIZE */ +# endif /* no NBPC */ +# endif /* no NBPG */ +# endif /* no EXEC_PAGESIZE */ +# else /* no HAVE_SYS_PARAM_H */ +# define getpagesize() 8192 /* punt totally */ +# endif /* no HAVE_SYS_PARAM_H */ +# endif /* no _SC_PAGESIZE */ + +#endif /* no HAVE_GETPAGESIZE */ + +int +main () +{ + char *data, *data2, *data3; + const char *cdata2; + int i, pagesize; + int fd, fd2; + + pagesize = getpagesize (); + + /* First, make a file with some known garbage in it. */ + data = (char *) malloc (pagesize); + if (!data) + return 1; + for (i = 0; i < pagesize; ++i) + *(data + i) = rand (); + umask (0); + fd = creat ("conftest.mmap", 0600); + if (fd < 0) + return 2; + if (write (fd, data, pagesize) != pagesize) + return 3; + close (fd); + + /* Next, check that the tail of a page is zero-filled. File must have + non-zero length, otherwise we risk SIGBUS for entire page. */ + fd2 = open ("conftest.txt", O_RDWR | O_CREAT | O_TRUNC, 0600); + if (fd2 < 0) + return 4; + cdata2 = ""; + if (write (fd2, cdata2, 1) != 1) + return 5; + data2 = (char *) mmap (0, pagesize, PROT_READ | PROT_WRITE, MAP_SHARED, fd2, 0L); + if (data2 == MAP_FAILED) + return 6; + for (i = 0; i < pagesize; ++i) + if (*(data2 + i)) + return 7; + close (fd2); + if (munmap (data2, pagesize)) + return 8; + + /* Next, try to mmap the file at a fixed address which already has + something else allocated at it. If we can, also make sure that + we see the same garbage. */ + fd = open ("conftest.mmap", O_RDWR); + if (fd < 0) + return 9; + if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_FIXED, fd, 0L)) + return 10; + for (i = 0; i < pagesize; ++i) + if (*(data + i) != *(data2 + i)) + return 11; + + /* Finally, make sure that changes to the mapped area do not + percolate back to the file as seen by read(). (This is a bug on + some variants of i386 svr4.0.) */ + for (i = 0; i < pagesize; ++i) + *(data2 + i) = *(data2 + i) + 1; + data3 = (char *) malloc (pagesize); + if (!data3) + return 12; + if (read (fd, data3, pagesize) != pagesize) + return 13; + for (i = 0; i < pagesize; ++i) + if (*(data + i) != *(data3 + i)) + return 14; + close (fd); + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + ac_cv_func_mmap_fixed_mapped=yes +else + ac_cv_func_mmap_fixed_mapped=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_mmap_fixed_mapped" >&5 +$as_echo "$ac_cv_func_mmap_fixed_mapped" >&6; } +if test $ac_cv_func_mmap_fixed_mapped = yes; then + +$as_echo "#define HAVE_MMAP 1" >>confdefs.h + +fi +rm -f conftest.mmap conftest.txt + +ac_fn_c_check_member "$LINENO" "struct stat" "st_blksize" "ac_cv_member_struct_stat_st_blksize" "$ac_includes_default" +if test "x$ac_cv_member_struct_stat_st_blksize" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_STAT_ST_BLKSIZE 1 +_ACEOF + + +fi + +for ac_header in malloc.h unistd.h sys/time.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 execinfo.h +do : + ac_fn_c_check_header_compile "$LINENO" "execinfo.h" "ac_cv_header_execinfo_h" "$ac_includes_default +" +if test "x$ac_cv_header_execinfo_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_EXECINFO_H 1 +_ACEOF + +fi + +done + + if test x"$ac_cv_header_execinfo_h" = xyes; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking size parameter type for backtrace()" >&5 +$as_echo_n "checking size parameter type for backtrace()... " >&6; } +if ${ax_cv_proto_backtrace_type+:} 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 +ac_link="$ac_pwd/libtool --mode=link --tag=CC $ac_link" +ac_compile="$ac_pwd/libtool --mode=compile --tag=CC $ac_compile" + + for ax_cv_proto_backtrace_type in size_t int none; do + if test "${ax_cv_proto_backtrace_type}" = none; then : + ax_cv_proto_backtrace_type= ; break +fi + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <execinfo.h> +extern +${ax_cv_proto_backtrace_type} backtrace(void **addrlist, ${ax_cv_proto_backtrace_type} len); +char **backtrace_symbols(void *const *buffer, ${ax_cv_proto_backtrace_type} size); + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + break +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done + 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_link="$ac_pwd/libtool --mode=link --tag=CC $ac_link" +ac_compile="$ac_pwd/libtool --mode=compile --tag=CC $ac_compile" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_proto_backtrace_type" >&5 +$as_echo "$ax_cv_proto_backtrace_type" >&6; } +fi + if test x${ax_cv_proto_backtrace_type} != x; then : + +cat >>confdefs.h <<_ACEOF +#define backtrace_size_t $ax_cv_proto_backtrace_type +_ACEOF + +fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing backtrace" >&5 +$as_echo_n "checking for library containing backtrace... " >&6; } +if ${ac_cv_search_backtrace+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$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 backtrace (); +int +main () +{ +return backtrace (); + ; + return 0; +} +_ACEOF +for ac_lib in '' execinfo; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_backtrace=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_backtrace+:} false; then : + break +fi +done +if ${ac_cv_search_backtrace+:} false; then : + +else + ac_cv_search_backtrace=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_backtrace" >&5 +$as_echo "$ac_cv_search_backtrace" >&6; } +ac_res=$ac_cv_search_backtrace +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + + if test x"${ax_cv_proto_backtrace_type}" != x -a x"$ac_cv_header_execinfo_h" = xyes -a x"$ac_cv_search_backtrace" != xno; then : + +$as_echo "#define HAVE_BACKTRACE 1" >>confdefs.h + + +fi +for ac_func in mallinfo pwrite +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 + +ac_fn_c_check_func "$LINENO" "getline" "ac_cv_func_getline" +if test "x$ac_cv_func_getline" = xyes; then : + $as_echo "#define HAVE_GETLINE 1" >>confdefs.h + +else + case " $LIBOBJS " in + *" getline.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS getline.$ac_objext" + ;; +esac + +fi + + +# Sed expression to map a string onto a valid argument string part. +asx_tr_arg="eval sed 'y%*+%pp%;s%[^-$as_cr_alnum]%-%g'" + +have_dce_uuid_c_bindings=no + have_util_linux_uuid_c_bindings=no + have_ossp_uuid_c_bindings=no + # Check whether --enable-util-linux-uuid was given. +if test "${enable_util_linux_uuid+set}" = set; then : + enableval=$enable_util_linux_uuid; +else + enable_util_linux_uuid=auto +fi + + # Check whether --enable-ossp-uuid was given. +if test "${enable_ossp_uuid+set}" = set; then : + enableval=$enable_ossp_uuid; +else + enable_ossp_uuid=auto +fi + + # Check whether --enable-dce-uuid was given. +if test "${enable_dce_uuid+set}" = set; then : + enableval=$enable_dce_uuid; +else + enable_dce_uuid=auto +fi + + + +# Check whether --with-util-linux-uuid was given. +if test "${with_util_linux_uuid+set}" = set; then : + withval=$with_util_linux_uuid; case $with_util_linux_uuid in #( + yes) : + enable_ossp_uuid=no enable_dce_uuid=no ;; #( + no) : + enable_util_linux_uuid=no ;; #( + /*) : + if test x${with_util_linux_uuid_root+set} != xset; then : + with_util_linux_uuid_root=$with_util_linux_uuid +elif test x"${with_util_linux_uuid_root}" != x"${with_util_linux_uuid}"; 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 $? "inconsistent directories specified for --with-util-linux-uuid and --with-util-linux-uuid-root +See \`config.log' for more details" "$LINENO" 5; } +fi + enable_ossp_uuid=no enable_dce_uuid=no ;; #( + *) : + ;; +esac +fi + + +# Check whether --with-ossp-uuid was given. +if test "${with_ossp_uuid+set}" = set; then : + withval=$with_ossp_uuid; case $with_ossp_uuid in #( + yes) : + enable_util_linux_uuid=no enable_dce_uuid=no ;; #( + no) : + enable_ossp_uuid=no ;; #( + /*) : + if test x${with_ossp_uuid_root+set} != xset; then : + with_ossp_uuid_root=$with_ossp_uuid +elif test x"${with_ossp_uuid_root}" != x"${with_ossp_uuid}"; 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 $? "inconsistent directories specified for --with-ossp-uuid and --with-ossp-uuid-root +See \`config.log' for more details" "$LINENO" 5; } +fi + enable_util_linux_uuid=no enable_dce_uuid=no ;; #( + *) : + ;; +esac +fi + + +# Check whether --with-dce-uuid was given. +if test "${with_dce_uuid+set}" = set; then : + withval=$with_dce_uuid; case $with_dce_uuid in #( + yes) : + enable_util_linux_uuid=no enable_ossp_uuid=no ;; #( + no) : + enable_dce_uuid=no ;; #( + /*) : + if test x${with_dce_uuid_root+set} != xset; then : + with_dce_uuid_root=$with_dce_uuid +elif test x"${with_dce_uuid_root}" != x"${with_dce_uuid}"; 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 $? "inconsistent directories specified for --with-dce-uuid and --with-dce-uuid-root +See \`config.log' for more details" "$LINENO" 5; } +fi + enable_util_linux_uuid=no enable_ossp_uuid=no ;; #( + *) : + ;; +esac +fi + + + if test x"$enable_util_linux_uuid" != xno; then : + 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_link="$ac_pwd/libtool --mode=link --tag=CC $ac_link" +ac_compile="$ac_pwd/libtool --mode=compile --tag=CC $ac_compile" + + + + + + + + have_util_linux_uuid_c_bindings=yes + + +# Check whether --with-util-linux-uuid-root was given. +if test "${with_util_linux_uuid_root+set}" = set; then : + withval=$with_util_linux_uuid_root; UTIL_LINUX_UUIDROOT=$withval +fi + + if ${UTIL_LINUX_UUIDROOT+:} false; then : + if ${UTIL_LINUX_UUID_C_LIB+:} false; then : + +else + UTIL_LINUX_UUID_C_LIB="-L$UTIL_LINUX_UUIDROOT/lib" +fi + if ${UTIL_LINUX_UUID_C_INCLUDE+:} false; then : + +else + UTIL_LINUX_UUID_C_INCLUDE="-I$UTIL_LINUX_UUIDROOT/include" +fi +fi + +# Check whether --with-util-linux-uuid-include was given. +if test "${with_util_linux_uuid_include+set}" = set; then : + withval=$with_util_linux_uuid_include; UTIL_LINUX_UUID_C_INCLUDE="-I$withval" +fi + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uuid/uuid.h extra include path" >&5 +$as_echo_n "checking for uuid/uuid.h extra include path... " >&6; } + if ${acx_cv_c_include_uuid_uuid_h+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_include_search_uuid_uuid_h_SAVE="$CPPFLAGS" + while :; do + for ac_incdir in '' +do : + if test -z "$ac_incdir"; then : + ac_res="none required" + CPPFLAGS="$UTIL_LINUX_UUID_C_INCLUDE $ac_include_search_uuid_uuid_h_SAVE" +else + ac_res="-I$ac_incdir" + CPPFLAGS="$UTIL_LINUX_UUID_C_INCLUDE $ac_res $ac_include_search_uuid_uuid_h_SAVE" +fi + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +#include <uuid/uuid.h> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + acx_cv_c_include_uuid_uuid_h=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if ${acx_cv_c_include_uuid_uuid_h+:} false; then : + if test -z "$ac_incdir"; then : + acx_cv_c_include_uuid_uuid_h="$UTIL_LINUX_UUID_C_INCLUDE" +else + acx_cv_c_include_uuid_uuid_h="$UTIL_LINUX_UUID_C_INCLUDE -I$ac_incdir" +fi +fi + if ${acx_cv_c_include_uuid_uuid_h+:} false; then : + break +fi +done + if ${acx_cv_c_include_uuid_uuid_h+:} false; then : + break +fi + + break + done + CPPFLAGS=$ac_include_search_uuid_uuid_h_SAVE +fi + + if ${acx_cv_c_include_uuid_uuid_h+:} false; then : + if test x"$acx_cv_c_include_uuid_uuid_h" = x; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: (none required)" >&5 +$as_echo "(none required)" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_c_include_uuid_uuid_h" >&5 +$as_echo "$acx_cv_c_include_uuid_uuid_h" >&6; } +fi + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 +$as_echo "not found" >&6; } +fi + if ${acx_cv_c_include_uuid_uuid_h+:} false; then : + UTIL_LINUX_UUID_C_INCLUDE=`echo "$acx_cv_c_include_uuid_uuid_h" | sed -e 's/^ *//;s/ *$//'` +else + have_util_linux_uuid_c_bindings=no; +fi + + +# Check whether --with-util-linux-uuid-lib was given. +if test "${with_util_linux_uuid_lib+set}" = set; then : + withval=$with_util_linux_uuid_lib; UTIL_LINUX_UUID_C_LIB="-L$withval" +fi + + if test "x$have_util_linux_uuid_c_bindings" = xyes; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing uuid_generate" >&5 +$as_echo_n "checking for library containing uuid_generate... " >&6; } + if ${acx_cv_option_search_uuid_generate_c+:} false; then : + $as_echo_n "(cached) " >&6 +else + acx_option_func_search_save_LIBS=$LIBS + while :; do + 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 uuid_generate (); +int +main () +{ +return uuid_generate (); + ; + return 0; +} +_ACEOF + for ac_lib in '' uuid +do : + if test -z "$ac_lib"; then : + ac_res="none required" + LIBS="$UTIL_LINUX_UUID_C_LIB $acx_option_func_search_save_LIBS" +else + ac_res="-l$ac_lib" + LIBS="$UTIL_LINUX_UUID_C_LIB $ac_res $acx_option_func_search_save_LIBS" +fi + if ac_fn_c_try_link "$LINENO"; then : + if test x"$ac_res" = x"none required"; then : + acx_cv_option_search_uuid_generate_c="$UTIL_LINUX_UUID_C_LIB" +else + acx_cv_option_search_uuid_generate_c="$UTIL_LINUX_UUID_C_LIB -l$ac_lib" +fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${acx_cv_option_search_uuid_generate_c+:} false; then : + break +fi +done + rm conftest.$ac_ext + if ${acx_cv_option_search_uuid_generate_c+:} false; then : + break +fi + for acx_libset in "" +do : + 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 uuid_generate (); +int +main () +{ +return uuid_generate (); + ; + return 0; +} +_ACEOF + for ac_lib in '' uuid +do : + if test -z "$ac_lib"; then : + ac_res="none required" + LIBS="$UTIL_LINUX_UUID_C_LIB $acx_libset $acx_option_func_search_save_LIBS" +else + ac_res="-l$ac_lib" + LIBS="$UTIL_LINUX_UUID_C_LIB $ac_res $acx_libset $acx_option_func_search_save_LIBS" +fi + if ac_fn_c_try_link "$LINENO"; then : + if test x"$ac_res" = x"none required"; then : + acx_cv_option_search_uuid_generate_c="$UTIL_LINUX_UUID_C_LIB $acx_libset" +else + acx_cv_option_search_uuid_generate_c="$UTIL_LINUX_UUID_C_LIB -l$ac_lib $acx_libset" +fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${acx_cv_option_search_uuid_generate_c+:} false; then : + break +fi +done + rm conftest.$ac_ext + if ${acx_cv_option_search_uuid_generate_c+:} false; then : + break +fi + +done + break + done + LIBS=$acx_option_func_search_save_LIBS +fi + + if ${acx_cv_option_search_uuid_generate_c+:} false; then : + if test x"$acx_cv_option_search_uuid_generate_c" = x; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: (none required)" >&5 +$as_echo "(none required)" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_option_search_uuid_generate_c" >&5 +$as_echo "$acx_cv_option_search_uuid_generate_c" >&6; } +fi +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 +$as_echo "not found" >&6; } + have_util_linux_uuid_c_bindings=no + +fi + + UTIL_LINUX_UUID_C_LIB=`echo "$acx_cv_option_search_uuid_generate_c" | sed -e 's/^ *//;s/ *$//'` + +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_link="$ac_pwd/libtool --mode=link --tag=CC $ac_link" +ac_compile="$ac_pwd/libtool --mode=compile --tag=CC $ac_compile" + + if test x"$have_util_linux_uuid_c_bindings" = xyes; then : + acx_save_CPPFLAGS=$CPPFLAGS + CPPFLAGS="$CPPFLAGS $UTIL_LINUX_UUID_C_INCLUDE" + for ac_header in uuid/uuid.h +do : + ac_fn_c_check_header_compile "$LINENO" "uuid/uuid.h" "ac_cv_header_uuid_uuid_h" "$ac_includes_default +" +if test "x$ac_cv_header_uuid_uuid_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_UUID_UUID_H 1 +_ACEOF + ac_fn_c_check_decl "$LINENO" "uuid_generate" "ac_cv_have_decl_uuid_generate" "$ac_includes_default +#include <uuid/uuid.h> +" +if test "x$ac_cv_have_decl_uuid_generate" = xyes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_UUID_GENERATE $ac_have_decl +_ACEOF +if test $ac_have_decl = 1; then : + +else + have_util_linux_uuid_c_bindings=no +fi + +else + have_util_linux_uuid_c_bindings=no +fi + +done + + CPPFLAGS=$acx_save_CPPFLAGS +fi +else + have_util_linux_uuid_c_bindings=no +fi + if test x"$enable_ossp_uuid" != xno -a x"$have_util_linux_uuid_c_bindings" = xno; then : + 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_link="$ac_pwd/libtool --mode=link --tag=CC $ac_link" +ac_compile="$ac_pwd/libtool --mode=compile --tag=CC $ac_compile" + + + + + + + + have_ossp_uuid_c_bindings=yes + + +# Check whether --with-ossp-uuid-root was given. +if test "${with_ossp_uuid_root+set}" = set; then : + withval=$with_ossp_uuid_root; OSSP_UUIDROOT=$withval +fi + + if ${OSSP_UUIDROOT+:} false; then : + if ${OSSP_UUID_C_LIB+:} false; then : + +else + OSSP_UUID_C_LIB="-L$OSSP_UUIDROOT/lib" +fi + if ${OSSP_UUID_C_INCLUDE+:} false; then : + +else + OSSP_UUID_C_INCLUDE="-I$OSSP_UUIDROOT/include" +fi +fi + +# Check whether --with-ossp-uuid-include was given. +if test "${with_ossp_uuid_include+set}" = set; then : + withval=$with_ossp_uuid_include; OSSP_UUID_C_INCLUDE="-I$withval" +fi + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uuid.h extra include path" >&5 +$as_echo_n "checking for uuid.h extra include path... " >&6; } + if ${acx_cv_c_include_uuid_h+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_include_search_uuid_h_SAVE="$CPPFLAGS" + while :; do + for ac_incdir in '' /usr/include/ossp +do : + if test -z "$ac_incdir"; then : + ac_res="none required" + CPPFLAGS="$OSSP_UUID_C_INCLUDE $ac_include_search_uuid_h_SAVE" +else + ac_res="-I$ac_incdir" + CPPFLAGS="$OSSP_UUID_C_INCLUDE $ac_res $ac_include_search_uuid_h_SAVE" +fi + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <uuid.h> +$ac_includes_default + +#include <uuid.h> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + acx_cv_c_include_uuid_h=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if ${acx_cv_c_include_uuid_h+:} false; then : + if test -z "$ac_incdir"; then : + acx_cv_c_include_uuid_h="$OSSP_UUID_C_INCLUDE" +else + acx_cv_c_include_uuid_h="$OSSP_UUID_C_INCLUDE -I$ac_incdir" +fi +fi + if ${acx_cv_c_include_uuid_h+:} false; then : + break +fi +done + if ${acx_cv_c_include_uuid_h+:} false; then : + break +fi + + break + done + CPPFLAGS=$ac_include_search_uuid_h_SAVE +fi + + if ${acx_cv_c_include_uuid_h+:} false; then : + if test x"$acx_cv_c_include_uuid_h" = x; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: (none required)" >&5 +$as_echo "(none required)" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_c_include_uuid_h" >&5 +$as_echo "$acx_cv_c_include_uuid_h" >&6; } +fi + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 +$as_echo "not found" >&6; } +fi + if ${acx_cv_c_include_uuid_h+:} false; then : + OSSP_UUID_C_INCLUDE=`echo "$acx_cv_c_include_uuid_h" | sed -e 's/^ *//;s/ *$//'` +else + have_ossp_uuid_c_bindings=no; +fi + + +# Check whether --with-ossp-uuid-lib was given. +if test "${with_ossp_uuid_lib+set}" = set; then : + withval=$with_ossp_uuid_lib; OSSP_UUID_C_LIB="-L$withval" +fi + + if test "x$have_ossp_uuid_c_bindings" = xyes; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing uuid_create" >&5 +$as_echo_n "checking for library containing uuid_create... " >&6; } + if ${acx_cv_option_search_uuid_create_c+:} false; then : + $as_echo_n "(cached) " >&6 +else + acx_option_func_search_save_LIBS=$LIBS + while :; do + 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 uuid_create (); +int +main () +{ +return uuid_create (); + ; + return 0; +} +_ACEOF + for ac_lib in '' ossp-uuid uuid +do : + if test -z "$ac_lib"; then : + ac_res="none required" + LIBS="$OSSP_UUID_C_LIB $acx_option_func_search_save_LIBS" +else + ac_res="-l$ac_lib" + LIBS="$OSSP_UUID_C_LIB $ac_res $acx_option_func_search_save_LIBS" +fi + if ac_fn_c_try_link "$LINENO"; then : + if test x"$ac_res" = x"none required"; then : + acx_cv_option_search_uuid_create_c="$OSSP_UUID_C_LIB" +else + acx_cv_option_search_uuid_create_c="$OSSP_UUID_C_LIB -l$ac_lib" +fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${acx_cv_option_search_uuid_create_c+:} false; then : + break +fi +done + rm conftest.$ac_ext + if ${acx_cv_option_search_uuid_create_c+:} false; then : + break +fi + for acx_libset in "" +do : + 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 uuid_create (); +int +main () +{ +return uuid_create (); + ; + return 0; +} +_ACEOF + for ac_lib in '' ossp-uuid uuid +do : + if test -z "$ac_lib"; then : + ac_res="none required" + LIBS="$OSSP_UUID_C_LIB $acx_libset $acx_option_func_search_save_LIBS" +else + ac_res="-l$ac_lib" + LIBS="$OSSP_UUID_C_LIB $ac_res $acx_libset $acx_option_func_search_save_LIBS" +fi + if ac_fn_c_try_link "$LINENO"; then : + if test x"$ac_res" = x"none required"; then : + acx_cv_option_search_uuid_create_c="$OSSP_UUID_C_LIB $acx_libset" +else + acx_cv_option_search_uuid_create_c="$OSSP_UUID_C_LIB -l$ac_lib $acx_libset" +fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${acx_cv_option_search_uuid_create_c+:} false; then : + break +fi +done + rm conftest.$ac_ext + if ${acx_cv_option_search_uuid_create_c+:} false; then : + break +fi + +done + break + done + LIBS=$acx_option_func_search_save_LIBS +fi + + if ${acx_cv_option_search_uuid_create_c+:} false; then : + if test x"$acx_cv_option_search_uuid_create_c" = x; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: (none required)" >&5 +$as_echo "(none required)" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_option_search_uuid_create_c" >&5 +$as_echo "$acx_cv_option_search_uuid_create_c" >&6; } +fi +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 +$as_echo "not found" >&6; } + have_ossp_uuid_c_bindings=no + +fi + + OSSP_UUID_C_LIB=`echo "$acx_cv_option_search_uuid_create_c" | sed -e 's/^ *//;s/ *$//'` + +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_link="$ac_pwd/libtool --mode=link --tag=CC $ac_link" +ac_compile="$ac_pwd/libtool --mode=compile --tag=CC $ac_compile" + + if test x"$have_ossp_uuid_c_bindings" = xyes; then : + acx_save_CPPFLAGS=$CPPFLAGS + CPPFLAGS="${CPPFLAGS+$CPPFLAGS }$OSSP_UUID_C_INCLUDE" + for ac_header in uuid.h +do : + ac_fn_c_check_header_compile "$LINENO" "uuid.h" "ac_cv_header_uuid_h" "#include <uuid.h> +$ac_includes_default +" +if test "x$ac_cv_header_uuid_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_UUID_H 1 +_ACEOF + ac_fn_c_check_decl "$LINENO" "uuid_create" "ac_cv_have_decl_uuid_create" "#include <uuid.h> +$ac_includes_default +" +if test "x$ac_cv_have_decl_uuid_create" = xyes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_UUID_CREATE $ac_have_decl +_ACEOF +if test $ac_have_decl = 1; then : + ac_fn_c_check_decl "$LINENO" "UUID_MAKE_V5" "ac_cv_have_decl_UUID_MAKE_V5" "#include <uuid.h> +$ac_includes_default +" +if test "x$ac_cv_have_decl_UUID_MAKE_V5" = xyes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_UUID_MAKE_V5 $ac_have_decl +_ACEOF +if test $ac_have_decl = 1; then : + +else + have_ossp_uuid_c_bindings=no +fi + +else + have_ossp_uuid_c_bindings=no +fi + +else + have_ossp_uuid_c_bindings=no +fi + +done + + CPPFLAGS=$acx_save_CPPFLAGS +fi +else + have_ossp_uuid_c_bindings=no +fi + # check for DCE uuid_create if util-linux and OSSP variants cannot be found + if test x"$enable_dce_uuid" != xno -a x"$have_util_linux_uuid_c_bindings$have_ossp_uuid_c_bindings" = xnono; then : + 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_link="$ac_pwd/libtool --mode=link --tag=CC $ac_link" +ac_compile="$ac_pwd/libtool --mode=compile --tag=CC $ac_compile" + + + + + + + + have_dce_uuid_c_bindings=yes + + +# Check whether --with-dce-uuid-root was given. +if test "${with_dce_uuid_root+set}" = set; then : + withval=$with_dce_uuid_root; DCE_UUIDROOT=$withval +fi + + if ${DCE_UUIDROOT+:} false; then : + if ${DCE_UUID_C_LIB+:} false; then : + +else + DCE_UUID_C_LIB="-L$DCE_UUIDROOT/lib" +fi + if ${DCE_UUID_C_INCLUDE+:} false; then : + +else + DCE_UUID_C_INCLUDE="-I$DCE_UUIDROOT/include" +fi +fi + +# Check whether --with-dce-uuid-include was given. +if test "${with_dce_uuid_include+set}" = set; then : + withval=$with_dce_uuid_include; DCE_UUID_C_INCLUDE="-I$withval" +fi + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uuid.h extra include path" >&5 +$as_echo_n "checking for uuid.h extra include path... " >&6; } + if ${acx_cv_c_include_uuid_h+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_include_search_uuid_h_SAVE="$CPPFLAGS" + while :; do + for ac_incdir in '' +do : + if test -z "$ac_incdir"; then : + ac_res="none required" + CPPFLAGS="$DCE_UUID_C_INCLUDE $ac_include_search_uuid_h_SAVE" +else + ac_res="-I$ac_incdir" + CPPFLAGS="$DCE_UUID_C_INCLUDE $ac_res $ac_include_search_uuid_h_SAVE" +fi + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +#include <uuid.h> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + acx_cv_c_include_uuid_h=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if ${acx_cv_c_include_uuid_h+:} false; then : + if test -z "$ac_incdir"; then : + acx_cv_c_include_uuid_h="$DCE_UUID_C_INCLUDE" +else + acx_cv_c_include_uuid_h="$DCE_UUID_C_INCLUDE -I$ac_incdir" +fi +fi + if ${acx_cv_c_include_uuid_h+:} false; then : + break +fi +done + if ${acx_cv_c_include_uuid_h+:} false; then : + break +fi + + break + done + CPPFLAGS=$ac_include_search_uuid_h_SAVE +fi + + if ${acx_cv_c_include_uuid_h+:} false; then : + if test x"$acx_cv_c_include_uuid_h" = x; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: (none required)" >&5 +$as_echo "(none required)" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_c_include_uuid_h" >&5 +$as_echo "$acx_cv_c_include_uuid_h" >&6; } +fi + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 +$as_echo "not found" >&6; } +fi + if ${acx_cv_c_include_uuid_h+:} false; then : + DCE_UUID_C_INCLUDE=`echo "$acx_cv_c_include_uuid_h" | sed -e 's/^ *//;s/ *$//'` +else + have_dce_uuid_c_bindings=no; +fi + + +# Check whether --with-dce-uuid-lib was given. +if test "${with_dce_uuid_lib+set}" = set; then : + withval=$with_dce_uuid_lib; DCE_UUID_C_LIB="-L$withval" +fi + + if test "x$have_dce_uuid_c_bindings" = xyes; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing uuid_create" >&5 +$as_echo_n "checking for library containing uuid_create... " >&6; } + if ${acx_cv_option_search_uuid_create_c+:} false; then : + $as_echo_n "(cached) " >&6 +else + acx_option_func_search_save_LIBS=$LIBS + while :; do + 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 uuid_create (); +int +main () +{ +return uuid_create (); + ; + return 0; +} +_ACEOF + for ac_lib in '' +do : + if test -z "$ac_lib"; then : + ac_res="none required" + LIBS="$DCE_UUID_C_LIB $acx_option_func_search_save_LIBS" +else + ac_res="-l$ac_lib" + LIBS="$DCE_UUID_C_LIB $ac_res $acx_option_func_search_save_LIBS" +fi + if ac_fn_c_try_link "$LINENO"; then : + if test x"$ac_res" = x"none required"; then : + acx_cv_option_search_uuid_create_c="$DCE_UUID_C_LIB" +else + acx_cv_option_search_uuid_create_c="$DCE_UUID_C_LIB -l$ac_lib" +fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${acx_cv_option_search_uuid_create_c+:} false; then : + break +fi +done + rm conftest.$ac_ext + if ${acx_cv_option_search_uuid_create_c+:} false; then : + break +fi + for acx_libset in "" +do : + 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 uuid_create (); +int +main () +{ +return uuid_create (); + ; + return 0; +} +_ACEOF + for ac_lib in '' +do : + if test -z "$ac_lib"; then : + ac_res="none required" + LIBS="$DCE_UUID_C_LIB $acx_libset $acx_option_func_search_save_LIBS" +else + ac_res="-l$ac_lib" + LIBS="$DCE_UUID_C_LIB $ac_res $acx_libset $acx_option_func_search_save_LIBS" +fi + if ac_fn_c_try_link "$LINENO"; then : + if test x"$ac_res" = x"none required"; then : + acx_cv_option_search_uuid_create_c="$DCE_UUID_C_LIB $acx_libset" +else + acx_cv_option_search_uuid_create_c="$DCE_UUID_C_LIB -l$ac_lib $acx_libset" +fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${acx_cv_option_search_uuid_create_c+:} false; then : + break +fi +done + rm conftest.$ac_ext + if ${acx_cv_option_search_uuid_create_c+:} false; then : + break +fi + +done + break + done + LIBS=$acx_option_func_search_save_LIBS +fi + + if ${acx_cv_option_search_uuid_create_c+:} false; then : + if test x"$acx_cv_option_search_uuid_create_c" = x; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: (none required)" >&5 +$as_echo "(none required)" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_option_search_uuid_create_c" >&5 +$as_echo "$acx_cv_option_search_uuid_create_c" >&6; } +fi +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 +$as_echo "not found" >&6; } + have_dce_uuid_c_bindings=no + +fi + + DCE_UUID_C_LIB=`echo "$acx_cv_option_search_uuid_create_c" | sed -e 's/^ *//;s/ *$//'` + +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_link="$ac_pwd/libtool --mode=link --tag=CC $ac_link" +ac_compile="$ac_pwd/libtool --mode=compile --tag=CC $ac_compile" + + if test x"$have_dce_uuid_c_bindings" = xyes; then : + acx_save_CPPFLAGS=$CPPFLAGS + CPPFLAGS="$CPPFLAGS $DCE_UUID_C_INCLUDE" + for ac_header in uuid.h +do : + ac_fn_c_check_header_compile "$LINENO" "uuid.h" "ac_cv_header_uuid_h" "$ac_includes_default +" +if test "x$ac_cv_header_uuid_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_UUID_H 1 +_ACEOF + ac_fn_c_check_decl "$LINENO" "uuid_create" "ac_cv_have_decl_uuid_create" "$ac_includes_default +#include <uuid.h> +" +if test "x$ac_cv_have_decl_uuid_create" = xyes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_UUID_CREATE $ac_have_decl +_ACEOF +if test $ac_have_decl = 1; then : + have_dce_uuid_c_bindings=yes +else + have_dce_uuid_c_bindings=no +fi + +else + have_dce_uuid_c_bindings=yes +fi + +done + + CPPFLAGS=$acx_save_CPPFLAGS +fi +fi + +if test x"$have_util_linux_uuid_c_bindings" = xyes; then : + UUID_C_INCLUDE=$UTIL_LINUX_UUID_C_INCLUDE + UUID_C_LIB=$UTIL_LINUX_UUID_C_LIB +elif test x"$have_ossp_uuid_c_bindings" = xyes; then : + UUID_C_INCLUDE=$OSSP_UUID_C_INCLUDE + UUID_C_LIB=$OSSP_UUID_C_LIB +elif test x"$have_dce_uuid_c_bindings" = xyes; then : + UUID_C_INCLUDE=$DCE_UUID_C_INCLUDE + UUID_C_LIB=$DCE_UUID_C_LIB +fi + + +as_fn_append CPPFLAGS " $UUID_C_INCLUDE" +LIBS="$UUID_C_LIB $LIBS" +ac_fn_c_check_decl "$LINENO" "isnan" "ac_cv_have_decl_isnan" "$ac_includes_default +#include <math.h> +" +if test "x$ac_cv_have_decl_isnan" = xyes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_ISNAN $ac_have_decl +_ACEOF + +ac_fn_c_check_decl "$LINENO" "_SC_LARGE_PAGESIZE" "ac_cv_have_decl__SC_LARGE_PAGESIZE" "$ac_includes_default +#include <limits.h> +#include <unistd.h> +" +if test "x$ac_cv_have_decl__SC_LARGE_PAGESIZE" = xyes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL__SC_LARGE_PAGESIZE $ac_have_decl +_ACEOF +ac_fn_c_check_decl "$LINENO" "PAGESIZE" "ac_cv_have_decl_PAGESIZE" "$ac_includes_default +#include <limits.h> +#include <unistd.h> +" +if test "x$ac_cv_have_decl_PAGESIZE" = xyes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_PAGESIZE $ac_have_decl +_ACEOF +ac_fn_c_check_decl "$LINENO" "PAGE_SIZE" "ac_cv_have_decl_PAGE_SIZE" "$ac_includes_default +#include <limits.h> +#include <unistd.h> +" +if test "x$ac_cv_have_decl_PAGE_SIZE" = xyes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_PAGE_SIZE $ac_have_decl +_ACEOF +ac_fn_c_check_decl "$LINENO" "_SC_PAGE_SIZE" "ac_cv_have_decl__SC_PAGE_SIZE" "$ac_includes_default +#include <limits.h> +#include <unistd.h> +" +if test "x$ac_cv_have_decl__SC_PAGE_SIZE" = xyes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL__SC_PAGE_SIZE $ac_have_decl +_ACEOF +ac_fn_c_check_decl "$LINENO" "_SC_PAGESIZE" "ac_cv_have_decl__SC_PAGESIZE" "$ac_includes_default +#include <limits.h> +#include <unistd.h> +" +if test "x$ac_cv_have_decl__SC_PAGESIZE" = xyes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL__SC_PAGESIZE $ac_have_decl +_ACEOF +ac_fn_c_check_decl "$LINENO" "_PC_REC_XFER_ALIGN" "ac_cv_have_decl__PC_REC_XFER_ALIGN" "$ac_includes_default +#include <limits.h> +#include <unistd.h> +" +if test "x$ac_cv_have_decl__PC_REC_XFER_ALIGN" = xyes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL__PC_REC_XFER_ALIGN $ac_have_decl +_ACEOF +ac_fn_c_check_decl "$LINENO" "POSIX_REC_XFER_ALIGN" "ac_cv_have_decl_POSIX_REC_XFER_ALIGN" "$ac_includes_default +#include <limits.h> +#include <unistd.h> +" +if test "x$ac_cv_have_decl_POSIX_REC_XFER_ALIGN" = xyes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_POSIX_REC_XFER_ALIGN $ac_have_decl +_ACEOF + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing floor" >&5 +$as_echo_n "checking for library containing floor... " >&6; } +if ${ac_cv_search_floor+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$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 floor (); +int +main () +{ +return floor (); + ; + return 0; +} +_ACEOF +for ac_lib in '' m; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_floor=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_floor+:} false; then : + break +fi +done +if ${ac_cv_search_floor+:} false; then : + +else + ac_cv_search_floor=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_floor" >&5 +$as_echo "$ac_cv_search_floor" >&6; } +ac_res=$ac_cv_search_floor +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + + +for builtin in __builtin_ctz +do : + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether __builtin_ctz is declared" >&5 +$as_echo_n "checking whether __builtin_ctz is declared... " >&6; } +if ${acx_cv_have_decl___builtin_ctz+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + unsigned lbz = __builtin_ctz(56U) + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + acx_cv_have_decl___builtin_ctz=yes +else + acx_cv_have_decl___builtin_ctz=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: $acx_cv_have_decl___builtin_ctz" >&5 +$as_echo "$acx_cv_have_decl___builtin_ctz" >&6; } + if test "x$acx_cv_have_decl___builtin_ctz" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL___BUILTIN_CTZ 1 +_ACEOF + + break +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL___BUILTIN_CTZ 0 +_ACEOF + +fi +done + + + +# ---------------------------------------------------------------------- +# Checks for multithreaded compiling + linking + +# Check whether --with-threads was given. +if test "${with_threads+set}" = set; then : + withval=$with_threads; +else + with_threads=yes +fi + +THREADS_INCLUDE='' +THREADS_LIBS='' +case $with_threads in #( + no) : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking multithreading" >&5 +$as_echo_n "checking multithreading... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: suppressed" >&5 +$as_echo "suppressed" >&6; } ;; #( + 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_link="$ac_pwd/libtool --mode=link --tag=CC $ac_link" +ac_compile="$ac_pwd/libtool --mode=compile --tag=CC $ac_compile" + +ax_pthread_ok=no + +# We used to check for pthread.h first, but this fails if pthread.h +# requires special compiler flags (e.g. on Tru64 or Sequent). +# It gets checked for in the link test anyway. + +# First of all, check if the user has set any of the PTHREAD_LIBS, +# etcetera environment variables, and if threads linking works using +# them: +if test "x$PTHREAD_CFLAGS$PTHREAD_LIBS" != "x"; then + ax_pthread_save_CC="$CC" + ax_pthread_save_CFLAGS="$CFLAGS" + ax_pthread_save_LIBS="$LIBS" + if test "x$PTHREAD_CC" != "x"; then : + CC="$PTHREAD_CC" +fi + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + LIBS="$PTHREAD_LIBS $LIBS" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_join using $CC $PTHREAD_CFLAGS $PTHREAD_LIBS" >&5 +$as_echo_n "checking for pthread_join using $CC $PTHREAD_CFLAGS $PTHREAD_LIBS... " >&6; } + 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_join (); +int +main () +{ +return pthread_join (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ax_pthread_ok=yes +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_pthread_ok" >&5 +$as_echo "$ax_pthread_ok" >&6; } + if test "x$ax_pthread_ok" = "xno"; then + PTHREAD_LIBS="" + PTHREAD_CFLAGS="" + fi + CC="$ax_pthread_save_CC" + CFLAGS="$ax_pthread_save_CFLAGS" + LIBS="$ax_pthread_save_LIBS" +fi + +# We must check for the threads library under a number of different +# names; the ordering is very important because some systems +# (e.g. DEC) have both -lpthread and -lpthreads, where one of the +# libraries is broken (non-POSIX). + +# Create a list of thread flags to try. Items with a "," contain both +# C compiler flags (before ",") and linker flags (after ","). Other items +# starting with a "-" are C compiler flags, and remaining items are +# library names, except for "none" which indicates that we try without +# any flags at all, and "pthread-config" which is a program returning +# the flags for the Pth emulation library. + +ax_pthread_flags="pthreads none -Kthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" + +# The ordering *is* (sometimes) important. Some notes on the +# individual items follow: + +# pthreads: AIX (must check this before -lpthread) +# none: in case threads are in libc; should be tried before -Kthread and +# other compiler flags to prevent continual compiler warnings +# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) +# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads), Tru64 +# (Note: HP C rejects this with "bad form for `-t' option") +# -pthreads: Solaris/gcc (Note: HP C also rejects) +# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it +# doesn't hurt to check since this sometimes defines pthreads and +# -D_REENTRANT too), HP C (must be checked before -lpthread, which +# is present but should not be used directly; and before -mthreads, +# because the compiler interprets this as "-mt" + "-hreads") +# -mthreads: Mingw32/gcc, Lynx/gcc +# pthread: Linux, etcetera +# --thread-safe: KAI C++ +# pthread-config: use pthread-config program (for GNU Pth library) + +case $host_os in + + freebsd*) + + # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) + # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) + + ax_pthread_flags="-kthread lthread $ax_pthread_flags" + ;; + + hpux*) + + # From the cc(1) man page: "[-mt] Sets various -D flags to enable + # multi-threading and also sets -lpthread." + + ax_pthread_flags="-mt -pthread pthread $ax_pthread_flags" + ;; + + openedition*) + + # IBM z/OS requires a feature-test macro to be defined in order to + # enable POSIX threads at all, so give the user a hint if this is + # not set. (We don't define these ourselves, as they can affect + # other portions of the system API in unpredictable ways.) + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +# if !defined(_OPEN_THREADS) && !defined(_UNIX03_THREADS) + AX_PTHREAD_ZOS_MISSING +# endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "AX_PTHREAD_ZOS_MISSING" >/dev/null 2>&1; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: IBM z/OS requires -D_OPEN_THREADS or -D_UNIX03_THREADS to enable pthreads support." >&5 +$as_echo "$as_me: WARNING: IBM z/OS requires -D_OPEN_THREADS or -D_UNIX03_THREADS to enable pthreads support." >&2;} +fi +rm -f conftest* + + ;; + + solaris*) + + # On Solaris (at least, for some versions), libc contains stubbed + # (non-functional) versions of the pthreads routines, so link-based + # tests will erroneously succeed. (N.B.: The stubs are missing + # pthread_cleanup_push, or rather a function called by this macro, + # so we could check for that, but who knows whether they'll stub + # that too in a future libc.) So we'll check first for the + # standard Solaris way of linking pthreads (-mt -lpthread). + + ax_pthread_flags="-mt,-lpthread pthread $ax_pthread_flags" + ;; +esac + +# Are we compiling with Clang? + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC is Clang" >&5 +$as_echo_n "checking whether $CC is Clang... " >&6; } +if ${ax_cv_PTHREAD_CLANG+:} false; then : + $as_echo_n "(cached) " >&6 +else + ax_cv_PTHREAD_CLANG=no + # Note that Autoconf sets GCC=yes for Clang as well as GCC + if test "x$GCC" = "xyes"; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Note: Clang 2.7 lacks __clang_[a-z]+__ */ +# if defined(__clang__) && defined(__llvm__) + AX_PTHREAD_CC_IS_CLANG +# endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "AX_PTHREAD_CC_IS_CLANG" >/dev/null 2>&1; then : + ax_cv_PTHREAD_CLANG=yes +fi +rm -f conftest* + + fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_CLANG" >&5 +$as_echo "$ax_cv_PTHREAD_CLANG" >&6; } +ax_pthread_clang="$ax_cv_PTHREAD_CLANG" + + +# GCC generally uses -pthread, or -pthreads on some platforms (e.g. SPARC) + +# Note that for GCC and Clang -pthread generally implies -lpthread, +# except when -nostdlib is passed. +# This is problematic using libtool to build C++ shared libraries with pthread: +# [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25460 +# [2] https://bugzilla.redhat.com/show_bug.cgi?id=661333 +# [3] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=468555 +# To solve this, first try -pthread together with -lpthread for GCC + +if test "x$GCC" = "xyes"; then : + ax_pthread_flags="-pthread,-lpthread -pthread -pthreads $ax_pthread_flags" +fi + +# Clang takes -pthread (never supported any other flag), but we'll try with -lpthread first + +if test "x$ax_pthread_clang" = "xyes"; then : + ax_pthread_flags="-pthread,-lpthread -pthread" +fi + + +# The presence of a feature test macro requesting re-entrant function +# definitions is, on some systems, a strong hint that pthreads support is +# correctly enabled + +case $host_os in + darwin* | hpux* | linux* | osf* | solaris*) + ax_pthread_check_macro="_REENTRANT" + ;; + + aix*) + ax_pthread_check_macro="_THREAD_SAFE" + ;; + + *) + ax_pthread_check_macro="--" + ;; +esac +if test "x$ax_pthread_check_macro" = "x--"; then : + ax_pthread_check_cond=0 +else + ax_pthread_check_cond="!defined($ax_pthread_check_macro)" +fi + + +if test "x$ax_pthread_ok" = "xno"; then +for ax_pthread_try_flag in $ax_pthread_flags; do + + case $ax_pthread_try_flag in + none) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads work without any flags" >&5 +$as_echo_n "checking whether pthreads work without any flags... " >&6; } + ;; + + *,*) + PTHREAD_CFLAGS=`echo $ax_pthread_try_flag | sed "s/^\(.*\),\(.*\)$/\1/"` + PTHREAD_LIBS=`echo $ax_pthread_try_flag | sed "s/^\(.*\),\(.*\)$/\2/"` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads work with \"$PTHREAD_CFLAGS\" and \"$PTHREAD_LIBS\"" >&5 +$as_echo_n "checking whether pthreads work with \"$PTHREAD_CFLAGS\" and \"$PTHREAD_LIBS\"... " >&6; } + ;; + + -*) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads work with $ax_pthread_try_flag" >&5 +$as_echo_n "checking whether pthreads work with $ax_pthread_try_flag... " >&6; } + PTHREAD_CFLAGS="$ax_pthread_try_flag" + ;; + + pthread-config) + # Extract the first word of "pthread-config", so it can be a program name with args. +set dummy pthread-config; 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_ax_pthread_config+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ax_pthread_config"; then + ac_cv_prog_ax_pthread_config="$ax_pthread_config" # 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_ax_pthread_config="yes" + $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 + + test -z "$ac_cv_prog_ax_pthread_config" && ac_cv_prog_ax_pthread_config="no" +fi +fi +ax_pthread_config=$ac_cv_prog_ax_pthread_config +if test -n "$ax_pthread_config"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_pthread_config" >&5 +$as_echo "$ax_pthread_config" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + if test "x$ax_pthread_config" = "xno"; then : + continue +fi + PTHREAD_CFLAGS="`pthread-config --cflags`" + PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" + ;; + + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the pthreads library -l$ax_pthread_try_flag" >&5 +$as_echo_n "checking for the pthreads library -l$ax_pthread_try_flag... " >&6; } + PTHREAD_LIBS="-l$ax_pthread_try_flag" + ;; + esac + + ax_pthread_save_CFLAGS="$CFLAGS" + ax_pthread_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + LIBS="$PTHREAD_LIBS $LIBS" + + # Check for various functions. We must include pthread.h, + # since some functions may be macros. (On the Sequent, we + # need a special flag -Kthread to make this header compile.) + # We check for pthread_join because it is in -lpthread on IRIX + # while pthread_create is in libc. We check for pthread_attr_init + # due to DEC craziness with -lpthreads. We check for + # pthread_cleanup_push because it is one of the few pthread + # functions on Solaris that doesn't have a non-functional libc stub. + # We try pthread_create on general principles. + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <pthread.h> +# if $ax_pthread_check_cond +# error "$ax_pthread_check_macro must be defined" +# endif + static void *some_global = NULL; + static void routine(void *a) + { + /* To avoid any unused-parameter or + unused-but-set-parameter warning. */ + some_global = a; + } + static void *start_routine(void *a) { return a; } +int +main () +{ +pthread_t th; pthread_attr_t attr; + pthread_create(&th, 0, start_routine, 0); + pthread_join(th, 0); + pthread_attr_init(&attr); + pthread_cleanup_push(routine, 0); + pthread_cleanup_pop(0) /* ; */ + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ax_pthread_ok=yes +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + + CFLAGS="$ax_pthread_save_CFLAGS" + LIBS="$ax_pthread_save_LIBS" + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_pthread_ok" >&5 +$as_echo "$ax_pthread_ok" >&6; } + if test "x$ax_pthread_ok" = "xyes"; then : + break +fi + + PTHREAD_LIBS="" + PTHREAD_CFLAGS="" +done +fi + + +# Clang needs special handling, because older versions handle the -pthread +# option in a rather... idiosyncratic way + +if test "x$ax_pthread_clang" = "xyes"; then + + # Clang takes -pthread; it has never supported any other flag + + # (Note 1: This will need to be revisited if a system that Clang + # supports has POSIX threads in a separate library. This tends not + # to be the way of modern systems, but it's conceivable.) + + # (Note 2: On some systems, notably Darwin, -pthread is not needed + # to get POSIX threads support; the API is always present and + # active. We could reasonably leave PTHREAD_CFLAGS empty. But + # -pthread does define _REENTRANT, and while the Darwin headers + # ignore this macro, third-party headers might not.) + + # However, older versions of Clang make a point of warning the user + # that, in an invocation where only linking and no compilation is + # taking place, the -pthread option has no effect ("argument unused + # during compilation"). They expect -pthread to be passed in only + # when source code is being compiled. + # + # Problem is, this is at odds with the way Automake and most other + # C build frameworks function, which is that the same flags used in + # compilation (CFLAGS) are also used in linking. Many systems + # supported by AX_PTHREAD require exactly this for POSIX threads + # support, and in fact it is often not straightforward to specify a + # flag that is used only in the compilation phase and not in + # linking. Such a scenario is extremely rare in practice. + # + # Even though use of the -pthread flag in linking would only print + # a warning, this can be a nuisance for well-run software projects + # that build with -Werror. So if the active version of Clang has + # this misfeature, we search for an option to squash it. + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether Clang needs flag to prevent \"argument unused\" warning when linking with -pthread" >&5 +$as_echo_n "checking whether Clang needs flag to prevent \"argument unused\" warning when linking with -pthread... " >&6; } +if ${ax_cv_PTHREAD_CLANG_NO_WARN_FLAG+:} false; then : + $as_echo_n "(cached) " >&6 +else + ax_cv_PTHREAD_CLANG_NO_WARN_FLAG=unknown + # Create an alternate version of $ac_link that compiles and + # links in two steps (.c -> .o, .o -> exe) instead of one + # (.c -> exe), because the warning occurs only in the second + # step + ax_pthread_save_ac_link="$ac_link" + ax_pthread_sed='s/conftest\.\$ac_ext/conftest.$ac_objext/g' + ax_pthread_link_step=`$as_echo "$ac_link" | sed "$ax_pthread_sed"` + ax_pthread_2step_ac_link="($ac_compile) && (echo ==== >&5) && ($ax_pthread_link_step)" + ax_pthread_save_CFLAGS="$CFLAGS" + for ax_pthread_try in '' -Qunused-arguments -Wno-unused-command-line-argument unknown; do + if test "x$ax_pthread_try" = "xunknown"; then : + break +fi + CFLAGS="-Werror -Wunknown-warning-option $ax_pthread_try -pthread $ax_pthread_save_CFLAGS" + ac_link="$ax_pthread_save_ac_link" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int main(void){return 0;} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_link="$ax_pthread_2step_ac_link" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int main(void){return 0;} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + break +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + done + ac_link="$ax_pthread_save_ac_link" + CFLAGS="$ax_pthread_save_CFLAGS" + if test "x$ax_pthread_try" = "x"; then : + ax_pthread_try=no +fi + ax_cv_PTHREAD_CLANG_NO_WARN_FLAG="$ax_pthread_try" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" >&5 +$as_echo "$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" >&6; } + + case "$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" in + no | unknown) ;; + *) PTHREAD_CFLAGS="$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG $PTHREAD_CFLAGS" ;; + esac + +fi # $ax_pthread_clang = yes + + + +# Various other checks: +if test "x$ax_pthread_ok" = "xyes"; then + ax_pthread_save_CFLAGS="$CFLAGS" + ax_pthread_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + LIBS="$PTHREAD_LIBS $LIBS" + + # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for joinable pthread attribute" >&5 +$as_echo_n "checking for joinable pthread attribute... " >&6; } +if ${ax_cv_PTHREAD_JOINABLE_ATTR+:} false; then : + $as_echo_n "(cached) " >&6 +else + ax_cv_PTHREAD_JOINABLE_ATTR=unknown + for ax_pthread_attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <pthread.h> +int +main () +{ +int attr = $ax_pthread_attr; return attr /* ; */ + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ax_cv_PTHREAD_JOINABLE_ATTR=$ax_pthread_attr; break +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + done + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_JOINABLE_ATTR" >&5 +$as_echo "$ax_cv_PTHREAD_JOINABLE_ATTR" >&6; } + if test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xunknown" && \ + test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xPTHREAD_CREATE_JOINABLE" && \ + test "x$ax_pthread_joinable_attr_defined" != "xyes"; then : + +cat >>confdefs.h <<_ACEOF +#define PTHREAD_CREATE_JOINABLE $ax_cv_PTHREAD_JOINABLE_ATTR +_ACEOF + + ax_pthread_joinable_attr_defined=yes + +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether more special flags are required for pthreads" >&5 +$as_echo_n "checking whether more special flags are required for pthreads... " >&6; } +if ${ax_cv_PTHREAD_SPECIAL_FLAGS+:} false; then : + $as_echo_n "(cached) " >&6 +else + ax_cv_PTHREAD_SPECIAL_FLAGS=no + case $host_os in + solaris*) + ax_cv_PTHREAD_SPECIAL_FLAGS="-D_POSIX_PTHREAD_SEMANTICS" + ;; + esac + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_SPECIAL_FLAGS" >&5 +$as_echo "$ax_cv_PTHREAD_SPECIAL_FLAGS" >&6; } + if test "x$ax_cv_PTHREAD_SPECIAL_FLAGS" != "xno" && \ + test "x$ax_pthread_special_flags_added" != "xyes"; then : + PTHREAD_CFLAGS="$ax_cv_PTHREAD_SPECIAL_FLAGS $PTHREAD_CFLAGS" + ax_pthread_special_flags_added=yes +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PTHREAD_PRIO_INHERIT" >&5 +$as_echo_n "checking for PTHREAD_PRIO_INHERIT... " >&6; } +if ${ax_cv_PTHREAD_PRIO_INHERIT+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <pthread.h> +int +main () +{ +int i = PTHREAD_PRIO_INHERIT; + return i; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ax_cv_PTHREAD_PRIO_INHERIT=yes +else + ax_cv_PTHREAD_PRIO_INHERIT=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: $ax_cv_PTHREAD_PRIO_INHERIT" >&5 +$as_echo "$ax_cv_PTHREAD_PRIO_INHERIT" >&6; } + if test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes" && \ + test "x$ax_pthread_prio_inherit_defined" != "xyes"; then : + +$as_echo "#define HAVE_PTHREAD_PRIO_INHERIT 1" >>confdefs.h + + ax_pthread_prio_inherit_defined=yes + +fi + + CFLAGS="$ax_pthread_save_CFLAGS" + LIBS="$ax_pthread_save_LIBS" + + # More AIX lossage: compile with *_r variant + if test "x$GCC" != "xyes"; then + case $host_os in + aix*) + case "x/$CC" in #( + x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6) : + #handle absolute path differently from PATH based program lookup + case "x$CC" in #( + x/*) : + if as_fn_executable_p ${CC}_r; then : + PTHREAD_CC="${CC}_r" +fi ;; #( + *) : + for ac_prog in ${CC}_r +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_PTHREAD_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$PTHREAD_CC"; then + ac_cv_prog_PTHREAD_CC="$PTHREAD_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_PTHREAD_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 +PTHREAD_CC=$ac_cv_prog_PTHREAD_CC +if test -n "$PTHREAD_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PTHREAD_CC" >&5 +$as_echo "$PTHREAD_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$PTHREAD_CC" && break +done +test -n "$PTHREAD_CC" || PTHREAD_CC="$CC" + ;; +esac ;; #( + *) : + ;; +esac + ;; + esac + fi +fi + +test -n "$PTHREAD_CC" || PTHREAD_CC="$CC" + + + + + +# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: +if test "x$ax_pthread_ok" = "xyes"; then + +$as_echo "#define HAVE_LIBPTHREAD 1" >>confdefs.h + + : +else + ax_pthread_ok=no + as_fn_error $? "multithreaded settings NOT found" "$LINENO" 5 +fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +ac_link="$ac_pwd/libtool --mode=link --tag=CC $ac_link" +ac_compile="$ac_pwd/libtool --mode=compile --tag=CC $ac_compile" + + + LIBS="$PTHREAD_LIBS $LIBS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + CC="$PTHREAD_CC" + $as_echo "CC:$CC CFLAGS:$CFLAGS LIBS:$LIBS" >&6 ;; #( + *) : + THREADS_ROOT=$with_threads + LDFLAGS="-L$THREADS_ROOT/lib $LDFLAGS" + CPPFLAGS="-I$THREADS_ROOT/include $CPPFLAGS " + for ac_header in pthread.h +do : + ac_fn_c_check_header_compile "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default +" +if test "x$ac_cv_header_pthread_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_PTHREAD_H 1 +_ACEOF + +fi + +done + + { $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 + + THREADS_LIBS=" -L$THREADS_ROOT/lib -lpthread" + THREADS_INCLUDE=" -I$THREADS_ROOT/include" ;; #( + *) : + ;; +esac + + +# ---------------------------------------------------------------------- +# Compile application with FDB5 library +FDB5_INCLUDE='' +FDB5_LIBS='' + +# Check whether --with-fdb5 was given. +if test "${with_fdb5+set}" = set; then : + withval=$with_fdb5; case "$with_fdb5" in #( + no) : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fdb5 library" >&5 +$as_echo_n "checking for fdb5 library... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: suppressed" >&5 +$as_echo "suppressed" >&6; } ;; #( + yes) : + for ac_header in fdb5/api/fdb_c.h +do : + ac_fn_c_check_header_compile "$LINENO" "fdb5/api/fdb_c.h" "ac_cv_header_fdb5_api_fdb_c_h" "$ac_includes_default +" +if test "x$ac_cv_header_fdb5_api_fdb_c_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_FDB5_API_FDB_C_H 1 +_ACEOF + +else + as_fn_error $? "Could not find fdb5/api/fdb_c.h" "$LINENO" 5 +fi + +done + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing fdb_initialise" >&5 +$as_echo_n "checking for library containing fdb_initialise... " >&6; } +if ${ac_cv_search_fdb_initialise+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$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 fdb_initialise (); +int +main () +{ +return fdb_initialise (); + ; + return 0; +} +_ACEOF +for ac_lib in '' fdb5; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_fdb_initialise=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_fdb_initialise+:} false; then : + break +fi +done +if ${ac_cv_search_fdb_initialise+:} false; then : + +else + ac_cv_search_fdb_initialise=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_fdb_initialise" >&5 +$as_echo "$ac_cv_search_fdb_initialise" >&6; } +ac_res=$ac_cv_search_fdb_initialise +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +$as_echo "#define HAVE_LIBFDB5 1" >>confdefs.h + +else + as_fn_error $? "Could not link to fdb5" "$LINENO" 5 +fi + + FDB5_LIBS=" -lfdb5" ;; #( + *) : + FDB5_ROOT=$with_fdb5 + if test -d "$FDB5_ROOT"; then : + LDFLAGS="-L$FDB5_ROOT/lib $LDFLAGS" + CPPFLAGS="-I$FDB5_ROOT/include $CPPFLAGS" + for ac_header in fdb5/api/fdb_c.h +do : + ac_fn_c_check_header_compile "$LINENO" "fdb5/api/fdb_c.h" "ac_cv_header_fdb5_api_fdb_c_h" "$ac_includes_default +" +if test "x$ac_cv_header_fdb5_api_fdb_c_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_FDB5_API_FDB_C_H 1 +_ACEOF + +else + as_fn_error $? "Could not find fdb5/api/fdb_c.h" "$LINENO" 5 +fi + +done + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing fdb_initialise" >&5 +$as_echo_n "checking for library containing fdb_initialise... " >&6; } +if ${ac_cv_search_fdb_initialise+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$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 fdb_initialise (); +int +main () +{ +return fdb_initialise (); + ; + return 0; +} +_ACEOF +for ac_lib in '' fdb5; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_fdb_initialise=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_fdb_initialise+:} false; then : + break +fi +done +if ${ac_cv_search_fdb_initialise+:} false; then : + +else + ac_cv_search_fdb_initialise=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_fdb_initialise" >&5 +$as_echo "$ac_cv_search_fdb_initialise" >&6; } +ac_res=$ac_cv_search_fdb_initialise +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +$as_echo "#define HAVE_LIBFDB5 1" >>confdefs.h + +else + as_fn_error $? "Could not link to fdb5" "$LINENO" 5 +fi + + FDB5_LIBS=" -L$FDB5_ROOT/lib -lfdb5" + FDB5_INCLUDE=" -I$FDB5_ROOT/include" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: $FDB5_ROOT is not a directory! FDB5 suppressed" >&5 +$as_echo "$as_me: $FDB5_ROOT is not a directory! FDB5 suppressed" >&6;} +fi ;; #( + *) : + ;; +esac +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fdb5 library" >&5 +$as_echo_n "checking for fdb5 library... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: suppressed" >&5 +$as_echo "suppressed" >&6; } +fi + + + +# ---------------------------------------------------------------------- +# Compile application with SZLIB library, needed for GRIB1 +SZLIB_INCLUDE='' +SZLIB_LIBS='' + +# Check whether --with-szlib was given. +if test "${with_szlib+set}" = set; then : + withval=$with_szlib; case "$with_szlib" in #( + no) : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for szlib library" >&5 +$as_echo_n "checking for szlib library... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: suppressed" >&5 +$as_echo "suppressed" >&6; } ;; #( + yes) : + for ac_header in szlib.h +do : + ac_fn_c_check_header_compile "$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 $? "Could not find szlib.h" "$LINENO" 5 +fi + +done + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing SZ_BufftoBuffCompress" >&5 +$as_echo_n "checking for library containing SZ_BufftoBuffCompress... " >&6; } +if ${ac_cv_search_SZ_BufftoBuffCompress+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$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 +for ac_lib in '' sz; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_SZ_BufftoBuffCompress=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_SZ_BufftoBuffCompress+:} false; then : + break +fi +done +if ${ac_cv_search_SZ_BufftoBuffCompress+:} false; then : + +else + ac_cv_search_SZ_BufftoBuffCompress=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_SZ_BufftoBuffCompress" >&5 +$as_echo "$ac_cv_search_SZ_BufftoBuffCompress" >&6; } +ac_res=$ac_cv_search_SZ_BufftoBuffCompress +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +$as_echo "#define HAVE_LIBSZ 1" >>confdefs.h + +else + as_fn_error $? "Could not link to szlib" "$LINENO" 5 +fi + + SZLIB_LIBS=" -lsz" ;; #( + *) : + SZLIB_ROOT=$with_szlib + if test -d "$SZLIB_ROOT"; then : + LDFLAGS="-L$SZLIB_ROOT/lib $LDFLAGS" + CPPFLAGS="-I$SZLIB_ROOT/include $CPPFLAGS" + for ac_header in szlib.h +do : + ac_fn_c_check_header_compile "$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 $? "Could not find szlib.h" "$LINENO" 5 +fi + +done + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing SZ_BufftoBuffCompress" >&5 +$as_echo_n "checking for library containing SZ_BufftoBuffCompress... " >&6; } +if ${ac_cv_search_SZ_BufftoBuffCompress+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$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 +for ac_lib in '' sz; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_SZ_BufftoBuffCompress=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_SZ_BufftoBuffCompress+:} false; then : + break +fi +done +if ${ac_cv_search_SZ_BufftoBuffCompress+:} false; then : + +else + ac_cv_search_SZ_BufftoBuffCompress=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_SZ_BufftoBuffCompress" >&5 +$as_echo "$ac_cv_search_SZ_BufftoBuffCompress" >&6; } +ac_res=$ac_cv_search_SZ_BufftoBuffCompress +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +$as_echo "#define HAVE_LIBSZ 1" >>confdefs.h + +else + as_fn_error $? "Could not link to szlib" "$LINENO" 5 +fi + + SZLIB_LIBS=" -L$SZLIB_ROOT/lib -lsz" + SZLIB_INCLUDE=" -I$SZLIB_ROOT/include" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: $SZLIB_ROOT is not a directory! SZLIB suppressed" >&5 +$as_echo "$as_me: $SZLIB_ROOT is not a directory! SZLIB suppressed" >&6;} +fi ;; #( + *) : + ;; +esac +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for szlib library" >&5 +$as_echo_n "checking for szlib library... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: suppressed" >&5 +$as_echo "suppressed" >&6; } +fi + + + +# ---------------------------------------------------------------------- +# Compile application with netcdf +NETCDF_ROOT='' +NETCDF_INCLUDE='' +NETCDF_LIBS='' +ENABLE_NETCDF=no +ENABLE_NC2=no +ENABLE_NC4=no +ENABLE_NC4HDF5=no +ENABLE_NC4SZLIB=no + +# Check whether --with-netcdf was given. +if test "${with_netcdf+set}" = set; then : + withval=$with_netcdf; case "$with_netcdf" in #( + no) : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for NetCDF library" >&5 +$as_echo_n "checking for NetCDF library... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: suppressed" >&5 +$as_echo "suppressed" >&6; } ;; #( + yes) : + for ac_header in netcdf.h +do : + ac_fn_c_check_header_compile "$LINENO" "netcdf.h" "ac_cv_header_netcdf_h" "$ac_includes_default +" +if test "x$ac_cv_header_netcdf_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_NETCDF_H 1 +_ACEOF + +else + as_fn_error $? "Could not find netcdf.h" "$LINENO" 5 +fi + +done + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing nc_open" >&5 +$as_echo_n "checking for library containing nc_open... " >&6; } +if ${ac_cv_search_nc_open+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$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 nc_open (); +int +main () +{ +return nc_open (); + ; + return 0; +} +_ACEOF +for ac_lib in '' netcdf; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_nc_open=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_nc_open+:} false; then : + break +fi +done +if ${ac_cv_search_nc_open+:} false; then : + +else + ac_cv_search_nc_open=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_nc_open" >&5 +$as_echo "$ac_cv_search_nc_open" >&6; } +ac_res=$ac_cv_search_nc_open +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +$as_echo "#define HAVE_LIBNETCDF 1" >>confdefs.h + + ENABLE_NETCDF=yes +else + as_fn_error $? "Could not link to NetCDF library" "$LINENO" 5 +fi + + NETCDF_LIBS=" -lnetcdf" + # Extract the first word of "nc-config", so it can be a program name with args. +set dummy nc-config; 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_NC_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$NC_CONFIG"; then + ac_cv_prog_NC_CONFIG="$NC_CONFIG" # 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_NC_CONFIG="nc-config" + $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 +NC_CONFIG=$ac_cv_prog_NC_CONFIG +if test -n "$NC_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NC_CONFIG" >&5 +$as_echo "$NC_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + ;; #( + *) : + if test -d "$with_netcdf"; then : + NETCDF_ROOT=$with_netcdf + LDFLAGS="-L$NETCDF_ROOT/lib $LDFLAGS" + CPPFLAGS="-I$NETCDF_ROOT/include $CPPFLAGS" + for ac_header in netcdf.h +do : + ac_fn_c_check_header_compile "$LINENO" "netcdf.h" "ac_cv_header_netcdf_h" "$ac_includes_default +" +if test "x$ac_cv_header_netcdf_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_NETCDF_H 1 +_ACEOF + +else + as_fn_error $? "Could not find netcdf.h" "$LINENO" 5 +fi + +done + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing nc_open" >&5 +$as_echo_n "checking for library containing nc_open... " >&6; } +if ${ac_cv_search_nc_open+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$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 nc_open (); +int +main () +{ +return nc_open (); + ; + return 0; +} +_ACEOF +for ac_lib in '' netcdf; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_nc_open=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_nc_open+:} false; then : + break +fi +done +if ${ac_cv_search_nc_open+:} false; then : + +else + ac_cv_search_nc_open=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_nc_open" >&5 +$as_echo "$ac_cv_search_nc_open" >&6; } +ac_res=$ac_cv_search_nc_open +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +$as_echo "#define HAVE_LIBNETCDF 1" >>confdefs.h + + ENABLE_NETCDF=yes +else + as_fn_error $? "Could not link to NetCDF library" "$LINENO" 5 +fi + + NETCDF_LIBS=" -L$NETCDF_ROOT/lib -lnetcdf" + NETCDF_INCLUDE=" -I$NETCDF_ROOT/include" + # Extract the first word of "nc-config", so it can be a program name with args. +set dummy nc-config; 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_NC_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$NC_CONFIG"; then + ac_cv_prog_NC_CONFIG="$NC_CONFIG" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in "$NETCDF_ROOT/bin" +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_NC_CONFIG="$NETCDF_ROOT/bin/nc-config" + $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 +NC_CONFIG=$ac_cv_prog_NC_CONFIG +if test -n "$NC_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NC_CONFIG" >&5 +$as_echo "$NC_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: $with_netcdf is not a directory! NetCDF suppressed" >&5 +$as_echo "$as_me: $with_netcdf is not a directory! NetCDF suppressed" >&6;} +fi ;; #( + *) : + ;; +esac +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for NetCDF library" >&5 +$as_echo_n "checking for NetCDF library... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: suppressed" >&5 +$as_echo "suppressed" >&6; } +fi + + +if test "x$ENABLE_NETCDF" = xyes; then : + if ${NC_CONFIG:+false} :; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Could not find nc-config! go on with default configuration" >&5 +$as_echo "$as_me: WARNING: Could not find nc-config! go on with default configuration" >&2;} +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking netcdf's OpenDAP support" >&5 +$as_echo_n "checking netcdf's OpenDAP support... " >&6; } +if ${acx_cv_have_libnc_dap+:} false; then : + $as_echo_n "(cached) " >&6 +else + acx_cv_have_libnc_dap=no + test "x$NC_CONFIG" != "x" && \ + test "x$($NC_CONFIG --has-dap)" = "xyes" && \ + acx_cv_have_libnc_dap=yes +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_have_libnc_dap" >&5 +$as_echo "$acx_cv_have_libnc_dap" >&6; } + if test "x$acx_cv_have_libnc_dap" = xyes; then : + +$as_echo "#define HAVE_LIBNC_DAP 1" >>confdefs.h + +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking netcdf's Zarr support" >&5 +$as_echo_n "checking netcdf's Zarr support... " >&6; } +if ${acx_cv_have_nczarr+:} false; then : + $as_echo_n "(cached) " >&6 +else + acx_cv_have_nczarr=no + test "x$NC_CONFIG" != "x" && \ + test "x$($NC_CONFIG --has-nczarr)" = "xyes" && \ + acx_cv_have_nczarr=yes +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_have_nczarr" >&5 +$as_echo "$acx_cv_have_nczarr" >&6; } + if test "x$acx_cv_have_nczarr" = xyes; then : + +$as_echo "#define HAVE_NCZARR 1" >>confdefs.h + +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking netcdf's nc2 support" >&5 +$as_echo_n "checking netcdf's nc2 support... " >&6; } +if ${acx_cv_have_netcdf2+:} false; then : + $as_echo_n "(cached) " >&6 +else + acx_cv_have_netcdf2=no + test "x$NC_CONFIG" != "x" && \ + test "x$($NC_CONFIG --has-nc2)" = "xyes" && \ + acx_cv_have_netcdf2=yes +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_have_netcdf2" >&5 +$as_echo "$acx_cv_have_netcdf2" >&6; } + if test "x$acx_cv_have_netcdf2" = xyes; then : + +$as_echo "#define HAVE_NETCDF2 1" >>confdefs.h + + ENABLE_NC2=yes +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking netcdf's nc4 support" >&5 +$as_echo_n "checking netcdf's nc4 support... " >&6; } +if ${acx_cv_have_netcdf4+:} false; then : + $as_echo_n "(cached) " >&6 +else + acx_cv_have_netcdf4=no + test "x$NC_CONFIG" != "x" && \ + test "x$($NC_CONFIG --has-nc4)" = "xyes" && \ + acx_cv_have_netcdf4=yes +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_have_netcdf4" >&5 +$as_echo "$acx_cv_have_netcdf4" >&6; } + if test "x$acx_cv_have_netcdf4" = xyes; then : + +$as_echo "#define HAVE_NETCDF4 1" >>confdefs.h + + ENABLE_NC4=yes +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking netcdf's nc4/hdf5 support" >&5 +$as_echo_n "checking netcdf's nc4/hdf5 support... " >&6; } +if ${acx_cv_have_nc4hdf5+:} false; then : + $as_echo_n "(cached) " >&6 +else + acx_cv_have_nc4hdf5=no + test "x$NC_CONFIG" != "x" && \ + test "x$($NC_CONFIG --has-hdf5)" = "xyes" && \ + acx_cv_have_nc4hdf5=yes +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_have_nc4hdf5" >&5 +$as_echo "$acx_cv_have_nc4hdf5" >&6; } + if test "x$acx_cv_have_nc4hdf5" = xyes; then : + +$as_echo "#define HAVE_NC4HDF5 1" >>confdefs.h + + ENABLE_NC4HDF5=yes +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking netcdf's nc4/szlib support" >&5 +$as_echo_n "checking netcdf's nc4/szlib support... " >&6; } +if ${acx_cv_have_nc4szlib+:} false; then : + $as_echo_n "(cached) " >&6 +else + acx_cv_have_nc4szlib=no + test "x$NC_CONFIG" != "x" && \ + test "x$($NC_CONFIG --has-szlib)" = "xyes" && \ + acx_cv_have_nc4szlib=yes +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_have_nc4szlib" >&5 +$as_echo "$acx_cv_have_nc4szlib" >&6; } + if test "x$acx_cv_have_nc4szlib" = xyes; then : + +$as_echo "#define HAVE_NC4SZLIB 1" >>confdefs.h + + ENABLE_NC4SZLIB=yes +fi +fi + +if test "x$ENABLE_NC4SZLIB" = "xyes"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing nc_def_var_szip" >&5 +$as_echo_n "checking for library containing nc_def_var_szip... " >&6; } +if ${ac_cv_search_nc_def_var_szip+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$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 nc_def_var_szip (); +int +main () +{ +return nc_def_var_szip (); + ; + return 0; +} +_ACEOF +for ac_lib in '' netcdf; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_nc_def_var_szip=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_nc_def_var_szip+:} false; then : + break +fi +done +if ${ac_cv_search_nc_def_var_szip+:} false; then : + +else + ac_cv_search_nc_def_var_szip=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_nc_def_var_szip" >&5 +$as_echo "$ac_cv_search_nc_def_var_szip" >&6; } +ac_res=$ac_cv_search_nc_def_var_szip +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +$as_echo "#define HAVE_NC_DEF_VAR_SZIP 1" >>confdefs.h + +fi + +fi + +if test "x$ENABLE_NC4HDF5" = "xyes"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing H5TS_mutex_lock" >&5 +$as_echo_n "checking for library containing H5TS_mutex_lock... " >&6; } +if ${ac_cv_search_H5TS_mutex_lock+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$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 H5TS_mutex_lock (); +int +main () +{ +return H5TS_mutex_lock (); + ; + return 0; +} +_ACEOF +for ac_lib in '' netcdf; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib -lhdf5 $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_H5TS_mutex_lock=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_H5TS_mutex_lock+:} false; then : + break +fi +done +if ${ac_cv_search_H5TS_mutex_lock+:} false; then : + +else + ac_cv_search_H5TS_mutex_lock=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_H5TS_mutex_lock" >&5 +$as_echo "$ac_cv_search_H5TS_mutex_lock" >&6; } +ac_res=$ac_cv_search_H5TS_mutex_lock +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +$as_echo "#define HAVE_NC4HDF5_THREADSAFE 1" >>confdefs.h + +fi + +fi + +if test "x$ENABLE_NC4HDF5" = "xyes"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing H5get_libversion" >&5 +$as_echo_n "checking for library containing H5get_libversion... " >&6; } +if ${ac_cv_search_H5get_libversion+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$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 H5get_libversion (); +int +main () +{ +return H5get_libversion (); + ; + return 0; +} +_ACEOF +for ac_lib in '' netcdf; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib -lhdf5 $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_H5get_libversion=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_H5get_libversion+:} false; then : + break +fi +done +if ${ac_cv_search_H5get_libversion+:} false; then : + +else + ac_cv_search_H5get_libversion=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_H5get_libversion" >&5 +$as_echo "$ac_cv_search_H5get_libversion" >&6; } +ac_res=$ac_cv_search_H5get_libversion +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +$as_echo "#define HAVE_H5GET_LIBVERSION 1" >>confdefs.h + +fi + +fi + + + + + + + + + +# ---------------------------------------------------------------------- +# Compile application with ECCODES library (for GRIB2 support) +ECCODES_INCLUDE='' +ECCODES_LIBS='' + +# Check whether --with-eccodes was given. +if test "${with_eccodes+set}" = set; then : + withval=$with_eccodes; case "$with_eccodes" in #( + no) : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ECCODES library" >&5 +$as_echo_n "checking for ECCODES library... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: suppressed" >&5 +$as_echo "suppressed" >&6; } ;; #( + yes) : + for ac_header in grib_api.h +do : + ac_fn_c_check_header_compile "$LINENO" "grib_api.h" "ac_cv_header_grib_api_h" "$ac_includes_default +" +if test "x$ac_cv_header_grib_api_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_GRIB_API_H 1 +_ACEOF + +else + as_fn_error $? "Could not find grib_api.h" "$LINENO" 5 +fi + +done + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing grib_get_message" >&5 +$as_echo_n "checking for library containing grib_get_message... " >&6; } +if ${ac_cv_search_grib_get_message+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$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 grib_get_message (); +int +main () +{ +return grib_get_message (); + ; + return 0; +} +_ACEOF +for ac_lib in '' eccodes; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_grib_get_message=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_grib_get_message+:} false; then : + break +fi +done +if ${ac_cv_search_grib_get_message+:} false; then : + +else + ac_cv_search_grib_get_message=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_grib_get_message" >&5 +$as_echo "$ac_cv_search_grib_get_message" >&6; } +ac_res=$ac_cv_search_grib_get_message +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +$as_echo "#define HAVE_LIBGRIB_API 1" >>confdefs.h + +else + as_fn_error $? "Could not link to eccodes library" "$LINENO" 5 +fi + ;; #( + *) : + ECCODES_ROOT=$with_eccodes + if test -d "$ECCODES_ROOT"; then : + LDFLAGS="-L$ECCODES_ROOT/lib $LDFLAGS" + CPPFLAGS="-I$ECCODES_ROOT/include $CPPFLAGS" + for ac_header in grib_api.h +do : + ac_fn_c_check_header_compile "$LINENO" "grib_api.h" "ac_cv_header_grib_api_h" "$ac_includes_default +" +if test "x$ac_cv_header_grib_api_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_GRIB_API_H 1 +_ACEOF + +else + as_fn_error $? "Could not find grib_api.h" "$LINENO" 5 +fi + +done + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing grib_get_message" >&5 +$as_echo_n "checking for library containing grib_get_message... " >&6; } +if ${ac_cv_search_grib_get_message+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$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 grib_get_message (); +int +main () +{ +return grib_get_message (); + ; + return 0; +} +_ACEOF +for ac_lib in '' eccodes; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_grib_get_message=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_grib_get_message+:} false; then : + break +fi +done +if ${ac_cv_search_grib_get_message+:} false; then : + +else + ac_cv_search_grib_get_message=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_grib_get_message" >&5 +$as_echo "$ac_cv_search_grib_get_message" >&6; } +ac_res=$ac_cv_search_grib_get_message +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +$as_echo "#define HAVE_LIBGRIB_API 1" >>confdefs.h + +else + as_fn_error $? "Could not link to eccodes library" "$LINENO" 5 +fi + + ECCODES_LIBS=" -L$ECCODES_ROOT/lib -leccodes" + ECCODES_INCLUDE=" -I$ECCODES_ROOT/include" +else + as_fn_error $? "$ECCODES_ROOT is not a directory! ECCODES suppressed" "$LINENO" 5 +fi ;; #( + *) : + ;; +esac +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the ECCODES library" >&5 +$as_echo_n "checking for the ECCODES library... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: suppressed" >&5 +$as_echo "suppressed" >&6; } +fi + + + +# AM_CONDITIONAL([HAVE_LIBGRIB_API],[test "x$with_eccodes" != 'x' -a "x$with_eccodes" != 'xno' ]) +# ---------------------------------------------------------------------- +# Compile application with GRIB_API library (for GRIB2 support) +GRIB_API_INCLUDE='' +GRIB_API_LIBS='' + +# Check whether --with-grib_api was given. +if test "${with_grib_api+set}" = set; then : + withval=$with_grib_api; case "$with_grib_api" in #( + no) : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GRIB_API library" >&5 +$as_echo_n "checking for GRIB_API library... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: suppressed" >&5 +$as_echo "suppressed" >&6; } ;; #( + yes) : + for ac_header in grib_api.h +do : + ac_fn_c_check_header_compile "$LINENO" "grib_api.h" "ac_cv_header_grib_api_h" "$ac_includes_default +" +if test "x$ac_cv_header_grib_api_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_GRIB_API_H 1 +_ACEOF + +else + as_fn_error $? "Could not find grib_api.h" "$LINENO" 5 +fi + +done + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing grib_get_message" >&5 +$as_echo_n "checking for library containing grib_get_message... " >&6; } +if ${ac_cv_search_grib_get_message+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$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 grib_get_message (); +int +main () +{ +return grib_get_message (); + ; + return 0; +} +_ACEOF +for ac_lib in '' grib_api; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_grib_get_message=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_grib_get_message+:} false; then : + break +fi +done +if ${ac_cv_search_grib_get_message+:} false; then : + +else + ac_cv_search_grib_get_message=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_grib_get_message" >&5 +$as_echo "$ac_cv_search_grib_get_message" >&6; } +ac_res=$ac_cv_search_grib_get_message +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +$as_echo "#define HAVE_LIBGRIB_API 1" >>confdefs.h + +else + as_fn_error $? "Could not link to grib_api library" "$LINENO" 5 +fi + ;; #( + *) : + GRIB_API_ROOT=$with_grib_api + if test -d "$GRIB_API_ROOT"; then : + LDFLAGS="-L$GRIB_API_ROOT/lib $LDFLAGS" + CPPFLAGS="-I$GRIB_API_ROOT/include $CPPFLAGS" + for ac_header in grib_api.h +do : + ac_fn_c_check_header_compile "$LINENO" "grib_api.h" "ac_cv_header_grib_api_h" "$ac_includes_default +" +if test "x$ac_cv_header_grib_api_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_GRIB_API_H 1 +_ACEOF + +else + as_fn_error $? "Could not find grib_api.h" "$LINENO" 5 +fi + +done + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing grib_get_message" >&5 +$as_echo_n "checking for library containing grib_get_message... " >&6; } +if ${ac_cv_search_grib_get_message+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$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 grib_get_message (); +int +main () +{ +return grib_get_message (); + ; + return 0; +} +_ACEOF +for ac_lib in '' grib_api; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_grib_get_message=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_grib_get_message+:} false; then : + break +fi +done +if ${ac_cv_search_grib_get_message+:} false; then : + +else + ac_cv_search_grib_get_message=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_grib_get_message" >&5 +$as_echo "$ac_cv_search_grib_get_message" >&6; } +ac_res=$ac_cv_search_grib_get_message +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +$as_echo "#define HAVE_LIBGRIB_API 1" >>confdefs.h + +else + as_fn_error $? "Could not link to grib_api library" "$LINENO" 5 +fi + + GRIB_API_LIBS=" -L$GRIB_API_ROOT/lib -lgrib_api" + GRIB_API_INCLUDE=" -I$GRIB_API_ROOT/include" +else + as_fn_error $? "$GRIB_API_ROOT is not a directory! GRIB_API suppressed" "$LINENO" 5 +fi ;; #( + *) : + ;; +esac +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the GRIB_API library" >&5 +$as_echo_n "checking for the GRIB_API library... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: suppressed" >&5 +$as_echo "suppressed" >&6; } +fi + + + + if test \( "x$with_grib_api" != 'x' -a "x$with_grib_api" != 'xno' \) -o \( "x$with_eccodes" != 'x' -a "x$with_eccodes" != 'xno' \) ; then + HAVE_LIBGRIB_API_TRUE= + HAVE_LIBGRIB_API_FALSE='#' +else + HAVE_LIBGRIB_API_TRUE='#' + HAVE_LIBGRIB_API_FALSE= +fi + +# ---------------------------------------------------------------------- +# Enable GRIB support +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GRIB support" >&5 +$as_echo_n "checking for GRIB support... " >&6; } +# Check whether --enable-grib was given. +if test "${enable_grib+set}" = set; then : + enableval=$enable_grib; if test "x$enable_grib" != 'xno'; then : + +$as_echo "#define HAVE_LIBGRIB 1" >>confdefs.h + + enable_grib=yes +fi +else + +$as_echo "#define HAVE_LIBGRIB 1" >>confdefs.h + + enable_grib=yes +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_grib" >&5 +$as_echo "$enable_grib" >&6; } +ENABLE_GRIB=$enable_grib + +# ---------------------------------------------------------------------- +# Enable ACROSS support +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ACROSS support" >&5 +$as_echo_n "checking for ACROSS support... " >&6; } +# Check whether --enable-across was given. +if test "${enable_across+set}" = set; then : + enableval=$enable_across; if test "x$enable_across" != 'xno'; then : + +$as_echo "#define HAVE_ACROSS 1" >>confdefs.h + + enable_across=yes +fi +else + +$as_echo "#define HAVE_ACROSS 1" >>confdefs.h + + enable_across=yes +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_across" >&5 +$as_echo "$enable_across" >&6; } +ENABLE_ACROSS=$enable_across + +# ---------------------------------------------------------------------- +# Compile interface with internal CGRIBEX library +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for CGRIBEX support" >&5 +$as_echo_n "checking for CGRIBEX support... " >&6; } +# Check whether --enable-cgribex was given. +if test "${enable_cgribex+set}" = set; then : + enableval=$enable_cgribex; if test "x$enable_cgribex" != 'xno'; then : + +$as_echo "#define HAVE_LIBCGRIBEX 1" >>confdefs.h + + enable_cgribex=yes +fi +else + +$as_echo "#define HAVE_LIBCGRIBEX 1" >>confdefs.h + + enable_cgribex=yes +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_cgribex" >&5 +$as_echo "$enable_cgribex" >&6; } +ENABLE_CGRIBEX=$enable_cgribex + +# ---------------------------------------------------------------------- +# Compile interface with internal SERVICE library +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SERVICE support" >&5 +$as_echo_n "checking for SERVICE support... " >&6; } +# Check whether --enable-service was given. +if test "${enable_service+set}" = set; then : + enableval=$enable_service; if test "x$enable_service" != 'xno'; then : + +$as_echo "#define HAVE_LIBSERVICE 1" >>confdefs.h + + enable_service=yes +fi +else + +$as_echo "#define HAVE_LIBSERVICE 1" >>confdefs.h + + enable_service=yes +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_service" >&5 +$as_echo "$enable_service" >&6; } +ENABLE_SERVICE=$enable_service + +# ---------------------------------------------------------------------- +# Compile interface with internal EXTRA library +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for EXTRA support" >&5 +$as_echo_n "checking for EXTRA support... " >&6; } +# Check whether --enable-extra was given. +if test "${enable_extra+set}" = set; then : + enableval=$enable_extra; if test "x$enable_extra" != 'xno'; then : + +$as_echo "#define HAVE_LIBEXTRA 1" >>confdefs.h + + enable_extra=yes +fi +else + +$as_echo "#define HAVE_LIBEXTRA 1" >>confdefs.h + + enable_extra=yes +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_extra" >&5 +$as_echo "$enable_extra" >&6; } +ENABLE_EXTRA=$enable_extra + +# ---------------------------------------------------------------------- +# Compile interface with internal IEG library +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for IEG support" >&5 +$as_echo_n "checking for IEG support... " >&6; } +# Check whether --enable-ieg was given. +if test "${enable_ieg+set}" = set; then : + enableval=$enable_ieg; if test "x$enable_ieg" != 'xno'; then : + +$as_echo "#define HAVE_LIBIEG 1" >>confdefs.h + + enable_ieg=yes +fi +else + +$as_echo "#define HAVE_LIBIEG 1" >>confdefs.h + + enable_ieg=yes +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_ieg" >&5 +$as_echo "$enable_ieg" >&6; } +ENABLE_IEG=$enable_ieg + +# ---------------------------------------------------------------------- +# At the moment, there are two possible CDI bindings +# (default for CDO) linking directly to CDI convenience library with libtool +# (default for CDI) build and link to a shared CDI library +if test "x$CDO_DISABLE_CDILIB" = "x1"; then : + enable_cdi_lib=no +else + enable_cdi_lib=yes +fi +# save CDI binding mode for later automake use + if test x$enable_cdi_lib = 'xyes'; then + ENABLE_CDI_LIB_TRUE= + ENABLE_CDI_LIB_FALSE='#' +else + ENABLE_CDI_LIB_TRUE='#' + ENABLE_CDI_LIB_FALSE= +fi + +# create shell variables for the representation of configure results +if test x$enable_cdi_lib = 'xno'; then : + ENABLE_CDI_LIB=false + +else + ENABLE_CDI_LIB=true + +fi +# ---------------------------------------------------------------------- +# Build a static CDI +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for building an additional static CDI binary" >&5 +$as_echo_n "checking for building an additional static CDI binary... " >&6; } +# Check whether --enable-all-static was given. +if test "${enable_all_static+set}" = set; then : + enableval=$enable_all_static; if test "x$enable_all_static" != "xno"; then : + enable_all_static=yes +else + enable_all_static=no +fi +else + enable_all_static=no +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_all_static" >&5 +$as_echo "$enable_all_static" >&6; } + if test x$enable_all_static = 'xyes'; then + ENABLE_ALL_STATIC_TRUE= + ENABLE_ALL_STATIC_FALSE='#' +else + ENABLE_ALL_STATIC_TRUE='#' + ENABLE_ALL_STATIC_FALSE= +fi + +# ---------------------------------------------------------------------- +# Build CDO with HIRLAM extensions +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for HIRLAM extensions" >&5 +$as_echo_n "checking for HIRLAM extensions... " >&6; } +# Check whether --enable-hirlam-extensions was given. +if test "${enable_hirlam_extensions+set}" = set; then : + enableval=$enable_hirlam_extensions; if test "x$enable_hirlam_extensions" != "xno"; then : + +$as_echo "#define HIRLAM_EXTENSIONS 1" >>confdefs.h + + enable_hirlam_extensions=yes +else + enable_hirlam_extensions=no +fi +else + enable_hirlam_extensions=no +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_hirlam_extensions" >&5 +$as_echo "$enable_hirlam_extensions" >&6; } + if test x$enable_hirlam_extensions = 'xyes'; then + ENABLE_HIRLAM_EXTENSIONS_TRUE= + ENABLE_HIRLAM_EXTENSIONS_FALSE='#' +else + ENABLE_HIRLAM_EXTENSIONS_TRUE='#' + ENABLE_HIRLAM_EXTENSIONS_FALSE= +fi + +# ---------------------------------------------------------------------- +# Build CDI application +# Check whether --enable-cdi-app was given. +if test "${enable_cdi_app+set}" = set; then : + enableval=$enable_cdi_app; +else + enable_cdi_app=yes +fi + + if test x$enable_cdi_app = 'xyes'; then + ENABLE_CDI_APP_TRUE= + ENABLE_CDI_APP_FALSE='#' +else + ENABLE_CDI_APP_TRUE='#' + ENABLE_CDI_APP_FALSE= +fi + +# + + if test "x$ENABLE_NETCDF" = xyes; then + ENABLE_NETCDF_TRUE= + ENABLE_NETCDF_FALSE='#' +else + ENABLE_NETCDF_TRUE='#' + ENABLE_NETCDF_FALSE= +fi + +for ac_func in grib_get_length +do : + ac_fn_c_check_func "$LINENO" "grib_get_length" "ac_cv_func_grib_get_length" +if test "x$ac_cv_func_grib_get_length" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_GRIB_GET_LENGTH 1 +_ACEOF + +fi +done + + + +cat >>confdefs.h <<_ACEOF +#define COMPILER "$CC $CFLAGS" +_ACEOF + +COMP_VERSION= +case $CC in #( + pgcc*) : + COMP_VERSION=`$CC -V | head -2 | tail -n 1` ;; #( + *gcc*) : + COMP_VERSION=`$CC --version | head -n 1` ;; #( + g++*) : + COMP_VERSION=`$CC --version | head -n 1` ;; #( + clang*) : + COMP_VERSION=`$CC --version | head -n 1` ;; #( + sxc*) : + COMP_VERSION=`$CC -V 2>&1 | tail -n 1` ;; #( + xlc*) : + COMP_VERSION=`$CC -qversion 2>&1 | head -n 1` ;; #( + *) : + COMP_VERSION=`$CC -V 2>&1 | sed -n 1p` ;; +esac +test -z "$COMP_VERSION" && COMP_VERSION=unknown + +cat >>confdefs.h <<_ACEOF +#define COMP_VERSION "$COMP_VERSION" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define SYSTEM_TYPE "$ac_cv_build" +_ACEOF + +SYSTEM_TYPE="$ac_cv_build" + + +# Check whether --enable-ppm-dist-array was given. +if test "${enable_ppm_dist_array+set}" = set; then : + enableval=$enable_ppm_dist_array; case $enableval in #( + no|auto) : + ;; #( + *) : + if test "x$enable_mpi" = xno; then : + as_fn_error $? "usage of the PPM distributed array can be enabled (--enable-ppm-dist-array) only if the parallel I/O with MPI is enabled (--enable-mpi)" "$LINENO" 5 +fi + enable_ppm_dist_array=yes ;; +esac +else + enable_ppm_dist_array=auto +fi + + +build_pio_fc_programs=no +have_ppm=no +HAVE_PPM_DIST_ARRAY=no + + +have_parallel_nc4=no +if test "x$enable_mpi" = xyes; then : + 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_link="$ac_pwd/libtool --mode=link --tag=CC $ac_link" +ac_compile="$ac_pwd/libtool --mode=compile --tag=CC $ac_compile" + + + + + + + + have_MPI_c_bindings=yes + + +# Check whether --with-mpi-root was given. +if test "${with_mpi_root+set}" = set; then : + withval=$with_mpi_root; MPIROOT=$withval +fi + + if ${MPIROOT+:} false; then : + if ${MPI_C_LIB+:} false; then : + +else + MPI_C_LIB="-L$MPIROOT/lib" +fi + if ${MPI_C_INCLUDE+:} false; then : + +else + MPI_C_INCLUDE="-I$MPIROOT/include" +fi +fi + +# Check whether --with-mpi-include was given. +if test "${with_mpi_include+set}" = set; then : + withval=$with_mpi_include; MPI_C_INCLUDE="-I$withval" +fi + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for mpi.h extra include path" >&5 +$as_echo_n "checking for mpi.h extra include path... " >&6; } + if ${acx_cv_c_include_mpi_h+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_include_search_mpi_h_SAVE="$CPPFLAGS" + while :; do + for ac_incdir in '' +do : + if test -z "$ac_incdir"; then : + ac_res="none required" + CPPFLAGS="$MPI_C_INCLUDE $ac_include_search_mpi_h_SAVE" +else + ac_res="-I$ac_incdir" + CPPFLAGS="$MPI_C_INCLUDE $ac_res $ac_include_search_mpi_h_SAVE" +fi + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +#include <mpi.h> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + acx_cv_c_include_mpi_h=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if ${acx_cv_c_include_mpi_h+:} false; then : + if test -z "$ac_incdir"; then : + acx_cv_c_include_mpi_h="$MPI_C_INCLUDE" +else + acx_cv_c_include_mpi_h="$MPI_C_INCLUDE -I$ac_incdir" +fi +fi + if ${acx_cv_c_include_mpi_h+:} false; then : + break +fi +done + if ${acx_cv_c_include_mpi_h+:} false; then : + break +fi + + break + done + CPPFLAGS=$ac_include_search_mpi_h_SAVE +fi + + if ${acx_cv_c_include_mpi_h+:} false; then : + if test x"$acx_cv_c_include_mpi_h" = x; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: (none required)" >&5 +$as_echo "(none required)" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_c_include_mpi_h" >&5 +$as_echo "$acx_cv_c_include_mpi_h" >&6; } +fi + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 +$as_echo "not found" >&6; } +fi + if ${acx_cv_c_include_mpi_h+:} false; then : + MPI_C_INCLUDE=`echo "$acx_cv_c_include_mpi_h" | sed -e 's/^ *//;s/ *$//'` +else + have_MPI_c_bindings=no; { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "required header mpi.h not found or not compilable +See \`config.log' for more details" "$LINENO" 5; } +fi + + +# Check whether --with-mpi-lib was given. +if test "${with_mpi_lib+set}" = set; then : + withval=$with_mpi_lib; MPI_C_LIB="-L$withval" +fi + + if test "x$have_MPI_c_bindings" = xyes; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing MPI_Waitall" >&5 +$as_echo_n "checking for library containing MPI_Waitall... " >&6; } + if ${acx_cv_option_search_MPI_Waitall_c+:} false; then : + $as_echo_n "(cached) " >&6 +else + acx_option_func_search_save_LIBS=$LIBS + while :; do + 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 MPI_Waitall (); +int +main () +{ +return MPI_Waitall (); + ; + return 0; +} +_ACEOF + for ac_lib in '' mpi mpich +do : + if test -z "$ac_lib"; then : + ac_res="none required" + LIBS="$MPI_C_LIB $acx_option_func_search_save_LIBS" +else + ac_res="-l$ac_lib" + LIBS="$MPI_C_LIB $ac_res $acx_option_func_search_save_LIBS" +fi + if ac_fn_c_try_link "$LINENO"; then : + if test x"$ac_res" = x"none required"; then : + acx_cv_option_search_MPI_Waitall_c="$MPI_C_LIB" +else + acx_cv_option_search_MPI_Waitall_c="$MPI_C_LIB -l$ac_lib" +fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${acx_cv_option_search_MPI_Waitall_c+:} false; then : + break +fi +done + rm conftest.$ac_ext + if ${acx_cv_option_search_MPI_Waitall_c+:} false; then : + break +fi + for acx_libset in "" +do : + 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 MPI_Waitall (); +int +main () +{ +return MPI_Waitall (); + ; + return 0; +} +_ACEOF + for ac_lib in '' mpi mpich +do : + if test -z "$ac_lib"; then : + ac_res="none required" + LIBS="$MPI_C_LIB $acx_libset $acx_option_func_search_save_LIBS" +else + ac_res="-l$ac_lib" + LIBS="$MPI_C_LIB $ac_res $acx_libset $acx_option_func_search_save_LIBS" +fi + if ac_fn_c_try_link "$LINENO"; then : + if test x"$ac_res" = x"none required"; then : + acx_cv_option_search_MPI_Waitall_c="$MPI_C_LIB $acx_libset" +else + acx_cv_option_search_MPI_Waitall_c="$MPI_C_LIB -l$ac_lib $acx_libset" +fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${acx_cv_option_search_MPI_Waitall_c+:} false; then : + break +fi +done + rm conftest.$ac_ext + if ${acx_cv_option_search_MPI_Waitall_c+:} false; then : + break +fi + +done + break + done + LIBS=$acx_option_func_search_save_LIBS +fi + + if ${acx_cv_option_search_MPI_Waitall_c+:} false; then : + if test x"$acx_cv_option_search_MPI_Waitall_c" = x; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: (none required)" >&5 +$as_echo "(none required)" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_option_search_MPI_Waitall_c" >&5 +$as_echo "$acx_cv_option_search_MPI_Waitall_c" >&6; } +fi +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 +$as_echo "not found" >&6; } + have_MPI_c_bindings=no + { { $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 link C MPI programs +See \`config.log' for more details" "$LINENO" 5; } +fi + + MPI_C_LIB=`echo "$acx_cv_option_search_MPI_Waitall_c" | sed -e 's/^ *//;s/ *$//'` + +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_link="$ac_pwd/libtool --mode=link --tag=CC $ac_link" +ac_compile="$ac_pwd/libtool --mode=compile --tag=CC $ac_compile" + + + saved_CPPFLAGS=$CPPFLAGS + saved_LIBS=$LIBS + as_fn_append CPPFLAGS " $MPI_C_INCLUDE" + LIBS="$MPI_C_LIB $LIBS" + for ac_prog in mpirun mpiexec +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_path_MPI_LAUNCH+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $MPI_LAUNCH in + [\\/]* | ?:[\\/]*) + ac_cv_path_MPI_LAUNCH="$MPI_LAUNCH" # Let the user override the test with a path. + ;; + *) + 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_path_MPI_LAUNCH="$as_dir/$ac_word$ac_exec_ext" + $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 + + ;; +esac +fi +MPI_LAUNCH=$ac_cv_path_MPI_LAUNCH +if test -n "$MPI_LAUNCH"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MPI_LAUNCH" >&5 +$as_echo "$MPI_LAUNCH" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$MPI_LAUNCH" && break +done +test -n "$MPI_LAUNCH" || MPI_LAUNCH="true" + + + if test x"$MPI_LAUNCH" = xtrue; then : + MPI_LAUNCH_failMsg="Failed to find MPI launcher" +else + if test x"$cross_compiling" = xno; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MPI_LAUNCH works" >&5 +$as_echo_n "checking if $MPI_LAUNCH works... " >&6; } + if test -x `echo "$MPI_LAUNCH" | sed -e 's/[ ].*//'`; then : + 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_link="$ac_pwd/libtool --mode=link --tag=CC $ac_link" +ac_compile="$ac_pwd/libtool --mode=compile --tag=CC $ac_compile" + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <stdio.h> +#include <stdlib.h> + +#include <mpi.h> + +#define xmpi(ret) \\ + do { \\ + if (ret != MPI_SUCCESS) \\ + exit(EXIT_FAILURE); \\ + } while (0) + +int +main(int argc, char **argv) +{ + xmpi(MPI_Init(&argc, &argv)); + char *numarg = argv[1]; + int cmdnum = atoi(numarg); + int procnum = 1; + xmpi(MPI_Allreduce(MPI_IN_PLACE, &procnum, 1, MPI_INT, MPI_SUM, + MPI_COMM_WORLD)); + xmpi(MPI_Finalize()); + return (procnum == cmdnum)?EXIT_SUCCESS:EXIT_FAILURE; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + acx_mpirun_test="$MPI_LAUNCH -n 4 ./conftest$EXEEXT 4" + if expr "$ac_link" : '.*/libtool --mode=link' >/dev/null; then : + acx_mpirun_test=`echo "$ac_link" | sed -e 's@\(.*/libtool --mode=\)link.*@\1@'`"execute $acx_mpirun_test" +fi + { { echo "running $acx_mpirun_test"; } >&5 + (LIBC_FATAL_STDERR_=1 $acx_mpirun_test >&2) 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 : + +else + MPI_LAUNCH=true ; MPI_LAUNCH_failMsg="Failed to run MPI programs" +fi +else + MPI_LAUNCH=true ; MPI_LAUNCH_failMsg="Cannot compile or link simple MPI program" +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 +ac_link="$ac_pwd/libtool --mode=link --tag=CC $ac_link" +ac_compile="$ac_pwd/libtool --mode=compile --tag=CC $ac_compile" + +else + MPI_LAUNCH_failMsg="Cannot execute $MPI_LAUNCH" ; MPI_LAUNCH=true +fi + if test x"$MPI_LAUNCH" = xtrue; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +fi +fi +fi + if test x"$MPI_LAUNCH" = xtrue; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: MPI launch command not found or not compilable" >&5 +$as_echo "$as_me: WARNING: MPI launch command not found or not compilable" >&2;} +else + : +fi + + CPPFLAGS=$saved_CPPFLAGS + LIBS=$saved_LIBS + + build_pio_fc_programs=$enable_cf_interface + test "x$FC" = xno && build_pio_fc_programs=no + if test "x$build_pio_fc_programs" = xyes; then : + 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 +ac_link="$ac_pwd/libtool --mode=link --tag=FC $ac_link" +ac_compile="$ac_pwd/libtool --mode=compile --tag=FC $ac_compile" + have_MPI_fc_bindings=yes + +# Check whether --with-mpi-root was given. +if test "${with_mpi_root+set}" = set; then : + withval=$with_mpi_root; MPIROOT=$withval +fi + + if ${MPIROOT+:} false; then : + if ${MPI_FC_LIB+:} false; then : + +else + MPI_FC_LIB="-L$MPIROOT/lib" +fi + if ${MPI_FC_MOD+:} false; then : + +else + MPI_FC_MOD="$FC_MOD_FLAG$MPIROOT/include" +fi +fi + +# Check whether --with-mpi-fc-mod was given. +if test "${with_mpi_fc_mod+set}" = set; then : + withval=$with_mpi_fc_mod; MPI_FC_MOD="$FC_MOD_FLAG$withval" +fi + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for mpi extra module path" >&5 +$as_echo_n "checking for mpi extra module path... " >&6; } + if ${acx_cv_fortran_mod_mpi+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_mod_search_FCFLAGS_SAVE=$FCFLAGS + for ac_moddir in '' "$MPIROOT/include" "$MPIROOT/lib" +do : + if test -z "$ac_moddir"; then : + ac_res="none required" + FCFLAGS="$MPI_FC_MOD $ac_mod_search_FCFLAGS_SAVE" +else + ac_res="$FC_MOD_FLAG$ac_moddir" + FCFLAGS="$MPI_FC_MOD $ac_res $ac_mod_search_FCFLAGS_SAVE" +fi + 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 +ac_link="$ac_pwd/libtool --mode=link --tag=FC $ac_link" +ac_compile="$ac_pwd/libtool --mode=compile --tag=FC $ac_compile" + + cat > conftest.$ac_ext <<_ACEOF + program conftest + use mpi + end +_ACEOF +if ac_fn_fc_try_compile "$LINENO"; then : + acx_cv_fortran_mod_mpi=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + 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 +ac_link="$ac_pwd/libtool --mode=link --tag=FC $ac_link" +ac_compile="$ac_pwd/libtool --mode=compile --tag=FC $ac_compile" + + if ${acx_cv_fortran_mod_mpi+:} false; then : + if test -z "$ac_moddir"; then : + acx_cv_fortran_mod_mpi="$MPI_FC_MOD" +else + acx_cv_fortran_mod_mpi="$MPI_FC_MOD $FC_MOD_FLAG$ac_moddir" +fi + break +fi +done + FCFLAGS=$ac_mod_search_FCFLAGS_SAVE +fi + + if ${acx_cv_fortran_mod_mpi+:} false; then : + if test x"$acx_cv_fortran_mod_mpi" = x; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: (none required)" >&5 +$as_echo "(none required)" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_fortran_mod_mpi" >&5 +$as_echo "$acx_cv_fortran_mod_mpi" >&6; } +fi + MPI_FC_MOD=$acx_cv_fortran_mod_mpi +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 +$as_echo "not found" >&6; } + have_MPI_fc_bindings=no; { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: required Fortran module mpi not found or not compilable" >&5 +$as_echo "$as_me: WARNING: required Fortran module mpi not found or not compilable" >&2;} + build_pio_fc_programs=no +fi + + +# Check whether --with-mpi-fc-lib was given. +if test "${with_mpi_fc_lib+set}" = set; then : + withval=$with_mpi_fc_lib; MPI_FC_LIB="-L$withval" +fi + + if test "x$have_MPI_fc_bindings" = xyes; then : + acx_save_FCFLAGS=$FCFLAGS + FCFLAGS="$MPI_FC_MOD $FCFLAGS" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing mpi_waitall" >&5 +$as_echo_n "checking for library containing mpi_waitall... " >&6; } + if ${acx_cv_option_search_mpi_waitall_fc+:} false; then : + $as_echo_n "(cached) " >&6 +else + acx_option_func_search_save_LIBS=$LIBS + while :; do + cat > conftest.$ac_ext <<_ACEOF + program conftest + use mpi + INTEGER :: req(1), stat(mpi_status_size, 1), ierror + call mpi_waitall(1, req, stat, ierror) + end +_ACEOF + for ac_lib in '' mpi mpi_f90 mpi_f77 mpich +do : + if test -z "$ac_lib"; then : + ac_res="none required" + LIBS="$MPI_FC_LIB $acx_option_func_search_save_LIBS" +else + ac_res="-l$ac_lib" + LIBS="$MPI_FC_LIB $ac_res $acx_option_func_search_save_LIBS" +fi + if ac_fn_fc_try_link "$LINENO"; then : + if test x"$ac_res" = x"none required"; then : + acx_cv_option_search_mpi_waitall_fc="$MPI_FC_LIB" +else + acx_cv_option_search_mpi_waitall_fc="$MPI_FC_LIB -l$ac_lib" +fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${acx_cv_option_search_mpi_waitall_fc+:} false; then : + break +fi +done + rm conftest.$ac_ext + if ${acx_cv_option_search_mpi_waitall_fc+:} false; then : + break +fi + for acx_libset in "-lmpi_f77 -lmpi" "-lmpi" +do : + cat > conftest.$ac_ext <<_ACEOF + program conftest + use mpi + INTEGER :: req(1), stat(mpi_status_size, 1), ierror + call mpi_waitall(1, req, stat, ierror) + end +_ACEOF + for ac_lib in '' mpi mpi_f90 mpi_f77 mpich +do : + if test -z "$ac_lib"; then : + ac_res="none required" + LIBS="$MPI_FC_LIB $acx_libset $acx_option_func_search_save_LIBS" +else + ac_res="-l$ac_lib" + LIBS="$MPI_FC_LIB $ac_res $acx_libset $acx_option_func_search_save_LIBS" +fi + if ac_fn_fc_try_link "$LINENO"; then : + if test x"$ac_res" = x"none required"; then : + acx_cv_option_search_mpi_waitall_fc="$MPI_FC_LIB $acx_libset" +else + acx_cv_option_search_mpi_waitall_fc="$MPI_FC_LIB -l$ac_lib $acx_libset" +fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${acx_cv_option_search_mpi_waitall_fc+:} false; then : + break +fi +done + rm conftest.$ac_ext + if ${acx_cv_option_search_mpi_waitall_fc+:} false; then : + break +fi + +done + break + done + LIBS=$acx_option_func_search_save_LIBS +fi + + if ${acx_cv_option_search_mpi_waitall_fc+:} false; then : + if test x"$acx_cv_option_search_mpi_waitall_fc" = x; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: (none required)" >&5 +$as_echo "(none required)" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_option_search_mpi_waitall_fc" >&5 +$as_echo "$acx_cv_option_search_mpi_waitall_fc" >&6; } +fi +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 +$as_echo "not found" >&6; } + have_MPI_fc_bindings=no ; { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot link Fortran MPI programs" >&5 +$as_echo "$as_me: WARNING: cannot link Fortran MPI programs" >&2;} + build_pio_fc_programs=no +fi + + FCFLAGS=$acx_save_FCFLAGS + MPI_FC_LIB=`echo "$acx_cv_option_search_mpi_waitall_fc" | sed -e 's/^ *//;s/ *$//'` + +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_link="$ac_pwd/libtool --mode=link --tag=CC $ac_link" +ac_compile="$ac_pwd/libtool --mode=compile --tag=CC $ac_compile" + +fi + + + + + + + + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. +set dummy ${ac_tool_prefix}pkg-config; 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_path_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + 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_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $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 + + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 +$as_echo "$PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_path_PKG_CONFIG"; then + ac_pt_PKG_CONFIG=$PKG_CONFIG + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; 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_path_ac_pt_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $ac_pt_PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + 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_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $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 + + ;; +esac +fi +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG +if test -n "$ac_pt_PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 +$as_echo "$ac_pt_PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_pt_PKG_CONFIG" = x; then + PKG_CONFIG="" + 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 + PKG_CONFIG=$ac_pt_PKG_CONFIG + fi +else + PKG_CONFIG="$ac_cv_path_PKG_CONFIG" +fi + +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=0.9.0 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 +$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + PKG_CONFIG="" + fi +fi + yaxt_c_CFLAGS=$YAXT_C_INCLUDE + yaxt_c_LIBS=$YAXT_C_LIB + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for yaxt_c" >&5 +$as_echo_n "checking for yaxt_c... " >&6; } + +if test -n "$yaxt_c_CFLAGS"; then + pkg_cv_yaxt_c_CFLAGS="$yaxt_c_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"yaxt_c\""; } >&5 + ($PKG_CONFIG --exists --print-errors "yaxt_c") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_yaxt_c_CFLAGS=`$PKG_CONFIG --cflags "yaxt_c" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$yaxt_c_LIBS"; then + pkg_cv_yaxt_c_LIBS="$yaxt_c_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"yaxt_c\""; } >&5 + ($PKG_CONFIG --exists --print-errors "yaxt_c") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_yaxt_c_LIBS=`$PKG_CONFIG --libs "yaxt_c" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + yaxt_c_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "yaxt_c" 2>&1` + else + yaxt_c_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "yaxt_c" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$yaxt_c_PKG_ERRORS" >&5 + + yaxt_CFLAGS=$YAXT_C_INCLUDE + yaxt_LIBS=$YAXT_C_LIB + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for yaxt" >&5 +$as_echo_n "checking for yaxt... " >&6; } + +if test -n "$yaxt_CFLAGS"; then + pkg_cv_yaxt_CFLAGS="$yaxt_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"yaxt\""; } >&5 + ($PKG_CONFIG --exists --print-errors "yaxt") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_yaxt_CFLAGS=`$PKG_CONFIG --cflags "yaxt" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$yaxt_LIBS"; then + pkg_cv_yaxt_LIBS="$yaxt_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"yaxt\""; } >&5 + ($PKG_CONFIG --exists --print-errors "yaxt") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_yaxt_LIBS=`$PKG_CONFIG --libs "yaxt" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + yaxt_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "yaxt" 2>&1` + else + yaxt_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "yaxt" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$yaxt_PKG_ERRORS" >&5 + + : +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + : +else + yaxt_CFLAGS=$pkg_cv_yaxt_CFLAGS + yaxt_LIBS=$pkg_cv_yaxt_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + YAXT_VERSION=`$PKG_CONFIG --modversion yaxt` + YAXT_MAJOR_VERSION=`expr X"$YAXT_VERSION" : "X\([0-9]*\)"` + YAXT_MINOR_VERSION=`echo "$YAXT_VERSION" | sed -e 's/^[0-9]*\.\([0-9]*\).*/\1/'` + if test "$YAXT_MAJOR_VERSION" -gt 0 -o "$YAXT_MINOR_VERSION" -gt 4; then : + YAXT_C_INCLUDE=$yaxt_CFLAGS + YAXT_C_LIB=`echo "$yaxt_LIBS" | sed -e 's/-lyaxt *$/-lyaxt_c/'` +fi +fi +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + yaxt_CFLAGS=$YAXT_C_INCLUDE + yaxt_LIBS=$YAXT_C_LIB + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for yaxt" >&5 +$as_echo_n "checking for yaxt... " >&6; } + +if test -n "$yaxt_CFLAGS"; then + pkg_cv_yaxt_CFLAGS="$yaxt_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"yaxt\""; } >&5 + ($PKG_CONFIG --exists --print-errors "yaxt") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_yaxt_CFLAGS=`$PKG_CONFIG --cflags "yaxt" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$yaxt_LIBS"; then + pkg_cv_yaxt_LIBS="$yaxt_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"yaxt\""; } >&5 + ($PKG_CONFIG --exists --print-errors "yaxt") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_yaxt_LIBS=`$PKG_CONFIG --libs "yaxt" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + yaxt_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "yaxt" 2>&1` + else + yaxt_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "yaxt" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$yaxt_PKG_ERRORS" >&5 + + : +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + : +else + yaxt_CFLAGS=$pkg_cv_yaxt_CFLAGS + yaxt_LIBS=$pkg_cv_yaxt_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + YAXT_VERSION=`$PKG_CONFIG --modversion yaxt` + YAXT_MAJOR_VERSION=`expr X"$YAXT_VERSION" : "X\([0-9]*\)"` + YAXT_MINOR_VERSION=`echo "$YAXT_VERSION" | sed -e 's/^[0-9]*\.\([0-9]*\).*/\1/'` + if test "$YAXT_MAJOR_VERSION" -gt 0 -o "$YAXT_MINOR_VERSION" -gt 4; then : + YAXT_C_INCLUDE=$yaxt_CFLAGS + YAXT_C_LIB=`echo "$yaxt_LIBS" | sed -e 's/-lyaxt *$/-lyaxt_c/'` +fi +fi +else + yaxt_c_CFLAGS=$pkg_cv_yaxt_c_CFLAGS + yaxt_c_LIBS=$pkg_cv_yaxt_c_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + YAXT_C_INCLUDE=$yaxt_c_CFLAGS + YAXT_C_LIB=$yaxt_c_LIBS +fi + saved_CPPFLAGS=$CPPFLAGS + saved_LIBS=$LIBS + as_fn_append CPPFLAGS " $MPI_C_INCLUDE" + LIBS="$MPI_C_LIB $LIBS" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for yaxt.h extra include path" >&5 +$as_echo_n "checking for yaxt.h extra include path... " >&6; } + if ${acx_cv_c_include_yaxt_h+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_include_search_yaxt_h_SAVE="$CPPFLAGS" + while :; do + for ac_incdir in '' +do : + if test -z "$ac_incdir"; then : + ac_res="none required" + CPPFLAGS="$YAXT_C_INCLUDE $ac_include_search_yaxt_h_SAVE" +else + ac_res="-I$ac_incdir" + CPPFLAGS="$YAXT_C_INCLUDE $ac_res $ac_include_search_yaxt_h_SAVE" +fi + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +#include <yaxt.h> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + acx_cv_c_include_yaxt_h=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if ${acx_cv_c_include_yaxt_h+:} false; then : + if test -z "$ac_incdir"; then : + acx_cv_c_include_yaxt_h="$YAXT_C_INCLUDE" +else + acx_cv_c_include_yaxt_h="$YAXT_C_INCLUDE -I$ac_incdir" +fi +fi + if ${acx_cv_c_include_yaxt_h+:} false; then : + break +fi +done + if ${acx_cv_c_include_yaxt_h+:} false; then : + break +fi + + break + done + CPPFLAGS=$ac_include_search_yaxt_h_SAVE +fi + + if ${acx_cv_c_include_yaxt_h+:} false; then : + if test x"$acx_cv_c_include_yaxt_h" = x; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: (none required)" >&5 +$as_echo "(none required)" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_c_include_yaxt_h" >&5 +$as_echo "$acx_cv_c_include_yaxt_h" >&6; } +fi + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 +$as_echo "not found" >&6; } +fi + if ${acx_cv_c_include_yaxt_h+:} false; then : + YAXT_C_INCLUDE=$acx_cv_c_include_yaxt_h + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing xt_initialized" >&5 +$as_echo_n "checking for library containing xt_initialized... " >&6; } + if ${acx_cv_option_search_xt_initialized_c+:} false; then : + $as_echo_n "(cached) " >&6 +else + acx_option_func_search_save_LIBS=$LIBS + while :; do + 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 xt_initialized (); +int +main () +{ +return xt_initialized (); + ; + return 0; +} +_ACEOF + for ac_lib in '' yaxt_c yaxt +do : + if test -z "$ac_lib"; then : + ac_res="none required" + LIBS="$YAXT_C_LIB $acx_option_func_search_save_LIBS" +else + ac_res="-l$ac_lib" + LIBS="$YAXT_C_LIB $ac_res $acx_option_func_search_save_LIBS" +fi + if ac_fn_c_try_link "$LINENO"; then : + if test x"$ac_res" = x"none required"; then : + acx_cv_option_search_xt_initialized_c="$YAXT_C_LIB" +else + acx_cv_option_search_xt_initialized_c="$YAXT_C_LIB -l$ac_lib" +fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${acx_cv_option_search_xt_initialized_c+:} false; then : + break +fi +done + rm conftest.$ac_ext + if ${acx_cv_option_search_xt_initialized_c+:} false; then : + break +fi + for acx_libset in "" +do : + 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 xt_initialized (); +int +main () +{ +return xt_initialized (); + ; + return 0; +} +_ACEOF + for ac_lib in '' yaxt_c yaxt +do : + if test -z "$ac_lib"; then : + ac_res="none required" + LIBS="$YAXT_C_LIB $acx_libset $acx_option_func_search_save_LIBS" +else + ac_res="-l$ac_lib" + LIBS="$YAXT_C_LIB $ac_res $acx_libset $acx_option_func_search_save_LIBS" +fi + if ac_fn_c_try_link "$LINENO"; then : + if test x"$ac_res" = x"none required"; then : + acx_cv_option_search_xt_initialized_c="$YAXT_C_LIB $acx_libset" +else + acx_cv_option_search_xt_initialized_c="$YAXT_C_LIB -l$ac_lib $acx_libset" +fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${acx_cv_option_search_xt_initialized_c+:} false; then : + break +fi +done + rm conftest.$ac_ext + if ${acx_cv_option_search_xt_initialized_c+:} false; then : + break +fi + +done + break + done + LIBS=$acx_option_func_search_save_LIBS +fi + + if ${acx_cv_option_search_xt_initialized_c+:} false; then : + if test x"$acx_cv_option_search_xt_initialized_c" = x; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: (none required)" >&5 +$as_echo "(none required)" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_option_search_xt_initialized_c" >&5 +$as_echo "$acx_cv_option_search_xt_initialized_c" >&6; } +fi + YAXT_C_LIB=$acx_cv_option_search_xt_initialized_c +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 +$as_echo "not found" >&6; } + { { $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 link C YAXT programs +See \`config.log' for more details" "$LINENO" 5; } +fi + +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "required header yaxt.h not found or not compilable +See \`config.log' for more details" "$LINENO" 5; } +fi + + defined_Xt_uid=no + ac_fn_c_check_decl "$LINENO" "MPI_UINT64_T" "ac_cv_have_decl_MPI_UINT64_T" "$ac_includes_default +#include <mpi.h> +" +if test "x$ac_cv_have_decl_MPI_UINT64_T" = xyes; then : + $as_echo "#define YAXT_UID_DT MPI_UINT64_T" >>confdefs.h + + defined_Xt_uid=yes +else + as_fn_append CPPFLAGS " $YAXT_C_INCLUDE" + LIBS="$YAXT_C_LIB $LIBS" + # 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 Xt_uid" >&5 +$as_echo_n "checking size of Xt_uid... " >&6; } +if ${ac_cv_sizeof_Xt_uid+:} false; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (Xt_uid))" "ac_cv_sizeof_Xt_uid" "$ac_includes_default +#include <yaxt.h> +"; then : + +else + if test "$ac_cv_type_Xt_uid" = 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 (Xt_uid) +See \`config.log' for more details" "$LINENO" 5; } + else + ac_cv_sizeof_Xt_uid=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_Xt_uid" >&5 +$as_echo "$ac_cv_sizeof_Xt_uid" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_XT_UID $ac_cv_sizeof_Xt_uid +_ACEOF + + + # 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 unsigned long" >&5 +$as_echo_n "checking size of unsigned long... " >&6; } +if ${ac_cv_sizeof_unsigned_long+:} false; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (unsigned long))" "ac_cv_sizeof_unsigned_long" "$ac_includes_default"; then : + +else + if test "$ac_cv_type_unsigned_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 (unsigned long) +See \`config.log' for more details" "$LINENO" 5; } + else + ac_cv_sizeof_unsigned_long=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_unsigned_long" >&5 +$as_echo "$ac_cv_sizeof_unsigned_long" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_UNSIGNED_LONG $ac_cv_sizeof_unsigned_long +_ACEOF + + + if test "$ac_cv_sizeof_unsigned_long" -eq "$ac_cv_sizeof_Xt_uid"; then : + $as_echo "#define YAXT_UID_DT MPI_UNSIGNED_LONG" >>confdefs.h + + defined_Xt_uid=yes +else + ac_fn_c_check_decl "$LINENO" "MPI_UNSIGNED_LONG_LONG" "ac_cv_have_decl_MPI_UNSIGNED_LONG_LONG" "$ac_includes_default +#include <mpi.h> +" +if test "x$ac_cv_have_decl_MPI_UNSIGNED_LONG_LONG" = xyes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_MPI_UNSIGNED_LONG_LONG $ac_have_decl +_ACEOF +if test $ac_have_decl = 1; 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 unsigned long long" >&5 +$as_echo_n "checking size of unsigned long long... " >&6; } +if ${ac_cv_sizeof_unsigned_long_long+:} false; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (unsigned long long))" "ac_cv_sizeof_unsigned_long_long" "$ac_includes_default"; then : + +else + if test "$ac_cv_type_unsigned_long_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 (unsigned long long) +See \`config.log' for more details" "$LINENO" 5; } + else + ac_cv_sizeof_unsigned_long_long=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_unsigned_long_long" >&5 +$as_echo "$ac_cv_sizeof_unsigned_long_long" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_UNSIGNED_LONG_LONG $ac_cv_sizeof_unsigned_long_long +_ACEOF + + + if test "$ac_cv_sizeof_unsigned_long_long" -eq "$ac_cv_sizeof_Xt_uid"; then : + $as_echo "#define YAXT_UID_DT MPI_UNSIGNED_LONG_LONG" >>confdefs.h + + defined_Xt_uid=yes +fi +fi + +fi +fi + + if test "x$defined_Xt_uid" = xno; 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 $? "no way to communicate Xt_uid found +See \`config.log' for more details" "$LINENO" 5; } +fi + { defined_Xt_uid=; unset defined_Xt_uid;} + CPPFLAGS=$saved_CPPFLAGS + LIBS=$saved_LIBS + + if test "x$build_pio_fc_programs" = xyes; then : + yaxt_CFLAGS=$YAXT_FC_MOD + yaxt_LIBS=$YAXT_FC_LIB + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for yaxt" >&5 +$as_echo_n "checking for yaxt... " >&6; } + +if test -n "$yaxt_CFLAGS"; then + pkg_cv_yaxt_CFLAGS="$yaxt_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"yaxt\""; } >&5 + ($PKG_CONFIG --exists --print-errors "yaxt") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_yaxt_CFLAGS=`$PKG_CONFIG --cflags "yaxt" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$yaxt_LIBS"; then + pkg_cv_yaxt_LIBS="$yaxt_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"yaxt\""; } >&5 + ($PKG_CONFIG --exists --print-errors "yaxt") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_yaxt_LIBS=`$PKG_CONFIG --libs "yaxt" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + yaxt_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "yaxt" 2>&1` + else + yaxt_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "yaxt" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$yaxt_PKG_ERRORS" >&5 + + : +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + : +else + yaxt_CFLAGS=$pkg_cv_yaxt_CFLAGS + yaxt_LIBS=$pkg_cv_yaxt_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + YAXT_FC_MOD=$yaxt_CFLAGS + YAXT_FC_LIB=$yaxt_LIBS +fi + saved_FCFLAGS=$FCFLAGS + saved_LIBS=$LIBS + as_fn_append FCFLAGS " $MPI_FC_MOD" + LIBS="$MPI_FC_LIB $LIBS" + 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 +ac_link="$ac_pwd/libtool --mode=link --tag=FC $ac_link" +ac_compile="$ac_pwd/libtool --mode=compile --tag=FC $ac_compile" + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for yaxt extra module path" >&5 +$as_echo_n "checking for yaxt extra module path... " >&6; } + if ${acx_cv_fortran_mod_yaxt+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_mod_search_FCFLAGS_SAVE=$FCFLAGS + for ac_moddir in '' +do : + if test -z "$ac_moddir"; then : + ac_res="none required" + FCFLAGS="$YAXT_FC_MOD $ac_mod_search_FCFLAGS_SAVE" +else + ac_res="$FC_MOD_FLAG$ac_moddir" + FCFLAGS="$YAXT_FC_MOD $ac_res $ac_mod_search_FCFLAGS_SAVE" +fi + 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 +ac_link="$ac_pwd/libtool --mode=link --tag=FC $ac_link" +ac_compile="$ac_pwd/libtool --mode=compile --tag=FC $ac_compile" + + cat > conftest.$ac_ext <<_ACEOF + program conftest + use yaxt + end +_ACEOF +if ac_fn_fc_try_compile "$LINENO"; then : + acx_cv_fortran_mod_yaxt=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + 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 +ac_link="$ac_pwd/libtool --mode=link --tag=FC $ac_link" +ac_compile="$ac_pwd/libtool --mode=compile --tag=FC $ac_compile" + + if ${acx_cv_fortran_mod_yaxt+:} false; then : + if test -z "$ac_moddir"; then : + acx_cv_fortran_mod_yaxt="$YAXT_FC_MOD" +else + acx_cv_fortran_mod_yaxt="$YAXT_FC_MOD $FC_MOD_FLAG$ac_moddir" +fi + break +fi +done + FCFLAGS=$ac_mod_search_FCFLAGS_SAVE +fi + + if ${acx_cv_fortran_mod_yaxt+:} false; then : + if test x"$acx_cv_fortran_mod_yaxt" = x; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: (none required)" >&5 +$as_echo "(none required)" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_fortran_mod_yaxt" >&5 +$as_echo "$acx_cv_fortran_mod_yaxt" >&6; } +fi + YAXT_FC_MOD=$acx_cv_fortran_mod_yaxt + as_fn_append FCFLAGS " $YAXT_FC_MOD" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing xt_initialized" >&5 +$as_echo_n "checking for library containing xt_initialized... " >&6; } + if ${acx_cv_option_search_xt_initialized_fc+:} false; then : + $as_echo_n "(cached) " >&6 +else + acx_option_func_search_save_LIBS=$LIBS + while :; do + cat > conftest.$ac_ext <<_ACEOF + program conftest + use yaxt + logical is_initialized + is_initialized = xt_initialized() + call xt_finalize() + end +_ACEOF + for ac_lib in '' yaxt +do : + if test -z "$ac_lib"; then : + ac_res="none required" + LIBS="$YAXT_FC_LIB $acx_option_func_search_save_LIBS" +else + ac_res="-l$ac_lib" + LIBS="$YAXT_FC_LIB $ac_res $acx_option_func_search_save_LIBS" +fi + if ac_fn_fc_try_link "$LINENO"; then : + if test x"$ac_res" = x"none required"; then : + acx_cv_option_search_xt_initialized_fc="$YAXT_FC_LIB" +else + acx_cv_option_search_xt_initialized_fc="$YAXT_FC_LIB -l$ac_lib" +fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${acx_cv_option_search_xt_initialized_fc+:} false; then : + break +fi +done + rm conftest.$ac_ext + if ${acx_cv_option_search_xt_initialized_fc+:} false; then : + break +fi + for acx_libset in "-lyaxt_c" +do : + cat > conftest.$ac_ext <<_ACEOF + program conftest + use yaxt + logical is_initialized + is_initialized = xt_initialized() + call xt_finalize() + end +_ACEOF + for ac_lib in '' yaxt +do : + if test -z "$ac_lib"; then : + ac_res="none required" + LIBS="$YAXT_FC_LIB $acx_libset $acx_option_func_search_save_LIBS" +else + ac_res="-l$ac_lib" + LIBS="$YAXT_FC_LIB $ac_res $acx_libset $acx_option_func_search_save_LIBS" +fi + if ac_fn_fc_try_link "$LINENO"; then : + if test x"$ac_res" = x"none required"; then : + acx_cv_option_search_xt_initialized_fc="$YAXT_FC_LIB $acx_libset" +else + acx_cv_option_search_xt_initialized_fc="$YAXT_FC_LIB -l$ac_lib $acx_libset" +fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${acx_cv_option_search_xt_initialized_fc+:} false; then : + break +fi +done + rm conftest.$ac_ext + if ${acx_cv_option_search_xt_initialized_fc+:} false; then : + break +fi + +done + break + done + LIBS=$acx_option_func_search_save_LIBS +fi + + if ${acx_cv_option_search_xt_initialized_fc+:} false; then : + if test x"$acx_cv_option_search_xt_initialized_fc" = x; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: (none required)" >&5 +$as_echo "(none required)" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_option_search_xt_initialized_fc" >&5 +$as_echo "$acx_cv_option_search_xt_initialized_fc" >&6; } +fi + YAXT_FC_LIB=$acx_cv_option_search_xt_initialized_fc +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 +$as_echo "not found" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot link Fortran YAXT programs" >&5 +$as_echo "$as_me: WARNING: cannot link Fortran YAXT programs" >&2;} + build_pio_fc_programs=no +fi + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 +$as_echo "not found" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: required Fortran module yaxt not found or not compilable" >&5 +$as_echo "$as_me: WARNING: required Fortran module yaxt not found or not compilable" >&2;} + build_pio_fc_programs=no +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_link="$ac_pwd/libtool --mode=link --tag=CC $ac_link" +ac_compile="$ac_pwd/libtool --mode=compile --tag=CC $ac_compile" + FCFLAGS=$saved_FCFLAGS + LIBS=$saved_LIBS +fi + + ppm_core_CFLAGS=$PPM_CORE_C_INCLUDE + ppm_core_LIBS=$PPM_CORE_C_LIB + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ppm_core" >&5 +$as_echo_n "checking for ppm_core... " >&6; } + +if test -n "$ppm_core_CFLAGS"; then + pkg_cv_ppm_core_CFLAGS="$ppm_core_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"scales-ppm-core\""; } >&5 + ($PKG_CONFIG --exists --print-errors "scales-ppm-core") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_ppm_core_CFLAGS=`$PKG_CONFIG --cflags "scales-ppm-core" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$ppm_core_LIBS"; then + pkg_cv_ppm_core_LIBS="$ppm_core_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"scales-ppm-core\""; } >&5 + ($PKG_CONFIG --exists --print-errors "scales-ppm-core") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_ppm_core_LIBS=`$PKG_CONFIG --libs "scales-ppm-core" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + ppm_core_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "scales-ppm-core" 2>&1` + else + ppm_core_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "scales-ppm-core" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$ppm_core_PKG_ERRORS" >&5 + + : +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + : +else + ppm_core_CFLAGS=$pkg_cv_ppm_core_CFLAGS + ppm_core_LIBS=$pkg_cv_ppm_core_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + PPM_CORE_C_INCLUDE=$ppm_core_CFLAGS + PPM_CORE_C_LIB=$ppm_core_LIBS +fi + saved_CPPFLAGS=$CPPFLAGS + saved_LIBS=$LIBS + as_fn_append CPPFLAGS " $MPI_C_INCLUDE" + LIBS="$MPI_C_LIB $LIBS" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ppm/ppm.h extra include path" >&5 +$as_echo_n "checking for ppm/ppm.h extra include path... " >&6; } + if ${acx_cv_c_include_ppm_ppm_h+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_include_search_ppm_ppm_h_SAVE="$CPPFLAGS" + while :; do + for ac_incdir in '' +do : + if test -z "$ac_incdir"; then : + ac_res="none required" + CPPFLAGS="$PPM_CORE_C_INCLUDE $ac_include_search_ppm_ppm_h_SAVE" +else + ac_res="-I$ac_incdir" + CPPFLAGS="$PPM_CORE_C_INCLUDE $ac_res $ac_include_search_ppm_ppm_h_SAVE" +fi + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +#include <ppm/ppm.h> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + acx_cv_c_include_ppm_ppm_h=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if ${acx_cv_c_include_ppm_ppm_h+:} false; then : + if test -z "$ac_incdir"; then : + acx_cv_c_include_ppm_ppm_h="$PPM_CORE_C_INCLUDE" +else + acx_cv_c_include_ppm_ppm_h="$PPM_CORE_C_INCLUDE -I$ac_incdir" +fi +fi + if ${acx_cv_c_include_ppm_ppm_h+:} false; then : + break +fi +done + if ${acx_cv_c_include_ppm_ppm_h+:} false; then : + break +fi + + break + done + CPPFLAGS=$ac_include_search_ppm_ppm_h_SAVE +fi + + if ${acx_cv_c_include_ppm_ppm_h+:} false; then : + if test x"$acx_cv_c_include_ppm_ppm_h" = x; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: (none required)" >&5 +$as_echo "(none required)" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_c_include_ppm_ppm_h" >&5 +$as_echo "$acx_cv_c_include_ppm_ppm_h" >&6; } +fi + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 +$as_echo "not found" >&6; } +fi + if ${acx_cv_c_include_ppm_ppm_h+:} false; then : + PPM_CORE_C_INCLUDE=$acx_cv_c_include_ppm_ppm_h + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing PPM_initialize" >&5 +$as_echo_n "checking for library containing PPM_initialize... " >&6; } + if ${acx_cv_option_search_PPM_initialize_c+:} false; then : + $as_echo_n "(cached) " >&6 +else + acx_option_func_search_save_LIBS=$LIBS + while :; do + 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 PPM_initialize (); +int +main () +{ +return PPM_initialize (); + ; + return 0; +} +_ACEOF + for ac_lib in '' scalesppmcore +do : + if test -z "$ac_lib"; then : + ac_res="none required" + LIBS="$PPM_CORE_C_LIB $acx_option_func_search_save_LIBS" +else + ac_res="-l$ac_lib" + LIBS="$PPM_CORE_C_LIB $ac_res $acx_option_func_search_save_LIBS" +fi + if ac_fn_c_try_link "$LINENO"; then : + if test x"$ac_res" = x"none required"; then : + acx_cv_option_search_PPM_initialize_c="$PPM_CORE_C_LIB" +else + acx_cv_option_search_PPM_initialize_c="$PPM_CORE_C_LIB -l$ac_lib" +fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${acx_cv_option_search_PPM_initialize_c+:} false; then : + break +fi +done + rm conftest.$ac_ext + if ${acx_cv_option_search_PPM_initialize_c+:} false; then : + break +fi + for acx_libset in "" +do : + 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 PPM_initialize (); +int +main () +{ +return PPM_initialize (); + ; + return 0; +} +_ACEOF + for ac_lib in '' scalesppmcore +do : + if test -z "$ac_lib"; then : + ac_res="none required" + LIBS="$PPM_CORE_C_LIB $acx_libset $acx_option_func_search_save_LIBS" +else + ac_res="-l$ac_lib" + LIBS="$PPM_CORE_C_LIB $ac_res $acx_libset $acx_option_func_search_save_LIBS" +fi + if ac_fn_c_try_link "$LINENO"; then : + if test x"$ac_res" = x"none required"; then : + acx_cv_option_search_PPM_initialize_c="$PPM_CORE_C_LIB $acx_libset" +else + acx_cv_option_search_PPM_initialize_c="$PPM_CORE_C_LIB -l$ac_lib $acx_libset" +fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${acx_cv_option_search_PPM_initialize_c+:} false; then : + break +fi +done + rm conftest.$ac_ext + if ${acx_cv_option_search_PPM_initialize_c+:} false; then : + break +fi + +done + break + done + LIBS=$acx_option_func_search_save_LIBS +fi + + if ${acx_cv_option_search_PPM_initialize_c+:} false; then : + if test x"$acx_cv_option_search_PPM_initialize_c" = x; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: (none required)" >&5 +$as_echo "(none required)" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_option_search_PPM_initialize_c" >&5 +$as_echo "$acx_cv_option_search_PPM_initialize_c" >&6; } +fi + PPM_CORE_C_LIB=$acx_cv_option_search_PPM_initialize_c + have_ppm=yes + +$as_echo "#define HAVE_PPM_CORE /**/" >>confdefs.h + + as_fn_append CPPFLAGS " $PPM_CORE_C_INCLUDE" + if test "x$enable_ppm_dist_array" != xno; then : + for ac_header in ppm/dist_array.h +do : + ac_fn_c_check_header_compile "$LINENO" "ppm/dist_array.h" "ac_cv_header_ppm_dist_array_h" "$ac_includes_default +" +if test "x$ac_cv_header_ppm_dist_array_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_PPM_DIST_ARRAY_H 1 +_ACEOF + HAVE_PPM_DIST_ARRAY=yes +fi + +done + +fi +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 +$as_echo "not found" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot link C SCALES-PPM-CORE programs" >&5 +$as_echo "$as_me: WARNING: cannot link C SCALES-PPM-CORE programs" >&2;} +fi + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: required header ppm/ppm.h not found or not compilable" >&5 +$as_echo "$as_me: WARNING: required header ppm/ppm.h not found or not compilable" >&2;} +fi + + CPPFLAGS=$saved_CPPFLAGS + LIBS=$saved_LIBS + + if test "x$ENABLE_NETCDF" = xyes; then : + for ac_header in netcdf_meta.h +do : + ac_fn_c_check_header_compile "$LINENO" "netcdf_meta.h" "ac_cv_header_netcdf_meta_h" "$ac_includes_default +#include <netcdf.h> +" +if test "x$ac_cv_header_netcdf_meta_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_NETCDF_META_H 1 +_ACEOF + +fi + +done + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking parallel netcdf's pnetcdf support" >&5 +$as_echo_n "checking parallel netcdf's pnetcdf support... " >&6; } +if ${acx_cv_have_pnetcdf+:} false; then : + $as_echo_n "(cached) " >&6 +else + acx_cv_have_pnetcdf=no + test "x$NC_CONFIG" != "x" && \ + test "x$($NC_CONFIG --has-pnetcdf)" = "xyes" && \ + acx_cv_have_pnetcdf=yes +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_have_pnetcdf" >&5 +$as_echo "$acx_cv_have_pnetcdf" >&6; } + if test "x$acx_cv_have_pnetcdf" = xyes; then : + +$as_echo "#define HAVE_NETCDF_PAR_PNETCDF 1" >>confdefs.h + +fi +fi + + if test "x$ENABLE_NC4" = xyes && test "x$have_ppm" = xyes; then : + saved_CPPFLAGS=$CPPFLAGS + as_fn_append CPPFLAGS " $MPI_C_INCLUDE" + for ac_header in netcdf_par.h +do : + ac_fn_c_check_header_compile "$LINENO" "netcdf_par.h" "ac_cv_header_netcdf_par_h" "$ac_includes_default +#include <netcdf.h> +" +if test "x$ac_cv_header_netcdf_par_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_NETCDF_PAR_H 1 +_ACEOF + +fi + +done + + ac_fn_c_check_decl "$LINENO" "MPI_Bcast" "ac_cv_have_decl_MPI_Bcast" "$ac_includes_default +#include <netcdf.h> +#ifdef HAVE_NETCDF_PAR_H +#include <netcdf_par.h> +#endif +" +if test "x$ac_cv_have_decl_MPI_Bcast" = xyes; then : + have_parallel_nc4=yes + ac_fn_c_check_decl "$LINENO" "nc_inq_format_extended" "ac_cv_have_decl_nc_inq_format_extended" "$ac_includes_default +#include <netcdf.h> +" +if test "x$ac_cv_have_decl_nc_inq_format_extended" = xyes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_NC_INQ_FORMAT_EXTENDED $ac_have_decl +_ACEOF +if test $ac_have_decl = 1; then : + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: The supplied netCDF library does not support nc_inq_format_extended." >&5 +$as_echo "$as_me: The supplied netCDF library does not support nc_inq_format_extended." >&6;} +fi + + +$as_echo "#define HAVE_PARALLEL_NC4 1" >>confdefs.h + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: the supplied netCDF library does not support MPI parallel invocations" >&5 +$as_echo "$as_me: WARNING: the supplied netCDF library does not support MPI parallel invocations" >&2;} +fi + + CPPFLAGS=$saved_CPPFLAGS + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for thread local storage (TLS) class" >&5 +$as_echo_n "checking for thread local storage (TLS) class... " >&6; } + if ${ac_cv_tls+:} false; then : + $as_echo_n "(cached) " >&6 +else + for ax_tls_keyword in thread_local _Thread_local __thread '__declspec(thread)' none; do + case $ax_tls_keyword in #( + none) : + ac_cv_tls=none ; break ;; #( + *) : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <stdlib.h> +int +main () +{ +static $ax_tls_keyword int bar; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_tls=$ax_tls_keyword ; break +else + ac_cv_tls=none + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ;; +esac + done + +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_tls" >&5 +$as_echo "$ac_cv_tls" >&6; } + + if test "$ac_cv_tls" != "none"; then : + +cat >>confdefs.h <<_ACEOF +#define TLS $ac_cv_tls +_ACEOF + + : +else + ac_cv_tls=`$CC -qversion 2>&1 | sed -n '/^IBM XL C/{ +n +s/^Version: \([0-9]*\).*/\1/ +t print +b +: print +p +}'` + if test x"$ac_cv_tls" = x; then : + ac_cv_tls=`$CC -V | sed -n '/^pgcc /{ +s/^pgcc \(0-90-9.*\).*/\1/ +p +}'` +# pgcc 18.1 and newer support TLS if switched to C11 mode + as_arg_v1=$ac_cv_tls +as_arg_v2=18.9 +awk "$as_awk_strverscmp" v1="$as_arg_v1" v2="$as_arg_v2" /dev/null +case $? in #( + 1) : + ac_cv_tls=none ;; #( + 0) : + ac_cv_tls=none ;; #( + 2) : + saved_CFLAGS=$CFLAGS + case " $CFLAGS " in #( + -c11 ) : + ;; #( + *) : + CFLAGS="$CFLAGS -c11" ;; +esac + if test x"$CFLAGS" = x"$saved_CFLAGS"; then : + ac_cv_tls=none +else + { $as_echo "$as_me:${as_lineno-$LINENO}: retrying with -c11 added to CFLAGS" >&5 +$as_echo "$as_me: retrying with -c11 added to CFLAGS" >&6;} + { ac_cv_tls=; unset ac_cv_tls;} + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for thread local storage (TLS) class" >&5 +$as_echo_n "checking for thread local storage (TLS) class... " >&6; } + if ${ac_cv_tls+:} false; then : + $as_echo_n "(cached) " >&6 +else + for ax_tls_keyword in thread_local _Thread_local __thread '__declspec(thread)' none; do + case $ax_tls_keyword in #( + none) : + ac_cv_tls=none ; break ;; #( + *) : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <stdlib.h> +int +main () +{ +static $ax_tls_keyword int bar; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_tls=$ax_tls_keyword ; break +else + ac_cv_tls=none + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ;; +esac + done + +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_tls" >&5 +$as_echo "$ac_cv_tls" >&6; } + + if test "$ac_cv_tls" != "none"; then : + +cat >>confdefs.h <<_ACEOF +#define TLS $ac_cv_tls +_ACEOF + + : +else + CFLAGS=$saved_CFLAGS +fi + +fi ;; #( + *) : + ;; +esac +elif test "$ac_cv_tls" -gt 7; then : + # unless the user already set the -qtls option, add it and retry test + saved_CFLAGS=$CFLAGS + CFLAGS=`echo "$CFLAGS" | sed -n '/.*-qtls\(=[^ ]*\)\{0,1\}/{ +p +q +} +s/$/ -qtls=initial-exec/ +p +q +'` + if test x"$CFLAGS" = x"$saved_CFLAGS"; then : + ac_cv_tls=none +else + { $as_echo "$as_me:${as_lineno-$LINENO}: retrying with -qtls=initial-exec added to CFLAGS" >&5 +$as_echo "$as_me: retrying with -qtls=initial-exec added to CFLAGS" >&6;} + { ac_cv_tls=; unset ac_cv_tls;} + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for thread local storage (TLS) class" >&5 +$as_echo_n "checking for thread local storage (TLS) class... " >&6; } + if ${ac_cv_tls+:} false; then : + $as_echo_n "(cached) " >&6 +else + for ax_tls_keyword in thread_local _Thread_local __thread '__declspec(thread)' none; do + case $ax_tls_keyword in #( + none) : + ac_cv_tls=none ; break ;; #( + *) : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <stdlib.h> +int +main () +{ +static $ax_tls_keyword int bar; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_tls=$ax_tls_keyword ; break +else + ac_cv_tls=none + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ;; +esac + done + +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_tls" >&5 +$as_echo "$ac_cv_tls" >&6; } + + if test "$ac_cv_tls" != "none"; then : + +cat >>confdefs.h <<_ACEOF +#define TLS $ac_cv_tls +_ACEOF + + : +else + CFLAGS=$saved_CFLAGS +fi + +fi + +else + ac_cv_tls=none +fi +fi + + + +fi + + LIBRT='' + + ac_fn_c_check_decl "$LINENO" "_POSIX_ASYNCHRONOUS_IO" "ac_cv_have_decl__POSIX_ASYNCHRONOUS_IO" "$ac_includes_default" +if test "x$ac_cv_have_decl__POSIX_ASYNCHRONOUS_IO" = xyes; then : + saved_LIBS=$LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing aio_suspend" >&5 +$as_echo_n "checking for library containing aio_suspend... " >&6; } +if ${ac_cv_search_aio_suspend+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$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 aio_suspend (); +int +main () +{ +return aio_suspend (); + ; + return 0; +} +_ACEOF +for ac_lib in '' rt; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_aio_suspend=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_aio_suspend+:} false; then : + break +fi +done +if ${ac_cv_search_aio_suspend+:} false; then : + +else + ac_cv_search_aio_suspend=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_aio_suspend" >&5 +$as_echo "$ac_cv_search_aio_suspend" >&6; } +ac_res=$ac_cv_search_aio_suspend +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + test "$ac_res" = "none required" || LIBRT=$ac_res +fi + + LIBS=$saved_LIBS +fi + +else + YAXT_C_INCLUDE=; YAXT_C_LIB= + MPI_C_INCLUDE=; MPI_C_LIB= +fi +case "$enable_ppm_dist_array$HAVE_PPM_DIST_ARRAY" in #( + yesyes|no*) : + ;; #( + auto*) : + enable_ppm_dist_array=$HAVE_PPM_DIST_ARRAY ;; #( + *) : + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "usage of the PPM distributed array is requested but the required headers and libraries are not found +See \`config.log' for more details" "$LINENO" 5; } ;; +esac +if test "x$have_ppm" = xno; then : + PPM_CORE_C_INCLUDE=; PPM_CORE_C_LIB= +fi +if test "x$build_pio_fc_programs" = xno; then : + YAXT_FC_MOD=; YAXT_FC_LIB= + MPI_FC_MOD=; MPI_FC_LIB= +fi + if test "x$build_pio_fc_programs" = xyes; then + BUILD_PIO_FC_PROGRAMS_TRUE= + BUILD_PIO_FC_PROGRAMS_FALSE='#' +else + BUILD_PIO_FC_PROGRAMS_TRUE='#' + BUILD_PIO_FC_PROGRAMS_FALSE= +fi + + if test "x$enable_mpi" = xyes; then + ENABLE_MPI_TRUE= + ENABLE_MPI_FALSE='#' +else + ENABLE_MPI_TRUE='#' + ENABLE_MPI_FALSE= +fi + + if test "x$have_parallel_nc4" = xyes; then + HAVE_PARALLEL_NC4_TRUE= + HAVE_PARALLEL_NC4_FALSE='#' +else + HAVE_PARALLEL_NC4_TRUE='#' + HAVE_PARALLEL_NC4_FALSE= +fi + + + +SWIG=${SWIG-"${am_missing_run}swig"} + + +if test "x$enable_ruby_interface" = xyes; then : + + for ac_prog in ruby +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_path_RUBY+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $RUBY in + [\\/]* | ?:[\\/]*) + ac_cv_path_RUBY="$RUBY" # Let the user override the test with a path. + ;; + *) + 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_path_RUBY="$as_dir/$ac_word$ac_exec_ext" + $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 + + ;; +esac +fi +RUBY=$ac_cv_path_RUBY +if test -n "$RUBY"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RUBY" >&5 +$as_echo "$RUBY" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$RUBY" && break +done + + ruby_CPPFLAGS=`$RUBY $srcdir/config/interface.rb 2>/dev/null` + if test $? -ne 0; then : + as_fn_error $? "Ruby interface is requested but the Ruby interpreter is not found" "$LINENO" 5 +fi + saved_CPPFLAGS=$CPPFLAGS + as_fn_append CPPFLAGS " $ruby_CPPFLAGS" + ac_fn_c_check_header_compile "$LINENO" "ruby.h" "ac_cv_header_ruby_h" "$ac_includes_default +" +if test "x$ac_cv_header_ruby_h" = xyes; 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 $? "Ruby interface is requested but the required header ruby.h not found or not compilable +See \`config.log' for more details" "$LINENO" 5; } +fi + + + CPPFLAGS=$saved_CPPFLAGS +else + +RUBY=${RUBY-"${am_missing_run}ruby"} + +fi + if test "x$enable_ruby_interface" = xyes; then + ENABLE_RUBY_INTERFACE_TRUE= + ENABLE_RUBY_INTERFACE_FALSE='#' +else + ENABLE_RUBY_INTERFACE_TRUE='#' + ENABLE_RUBY_INTERFACE_FALSE= +fi + + +if test "x$enable_python_interface" = xyes; then : + if ${PYTHON+:} false; then : + case $PYTHON in #( + [\\/]* | ?:[\\/]*) : + ;; #( + *) : + PYTHON= ;; +esac +fi + + + + + + + # Find any Python interpreter. + if test -z "$PYTHON"; then + for ac_prog in python python2 python3 python3.9 python3.8 python3.7 python3.6 python3.5 python3.4 python3.3 python3.2 python3.1 python3.0 python2.7 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 +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_path_PYTHON+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $PYTHON in + [\\/]* | ?:[\\/]*) + ac_cv_path_PYTHON="$PYTHON" # Let the user override the test with a path. + ;; + *) + 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_path_PYTHON="$as_dir/$ac_word$ac_exec_ext" + $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 + + ;; +esac +fi +PYTHON=$ac_cv_path_PYTHON +if test -n "$PYTHON"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON" >&5 +$as_echo "$PYTHON" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$PYTHON" && break +done +test -n "$PYTHON" || PYTHON=":" + + fi + am_display_PYTHON=python + + + if test "$PYTHON" = :; then + : + else + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON version" >&5 +$as_echo_n "checking for $am_display_PYTHON version... " >&6; } +if ${am_cv_python_version+:} false; then : + $as_echo_n "(cached) " >&6 +else + am_cv_python_version=`$PYTHON -c "import sys; print ('%u.%u' % sys.version_info[:2])"` +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_version" >&5 +$as_echo "$am_cv_python_version" >&6; } + PYTHON_VERSION=$am_cv_python_version + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON platform" >&5 +$as_echo_n "checking for $am_display_PYTHON platform... " >&6; } +if ${am_cv_python_platform+:} false; then : + $as_echo_n "(cached) " >&6 +else + am_cv_python_platform=`$PYTHON -c "import sys; sys.stdout.write(sys.platform)"` +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_platform" >&5 +$as_echo "$am_cv_python_platform" >&6; } + PYTHON_PLATFORM=$am_cv_python_platform + + + if test "x$prefix" = xNONE; then + am__usable_prefix=$ac_default_prefix + else + am__usable_prefix=$prefix + fi + + # Allow user to request using sys.* values from Python, + # instead of the GNU $prefix values. + +# Check whether --with-python-sys-prefix was given. +if test "${with_python_sys_prefix+set}" = set; then : + withval=$with_python_sys_prefix; am_use_python_sys=: +else + am_use_python_sys=false +fi + + + # Allow user to override whatever the default Python prefix is. + +# Check whether --with-python_prefix was given. +if test "${with_python_prefix+set}" = set; then : + withval=$with_python_prefix; am_python_prefix_subst=$withval + am_cv_python_prefix=$withval + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for explicit $am_display_PYTHON prefix" >&5 +$as_echo_n "checking for explicit $am_display_PYTHON prefix... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_prefix" >&5 +$as_echo "$am_cv_python_prefix" >&6; } +else + + if $am_use_python_sys; then + # using python sys.prefix value, not GNU + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for python default $am_display_PYTHON prefix" >&5 +$as_echo_n "checking for python default $am_display_PYTHON prefix... " >&6; } +if ${am_cv_python_prefix+:} false; then : + $as_echo_n "(cached) " >&6 +else + am_cv_python_prefix=`$PYTHON -c "import sys; sys.stdout.write(sys.prefix)"` +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_prefix" >&5 +$as_echo "$am_cv_python_prefix" >&6; } + + case $am_cv_python_prefix in + $am__usable_prefix*) + am__strip_prefix=`echo "$am__usable_prefix" | sed 's|.|.|g'` + am_python_prefix_subst=`echo "$am_cv_python_prefix" | sed "s,^$am__strip_prefix,\\${prefix},"` + ;; + *) + am_python_prefix_subst=$am_cv_python_prefix + ;; + esac + else # using GNU prefix value, not python sys.prefix + am_python_prefix_subst='${prefix}' + am_python_prefix=$am_python_prefix_subst + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU default $am_display_PYTHON prefix" >&5 +$as_echo_n "checking for GNU default $am_display_PYTHON prefix... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_python_prefix" >&5 +$as_echo "$am_python_prefix" >&6; } + fi +fi + + # Substituting python_prefix_subst value. + PYTHON_PREFIX=$am_python_prefix_subst + + + # emacs-page Now do it all over again for Python exec_prefix, but with yet + # another conditional: fall back to regular prefix if that was specified. + +# Check whether --with-python_exec_prefix was given. +if test "${with_python_exec_prefix+set}" = set; then : + withval=$with_python_exec_prefix; am_python_exec_prefix_subst=$withval + am_cv_python_exec_prefix=$withval + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for explicit $am_display_PYTHON exec_prefix" >&5 +$as_echo_n "checking for explicit $am_display_PYTHON exec_prefix... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_exec_prefix" >&5 +$as_echo "$am_cv_python_exec_prefix" >&6; } +else + + # no explicit --with-python_exec_prefix, but if + # --with-python_prefix was given, use its value for python_exec_prefix too. + if test -n "$with_python_prefix"; then : + am_python_exec_prefix_subst=$with_python_prefix + am_cv_python_exec_prefix=$with_python_prefix + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for python_prefix-given $am_display_PYTHON exec_prefix" >&5 +$as_echo_n "checking for python_prefix-given $am_display_PYTHON exec_prefix... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_exec_prefix" >&5 +$as_echo "$am_cv_python_exec_prefix" >&6; } +else + + # Set am__usable_exec_prefix whether using GNU or Python values, + # since we use that variable for pyexecdir. + if test "x$exec_prefix" = xNONE; then + am__usable_exec_prefix=$am__usable_prefix + else + am__usable_exec_prefix=$exec_prefix + fi + # + if $am_use_python_sys; then # using python sys.exec_prefix, not GNU + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for python default $am_display_PYTHON exec_prefix" >&5 +$as_echo_n "checking for python default $am_display_PYTHON exec_prefix... " >&6; } +if ${am_cv_python_exec_prefix+:} false; then : + $as_echo_n "(cached) " >&6 +else + am_cv_python_exec_prefix=`$PYTHON -c "import sys; sys.stdout.write(sys.exec_prefix)"` +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_exec_prefix" >&5 +$as_echo "$am_cv_python_exec_prefix" >&6; } + case $am_cv_python_exec_prefix in + $am__usable_exec_prefix*) + am__strip_prefix=`echo "$am__usable_exec_prefix" | sed 's|.|.|g'` + am_python_exec_prefix_subst=`echo "$am_cv_python_exec_prefix" | sed "s,^$am__strip_prefix,\\${exec_prefix},"` + ;; + *) + am_python_exec_prefix_subst=$am_cv_python_exec_prefix + ;; + esac + else # using GNU $exec_prefix, not python sys.exec_prefix + am_python_exec_prefix_subst='${exec_prefix}' + am_python_exec_prefix=$am_python_exec_prefix_subst + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU default $am_display_PYTHON exec_prefix" >&5 +$as_echo_n "checking for GNU default $am_display_PYTHON exec_prefix... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_python_exec_prefix" >&5 +$as_echo "$am_python_exec_prefix" >&6; } + fi +fi +fi + + # Substituting python_exec_prefix_subst. + PYTHON_EXEC_PREFIX=$am_python_exec_prefix_subst + + + # Factor out some code duplication into this shell variable. + am_python_setup_sysconfig="\ +import sys +# Prefer sysconfig over distutils.sysconfig, for better compatibility +# with python 3.x. See automake bug#10227. +try: + import sysconfig +except ImportError: + can_use_sysconfig = 0 +else: + can_use_sysconfig = 1 +# Can't use sysconfig in CPython 2.7, since it's broken in virtualenvs: +# <https://github.com/pypa/virtualenv/issues/118> +try: + from platform import python_implementation + if python_implementation() == 'CPython' and sys.version[:3] == '2.7': + can_use_sysconfig = 0 +except ImportError: + pass" + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON script directory (pythondir)" >&5 +$as_echo_n "checking for $am_display_PYTHON script directory (pythondir)... " >&6; } +if ${am_cv_python_pythondir+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "x$am_cv_python_prefix" = x; then + am_py_prefix=$am__usable_prefix + else + am_py_prefix=$am_cv_python_prefix + fi + am_cv_python_pythondir=`$PYTHON -c " +$am_python_setup_sysconfig +if can_use_sysconfig: + sitedir = sysconfig.get_path('purelib', vars={'base':'$am_py_prefix'}) +else: + from distutils import sysconfig + sitedir = sysconfig.get_python_lib(0, 0, prefix='$am_py_prefix') +sys.stdout.write(sitedir)"` + # + case $am_cv_python_pythondir in + $am_py_prefix*) + am__strip_prefix=`echo "$am_py_prefix" | sed 's|.|.|g'` + am_cv_python_pythondir=`echo "$am_cv_python_pythondir" | sed "s,^$am__strip_prefix,\\${PYTHON_PREFIX},"` + ;; + *) + case $am_py_prefix in + /usr|/System*) ;; + *) am_cv_python_pythondir="\${PYTHON_PREFIX}/lib/python$PYTHON_VERSION/site-packages" + ;; + esac + ;; + esac + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_pythondir" >&5 +$as_echo "$am_cv_python_pythondir" >&6; } + pythondir=$am_cv_python_pythondir + + + pkgpythondir=\${pythondir}/$PACKAGE + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON extension module directory (pyexecdir)" >&5 +$as_echo_n "checking for $am_display_PYTHON extension module directory (pyexecdir)... " >&6; } +if ${am_cv_python_pyexecdir+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "x$am_cv_python_exec_prefix" = x; then + am_py_exec_prefix=$am__usable_exec_prefix + else + am_py_exec_prefix=$am_cv_python_exec_prefix + fi + am_cv_python_pyexecdir=`$PYTHON -c " +$am_python_setup_sysconfig +if can_use_sysconfig: + sitedir = sysconfig.get_path('platlib', vars={'platbase':'$am_py_exec_prefix'}) +else: + from distutils import sysconfig + sitedir = sysconfig.get_python_lib(1, 0, prefix='$am_py_exec_prefix') +sys.stdout.write(sitedir)"` + # + case $am_cv_python_pyexecdir in + $am_py_exec_prefix*) + am__strip_prefix=`echo "$am_py_exec_prefix" | sed 's|.|.|g'` + am_cv_python_pyexecdir=`echo "$am_cv_python_pyexecdir" | sed "s,^$am__strip_prefix,\\${PYTHON_EXEC_PREFIX},"` + ;; + *) + case $am_py_exec_prefix in + /usr|/System*) ;; + *) am_cv_python_pyexecdir="\${PYTHON_EXEC_PREFIX}/lib/python$PYTHON_VERSION/site-packages" + ;; + esac + ;; + esac + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_pyexecdir" >&5 +$as_echo "$am_cv_python_pyexecdir" >&6; } + pyexecdir=$am_cv_python_pyexecdir + + + pkgpyexecdir=\${pyexecdir}/$PACKAGE + + + + fi + + if $PYTHON -c 'import sys' >/dev/null 2>&1; then : + +else + as_fn_error $? "Python interface is requested but the Python interpreter is not found" "$LINENO" 5 +fi + PYTHON_EXTRA_LDFLAGS=${PYTHON_EXTRA_LDFLAGS-' '} + PYTHON_EXTRA_LIBS=${PYTHON_EXTRA_LIBS-' '} + + # + # Allow the use of a (user set) custom python version + # + + + # Extract the first word of "python[$PYTHON_VERSION]", so it can be a program name with args. +set dummy python$PYTHON_VERSION; 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_path_PYTHON+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $PYTHON in + [\\/]* | ?:[\\/]*) + ac_cv_path_PYTHON="$PYTHON" # Let the user override the test with a path. + ;; + *) + 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_path_PYTHON="$as_dir/$ac_word$ac_exec_ext" + $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 + + ;; +esac +fi +PYTHON=$ac_cv_path_PYTHON +if test -n "$PYTHON"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON" >&5 +$as_echo "$PYTHON" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + if test -z "$PYTHON"; then + as_fn_error $? "Cannot find python$PYTHON_VERSION in your system path" "$LINENO" 5 + PYTHON_VERSION="" + fi + + # + # Check for a version of Python >= 2.1.0 + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a version of Python >= '2.1.0'" >&5 +$as_echo_n "checking for a version of Python >= '2.1.0'... " >&6; } + ac_supports_python_ver=`$PYTHON -c "import sys; \ + ver = sys.version.split ()[0]; \ + print (ver >= '2.1.0')"` + if test "$ac_supports_python_ver" != "True"; then + if test -z "$PYTHON_NOVERSIONCHECK"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? " +This version of the AC_PYTHON_DEVEL macro +doesn't work properly with versions of Python before +2.1.0. You may need to re-run configure, setting the +variables PYTHON_CPPFLAGS, PYTHON_LIBS, PYTHON_SITE_PKG, +PYTHON_EXTRA_LIBS and PYTHON_EXTRA_LDFLAGS by hand. +Moreover, to disable this check, set PYTHON_NOVERSIONCHECK +to something else than an empty string. + +See \`config.log' for more details" "$LINENO" 5; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: skip at user request" >&5 +$as_echo "skip at user request" >&6; } + fi + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + fi + + # + # If the macro parameter ``version'' is set, honour it. + # A Python shim class, VPy, is used to implement correct version comparisons via + # string expressions, since e.g. a naive textual ">= 2.7.3" won't work for + # Python 2.7.10 (the ".1" being evaluated as less than ".3"). + # + if test -n ""; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a version of Python " >&5 +$as_echo_n "checking for a version of Python ... " >&6; } + cat << EOF > ax_python_devel_vpy.py +class VPy: + def vtup(self, s): + return tuple(map(int, s.strip().replace("rc", ".").split("."))) + def __init__(self): + import sys + self.vpy = tuple(sys.version_info) + def __eq__(self, s): + return self.vpy == self.vtup(s) + def __ne__(self, s): + return self.vpy != self.vtup(s) + def __lt__(self, s): + return self.vpy < self.vtup(s) + def __gt__(self, s): + return self.vpy > self.vtup(s) + def __le__(self, s): + return self.vpy <= self.vtup(s) + def __ge__(self, s): + return self.vpy >= self.vtup(s) +EOF + ac_supports_python_ver=`$PYTHON -c "import ax_python_devel_vpy; \ + ver = ax_python_devel_vpy.VPy(); \ + print (ver )"` + rm -rf ax_python_devel_vpy*.py* __pycache__/ax_python_devel_vpy*.py* + if test "$ac_supports_python_ver" = "True"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + as_fn_error $? "this package requires Python . +If you have it installed, but it isn't the default Python +interpreter in your system path, please pass the PYTHON_VERSION +variable to configure. See \`\`configure --help'' for reference. +" "$LINENO" 5 + PYTHON_VERSION="" + fi + fi + + # + # Check if you have distutils, else fail + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the sysconfig Python package" >&5 +$as_echo_n "checking for the sysconfig Python package... " >&6; } + ac_sysconfig_result=`$PYTHON -c "import sysconfig" 2>&1` + if test $? -eq 0; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + IMPORT_SYSCONFIG="import sysconfig" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the distutils Python package" >&5 +$as_echo_n "checking for the distutils Python package... " >&6; } + ac_sysconfig_result=`$PYTHON -c "from distutils import sysconfig" 2>&1` + if test $? -eq 0; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + IMPORT_SYSCONFIG="from distutils import sysconfig" + else + as_fn_error $? "cannot import Python module \"distutils\". +Please check your Python installation. The error was: +$ac_sysconfig_result" "$LINENO" 5 + PYTHON_VERSION="" + fi + fi + + # + # Check for Python include path + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python include path" >&5 +$as_echo_n "checking for Python include path... " >&6; } + if test -z "$PYTHON_CPPFLAGS"; then + if test "$IMPORT_SYSCONFIG" = "import sysconfig"; then + # sysconfig module has different functions + python_path=`$PYTHON -c "$IMPORT_SYSCONFIG; \ + print (sysconfig.get_path ('include'));"` + plat_python_path=`$PYTHON -c "$IMPORT_SYSCONFIG; \ + print (sysconfig.get_path ('platinclude'));"` + else + # old distutils way + python_path=`$PYTHON -c "$IMPORT_SYSCONFIG; \ + print (sysconfig.get_python_inc ());"` + plat_python_path=`$PYTHON -c "$IMPORT_SYSCONFIG; \ + print (sysconfig.get_python_inc (plat_specific=1));"` + fi + if test -n "${python_path}"; then + if test "${plat_python_path}" != "${python_path}"; then + python_path="-I$python_path -I$plat_python_path" + else + python_path="-I$python_path" + fi + fi + PYTHON_CPPFLAGS=$python_path + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_CPPFLAGS" >&5 +$as_echo "$PYTHON_CPPFLAGS" >&6; } + + + # + # Check for Python library path + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python library path" >&5 +$as_echo_n "checking for Python library path... " >&6; } + if test -z "$PYTHON_LIBS"; then + # (makes two attempts to ensure we've got a version number + # from the interpreter) + ac_python_version=`cat<<EOD | $PYTHON - + +# join all versioning strings, on some systems +# major/minor numbers could be in different list elements +from sysconfig import * +e = get_config_var('VERSION') +if e is not None: + print(e) +EOD` + + if test -z "$ac_python_version"; then + if test -n "$PYTHON_VERSION"; then + ac_python_version=$PYTHON_VERSION + else + ac_python_version=`$PYTHON -c "import sys; \ + print ("%d.%d" % sys.version_info[:2])"` + fi + fi + + # Make the versioning information available to the compiler + +cat >>confdefs.h <<_ACEOF +#define HAVE_PYTHON "$ac_python_version" +_ACEOF + + + # First, the library directory: + ac_python_libdir=`cat<<EOD | $PYTHON - + +# There should be only one +$IMPORT_SYSCONFIG +e = sysconfig.get_config_var('LIBDIR') +if e is not None: + print (e) +EOD` + + # Now, for the library: + ac_python_library=`cat<<EOD | $PYTHON - + +$IMPORT_SYSCONFIG +c = sysconfig.get_config_vars() +if 'LDVERSION' in c: + print ('python'+c['LDVERSION']) +else: + print ('python'+c['VERSION']) +EOD` + + # This small piece shamelessly adapted from PostgreSQL python macro; + # credits goes to momjian, I think. I'd like to put the right name + # in the credits, if someone can point me in the right direction... ? + # + if test -n "$ac_python_libdir" -a -n "$ac_python_library" + then + # use the official shared library + ac_python_library=`echo "$ac_python_library" | sed "s/^lib//"` + PYTHON_LIBS="-L$ac_python_libdir -l$ac_python_library" + else + # old way: use libpython from python_configdir + ac_python_libdir=`$PYTHON -c \ + "from sysconfig import get_python_lib as f; \ + import os; \ + print (os.path.join(f(plat_specific=1, standard_lib=1), 'config'));"` + PYTHON_LIBS="-L$ac_python_libdir -lpython$ac_python_version" + fi + + if test -z "PYTHON_LIBS"; then + as_fn_error $? " + Cannot determine location of your Python DSO. Please check it was installed with + dynamic libraries enabled, or try setting PYTHON_LIBS by hand. + " "$LINENO" 5 + fi + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_LIBS" >&5 +$as_echo "$PYTHON_LIBS" >&6; } + + + # + # Check for site packages + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python site-packages path" >&5 +$as_echo_n "checking for Python site-packages path... " >&6; } + if test -z "$PYTHON_SITE_PKG"; then + if test "$IMPORT_SYSCONFIG" = "import sysconfig"; then + PYTHON_SITE_PKG=`$PYTHON -c " +$IMPORT_SYSCONFIG; +if hasattr(sysconfig, 'get_default_scheme'): + scheme = sysconfig.get_default_scheme() +else: + scheme = sysconfig._get_default_scheme() +if scheme == 'posix_local': + # Debian's default scheme installs to /usr/local/ but we want to find headers in /usr/ + scheme = 'posix_prefix' +prefix = '$prefix' +if prefix == 'NONE': + prefix = '$ac_default_prefix' +sitedir = sysconfig.get_path('purelib', scheme, vars={'base': prefix}) +print(sitedir)"` + else + # distutils.sysconfig way + PYTHON_SITE_PKG=`$PYTHON -c "$IMPORT_SYSCONFIG; \ + print (sysconfig.get_python_lib(0,0));"` + fi + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_SITE_PKG" >&5 +$as_echo "$PYTHON_SITE_PKG" >&6; } + + + # + # Check for platform-specific site packages + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python platform specific site-packages path" >&5 +$as_echo_n "checking for Python platform specific site-packages path... " >&6; } + if test -z "$PYTHON_PLATFORM_SITE_PKG"; then + if test "$IMPORT_SYSCONFIG" = "import sysconfig"; then + PYTHON_PLATFORM_SITE_PKG=`$PYTHON -c " +$IMPORT_SYSCONFIG; +if hasattr(sysconfig, 'get_default_scheme'): + scheme = sysconfig.get_default_scheme() +else: + scheme = sysconfig._get_default_scheme() +if scheme == 'posix_local': + # Debian's default scheme installs to /usr/local/ but we want to find headers in /usr/ + scheme = 'posix_prefix' +prefix = '$prefix' +if prefix == 'NONE': + prefix = '$ac_default_prefix' +sitedir = sysconfig.get_path('platlib', scheme, vars={'platbase': prefix}) +print(sitedir)"` + else + # distutils.sysconfig way + PYTHON_PLATFORM_SITE_PKG=`$PYTHON -c "$IMPORT_SYSCONFIG; \ + print (sysconfig.get_python_lib(1,0));"` + fi + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_PLATFORM_SITE_PKG" >&5 +$as_echo "$PYTHON_PLATFORM_SITE_PKG" >&6; } + + + # + # libraries which must be linked in when embedding + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking python extra libraries" >&5 +$as_echo_n "checking python extra libraries... " >&6; } + if test -z "$PYTHON_EXTRA_LIBS"; then + PYTHON_EXTRA_LIBS=`$PYTHON -c "$IMPORT_SYSCONFIG; \ + conf = sysconfig.get_config_var; \ + print (conf('LIBS') + ' ' + conf('SYSLIBS'))"` + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_EXTRA_LIBS" >&5 +$as_echo "$PYTHON_EXTRA_LIBS" >&6; } + + + # + # linking flags needed when embedding + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking python extra linking flags" >&5 +$as_echo_n "checking python extra linking flags... " >&6; } + if test -z "$PYTHON_EXTRA_LDFLAGS"; then + PYTHON_EXTRA_LDFLAGS=`$PYTHON -c "$IMPORT_SYSCONFIG; \ + conf = sysconfig.get_config_var; \ + print (conf('LINKFORSHARED'))"` + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_EXTRA_LDFLAGS" >&5 +$as_echo "$PYTHON_EXTRA_LDFLAGS" >&6; } + + + # + # final check to see if everything compiles alright + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking consistency of all components of python development environment" >&5 +$as_echo_n "checking consistency of all components of python development environment... " >&6; } + # save current global flags + ac_save_LIBS="$LIBS" + ac_save_LDFLAGS="$LDFLAGS" + ac_save_CPPFLAGS="$CPPFLAGS" + LIBS="$ac_save_LIBS $PYTHON_LIBS $PYTHON_EXTRA_LIBS" + LDFLAGS="$ac_save_LDFLAGS $PYTHON_EXTRA_LDFLAGS" + CPPFLAGS="$ac_save_CPPFLAGS $PYTHON_CPPFLAGS" + 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_link="$ac_pwd/libtool --mode=link --tag=CC $ac_link" +ac_compile="$ac_pwd/libtool --mode=compile --tag=CC $ac_compile" + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include <Python.h> +int +main () +{ +Py_Initialize(); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + pythonexists=yes +else + pythonexists=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 +ac_link="$ac_pwd/libtool --mode=link --tag=CC $ac_link" +ac_compile="$ac_pwd/libtool --mode=compile --tag=CC $ac_compile" + + # turn back to default flags + CPPFLAGS="$ac_save_CPPFLAGS" + LIBS="$ac_save_LIBS" + LDFLAGS="$ac_save_LDFLAGS" + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $pythonexists" >&5 +$as_echo "$pythonexists" >&6; } + + if test ! "x$pythonexists" = "xyes"; 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 $? " + Could not link test program to Python. Maybe the main Python library has been + installed in some non-standard library path. If so, pass it to configure, + via the LIBS environment variable. + Example: ./configure LIBS=\"-L/usr/non-standard-path/python/lib\" + ============================================================================ + ERROR! + You probably have to install the development version of the Python package + for your distribution. The exact name of this package varies among them. + ============================================================================ + +See \`config.log' for more details" "$LINENO" 5; } + PYTHON_VERSION="" + fi + + # + # all done! + # + +fi + if test "x$enable_python_interface" = xyes; then + ENABLE_PYTHON_INTERFACE_TRUE= + ENABLE_PYTHON_INTERFACE_FALSE='#' +else + ENABLE_PYTHON_INTERFACE_TRUE='#' + ENABLE_PYTHON_INTERFACE_FALSE= +fi + + + +# Check whether --with-on-demand-check-programs was given. +if test "${with_on_demand_check_programs+set}" = set; then : + withval=$with_on_demand_check_programs; test "x$withval" != xno && with_on_demand_check_programs=yes +else + with_on_demand_check_programs=no +fi + + if test "x$with_on_demand_check_programs" = xyes; then + with_on_demand_check_programs_TRUE= + with_on_demand_check_programs_FALSE='#' +else + with_on_demand_check_programs_TRUE='#' + with_on_demand_check_programs_FALSE= +fi + + + +# Check whether --with-concurrent-mpi-checks was given. +if test "${with_concurrent_mpi_checks+set}" = set; then : + withval=$with_concurrent_mpi_checks; test "x$withval" != xno && with_concurrent_mpi_checks=yes +else + with_concurrent_mpi_checks=no +fi + + if test "x$with_concurrent_mpi_checks" = xyes; then + with_concurrent_mpi_checks_TRUE= + with_concurrent_mpi_checks_FALSE='#' +else + with_concurrent_mpi_checks_TRUE='#' + with_concurrent_mpi_checks_FALSE= +fi + + + +# Check whether --with-example-programs was given. +if test "${with_example_programs+set}" = set; then : + withval=$with_example_programs; test "x$withval" != xno && with_example_programs=yes +else + with_example_programs=yes +fi + + if test "x$with_example_programs" = xyes; then + with_example_programs_TRUE= + with_example_programs_FALSE='#' +else + with_example_programs_TRUE='#' + with_example_programs_FALSE= +fi + + + + +if test "x$enable_mpi" = xyes; then : + ENABLE_MPI=true +else + ENABLE_MPI=false +fi + + +if test "x$have_parallel_nc4" = xyes; then : + HAVE_PARALLEL_NC4=1 +else + HAVE_PARALLEL_NC4=0 +fi + + +if test "x$enable_ruby_interface" = xyes; then : + ENABLE_RUBY_INTERFACE=true +else + ENABLE_RUBY_INTERFACE=false +fi + + +if test "x$enable_python_interface" = xyes; then : + ENABLE_PYTHON_INTERFACE=true +else + ENABLE_PYTHON_INTERFACE=false +fi + + + +ac_config_headers="$ac_config_headers src/config.h" + +ac_config_files="$ac_config_files Makefile app/Makefile cdi.settings examples/Makefile examples/pio/Makefile interfaces/Makefile src/Makefile src/cmake/cdi/cdi-config-version.cmake src/cmake/cdi/cdi-config.cmake src/pkgconfig/cdi.pc src/pkgconfig/cdi_f2003.pc src/pkgconfig/cdipio.pc tests/Makefile tests/test_cksum_base" + +ac_config_files="$ac_config_files interfaces/test_cpp_nc.run interfaces/test_python_grb.run interfaces/test_python_nc.run interfaces/test_ruby_grb.run interfaces/test_ruby_nc.run tables/gen_tableheaderfile tests/pio_cksum_asynch.run tests/pio_cksum_fpguard.run tests/pio_cksum_grb2.run tests/pio_cksum_mpi_fw_at_all.run tests/pio_cksum_mpi_fw_at_reblock.run tests/pio_cksum_mpi_fw_ordered.run tests/pio_cksum_mpinonb.run tests/pio_cksum_nc.run tests/pio_cksum_nc2.run tests/pio_cksum_nc4.run tests/pio_cksum_writer.run tests/pio_write.parallel.run tests/pio_write.run tests/pio_write_deco2d.parallel.run tests/pio_write_deco2d.run tests/pio_write_dist_array.run tests/test_byteswap.run tests/test_cdf_const.run tests/test_cdf_transformation.run tests/test_cksum_ext.run tests/test_cksum_grb.run tests/test_cksum_grb2.run tests/test_cksum_ieg.run tests/test_cksum_nc.run tests/test_cksum_nc2.run tests/test_cksum_nc4.run tests/test_cksum_nc_chunk.run tests/test_cksum_srv.run tests/test_f2003.run tests/test_grib.run tests/test_resource_copy.parallel.run tests/test_resource_copy.run tests/test_table.run" + + +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 "${ENABLE_ISOC_INTERFACE_TRUE}" && test -z "${ENABLE_ISOC_INTERFACE_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_ISOC_INTERFACE\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${FC_MOD_UPPERCASE_TRUE}" && test -z "${FC_MOD_UPPERCASE_FALSE}"; then + as_fn_error $? "conditional \"FC_MOD_UPPERCASE\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${BUILD_FC_PROGRAMS_TRUE}" && test -z "${BUILD_FC_PROGRAMS_FALSE}"; then + as_fn_error $? "conditional \"BUILD_FC_PROGRAMS\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${ENABLE_CF_INTERFACE_TRUE}" && test -z "${ENABLE_CF_INTERFACE_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_CF_INTERFACE\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then + as_fn_error $? "conditional \"am__fastdepCXX\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then + as_fn_error $? "conditional \"am__fastdepCXX\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +ac_objext=${acx_lt_saved_ac_objext} + +if test -z "${HAVE_LIBGRIB_API_TRUE}" && test -z "${HAVE_LIBGRIB_API_FALSE}"; then + as_fn_error $? "conditional \"HAVE_LIBGRIB_API\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${ENABLE_CDI_LIB_TRUE}" && test -z "${ENABLE_CDI_LIB_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_CDI_LIB\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${ENABLE_ALL_STATIC_TRUE}" && test -z "${ENABLE_ALL_STATIC_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_ALL_STATIC\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${ENABLE_HIRLAM_EXTENSIONS_TRUE}" && test -z "${ENABLE_HIRLAM_EXTENSIONS_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_HIRLAM_EXTENSIONS\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${ENABLE_CDI_APP_TRUE}" && test -z "${ENABLE_CDI_APP_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_CDI_APP\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${ENABLE_NETCDF_TRUE}" && test -z "${ENABLE_NETCDF_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_NETCDF\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${BUILD_PIO_FC_PROGRAMS_TRUE}" && test -z "${BUILD_PIO_FC_PROGRAMS_FALSE}"; then + as_fn_error $? "conditional \"BUILD_PIO_FC_PROGRAMS\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${ENABLE_MPI_TRUE}" && test -z "${ENABLE_MPI_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_MPI\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_PARALLEL_NC4_TRUE}" && test -z "${HAVE_PARALLEL_NC4_FALSE}"; then + as_fn_error $? "conditional \"HAVE_PARALLEL_NC4\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${ENABLE_RUBY_INTERFACE_TRUE}" && test -z "${ENABLE_RUBY_INTERFACE_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_RUBY_INTERFACE\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${ENABLE_PYTHON_INTERFACE_TRUE}" && test -z "${ENABLE_PYTHON_INTERFACE_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_PYTHON_INTERFACE\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${with_on_demand_check_programs_TRUE}" && test -z "${with_on_demand_check_programs_FALSE}"; then + as_fn_error $? "conditional \"with_on_demand_check_programs\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${with_concurrent_mpi_checks_TRUE}" && test -z "${with_concurrent_mpi_checks_FALSE}"; then + as_fn_error $? "conditional \"with_concurrent_mpi_checks\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${with_example_programs_TRUE}" && test -z "${with_example_programs_FALSE}"; then + as_fn_error $? "conditional \"with_example_programs\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +CFLAGS="$CFLAGS${BUILD_CFLAGS:+ $BUILD_CFLAGS}" +FCFLAGS="$FCFLAGS${BUILD_FCFLAGS:+ $BUILD_FCFLAGS}" +LDFLAGS="$LDFLAGS${BUILD_LDFLAGS:+ $BUILD_LDFLAGS}" +LIBS="$LIBS${BUILD_LIBS:+ $BUILD_LIBS}" +MPI_C_LIB="$MPI_C_LIB${BUILD_MPI_C_LIB:+ $BUILD_MPI_C_LIB}" +MPI_FC_LIB="$MPI_FC_LIB${BUILD_MPI_FC_LIB:+ $BUILD_MPI_FC_LIB}" +CC="${BUILD_CC:-$CC}" +CXX="${BUILD_CXX:-$CXX}" +FC="${BUILD_FC:-$FC}" +F77="${BUILD_F77:-$F77}" + +: "${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 cdi $as_me 2.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 <https://mpimet.mpg.de/cdi>." + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" +ac_cs_version="\\ +cdi config.status 2.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" MAKE="${MAKE-make}" + + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +sed_quote_subst='$sed_quote_subst' +double_quote_subst='$double_quote_subst' +delay_variable_subst='$delay_variable_subst' +macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' +macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' +pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' +enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' +enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' +enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' +shared_archive_member_spec='`$ECHO "$shared_archive_member_spec" | $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_import='`$ECHO "$lt_cv_sys_global_symbol_to_import" | $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"`' +lt_cv_nm_interface='`$ECHO "$lt_cv_nm_interface" | $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"`' +lt_cv_truncate_bin='`$ECHO "$lt_cv_truncate_bin" | $SED "$delay_single_quote_subst"`' +objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' +MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' +acx_is_nagfor='`$ECHO "$acx_is_nagfor" | $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"`' +configure_time_dlsearch_path='`$ECHO "$configure_time_dlsearch_path" | $SED "$delay_single_quote_subst"`' +configure_time_lt_sys_library_path='`$ECHO "$configure_time_lt_sys_library_path" | $SED "$delay_single_quote_subst"`' +hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' +enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' +enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' +enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' +old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' +striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' +compiler_lib_search_dirs='`$ECHO "$compiler_lib_search_dirs" | $SED "$delay_single_quote_subst"`' +predep_objects='`$ECHO "$predep_objects" | $SED "$delay_single_quote_subst"`' +postdep_objects='`$ECHO "$postdep_objects" | $SED "$delay_single_quote_subst"`' +predeps='`$ECHO "$predeps" | $SED "$delay_single_quote_subst"`' +postdeps='`$ECHO "$postdeps" | $SED "$delay_single_quote_subst"`' +compiler_lib_search_path='`$ECHO "$compiler_lib_search_path" | $SED "$delay_single_quote_subst"`' +LD_CXX='`$ECHO "$LD_CXX" | $SED "$delay_single_quote_subst"`' +LD_F77='`$ECHO "$LD_F77" | $SED "$delay_single_quote_subst"`' +LD_FC='`$ECHO "$LD_FC" | $SED "$delay_single_quote_subst"`' +reload_flag_CXX='`$ECHO "$reload_flag_CXX" | $SED "$delay_single_quote_subst"`' +reload_flag_F77='`$ECHO "$reload_flag_F77" | $SED "$delay_single_quote_subst"`' +reload_flag_FC='`$ECHO "$reload_flag_FC" | $SED "$delay_single_quote_subst"`' +reload_cmds_CXX='`$ECHO "$reload_cmds_CXX" | $SED "$delay_single_quote_subst"`' +reload_cmds_F77='`$ECHO "$reload_cmds_F77" | $SED "$delay_single_quote_subst"`' +reload_cmds_FC='`$ECHO "$reload_cmds_FC" | $SED "$delay_single_quote_subst"`' +old_archive_cmds_CXX='`$ECHO "$old_archive_cmds_CXX" | $SED "$delay_single_quote_subst"`' +old_archive_cmds_F77='`$ECHO "$old_archive_cmds_F77" | $SED "$delay_single_quote_subst"`' +old_archive_cmds_FC='`$ECHO "$old_archive_cmds_FC" | $SED "$delay_single_quote_subst"`' +compiler_CXX='`$ECHO "$compiler_CXX" | $SED "$delay_single_quote_subst"`' +compiler_F77='`$ECHO "$compiler_F77" | $SED "$delay_single_quote_subst"`' +compiler_FC='`$ECHO "$compiler_FC" | $SED "$delay_single_quote_subst"`' +GCC_CXX='`$ECHO "$GCC_CXX" | $SED "$delay_single_quote_subst"`' +GCC_F77='`$ECHO "$GCC_F77" | $SED "$delay_single_quote_subst"`' +GCC_FC='`$ECHO "$GCC_FC" | $SED "$delay_single_quote_subst"`' +acx_is_nagfor_CXX='`$ECHO "$acx_is_nagfor_CXX" | $SED "$delay_single_quote_subst"`' +acx_is_nagfor_F77='`$ECHO "$acx_is_nagfor_F77" | $SED "$delay_single_quote_subst"`' +acx_is_nagfor_FC='`$ECHO "$acx_is_nagfor_FC" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_no_builtin_flag_CXX='`$ECHO "$lt_prog_compiler_no_builtin_flag_CXX" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_no_builtin_flag_F77='`$ECHO "$lt_prog_compiler_no_builtin_flag_F77" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_no_builtin_flag_FC='`$ECHO "$lt_prog_compiler_no_builtin_flag_FC" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_pic_CXX='`$ECHO "$lt_prog_compiler_pic_CXX" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_pic_F77='`$ECHO "$lt_prog_compiler_pic_F77" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_pic_FC='`$ECHO "$lt_prog_compiler_pic_FC" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_wl_CXX='`$ECHO "$lt_prog_compiler_wl_CXX" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_wl_F77='`$ECHO "$lt_prog_compiler_wl_F77" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_wl_FC='`$ECHO "$lt_prog_compiler_wl_FC" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_static_CXX='`$ECHO "$lt_prog_compiler_static_CXX" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_static_F77='`$ECHO "$lt_prog_compiler_static_F77" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_static_FC='`$ECHO "$lt_prog_compiler_static_FC" | $SED "$delay_single_quote_subst"`' +lt_cv_prog_compiler_c_o_CXX='`$ECHO "$lt_cv_prog_compiler_c_o_CXX" | $SED "$delay_single_quote_subst"`' +lt_cv_prog_compiler_c_o_F77='`$ECHO "$lt_cv_prog_compiler_c_o_F77" | $SED "$delay_single_quote_subst"`' +lt_cv_prog_compiler_c_o_FC='`$ECHO "$lt_cv_prog_compiler_c_o_FC" | $SED "$delay_single_quote_subst"`' +archive_cmds_need_lc_CXX='`$ECHO "$archive_cmds_need_lc_CXX" | $SED "$delay_single_quote_subst"`' +archive_cmds_need_lc_F77='`$ECHO "$archive_cmds_need_lc_F77" | $SED "$delay_single_quote_subst"`' +archive_cmds_need_lc_FC='`$ECHO "$archive_cmds_need_lc_FC" | $SED "$delay_single_quote_subst"`' +enable_shared_with_static_runtimes_CXX='`$ECHO "$enable_shared_with_static_runtimes_CXX" | $SED "$delay_single_quote_subst"`' +enable_shared_with_static_runtimes_F77='`$ECHO "$enable_shared_with_static_runtimes_F77" | $SED "$delay_single_quote_subst"`' +enable_shared_with_static_runtimes_FC='`$ECHO "$enable_shared_with_static_runtimes_FC" | $SED "$delay_single_quote_subst"`' +export_dynamic_flag_spec_CXX='`$ECHO "$export_dynamic_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' +export_dynamic_flag_spec_F77='`$ECHO "$export_dynamic_flag_spec_F77" | $SED "$delay_single_quote_subst"`' +export_dynamic_flag_spec_FC='`$ECHO "$export_dynamic_flag_spec_FC" | $SED "$delay_single_quote_subst"`' +whole_archive_flag_spec_CXX='`$ECHO "$whole_archive_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' +whole_archive_flag_spec_F77='`$ECHO "$whole_archive_flag_spec_F77" | $SED "$delay_single_quote_subst"`' +whole_archive_flag_spec_FC='`$ECHO "$whole_archive_flag_spec_FC" | $SED "$delay_single_quote_subst"`' +compiler_needs_object_CXX='`$ECHO "$compiler_needs_object_CXX" | $SED "$delay_single_quote_subst"`' +compiler_needs_object_F77='`$ECHO "$compiler_needs_object_F77" | $SED "$delay_single_quote_subst"`' +compiler_needs_object_FC='`$ECHO "$compiler_needs_object_FC" | $SED "$delay_single_quote_subst"`' +old_archive_from_new_cmds_CXX='`$ECHO "$old_archive_from_new_cmds_CXX" | $SED "$delay_single_quote_subst"`' +old_archive_from_new_cmds_F77='`$ECHO "$old_archive_from_new_cmds_F77" | $SED "$delay_single_quote_subst"`' +old_archive_from_new_cmds_FC='`$ECHO "$old_archive_from_new_cmds_FC" | $SED "$delay_single_quote_subst"`' +old_archive_from_expsyms_cmds_CXX='`$ECHO "$old_archive_from_expsyms_cmds_CXX" | $SED "$delay_single_quote_subst"`' +old_archive_from_expsyms_cmds_F77='`$ECHO "$old_archive_from_expsyms_cmds_F77" | $SED "$delay_single_quote_subst"`' +old_archive_from_expsyms_cmds_FC='`$ECHO "$old_archive_from_expsyms_cmds_FC" | $SED "$delay_single_quote_subst"`' +archive_cmds_CXX='`$ECHO "$archive_cmds_CXX" | $SED "$delay_single_quote_subst"`' +archive_cmds_F77='`$ECHO "$archive_cmds_F77" | $SED "$delay_single_quote_subst"`' +archive_cmds_FC='`$ECHO "$archive_cmds_FC" | $SED "$delay_single_quote_subst"`' +archive_expsym_cmds_CXX='`$ECHO "$archive_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`' +archive_expsym_cmds_F77='`$ECHO "$archive_expsym_cmds_F77" | $SED "$delay_single_quote_subst"`' +archive_expsym_cmds_FC='`$ECHO "$archive_expsym_cmds_FC" | $SED "$delay_single_quote_subst"`' +module_cmds_CXX='`$ECHO "$module_cmds_CXX" | $SED "$delay_single_quote_subst"`' +module_cmds_F77='`$ECHO "$module_cmds_F77" | $SED "$delay_single_quote_subst"`' +module_cmds_FC='`$ECHO "$module_cmds_FC" | $SED "$delay_single_quote_subst"`' +module_expsym_cmds_CXX='`$ECHO "$module_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`' +module_expsym_cmds_F77='`$ECHO "$module_expsym_cmds_F77" | $SED "$delay_single_quote_subst"`' +module_expsym_cmds_FC='`$ECHO "$module_expsym_cmds_FC" | $SED "$delay_single_quote_subst"`' +with_gnu_ld_CXX='`$ECHO "$with_gnu_ld_CXX" | $SED "$delay_single_quote_subst"`' +with_gnu_ld_F77='`$ECHO "$with_gnu_ld_F77" | $SED "$delay_single_quote_subst"`' +with_gnu_ld_FC='`$ECHO "$with_gnu_ld_FC" | $SED "$delay_single_quote_subst"`' +allow_undefined_flag_CXX='`$ECHO "$allow_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`' +allow_undefined_flag_F77='`$ECHO "$allow_undefined_flag_F77" | $SED "$delay_single_quote_subst"`' +allow_undefined_flag_FC='`$ECHO "$allow_undefined_flag_FC" | $SED "$delay_single_quote_subst"`' +no_undefined_flag_CXX='`$ECHO "$no_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`' +no_undefined_flag_F77='`$ECHO "$no_undefined_flag_F77" | $SED "$delay_single_quote_subst"`' +no_undefined_flag_FC='`$ECHO "$no_undefined_flag_FC" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_flag_spec_CXX='`$ECHO "$hardcode_libdir_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_flag_spec_F77='`$ECHO "$hardcode_libdir_flag_spec_F77" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_flag_spec_FC='`$ECHO "$hardcode_libdir_flag_spec_FC" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_separator_CXX='`$ECHO "$hardcode_libdir_separator_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_separator_F77='`$ECHO "$hardcode_libdir_separator_F77" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_separator_FC='`$ECHO "$hardcode_libdir_separator_FC" | $SED "$delay_single_quote_subst"`' +hardcode_direct_CXX='`$ECHO "$hardcode_direct_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_direct_F77='`$ECHO "$hardcode_direct_F77" | $SED "$delay_single_quote_subst"`' +hardcode_direct_FC='`$ECHO "$hardcode_direct_FC" | $SED "$delay_single_quote_subst"`' +hardcode_direct_absolute_CXX='`$ECHO "$hardcode_direct_absolute_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_direct_absolute_F77='`$ECHO "$hardcode_direct_absolute_F77" | $SED "$delay_single_quote_subst"`' +hardcode_direct_absolute_FC='`$ECHO "$hardcode_direct_absolute_FC" | $SED "$delay_single_quote_subst"`' +hardcode_minus_L_CXX='`$ECHO "$hardcode_minus_L_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_minus_L_F77='`$ECHO "$hardcode_minus_L_F77" | $SED "$delay_single_quote_subst"`' +hardcode_minus_L_FC='`$ECHO "$hardcode_minus_L_FC" | $SED "$delay_single_quote_subst"`' +hardcode_shlibpath_var_CXX='`$ECHO "$hardcode_shlibpath_var_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_shlibpath_var_F77='`$ECHO "$hardcode_shlibpath_var_F77" | $SED "$delay_single_quote_subst"`' +hardcode_shlibpath_var_FC='`$ECHO "$hardcode_shlibpath_var_FC" | $SED "$delay_single_quote_subst"`' +hardcode_automatic_CXX='`$ECHO "$hardcode_automatic_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_automatic_F77='`$ECHO "$hardcode_automatic_F77" | $SED "$delay_single_quote_subst"`' +hardcode_automatic_FC='`$ECHO "$hardcode_automatic_FC" | $SED "$delay_single_quote_subst"`' +inherit_rpath_CXX='`$ECHO "$inherit_rpath_CXX" | $SED "$delay_single_quote_subst"`' +inherit_rpath_F77='`$ECHO "$inherit_rpath_F77" | $SED "$delay_single_quote_subst"`' +inherit_rpath_FC='`$ECHO "$inherit_rpath_FC" | $SED "$delay_single_quote_subst"`' +link_all_deplibs_CXX='`$ECHO "$link_all_deplibs_CXX" | $SED "$delay_single_quote_subst"`' +link_all_deplibs_F77='`$ECHO "$link_all_deplibs_F77" | $SED "$delay_single_quote_subst"`' +link_all_deplibs_FC='`$ECHO "$link_all_deplibs_FC" | $SED "$delay_single_quote_subst"`' +always_export_symbols_CXX='`$ECHO "$always_export_symbols_CXX" | $SED "$delay_single_quote_subst"`' +always_export_symbols_F77='`$ECHO "$always_export_symbols_F77" | $SED "$delay_single_quote_subst"`' +always_export_symbols_FC='`$ECHO "$always_export_symbols_FC" | $SED "$delay_single_quote_subst"`' +export_symbols_cmds_CXX='`$ECHO "$export_symbols_cmds_CXX" | $SED "$delay_single_quote_subst"`' +export_symbols_cmds_F77='`$ECHO "$export_symbols_cmds_F77" | $SED "$delay_single_quote_subst"`' +export_symbols_cmds_FC='`$ECHO "$export_symbols_cmds_FC" | $SED "$delay_single_quote_subst"`' +exclude_expsyms_CXX='`$ECHO "$exclude_expsyms_CXX" | $SED "$delay_single_quote_subst"`' +exclude_expsyms_F77='`$ECHO "$exclude_expsyms_F77" | $SED "$delay_single_quote_subst"`' +exclude_expsyms_FC='`$ECHO "$exclude_expsyms_FC" | $SED "$delay_single_quote_subst"`' +include_expsyms_CXX='`$ECHO "$include_expsyms_CXX" | $SED "$delay_single_quote_subst"`' +include_expsyms_F77='`$ECHO "$include_expsyms_F77" | $SED "$delay_single_quote_subst"`' +include_expsyms_FC='`$ECHO "$include_expsyms_FC" | $SED "$delay_single_quote_subst"`' +prelink_cmds_CXX='`$ECHO "$prelink_cmds_CXX" | $SED "$delay_single_quote_subst"`' +prelink_cmds_F77='`$ECHO "$prelink_cmds_F77" | $SED "$delay_single_quote_subst"`' +prelink_cmds_FC='`$ECHO "$prelink_cmds_FC" | $SED "$delay_single_quote_subst"`' +postlink_cmds_CXX='`$ECHO "$postlink_cmds_CXX" | $SED "$delay_single_quote_subst"`' +postlink_cmds_F77='`$ECHO "$postlink_cmds_F77" | $SED "$delay_single_quote_subst"`' +postlink_cmds_FC='`$ECHO "$postlink_cmds_FC" | $SED "$delay_single_quote_subst"`' +file_list_spec_CXX='`$ECHO "$file_list_spec_CXX" | $SED "$delay_single_quote_subst"`' +file_list_spec_F77='`$ECHO "$file_list_spec_F77" | $SED "$delay_single_quote_subst"`' +file_list_spec_FC='`$ECHO "$file_list_spec_FC" | $SED "$delay_single_quote_subst"`' +hardcode_action_CXX='`$ECHO "$hardcode_action_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_action_F77='`$ECHO "$hardcode_action_F77" | $SED "$delay_single_quote_subst"`' +hardcode_action_FC='`$ECHO "$hardcode_action_FC" | $SED "$delay_single_quote_subst"`' +compiler_lib_search_dirs_CXX='`$ECHO "$compiler_lib_search_dirs_CXX" | $SED "$delay_single_quote_subst"`' +compiler_lib_search_dirs_F77='`$ECHO "$compiler_lib_search_dirs_F77" | $SED "$delay_single_quote_subst"`' +compiler_lib_search_dirs_FC='`$ECHO "$compiler_lib_search_dirs_FC" | $SED "$delay_single_quote_subst"`' +predep_objects_CXX='`$ECHO "$predep_objects_CXX" | $SED "$delay_single_quote_subst"`' +predep_objects_F77='`$ECHO "$predep_objects_F77" | $SED "$delay_single_quote_subst"`' +predep_objects_FC='`$ECHO "$predep_objects_FC" | $SED "$delay_single_quote_subst"`' +postdep_objects_CXX='`$ECHO "$postdep_objects_CXX" | $SED "$delay_single_quote_subst"`' +postdep_objects_F77='`$ECHO "$postdep_objects_F77" | $SED "$delay_single_quote_subst"`' +postdep_objects_FC='`$ECHO "$postdep_objects_FC" | $SED "$delay_single_quote_subst"`' +predeps_CXX='`$ECHO "$predeps_CXX" | $SED "$delay_single_quote_subst"`' +predeps_F77='`$ECHO "$predeps_F77" | $SED "$delay_single_quote_subst"`' +predeps_FC='`$ECHO "$predeps_FC" | $SED "$delay_single_quote_subst"`' +postdeps_CXX='`$ECHO "$postdeps_CXX" | $SED "$delay_single_quote_subst"`' +postdeps_F77='`$ECHO "$postdeps_F77" | $SED "$delay_single_quote_subst"`' +postdeps_FC='`$ECHO "$postdeps_FC" | $SED "$delay_single_quote_subst"`' +compiler_lib_search_path_CXX='`$ECHO "$compiler_lib_search_path_CXX" | $SED "$delay_single_quote_subst"`' +compiler_lib_search_path_F77='`$ECHO "$compiler_lib_search_path_F77" | $SED "$delay_single_quote_subst"`' +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_import \ +lt_cv_sys_global_symbol_to_c_name_address \ +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ +lt_cv_nm_interface \ +nm_file_list_spec \ +lt_cv_truncate_bin \ +lt_prog_compiler_no_builtin_flag \ +lt_prog_compiler_pic \ +lt_prog_compiler_wl \ +lt_prog_compiler_static \ +lt_cv_prog_compiler_c_o \ +need_locks \ +MANIFEST_TOOL \ +DSYMUTIL \ +NMEDIT \ +LIPO \ +OTOOL \ +OTOOL64 \ +shrext_cmds \ +export_dynamic_flag_spec \ +whole_archive_flag_spec \ +compiler_needs_object \ +with_gnu_ld \ +allow_undefined_flag \ +no_undefined_flag \ +hardcode_libdir_flag_spec \ +hardcode_libdir_separator \ +exclude_expsyms \ +include_expsyms \ +file_list_spec \ +variables_saved_for_relink \ +libname_spec \ +library_names_spec \ +soname_spec \ +install_override_mode \ +finish_eval \ +old_striplib \ +striplib \ +compiler_lib_search_dirs \ +predep_objects \ +postdep_objects \ +predeps \ +postdeps \ +compiler_lib_search_path \ +LD_CXX \ +LD_F77 \ +LD_FC \ +reload_flag_CXX \ +reload_flag_F77 \ +reload_flag_FC \ +compiler_CXX \ +compiler_F77 \ +compiler_FC \ +lt_prog_compiler_no_builtin_flag_CXX \ +lt_prog_compiler_no_builtin_flag_F77 \ +lt_prog_compiler_no_builtin_flag_FC \ +lt_prog_compiler_pic_CXX \ +lt_prog_compiler_pic_F77 \ +lt_prog_compiler_pic_FC \ +lt_prog_compiler_wl_CXX \ +lt_prog_compiler_wl_F77 \ +lt_prog_compiler_wl_FC \ +lt_prog_compiler_static_CXX \ +lt_prog_compiler_static_F77 \ +lt_prog_compiler_static_FC \ +lt_cv_prog_compiler_c_o_CXX \ +lt_cv_prog_compiler_c_o_F77 \ +lt_cv_prog_compiler_c_o_FC \ +export_dynamic_flag_spec_CXX \ +export_dynamic_flag_spec_F77 \ +export_dynamic_flag_spec_FC \ +whole_archive_flag_spec_CXX \ +whole_archive_flag_spec_F77 \ +whole_archive_flag_spec_FC \ +compiler_needs_object_CXX \ +compiler_needs_object_F77 \ +compiler_needs_object_FC \ +with_gnu_ld_CXX \ +with_gnu_ld_F77 \ +with_gnu_ld_FC \ +allow_undefined_flag_CXX \ +allow_undefined_flag_F77 \ +allow_undefined_flag_FC \ +no_undefined_flag_CXX \ +no_undefined_flag_F77 \ +no_undefined_flag_FC \ +hardcode_libdir_flag_spec_CXX \ +hardcode_libdir_flag_spec_F77 \ +hardcode_libdir_flag_spec_FC \ +hardcode_libdir_separator_CXX \ +hardcode_libdir_separator_F77 \ +hardcode_libdir_separator_FC \ +exclude_expsyms_CXX \ +exclude_expsyms_F77 \ +exclude_expsyms_FC \ +include_expsyms_CXX \ +include_expsyms_F77 \ +include_expsyms_FC \ +file_list_spec_CXX \ +file_list_spec_F77 \ +file_list_spec_FC \ +compiler_lib_search_dirs_CXX \ +compiler_lib_search_dirs_F77 \ +compiler_lib_search_dirs_FC \ +predep_objects_CXX \ +predep_objects_F77 \ +predep_objects_FC \ +postdep_objects_CXX \ +postdep_objects_F77 \ +postdep_objects_FC \ +predeps_CXX \ +predeps_F77 \ +predeps_FC \ +postdeps_CXX \ +postdeps_F77 \ +postdeps_FC \ +compiler_lib_search_path_CXX \ +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\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes + ;; + *) + 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 \ +configure_time_dlsearch_path \ +configure_time_lt_sys_library_path \ +reload_cmds_CXX \ +reload_cmds_F77 \ +reload_cmds_FC \ +old_archive_cmds_CXX \ +old_archive_cmds_F77 \ +old_archive_cmds_FC \ +old_archive_from_new_cmds_CXX \ +old_archive_from_new_cmds_F77 \ +old_archive_from_new_cmds_FC \ +old_archive_from_expsyms_cmds_CXX \ +old_archive_from_expsyms_cmds_F77 \ +old_archive_from_expsyms_cmds_FC \ +archive_cmds_CXX \ +archive_cmds_F77 \ +archive_cmds_FC \ +archive_expsym_cmds_CXX \ +archive_expsym_cmds_F77 \ +archive_expsym_cmds_FC \ +module_cmds_CXX \ +module_cmds_F77 \ +module_cmds_FC \ +module_expsym_cmds_CXX \ +module_expsym_cmds_F77 \ +module_expsym_cmds_FC \ +export_symbols_cmds_CXX \ +export_symbols_cmds_F77 \ +export_symbols_cmds_FC \ +prelink_cmds_CXX \ +prelink_cmds_F77 \ +prelink_cmds_FC \ +postlink_cmds_CXX \ +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\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +ac_aux_dir='$ac_aux_dir' + +# See if we are running on zsh, and set the options that 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' + RM='$RM' + ofile='$ofile' + + + + + + + +ac_aux_dir='$ac_aux_dir' + + + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; + "src/config.h") CONFIG_HEADERS="$CONFIG_HEADERS src/config.h" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "app/Makefile") CONFIG_FILES="$CONFIG_FILES app/Makefile" ;; + "cdi.settings") CONFIG_FILES="$CONFIG_FILES cdi.settings" ;; + "examples/Makefile") CONFIG_FILES="$CONFIG_FILES examples/Makefile" ;; + "examples/pio/Makefile") CONFIG_FILES="$CONFIG_FILES examples/pio/Makefile" ;; + "interfaces/Makefile") CONFIG_FILES="$CONFIG_FILES interfaces/Makefile" ;; + "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; + "src/cmake/cdi/cdi-config-version.cmake") CONFIG_FILES="$CONFIG_FILES src/cmake/cdi/cdi-config-version.cmake" ;; + "src/cmake/cdi/cdi-config.cmake") CONFIG_FILES="$CONFIG_FILES src/cmake/cdi/cdi-config.cmake" ;; + "src/pkgconfig/cdi.pc") CONFIG_FILES="$CONFIG_FILES src/pkgconfig/cdi.pc" ;; + "src/pkgconfig/cdi_f2003.pc") CONFIG_FILES="$CONFIG_FILES src/pkgconfig/cdi_f2003.pc" ;; + "src/pkgconfig/cdipio.pc") CONFIG_FILES="$CONFIG_FILES src/pkgconfig/cdipio.pc" ;; + "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;; + "tests/test_cksum_base") CONFIG_FILES="$CONFIG_FILES tests/test_cksum_base" ;; + "interfaces/test_cpp_nc.run") CONFIG_FILES="$CONFIG_FILES interfaces/test_cpp_nc.run" ;; + "interfaces/test_python_grb.run") CONFIG_FILES="$CONFIG_FILES interfaces/test_python_grb.run" ;; + "interfaces/test_python_nc.run") CONFIG_FILES="$CONFIG_FILES interfaces/test_python_nc.run" ;; + "interfaces/test_ruby_grb.run") CONFIG_FILES="$CONFIG_FILES interfaces/test_ruby_grb.run" ;; + "interfaces/test_ruby_nc.run") CONFIG_FILES="$CONFIG_FILES interfaces/test_ruby_nc.run" ;; + "tables/gen_tableheaderfile") CONFIG_FILES="$CONFIG_FILES tables/gen_tableheaderfile" ;; + "tests/pio_cksum_asynch.run") CONFIG_FILES="$CONFIG_FILES tests/pio_cksum_asynch.run" ;; + "tests/pio_cksum_fpguard.run") CONFIG_FILES="$CONFIG_FILES tests/pio_cksum_fpguard.run" ;; + "tests/pio_cksum_grb2.run") CONFIG_FILES="$CONFIG_FILES tests/pio_cksum_grb2.run" ;; + "tests/pio_cksum_mpi_fw_at_all.run") CONFIG_FILES="$CONFIG_FILES tests/pio_cksum_mpi_fw_at_all.run" ;; + "tests/pio_cksum_mpi_fw_at_reblock.run") CONFIG_FILES="$CONFIG_FILES tests/pio_cksum_mpi_fw_at_reblock.run" ;; + "tests/pio_cksum_mpi_fw_ordered.run") CONFIG_FILES="$CONFIG_FILES tests/pio_cksum_mpi_fw_ordered.run" ;; + "tests/pio_cksum_mpinonb.run") CONFIG_FILES="$CONFIG_FILES tests/pio_cksum_mpinonb.run" ;; + "tests/pio_cksum_nc.run") CONFIG_FILES="$CONFIG_FILES tests/pio_cksum_nc.run" ;; + "tests/pio_cksum_nc2.run") CONFIG_FILES="$CONFIG_FILES tests/pio_cksum_nc2.run" ;; + "tests/pio_cksum_nc4.run") CONFIG_FILES="$CONFIG_FILES tests/pio_cksum_nc4.run" ;; + "tests/pio_cksum_writer.run") CONFIG_FILES="$CONFIG_FILES tests/pio_cksum_writer.run" ;; + "tests/pio_write.parallel.run") CONFIG_FILES="$CONFIG_FILES tests/pio_write.parallel.run" ;; + "tests/pio_write.run") CONFIG_FILES="$CONFIG_FILES tests/pio_write.run" ;; + "tests/pio_write_deco2d.parallel.run") CONFIG_FILES="$CONFIG_FILES tests/pio_write_deco2d.parallel.run" ;; + "tests/pio_write_deco2d.run") CONFIG_FILES="$CONFIG_FILES tests/pio_write_deco2d.run" ;; + "tests/pio_write_dist_array.run") CONFIG_FILES="$CONFIG_FILES tests/pio_write_dist_array.run" ;; + "tests/test_byteswap.run") CONFIG_FILES="$CONFIG_FILES tests/test_byteswap.run" ;; + "tests/test_cdf_const.run") CONFIG_FILES="$CONFIG_FILES tests/test_cdf_const.run" ;; + "tests/test_cdf_transformation.run") CONFIG_FILES="$CONFIG_FILES tests/test_cdf_transformation.run" ;; + "tests/test_cksum_ext.run") CONFIG_FILES="$CONFIG_FILES tests/test_cksum_ext.run" ;; + "tests/test_cksum_grb.run") CONFIG_FILES="$CONFIG_FILES tests/test_cksum_grb.run" ;; + "tests/test_cksum_grb2.run") CONFIG_FILES="$CONFIG_FILES tests/test_cksum_grb2.run" ;; + "tests/test_cksum_ieg.run") CONFIG_FILES="$CONFIG_FILES tests/test_cksum_ieg.run" ;; + "tests/test_cksum_nc.run") CONFIG_FILES="$CONFIG_FILES tests/test_cksum_nc.run" ;; + "tests/test_cksum_nc2.run") CONFIG_FILES="$CONFIG_FILES tests/test_cksum_nc2.run" ;; + "tests/test_cksum_nc4.run") CONFIG_FILES="$CONFIG_FILES tests/test_cksum_nc4.run" ;; + "tests/test_cksum_nc_chunk.run") CONFIG_FILES="$CONFIG_FILES tests/test_cksum_nc_chunk.run" ;; + "tests/test_cksum_srv.run") CONFIG_FILES="$CONFIG_FILES tests/test_cksum_srv.run" ;; + "tests/test_f2003.run") CONFIG_FILES="$CONFIG_FILES tests/test_f2003.run" ;; + "tests/test_grib.run") CONFIG_FILES="$CONFIG_FILES tests/test_grib.run" ;; + "tests/test_resource_copy.parallel.run") CONFIG_FILES="$CONFIG_FILES tests/test_resource_copy.parallel.run" ;; + "tests/test_resource_copy.run") CONFIG_FILES="$CONFIG_FILES tests/test_resource_copy.run" ;; + "tests/test_table.run") CONFIG_FILES="$CONFIG_FILES tests/test_table.run" ;; + + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers + test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= ac_tmp= + trap 'exit_status=$? + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status +' 0 + trap 'as_fn_exit 1' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && +_ACEOF + + +{ + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + . ./conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done +rm -f conf$$subs.sh + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\)..*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\)..*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' <conf$$subs.awk | sed ' +/^[^""]/{ + N + s/\n// +} +' >>$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} + +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 +_ACEOF + +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// +s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +fi # test -n "$CONFIG_FILES" + +# Set up the scripts for CONFIG_HEADERS section. +# No need to generate them if there are no CONFIG_HEADERS. +# This happens for instance with `./config.status Makefile'. +if test -n "$CONFIG_HEADERS"; then +cat >"$ac_tmp/defines.awk" <<\_ACAWK || +BEGIN { +_ACEOF + +# Transform confdefs.h into an awk script `defines.awk', embedded as +# here-document in config.status, that substitutes the proper values into +# config.h.in to produce config.h. + +# Create a delimiter string that does not exist in confdefs.h, to ease +# handling of long lines. +ac_delim='%!_!# ' +for ac_last_try in false false :; do + ac_tt=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_tt"; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +# For the awk script, D is an array of macro values keyed by name, +# likewise P contains macro parameters if any. Preserve backslash +# newline sequences. + +ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* +sed -n ' +s/.\{148\}/&'"$ac_delim"'/g +t rset +:rset +s/^[ ]*#[ ]*define[ ][ ]*/ / +t def +d +:def +s/\\$// +t bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3"/p +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p +d +:bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3\\\\\\n"\\/p +t cont +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p +t cont +d +:cont +n +s/.\{148\}/&'"$ac_delim"'/g +t clear +:clear +s/\\$// +t bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/"/p +d +:bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p +b cont +' <confdefs.h | sed ' +s/'"$ac_delim"'/"\\\ +"/g' >>$CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + for (key in D) D_is_set[key] = 1 + FS = "" +} +/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { + line = \$ 0 + split(line, arg, " ") + if (arg[1] == "#") { + defundef = arg[2] + mac1 = arg[3] + } else { + defundef = substr(arg[1], 2) + mac1 = arg[2] + } + split(mac1, mac2, "(") #) + macro = mac2[1] + prefix = substr(line, 1, index(line, defundef) - 1) + if (D_is_set[macro]) { + # Preserve the white space surrounding the "#". + print prefix "define", macro P[macro] D[macro] + next + } else { + # Replace #undef with comments. This is necessary, for example, + # in the case of _POSIX_SOURCE, which is predefined and required + # on some systems where configure will not decide to define it. + if (defundef == "undef") { + print "/*", prefix defundef, macro, "*/" + next + } + } +} +{ print } +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 +fi # test -n "$CONFIG_HEADERS" + + +eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$ac_tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; + esac + case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append ac_file_inputs " '$ac_f'" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input='Generated from '` + $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +$as_echo "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`$as_echo "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir="$ac_dir"; as_fn_mkdir_p + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; + esac + ac_MKDIR_P=$MKDIR_P + case $MKDIR_P in + [\\/$]* | ?:[\\/]* ) ;; + */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; + esac +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_sed_extra="$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +s&@MKDIR_P@&$ac_MKDIR_P&;t t +$ac_datarootdir_hack +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&5 +$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&2;} + + rm -f "$ac_tmp/stdin" + case $ac_file in + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; + esac \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + ;; + :H) + # + # CONFIG_HEADER + # + if test x"$ac_file" != x-; then + { + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" + } >"$ac_tmp/config.h" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then + { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 +$as_echo "$as_me: $ac_file is unchanged" >&6;} + else + rm -f "$ac_file" + mv "$ac_tmp/config.h" "$ac_file" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + fi + else + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ + || as_fn_error $? "could not create -" "$LINENO" 5 + fi +# Compute "$ac_file"'s index in $config_headers. +_am_arg="$ac_file" +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $_am_arg | $_am_arg:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || +$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$_am_arg" : 'X\(//\)[^/]' \| \ + X"$_am_arg" : 'X\(//\)$' \| \ + X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$_am_arg" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'`/stamp-h$_am_stamp_count + ;; + + :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 +$as_echo "$as_me: executing $ac_file commands" >&6;} + ;; + esac + + + case $ac_file$ac_mode in + "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. + # TODO: see whether this extra hack can be removed once we start + # requiring Autoconf 2.70 or later. + case $CONFIG_FILES in #( + *\'*) : + eval set x "$CONFIG_FILES" ;; #( + *) : + set x $CONFIG_FILES ;; #( + *) : + ;; +esac + shift + # Used to flag and report bootstrapping failures. + am_rc=0 + for am_mf + do + # Strip MF so we end up with the name of the file. + am_mf=`$as_echo "$am_mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile which includes + # dependency-tracking related rules and includes. + # Grep'ing the whole file directly is not great: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ + || continue + am_dirpart=`$as_dirname -- "$am_mf" || +$as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$am_mf" : 'X\(//\)[^/]' \| \ + X"$am_mf" : 'X\(//\)$' \| \ + X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$am_mf" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + am_filepart=`$as_basename -- "$am_mf" || +$as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \ + X"$am_mf" : 'X\(//\)$' \| \ + X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$am_mf" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + { echo "$as_me:$LINENO: cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles" >&5 + (cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } || am_rc=$? + done + if test $am_rc -ne 0; 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 $? "Something went wrong bootstrapping makefile fragments + for automatic dependency tracking. If GNU make was not used, consider + re-running the configure script with MAKE=\"gmake\" (or whatever is + necessary). You can also try re-running configure with the + '--disable-dependency-tracking' option to at least be able to build + the package (albeit without support for automatic dependency tracking). +See \`config.log' for more details" "$LINENO" 5; } + fi + { am_dirpart=; unset am_dirpart;} + { am_filepart=; unset am_filepart;} + { am_mf=; unset am_mf;} + { am_rc=; unset am_rc;} + rm -f conftest-deps.mk +} + ;; + "libtool":C) + + # See if we are running on zsh, and set the options that 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 +# Generated automatically by $as_me ($PACKAGE) $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. + +# Provide generalized library-building support services. +# Written by Gordon Matzigkeit, 1996 + +# Copyright (C) 2014 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 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 this program. If not, see <http://www.gnu.org/licenses/>. + + +# The names of the tagged configurations supported by this script. +available_tags='CXX F77 FC ' + +# Configured defaults for sys_lib_dlsearch_path munging. +: \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"} + +# ### BEGIN LIBTOOL CONFIG + +# Which release of libtool.m4 was used? +macro_version=$macro_version +macro_revision=$macro_revision + +# What type of objects to build. +pic_mode=$pic_mode + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# Shared archive member basename,for filename based shared library versioning on AIX. +shared_archive_member_spec=$shared_archive_member_spec + +# 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 into a list of symbols to manually relocate. +global_symbol_to_import=$lt_lt_cv_sys_global_symbol_to_import + +# 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 + +# The name lister interface. +nm_interface=$lt_lt_cv_nm_interface + +# 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 where our libraries should be installed. +lt_sysroot=$lt_sysroot + +# Command to truncate a binary pipe. +lt_truncate_bin=$lt_lt_cv_truncate_bin + +# 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 + +# Detected run-time system search path for libraries. +sys_lib_dlsearch_path_spec=$lt_configure_time_dlsearch_path + +# Explicit LT_SYS_LIBRARY_PATH set during ./configure time. +configure_time_lt_sys_library_path=$lt_configure_time_lt_sys_library_path + +# 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 + +# Is the compiler the NAG Fortran compiler? +with_nagfor=$acx_is_nagfor + +# 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 + + cat <<'_LT_EOF' >> "$cfgfile" + +# ### BEGIN FUNCTIONS SHARED WITH CONFIGURE + +# func_munge_path_list VARIABLE PATH +# ----------------------------------- +# VARIABLE is name of variable containing _space_ separated list of +# directories to be munged by the contents of PATH, which is string +# having a format: +# "DIR[:DIR]:" +# string "DIR[ DIR]" will be prepended to VARIABLE +# ":DIR[:DIR]" +# string "DIR[ DIR]" will be appended to VARIABLE +# "DIRP[:DIRP]::[DIRA:]DIRA" +# string "DIRP[ DIRP]" will be prepended to VARIABLE and string +# "DIRA[ DIRA]" will be appended to VARIABLE +# "DIR[:DIR]" +# VARIABLE will be replaced by "DIR[ DIR]" +func_munge_path_list () +{ + case x$2 in + x) + ;; + *:) + eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" + ;; + x:*) + eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" + ;; + *::*) + eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" + eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" + ;; + *) + eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" + ;; + esac +} + + +# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. +func_cc_basename () +{ + for cc_temp in $*""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac + done + func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` +} + + +# ### END FUNCTIONS SHARED WITH CONFIGURE + +_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 set != "${COLLECT_NAMES+set}"; 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) + + mv -f "$cfgfile" "$ofile" || + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" + + + cat <<_LT_EOF >> "$ofile" + +# ### BEGIN LIBTOOL TAG CONFIG: CXX + +# The linker used to build libraries. +LD=$lt_LD_CXX + +# How to create reloadable object files. +reload_flag=$lt_reload_flag_CXX +reload_cmds=$lt_reload_cmds_CXX + +# Commands used to build an old-style archive. +old_archive_cmds=$lt_old_archive_cmds_CXX + +# A language specific compiler. +CC=$lt_compiler_CXX + +# Is the compiler the GNU compiler? +with_gcc=$GCC_CXX + +# Is the compiler the NAG Fortran compiler? +with_nagfor=$acx_is_nagfor_CXX + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic_CXX + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl_CXX + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static_CXX + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_CXX + +# Whether or not to disallow shared libs when runtime libs are static. +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX + +# Whether the compiler copes with passing no objects directly. +compiler_needs_object=$lt_compiler_needs_object_CXX + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX + +# Commands used to build a shared archive. +archive_cmds=$lt_archive_cmds_CXX +archive_expsym_cmds=$lt_archive_expsym_cmds_CXX + +# Commands used to build a loadable module if different from building +# a shared archive. +module_cmds=$lt_module_cmds_CXX +module_expsym_cmds=$lt_module_expsym_cmds_CXX + +# Whether we are building with GNU ld or not. +with_gnu_ld=$lt_with_gnu_ld_CXX + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag_CXX + +# Flag that enforces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag_CXX + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX + +# Whether we need a single "-rpath" flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX + +# Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes +# DIR into the resulting binary. +hardcode_direct=$hardcode_direct_CXX + +# Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes +# DIR into the resulting binary and the resulting library dependency is +# "absolute",i.e impossible to change by setting \$shlibpath_var if the +# library is relocated. +hardcode_direct_absolute=$hardcode_direct_absolute_CXX + +# Set to "yes" if using the -LDIR flag during linking hardcodes DIR +# into the resulting binary. +hardcode_minus_L=$hardcode_minus_L_CXX + +# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR +# into the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX + +# Set to "yes" if building a shared library automatically hardcodes DIR +# into the library and all subsequent libraries and executables linked +# against it. +hardcode_automatic=$hardcode_automatic_CXX + +# Set to yes if linker adds runtime paths of dependent libraries +# to runtime path list. +inherit_rpath=$inherit_rpath_CXX + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs_CXX + +# Set to "yes" if exported symbols are required. +always_export_symbols=$always_export_symbols_CXX + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_CXX + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_CXX + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_CXX + +# Commands necessary for linking programs (against libraries) with templates. +prelink_cmds=$lt_prelink_cmds_CXX + +# Commands necessary for finishing linking programs. +postlink_cmds=$lt_postlink_cmds_CXX + +# Specify filename containing input files. +file_list_spec=$lt_file_list_spec_CXX + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action_CXX + +# The directories searched by this compiler when creating a shared library. +compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_CXX + +# Dependencies to place before and after the objects being linked to +# create a shared library. +predep_objects=$lt_predep_objects_CXX +postdep_objects=$lt_postdep_objects_CXX +predeps=$lt_predeps_CXX +postdeps=$lt_postdeps_CXX + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path_CXX + +# ### END LIBTOOL TAG CONFIG: CXX +_LT_EOF + + + cat <<_LT_EOF >> "$ofile" + +# ### BEGIN LIBTOOL TAG CONFIG: F77 + +# The linker used to build libraries. +LD=$lt_LD_F77 + +# How to create reloadable object files. +reload_flag=$lt_reload_flag_F77 +reload_cmds=$lt_reload_cmds_F77 + +# Commands used to build an old-style archive. +old_archive_cmds=$lt_old_archive_cmds_F77 + +# A language specific compiler. +CC=$lt_compiler_F77 + +# Is the compiler the GNU compiler? +with_gcc=$GCC_F77 + +# Is the compiler the NAG Fortran compiler? +with_nagfor=$acx_is_nagfor_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 + +# Is the compiler the NAG Fortran compiler? +with_nagfor=$acx_is_nagfor_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 + + ;; + "interfaces/test_cpp_nc.run":F) chmod a+x "$ac_file" ;; + "interfaces/test_python_grb.run":F) chmod a+x "$ac_file" ;; + "interfaces/test_python_nc.run":F) chmod a+x "$ac_file" ;; + "interfaces/test_ruby_grb.run":F) chmod a+x "$ac_file" ;; + "interfaces/test_ruby_nc.run":F) chmod a+x "$ac_file" ;; + "tables/gen_tableheaderfile":F) chmod a+x "$ac_file" ;; + "tests/pio_cksum_asynch.run":F) chmod a+x "$ac_file" ;; + "tests/pio_cksum_fpguard.run":F) chmod a+x "$ac_file" ;; + "tests/pio_cksum_grb2.run":F) chmod a+x "$ac_file" ;; + "tests/pio_cksum_mpi_fw_at_all.run":F) chmod a+x "$ac_file" ;; + "tests/pio_cksum_mpi_fw_at_reblock.run":F) chmod a+x "$ac_file" ;; + "tests/pio_cksum_mpi_fw_ordered.run":F) chmod a+x "$ac_file" ;; + "tests/pio_cksum_mpinonb.run":F) chmod a+x "$ac_file" ;; + "tests/pio_cksum_nc.run":F) chmod a+x "$ac_file" ;; + "tests/pio_cksum_nc2.run":F) chmod a+x "$ac_file" ;; + "tests/pio_cksum_nc4.run":F) chmod a+x "$ac_file" ;; + "tests/pio_cksum_writer.run":F) chmod a+x "$ac_file" ;; + "tests/pio_write.parallel.run":F) chmod a+x "$ac_file" ;; + "tests/pio_write.run":F) chmod a+x "$ac_file" ;; + "tests/pio_write_deco2d.parallel.run":F) chmod a+x "$ac_file" ;; + "tests/pio_write_deco2d.run":F) chmod a+x "$ac_file" ;; + "tests/pio_write_dist_array.run":F) chmod a+x "$ac_file" ;; + "tests/test_byteswap.run":F) chmod a+x "$ac_file" ;; + "tests/test_cdf_const.run":F) chmod a+x "$ac_file" ;; + "tests/test_cdf_transformation.run":F) chmod a+x "$ac_file" ;; + "tests/test_cksum_ext.run":F) chmod a+x "$ac_file" ;; + "tests/test_cksum_grb.run":F) chmod a+x "$ac_file" ;; + "tests/test_cksum_grb2.run":F) chmod a+x "$ac_file" ;; + "tests/test_cksum_ieg.run":F) chmod a+x "$ac_file" ;; + "tests/test_cksum_nc.run":F) chmod a+x "$ac_file" ;; + "tests/test_cksum_nc2.run":F) chmod a+x "$ac_file" ;; + "tests/test_cksum_nc4.run":F) chmod a+x "$ac_file" ;; + "tests/test_cksum_nc_chunk.run":F) chmod a+x "$ac_file" ;; + "tests/test_cksum_srv.run":F) chmod a+x "$ac_file" ;; + "tests/test_f2003.run":F) chmod a+x "$ac_file" ;; + "tests/test_grib.run":F) chmod a+x "$ac_file" ;; + "tests/test_resource_copy.parallel.run":F) chmod a+x "$ac_file" ;; + "tests/test_resource_copy.run":F) chmod a+x "$ac_file" ;; + "tests/test_table.run":F) chmod a+x "$ac_file" ;; + + 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 + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: CDI is configured with the following options:" >&5 +$as_echo "$as_me: CDI is configured with the following options:" >&6;} +cat cdi.settings >&6 + +{ $as_echo "$as_me:${as_lineno-$LINENO}: + + Configuration completed. + + You can now run 'make' to compile the CDI package and 'make install' to install it afterwards. +" >&5 +$as_echo "$as_me: + + Configuration completed. + + You can now run 'make' to compile the CDI package and 'make install' to install it afterwards. +" >&6;} diff --git a/doc/cdi_cman.pdf b/doc/cdi_cman.pdf new file mode 100644 index 0000000000000000000000000000000000000000..3cdc1333f9f0ae2ef90d8edf4b44225715af6bb6 Binary files /dev/null and b/doc/cdi_cman.pdf differ diff --git a/doc/cdi_fman.pdf b/doc/cdi_fman.pdf new file mode 100644 index 0000000000000000000000000000000000000000..de920b695b8a71871ef949473ab806f7dd5cb0c3 Binary files /dev/null and b/doc/cdi_fman.pdf differ diff --git a/examples/Makefile.in b/examples/Makefile.in new file mode 100644 index 0000000000000000000000000000000000000000..ec6bd387abf3b004ba7371feb2168e4734cdc819 --- /dev/null +++ b/examples/Makefile.in @@ -0,0 +1,1058 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 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@ + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +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@ +noinst_PROGRAMS = $(am__EXEEXT_5) $(am__append_5) +check_PROGRAMS = $(am__EXEEXT_4) +EXTRA_PROGRAMS = cdi_append$(EXEEXT) cdi_copy$(EXEEXT) \ + cdi_read$(EXEEXT) cdi_write$(EXEEXT) cdi_write_ens$(EXEEXT) \ + cdi_write_hybrid$(EXEEXT) cdi_write_local$(EXEEXT) \ + cdi_write_relativ$(EXEEXT) +@ENABLE_NETCDF_TRUE@am__append_1 = cdi_write_const +@ENABLE_ISOC_INTERFACE_TRUE@am__append_2 = cdi_read_f2003 cdi_write_f2003 +@with_on_demand_check_programs_TRUE@am__append_3 = $(test_PROGRAMS_) +@with_on_demand_check_programs_FALSE@am__append_4 = $(test_PROGRAMS_) +@with_example_programs_TRUE@am__append_5 = $(EXTRA_PROGRAMS) +@with_example_programs_FALSE@am__append_6 = $(EXTRA_PROGRAMS) +@ENABLE_ISOC_INTERFACE_TRUE@am__append_7 = $(FC_MOD_FLAG)$(top_builddir)/src +@ENABLE_ALL_STATIC_TRUE@am__append_8 = -all-static +subdir = examples +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = \ + $(top_srcdir)/m4/acx_assert_lang_is_fortran_variant.m4 \ + $(top_srcdir)/m4/acx_c_package.m4 \ + $(top_srcdir)/m4/acx_cfortran_flags.m4 \ + $(top_srcdir)/m4/acx_check_cfortran.m4 \ + $(top_srcdir)/m4/acx_check_strptr_convert.m4 \ + $(top_srcdir)/m4/acx_execinfo.m4 \ + $(top_srcdir)/m4/acx_fortran_check_include.m4 \ + $(top_srcdir)/m4/acx_fortran_include_flag.m4 \ + $(top_srcdir)/m4/acx_fortran_package.m4 \ + $(top_srcdir)/m4/acx_lang_check_include.m4 \ + $(top_srcdir)/m4/acx_lang_package.m4 \ + $(top_srcdir)/m4/acx_lt_problems.m4 \ + $(top_srcdir)/m4/acx_m4_list_to_quoted_strings.m4 \ + $(top_srcdir)/m4/acx_mpirun.m4 $(top_srcdir)/m4/acx_mv_obj.m4 \ + $(top_srcdir)/m4/acx_option_search_libs.m4 \ + $(top_srcdir)/m4/acx_options.m4 \ + $(top_srcdir)/m4/acx_prog_cc_posix.m4 \ + $(top_srcdir)/m4/acx_sl_fc_mod_path_flag.m4 \ + $(top_srcdir)/m4/acx_sl_mod_suffix.m4 \ + $(top_srcdir)/m4/acx_tls_xlc_retry.m4 \ + $(top_srcdir)/m4/acx_use_libtool_configuration.m4 \ + $(top_srcdir)/m4/acx_uuid.m4 $(top_srcdir)/m4/asx_tr_arg.m4 \ + $(top_srcdir)/m4/asx_unset.m4 $(top_srcdir)/m4/ax_pthread.m4 \ + $(top_srcdir)/m4/ax_python_devel.m4 $(top_srcdir)/m4/ax_tls.m4 \ + $(top_srcdir)/m4/kpse_libtool.m4 $(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/pkg.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/m4/ac_lang_program_fortran.m4 \ + $(top_srcdir)/m4/acx_lang_fortran_check_include.m4 \ + $(top_srcdir)/m4/acx_lang_c_check_include.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/src/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +@ENABLE_NETCDF_TRUE@am__EXEEXT_1 = cdi_write_const$(EXEEXT) +@ENABLE_ISOC_INTERFACE_TRUE@am__EXEEXT_2 = cdi_read_f2003$(EXEEXT) \ +@ENABLE_ISOC_INTERFACE_TRUE@ cdi_write_f2003$(EXEEXT) +am__EXEEXT_3 = $(am__EXEEXT_1) $(am__EXEEXT_2) +@with_on_demand_check_programs_TRUE@am__EXEEXT_4 = $(am__EXEEXT_3) +@with_on_demand_check_programs_FALSE@am__EXEEXT_5 = $(am__EXEEXT_3) +PROGRAMS = $(noinst_PROGRAMS) +am_cdi_append_OBJECTS = cdi_append.$(OBJEXT) +cdi_append_OBJECTS = $(am_cdi_append_OBJECTS) +cdi_append_LDADD = $(LDADD) +cdi_append_DEPENDENCIES = $(top_builddir)/src/libcdi.la +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_cdi_copy_OBJECTS = cdi_copy.$(OBJEXT) +cdi_copy_OBJECTS = $(am_cdi_copy_OBJECTS) +cdi_copy_LDADD = $(LDADD) +cdi_copy_DEPENDENCIES = $(top_builddir)/src/libcdi.la +am_cdi_read_OBJECTS = cdi_read.$(OBJEXT) +cdi_read_OBJECTS = $(am_cdi_read_OBJECTS) +cdi_read_LDADD = $(LDADD) +cdi_read_DEPENDENCIES = $(top_builddir)/src/libcdi.la +am_cdi_read_f2003_OBJECTS = cdi_read_f2003.$(OBJEXT) +cdi_read_f2003_OBJECTS = $(am_cdi_read_f2003_OBJECTS) +cdi_read_f2003_DEPENDENCIES = $(top_builddir)/src/libcdi_f2003.la \ + $(LDADD) +am_cdi_write_OBJECTS = cdi_write.$(OBJEXT) +cdi_write_OBJECTS = $(am_cdi_write_OBJECTS) +cdi_write_LDADD = $(LDADD) +cdi_write_DEPENDENCIES = $(top_builddir)/src/libcdi.la +am_cdi_write_const_OBJECTS = cdi_write_const.$(OBJEXT) +cdi_write_const_OBJECTS = $(am_cdi_write_const_OBJECTS) +cdi_write_const_LDADD = $(LDADD) +cdi_write_const_DEPENDENCIES = $(top_builddir)/src/libcdi.la +am_cdi_write_ens_OBJECTS = cdi_write_ens.$(OBJEXT) +cdi_write_ens_OBJECTS = $(am_cdi_write_ens_OBJECTS) +cdi_write_ens_LDADD = $(LDADD) +cdi_write_ens_DEPENDENCIES = $(top_builddir)/src/libcdi.la +am_cdi_write_f2003_OBJECTS = cdi_write_f2003.$(OBJEXT) +cdi_write_f2003_OBJECTS = $(am_cdi_write_f2003_OBJECTS) +cdi_write_f2003_DEPENDENCIES = $(top_builddir)/src/libcdi_f2003.la \ + $(LDADD) +am_cdi_write_hybrid_OBJECTS = cdi_write_hybrid.$(OBJEXT) +cdi_write_hybrid_OBJECTS = $(am_cdi_write_hybrid_OBJECTS) +cdi_write_hybrid_LDADD = $(LDADD) +cdi_write_hybrid_DEPENDENCIES = $(top_builddir)/src/libcdi.la +am_cdi_write_local_OBJECTS = cdi_write_local.$(OBJEXT) +cdi_write_local_OBJECTS = $(am_cdi_write_local_OBJECTS) +cdi_write_local_LDADD = $(LDADD) +cdi_write_local_DEPENDENCIES = $(top_builddir)/src/libcdi.la +am_cdi_write_relativ_OBJECTS = cdi_write_relativ.$(OBJEXT) +cdi_write_relativ_OBJECTS = $(am_cdi_write_relativ_OBJECTS) +cdi_write_relativ_LDADD = $(LDADD) +cdi_write_relativ_DEPENDENCIES = $(top_builddir)/src/libcdi.la +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)/src +depcomp = $(SHELL) $(top_srcdir)/config/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/cdi_append.Po \ + ./$(DEPDIR)/cdi_copy.Po ./$(DEPDIR)/cdi_read.Po \ + ./$(DEPDIR)/cdi_write.Po ./$(DEPDIR)/cdi_write_const.Po \ + ./$(DEPDIR)/cdi_write_ens.Po ./$(DEPDIR)/cdi_write_hybrid.Po \ + ./$(DEPDIR)/cdi_write_local.Po \ + ./$(DEPDIR)/cdi_write_relativ.Po +am__mv = mv -f +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 = +LTFCCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=FC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) +AM_V_FC = $(am__v_FC_@AM_V@) +am__v_FC_ = $(am__v_FC_@AM_DEFAULT_V@) +am__v_FC_0 = @echo " FC " $@; +am__v_FC_1 = +FCLD = $(FC) +FCLINK = $(LIBTOOL) $(AM_V_lt) --tag=FC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(FCLD) $(AM_FCFLAGS) $(FCFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_FCLD = $(am__v_FCLD_@AM_V@) +am__v_FCLD_ = $(am__v_FCLD_@AM_DEFAULT_V@) +am__v_FCLD_0 = @echo " FCLD " $@; +am__v_FCLD_1 = +SOURCES = $(cdi_append_SOURCES) $(cdi_copy_SOURCES) \ + $(cdi_read_SOURCES) $(cdi_read_f2003_SOURCES) \ + $(cdi_write_SOURCES) $(cdi_write_const_SOURCES) \ + $(cdi_write_ens_SOURCES) $(cdi_write_f2003_SOURCES) \ + $(cdi_write_hybrid_SOURCES) $(cdi_write_local_SOURCES) \ + $(cdi_write_relativ_SOURCES) +DIST_SOURCES = $(cdi_append_SOURCES) $(cdi_copy_SOURCES) \ + $(cdi_read_SOURCES) $(cdi_read_f2003_SOURCES) \ + $(cdi_write_SOURCES) $(cdi_write_const_SOURCES) \ + $(cdi_write_ens_SOURCES) $(cdi_write_f2003_SOURCES) \ + $(cdi_write_hybrid_SOURCES) $(cdi_write_local_SOURCES) \ + $(cdi_write_relativ_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 distdir-am +am__extra_recursive_targets = examples-recursive +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)` +DIST_SUBDIRS = $(SUBDIRS) +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/config/depcomp \ + README +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@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DCE_UUIDROOT = @DCE_UUIDROOT@ +DCE_UUID_C_INCLUDE = @DCE_UUID_C_INCLUDE@ +DCE_UUID_C_LIB = @DCE_UUID_C_LIB@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECCODES_INCLUDE = @ECCODES_INCLUDE@ +ECCODES_LIBS = @ECCODES_LIBS@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ENABLE_ACROSS = @ENABLE_ACROSS@ +ENABLE_CDI_LIB = @ENABLE_CDI_LIB@ +ENABLE_CGRIBEX = @ENABLE_CGRIBEX@ +ENABLE_EXTRA = @ENABLE_EXTRA@ +ENABLE_GRIB = @ENABLE_GRIB@ +ENABLE_IEG = @ENABLE_IEG@ +ENABLE_MPI = @ENABLE_MPI@ +ENABLE_NC2 = @ENABLE_NC2@ +ENABLE_NC4 = @ENABLE_NC4@ +ENABLE_NC4HDF5 = @ENABLE_NC4HDF5@ +ENABLE_NC4SZLIB = @ENABLE_NC4SZLIB@ +ENABLE_NETCDF = @ENABLE_NETCDF@ +ENABLE_SERVICE = @ENABLE_SERVICE@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FC = @FC@ +FCFLAGS = @FCFLAGS@ +FCFLAGS_f90 = @FCFLAGS_f90@ +FCMODCASE = @FCMODCASE@ +FCMODEXT = @FCMODEXT@ +FC_DEFINE = @FC_DEFINE@ +FC_MOD_FLAG = @FC_MOD_FLAG@ +FC_OPTINC = @FC_OPTINC@ +FDB5_INCLUDE = @FDB5_INCLUDE@ +FDB5_LIBS = @FDB5_LIBS@ +FFLAGS = @FFLAGS@ +FGREP = @FGREP@ +GREP = @GREP@ +GRIB_API_INCLUDE = @GRIB_API_INCLUDE@ +GRIB_API_LIBS = @GRIB_API_LIBS@ +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@ +LIBRT = @LIBRT@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +MPIROOT = @MPIROOT@ +MPI_C_INCLUDE = @MPI_C_INCLUDE@ +MPI_C_LIB = @MPI_C_LIB@ +MPI_FC_LIB = @MPI_FC_LIB@ +MPI_FC_MOD = @MPI_FC_MOD@ +MPI_LAUNCH = @MPI_LAUNCH@ +NC_CONFIG = @NC_CONFIG@ +NETCDF_INCLUDE = @NETCDF_INCLUDE@ +NETCDF_LIBS = @NETCDF_LIBS@ +NETCDF_ROOT = @NETCDF_ROOT@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OPENMP_CFLAGS = @OPENMP_CFLAGS@ +OSSP_UUIDROOT = @OSSP_UUIDROOT@ +OSSP_UUID_C_INCLUDE = @OSSP_UUID_C_INCLUDE@ +OSSP_UUID_C_LIB = @OSSP_UUID_C_LIB@ +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@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PPM_CORE_C_INCLUDE = @PPM_CORE_C_INCLUDE@ +PPM_CORE_C_LIB = @PPM_CORE_C_LIB@ +PTHREAD_CC = @PTHREAD_CC@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +PYTHON = @PYTHON@ +PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ +PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ +PYTHON_LIBS = @PYTHON_LIBS@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PLATFORM_SITE_PKG = @PYTHON_PLATFORM_SITE_PKG@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +RUBY = @RUBY@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +SWIG = @SWIG@ +SYSTEM_TYPE = @SYSTEM_TYPE@ +SZLIB_INCLUDE = @SZLIB_INCLUDE@ +SZLIB_LIBS = @SZLIB_LIBS@ +THREADS_INCLUDE = @THREADS_INCLUDE@ +THREADS_LIBS = @THREADS_LIBS@ +UTIL_LINUX_UUIDROOT = @UTIL_LINUX_UUIDROOT@ +UTIL_LINUX_UUID_C_INCLUDE = @UTIL_LINUX_UUID_C_INCLUDE@ +UTIL_LINUX_UUID_C_LIB = @UTIL_LINUX_UUID_C_LIB@ +UUID_C_INCLUDE = @UUID_C_INCLUDE@ +UUID_C_LIB = @UUID_C_LIB@ +VERSION = @VERSION@ +YAXT_C_INCLUDE = @YAXT_C_INCLUDE@ +YAXT_C_LIB = @YAXT_C_LIB@ +YAXT_FC_LIB = @YAXT_FC_LIB@ +YAXT_FC_MOD = @YAXT_FC_MOD@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_F77 = @ac_ct_F77@ +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@ +ax_pthread_config = @ax_pthread_config@ +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@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ +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@ +SUBDIRS = pio +CLEANFILES = $(am__append_6) + +# Examples that are part of the test suite: +test_PROGRAMS_ = $(am__append_1) $(am__append_2) +AM_CPPFLAGS = -I$(top_srcdir)/src +AM_FCFLAGS = $(am__append_7) -static +AM_LDFLAGS = $(am__append_8) +LDADD = $(top_builddir)/src/libcdi.la +cdi_append_SOURCES = cdi_append.c +cdi_copy_SOURCES = cdi_copy.c +cdi_read_SOURCES = cdi_read.c +cdi_write_SOURCES = cdi_write.c +cdi_write_ens_SOURCES = cdi_write_ens.c +cdi_write_hybrid_SOURCES = cdi_write_hybrid.c +cdi_write_local_SOURCES = cdi_write_local.c +cdi_write_relativ_SOURCES = cdi_write_relativ.c +cdi_write_const_SOURCES = cdi_write_const.c +cdi_read_f2003_SOURCES = cdi_read_f2003.f90 +cdi_read_f2003_LDADD = $(top_builddir)/src/libcdi_f2003.la $(LDADD) +cdi_write_f2003_SOURCES = cdi_write_f2003.f90 +cdi_write_f2003_LDADD = $(top_builddir)/src/libcdi_f2003.la $(LDADD) +@FC_MOD_UPPERCASE_FALSE@mo_cdi_mod = mo_cdi.$(FCMODEXT) +@FC_MOD_UPPERCASE_TRUE@mo_cdi_mod = MO_CDI.$(FCMODEXT) + +# Compile programs using Libtool: +COMPILE = $(LTCOMPILE) +FCCOMPILE = $(LTFCCOMPILE) +PPFCCOMPILE = $(LTPPFCCOMPILE) +CXXCOMPILE = $(LTCXXCOMPILE) + +# Compile *.F90 without CPPFLAGS, which are normally meant for the C compiler +# and might not be compatible with the Fortran compiler: +LTPPFCCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=FC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) + + +# Avoid compiling twice by running Libtool with '-static' +# This is safe because all Libtool libraries in this directory are +# static-only and contain PIC objects: +AM_CFLAGS = -static +AM_CXXFLAGS = -static +all: all-recursive + +.SUFFIXES: +.SUFFIXES: .c .f90 .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.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 examples/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign examples/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__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(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 + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +cdi_append$(EXEEXT): $(cdi_append_OBJECTS) $(cdi_append_DEPENDENCIES) $(EXTRA_cdi_append_DEPENDENCIES) + @rm -f cdi_append$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(cdi_append_OBJECTS) $(cdi_append_LDADD) $(LIBS) + +cdi_copy$(EXEEXT): $(cdi_copy_OBJECTS) $(cdi_copy_DEPENDENCIES) $(EXTRA_cdi_copy_DEPENDENCIES) + @rm -f cdi_copy$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(cdi_copy_OBJECTS) $(cdi_copy_LDADD) $(LIBS) + +cdi_read$(EXEEXT): $(cdi_read_OBJECTS) $(cdi_read_DEPENDENCIES) $(EXTRA_cdi_read_DEPENDENCIES) + @rm -f cdi_read$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(cdi_read_OBJECTS) $(cdi_read_LDADD) $(LIBS) + +cdi_read_f2003$(EXEEXT): $(cdi_read_f2003_OBJECTS) $(cdi_read_f2003_DEPENDENCIES) $(EXTRA_cdi_read_f2003_DEPENDENCIES) + @rm -f cdi_read_f2003$(EXEEXT) + $(AM_V_FCLD)$(FCLINK) $(cdi_read_f2003_OBJECTS) $(cdi_read_f2003_LDADD) $(LIBS) + +cdi_write$(EXEEXT): $(cdi_write_OBJECTS) $(cdi_write_DEPENDENCIES) $(EXTRA_cdi_write_DEPENDENCIES) + @rm -f cdi_write$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(cdi_write_OBJECTS) $(cdi_write_LDADD) $(LIBS) + +cdi_write_const$(EXEEXT): $(cdi_write_const_OBJECTS) $(cdi_write_const_DEPENDENCIES) $(EXTRA_cdi_write_const_DEPENDENCIES) + @rm -f cdi_write_const$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(cdi_write_const_OBJECTS) $(cdi_write_const_LDADD) $(LIBS) + +cdi_write_ens$(EXEEXT): $(cdi_write_ens_OBJECTS) $(cdi_write_ens_DEPENDENCIES) $(EXTRA_cdi_write_ens_DEPENDENCIES) + @rm -f cdi_write_ens$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(cdi_write_ens_OBJECTS) $(cdi_write_ens_LDADD) $(LIBS) + +cdi_write_f2003$(EXEEXT): $(cdi_write_f2003_OBJECTS) $(cdi_write_f2003_DEPENDENCIES) $(EXTRA_cdi_write_f2003_DEPENDENCIES) + @rm -f cdi_write_f2003$(EXEEXT) + $(AM_V_FCLD)$(FCLINK) $(cdi_write_f2003_OBJECTS) $(cdi_write_f2003_LDADD) $(LIBS) + +cdi_write_hybrid$(EXEEXT): $(cdi_write_hybrid_OBJECTS) $(cdi_write_hybrid_DEPENDENCIES) $(EXTRA_cdi_write_hybrid_DEPENDENCIES) + @rm -f cdi_write_hybrid$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(cdi_write_hybrid_OBJECTS) $(cdi_write_hybrid_LDADD) $(LIBS) + +cdi_write_local$(EXEEXT): $(cdi_write_local_OBJECTS) $(cdi_write_local_DEPENDENCIES) $(EXTRA_cdi_write_local_DEPENDENCIES) + @rm -f cdi_write_local$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(cdi_write_local_OBJECTS) $(cdi_write_local_LDADD) $(LIBS) + +cdi_write_relativ$(EXEEXT): $(cdi_write_relativ_OBJECTS) $(cdi_write_relativ_DEPENDENCIES) $(EXTRA_cdi_write_relativ_DEPENDENCIES) + @rm -f cdi_write_relativ$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(cdi_write_relativ_OBJECTS) $(cdi_write_relativ_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdi_append.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdi_copy.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdi_read.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdi_write.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdi_write_const.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdi_write_ens.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdi_write_hybrid.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdi_write_local.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdi_write_relativ.Po@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.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 -o $@ $< + +.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 -o $@ `$(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 $@ $< + +.f90.o: + $(AM_V_FC)$(FCCOMPILE) -c -o $@ $(FCFLAGS_f90) $< + +.f90.obj: + $(AM_V_FC)$(FCCOMPILE) -c -o $@ $(FCFLAGS_f90) `$(CYGPATH_W) '$<'` + +.f90.lo: + $(AM_V_FC)$(LTFCCOMPILE) -c -o $@ $(FCFLAGS_f90) $< + +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" +examples-local: + +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: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) +check: check-recursive +all-am: Makefile $(PROGRAMS) +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: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-checkPROGRAMS clean-generic clean-libtool clean-local \ + clean-noinstPROGRAMS mostlyclean-am + +distclean: distclean-recursive + -rm -f ./$(DEPDIR)/cdi_append.Po + -rm -f ./$(DEPDIR)/cdi_copy.Po + -rm -f ./$(DEPDIR)/cdi_read.Po + -rm -f ./$(DEPDIR)/cdi_write.Po + -rm -f ./$(DEPDIR)/cdi_write_const.Po + -rm -f ./$(DEPDIR)/cdi_write_ens.Po + -rm -f ./$(DEPDIR)/cdi_write_hybrid.Po + -rm -f ./$(DEPDIR)/cdi_write_local.Po + -rm -f ./$(DEPDIR)/cdi_write_relativ.Po + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +examples: examples-recursive + +examples-am: examples-local + +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 ./$(DEPDIR)/cdi_append.Po + -rm -f ./$(DEPDIR)/cdi_copy.Po + -rm -f ./$(DEPDIR)/cdi_read.Po + -rm -f ./$(DEPDIR)/cdi_write.Po + -rm -f ./$(DEPDIR)/cdi_write_const.Po + -rm -f ./$(DEPDIR)/cdi_write_ens.Po + -rm -f ./$(DEPDIR)/cdi_write_hybrid.Po + -rm -f ./$(DEPDIR)/cdi_write_local.Po + -rm -f ./$(DEPDIR)/cdi_write_relativ.Po + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(am__recursive_targets) check-am install-am install-strip + +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ + am--depfiles check check-am clean clean-checkPROGRAMS \ + clean-generic clean-libtool clean-local clean-noinstPROGRAMS \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am examples-am examples-local 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-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ + uninstall-am + +.PRECIOUS: Makefile + +examples-local: $(test_PROGRAMS_) $(EXTRA_PROGRAMS) + +cdi_read_f2003.$(OBJEXT) cdi_write_f2003.$(OBJEXT): $(top_builddir)/src/$(mo_cdi_mod) + +clean-local: + -rm -f *.grb *.grb2 *.nc + -rm -rf *.dSYM + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/examples/pio/Makefile.in b/examples/pio/Makefile.in new file mode 100644 index 0000000000000000000000000000000000000000..4e805acd6fd03ab6ae2162849b43e6919fde554c --- /dev/null +++ b/examples/pio/Makefile.in @@ -0,0 +1,896 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 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@ + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +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@ +EXTRA_PROGRAMS = collectData$(EXEEXT) collectDataNStreams$(EXEEXT) \ + $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) +@ENABLE_MPI_TRUE@am__append_1 = \ +@ENABLE_MPI_TRUE@ collectData.parallel \ +@ENABLE_MPI_TRUE@ collectDataNStreams.parallel \ +@ENABLE_MPI_TRUE@ compareResourcesArray + +@BUILD_FC_PROGRAMS_TRUE@@ENABLE_CF_INTERFACE_TRUE@am__append_2 = collectData2003 +@BUILD_PIO_FC_PROGRAMS_TRUE@@ENABLE_CF_INTERFACE_TRUE@am__append_3 = collectData2003.parallel +@with_example_programs_TRUE@am__append_4 = $(EXTRA_PROGRAMS) +@with_example_programs_FALSE@am__append_5 = $(EXTRA_PROGRAMS) +@ENABLE_CF_INTERFACE_TRUE@am__append_6 = $(FC_OPTINC)$(top_builddir)/src $(FC_OPTINC)$(top_srcdir)/src +@ENABLE_ALL_STATIC_TRUE@am__append_7 = -all-static +subdir = examples/pio +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = \ + $(top_srcdir)/m4/acx_assert_lang_is_fortran_variant.m4 \ + $(top_srcdir)/m4/acx_c_package.m4 \ + $(top_srcdir)/m4/acx_cfortran_flags.m4 \ + $(top_srcdir)/m4/acx_check_cfortran.m4 \ + $(top_srcdir)/m4/acx_check_strptr_convert.m4 \ + $(top_srcdir)/m4/acx_execinfo.m4 \ + $(top_srcdir)/m4/acx_fortran_check_include.m4 \ + $(top_srcdir)/m4/acx_fortran_include_flag.m4 \ + $(top_srcdir)/m4/acx_fortran_package.m4 \ + $(top_srcdir)/m4/acx_lang_check_include.m4 \ + $(top_srcdir)/m4/acx_lang_package.m4 \ + $(top_srcdir)/m4/acx_lt_problems.m4 \ + $(top_srcdir)/m4/acx_m4_list_to_quoted_strings.m4 \ + $(top_srcdir)/m4/acx_mpirun.m4 $(top_srcdir)/m4/acx_mv_obj.m4 \ + $(top_srcdir)/m4/acx_option_search_libs.m4 \ + $(top_srcdir)/m4/acx_options.m4 \ + $(top_srcdir)/m4/acx_prog_cc_posix.m4 \ + $(top_srcdir)/m4/acx_sl_fc_mod_path_flag.m4 \ + $(top_srcdir)/m4/acx_sl_mod_suffix.m4 \ + $(top_srcdir)/m4/acx_tls_xlc_retry.m4 \ + $(top_srcdir)/m4/acx_use_libtool_configuration.m4 \ + $(top_srcdir)/m4/acx_uuid.m4 $(top_srcdir)/m4/asx_tr_arg.m4 \ + $(top_srcdir)/m4/asx_unset.m4 $(top_srcdir)/m4/ax_pthread.m4 \ + $(top_srcdir)/m4/ax_python_devel.m4 $(top_srcdir)/m4/ax_tls.m4 \ + $(top_srcdir)/m4/kpse_libtool.m4 $(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/pkg.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/m4/ac_lang_program_fortran.m4 \ + $(top_srcdir)/m4/acx_lang_fortran_check_include.m4 \ + $(top_srcdir)/m4/acx_lang_c_check_include.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/src/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +@ENABLE_MPI_TRUE@am__EXEEXT_1 = collectData.parallel$(EXEEXT) \ +@ENABLE_MPI_TRUE@ collectDataNStreams.parallel$(EXEEXT) \ +@ENABLE_MPI_TRUE@ compareResourcesArray$(EXEEXT) +@BUILD_FC_PROGRAMS_TRUE@@ENABLE_CF_INTERFACE_TRUE@am__EXEEXT_2 = collectData2003$(EXEEXT) +@BUILD_PIO_FC_PROGRAMS_TRUE@@ENABLE_CF_INTERFACE_TRUE@am__EXEEXT_3 = collectData2003.parallel$(EXEEXT) +PROGRAMS = $(noinst_PROGRAMS) +am_collectData_OBJECTS = collectData.$(OBJEXT) +collectData_OBJECTS = $(am_collectData_OBJECTS) +collectData_LDADD = $(LDADD) +collectData_DEPENDENCIES = $(top_builddir)/src/libcdi.la +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__objects_1 = collectData.parallel.$(OBJEXT) +nodist_collectData_parallel_OBJECTS = $(am__objects_1) +collectData_parallel_OBJECTS = $(nodist_collectData_parallel_OBJECTS) +am__DEPENDENCIES_1 = +collectData_parallel_DEPENDENCIES = $(top_builddir)/src/libcdipio.la \ + $(am__DEPENDENCIES_1) $(LDADD) +am_collectData2003_OBJECTS = collectData2003.$(OBJEXT) +collectData2003_OBJECTS = $(am_collectData2003_OBJECTS) +collectData2003_LDADD = $(LDADD) +collectData2003_DEPENDENCIES = $(top_builddir)/src/libcdi.la +am__objects_2 = collectData2003.parallel.$(OBJEXT) +nodist_collectData2003_parallel_OBJECTS = $(am__objects_2) +collectData2003_parallel_OBJECTS = \ + $(nodist_collectData2003_parallel_OBJECTS) +collectData2003_parallel_DEPENDENCIES = \ + $(top_builddir)/src/libcdipio.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(LDADD) +am_collectDataNStreams_OBJECTS = collectDataNStreams.$(OBJEXT) +collectDataNStreams_OBJECTS = $(am_collectDataNStreams_OBJECTS) +collectDataNStreams_LDADD = $(LDADD) +collectDataNStreams_DEPENDENCIES = $(top_builddir)/src/libcdi.la +am__objects_3 = collectDataNStreams.parallel.$(OBJEXT) +nodist_collectDataNStreams_parallel_OBJECTS = $(am__objects_3) +collectDataNStreams_parallel_OBJECTS = \ + $(nodist_collectDataNStreams_parallel_OBJECTS) +collectDataNStreams_parallel_DEPENDENCIES = \ + $(top_builddir)/src/libcdipio.la $(am__DEPENDENCIES_1) \ + $(LDADD) +am_compareResourcesArray_OBJECTS = compareResourcesArray.$(OBJEXT) +compareResourcesArray_OBJECTS = $(am_compareResourcesArray_OBJECTS) +compareResourcesArray_DEPENDENCIES = $(top_builddir)/src/libcdipio.la \ + $(am__DEPENDENCIES_1) $(LDADD) +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)/src +depcomp = $(SHELL) $(top_srcdir)/config/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/collectData.Po \ + ./$(DEPDIR)/collectData.parallel.Po \ + ./$(DEPDIR)/collectDataNStreams.Po \ + ./$(DEPDIR)/collectDataNStreams.parallel.Po \ + ./$(DEPDIR)/compareResourcesArray.Po +am__mv = mv -f +AM_V_PPFC = $(am__v_PPFC_@AM_V@) +am__v_PPFC_ = $(am__v_PPFC_@AM_DEFAULT_V@) +am__v_PPFC_0 = @echo " PPFC " $@; +am__v_PPFC_1 = +FCLD = $(FC) +FCLINK = $(LIBTOOL) $(AM_V_lt) --tag=FC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(FCLD) $(AM_FCFLAGS) $(FCFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_FCLD = $(am__v_FCLD_@AM_V@) +am__v_FCLD_ = $(am__v_FCLD_@AM_DEFAULT_V@) +am__v_FCLD_0 = @echo " FCLD " $@; +am__v_FCLD_1 = +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 = $(collectData_SOURCES) \ + $(nodist_collectData_parallel_SOURCES) \ + $(collectData2003_SOURCES) \ + $(nodist_collectData2003_parallel_SOURCES) \ + $(collectDataNStreams_SOURCES) \ + $(nodist_collectDataNStreams_parallel_SOURCES) \ + $(compareResourcesArray_SOURCES) +DIST_SOURCES = $(collectData_SOURCES) $(collectData2003_SOURCES) \ + $(collectDataNStreams_SOURCES) \ + $(compareResourcesArray_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__extra_recursive_targets = examples-recursive +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)` +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/config/depcomp +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@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DCE_UUIDROOT = @DCE_UUIDROOT@ +DCE_UUID_C_INCLUDE = @DCE_UUID_C_INCLUDE@ +DCE_UUID_C_LIB = @DCE_UUID_C_LIB@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECCODES_INCLUDE = @ECCODES_INCLUDE@ +ECCODES_LIBS = @ECCODES_LIBS@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ENABLE_ACROSS = @ENABLE_ACROSS@ +ENABLE_CDI_LIB = @ENABLE_CDI_LIB@ +ENABLE_CGRIBEX = @ENABLE_CGRIBEX@ +ENABLE_EXTRA = @ENABLE_EXTRA@ +ENABLE_GRIB = @ENABLE_GRIB@ +ENABLE_IEG = @ENABLE_IEG@ +ENABLE_MPI = @ENABLE_MPI@ +ENABLE_NC2 = @ENABLE_NC2@ +ENABLE_NC4 = @ENABLE_NC4@ +ENABLE_NC4HDF5 = @ENABLE_NC4HDF5@ +ENABLE_NC4SZLIB = @ENABLE_NC4SZLIB@ +ENABLE_NETCDF = @ENABLE_NETCDF@ +ENABLE_SERVICE = @ENABLE_SERVICE@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FC = @FC@ +FCFLAGS = @FCFLAGS@ +FCFLAGS_f90 = @FCFLAGS_f90@ +FCMODCASE = @FCMODCASE@ +FCMODEXT = @FCMODEXT@ +FC_DEFINE = @FC_DEFINE@ +FC_MOD_FLAG = @FC_MOD_FLAG@ +FC_OPTINC = @FC_OPTINC@ +FDB5_INCLUDE = @FDB5_INCLUDE@ +FDB5_LIBS = @FDB5_LIBS@ +FFLAGS = @FFLAGS@ +FGREP = @FGREP@ +GREP = @GREP@ +GRIB_API_INCLUDE = @GRIB_API_INCLUDE@ +GRIB_API_LIBS = @GRIB_API_LIBS@ +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@ +LIBRT = @LIBRT@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +MPIROOT = @MPIROOT@ +MPI_C_INCLUDE = @MPI_C_INCLUDE@ +MPI_C_LIB = @MPI_C_LIB@ +MPI_FC_LIB = @MPI_FC_LIB@ +MPI_FC_MOD = @MPI_FC_MOD@ +MPI_LAUNCH = @MPI_LAUNCH@ +NC_CONFIG = @NC_CONFIG@ +NETCDF_INCLUDE = @NETCDF_INCLUDE@ +NETCDF_LIBS = @NETCDF_LIBS@ +NETCDF_ROOT = @NETCDF_ROOT@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OPENMP_CFLAGS = @OPENMP_CFLAGS@ +OSSP_UUIDROOT = @OSSP_UUIDROOT@ +OSSP_UUID_C_INCLUDE = @OSSP_UUID_C_INCLUDE@ +OSSP_UUID_C_LIB = @OSSP_UUID_C_LIB@ +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@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PPM_CORE_C_INCLUDE = @PPM_CORE_C_INCLUDE@ +PPM_CORE_C_LIB = @PPM_CORE_C_LIB@ +PTHREAD_CC = @PTHREAD_CC@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +PYTHON = @PYTHON@ +PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ +PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ +PYTHON_LIBS = @PYTHON_LIBS@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PLATFORM_SITE_PKG = @PYTHON_PLATFORM_SITE_PKG@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +RUBY = @RUBY@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +SWIG = @SWIG@ +SYSTEM_TYPE = @SYSTEM_TYPE@ +SZLIB_INCLUDE = @SZLIB_INCLUDE@ +SZLIB_LIBS = @SZLIB_LIBS@ +THREADS_INCLUDE = @THREADS_INCLUDE@ +THREADS_LIBS = @THREADS_LIBS@ +UTIL_LINUX_UUIDROOT = @UTIL_LINUX_UUIDROOT@ +UTIL_LINUX_UUID_C_INCLUDE = @UTIL_LINUX_UUID_C_INCLUDE@ +UTIL_LINUX_UUID_C_LIB = @UTIL_LINUX_UUID_C_LIB@ +UUID_C_INCLUDE = @UUID_C_INCLUDE@ +UUID_C_LIB = @UUID_C_LIB@ +VERSION = @VERSION@ +YAXT_C_INCLUDE = @YAXT_C_INCLUDE@ +YAXT_C_LIB = @YAXT_C_LIB@ +YAXT_FC_LIB = @YAXT_FC_LIB@ +YAXT_FC_MOD = @YAXT_FC_MOD@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_F77 = @ac_ct_F77@ +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@ +ax_pthread_config = @ax_pthread_config@ +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@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ +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@ +noinst_PROGRAMS = $(am__append_4) +CLEANFILES = $(am__append_5) +AM_CPPFLAGS = -I$(top_srcdir)/src $(YAXT_C_INCLUDE) $(MPI_C_INCLUDE) +AM_FCFLAGS = $(am__append_6) $(YAXT_FC_MOD) $(MPI_FC_MOD) -static +AM_LDFLAGS = $(am__append_7) +LDADD = $(top_builddir)/src/libcdi.la +collectData_SOURCES = collectData.c +nodist_collectData_parallel_SOURCES = $(collectData_SOURCES:.c=.parallel.c) +collectData_parallel_LDADD = $(top_builddir)/src/libcdipio.la $(YAXT_C_LIB) $(LDADD) +collectDataNStreams_SOURCES = collectDataNStreams.c +nodist_collectDataNStreams_parallel_SOURCES = $(collectDataNStreams_SOURCES:.c=.parallel.c) +collectDataNStreams_parallel_LDADD = $(top_builddir)/src/libcdipio.la $(YAXT_C_LIB) $(LDADD) +compareResourcesArray_SOURCES = compareResourcesArray.c +compareResourcesArray_LDADD = $(top_builddir)/src/libcdipio.la $(YAXT_C_LIB) $(LDADD) +collectData2003_SOURCES = collectData2003.F90 +nodist_collectData2003_parallel_SOURCES = $(collectData2003_SOURCES:.F90=.parallel.F90) +collectData2003_parallel_LDADD = $(top_builddir)/src/libcdipio.la $(YAXT_FC_LIB) $(MPI_FC_LIB) $(LDADD) + +# Compile programs using Libtool: +COMPILE = $(LTCOMPILE) +FCCOMPILE = $(LTFCCOMPILE) +PPFCCOMPILE = $(LTPPFCCOMPILE) +CXXCOMPILE = $(LTCXXCOMPILE) + +# Compile *.F90 without CPPFLAGS, which are normally meant for the C compiler +# and might not be compatible with the Fortran compiler: +LTPPFCCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=FC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) + + +# Avoid compiling twice by running Libtool with '-static' +# This is safe because all Libtool libraries in this directory are +# static-only and contain PIC objects: +AM_CFLAGS = -static +AM_CXXFLAGS = -static + +# Generate source files for parallel versions of the programs. We do this to +# avoid target-specific flags, which result into rules that do not use the +# compilation commands above. +SUFFIXES = .parallel.c .parallel.F90 +all: all-am + +.SUFFIXES: +.SUFFIXES: .parallel.c .parallel.F90 .F90 .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.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 examples/pio/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign examples/pio/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__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(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-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +collectData$(EXEEXT): $(collectData_OBJECTS) $(collectData_DEPENDENCIES) $(EXTRA_collectData_DEPENDENCIES) + @rm -f collectData$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(collectData_OBJECTS) $(collectData_LDADD) $(LIBS) + +collectData.parallel$(EXEEXT): $(collectData_parallel_OBJECTS) $(collectData_parallel_DEPENDENCIES) $(EXTRA_collectData_parallel_DEPENDENCIES) + @rm -f collectData.parallel$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(collectData_parallel_OBJECTS) $(collectData_parallel_LDADD) $(LIBS) + +collectData2003$(EXEEXT): $(collectData2003_OBJECTS) $(collectData2003_DEPENDENCIES) $(EXTRA_collectData2003_DEPENDENCIES) + @rm -f collectData2003$(EXEEXT) + $(AM_V_FCLD)$(FCLINK) $(collectData2003_OBJECTS) $(collectData2003_LDADD) $(LIBS) + +collectData2003.parallel$(EXEEXT): $(collectData2003_parallel_OBJECTS) $(collectData2003_parallel_DEPENDENCIES) $(EXTRA_collectData2003_parallel_DEPENDENCIES) + @rm -f collectData2003.parallel$(EXEEXT) + $(AM_V_FCLD)$(FCLINK) $(collectData2003_parallel_OBJECTS) $(collectData2003_parallel_LDADD) $(LIBS) + +collectDataNStreams$(EXEEXT): $(collectDataNStreams_OBJECTS) $(collectDataNStreams_DEPENDENCIES) $(EXTRA_collectDataNStreams_DEPENDENCIES) + @rm -f collectDataNStreams$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(collectDataNStreams_OBJECTS) $(collectDataNStreams_LDADD) $(LIBS) + +collectDataNStreams.parallel$(EXEEXT): $(collectDataNStreams_parallel_OBJECTS) $(collectDataNStreams_parallel_DEPENDENCIES) $(EXTRA_collectDataNStreams_parallel_DEPENDENCIES) + @rm -f collectDataNStreams.parallel$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(collectDataNStreams_parallel_OBJECTS) $(collectDataNStreams_parallel_LDADD) $(LIBS) + +compareResourcesArray$(EXEEXT): $(compareResourcesArray_OBJECTS) $(compareResourcesArray_DEPENDENCIES) $(EXTRA_compareResourcesArray_DEPENDENCIES) + @rm -f compareResourcesArray$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(compareResourcesArray_OBJECTS) $(compareResourcesArray_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/collectData.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/collectData.parallel.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/collectDataNStreams.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/collectDataNStreams.parallel.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/compareResourcesArray.Po@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.F90.o: + $(AM_V_PPFC)$(PPFCCOMPILE) -c -o $@ $< + +.F90.obj: + $(AM_V_PPFC)$(PPFCCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.F90.lo: + $(AM_V_PPFC)$(LTPPFCCOMPILE) -c -o $@ $< + +.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 -o $@ $< + +.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 -o $@ `$(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 +examples-local: + +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: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(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 $(PROGRAMS) +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: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +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 clean-local clean-noinstPROGRAMS \ + mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/collectData.Po + -rm -f ./$(DEPDIR)/collectData.parallel.Po + -rm -f ./$(DEPDIR)/collectDataNStreams.Po + -rm -f ./$(DEPDIR)/collectDataNStreams.parallel.Po + -rm -f ./$(DEPDIR)/compareResourcesArray.Po + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +examples: examples-am + +examples-am: examples-local + +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 ./$(DEPDIR)/collectData.Po + -rm -f ./$(DEPDIR)/collectData.parallel.Po + -rm -f ./$(DEPDIR)/collectDataNStreams.Po + -rm -f ./$(DEPDIR)/collectDataNStreams.parallel.Po + -rm -f ./$(DEPDIR)/compareResourcesArray.Po + -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: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-generic clean-libtool clean-local clean-noinstPROGRAMS \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am examples-am examples-local 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 + +.PRECIOUS: Makefile + +examples-local: $(EXTRA_PROGRAMS) + +clean-local: + -rm -f *.parallel.c *.parallel.F90 + -rm -f *.grb + -rm -rf *.dSYM + +.c.parallel.c: + $(AM_V_GEN):;{ \ + echo '#define USE_MPI 1'; \ + echo '#include "$<"'; \ + } >$@ + +.F90.parallel.F90: + $(AM_V_GEN):;{ \ + echo '#define USE_MPI 1'; \ + echo '#include "$<"'; \ + } >$@ + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/interfaces/Makefile.in b/interfaces/Makefile.in new file mode 100644 index 0000000000000000000000000000000000000000..84464c8eaa414d66242fecce4f23b471ca335f5a --- /dev/null +++ b/interfaces/Makefile.in @@ -0,0 +1,1429 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 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@ + + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +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@ +@ENABLE_RUBY_INTERFACE_TRUE@am__append_1 = ruby-binding +@ENABLE_RUBY_INTERFACE_TRUE@am__append_2 = ruby-install +@ENABLE_RUBY_INTERFACE_TRUE@am__append_3 = ruby-uninstall +# We call with distclean to remove the generated ruby/Makefile, which is +# generated by this makefile, and should, therefore, be deleted with +# 'make clean': +@ENABLE_RUBY_INTERFACE_TRUE@am__append_4 = ruby-clean +@ENABLE_PYTHON_INTERFACE_FALSE@@ENABLE_RUBY_INTERFACE_TRUE@@with_on_demand_check_programs_TRUE@check_PROGRAMS = $(am__EXEEXT_1) +@ENABLE_PYTHON_INTERFACE_TRUE@@with_on_demand_check_programs_TRUE@check_PROGRAMS = $(am__EXEEXT_1) +@ENABLE_PYTHON_INTERFACE_FALSE@@ENABLE_RUBY_INTERFACE_TRUE@@with_on_demand_check_programs_FALSE@noinst_PROGRAMS = $(am__EXEEXT_1) +@ENABLE_PYTHON_INTERFACE_TRUE@@with_on_demand_check_programs_FALSE@noinst_PROGRAMS = $(am__EXEEXT_1) +subdir = interfaces +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = \ + $(top_srcdir)/m4/acx_assert_lang_is_fortran_variant.m4 \ + $(top_srcdir)/m4/acx_c_package.m4 \ + $(top_srcdir)/m4/acx_cfortran_flags.m4 \ + $(top_srcdir)/m4/acx_check_cfortran.m4 \ + $(top_srcdir)/m4/acx_check_strptr_convert.m4 \ + $(top_srcdir)/m4/acx_execinfo.m4 \ + $(top_srcdir)/m4/acx_fortran_check_include.m4 \ + $(top_srcdir)/m4/acx_fortran_include_flag.m4 \ + $(top_srcdir)/m4/acx_fortran_package.m4 \ + $(top_srcdir)/m4/acx_lang_check_include.m4 \ + $(top_srcdir)/m4/acx_lang_package.m4 \ + $(top_srcdir)/m4/acx_lt_problems.m4 \ + $(top_srcdir)/m4/acx_m4_list_to_quoted_strings.m4 \ + $(top_srcdir)/m4/acx_mpirun.m4 $(top_srcdir)/m4/acx_mv_obj.m4 \ + $(top_srcdir)/m4/acx_option_search_libs.m4 \ + $(top_srcdir)/m4/acx_options.m4 \ + $(top_srcdir)/m4/acx_prog_cc_posix.m4 \ + $(top_srcdir)/m4/acx_sl_fc_mod_path_flag.m4 \ + $(top_srcdir)/m4/acx_sl_mod_suffix.m4 \ + $(top_srcdir)/m4/acx_tls_xlc_retry.m4 \ + $(top_srcdir)/m4/acx_use_libtool_configuration.m4 \ + $(top_srcdir)/m4/acx_uuid.m4 $(top_srcdir)/m4/asx_tr_arg.m4 \ + $(top_srcdir)/m4/asx_unset.m4 $(top_srcdir)/m4/ax_pthread.m4 \ + $(top_srcdir)/m4/ax_python_devel.m4 $(top_srcdir)/m4/ax_tls.m4 \ + $(top_srcdir)/m4/kpse_libtool.m4 $(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/pkg.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/m4/ac_lang_program_fortran.m4 \ + $(top_srcdir)/m4/acx_lang_fortran_check_include.m4 \ + $(top_srcdir)/m4/acx_lang_c_check_include.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__python_PYTHON_DIST) \ + $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/src/config.h +CONFIG_CLEAN_FILES = test_cpp_nc.run test_python_grb.run \ + test_python_nc.run test_ruby_grb.run test_ruby_nc.run +CONFIG_CLEAN_VPATH_FILES = +am__EXEEXT_1 = CdiInfo$(EXEEXT) +PROGRAMS = $(noinst_PROGRAMS) +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)$(pyexecdir)" "$(DESTDIR)$(pythondir)" +LTLIBRARIES = $(pyexec_LTLIBRARIES) +libcdipp_la_DEPENDENCIES = $(top_builddir)/src/libcdi.la +am_libcdipp_la_OBJECTS = cdi.lo +libcdipp_la_OBJECTS = $(am_libcdipp_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__DEPENDENCIES_1 = +@ENABLE_PYTHON_INTERFACE_TRUE@python__Cdi_la_DEPENDENCIES = \ +@ENABLE_PYTHON_INTERFACE_TRUE@ libcdipp.la \ +@ENABLE_PYTHON_INTERFACE_TRUE@ $(am__DEPENDENCIES_1) +am__python__Cdi_la_SOURCES_DIST = python/cdi_wrapper.cpp +am__dirstamp = $(am__leading_dot)dirstamp +@ENABLE_PYTHON_INTERFACE_TRUE@am_python__Cdi_la_OBJECTS = \ +@ENABLE_PYTHON_INTERFACE_TRUE@ python/_Cdi_la-cdi_wrapper.lo +python__Cdi_la_OBJECTS = $(am_python__Cdi_la_OBJECTS) +python__Cdi_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ + $(python__Cdi_la_CXXFLAGS) $(CXXFLAGS) \ + $(python__Cdi_la_LDFLAGS) $(LDFLAGS) -o $@ +@ENABLE_PYTHON_INTERFACE_TRUE@am_python__Cdi_la_rpath = -rpath \ +@ENABLE_PYTHON_INTERFACE_TRUE@ $(pyexecdir) +am_CdiInfo_OBJECTS = CdiInfo.$(OBJEXT) +CdiInfo_OBJECTS = $(am_CdiInfo_OBJECTS) +CdiInfo_DEPENDENCIES = libcdipp.la +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)/src +depcomp = $(SHELL) $(top_srcdir)/config/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/CdiInfo.Po ./$(DEPDIR)/cdi.Plo \ + python/$(DEPDIR)/_Cdi_la-cdi_wrapper.Plo +am__mv = mv -f +LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) +AM_V_CXX = $(am__v_CXX_@AM_V@) +am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) +am__v_CXX_0 = @echo " CXX " $@; +am__v_CXX_1 = +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ + $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) +am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) +am__v_CXXLD_0 = @echo " CXXLD " $@; +am__v_CXXLD_1 = +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 = $(libcdipp_la_SOURCES) $(python__Cdi_la_SOURCES) \ + $(CdiInfo_SOURCES) +DIST_SOURCES = $(libcdipp_la_SOURCES) \ + $(am__python__Cdi_la_SOURCES_DIST) $(CdiInfo_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__python_PYTHON_DIST = python/Cdi.py +am__py_compile = PYTHON=$(PYTHON) $(SHELL) $(py_compile) +am__pep3147_tweak = \ + sed -e 's|\.py$$||' -e 's|[^/]*$$|__pycache__/&.*.pyc __pycache__/&.*.pyo|' +py_compile = $(top_srcdir)/config/py-compile +am__extra_recursive_targets = examples-recursive +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)` +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='[0;31m'; \ + grn='[0;32m'; \ + lgn='[1;32m'; \ + blu='[1;34m'; \ + mgn='[0;35m'; \ + brg='[1m'; \ + std='[m'; \ + fi; \ +} +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 +am__test_logs1 = $(TESTS:=.log) +am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) +TEST_LOGS = $(am__test_logs2:.run.log=.log) +RUN_LOG_DRIVER = $(SHELL) $(top_srcdir)/config/test-driver +RUN_LOG_COMPILE = $(RUN_LOG_COMPILER) $(AM_RUN_LOG_FLAGS) \ + $(RUN_LOG_FLAGS) +am__set_b = \ + case '$@' in \ + */*) \ + case '$*' in \ + */*) b='$*';; \ + *) b=`echo '$@' | sed 's/\.log$$//'`; \ + esac;; \ + *) \ + b='$*';; \ + esac +am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/test_cpp_nc.run.in \ + $(srcdir)/test_python_grb.run.in \ + $(srcdir)/test_python_nc.run.in $(srcdir)/test_ruby_grb.run.in \ + $(srcdir)/test_ruby_nc.run.in $(top_srcdir)/config/depcomp \ + $(top_srcdir)/config/py-compile \ + $(top_srcdir)/config/test-driver +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@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DCE_UUIDROOT = @DCE_UUIDROOT@ +DCE_UUID_C_INCLUDE = @DCE_UUID_C_INCLUDE@ +DCE_UUID_C_LIB = @DCE_UUID_C_LIB@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECCODES_INCLUDE = @ECCODES_INCLUDE@ +ECCODES_LIBS = @ECCODES_LIBS@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ENABLE_ACROSS = @ENABLE_ACROSS@ +ENABLE_CDI_LIB = @ENABLE_CDI_LIB@ +ENABLE_CGRIBEX = @ENABLE_CGRIBEX@ +ENABLE_EXTRA = @ENABLE_EXTRA@ +ENABLE_GRIB = @ENABLE_GRIB@ +ENABLE_IEG = @ENABLE_IEG@ +ENABLE_MPI = @ENABLE_MPI@ +ENABLE_NC2 = @ENABLE_NC2@ +ENABLE_NC4 = @ENABLE_NC4@ +ENABLE_NC4HDF5 = @ENABLE_NC4HDF5@ +ENABLE_NC4SZLIB = @ENABLE_NC4SZLIB@ +ENABLE_NETCDF = @ENABLE_NETCDF@ +ENABLE_SERVICE = @ENABLE_SERVICE@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FC = @FC@ +FCFLAGS = @FCFLAGS@ +FCFLAGS_f90 = @FCFLAGS_f90@ +FCMODCASE = @FCMODCASE@ +FCMODEXT = @FCMODEXT@ +FC_DEFINE = @FC_DEFINE@ +FC_MOD_FLAG = @FC_MOD_FLAG@ +FC_OPTINC = @FC_OPTINC@ +FDB5_INCLUDE = @FDB5_INCLUDE@ +FDB5_LIBS = @FDB5_LIBS@ +FFLAGS = @FFLAGS@ +FGREP = @FGREP@ +GREP = @GREP@ +GRIB_API_INCLUDE = @GRIB_API_INCLUDE@ +GRIB_API_LIBS = @GRIB_API_LIBS@ +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@ +LIBRT = @LIBRT@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +MPIROOT = @MPIROOT@ +MPI_C_INCLUDE = @MPI_C_INCLUDE@ +MPI_C_LIB = @MPI_C_LIB@ +MPI_FC_LIB = @MPI_FC_LIB@ +MPI_FC_MOD = @MPI_FC_MOD@ +MPI_LAUNCH = @MPI_LAUNCH@ +NC_CONFIG = @NC_CONFIG@ +NETCDF_INCLUDE = @NETCDF_INCLUDE@ +NETCDF_LIBS = @NETCDF_LIBS@ +NETCDF_ROOT = @NETCDF_ROOT@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OPENMP_CFLAGS = @OPENMP_CFLAGS@ +OSSP_UUIDROOT = @OSSP_UUIDROOT@ +OSSP_UUID_C_INCLUDE = @OSSP_UUID_C_INCLUDE@ +OSSP_UUID_C_LIB = @OSSP_UUID_C_LIB@ +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@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PPM_CORE_C_INCLUDE = @PPM_CORE_C_INCLUDE@ +PPM_CORE_C_LIB = @PPM_CORE_C_LIB@ +PTHREAD_CC = @PTHREAD_CC@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +PYTHON = @PYTHON@ +PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ +PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ +PYTHON_LIBS = @PYTHON_LIBS@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PLATFORM_SITE_PKG = @PYTHON_PLATFORM_SITE_PKG@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +RUBY = @RUBY@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +SWIG = @SWIG@ +SYSTEM_TYPE = @SYSTEM_TYPE@ +SZLIB_INCLUDE = @SZLIB_INCLUDE@ +SZLIB_LIBS = @SZLIB_LIBS@ +THREADS_INCLUDE = @THREADS_INCLUDE@ +THREADS_LIBS = @THREADS_LIBS@ +UTIL_LINUX_UUIDROOT = @UTIL_LINUX_UUIDROOT@ +UTIL_LINUX_UUID_C_INCLUDE = @UTIL_LINUX_UUID_C_INCLUDE@ +UTIL_LINUX_UUID_C_LIB = @UTIL_LINUX_UUID_C_LIB@ +UUID_C_INCLUDE = @UUID_C_INCLUDE@ +UUID_C_LIB = @UUID_C_LIB@ +VERSION = @VERSION@ +YAXT_C_INCLUDE = @YAXT_C_INCLUDE@ +YAXT_C_LIB = @YAXT_C_LIB@ +YAXT_FC_LIB = @YAXT_FC_LIB@ +YAXT_FC_MOD = @YAXT_FC_MOD@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_F77 = @ac_ct_F77@ +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@ +ax_pthread_config = @ax_pthread_config@ +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@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ +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@ +EXTRA_LTLIBRARIES = libcdipp.la +libcdipp_la_SOURCES = cdi.cpp cdi.hpp +libcdipp_la_LIBADD = $(top_builddir)/src/libcdi.la +test_PROGRAMS_ = CdiInfo +CdiInfo_SOURCES = CdiInfo.cpp +CdiInfo_LDADD = libcdipp.la +AM_CPPFLAGS = -I$(abs_top_srcdir)/src +all_local = $(am__append_1) +install_exec_local = $(am__append_2) +uninstall_local = $(am__append_3) +clean_local = $(am__append_4) +@ENABLE_RUBY_INTERFACE_TRUE@V_MAKERUBY = $(v_MAKERUBY_@AM_V@) +@ENABLE_RUBY_INTERFACE_TRUE@v_MAKERUBY_ = $(v_MAKERUBY_@AM_DEFAULT_V@) +@ENABLE_RUBY_INTERFACE_TRUE@v_MAKERUBY_0 = 0 +@ENABLE_RUBY_INTERFACE_TRUE@v_MAKERUBY_1 = 1 +AUTOMAKE_OPTIONS = subdir-objects +@ENABLE_PYTHON_INTERFACE_TRUE@python_PYTHON = python/Cdi.py +@ENABLE_PYTHON_INTERFACE_TRUE@pyexec_LTLIBRARIES = python/_Cdi.la +@ENABLE_PYTHON_INTERFACE_TRUE@python__Cdi_la_SOURCES = python/cdi_wrapper.cpp +@ENABLE_PYTHON_INTERFACE_TRUE@python__Cdi_la_CPPFLAGS = $(AM_CPPFLAGS) $(PYTHON_CPPFLAGS) +@ENABLE_PYTHON_INTERFACE_TRUE@python__Cdi_la_CXXFLAGS = $(AM_CXXFLAGS) -shared +@ENABLE_PYTHON_INTERFACE_TRUE@python__Cdi_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version +@ENABLE_PYTHON_INTERFACE_TRUE@python__Cdi_la_LIBADD = libcdipp.la $(PYTHON_LIBS) +AM_TESTSUITE_SUMMARY_HEADER = ' for Ruby and Python interfaces of $(PACKAGE_STRING)' +TEST_EXTENSIONS = .run +TESTS = \ + test_cpp_nc.run \ + test_python_grb.run \ + test_python_nc.run \ + test_ruby_grb.run \ + test_ruby_nc.run + +MOSTLYCLEANFILES = $(EXTRA_LTLIBRARIES) +MAINTAINERCLEANFILES = \ + python/Cdi.py \ + python/cdi_wrapper.cpp \ + ruby/cdi_wrapper.cpp + +EXTRA_DIST = \ + cdi.i \ + f2003/bindGen.rb \ + python/test.py \ + ruby/cdi_wrapper.cpp \ + ruby/setup.rb \ + ruby/test.rb \ + testdata/mulval.grb \ + testdata/mulval.nc + + +# Compile programs using Libtool: +COMPILE = $(LTCOMPILE) +FCCOMPILE = $(LTFCCOMPILE) +PPFCCOMPILE = $(LTPPFCCOMPILE) +CXXCOMPILE = $(LTCXXCOMPILE) + +# Compile *.F90 without CPPFLAGS, which are normally meant for the C compiler +# and might not be compatible with the Fortran compiler: +LTPPFCCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=FC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) + +all: all-am + +.SUFFIXES: +.SUFFIXES: .cpp .lo .log .o .obj .run .run$(EXEEXT) .trs +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.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 interfaces/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign interfaces/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__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(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): +test_cpp_nc.run: $(top_builddir)/config.status $(srcdir)/test_cpp_nc.run.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +test_python_grb.run: $(top_builddir)/config.status $(srcdir)/test_python_grb.run.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +test_python_nc.run: $(top_builddir)/config.status $(srcdir)/test_python_nc.run.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +test_ruby_grb.run: $(top_builddir)/config.status $(srcdir)/test_ruby_grb.run.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +test_ruby_nc.run: $(top_builddir)/config.status $(srcdir)/test_ruby_nc.run.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ + +clean-checkPROGRAMS: + @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +install-pyexecLTLIBRARIES: $(pyexec_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(pyexec_LTLIBRARIES)'; test -n "$(pyexecdir)" || 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)$(pyexecdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(pyexecdir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pyexecdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pyexecdir)"; \ + } + +uninstall-pyexecLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(pyexec_LTLIBRARIES)'; test -n "$(pyexecdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pyexecdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pyexecdir)/$$f"; \ + done + +clean-pyexecLTLIBRARIES: + -test -z "$(pyexec_LTLIBRARIES)" || rm -f $(pyexec_LTLIBRARIES) + @list='$(pyexec_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}; \ + } + +libcdipp.la: $(libcdipp_la_OBJECTS) $(libcdipp_la_DEPENDENCIES) $(EXTRA_libcdipp_la_DEPENDENCIES) + $(AM_V_CXXLD)$(CXXLINK) $(libcdipp_la_OBJECTS) $(libcdipp_la_LIBADD) $(LIBS) +python/$(am__dirstamp): + @$(MKDIR_P) python + @: > python/$(am__dirstamp) +python/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) python/$(DEPDIR) + @: > python/$(DEPDIR)/$(am__dirstamp) +python/_Cdi_la-cdi_wrapper.lo: python/$(am__dirstamp) \ + python/$(DEPDIR)/$(am__dirstamp) + +python/_Cdi.la: $(python__Cdi_la_OBJECTS) $(python__Cdi_la_DEPENDENCIES) $(EXTRA_python__Cdi_la_DEPENDENCIES) python/$(am__dirstamp) + $(AM_V_CXXLD)$(python__Cdi_la_LINK) $(am_python__Cdi_la_rpath) $(python__Cdi_la_OBJECTS) $(python__Cdi_la_LIBADD) $(LIBS) + +CdiInfo$(EXEEXT): $(CdiInfo_OBJECTS) $(CdiInfo_DEPENDENCIES) $(EXTRA_CdiInfo_DEPENDENCIES) + @rm -f CdiInfo$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(CdiInfo_OBJECTS) $(CdiInfo_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + -rm -f python/*.$(OBJEXT) + -rm -f python/*.lo + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CdiInfo.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdi.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@python/$(DEPDIR)/_Cdi_la-cdi_wrapper.Plo@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.cpp.o: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< + +.cpp.obj: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.cpp.lo: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ +@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $< + +python/_Cdi_la-cdi_wrapper.lo: python/cdi_wrapper.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(python__Cdi_la_CPPFLAGS) $(CPPFLAGS) $(python__Cdi_la_CXXFLAGS) $(CXXFLAGS) -MT python/_Cdi_la-cdi_wrapper.lo -MD -MP -MF python/$(DEPDIR)/_Cdi_la-cdi_wrapper.Tpo -c -o python/_Cdi_la-cdi_wrapper.lo `test -f 'python/cdi_wrapper.cpp' || echo '$(srcdir)/'`python/cdi_wrapper.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) python/$(DEPDIR)/_Cdi_la-cdi_wrapper.Tpo python/$(DEPDIR)/_Cdi_la-cdi_wrapper.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='python/cdi_wrapper.cpp' object='python/_Cdi_la-cdi_wrapper.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(python__Cdi_la_CPPFLAGS) $(CPPFLAGS) $(python__Cdi_la_CXXFLAGS) $(CXXFLAGS) -c -o python/_Cdi_la-cdi_wrapper.lo `test -f 'python/cdi_wrapper.cpp' || echo '$(srcdir)/'`python/cdi_wrapper.cpp + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + -rm -rf python/.libs python/_libs +install-pythonPYTHON: $(python_PYTHON) + @$(NORMAL_INSTALL) + @list='$(python_PYTHON)'; dlist=; list2=; test -n "$(pythondir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(pythondir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(pythondir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then b=; else b="$(srcdir)/"; fi; \ + if test -f $$b$$p; then \ + $(am__strip_dir) \ + dlist="$$dlist $$f"; \ + list2="$$list2 $$b$$p"; \ + else :; fi; \ + done; \ + for file in $$list2; do echo $$file; done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pythondir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(pythondir)" || exit $$?; \ + done || exit $$?; \ + if test -n "$$dlist"; then \ + $(am__py_compile) --destdir "$(DESTDIR)" \ + --basedir "$(pythondir)" $$dlist; \ + else :; fi + +uninstall-pythonPYTHON: + @$(NORMAL_UNINSTALL) + @list='$(python_PYTHON)'; test -n "$(pythondir)" || list=; \ + py_files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$py_files" || exit 0; \ + dir='$(DESTDIR)$(pythondir)'; \ + pyc_files=`echo "$$py_files" | sed 's|$$|c|'`; \ + pyo_files=`echo "$$py_files" | sed 's|$$|o|'`; \ + st=0; \ + for files in "$$py_files" "$$pyc_files" "$$pyo_files"; do \ + $(am__uninstall_files_from_dir) || st=$$?; \ + done; \ + dir='$(DESTDIR)$(pythondir)'; \ + echo "$$py_files" | $(am__pep3147_tweak) | $(am__base_list) | \ + while read files; do \ + $(am__uninstall_files_from_dir) || st=$$?; \ + done || exit $$?; \ + exit $$st +examples-local: + +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; \ + elif test -n "$$redo_logs"; then \ + 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"$(AM_TESTSUITE_SUMMARY_HEADER)"$${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: $(check_PROGRAMS) + @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 $$? +.run.log: + @p='$<'; \ + $(am__set_b); \ + $(am__check_pre) $(RUN_LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_RUN_LOG_DRIVER_FLAGS) $(RUN_LOG_DRIVER_FLAGS) -- $(RUN_LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +@am__EXEEXT_TRUE@.run$(EXEEXT).log: +@am__EXEEXT_TRUE@ @p='$<'; \ +@am__EXEEXT_TRUE@ $(am__set_b); \ +@am__EXEEXT_TRUE@ $(am__check_pre) $(RUN_LOG_DRIVER) --test-name "$$f" \ +@am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ +@am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_RUN_LOG_DRIVER_FLAGS) $(RUN_LOG_DRIVER_FLAGS) -- $(RUN_LOG_COMPILE) \ +@am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) + $(MAKE) $(AM_MAKEFLAGS) check-TESTS +check: check-am +all-am: Makefile $(PROGRAMS) $(LTLIBRARIES) all-local +installdirs: + for dir in "$(DESTDIR)$(pyexecdir)" "$(DESTDIR)$(pythondir)"; 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: + -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) + -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) + -rm -f python/$(DEPDIR)/$(am__dirstamp) + -rm -f python/$(am__dirstamp) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-checkPROGRAMS clean-generic clean-libtool clean-local \ + clean-noinstPROGRAMS clean-pyexecLTLIBRARIES mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/CdiInfo.Po + -rm -f ./$(DEPDIR)/cdi.Plo + -rm -f python/$(DEPDIR)/_Cdi_la-cdi_wrapper.Plo + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +examples: examples-am + +examples-am: examples-local + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-pythonPYTHON + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-exec-local install-pyexecLTLIBRARIES + +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 ./$(DEPDIR)/CdiInfo.Po + -rm -f ./$(DEPDIR)/cdi.Plo + -rm -f python/$(DEPDIR)/_Cdi_la-cdi_wrapper.Plo + -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-local uninstall-pyexecLTLIBRARIES \ + uninstall-pythonPYTHON + +.MAKE: check-am install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am all-local am--depfiles check \ + check-TESTS check-am clean clean-checkPROGRAMS clean-generic \ + clean-libtool clean-local clean-noinstPROGRAMS \ + clean-pyexecLTLIBRARIES cscopelist-am ctags ctags-am distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am examples-am examples-local \ + 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-exec-local install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-pyexecLTLIBRARIES install-pythonPYTHON 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 uninstall-local \ + uninstall-pyexecLTLIBRARIES uninstall-pythonPYTHON + +.PRECIOUS: Makefile + + +# For compatibility with older versions of Ruby, the recipes below redefine +# the following additional variables of the generated Makefile (this is known +# to be needed for Ruby 2.7.4 but not for Ruby 3.1.0): +# sitearchdir='$$(sitelibdir)/$$(sitearch)' +# sitedir='$$(rubylibprefix)/site_ruby' +# RM='$$(RM_RF)' + +@ENABLE_RUBY_INTERFACE_TRUE@.PHONY: ruby-binding +@ENABLE_RUBY_INTERFACE_TRUE@ruby-binding: ruby/Cdi.la +@ENABLE_RUBY_INTERFACE_TRUE@ruby/Cdi.la: ruby/cdi_wrapper.cpp ruby/Makefile libcdipp.la +@ENABLE_RUBY_INTERFACE_TRUE@ $(AM_V_CXXLD)$(am__cd) ruby && \ +@ENABLE_RUBY_INTERFACE_TRUE@ $(MAKE) $(AM_MAKEFLAGS) \ +@ENABLE_RUBY_INTERFACE_TRUE@ prefix='$(prefix)' \ +@ENABLE_RUBY_INTERFACE_TRUE@ sitearchdir='$$(sitelibdir)/$$(sitearch)' \ +@ENABLE_RUBY_INTERFACE_TRUE@ sitedir='$$(rubylibprefix)/site_ruby' \ +@ENABLE_RUBY_INTERFACE_TRUE@ TIMESTAMP_DIR='.dirstamp' \ +@ENABLE_RUBY_INTERFACE_TRUE@ CDI_INCFLAGS='-I$(abs_srcdir)' \ +@ENABLE_RUBY_INTERFACE_TRUE@ CDI_CPPFLAGS='$(AM_CPPFLAGS) $(CPPFLAGS)' \ +@ENABLE_RUBY_INTERFACE_TRUE@ CDI_CXXFLAGS='$(AM_CXXFLAGS) -shared $(CXXFLAGS)' \ +@ENABLE_RUBY_INTERFACE_TRUE@ CDI_LDFLAGS='$(AM_LDFLAGS) -module -avoid-version $(LDFLAGS) -rpath $$(RUBYARCHDIR)' \ +@ENABLE_RUBY_INTERFACE_TRUE@ CDI_LIBS='$(LIBS)' \ +@ENABLE_RUBY_INTERFACE_TRUE@ CCDLFLAGS= \ +@ENABLE_RUBY_INTERFACE_TRUE@ CXX='$(SHELL) $(abs_top_builddir)/libtool $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX)' \ +@ENABLE_RUBY_INTERFACE_TRUE@ LDSHAREDXX='$(SHELL) $(abs_top_builddir)/libtool $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) $$(CDI_CXXFLAGS)' \ +@ENABLE_RUBY_INTERFACE_TRUE@ DLLIB='$$(TARGET).la' \ +@ENABLE_RUBY_INTERFACE_TRUE@ V='$(V_MAKERUBY)' + +@ENABLE_RUBY_INTERFACE_TRUE@ruby/Makefile: $(abs_srcdir)/ruby/setup.rb Makefile +@ENABLE_RUBY_INTERFACE_TRUE@ $(AM_V_GEN)$(MKDIR_P) $(@D) && $(am__cd) $(@D) && $(RUBY) $< && \ +@ENABLE_RUBY_INTERFACE_TRUE@ $(SED) -i~ -e '/^\.cpp\.o:/s/^\.cpp\.o/.cpp.lo/;/^.SUFFIXES:/s/$$/ .lo/' \ +@ENABLE_RUBY_INTERFACE_TRUE@ -e '$$auninstall:; $$(UNINSTALL_PROG) $$(RUBYARCHDIR)/$$(DLLIB)' \ +@ENABLE_RUBY_INTERFACE_TRUE@ Makefile && rm -f Makefile~ + +@ENABLE_RUBY_INTERFACE_TRUE@.PHONY: ruby-install +@ENABLE_RUBY_INTERFACE_TRUE@ruby-install: ruby-binding +@ENABLE_RUBY_INTERFACE_TRUE@ $(am__cd) ruby && \ +@ENABLE_RUBY_INTERFACE_TRUE@ $(MAKE) $(AM_MAKEFLAGS) install \ +@ENABLE_RUBY_INTERFACE_TRUE@ prefix='$(DESTDIR)$(prefix)' \ +@ENABLE_RUBY_INTERFACE_TRUE@ sitearchdir='$$(sitelibdir)/$$(sitearch)' \ +@ENABLE_RUBY_INTERFACE_TRUE@ sitedir='$$(rubylibprefix)/site_ruby' \ +@ENABLE_RUBY_INTERFACE_TRUE@ TIMESTAMP_DIR='.dirstamp$(DESTDIR)' \ +@ENABLE_RUBY_INTERFACE_TRUE@ INSTALL_PROG='$(SHELL) $(abs_top_builddir)/libtool $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG)' \ +@ENABLE_RUBY_INTERFACE_TRUE@ DLLIB='$$(TARGET).la' + +@ENABLE_RUBY_INTERFACE_TRUE@.PHONY: ruby-uninstall +@ENABLE_RUBY_INTERFACE_TRUE@ruby-uninstall: +@ENABLE_RUBY_INTERFACE_TRUE@ $(am__cd) ruby && \ +@ENABLE_RUBY_INTERFACE_TRUE@ $(MAKE) $(AM_MAKEFLAGS) uninstall \ +@ENABLE_RUBY_INTERFACE_TRUE@ prefix='$(DESTDIR)$(prefix)' \ +@ENABLE_RUBY_INTERFACE_TRUE@ sitearchdir='$$(sitelibdir)/$$(sitearch)' \ +@ENABLE_RUBY_INTERFACE_TRUE@ sitedir='$$(rubylibprefix)/site_ruby' \ +@ENABLE_RUBY_INTERFACE_TRUE@ UNINSTALL_PROG='$(SHELL) $(abs_top_builddir)/libtool $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f' \ +@ENABLE_RUBY_INTERFACE_TRUE@ DLLIB='$$(TARGET).la' + +@ENABLE_RUBY_INTERFACE_TRUE@.PHONY: ruby-clean +@ENABLE_RUBY_INTERFACE_TRUE@ruby-clean: +@ENABLE_RUBY_INTERFACE_TRUE@ if test -f ruby/Makefile; then \ +@ENABLE_RUBY_INTERFACE_TRUE@ $(am__cd) ruby && \ +@ENABLE_RUBY_INTERFACE_TRUE@ $(MAKE) $(AM_MAKEFLAGS) distclean \ +@ENABLE_RUBY_INTERFACE_TRUE@ RM='$$(RM_RF)' \ +@ENABLE_RUBY_INTERFACE_TRUE@ DLLIB='$$(TARGET).la' \ +@ENABLE_RUBY_INTERFACE_TRUE@ CLEANOBJS='*.lo .libs .dirstamp'; \ +@ENABLE_RUBY_INTERFACE_TRUE@ fi + +@MAINTAINER_MODE_TRUE@ruby/cdi_wrapper.cpp: cdi.i cdi.hpp +@MAINTAINER_MODE_TRUE@ $(AM_V_GEN)$(MKDIR_P) $(@D) && $(SWIG) -ruby -c++ -globalmodule -o $@ $< + +@MAINTAINER_MODE_TRUE@python/Cdi.py: cdi.i cdi.hpp +@MAINTAINER_MODE_TRUE@ $(AM_V_GEN)$(SWIG) -python -c++ -o python/cdi_wrapper.cpp $< + +@MAINTAINER_MODE_TRUE@python/cdi_wrapper.cpp: python/Cdi.py +@MAINTAINER_MODE_TRUE@ $(AM_V_at)test -f $@ || rm -f $< +@MAINTAINER_MODE_TRUE@ $(AM_V_at)test -f $@ || $(MAKE) $(AM_MAKEFLAGS) $< +@MAINTAINER_MODE_FALSE@ruby/cdi_wrapper.cpp python/Cdi.py python/cdi_wrapper.cpp: +@MAINTAINER_MODE_FALSE@ @:;{ \ +@MAINTAINER_MODE_FALSE@ echo "ERROR: cannot generate '$@' when the maintainer mode is disabled:"; \ +@MAINTAINER_MODE_FALSE@ echo " re-configure with the '--enable-maintainer-mode' option"; \ +@MAINTAINER_MODE_FALSE@ } >&2; exit 1 + +all-local: $(all_local) +install-exec-local: $(install_exec_local) +uninstall-local: $(uninstall_local) +clean-local: $(clean_local) + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/interfaces/python/Cdi.py b/interfaces/python/Cdi.py new file mode 100644 index 0000000000000000000000000000000000000000..b96ab677f6232bea4b28279cf91e46fe69db53dc --- /dev/null +++ b/interfaces/python/Cdi.py @@ -0,0 +1,1379 @@ +# This file was automatically generated by SWIG (http://www.swig.org). +# Version 4.0.2 +# +# Do not make changes to this file unless you know what you are doing--modify +# the SWIG interface file instead. + +from sys import version_info as _swig_python_version_info +if _swig_python_version_info < (2, 7, 0): + raise RuntimeError("Python 2.7 or later required") + +# Import the low-level C/C++ module +if __package__ or "." in __name__: + from . import _Cdi +else: + import _Cdi + +try: + import builtins as __builtin__ +except ImportError: + import __builtin__ + +def _swig_repr(self): + try: + strthis = "proxy of " + self.this.__repr__() + except __builtin__.Exception: + strthis = "" + return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,) + + +def _swig_setattr_nondynamic_instance_variable(set): + def set_instance_attr(self, name, value): + if name == "thisown": + self.this.own(value) + elif name == "this": + set(self, name, value) + elif hasattr(self, name) and isinstance(getattr(type(self), name), property): + set(self, name, value) + else: + raise AttributeError("You cannot add instance attributes to %s" % self) + return set_instance_attr + + +def _swig_setattr_nondynamic_class_variable(set): + def set_class_attr(cls, name, value): + if hasattr(cls, name) and not isinstance(getattr(cls, name), property): + set(cls, name, value) + else: + raise AttributeError("You cannot add class attributes to %s" % cls) + return set_class_attr + + +def _swig_add_metaclass(metaclass): + """Class decorator for adding a metaclass to a SWIG wrapped class - a slimmed down version of six.add_metaclass""" + def wrapper(cls): + return metaclass(cls.__name__, cls.__bases__, cls.__dict__.copy()) + return wrapper + + +class _SwigNonDynamicMeta(type): + """Meta class to enforce nondynamic attributes (no new attributes) for a class""" + __setattr__ = _swig_setattr_nondynamic_class_variable(type.__setattr__) + + +class SwigPyIterator(object): + thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") + + def __init__(self, *args, **kwargs): + raise AttributeError("No constructor defined - class is abstract") + __repr__ = _swig_repr + __swig_destroy__ = _Cdi.delete_SwigPyIterator + + def value(self): + return _Cdi.SwigPyIterator_value(self) + + def incr(self, n=1): + return _Cdi.SwigPyIterator_incr(self, n) + + def decr(self, n=1): + return _Cdi.SwigPyIterator_decr(self, n) + + def distance(self, x): + return _Cdi.SwigPyIterator_distance(self, x) + + def equal(self, x): + return _Cdi.SwigPyIterator_equal(self, x) + + def copy(self): + return _Cdi.SwigPyIterator_copy(self) + + def next(self): + return _Cdi.SwigPyIterator_next(self) + + def __next__(self): + return _Cdi.SwigPyIterator___next__(self) + + def previous(self): + return _Cdi.SwigPyIterator_previous(self) + + def advance(self, n): + return _Cdi.SwigPyIterator_advance(self, n) + + def __eq__(self, x): + return _Cdi.SwigPyIterator___eq__(self, x) + + def __ne__(self, x): + return _Cdi.SwigPyIterator___ne__(self, x) + + def __iadd__(self, n): + return _Cdi.SwigPyIterator___iadd__(self, n) + + def __isub__(self, n): + return _Cdi.SwigPyIterator___isub__(self, n) + + def __add__(self, n): + return _Cdi.SwigPyIterator___add__(self, n) + + def __sub__(self, *args): + return _Cdi.SwigPyIterator___sub__(self, *args) + def __iter__(self): + return self + +# Register SwigPyIterator in _Cdi: +_Cdi.SwigPyIterator_swigregister(SwigPyIterator) + +class IntVector(object): + thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") + __repr__ = _swig_repr + + def iterator(self): + return _Cdi.IntVector_iterator(self) + def __iter__(self): + return self.iterator() + + def __nonzero__(self): + return _Cdi.IntVector___nonzero__(self) + + def __bool__(self): + return _Cdi.IntVector___bool__(self) + + def __len__(self): + return _Cdi.IntVector___len__(self) + + def __getslice__(self, i, j): + return _Cdi.IntVector___getslice__(self, i, j) + + def __setslice__(self, *args): + return _Cdi.IntVector___setslice__(self, *args) + + def __delslice__(self, i, j): + return _Cdi.IntVector___delslice__(self, i, j) + + def __delitem__(self, *args): + return _Cdi.IntVector___delitem__(self, *args) + + def __getitem__(self, *args): + return _Cdi.IntVector___getitem__(self, *args) + + def __setitem__(self, *args): + return _Cdi.IntVector___setitem__(self, *args) + + def pop(self): + return _Cdi.IntVector_pop(self) + + def append(self, x): + return _Cdi.IntVector_append(self, x) + + def empty(self): + return _Cdi.IntVector_empty(self) + + def size(self): + return _Cdi.IntVector_size(self) + + def swap(self, v): + return _Cdi.IntVector_swap(self, v) + + def begin(self): + return _Cdi.IntVector_begin(self) + + def end(self): + return _Cdi.IntVector_end(self) + + def rbegin(self): + return _Cdi.IntVector_rbegin(self) + + def rend(self): + return _Cdi.IntVector_rend(self) + + def clear(self): + return _Cdi.IntVector_clear(self) + + def get_allocator(self): + return _Cdi.IntVector_get_allocator(self) + + def pop_back(self): + return _Cdi.IntVector_pop_back(self) + + def erase(self, *args): + return _Cdi.IntVector_erase(self, *args) + + def __init__(self, *args): + _Cdi.IntVector_swiginit(self, _Cdi.new_IntVector(*args)) + + def push_back(self, x): + return _Cdi.IntVector_push_back(self, x) + + def front(self): + return _Cdi.IntVector_front(self) + + def back(self): + return _Cdi.IntVector_back(self) + + def assign(self, n, x): + return _Cdi.IntVector_assign(self, n, x) + + def resize(self, *args): + return _Cdi.IntVector_resize(self, *args) + + def insert(self, *args): + return _Cdi.IntVector_insert(self, *args) + + def reserve(self, n): + return _Cdi.IntVector_reserve(self, n) + + def capacity(self): + return _Cdi.IntVector_capacity(self) + __swig_destroy__ = _Cdi.delete_IntVector + +# Register IntVector in _Cdi: +_Cdi.IntVector_swigregister(IntVector) + +class DoubleVector(object): + thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") + __repr__ = _swig_repr + + def iterator(self): + return _Cdi.DoubleVector_iterator(self) + def __iter__(self): + return self.iterator() + + def __nonzero__(self): + return _Cdi.DoubleVector___nonzero__(self) + + def __bool__(self): + return _Cdi.DoubleVector___bool__(self) + + def __len__(self): + return _Cdi.DoubleVector___len__(self) + + def __getslice__(self, i, j): + return _Cdi.DoubleVector___getslice__(self, i, j) + + def __setslice__(self, *args): + return _Cdi.DoubleVector___setslice__(self, *args) + + def __delslice__(self, i, j): + return _Cdi.DoubleVector___delslice__(self, i, j) + + def __delitem__(self, *args): + return _Cdi.DoubleVector___delitem__(self, *args) + + def __getitem__(self, *args): + return _Cdi.DoubleVector___getitem__(self, *args) + + def __setitem__(self, *args): + return _Cdi.DoubleVector___setitem__(self, *args) + + def pop(self): + return _Cdi.DoubleVector_pop(self) + + def append(self, x): + return _Cdi.DoubleVector_append(self, x) + + def empty(self): + return _Cdi.DoubleVector_empty(self) + + def size(self): + return _Cdi.DoubleVector_size(self) + + def swap(self, v): + return _Cdi.DoubleVector_swap(self, v) + + def begin(self): + return _Cdi.DoubleVector_begin(self) + + def end(self): + return _Cdi.DoubleVector_end(self) + + def rbegin(self): + return _Cdi.DoubleVector_rbegin(self) + + def rend(self): + return _Cdi.DoubleVector_rend(self) + + def clear(self): + return _Cdi.DoubleVector_clear(self) + + def get_allocator(self): + return _Cdi.DoubleVector_get_allocator(self) + + def pop_back(self): + return _Cdi.DoubleVector_pop_back(self) + + def erase(self, *args): + return _Cdi.DoubleVector_erase(self, *args) + + def __init__(self, *args): + _Cdi.DoubleVector_swiginit(self, _Cdi.new_DoubleVector(*args)) + + def push_back(self, x): + return _Cdi.DoubleVector_push_back(self, x) + + def front(self): + return _Cdi.DoubleVector_front(self) + + def back(self): + return _Cdi.DoubleVector_back(self) + + def assign(self, n, x): + return _Cdi.DoubleVector_assign(self, n, x) + + def resize(self, *args): + return _Cdi.DoubleVector_resize(self, *args) + + def insert(self, *args): + return _Cdi.DoubleVector_insert(self, *args) + + def reserve(self, n): + return _Cdi.DoubleVector_reserve(self, n) + + def capacity(self): + return _Cdi.DoubleVector_capacity(self) + __swig_destroy__ = _Cdi.delete_DoubleVector + +# Register DoubleVector in _Cdi: +_Cdi.DoubleVector_swigregister(DoubleVector) + +class DoubleDoubleVector(object): + thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") + __repr__ = _swig_repr + + def iterator(self): + return _Cdi.DoubleDoubleVector_iterator(self) + def __iter__(self): + return self.iterator() + + def __nonzero__(self): + return _Cdi.DoubleDoubleVector___nonzero__(self) + + def __bool__(self): + return _Cdi.DoubleDoubleVector___bool__(self) + + def __len__(self): + return _Cdi.DoubleDoubleVector___len__(self) + + def __getslice__(self, i, j): + return _Cdi.DoubleDoubleVector___getslice__(self, i, j) + + def __setslice__(self, *args): + return _Cdi.DoubleDoubleVector___setslice__(self, *args) + + def __delslice__(self, i, j): + return _Cdi.DoubleDoubleVector___delslice__(self, i, j) + + def __delitem__(self, *args): + return _Cdi.DoubleDoubleVector___delitem__(self, *args) + + def __getitem__(self, *args): + return _Cdi.DoubleDoubleVector___getitem__(self, *args) + + def __setitem__(self, *args): + return _Cdi.DoubleDoubleVector___setitem__(self, *args) + + def pop(self): + return _Cdi.DoubleDoubleVector_pop(self) + + def append(self, x): + return _Cdi.DoubleDoubleVector_append(self, x) + + def empty(self): + return _Cdi.DoubleDoubleVector_empty(self) + + def size(self): + return _Cdi.DoubleDoubleVector_size(self) + + def swap(self, v): + return _Cdi.DoubleDoubleVector_swap(self, v) + + def begin(self): + return _Cdi.DoubleDoubleVector_begin(self) + + def end(self): + return _Cdi.DoubleDoubleVector_end(self) + + def rbegin(self): + return _Cdi.DoubleDoubleVector_rbegin(self) + + def rend(self): + return _Cdi.DoubleDoubleVector_rend(self) + + def clear(self): + return _Cdi.DoubleDoubleVector_clear(self) + + def get_allocator(self): + return _Cdi.DoubleDoubleVector_get_allocator(self) + + def pop_back(self): + return _Cdi.DoubleDoubleVector_pop_back(self) + + def erase(self, *args): + return _Cdi.DoubleDoubleVector_erase(self, *args) + + def __init__(self, *args): + _Cdi.DoubleDoubleVector_swiginit(self, _Cdi.new_DoubleDoubleVector(*args)) + + def push_back(self, x): + return _Cdi.DoubleDoubleVector_push_back(self, x) + + def front(self): + return _Cdi.DoubleDoubleVector_front(self) + + def back(self): + return _Cdi.DoubleDoubleVector_back(self) + + def assign(self, n, x): + return _Cdi.DoubleDoubleVector_assign(self, n, x) + + def resize(self, *args): + return _Cdi.DoubleDoubleVector_resize(self, *args) + + def insert(self, *args): + return _Cdi.DoubleDoubleVector_insert(self, *args) + + def reserve(self, n): + return _Cdi.DoubleDoubleVector_reserve(self, n) + + def capacity(self): + return _Cdi.DoubleDoubleVector_capacity(self) + __swig_destroy__ = _Cdi.delete_DoubleDoubleVector + +# Register DoubleDoubleVector in _Cdi: +_Cdi.DoubleDoubleVector_swigregister(DoubleDoubleVector) + +class StringVector(object): + thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") + __repr__ = _swig_repr + + def iterator(self): + return _Cdi.StringVector_iterator(self) + def __iter__(self): + return self.iterator() + + def __nonzero__(self): + return _Cdi.StringVector___nonzero__(self) + + def __bool__(self): + return _Cdi.StringVector___bool__(self) + + def __len__(self): + return _Cdi.StringVector___len__(self) + + def __getslice__(self, i, j): + return _Cdi.StringVector___getslice__(self, i, j) + + def __setslice__(self, *args): + return _Cdi.StringVector___setslice__(self, *args) + + def __delslice__(self, i, j): + return _Cdi.StringVector___delslice__(self, i, j) + + def __delitem__(self, *args): + return _Cdi.StringVector___delitem__(self, *args) + + def __getitem__(self, *args): + return _Cdi.StringVector___getitem__(self, *args) + + def __setitem__(self, *args): + return _Cdi.StringVector___setitem__(self, *args) + + def pop(self): + return _Cdi.StringVector_pop(self) + + def append(self, x): + return _Cdi.StringVector_append(self, x) + + def empty(self): + return _Cdi.StringVector_empty(self) + + def size(self): + return _Cdi.StringVector_size(self) + + def swap(self, v): + return _Cdi.StringVector_swap(self, v) + + def begin(self): + return _Cdi.StringVector_begin(self) + + def end(self): + return _Cdi.StringVector_end(self) + + def rbegin(self): + return _Cdi.StringVector_rbegin(self) + + def rend(self): + return _Cdi.StringVector_rend(self) + + def clear(self): + return _Cdi.StringVector_clear(self) + + def get_allocator(self): + return _Cdi.StringVector_get_allocator(self) + + def pop_back(self): + return _Cdi.StringVector_pop_back(self) + + def erase(self, *args): + return _Cdi.StringVector_erase(self, *args) + + def __init__(self, *args): + _Cdi.StringVector_swiginit(self, _Cdi.new_StringVector(*args)) + + def push_back(self, x): + return _Cdi.StringVector_push_back(self, x) + + def front(self): + return _Cdi.StringVector_front(self) + + def back(self): + return _Cdi.StringVector_back(self) + + def assign(self, n, x): + return _Cdi.StringVector_assign(self, n, x) + + def resize(self, *args): + return _Cdi.StringVector_resize(self, *args) + + def insert(self, *args): + return _Cdi.StringVector_insert(self, *args) + + def reserve(self, n): + return _Cdi.StringVector_reserve(self, n) + + def capacity(self): + return _Cdi.StringVector_capacity(self) + __swig_destroy__ = _Cdi.delete_StringVector + +# Register StringVector in _Cdi: +_Cdi.StringVector_swigregister(StringVector) + +class VarsVector(object): + thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") + __repr__ = _swig_repr + + def iterator(self): + return _Cdi.VarsVector_iterator(self) + def __iter__(self): + return self.iterator() + + def __nonzero__(self): + return _Cdi.VarsVector___nonzero__(self) + + def __bool__(self): + return _Cdi.VarsVector___bool__(self) + + def __len__(self): + return _Cdi.VarsVector___len__(self) + + def __getslice__(self, i, j): + return _Cdi.VarsVector___getslice__(self, i, j) + + def __setslice__(self, *args): + return _Cdi.VarsVector___setslice__(self, *args) + + def __delslice__(self, i, j): + return _Cdi.VarsVector___delslice__(self, i, j) + + def __delitem__(self, *args): + return _Cdi.VarsVector___delitem__(self, *args) + + def __getitem__(self, *args): + return _Cdi.VarsVector___getitem__(self, *args) + + def __setitem__(self, *args): + return _Cdi.VarsVector___setitem__(self, *args) + + def pop(self): + return _Cdi.VarsVector_pop(self) + + def append(self, x): + return _Cdi.VarsVector_append(self, x) + + def empty(self): + return _Cdi.VarsVector_empty(self) + + def size(self): + return _Cdi.VarsVector_size(self) + + def swap(self, v): + return _Cdi.VarsVector_swap(self, v) + + def begin(self): + return _Cdi.VarsVector_begin(self) + + def end(self): + return _Cdi.VarsVector_end(self) + + def rbegin(self): + return _Cdi.VarsVector_rbegin(self) + + def rend(self): + return _Cdi.VarsVector_rend(self) + + def clear(self): + return _Cdi.VarsVector_clear(self) + + def get_allocator(self): + return _Cdi.VarsVector_get_allocator(self) + + def pop_back(self): + return _Cdi.VarsVector_pop_back(self) + + def erase(self, *args): + return _Cdi.VarsVector_erase(self, *args) + + def __init__(self, *args): + _Cdi.VarsVector_swiginit(self, _Cdi.new_VarsVector(*args)) + + def push_back(self, x): + return _Cdi.VarsVector_push_back(self, x) + + def front(self): + return _Cdi.VarsVector_front(self) + + def back(self): + return _Cdi.VarsVector_back(self) + + def assign(self, n, x): + return _Cdi.VarsVector_assign(self, n, x) + + def resize(self, *args): + return _Cdi.VarsVector_resize(self, *args) + + def insert(self, *args): + return _Cdi.VarsVector_insert(self, *args) + + def reserve(self, n): + return _Cdi.VarsVector_reserve(self, n) + + def capacity(self): + return _Cdi.VarsVector_capacity(self) + __swig_destroy__ = _Cdi.delete_VarsVector + +# Register VarsVector in _Cdi: +_Cdi.VarsVector_swigregister(VarsVector) + +class VarsMap(object): + thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") + __repr__ = _swig_repr + + def iterator(self): + return _Cdi.VarsMap_iterator(self) + def __iter__(self): + return self.iterator() + + def __nonzero__(self): + return _Cdi.VarsMap___nonzero__(self) + + def __bool__(self): + return _Cdi.VarsMap___bool__(self) + + def __len__(self): + return _Cdi.VarsMap___len__(self) + def __iter__(self): + return self.key_iterator() + def iterkeys(self): + return self.key_iterator() + def itervalues(self): + return self.value_iterator() + def iteritems(self): + return self.iterator() + + def __getitem__(self, key): + return _Cdi.VarsMap___getitem__(self, key) + + def __delitem__(self, key): + return _Cdi.VarsMap___delitem__(self, key) + + def has_key(self, key): + return _Cdi.VarsMap_has_key(self, key) + + def keys(self): + return _Cdi.VarsMap_keys(self) + + def values(self): + return _Cdi.VarsMap_values(self) + + def items(self): + return _Cdi.VarsMap_items(self) + + def __contains__(self, key): + return _Cdi.VarsMap___contains__(self, key) + + def key_iterator(self): + return _Cdi.VarsMap_key_iterator(self) + + def value_iterator(self): + return _Cdi.VarsMap_value_iterator(self) + + def __setitem__(self, *args): + return _Cdi.VarsMap___setitem__(self, *args) + + def asdict(self): + return _Cdi.VarsMap_asdict(self) + + def __init__(self, *args): + _Cdi.VarsMap_swiginit(self, _Cdi.new_VarsMap(*args)) + + def empty(self): + return _Cdi.VarsMap_empty(self) + + def size(self): + return _Cdi.VarsMap_size(self) + + def swap(self, v): + return _Cdi.VarsMap_swap(self, v) + + def begin(self): + return _Cdi.VarsMap_begin(self) + + def end(self): + return _Cdi.VarsMap_end(self) + + def rbegin(self): + return _Cdi.VarsMap_rbegin(self) + + def rend(self): + return _Cdi.VarsMap_rend(self) + + def clear(self): + return _Cdi.VarsMap_clear(self) + + def get_allocator(self): + return _Cdi.VarsMap_get_allocator(self) + + def count(self, x): + return _Cdi.VarsMap_count(self, x) + + def erase(self, *args): + return _Cdi.VarsMap_erase(self, *args) + + def find(self, x): + return _Cdi.VarsMap_find(self, x) + + def lower_bound(self, x): + return _Cdi.VarsMap_lower_bound(self, x) + + def upper_bound(self, x): + return _Cdi.VarsMap_upper_bound(self, x) + __swig_destroy__ = _Cdi.delete_VarsMap + +# Register VarsMap in _Cdi: +_Cdi.VarsMap_swigregister(VarsMap) + +class VarsByCode(object): + thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") + __repr__ = _swig_repr + + def iterator(self): + return _Cdi.VarsByCode_iterator(self) + def __iter__(self): + return self.iterator() + + def __nonzero__(self): + return _Cdi.VarsByCode___nonzero__(self) + + def __bool__(self): + return _Cdi.VarsByCode___bool__(self) + + def __len__(self): + return _Cdi.VarsByCode___len__(self) + def __iter__(self): + return self.key_iterator() + def iterkeys(self): + return self.key_iterator() + def itervalues(self): + return self.value_iterator() + def iteritems(self): + return self.iterator() + + def __getitem__(self, key): + return _Cdi.VarsByCode___getitem__(self, key) + + def __delitem__(self, key): + return _Cdi.VarsByCode___delitem__(self, key) + + def has_key(self, key): + return _Cdi.VarsByCode_has_key(self, key) + + def keys(self): + return _Cdi.VarsByCode_keys(self) + + def values(self): + return _Cdi.VarsByCode_values(self) + + def items(self): + return _Cdi.VarsByCode_items(self) + + def __contains__(self, key): + return _Cdi.VarsByCode___contains__(self, key) + + def key_iterator(self): + return _Cdi.VarsByCode_key_iterator(self) + + def value_iterator(self): + return _Cdi.VarsByCode_value_iterator(self) + + def __setitem__(self, *args): + return _Cdi.VarsByCode___setitem__(self, *args) + + def asdict(self): + return _Cdi.VarsByCode_asdict(self) + + def __init__(self, *args): + _Cdi.VarsByCode_swiginit(self, _Cdi.new_VarsByCode(*args)) + + def empty(self): + return _Cdi.VarsByCode_empty(self) + + def size(self): + return _Cdi.VarsByCode_size(self) + + def swap(self, v): + return _Cdi.VarsByCode_swap(self, v) + + def begin(self): + return _Cdi.VarsByCode_begin(self) + + def end(self): + return _Cdi.VarsByCode_end(self) + + def rbegin(self): + return _Cdi.VarsByCode_rbegin(self) + + def rend(self): + return _Cdi.VarsByCode_rend(self) + + def clear(self): + return _Cdi.VarsByCode_clear(self) + + def get_allocator(self): + return _Cdi.VarsByCode_get_allocator(self) + + def count(self, x): + return _Cdi.VarsByCode_count(self, x) + + def erase(self, *args): + return _Cdi.VarsByCode_erase(self, *args) + + def find(self, x): + return _Cdi.VarsByCode_find(self, x) + + def lower_bound(self, x): + return _Cdi.VarsByCode_lower_bound(self, x) + + def upper_bound(self, x): + return _Cdi.VarsByCode_upper_bound(self, x) + __swig_destroy__ = _Cdi.delete_VarsByCode + +# Register VarsByCode in _Cdi: +_Cdi.VarsByCode_swigregister(VarsByCode) + +class TaxesMap(object): + thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") + __repr__ = _swig_repr + + def iterator(self): + return _Cdi.TaxesMap_iterator(self) + def __iter__(self): + return self.iterator() + + def __nonzero__(self): + return _Cdi.TaxesMap___nonzero__(self) + + def __bool__(self): + return _Cdi.TaxesMap___bool__(self) + + def __len__(self): + return _Cdi.TaxesMap___len__(self) + def __iter__(self): + return self.key_iterator() + def iterkeys(self): + return self.key_iterator() + def itervalues(self): + return self.value_iterator() + def iteritems(self): + return self.iterator() + + def __getitem__(self, key): + return _Cdi.TaxesMap___getitem__(self, key) + + def __delitem__(self, key): + return _Cdi.TaxesMap___delitem__(self, key) + + def has_key(self, key): + return _Cdi.TaxesMap_has_key(self, key) + + def keys(self): + return _Cdi.TaxesMap_keys(self) + + def values(self): + return _Cdi.TaxesMap_values(self) + + def items(self): + return _Cdi.TaxesMap_items(self) + + def __contains__(self, key): + return _Cdi.TaxesMap___contains__(self, key) + + def key_iterator(self): + return _Cdi.TaxesMap_key_iterator(self) + + def value_iterator(self): + return _Cdi.TaxesMap_value_iterator(self) + + def __setitem__(self, *args): + return _Cdi.TaxesMap___setitem__(self, *args) + + def asdict(self): + return _Cdi.TaxesMap_asdict(self) + + def __init__(self, *args): + _Cdi.TaxesMap_swiginit(self, _Cdi.new_TaxesMap(*args)) + + def empty(self): + return _Cdi.TaxesMap_empty(self) + + def size(self): + return _Cdi.TaxesMap_size(self) + + def swap(self, v): + return _Cdi.TaxesMap_swap(self, v) + + def begin(self): + return _Cdi.TaxesMap_begin(self) + + def end(self): + return _Cdi.TaxesMap_end(self) + + def rbegin(self): + return _Cdi.TaxesMap_rbegin(self) + + def rend(self): + return _Cdi.TaxesMap_rend(self) + + def clear(self): + return _Cdi.TaxesMap_clear(self) + + def get_allocator(self): + return _Cdi.TaxesMap_get_allocator(self) + + def count(self, x): + return _Cdi.TaxesMap_count(self, x) + + def erase(self, *args): + return _Cdi.TaxesMap_erase(self, *args) + + def find(self, x): + return _Cdi.TaxesMap_find(self, x) + + def lower_bound(self, x): + return _Cdi.TaxesMap_lower_bound(self, x) + + def upper_bound(self, x): + return _Cdi.TaxesMap_upper_bound(self, x) + __swig_destroy__ = _Cdi.delete_TaxesMap + +# Register TaxesMap in _Cdi: +_Cdi.TaxesMap_swigregister(TaxesMap) + +class ZaxesMap(object): + thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") + __repr__ = _swig_repr + + def iterator(self): + return _Cdi.ZaxesMap_iterator(self) + def __iter__(self): + return self.iterator() + + def __nonzero__(self): + return _Cdi.ZaxesMap___nonzero__(self) + + def __bool__(self): + return _Cdi.ZaxesMap___bool__(self) + + def __len__(self): + return _Cdi.ZaxesMap___len__(self) + def __iter__(self): + return self.key_iterator() + def iterkeys(self): + return self.key_iterator() + def itervalues(self): + return self.value_iterator() + def iteritems(self): + return self.iterator() + + def __getitem__(self, key): + return _Cdi.ZaxesMap___getitem__(self, key) + + def __delitem__(self, key): + return _Cdi.ZaxesMap___delitem__(self, key) + + def has_key(self, key): + return _Cdi.ZaxesMap_has_key(self, key) + + def keys(self): + return _Cdi.ZaxesMap_keys(self) + + def values(self): + return _Cdi.ZaxesMap_values(self) + + def items(self): + return _Cdi.ZaxesMap_items(self) + + def __contains__(self, key): + return _Cdi.ZaxesMap___contains__(self, key) + + def key_iterator(self): + return _Cdi.ZaxesMap_key_iterator(self) + + def value_iterator(self): + return _Cdi.ZaxesMap_value_iterator(self) + + def __setitem__(self, *args): + return _Cdi.ZaxesMap___setitem__(self, *args) + + def asdict(self): + return _Cdi.ZaxesMap_asdict(self) + + def __init__(self, *args): + _Cdi.ZaxesMap_swiginit(self, _Cdi.new_ZaxesMap(*args)) + + def empty(self): + return _Cdi.ZaxesMap_empty(self) + + def size(self): + return _Cdi.ZaxesMap_size(self) + + def swap(self, v): + return _Cdi.ZaxesMap_swap(self, v) + + def begin(self): + return _Cdi.ZaxesMap_begin(self) + + def end(self): + return _Cdi.ZaxesMap_end(self) + + def rbegin(self): + return _Cdi.ZaxesMap_rbegin(self) + + def rend(self): + return _Cdi.ZaxesMap_rend(self) + + def clear(self): + return _Cdi.ZaxesMap_clear(self) + + def get_allocator(self): + return _Cdi.ZaxesMap_get_allocator(self) + + def count(self, x): + return _Cdi.ZaxesMap_count(self, x) + + def erase(self, *args): + return _Cdi.ZaxesMap_erase(self, *args) + + def find(self, x): + return _Cdi.ZaxesMap_find(self, x) + + def lower_bound(self, x): + return _Cdi.ZaxesMap_lower_bound(self, x) + + def upper_bound(self, x): + return _Cdi.ZaxesMap_upper_bound(self, x) + __swig_destroy__ = _Cdi.delete_ZaxesMap + +# Register ZaxesMap in _Cdi: +_Cdi.ZaxesMap_swigregister(ZaxesMap) + +class GridsMap(object): + thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") + __repr__ = _swig_repr + + def iterator(self): + return _Cdi.GridsMap_iterator(self) + def __iter__(self): + return self.iterator() + + def __nonzero__(self): + return _Cdi.GridsMap___nonzero__(self) + + def __bool__(self): + return _Cdi.GridsMap___bool__(self) + + def __len__(self): + return _Cdi.GridsMap___len__(self) + def __iter__(self): + return self.key_iterator() + def iterkeys(self): + return self.key_iterator() + def itervalues(self): + return self.value_iterator() + def iteritems(self): + return self.iterator() + + def __getitem__(self, key): + return _Cdi.GridsMap___getitem__(self, key) + + def __delitem__(self, key): + return _Cdi.GridsMap___delitem__(self, key) + + def has_key(self, key): + return _Cdi.GridsMap_has_key(self, key) + + def keys(self): + return _Cdi.GridsMap_keys(self) + + def values(self): + return _Cdi.GridsMap_values(self) + + def items(self): + return _Cdi.GridsMap_items(self) + + def __contains__(self, key): + return _Cdi.GridsMap___contains__(self, key) + + def key_iterator(self): + return _Cdi.GridsMap_key_iterator(self) + + def value_iterator(self): + return _Cdi.GridsMap_value_iterator(self) + + def __setitem__(self, *args): + return _Cdi.GridsMap___setitem__(self, *args) + + def asdict(self): + return _Cdi.GridsMap_asdict(self) + + def __init__(self, *args): + _Cdi.GridsMap_swiginit(self, _Cdi.new_GridsMap(*args)) + + def empty(self): + return _Cdi.GridsMap_empty(self) + + def size(self): + return _Cdi.GridsMap_size(self) + + def swap(self, v): + return _Cdi.GridsMap_swap(self, v) + + def begin(self): + return _Cdi.GridsMap_begin(self) + + def end(self): + return _Cdi.GridsMap_end(self) + + def rbegin(self): + return _Cdi.GridsMap_rbegin(self) + + def rend(self): + return _Cdi.GridsMap_rend(self) + + def clear(self): + return _Cdi.GridsMap_clear(self) + + def get_allocator(self): + return _Cdi.GridsMap_get_allocator(self) + + def count(self, x): + return _Cdi.GridsMap_count(self, x) + + def erase(self, *args): + return _Cdi.GridsMap_erase(self, *args) + + def find(self, x): + return _Cdi.GridsMap_find(self, x) + + def lower_bound(self, x): + return _Cdi.GridsMap_lower_bound(self, x) + + def upper_bound(self, x): + return _Cdi.GridsMap_upper_bound(self, x) + __swig_destroy__ = _Cdi.delete_GridsMap + +# Register GridsMap in _Cdi: +_Cdi.GridsMap_swigregister(GridsMap) + +class CdiGrid(object): + thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") + __repr__ = _swig_repr + + def __init__(self, *args): + _Cdi.CdiGrid_swiginit(self, _Cdi.new_CdiGrid(*args)) + __swig_destroy__ = _Cdi.delete_CdiGrid + gridID = property(_Cdi.CdiGrid_gridID_get, _Cdi.CdiGrid_gridID_set) + type = property(_Cdi.CdiGrid_type_get, _Cdi.CdiGrid_type_set) + size = property(_Cdi.CdiGrid_size_get, _Cdi.CdiGrid_size_set) + xsize = property(_Cdi.CdiGrid_xsize_get, _Cdi.CdiGrid_xsize_set) + ysize = property(_Cdi.CdiGrid_ysize_get, _Cdi.CdiGrid_ysize_set) + prec = property(_Cdi.CdiGrid_prec_get, _Cdi.CdiGrid_prec_set) + ncorner = property(_Cdi.CdiGrid_ncorner_get, _Cdi.CdiGrid_ncorner_set) + hasXValues = property(_Cdi.CdiGrid_hasXValues_get, _Cdi.CdiGrid_hasXValues_set) + hasYValues = property(_Cdi.CdiGrid_hasYValues_get, _Cdi.CdiGrid_hasYValues_set) + hasBounds = property(_Cdi.CdiGrid_hasBounds_get, _Cdi.CdiGrid_hasBounds_set) + xvalues = property(_Cdi.CdiGrid_xvalues_get, _Cdi.CdiGrid_xvalues_set) + yvalues = property(_Cdi.CdiGrid_yvalues_get, _Cdi.CdiGrid_yvalues_set) + xbounds = property(_Cdi.CdiGrid_xbounds_get, _Cdi.CdiGrid_xbounds_set) + ybounds = property(_Cdi.CdiGrid_ybounds_get, _Cdi.CdiGrid_ybounds_set) + xname = property(_Cdi.CdiGrid_xname_get, _Cdi.CdiGrid_xname_set) + xlongname = property(_Cdi.CdiGrid_xlongname_get, _Cdi.CdiGrid_xlongname_set) + xstdname = property(_Cdi.CdiGrid_xstdname_get, _Cdi.CdiGrid_xstdname_set) + xunits = property(_Cdi.CdiGrid_xunits_get, _Cdi.CdiGrid_xunits_set) + yname = property(_Cdi.CdiGrid_yname_get, _Cdi.CdiGrid_yname_set) + ylongname = property(_Cdi.CdiGrid_ylongname_get, _Cdi.CdiGrid_ylongname_set) + ystdname = property(_Cdi.CdiGrid_ystdname_get, _Cdi.CdiGrid_ystdname_set) + yunits = property(_Cdi.CdiGrid_yunits_get, _Cdi.CdiGrid_yunits_set) + name = property(_Cdi.CdiGrid_name_get, _Cdi.CdiGrid_name_set) + + def getValues(self): + return _Cdi.CdiGrid_getValues(self) + + def getBounds(self): + return _Cdi.CdiGrid_getBounds(self) + + def getValuesAsPointer(self, xvals, yvals): + return _Cdi.CdiGrid_getValuesAsPointer(self, xvals, yvals) + + def getBoundsAsPointer(self, xbnds, ybnds): + return _Cdi.CdiGrid_getBoundsAsPointer(self, xbnds, ybnds) + + def getFloatVals(self, xvals, yvals): + return _Cdi.CdiGrid_getFloatVals(self, xvals, yvals) + + def getFloatBounds(self, xbnds, ybnds): + return _Cdi.CdiGrid_getFloatBounds(self, xbnds, ybnds) + +# Register CdiGrid in _Cdi: +_Cdi.CdiGrid_swigregister(CdiGrid) + +class CdiTaxis(object): + thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") + __repr__ = _swig_repr + + def __init__(self, *args): + _Cdi.CdiTaxis_swiginit(self, _Cdi.new_CdiTaxis(*args)) + __swig_destroy__ = _Cdi.delete_CdiTaxis + taxisID = property(_Cdi.CdiTaxis_taxisID_get, _Cdi.CdiTaxis_taxisID_set) + ntsteps = property(_Cdi.CdiTaxis_ntsteps_get, _Cdi.CdiTaxis_ntsteps_set) + unit = property(_Cdi.CdiTaxis_unit_get, _Cdi.CdiTaxis_unit_set) + rdate = property(_Cdi.CdiTaxis_rdate_get, _Cdi.CdiTaxis_rdate_set) + rtime = property(_Cdi.CdiTaxis_rtime_get, _Cdi.CdiTaxis_rtime_set) + vdate = property(_Cdi.CdiTaxis_vdate_get, _Cdi.CdiTaxis_vdate_set) + vtime = property(_Cdi.CdiTaxis_vtime_get, _Cdi.CdiTaxis_vtime_set) + type = property(_Cdi.CdiTaxis_type_get, _Cdi.CdiTaxis_type_set) + calendar = property(_Cdi.CdiTaxis_calendar_get, _Cdi.CdiTaxis_calendar_set) + hasBounds = property(_Cdi.CdiTaxis_hasBounds_get, _Cdi.CdiTaxis_hasBounds_set) + name = property(_Cdi.CdiTaxis_name_get, _Cdi.CdiTaxis_name_set) + unitname = property(_Cdi.CdiTaxis_unitname_get, _Cdi.CdiTaxis_unitname_set) + +# Register CdiTaxis in _Cdi: +_Cdi.CdiTaxis_swigregister(CdiTaxis) + +class CdiZaxis(object): + thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") + __repr__ = _swig_repr + + def __init__(self, *args): + _Cdi.CdiZaxis_swiginit(self, _Cdi.new_CdiZaxis(*args)) + __swig_destroy__ = _Cdi.delete_CdiZaxis + zaxisID = property(_Cdi.CdiZaxis_zaxisID_get, _Cdi.CdiZaxis_zaxisID_set) + type = property(_Cdi.CdiZaxis_type_get, _Cdi.CdiZaxis_type_set) + ltype = property(_Cdi.CdiZaxis_ltype_get, _Cdi.CdiZaxis_ltype_set) + size = property(_Cdi.CdiZaxis_size_get, _Cdi.CdiZaxis_size_set) + prec = property(_Cdi.CdiZaxis_prec_get, _Cdi.CdiZaxis_prec_set) + plevels = property(_Cdi.CdiZaxis_plevels_get, _Cdi.CdiZaxis_plevels_set) + plbounds = property(_Cdi.CdiZaxis_plbounds_get, _Cdi.CdiZaxis_plbounds_set) + pubounds = property(_Cdi.CdiZaxis_pubounds_get, _Cdi.CdiZaxis_pubounds_set) + pweights = property(_Cdi.CdiZaxis_pweights_get, _Cdi.CdiZaxis_pweights_set) + levels = property(_Cdi.CdiZaxis_levels_get, _Cdi.CdiZaxis_levels_set) + lbounds = property(_Cdi.CdiZaxis_lbounds_get, _Cdi.CdiZaxis_lbounds_set) + ubounds = property(_Cdi.CdiZaxis_ubounds_get, _Cdi.CdiZaxis_ubounds_set) + weights = property(_Cdi.CdiZaxis_weights_get, _Cdi.CdiZaxis_weights_set) + name = property(_Cdi.CdiZaxis_name_get, _Cdi.CdiZaxis_name_set) + longname = property(_Cdi.CdiZaxis_longname_get, _Cdi.CdiZaxis_longname_set) + units = property(_Cdi.CdiZaxis_units_get, _Cdi.CdiZaxis_units_set) + +# Register CdiZaxis in _Cdi: +_Cdi.CdiZaxis_swigregister(CdiZaxis) + +class CdiVariable(object): + thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") + __repr__ = _swig_repr + + def __init__(self, *args): + _Cdi.CdiVariable_swiginit(self, _Cdi.new_CdiVariable(*args)) + __swig_destroy__ = _Cdi.delete_CdiVariable + varID = property(_Cdi.CdiVariable_varID_get, _Cdi.CdiVariable_varID_set) + zaxisID = property(_Cdi.CdiVariable_zaxisID_get, _Cdi.CdiVariable_zaxisID_set) + gridID = property(_Cdi.CdiVariable_gridID_get, _Cdi.CdiVariable_gridID_set) + taxisID = property(_Cdi.CdiVariable_taxisID_get, _Cdi.CdiVariable_taxisID_set) + timeID = property(_Cdi.CdiVariable_timeID_get, _Cdi.CdiVariable_timeID_set) + vlistID = property(_Cdi.CdiVariable_vlistID_get, _Cdi.CdiVariable_vlistID_set) + size = property(_Cdi.CdiVariable_size_get, _Cdi.CdiVariable_size_set) + code = property(_Cdi.CdiVariable_code_get, _Cdi.CdiVariable_code_set) + datatype = property(_Cdi.CdiVariable_datatype_get, _Cdi.CdiVariable_datatype_set) + streamID = property(_Cdi.CdiVariable_streamID_get, _Cdi.CdiVariable_streamID_set) + name = property(_Cdi.CdiVariable_name_get, _Cdi.CdiVariable_name_set) + longname = property(_Cdi.CdiVariable_longname_get, _Cdi.CdiVariable_longname_set) + units = property(_Cdi.CdiVariable_units_get, _Cdi.CdiVariable_units_set) + stdname = property(_Cdi.CdiVariable_stdname_get, _Cdi.CdiVariable_stdname_set) + missval = property(_Cdi.CdiVariable_missval_get, _Cdi.CdiVariable_missval_set) + values = property(_Cdi.CdiVariable_values_get, _Cdi.CdiVariable_values_set) + valuesWithLevel = property(_Cdi.CdiVariable_valuesWithLevel_get, _Cdi.CdiVariable_valuesWithLevel_set) + grid = property(_Cdi.CdiVariable_grid_get, _Cdi.CdiVariable_grid_set) + zaxis = property(_Cdi.CdiVariable_zaxis_get, _Cdi.CdiVariable_zaxis_set) + taxis = property(_Cdi.CdiVariable_taxis_get, _Cdi.CdiVariable_taxis_set) + + def sinfo(self): + return _Cdi.CdiVariable_sinfo(self) + + def getValues(self): + return _Cdi.CdiVariable_getValues(self) + + def getValuesWithLevel(self, tsID=0): + return _Cdi.CdiVariable_getValuesWithLevel(self, tsID) + + def getFValues(self): + return _Cdi.CdiVariable_getFValues(self) + + def getFValuesWithLevel(self, tsID=0): + return _Cdi.CdiVariable_getFValuesWithLevel(self, tsID) + + def getValuesAsPointer(self): + return _Cdi.CdiVariable_getValuesAsPointer(self) + + def getValuesWithLevelAsPointer(self, tsID=0): + return _Cdi.CdiVariable_getValuesWithLevelAsPointer(self, tsID) + +# Register CdiVariable in _Cdi: +_Cdi.CdiVariable_swigregister(CdiVariable) + +class Cdi(object): + thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") + __repr__ = _swig_repr + + def __init__(self, path): + _Cdi.Cdi_swiginit(self, _Cdi.new_Cdi(path)) + __swig_destroy__ = _Cdi.delete_Cdi + streamID = property(_Cdi.Cdi_streamID_get, _Cdi.Cdi_streamID_set) + vlistID = property(_Cdi.Cdi_vlistID_get, _Cdi.Cdi_vlistID_set) + nvars = property(_Cdi.Cdi_nvars_get, _Cdi.Cdi_nvars_set) + nzaxes = property(_Cdi.Cdi_nzaxes_get, _Cdi.Cdi_nzaxes_set) + ngrids = property(_Cdi.Cdi_ngrids_get, _Cdi.Cdi_ngrids_set) + ntaxes = property(_Cdi.Cdi_ntaxes_get, _Cdi.Cdi_ntaxes_set) + taxisID = property(_Cdi.Cdi_taxisID_get, _Cdi.Cdi_taxisID_set) + varnames = property(_Cdi.Cdi_varnames_get, _Cdi.Cdi_varnames_set) + codes = property(_Cdi.Cdi_codes_get, _Cdi.Cdi_codes_set) + variables = property(_Cdi.Cdi_variables_get, _Cdi.Cdi_variables_set) + var = property(_Cdi.Cdi_var_get, _Cdi.Cdi_var_set) + varByCode = property(_Cdi.Cdi_varByCode_get, _Cdi.Cdi_varByCode_set) + taxes = property(_Cdi.Cdi_taxes_get, _Cdi.Cdi_taxes_set) + zaxes = property(_Cdi.Cdi_zaxes_get, _Cdi.Cdi_zaxes_set) + grids = property(_Cdi.Cdi_grids_get, _Cdi.Cdi_grids_set) + + def griddes(self): + return _Cdi.Cdi_griddes(self) + +# Register Cdi in _Cdi: +_Cdi.Cdi_swigregister(Cdi) + + + diff --git a/interfaces/python/cdi_wrapper.cpp b/interfaces/python/cdi_wrapper.cpp new file mode 100644 index 0000000000000000000000000000000000000000..06e0159f1f5f5c1e96bd99af096e5c1fdb577b97 --- /dev/null +++ b/interfaces/python/cdi_wrapper.cpp @@ -0,0 +1,29389 @@ +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 4.0.2 + * + * This file is not intended to be easily readable and contains a number of + * coding conventions designed to improve portability and efficiency. Do not make + * changes to this file unless you know what you are doing--modify the SWIG + * interface file instead. + * ----------------------------------------------------------------------------- */ + + +#ifndef SWIGPYTHON +#define SWIGPYTHON +#endif + +#define SWIG_PYTHON_DIRECTOR_NO_VTABLE + + +#ifdef __cplusplus +/* SwigValueWrapper is described in swig.swg */ +template<typename T> class SwigValueWrapper { + struct SwigMovePointer { + T *ptr; + SwigMovePointer(T *p) : ptr(p) { } + ~SwigMovePointer() { delete ptr; } + SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; } + } pointer; + SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs); + SwigValueWrapper(const SwigValueWrapper<T>& rhs); +public: + SwigValueWrapper() : pointer(0) { } + SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; } + operator T&() const { return *pointer.ptr; } + T *operator&() { return pointer.ptr; } +}; + +template <typename T> T SwigValueInit() { + return T(); +} +#endif + +/* ----------------------------------------------------------------------------- + * This section contains generic SWIG labels for method/variable + * declarations/attributes, and other compiler dependent labels. + * ----------------------------------------------------------------------------- */ + +/* template workaround for compilers that cannot correctly implement the C++ standard */ +#ifndef SWIGTEMPLATEDISAMBIGUATOR +# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560) +# define SWIGTEMPLATEDISAMBIGUATOR template +# elif defined(__HP_aCC) +/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */ +/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */ +# define SWIGTEMPLATEDISAMBIGUATOR template +# else +# define SWIGTEMPLATEDISAMBIGUATOR +# endif +#endif + +/* inline attribute */ +#ifndef SWIGINLINE +# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__)) +# define SWIGINLINE inline +# else +# define SWIGINLINE +# endif +#endif + +/* attribute recognised by some compilers to avoid 'unused' warnings */ +#ifndef SWIGUNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define SWIGUNUSED __attribute__ ((__unused__)) +# else +# define SWIGUNUSED +# endif +# elif defined(__ICC) +# define SWIGUNUSED __attribute__ ((__unused__)) +# else +# define SWIGUNUSED +# endif +#endif + +#ifndef SWIG_MSC_UNSUPPRESS_4505 +# if defined(_MSC_VER) +# pragma warning(disable : 4505) /* unreferenced local function has been removed */ +# endif +#endif + +#ifndef SWIGUNUSEDPARM +# ifdef __cplusplus +# define SWIGUNUSEDPARM(p) +# else +# define SWIGUNUSEDPARM(p) p SWIGUNUSED +# endif +#endif + +/* internal SWIG method */ +#ifndef SWIGINTERN +# define SWIGINTERN static SWIGUNUSED +#endif + +/* internal inline SWIG method */ +#ifndef SWIGINTERNINLINE +# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE +#endif + +/* exporting methods */ +#if defined(__GNUC__) +# if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) +# ifndef GCC_HASCLASSVISIBILITY +# define GCC_HASCLASSVISIBILITY +# endif +# endif +#endif + +#ifndef SWIGEXPORT +# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# if defined(STATIC_LINKED) +# define SWIGEXPORT +# else +# define SWIGEXPORT __declspec(dllexport) +# endif +# else +# if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY) +# define SWIGEXPORT __attribute__ ((visibility("default"))) +# else +# define SWIGEXPORT +# endif +# endif +#endif + +/* calling conventions for Windows */ +#ifndef SWIGSTDCALL +# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# define SWIGSTDCALL __stdcall +# else +# define SWIGSTDCALL +# endif +#endif + +/* Deal with Microsoft's attempt at deprecating C standard runtime functions */ +#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) +# define _CRT_SECURE_NO_DEPRECATE +#endif + +/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */ +#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE) +# define _SCL_SECURE_NO_DEPRECATE +#endif + +/* Deal with Apple's deprecated 'AssertMacros.h' from Carbon-framework */ +#if defined(__APPLE__) && !defined(__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES) +# define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0 +#endif + +/* Intel's compiler complains if a variable which was never initialised is + * cast to void, which is a common idiom which we use to indicate that we + * are aware a variable isn't used. So we just silence that warning. + * See: https://github.com/swig/swig/issues/192 for more discussion. + */ +#ifdef __INTEL_COMPILER +# pragma warning disable 592 +#endif + + +#if defined(__GNUC__) && defined(_WIN32) && !defined(SWIG_PYTHON_NO_HYPOT_WORKAROUND) +/* Workaround for '::hypot' has not been declared', see https://bugs.python.org/issue11566 */ +# include <math.h> +#endif + +#if defined(_DEBUG) && defined(SWIG_PYTHON_INTERPRETER_NO_DEBUG) +/* Use debug wrappers with the Python release dll */ +# undef _DEBUG +# include <Python.h> +# define _DEBUG 1 +#else +# include <Python.h> +#endif + +/* ----------------------------------------------------------------------------- + * swigrun.swg + * + * This file contains generic C API SWIG runtime support for pointer + * type checking. + * ----------------------------------------------------------------------------- */ + +/* This should only be incremented when either the layout of swig_type_info changes, + or for whatever reason, the runtime changes incompatibly */ +#define SWIG_RUNTIME_VERSION "4" + +/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */ +#ifdef SWIG_TYPE_TABLE +# define SWIG_QUOTE_STRING(x) #x +# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x) +# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE) +#else +# define SWIG_TYPE_TABLE_NAME +#endif + +/* + You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for + creating a static or dynamic library from the SWIG runtime code. + In 99.9% of the cases, SWIG just needs to declare them as 'static'. + + But only do this if strictly necessary, ie, if you have problems + with your compiler or suchlike. +*/ + +#ifndef SWIGRUNTIME +# define SWIGRUNTIME SWIGINTERN +#endif + +#ifndef SWIGRUNTIMEINLINE +# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE +#endif + +/* Generic buffer size */ +#ifndef SWIG_BUFFER_SIZE +# define SWIG_BUFFER_SIZE 1024 +#endif + +/* Flags for pointer conversions */ +#define SWIG_POINTER_DISOWN 0x1 +#define SWIG_CAST_NEW_MEMORY 0x2 +#define SWIG_POINTER_NO_NULL 0x4 + +/* Flags for new pointer objects */ +#define SWIG_POINTER_OWN 0x1 + + +/* + Flags/methods for returning states. + + The SWIG conversion methods, as ConvertPtr, return an integer + that tells if the conversion was successful or not. And if not, + an error code can be returned (see swigerrors.swg for the codes). + + Use the following macros/flags to set or process the returning + states. + + In old versions of SWIG, code such as the following was usually written: + + if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) { + // success code + } else { + //fail code + } + + Now you can be more explicit: + + int res = SWIG_ConvertPtr(obj,vptr,ty.flags); + if (SWIG_IsOK(res)) { + // success code + } else { + // fail code + } + + which is the same really, but now you can also do + + Type *ptr; + int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags); + if (SWIG_IsOK(res)) { + // success code + if (SWIG_IsNewObj(res) { + ... + delete *ptr; + } else { + ... + } + } else { + // fail code + } + + I.e., now SWIG_ConvertPtr can return new objects and you can + identify the case and take care of the deallocation. Of course that + also requires SWIG_ConvertPtr to return new result values, such as + + int SWIG_ConvertPtr(obj, ptr,...) { + if (<obj is ok>) { + if (<need new object>) { + *ptr = <ptr to new allocated object>; + return SWIG_NEWOBJ; + } else { + *ptr = <ptr to old object>; + return SWIG_OLDOBJ; + } + } else { + return SWIG_BADOBJ; + } + } + + Of course, returning the plain '0(success)/-1(fail)' still works, but you can be + more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the + SWIG errors code. + + Finally, if the SWIG_CASTRANK_MODE is enabled, the result code + allows to return the 'cast rank', for example, if you have this + + int food(double) + int fooi(int); + + and you call + + food(1) // cast rank '1' (1 -> 1.0) + fooi(1) // cast rank '0' + + just use the SWIG_AddCast()/SWIG_CheckState() +*/ + +#define SWIG_OK (0) +#define SWIG_ERROR (-1) +#define SWIG_IsOK(r) (r >= 0) +#define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError) + +/* The CastRankLimit says how many bits are used for the cast rank */ +#define SWIG_CASTRANKLIMIT (1 << 8) +/* The NewMask denotes the object was created (using new/malloc) */ +#define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1) +/* The TmpMask is for in/out typemaps that use temporal objects */ +#define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1) +/* Simple returning values */ +#define SWIG_BADOBJ (SWIG_ERROR) +#define SWIG_OLDOBJ (SWIG_OK) +#define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK) +#define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK) +/* Check, add and del mask methods */ +#define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r) +#define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r) +#define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK)) +#define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r) +#define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r) +#define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK)) + +/* Cast-Rank Mode */ +#if defined(SWIG_CASTRANK_MODE) +# ifndef SWIG_TypeRank +# define SWIG_TypeRank unsigned long +# endif +# ifndef SWIG_MAXCASTRANK /* Default cast allowed */ +# define SWIG_MAXCASTRANK (2) +# endif +# define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1) +# define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK) +SWIGINTERNINLINE int SWIG_AddCast(int r) { + return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r; +} +SWIGINTERNINLINE int SWIG_CheckState(int r) { + return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; +} +#else /* no cast-rank mode */ +# define SWIG_AddCast(r) (r) +# define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0) +#endif + + +#include <string.h> + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void *(*swig_converter_func)(void *, int *); +typedef struct swig_type_info *(*swig_dycast_func)(void **); + +/* Structure to store information on one type */ +typedef struct swig_type_info { + const char *name; /* mangled name of this type */ + const char *str; /* human readable name of this type */ + swig_dycast_func dcast; /* dynamic cast function down a hierarchy */ + struct swig_cast_info *cast; /* linked list of types that can cast into this type */ + void *clientdata; /* language specific type data */ + int owndata; /* flag if the structure owns the clientdata */ +} swig_type_info; + +/* Structure to store a type and conversion function used for casting */ +typedef struct swig_cast_info { + swig_type_info *type; /* pointer to type that is equivalent to this type */ + swig_converter_func converter; /* function to cast the void pointers */ + struct swig_cast_info *next; /* pointer to next cast in linked list */ + struct swig_cast_info *prev; /* pointer to the previous cast */ +} swig_cast_info; + +/* Structure used to store module information + * Each module generates one structure like this, and the runtime collects + * all of these structures and stores them in a circularly linked list.*/ +typedef struct swig_module_info { + swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */ + size_t size; /* Number of types in this module */ + struct swig_module_info *next; /* Pointer to next element in circularly linked list */ + swig_type_info **type_initial; /* Array of initially generated type structures */ + swig_cast_info **cast_initial; /* Array of initially generated casting structures */ + void *clientdata; /* Language specific module data */ +} swig_module_info; + +/* + Compare two type names skipping the space characters, therefore + "char*" == "char *" and "Class<int>" == "Class<int >", etc. + + Return 0 when the two name types are equivalent, as in + strncmp, but skipping ' '. +*/ +SWIGRUNTIME int +SWIG_TypeNameComp(const char *f1, const char *l1, + const char *f2, const char *l2) { + for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) { + while ((*f1 == ' ') && (f1 != l1)) ++f1; + while ((*f2 == ' ') && (f2 != l2)) ++f2; + if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1; + } + return (int)((l1 - f1) - (l2 - f2)); +} + +/* + Check type equivalence in a name list like <name1>|<name2>|... + Return 0 if equal, -1 if nb < tb, 1 if nb > tb +*/ +SWIGRUNTIME int +SWIG_TypeCmp(const char *nb, const char *tb) { + int equiv = 1; + const char* te = tb + strlen(tb); + const char* ne = nb; + while (equiv != 0 && *ne) { + for (nb = ne; *ne; ++ne) { + if (*ne == '|') break; + } + equiv = SWIG_TypeNameComp(nb, ne, tb, te); + if (*ne) ++ne; + } + return equiv; +} + +/* + Check type equivalence in a name list like <name1>|<name2>|... + Return 0 if not equal, 1 if equal +*/ +SWIGRUNTIME int +SWIG_TypeEquiv(const char *nb, const char *tb) { + return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0; +} + +/* + Check the typename +*/ +SWIGRUNTIME swig_cast_info * +SWIG_TypeCheck(const char *c, swig_type_info *ty) { + if (ty) { + swig_cast_info *iter = ty->cast; + while (iter) { + if (strcmp(iter->type->name, c) == 0) { + if (iter == ty->cast) + return iter; + /* Move iter to the top of the linked list */ + iter->prev->next = iter->next; + if (iter->next) + iter->next->prev = iter->prev; + iter->next = ty->cast; + iter->prev = 0; + if (ty->cast) ty->cast->prev = iter; + ty->cast = iter; + return iter; + } + iter = iter->next; + } + } + return 0; +} + +/* + Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison +*/ +SWIGRUNTIME swig_cast_info * +SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) { + if (ty) { + swig_cast_info *iter = ty->cast; + while (iter) { + if (iter->type == from) { + if (iter == ty->cast) + return iter; + /* Move iter to the top of the linked list */ + iter->prev->next = iter->next; + if (iter->next) + iter->next->prev = iter->prev; + iter->next = ty->cast; + iter->prev = 0; + if (ty->cast) ty->cast->prev = iter; + ty->cast = iter; + return iter; + } + iter = iter->next; + } + } + return 0; +} + +/* + Cast a pointer up an inheritance hierarchy +*/ +SWIGRUNTIMEINLINE void * +SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) { + return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory); +} + +/* + Dynamic pointer casting. Down an inheritance hierarchy +*/ +SWIGRUNTIME swig_type_info * +SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) { + swig_type_info *lastty = ty; + if (!ty || !ty->dcast) return ty; + while (ty && (ty->dcast)) { + ty = (*ty->dcast)(ptr); + if (ty) lastty = ty; + } + return lastty; +} + +/* + Return the name associated with this type +*/ +SWIGRUNTIMEINLINE const char * +SWIG_TypeName(const swig_type_info *ty) { + return ty->name; +} + +/* + Return the pretty name associated with this type, + that is an unmangled type name in a form presentable to the user. +*/ +SWIGRUNTIME const char * +SWIG_TypePrettyName(const swig_type_info *type) { + /* The "str" field contains the equivalent pretty names of the + type, separated by vertical-bar characters. We choose + to print the last name, as it is often (?) the most + specific. */ + if (!type) return NULL; + if (type->str != NULL) { + const char *last_name = type->str; + const char *s; + for (s = type->str; *s; s++) + if (*s == '|') last_name = s+1; + return last_name; + } + else + return type->name; +} + +/* + Set the clientdata field for a type +*/ +SWIGRUNTIME void +SWIG_TypeClientData(swig_type_info *ti, void *clientdata) { + swig_cast_info *cast = ti->cast; + /* if (ti->clientdata == clientdata) return; */ + ti->clientdata = clientdata; + + while (cast) { + if (!cast->converter) { + swig_type_info *tc = cast->type; + if (!tc->clientdata) { + SWIG_TypeClientData(tc, clientdata); + } + } + cast = cast->next; + } +} +SWIGRUNTIME void +SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) { + SWIG_TypeClientData(ti, clientdata); + ti->owndata = 1; +} + +/* + Search for a swig_type_info structure only by mangled name + Search is a O(log #types) + + We start searching at module start, and finish searching when start == end. + Note: if start == end at the beginning of the function, we go all the way around + the circular list. +*/ +SWIGRUNTIME swig_type_info * +SWIG_MangledTypeQueryModule(swig_module_info *start, + swig_module_info *end, + const char *name) { + swig_module_info *iter = start; + do { + if (iter->size) { + size_t l = 0; + size_t r = iter->size - 1; + do { + /* since l+r >= 0, we can (>> 1) instead (/ 2) */ + size_t i = (l + r) >> 1; + const char *iname = iter->types[i]->name; + if (iname) { + int compare = strcmp(name, iname); + if (compare == 0) { + return iter->types[i]; + } else if (compare < 0) { + if (i) { + r = i - 1; + } else { + break; + } + } else if (compare > 0) { + l = i + 1; + } + } else { + break; /* should never happen */ + } + } while (l <= r); + } + iter = iter->next; + } while (iter != end); + return 0; +} + +/* + Search for a swig_type_info structure for either a mangled name or a human readable name. + It first searches the mangled names of the types, which is a O(log #types) + If a type is not found it then searches the human readable names, which is O(#types). + + We start searching at module start, and finish searching when start == end. + Note: if start == end at the beginning of the function, we go all the way around + the circular list. +*/ +SWIGRUNTIME swig_type_info * +SWIG_TypeQueryModule(swig_module_info *start, + swig_module_info *end, + const char *name) { + /* STEP 1: Search the name field using binary search */ + swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name); + if (ret) { + return ret; + } else { + /* STEP 2: If the type hasn't been found, do a complete search + of the str field (the human readable name) */ + swig_module_info *iter = start; + do { + size_t i = 0; + for (; i < iter->size; ++i) { + if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name))) + return iter->types[i]; + } + iter = iter->next; + } while (iter != end); + } + + /* neither found a match */ + return 0; +} + +/* + Pack binary data into a string +*/ +SWIGRUNTIME char * +SWIG_PackData(char *c, void *ptr, size_t sz) { + static const char hex[17] = "0123456789abcdef"; + const unsigned char *u = (unsigned char *) ptr; + const unsigned char *eu = u + sz; + for (; u != eu; ++u) { + unsigned char uu = *u; + *(c++) = hex[(uu & 0xf0) >> 4]; + *(c++) = hex[uu & 0xf]; + } + return c; +} + +/* + Unpack binary data from a string +*/ +SWIGRUNTIME const char * +SWIG_UnpackData(const char *c, void *ptr, size_t sz) { + unsigned char *u = (unsigned char *) ptr; + const unsigned char *eu = u + sz; + for (; u != eu; ++u) { + char d = *(c++); + unsigned char uu; + if ((d >= '0') && (d <= '9')) + uu = (unsigned char)((d - '0') << 4); + else if ((d >= 'a') && (d <= 'f')) + uu = (unsigned char)((d - ('a'-10)) << 4); + else + return (char *) 0; + d = *(c++); + if ((d >= '0') && (d <= '9')) + uu |= (unsigned char)(d - '0'); + else if ((d >= 'a') && (d <= 'f')) + uu |= (unsigned char)(d - ('a'-10)); + else + return (char *) 0; + *u = uu; + } + return c; +} + +/* + Pack 'void *' into a string buffer. +*/ +SWIGRUNTIME char * +SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) { + char *r = buff; + if ((2*sizeof(void *) + 2) > bsz) return 0; + *(r++) = '_'; + r = SWIG_PackData(r,&ptr,sizeof(void *)); + if (strlen(name) + 1 > (bsz - (r - buff))) return 0; + strcpy(r,name); + return buff; +} + +SWIGRUNTIME const char * +SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) { + if (*c != '_') { + if (strcmp(c,"NULL") == 0) { + *ptr = (void *) 0; + return name; + } else { + return 0; + } + } + return SWIG_UnpackData(++c,ptr,sizeof(void *)); +} + +SWIGRUNTIME char * +SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) { + char *r = buff; + size_t lname = (name ? strlen(name) : 0); + if ((2*sz + 2 + lname) > bsz) return 0; + *(r++) = '_'; + r = SWIG_PackData(r,ptr,sz); + if (lname) { + strncpy(r,name,lname+1); + } else { + *r = 0; + } + return buff; +} + +SWIGRUNTIME const char * +SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { + if (*c != '_') { + if (strcmp(c,"NULL") == 0) { + memset(ptr,0,sz); + return name; + } else { + return 0; + } + } + return SWIG_UnpackData(++c,ptr,sz); +} + +#ifdef __cplusplus +} +#endif + +/* Errors in SWIG */ +#define SWIG_UnknownError -1 +#define SWIG_IOError -2 +#define SWIG_RuntimeError -3 +#define SWIG_IndexError -4 +#define SWIG_TypeError -5 +#define SWIG_DivisionByZero -6 +#define SWIG_OverflowError -7 +#define SWIG_SyntaxError -8 +#define SWIG_ValueError -9 +#define SWIG_SystemError -10 +#define SWIG_AttributeError -11 +#define SWIG_MemoryError -12 +#define SWIG_NullReferenceError -13 + + + +/* Compatibility macros for Python 3 */ +#if PY_VERSION_HEX >= 0x03000000 + +#define PyClass_Check(obj) PyObject_IsInstance(obj, (PyObject *)&PyType_Type) +#define PyInt_Check(x) PyLong_Check(x) +#define PyInt_AsLong(x) PyLong_AsLong(x) +#define PyInt_FromLong(x) PyLong_FromLong(x) +#define PyInt_FromSize_t(x) PyLong_FromSize_t(x) +#define PyString_Check(name) PyBytes_Check(name) +#define PyString_FromString(x) PyUnicode_FromString(x) +#define PyString_Format(fmt, args) PyUnicode_Format(fmt, args) +#define PyString_AsString(str) PyBytes_AsString(str) +#define PyString_Size(str) PyBytes_Size(str) +#define PyString_InternFromString(key) PyUnicode_InternFromString(key) +#define Py_TPFLAGS_HAVE_CLASS Py_TPFLAGS_BASETYPE +#define PyString_AS_STRING(x) PyUnicode_AS_STRING(x) +#define _PyLong_FromSsize_t(x) PyLong_FromSsize_t(x) + +#endif + +#ifndef Py_TYPE +# define Py_TYPE(op) ((op)->ob_type) +#endif + +/* SWIG APIs for compatibility of both Python 2 & 3 */ + +#if PY_VERSION_HEX >= 0x03000000 +# define SWIG_Python_str_FromFormat PyUnicode_FromFormat +#else +# define SWIG_Python_str_FromFormat PyString_FromFormat +#endif + + +/* Warning: This function will allocate a new string in Python 3, + * so please call SWIG_Python_str_DelForPy3(x) to free the space. + */ +SWIGINTERN char* +SWIG_Python_str_AsChar(PyObject *str) +{ +#if PY_VERSION_HEX >= 0x03030000 + return (char *)PyUnicode_AsUTF8(str); +#elif PY_VERSION_HEX >= 0x03000000 + char *newstr = 0; + str = PyUnicode_AsUTF8String(str); + if (str) { + char *cstr; + Py_ssize_t len; + if (PyBytes_AsStringAndSize(str, &cstr, &len) != -1) { + newstr = (char *) malloc(len+1); + if (newstr) + memcpy(newstr, cstr, len+1); + } + Py_XDECREF(str); + } + return newstr; +#else + return PyString_AsString(str); +#endif +} + +#if PY_VERSION_HEX >= 0x03030000 || PY_VERSION_HEX < 0x03000000 +# define SWIG_Python_str_DelForPy3(x) +#else +# define SWIG_Python_str_DelForPy3(x) free( (void*) (x) ) +#endif + + +SWIGINTERN PyObject* +SWIG_Python_str_FromChar(const char *c) +{ +#if PY_VERSION_HEX >= 0x03000000 + return PyUnicode_FromString(c); +#else + return PyString_FromString(c); +#endif +} + +#ifndef PyObject_DEL +# define PyObject_DEL PyObject_Del +#endif + +// SWIGPY_USE_CAPSULE is no longer used within SWIG itself, but some user +// interface files check for it. +# define SWIGPY_USE_CAPSULE +# define SWIGPY_CAPSULE_NAME ("swig_runtime_data" SWIG_RUNTIME_VERSION ".type_pointer_capsule" SWIG_TYPE_TABLE_NAME) + +#if PY_VERSION_HEX < 0x03020000 +#define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type) +#define PyDescr_NAME(x) (((PyDescrObject *)(x))->d_name) +#define Py_hash_t long +#endif + +/* ----------------------------------------------------------------------------- + * error manipulation + * ----------------------------------------------------------------------------- */ + +SWIGRUNTIME PyObject* +SWIG_Python_ErrorType(int code) { + PyObject* type = 0; + switch(code) { + case SWIG_MemoryError: + type = PyExc_MemoryError; + break; + case SWIG_IOError: + type = PyExc_IOError; + break; + case SWIG_RuntimeError: + type = PyExc_RuntimeError; + break; + case SWIG_IndexError: + type = PyExc_IndexError; + break; + case SWIG_TypeError: + type = PyExc_TypeError; + break; + case SWIG_DivisionByZero: + type = PyExc_ZeroDivisionError; + break; + case SWIG_OverflowError: + type = PyExc_OverflowError; + break; + case SWIG_SyntaxError: + type = PyExc_SyntaxError; + break; + case SWIG_ValueError: + type = PyExc_ValueError; + break; + case SWIG_SystemError: + type = PyExc_SystemError; + break; + case SWIG_AttributeError: + type = PyExc_AttributeError; + break; + default: + type = PyExc_RuntimeError; + } + return type; +} + + +SWIGRUNTIME void +SWIG_Python_AddErrorMsg(const char* mesg) +{ + PyObject *type = 0; + PyObject *value = 0; + PyObject *traceback = 0; + + if (PyErr_Occurred()) + PyErr_Fetch(&type, &value, &traceback); + if (value) { + PyObject *old_str = PyObject_Str(value); + const char *tmp = SWIG_Python_str_AsChar(old_str); + PyErr_Clear(); + Py_XINCREF(type); + if (tmp) + PyErr_Format(type, "%s %s", tmp, mesg); + else + PyErr_Format(type, "%s", mesg); + SWIG_Python_str_DelForPy3(tmp); + Py_DECREF(old_str); + Py_DECREF(value); + } else { + PyErr_SetString(PyExc_RuntimeError, mesg); + } +} + +SWIGRUNTIME int +SWIG_Python_TypeErrorOccurred(PyObject *obj) +{ + PyObject *error; + if (obj) + return 0; + error = PyErr_Occurred(); + return error && PyErr_GivenExceptionMatches(error, PyExc_TypeError); +} + +SWIGRUNTIME void +SWIG_Python_RaiseOrModifyTypeError(const char *message) +{ + if (SWIG_Python_TypeErrorOccurred(NULL)) { + /* Use existing TypeError to preserve stacktrace and enhance with given message */ + PyObject *newvalue; + PyObject *type = NULL, *value = NULL, *traceback = NULL; + PyErr_Fetch(&type, &value, &traceback); +#if PY_VERSION_HEX >= 0x03000000 + newvalue = PyUnicode_FromFormat("%S\nAdditional information:\n%s", value, message); +#else + newvalue = PyString_FromFormat("%s\nAdditional information:\n%s", PyString_AsString(value), message); +#endif + Py_XDECREF(value); + PyErr_Restore(type, newvalue, traceback); + } else { + /* Raise TypeError using given message */ + PyErr_SetString(PyExc_TypeError, message); + } +} + +#if defined(SWIG_PYTHON_NO_THREADS) +# if defined(SWIG_PYTHON_THREADS) +# undef SWIG_PYTHON_THREADS +# endif +#endif +#if defined(SWIG_PYTHON_THREADS) /* Threading support is enabled */ +# if !defined(SWIG_PYTHON_USE_GIL) && !defined(SWIG_PYTHON_NO_USE_GIL) +# define SWIG_PYTHON_USE_GIL +# endif +# if defined(SWIG_PYTHON_USE_GIL) /* Use PyGILState threads calls */ +# ifndef SWIG_PYTHON_INITIALIZE_THREADS +# define SWIG_PYTHON_INITIALIZE_THREADS PyEval_InitThreads() +# endif +# ifdef __cplusplus /* C++ code */ + class SWIG_Python_Thread_Block { + bool status; + PyGILState_STATE state; + public: + void end() { if (status) { PyGILState_Release(state); status = false;} } + SWIG_Python_Thread_Block() : status(true), state(PyGILState_Ensure()) {} + ~SWIG_Python_Thread_Block() { end(); } + }; + class SWIG_Python_Thread_Allow { + bool status; + PyThreadState *save; + public: + void end() { if (status) { PyEval_RestoreThread(save); status = false; }} + SWIG_Python_Thread_Allow() : status(true), save(PyEval_SaveThread()) {} + ~SWIG_Python_Thread_Allow() { end(); } + }; +# define SWIG_PYTHON_THREAD_BEGIN_BLOCK SWIG_Python_Thread_Block _swig_thread_block +# define SWIG_PYTHON_THREAD_END_BLOCK _swig_thread_block.end() +# define SWIG_PYTHON_THREAD_BEGIN_ALLOW SWIG_Python_Thread_Allow _swig_thread_allow +# define SWIG_PYTHON_THREAD_END_ALLOW _swig_thread_allow.end() +# else /* C code */ +# define SWIG_PYTHON_THREAD_BEGIN_BLOCK PyGILState_STATE _swig_thread_block = PyGILState_Ensure() +# define SWIG_PYTHON_THREAD_END_BLOCK PyGILState_Release(_swig_thread_block) +# define SWIG_PYTHON_THREAD_BEGIN_ALLOW PyThreadState *_swig_thread_allow = PyEval_SaveThread() +# define SWIG_PYTHON_THREAD_END_ALLOW PyEval_RestoreThread(_swig_thread_allow) +# endif +# else /* Old thread way, not implemented, user must provide it */ +# if !defined(SWIG_PYTHON_INITIALIZE_THREADS) +# define SWIG_PYTHON_INITIALIZE_THREADS +# endif +# if !defined(SWIG_PYTHON_THREAD_BEGIN_BLOCK) +# define SWIG_PYTHON_THREAD_BEGIN_BLOCK +# endif +# if !defined(SWIG_PYTHON_THREAD_END_BLOCK) +# define SWIG_PYTHON_THREAD_END_BLOCK +# endif +# if !defined(SWIG_PYTHON_THREAD_BEGIN_ALLOW) +# define SWIG_PYTHON_THREAD_BEGIN_ALLOW +# endif +# if !defined(SWIG_PYTHON_THREAD_END_ALLOW) +# define SWIG_PYTHON_THREAD_END_ALLOW +# endif +# endif +#else /* No thread support */ +# define SWIG_PYTHON_INITIALIZE_THREADS +# define SWIG_PYTHON_THREAD_BEGIN_BLOCK +# define SWIG_PYTHON_THREAD_END_BLOCK +# define SWIG_PYTHON_THREAD_BEGIN_ALLOW +# define SWIG_PYTHON_THREAD_END_ALLOW +#endif + +/* ----------------------------------------------------------------------------- + * Python API portion that goes into the runtime + * ----------------------------------------------------------------------------- */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* ----------------------------------------------------------------------------- + * Constant declarations + * ----------------------------------------------------------------------------- */ + +/* Constant Types */ +#define SWIG_PY_POINTER 4 +#define SWIG_PY_BINARY 5 + +/* Constant information structure */ +typedef struct swig_const_info { + int type; + const char *name; + long lvalue; + double dvalue; + void *pvalue; + swig_type_info **ptype; +} swig_const_info; + +#ifdef __cplusplus +} +#endif + + +/* ----------------------------------------------------------------------------- + * pyrun.swg + * + * This file contains the runtime support for Python modules + * and includes code for managing global variables and pointer + * type checking. + * + * ----------------------------------------------------------------------------- */ + +#if PY_VERSION_HEX < 0x02070000 /* 2.7.0 */ +# error "This version of SWIG only supports Python >= 2.7" +#endif + +#if PY_VERSION_HEX >= 0x03000000 && PY_VERSION_HEX < 0x03020000 +# error "This version of SWIG only supports Python 3 >= 3.2" +#endif + +/* Common SWIG API */ + +/* for raw pointers */ +#define SWIG_Python_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, 0) +#define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtr(obj, pptr, type, flags) +#define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, own) + +#ifdef SWIGPYTHON_BUILTIN +#define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(self, ptr, type, flags) +#else +#define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(NULL, ptr, type, flags) +#endif + +#define SWIG_InternalNewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(NULL, ptr, type, flags) + +#define SWIG_CheckImplicit(ty) SWIG_Python_CheckImplicit(ty) +#define SWIG_AcquirePtr(ptr, src) SWIG_Python_AcquirePtr(ptr, src) +#define swig_owntype int + +/* for raw packed data */ +#define SWIG_ConvertPacked(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty) +#define SWIG_NewPackedObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type) + +/* for class or struct pointers */ +#define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_ConvertPtr(obj, pptr, type, flags) +#define SWIG_NewInstanceObj(ptr, type, flags) SWIG_NewPointerObj(ptr, type, flags) + +/* for C or C++ function pointers */ +#define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_Python_ConvertFunctionPtr(obj, pptr, type) +#define SWIG_NewFunctionPtrObj(ptr, type) SWIG_Python_NewPointerObj(NULL, ptr, type, 0) + +/* for C++ member pointers, ie, member methods */ +#define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty) +#define SWIG_NewMemberObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type) + + +/* Runtime API */ + +#define SWIG_GetModule(clientdata) SWIG_Python_GetModule(clientdata) +#define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer) +#define SWIG_NewClientData(obj) SwigPyClientData_New(obj) + +#define SWIG_SetErrorObj SWIG_Python_SetErrorObj +#define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg +#define SWIG_ErrorType(code) SWIG_Python_ErrorType(code) +#define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg) +#define SWIG_fail goto fail + + +/* Runtime API implementation */ + +/* Error manipulation */ + +SWIGINTERN void +SWIG_Python_SetErrorObj(PyObject *errtype, PyObject *obj) { + SWIG_PYTHON_THREAD_BEGIN_BLOCK; + PyErr_SetObject(errtype, obj); + Py_DECREF(obj); + SWIG_PYTHON_THREAD_END_BLOCK; +} + +SWIGINTERN void +SWIG_Python_SetErrorMsg(PyObject *errtype, const char *msg) { + SWIG_PYTHON_THREAD_BEGIN_BLOCK; + PyErr_SetString(errtype, msg); + SWIG_PYTHON_THREAD_END_BLOCK; +} + +#define SWIG_Python_Raise(obj, type, desc) SWIG_Python_SetErrorObj(SWIG_Python_ExceptionType(desc), obj) + +/* Set a constant value */ + +#if defined(SWIGPYTHON_BUILTIN) + +SWIGINTERN void +SwigPyBuiltin_AddPublicSymbol(PyObject *seq, const char *key) { + PyObject *s = PyString_InternFromString(key); + PyList_Append(seq, s); + Py_DECREF(s); +} + +SWIGINTERN void +SWIG_Python_SetConstant(PyObject *d, PyObject *public_interface, const char *name, PyObject *obj) { + PyDict_SetItemString(d, name, obj); + Py_DECREF(obj); + if (public_interface) + SwigPyBuiltin_AddPublicSymbol(public_interface, name); +} + +#else + +SWIGINTERN void +SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) { + PyDict_SetItemString(d, name, obj); + Py_DECREF(obj); +} + +#endif + +/* Append a value to the result obj */ + +SWIGINTERN PyObject* +SWIG_Python_AppendOutput(PyObject* result, PyObject* obj) { + if (!result) { + result = obj; + } else if (result == Py_None) { + Py_DECREF(result); + result = obj; + } else { + if (!PyList_Check(result)) { + PyObject *o2 = result; + result = PyList_New(1); + PyList_SetItem(result, 0, o2); + } + PyList_Append(result,obj); + Py_DECREF(obj); + } + return result; +} + +/* Unpack the argument tuple */ + +SWIGINTERN Py_ssize_t +SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, PyObject **objs) +{ + if (!args) { + if (!min && !max) { + return 1; + } else { + PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got none", + name, (min == max ? "" : "at least "), (int)min); + return 0; + } + } + if (!PyTuple_Check(args)) { + if (min <= 1 && max >= 1) { + Py_ssize_t i; + objs[0] = args; + for (i = 1; i < max; ++i) { + objs[i] = 0; + } + return 2; + } + PyErr_SetString(PyExc_SystemError, "UnpackTuple() argument list is not a tuple"); + return 0; + } else { + Py_ssize_t l = PyTuple_GET_SIZE(args); + if (l < min) { + PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", + name, (min == max ? "" : "at least "), (int)min, (int)l); + return 0; + } else if (l > max) { + PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", + name, (min == max ? "" : "at most "), (int)max, (int)l); + return 0; + } else { + Py_ssize_t i; + for (i = 0; i < l; ++i) { + objs[i] = PyTuple_GET_ITEM(args, i); + } + for (; l < max; ++l) { + objs[l] = 0; + } + return i + 1; + } + } +} + +SWIGINTERN int +SWIG_Python_CheckNoKeywords(PyObject *kwargs, const char *name) { + int no_kwargs = 1; + if (kwargs) { + assert(PyDict_Check(kwargs)); + if (PyDict_Size(kwargs) > 0) { + PyErr_Format(PyExc_TypeError, "%s() does not take keyword arguments", name); + no_kwargs = 0; + } + } + return no_kwargs; +} + +/* A functor is a function object with one single object argument */ +#define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunctionObjArgs(functor, obj, NULL); + +/* + Helper for static pointer initialization for both C and C++ code, for example + static PyObject *SWIG_STATIC_POINTER(MyVar) = NewSomething(...); +*/ +#ifdef __cplusplus +#define SWIG_STATIC_POINTER(var) var +#else +#define SWIG_STATIC_POINTER(var) var = 0; if (!var) var +#endif + +/* ----------------------------------------------------------------------------- + * Pointer declarations + * ----------------------------------------------------------------------------- */ + +/* Flags for new pointer objects */ +#define SWIG_POINTER_NOSHADOW (SWIG_POINTER_OWN << 1) +#define SWIG_POINTER_NEW (SWIG_POINTER_NOSHADOW | SWIG_POINTER_OWN) + +#define SWIG_POINTER_IMPLICIT_CONV (SWIG_POINTER_DISOWN << 1) + +#define SWIG_BUILTIN_TP_INIT (SWIG_POINTER_OWN << 2) +#define SWIG_BUILTIN_INIT (SWIG_BUILTIN_TP_INIT | SWIG_POINTER_OWN) + +#ifdef __cplusplus +extern "C" { +#endif + +/* The python void return value */ + +SWIGRUNTIMEINLINE PyObject * +SWIG_Py_Void(void) +{ + PyObject *none = Py_None; + Py_INCREF(none); + return none; +} + +/* SwigPyClientData */ + +typedef struct { + PyObject *klass; + PyObject *newraw; + PyObject *newargs; + PyObject *destroy; + int delargs; + int implicitconv; + PyTypeObject *pytype; +} SwigPyClientData; + +SWIGRUNTIMEINLINE int +SWIG_Python_CheckImplicit(swig_type_info *ty) +{ + SwigPyClientData *data = (SwigPyClientData *)ty->clientdata; + int fail = data ? data->implicitconv : 0; + if (fail) + PyErr_SetString(PyExc_TypeError, "Implicit conversion is prohibited for explicit constructors."); + return fail; +} + +SWIGRUNTIMEINLINE PyObject * +SWIG_Python_ExceptionType(swig_type_info *desc) { + SwigPyClientData *data = desc ? (SwigPyClientData *) desc->clientdata : 0; + PyObject *klass = data ? data->klass : 0; + return (klass ? klass : PyExc_RuntimeError); +} + + +SWIGRUNTIME SwigPyClientData * +SwigPyClientData_New(PyObject* obj) +{ + if (!obj) { + return 0; + } else { + SwigPyClientData *data = (SwigPyClientData *)malloc(sizeof(SwigPyClientData)); + /* the klass element */ + data->klass = obj; + Py_INCREF(data->klass); + /* the newraw method and newargs arguments used to create a new raw instance */ + if (PyClass_Check(obj)) { + data->newraw = 0; + data->newargs = obj; + Py_INCREF(obj); + } else { + data->newraw = PyObject_GetAttrString(data->klass, "__new__"); + if (data->newraw) { + Py_INCREF(data->newraw); + data->newargs = PyTuple_New(1); + PyTuple_SetItem(data->newargs, 0, obj); + } else { + data->newargs = obj; + } + Py_INCREF(data->newargs); + } + /* the destroy method, aka as the C++ delete method */ + data->destroy = PyObject_GetAttrString(data->klass, "__swig_destroy__"); + if (PyErr_Occurred()) { + PyErr_Clear(); + data->destroy = 0; + } + if (data->destroy) { + int flags; + Py_INCREF(data->destroy); + flags = PyCFunction_GET_FLAGS(data->destroy); + data->delargs = !(flags & (METH_O)); + } else { + data->delargs = 0; + } + data->implicitconv = 0; + data->pytype = 0; + return data; + } +} + +SWIGRUNTIME void +SwigPyClientData_Del(SwigPyClientData *data) { + Py_XDECREF(data->newraw); + Py_XDECREF(data->newargs); + Py_XDECREF(data->destroy); +} + +/* =============== SwigPyObject =====================*/ + +typedef struct { + PyObject_HEAD + void *ptr; + swig_type_info *ty; + int own; + PyObject *next; +#ifdef SWIGPYTHON_BUILTIN + PyObject *dict; +#endif +} SwigPyObject; + + +#ifdef SWIGPYTHON_BUILTIN + +SWIGRUNTIME PyObject * +SwigPyObject_get___dict__(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) +{ + SwigPyObject *sobj = (SwigPyObject *)v; + + if (!sobj->dict) + sobj->dict = PyDict_New(); + + Py_INCREF(sobj->dict); + return sobj->dict; +} + +#endif + +SWIGRUNTIME PyObject * +SwigPyObject_long(SwigPyObject *v) +{ + return PyLong_FromVoidPtr(v->ptr); +} + +SWIGRUNTIME PyObject * +SwigPyObject_format(const char* fmt, SwigPyObject *v) +{ + PyObject *res = NULL; + PyObject *args = PyTuple_New(1); + if (args) { + if (PyTuple_SetItem(args, 0, SwigPyObject_long(v)) == 0) { + PyObject *ofmt = SWIG_Python_str_FromChar(fmt); + if (ofmt) { +#if PY_VERSION_HEX >= 0x03000000 + res = PyUnicode_Format(ofmt,args); +#else + res = PyString_Format(ofmt,args); +#endif + Py_DECREF(ofmt); + } + Py_DECREF(args); + } + } + return res; +} + +SWIGRUNTIME PyObject * +SwigPyObject_oct(SwigPyObject *v) +{ + return SwigPyObject_format("%o",v); +} + +SWIGRUNTIME PyObject * +SwigPyObject_hex(SwigPyObject *v) +{ + return SwigPyObject_format("%x",v); +} + +SWIGRUNTIME PyObject * +SwigPyObject_repr(SwigPyObject *v) +{ + const char *name = SWIG_TypePrettyName(v->ty); + PyObject *repr = SWIG_Python_str_FromFormat("<Swig Object of type '%s' at %p>", (name ? name : "unknown"), (void *)v); + if (v->next) { + PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next); +# if PY_VERSION_HEX >= 0x03000000 + PyObject *joined = PyUnicode_Concat(repr, nrep); + Py_DecRef(repr); + Py_DecRef(nrep); + repr = joined; +# else + PyString_ConcatAndDel(&repr,nrep); +# endif + } + return repr; +} + +/* We need a version taking two PyObject* parameters so it's a valid + * PyCFunction to use in swigobject_methods[]. */ +SWIGRUNTIME PyObject * +SwigPyObject_repr2(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) +{ + return SwigPyObject_repr((SwigPyObject*)v); +} + +SWIGRUNTIME int +SwigPyObject_compare(SwigPyObject *v, SwigPyObject *w) +{ + void *i = v->ptr; + void *j = w->ptr; + return (i < j) ? -1 : ((i > j) ? 1 : 0); +} + +/* Added for Python 3.x, would it also be useful for Python 2.x? */ +SWIGRUNTIME PyObject* +SwigPyObject_richcompare(SwigPyObject *v, SwigPyObject *w, int op) +{ + PyObject* res; + if( op != Py_EQ && op != Py_NE ) { + Py_INCREF(Py_NotImplemented); + return Py_NotImplemented; + } + res = PyBool_FromLong( (SwigPyObject_compare(v, w)==0) == (op == Py_EQ) ? 1 : 0); + return res; +} + + +SWIGRUNTIME PyTypeObject* SwigPyObject_TypeOnce(void); + +#ifdef SWIGPYTHON_BUILTIN +static swig_type_info *SwigPyObject_stype = 0; +SWIGRUNTIME PyTypeObject* +SwigPyObject_type(void) { + SwigPyClientData *cd; + assert(SwigPyObject_stype); + cd = (SwigPyClientData*) SwigPyObject_stype->clientdata; + assert(cd); + assert(cd->pytype); + return cd->pytype; +} +#else +SWIGRUNTIME PyTypeObject* +SwigPyObject_type(void) { + static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyObject_TypeOnce(); + return type; +} +#endif + +SWIGRUNTIMEINLINE int +SwigPyObject_Check(PyObject *op) { +#ifdef SWIGPYTHON_BUILTIN + PyTypeObject *target_tp = SwigPyObject_type(); + if (PyType_IsSubtype(op->ob_type, target_tp)) + return 1; + return (strcmp(op->ob_type->tp_name, "SwigPyObject") == 0); +#else + return (Py_TYPE(op) == SwigPyObject_type()) + || (strcmp(Py_TYPE(op)->tp_name,"SwigPyObject") == 0); +#endif +} + +SWIGRUNTIME PyObject * +SwigPyObject_New(void *ptr, swig_type_info *ty, int own); + +SWIGRUNTIME void +SwigPyObject_dealloc(PyObject *v) +{ + SwigPyObject *sobj = (SwigPyObject *) v; + PyObject *next = sobj->next; + if (sobj->own == SWIG_POINTER_OWN) { + swig_type_info *ty = sobj->ty; + SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0; + PyObject *destroy = data ? data->destroy : 0; + if (destroy) { + /* destroy is always a VARARGS method */ + PyObject *res; + + /* PyObject_CallFunction() has the potential to silently drop + the active exception. In cases of unnamed temporary + variable or where we just finished iterating over a generator + StopIteration will be active right now, and this needs to + remain true upon return from SwigPyObject_dealloc. So save + and restore. */ + + PyObject *type = NULL, *value = NULL, *traceback = NULL; + PyErr_Fetch(&type, &value, &traceback); + + if (data->delargs) { + /* we need to create a temporary object to carry the destroy operation */ + PyObject *tmp = SwigPyObject_New(sobj->ptr, ty, 0); + res = SWIG_Python_CallFunctor(destroy, tmp); + Py_DECREF(tmp); + } else { + PyCFunction meth = PyCFunction_GET_FUNCTION(destroy); + PyObject *mself = PyCFunction_GET_SELF(destroy); + res = ((*meth)(mself, v)); + } + if (!res) + PyErr_WriteUnraisable(destroy); + + PyErr_Restore(type, value, traceback); + + Py_XDECREF(res); + } +#if !defined(SWIG_PYTHON_SILENT_MEMLEAK) + else { + const char *name = SWIG_TypePrettyName(ty); + printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown")); + } +#endif + } + Py_XDECREF(next); + PyObject_DEL(v); +} + +SWIGRUNTIME PyObject* +SwigPyObject_append(PyObject* v, PyObject* next) +{ + SwigPyObject *sobj = (SwigPyObject *) v; + if (!SwigPyObject_Check(next)) { + PyErr_SetString(PyExc_TypeError, "Attempt to append a non SwigPyObject"); + return NULL; + } + sobj->next = next; + Py_INCREF(next); + return SWIG_Py_Void(); +} + +SWIGRUNTIME PyObject* +SwigPyObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) +{ + SwigPyObject *sobj = (SwigPyObject *) v; + if (sobj->next) { + Py_INCREF(sobj->next); + return sobj->next; + } else { + return SWIG_Py_Void(); + } +} + +SWIGINTERN PyObject* +SwigPyObject_disown(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) +{ + SwigPyObject *sobj = (SwigPyObject *)v; + sobj->own = 0; + return SWIG_Py_Void(); +} + +SWIGINTERN PyObject* +SwigPyObject_acquire(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) +{ + SwigPyObject *sobj = (SwigPyObject *)v; + sobj->own = SWIG_POINTER_OWN; + return SWIG_Py_Void(); +} + +SWIGINTERN PyObject* +SwigPyObject_own(PyObject *v, PyObject *args) +{ + PyObject *val = 0; + if (!PyArg_UnpackTuple(args, "own", 0, 1, &val)) { + return NULL; + } else { + SwigPyObject *sobj = (SwigPyObject *)v; + PyObject *obj = PyBool_FromLong(sobj->own); + if (val) { + if (PyObject_IsTrue(val)) { + SwigPyObject_acquire(v,args); + } else { + SwigPyObject_disown(v,args); + } + } + return obj; + } +} + +static PyMethodDef +swigobject_methods[] = { + {"disown", SwigPyObject_disown, METH_NOARGS, "releases ownership of the pointer"}, + {"acquire", SwigPyObject_acquire, METH_NOARGS, "acquires ownership of the pointer"}, + {"own", SwigPyObject_own, METH_VARARGS, "returns/sets ownership of the pointer"}, + {"append", SwigPyObject_append, METH_O, "appends another 'this' object"}, + {"next", SwigPyObject_next, METH_NOARGS, "returns the next 'this' object"}, + {"__repr__",SwigPyObject_repr2, METH_NOARGS, "returns object representation"}, + {0, 0, 0, 0} +}; + +SWIGRUNTIME PyTypeObject* +SwigPyObject_TypeOnce(void) { + static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer"; + + static PyNumberMethods SwigPyObject_as_number = { + (binaryfunc)0, /*nb_add*/ + (binaryfunc)0, /*nb_subtract*/ + (binaryfunc)0, /*nb_multiply*/ + /* nb_divide removed in Python 3 */ +#if PY_VERSION_HEX < 0x03000000 + (binaryfunc)0, /*nb_divide*/ +#endif + (binaryfunc)0, /*nb_remainder*/ + (binaryfunc)0, /*nb_divmod*/ + (ternaryfunc)0,/*nb_power*/ + (unaryfunc)0, /*nb_negative*/ + (unaryfunc)0, /*nb_positive*/ + (unaryfunc)0, /*nb_absolute*/ + (inquiry)0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ +#if PY_VERSION_HEX < 0x03000000 + 0, /*nb_coerce*/ +#endif + (unaryfunc)SwigPyObject_long, /*nb_int*/ +#if PY_VERSION_HEX < 0x03000000 + (unaryfunc)SwigPyObject_long, /*nb_long*/ +#else + 0, /*nb_reserved*/ +#endif + (unaryfunc)0, /*nb_float*/ +#if PY_VERSION_HEX < 0x03000000 + (unaryfunc)SwigPyObject_oct, /*nb_oct*/ + (unaryfunc)SwigPyObject_hex, /*nb_hex*/ +#endif +#if PY_VERSION_HEX >= 0x03050000 /* 3.5 */ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_matrix_multiply */ +#elif PY_VERSION_HEX >= 0x03000000 /* 3.0 */ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index, nb_inplace_divide removed */ +#else + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index */ +#endif + }; + + static PyTypeObject swigpyobject_type; + static int type_init = 0; + if (!type_init) { + const PyTypeObject tmp = { +#if PY_VERSION_HEX >= 0x03000000 + PyVarObject_HEAD_INIT(NULL, 0) +#else + PyObject_HEAD_INIT(NULL) + 0, /* ob_size */ +#endif + "SwigPyObject", /* tp_name */ + sizeof(SwigPyObject), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)SwigPyObject_dealloc, /* tp_dealloc */ + 0, /* tp_print */ + (getattrfunc)0, /* tp_getattr */ + (setattrfunc)0, /* tp_setattr */ +#if PY_VERSION_HEX >= 0x03000000 + 0, /* tp_reserved in 3.0.1, tp_compare in 3.0.0 but not used */ +#else + (cmpfunc)SwigPyObject_compare, /* tp_compare */ +#endif + (reprfunc)SwigPyObject_repr, /* tp_repr */ + &SwigPyObject_as_number, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + (hashfunc)0, /* tp_hash */ + (ternaryfunc)0, /* tp_call */ + 0, /* tp_str */ + PyObject_GenericGetAttr, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT, /* tp_flags */ + swigobject_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + (richcmpfunc)SwigPyObject_richcompare,/* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + swigobject_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + 0, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ + 0, /* tp_free */ + 0, /* tp_is_gc */ + 0, /* tp_bases */ + 0, /* tp_mro */ + 0, /* tp_cache */ + 0, /* tp_subclasses */ + 0, /* tp_weaklist */ + 0, /* tp_del */ + 0, /* tp_version_tag */ +#if PY_VERSION_HEX >= 0x03040000 + 0, /* tp_finalize */ +#endif +#if PY_VERSION_HEX >= 0x03080000 + 0, /* tp_vectorcall */ +#endif +#if (PY_VERSION_HEX >= 0x03080000) && (PY_VERSION_HEX < 0x03090000) + 0, /* tp_print */ +#endif +#ifdef COUNT_ALLOCS + 0, /* tp_allocs */ + 0, /* tp_frees */ + 0, /* tp_maxalloc */ + 0, /* tp_prev */ + 0 /* tp_next */ +#endif + }; + swigpyobject_type = tmp; + type_init = 1; + if (PyType_Ready(&swigpyobject_type) < 0) + return NULL; + } + return &swigpyobject_type; +} + +SWIGRUNTIME PyObject * +SwigPyObject_New(void *ptr, swig_type_info *ty, int own) +{ + SwigPyObject *sobj = PyObject_NEW(SwigPyObject, SwigPyObject_type()); + if (sobj) { + sobj->ptr = ptr; + sobj->ty = ty; + sobj->own = own; + sobj->next = 0; + } + return (PyObject *)sobj; +} + +/* ----------------------------------------------------------------------------- + * Implements a simple Swig Packed type, and use it instead of string + * ----------------------------------------------------------------------------- */ + +typedef struct { + PyObject_HEAD + void *pack; + swig_type_info *ty; + size_t size; +} SwigPyPacked; + +SWIGRUNTIME PyObject * +SwigPyPacked_repr(SwigPyPacked *v) +{ + char result[SWIG_BUFFER_SIZE]; + if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) { + return SWIG_Python_str_FromFormat("<Swig Packed at %s%s>", result, v->ty->name); + } else { + return SWIG_Python_str_FromFormat("<Swig Packed %s>", v->ty->name); + } +} + +SWIGRUNTIME PyObject * +SwigPyPacked_str(SwigPyPacked *v) +{ + char result[SWIG_BUFFER_SIZE]; + if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))){ + return SWIG_Python_str_FromFormat("%s%s", result, v->ty->name); + } else { + return SWIG_Python_str_FromChar(v->ty->name); + } +} + +SWIGRUNTIME int +SwigPyPacked_compare(SwigPyPacked *v, SwigPyPacked *w) +{ + size_t i = v->size; + size_t j = w->size; + int s = (i < j) ? -1 : ((i > j) ? 1 : 0); + return s ? s : strncmp((const char *)v->pack, (const char *)w->pack, 2*v->size); +} + +SWIGRUNTIME PyTypeObject* SwigPyPacked_TypeOnce(void); + +SWIGRUNTIME PyTypeObject* +SwigPyPacked_type(void) { + static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyPacked_TypeOnce(); + return type; +} + +SWIGRUNTIMEINLINE int +SwigPyPacked_Check(PyObject *op) { + return ((op)->ob_type == SwigPyPacked_TypeOnce()) + || (strcmp((op)->ob_type->tp_name,"SwigPyPacked") == 0); +} + +SWIGRUNTIME void +SwigPyPacked_dealloc(PyObject *v) +{ + if (SwigPyPacked_Check(v)) { + SwigPyPacked *sobj = (SwigPyPacked *) v; + free(sobj->pack); + } + PyObject_DEL(v); +} + +SWIGRUNTIME PyTypeObject* +SwigPyPacked_TypeOnce(void) { + static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer"; + static PyTypeObject swigpypacked_type; + static int type_init = 0; + if (!type_init) { + const PyTypeObject tmp = { +#if PY_VERSION_HEX>=0x03000000 + PyVarObject_HEAD_INIT(NULL, 0) +#else + PyObject_HEAD_INIT(NULL) + 0, /* ob_size */ +#endif + "SwigPyPacked", /* tp_name */ + sizeof(SwigPyPacked), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)SwigPyPacked_dealloc, /* tp_dealloc */ + 0, /* tp_print */ + (getattrfunc)0, /* tp_getattr */ + (setattrfunc)0, /* tp_setattr */ +#if PY_VERSION_HEX>=0x03000000 + 0, /* tp_reserved in 3.0.1 */ +#else + (cmpfunc)SwigPyPacked_compare, /* tp_compare */ +#endif + (reprfunc)SwigPyPacked_repr, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + (hashfunc)0, /* tp_hash */ + (ternaryfunc)0, /* tp_call */ + (reprfunc)SwigPyPacked_str, /* tp_str */ + PyObject_GenericGetAttr, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT, /* tp_flags */ + swigpacked_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + 0, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ + 0, /* tp_free */ + 0, /* tp_is_gc */ + 0, /* tp_bases */ + 0, /* tp_mro */ + 0, /* tp_cache */ + 0, /* tp_subclasses */ + 0, /* tp_weaklist */ + 0, /* tp_del */ + 0, /* tp_version_tag */ +#if PY_VERSION_HEX >= 0x03040000 + 0, /* tp_finalize */ +#endif +#if PY_VERSION_HEX >= 0x03080000 + 0, /* tp_vectorcall */ +#endif +#if (PY_VERSION_HEX >= 0x03080000) && (PY_VERSION_HEX < 0x03090000) + 0, /* tp_print */ +#endif +#ifdef COUNT_ALLOCS + 0, /* tp_allocs */ + 0, /* tp_frees */ + 0, /* tp_maxalloc */ + 0, /* tp_prev */ + 0 /* tp_next */ +#endif + }; + swigpypacked_type = tmp; + type_init = 1; + if (PyType_Ready(&swigpypacked_type) < 0) + return NULL; + } + return &swigpypacked_type; +} + +SWIGRUNTIME PyObject * +SwigPyPacked_New(void *ptr, size_t size, swig_type_info *ty) +{ + SwigPyPacked *sobj = PyObject_NEW(SwigPyPacked, SwigPyPacked_type()); + if (sobj) { + void *pack = malloc(size); + if (pack) { + memcpy(pack, ptr, size); + sobj->pack = pack; + sobj->ty = ty; + sobj->size = size; + } else { + PyObject_DEL((PyObject *) sobj); + sobj = 0; + } + } + return (PyObject *) sobj; +} + +SWIGRUNTIME swig_type_info * +SwigPyPacked_UnpackData(PyObject *obj, void *ptr, size_t size) +{ + if (SwigPyPacked_Check(obj)) { + SwigPyPacked *sobj = (SwigPyPacked *)obj; + if (sobj->size != size) return 0; + memcpy(ptr, sobj->pack, size); + return sobj->ty; + } else { + return 0; + } +} + +/* ----------------------------------------------------------------------------- + * pointers/data manipulation + * ----------------------------------------------------------------------------- */ + +static PyObject *Swig_This_global = NULL; + +SWIGRUNTIME PyObject * +SWIG_This(void) +{ + if (Swig_This_global == NULL) + Swig_This_global = SWIG_Python_str_FromChar("this"); + return Swig_This_global; +} + +/* #define SWIG_PYTHON_SLOW_GETSET_THIS */ + +/* TODO: I don't know how to implement the fast getset in Python 3 right now */ +#if PY_VERSION_HEX>=0x03000000 +#define SWIG_PYTHON_SLOW_GETSET_THIS +#endif + +SWIGRUNTIME SwigPyObject * +SWIG_Python_GetSwigThis(PyObject *pyobj) +{ + PyObject *obj; + + if (SwigPyObject_Check(pyobj)) + return (SwigPyObject *) pyobj; + +#ifdef SWIGPYTHON_BUILTIN + (void)obj; +# ifdef PyWeakref_CheckProxy + if (PyWeakref_CheckProxy(pyobj)) { + pyobj = PyWeakref_GET_OBJECT(pyobj); + if (pyobj && SwigPyObject_Check(pyobj)) + return (SwigPyObject*) pyobj; + } +# endif + return NULL; +#else + + obj = 0; + +#if !defined(SWIG_PYTHON_SLOW_GETSET_THIS) + if (PyInstance_Check(pyobj)) { + obj = _PyInstance_Lookup(pyobj, SWIG_This()); + } else { + PyObject **dictptr = _PyObject_GetDictPtr(pyobj); + if (dictptr != NULL) { + PyObject *dict = *dictptr; + obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0; + } else { +#ifdef PyWeakref_CheckProxy + if (PyWeakref_CheckProxy(pyobj)) { + PyObject *wobj = PyWeakref_GET_OBJECT(pyobj); + return wobj ? SWIG_Python_GetSwigThis(wobj) : 0; + } +#endif + obj = PyObject_GetAttr(pyobj,SWIG_This()); + if (obj) { + Py_DECREF(obj); + } else { + if (PyErr_Occurred()) PyErr_Clear(); + return 0; + } + } + } +#else + obj = PyObject_GetAttr(pyobj,SWIG_This()); + if (obj) { + Py_DECREF(obj); + } else { + if (PyErr_Occurred()) PyErr_Clear(); + return 0; + } +#endif + if (obj && !SwigPyObject_Check(obj)) { + /* a PyObject is called 'this', try to get the 'real this' + SwigPyObject from it */ + return SWIG_Python_GetSwigThis(obj); + } + return (SwigPyObject *)obj; +#endif +} + +/* Acquire a pointer value */ + +SWIGRUNTIME int +SWIG_Python_AcquirePtr(PyObject *obj, int own) { + if (own == SWIG_POINTER_OWN) { + SwigPyObject *sobj = SWIG_Python_GetSwigThis(obj); + if (sobj) { + int oldown = sobj->own; + sobj->own = own; + return oldown; + } + } + return 0; +} + +/* Convert a pointer value */ + +SWIGRUNTIME int +SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int flags, int *own) { + int res; + SwigPyObject *sobj; + int implicit_conv = (flags & SWIG_POINTER_IMPLICIT_CONV) != 0; + + if (!obj) + return SWIG_ERROR; + if (obj == Py_None && !implicit_conv) { + if (ptr) + *ptr = 0; + return (flags & SWIG_POINTER_NO_NULL) ? SWIG_NullReferenceError : SWIG_OK; + } + + res = SWIG_ERROR; + + sobj = SWIG_Python_GetSwigThis(obj); + if (own) + *own = 0; + while (sobj) { + void *vptr = sobj->ptr; + if (ty) { + swig_type_info *to = sobj->ty; + if (to == ty) { + /* no type cast needed */ + if (ptr) *ptr = vptr; + break; + } else { + swig_cast_info *tc = SWIG_TypeCheck(to->name,ty); + if (!tc) { + sobj = (SwigPyObject *)sobj->next; + } else { + if (ptr) { + int newmemory = 0; + *ptr = SWIG_TypeCast(tc,vptr,&newmemory); + if (newmemory == SWIG_CAST_NEW_MEMORY) { + assert(own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */ + if (own) + *own = *own | SWIG_CAST_NEW_MEMORY; + } + } + break; + } + } + } else { + if (ptr) *ptr = vptr; + break; + } + } + if (sobj) { + if (own) + *own = *own | sobj->own; + if (flags & SWIG_POINTER_DISOWN) { + sobj->own = 0; + } + res = SWIG_OK; + } else { + if (implicit_conv) { + SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0; + if (data && !data->implicitconv) { + PyObject *klass = data->klass; + if (klass) { + PyObject *impconv; + data->implicitconv = 1; /* avoid recursion and call 'explicit' constructors*/ + impconv = SWIG_Python_CallFunctor(klass, obj); + data->implicitconv = 0; + if (PyErr_Occurred()) { + PyErr_Clear(); + impconv = 0; + } + if (impconv) { + SwigPyObject *iobj = SWIG_Python_GetSwigThis(impconv); + if (iobj) { + void *vptr; + res = SWIG_Python_ConvertPtrAndOwn((PyObject*)iobj, &vptr, ty, 0, 0); + if (SWIG_IsOK(res)) { + if (ptr) { + *ptr = vptr; + /* transfer the ownership to 'ptr' */ + iobj->own = 0; + res = SWIG_AddCast(res); + res = SWIG_AddNewMask(res); + } else { + res = SWIG_AddCast(res); + } + } + } + Py_DECREF(impconv); + } + } + } + if (!SWIG_IsOK(res) && obj == Py_None) { + if (ptr) + *ptr = 0; + if (PyErr_Occurred()) + PyErr_Clear(); + res = SWIG_OK; + } + } + } + return res; +} + +/* Convert a function ptr value */ + +SWIGRUNTIME int +SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) { + if (!PyCFunction_Check(obj)) { + return SWIG_ConvertPtr(obj, ptr, ty, 0); + } else { + void *vptr = 0; + swig_cast_info *tc; + + /* here we get the method pointer for callbacks */ + const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc); + const char *desc = doc ? strstr(doc, "swig_ptr: ") : 0; + if (desc) + desc = ty ? SWIG_UnpackVoidPtr(desc + 10, &vptr, ty->name) : 0; + if (!desc) + return SWIG_ERROR; + tc = SWIG_TypeCheck(desc,ty); + if (tc) { + int newmemory = 0; + *ptr = SWIG_TypeCast(tc,vptr,&newmemory); + assert(!newmemory); /* newmemory handling not yet implemented */ + } else { + return SWIG_ERROR; + } + return SWIG_OK; + } +} + +/* Convert a packed pointer value */ + +SWIGRUNTIME int +SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *ty) { + swig_type_info *to = SwigPyPacked_UnpackData(obj, ptr, sz); + if (!to) return SWIG_ERROR; + if (ty) { + if (to != ty) { + /* check type cast? */ + swig_cast_info *tc = SWIG_TypeCheck(to->name,ty); + if (!tc) return SWIG_ERROR; + } + } + return SWIG_OK; +} + +/* ----------------------------------------------------------------------------- + * Create a new pointer object + * ----------------------------------------------------------------------------- */ + +/* + Create a new instance object, without calling __init__, and set the + 'this' attribute. +*/ + +SWIGRUNTIME PyObject* +SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this) +{ + PyObject *inst = 0; + PyObject *newraw = data->newraw; + if (newraw) { + inst = PyObject_Call(newraw, data->newargs, NULL); + if (inst) { +#if !defined(SWIG_PYTHON_SLOW_GETSET_THIS) + PyObject **dictptr = _PyObject_GetDictPtr(inst); + if (dictptr != NULL) { + PyObject *dict = *dictptr; + if (dict == NULL) { + dict = PyDict_New(); + *dictptr = dict; + PyDict_SetItem(dict, SWIG_This(), swig_this); + } + } +#else + if (PyObject_SetAttr(inst, SWIG_This(), swig_this) == -1) { + Py_DECREF(inst); + inst = 0; + } +#endif + } + } else { +#if PY_VERSION_HEX >= 0x03000000 + PyObject *empty_args = PyTuple_New(0); + if (empty_args) { + PyObject *empty_kwargs = PyDict_New(); + if (empty_kwargs) { + inst = ((PyTypeObject *)data->newargs)->tp_new((PyTypeObject *)data->newargs, empty_args, empty_kwargs); + Py_DECREF(empty_kwargs); + if (inst) { + if (PyObject_SetAttr(inst, SWIG_This(), swig_this) == -1) { + Py_DECREF(inst); + inst = 0; + } else { + Py_TYPE(inst)->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG; + } + } + } + Py_DECREF(empty_args); + } +#else + PyObject *dict = PyDict_New(); + if (dict) { + PyDict_SetItem(dict, SWIG_This(), swig_this); + inst = PyInstance_NewRaw(data->newargs, dict); + Py_DECREF(dict); + } +#endif + } + return inst; +} + +SWIGRUNTIME int +SWIG_Python_SetSwigThis(PyObject *inst, PyObject *swig_this) +{ +#if !defined(SWIG_PYTHON_SLOW_GETSET_THIS) + PyObject **dictptr = _PyObject_GetDictPtr(inst); + if (dictptr != NULL) { + PyObject *dict = *dictptr; + if (dict == NULL) { + dict = PyDict_New(); + *dictptr = dict; + } + return PyDict_SetItem(dict, SWIG_This(), swig_this); + } +#endif + return PyObject_SetAttr(inst, SWIG_This(), swig_this); +} + + +SWIGINTERN PyObject * +SWIG_Python_InitShadowInstance(PyObject *args) { + PyObject *obj[2]; + if (!SWIG_Python_UnpackTuple(args, "swiginit", 2, 2, obj)) { + return NULL; + } else { + SwigPyObject *sthis = SWIG_Python_GetSwigThis(obj[0]); + if (sthis) { + SwigPyObject_append((PyObject*) sthis, obj[1]); + } else { + if (SWIG_Python_SetSwigThis(obj[0], obj[1]) != 0) + return NULL; + } + return SWIG_Py_Void(); + } +} + +/* Create a new pointer object */ + +SWIGRUNTIME PyObject * +SWIG_Python_NewPointerObj(PyObject *self, void *ptr, swig_type_info *type, int flags) { + SwigPyClientData *clientdata; + PyObject * robj; + int own; + + if (!ptr) + return SWIG_Py_Void(); + + clientdata = type ? (SwigPyClientData *)(type->clientdata) : 0; + own = (flags & SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0; + if (clientdata && clientdata->pytype) { + SwigPyObject *newobj; + if (flags & SWIG_BUILTIN_TP_INIT) { + newobj = (SwigPyObject*) self; + if (newobj->ptr) { + PyObject *next_self = clientdata->pytype->tp_alloc(clientdata->pytype, 0); + while (newobj->next) + newobj = (SwigPyObject *) newobj->next; + newobj->next = next_self; + newobj = (SwigPyObject *)next_self; +#ifdef SWIGPYTHON_BUILTIN + newobj->dict = 0; +#endif + } + } else { + newobj = PyObject_New(SwigPyObject, clientdata->pytype); +#ifdef SWIGPYTHON_BUILTIN + newobj->dict = 0; +#endif + } + if (newobj) { + newobj->ptr = ptr; + newobj->ty = type; + newobj->own = own; + newobj->next = 0; + return (PyObject*) newobj; + } + return SWIG_Py_Void(); + } + + assert(!(flags & SWIG_BUILTIN_TP_INIT)); + + robj = SwigPyObject_New(ptr, type, own); + if (robj && clientdata && !(flags & SWIG_POINTER_NOSHADOW)) { + PyObject *inst = SWIG_Python_NewShadowInstance(clientdata, robj); + Py_DECREF(robj); + robj = inst; + } + return robj; +} + +/* Create a new packed object */ + +SWIGRUNTIMEINLINE PyObject * +SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) { + return ptr ? SwigPyPacked_New((void *) ptr, sz, type) : SWIG_Py_Void(); +} + +/* -----------------------------------------------------------------------------* + * Get type list + * -----------------------------------------------------------------------------*/ + +#ifdef SWIG_LINK_RUNTIME +void *SWIG_ReturnGlobalTypeList(void *); +#endif + +SWIGRUNTIME swig_module_info * +SWIG_Python_GetModule(void *SWIGUNUSEDPARM(clientdata)) { + static void *type_pointer = (void *)0; + /* first check if module already created */ + if (!type_pointer) { +#ifdef SWIG_LINK_RUNTIME + type_pointer = SWIG_ReturnGlobalTypeList((void *)0); +#else + type_pointer = PyCapsule_Import(SWIGPY_CAPSULE_NAME, 0); + if (PyErr_Occurred()) { + PyErr_Clear(); + type_pointer = (void *)0; + } +#endif + } + return (swig_module_info *) type_pointer; +} + +SWIGRUNTIME void +SWIG_Python_DestroyModule(PyObject *obj) +{ + swig_module_info *swig_module = (swig_module_info *) PyCapsule_GetPointer(obj, SWIGPY_CAPSULE_NAME); + swig_type_info **types = swig_module->types; + size_t i; + for (i =0; i < swig_module->size; ++i) { + swig_type_info *ty = types[i]; + if (ty->owndata) { + SwigPyClientData *data = (SwigPyClientData *) ty->clientdata; + if (data) SwigPyClientData_Del(data); + } + } + Py_DECREF(SWIG_This()); + Swig_This_global = NULL; +} + +SWIGRUNTIME void +SWIG_Python_SetModule(swig_module_info *swig_module) { +#if PY_VERSION_HEX >= 0x03000000 + /* Add a dummy module object into sys.modules */ + PyObject *module = PyImport_AddModule("swig_runtime_data" SWIG_RUNTIME_VERSION); +#else + static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} }; /* Sentinel */ + PyObject *module = Py_InitModule("swig_runtime_data" SWIG_RUNTIME_VERSION, swig_empty_runtime_method_table); +#endif + PyObject *pointer = PyCapsule_New((void *) swig_module, SWIGPY_CAPSULE_NAME, SWIG_Python_DestroyModule); + if (pointer && module) { + PyModule_AddObject(module, "type_pointer_capsule" SWIG_TYPE_TABLE_NAME, pointer); + } else { + Py_XDECREF(pointer); + } +} + +/* The python cached type query */ +SWIGRUNTIME PyObject * +SWIG_Python_TypeCache(void) { + static PyObject *SWIG_STATIC_POINTER(cache) = PyDict_New(); + return cache; +} + +SWIGRUNTIME swig_type_info * +SWIG_Python_TypeQuery(const char *type) +{ + PyObject *cache = SWIG_Python_TypeCache(); + PyObject *key = SWIG_Python_str_FromChar(type); + PyObject *obj = PyDict_GetItem(cache, key); + swig_type_info *descriptor; + if (obj) { + descriptor = (swig_type_info *) PyCapsule_GetPointer(obj, NULL); + } else { + swig_module_info *swig_module = SWIG_GetModule(0); + descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type); + if (descriptor) { + obj = PyCapsule_New((void*) descriptor, NULL, NULL); + PyDict_SetItem(cache, key, obj); + Py_DECREF(obj); + } + } + Py_DECREF(key); + return descriptor; +} + +/* + For backward compatibility only +*/ +#define SWIG_POINTER_EXCEPTION 0 +#define SWIG_arg_fail(arg) SWIG_Python_ArgFail(arg) +#define SWIG_MustGetPtr(p, type, argnum, flags) SWIG_Python_MustGetPtr(p, type, argnum, flags) + +SWIGRUNTIME int +SWIG_Python_AddErrMesg(const char* mesg, int infront) +{ + if (PyErr_Occurred()) { + PyObject *type = 0; + PyObject *value = 0; + PyObject *traceback = 0; + PyErr_Fetch(&type, &value, &traceback); + if (value) { + PyObject *old_str = PyObject_Str(value); + const char *tmp = SWIG_Python_str_AsChar(old_str); + const char *errmesg = tmp ? tmp : "Invalid error message"; + Py_XINCREF(type); + PyErr_Clear(); + if (infront) { + PyErr_Format(type, "%s %s", mesg, errmesg); + } else { + PyErr_Format(type, "%s %s", errmesg, mesg); + } + SWIG_Python_str_DelForPy3(tmp); + Py_DECREF(old_str); + } + return 1; + } else { + return 0; + } +} + +SWIGRUNTIME int +SWIG_Python_ArgFail(int argnum) +{ + if (PyErr_Occurred()) { + /* add information about failing argument */ + char mesg[256]; + PyOS_snprintf(mesg, sizeof(mesg), "argument number %d:", argnum); + return SWIG_Python_AddErrMesg(mesg, 1); + } else { + return 0; + } +} + +SWIGRUNTIMEINLINE const char * +SwigPyObject_GetDesc(PyObject *self) +{ + SwigPyObject *v = (SwigPyObject *)self; + swig_type_info *ty = v ? v->ty : 0; + return ty ? ty->str : ""; +} + +SWIGRUNTIME void +SWIG_Python_TypeError(const char *type, PyObject *obj) +{ + if (type) { +#if defined(SWIG_COBJECT_TYPES) + if (obj && SwigPyObject_Check(obj)) { + const char *otype = (const char *) SwigPyObject_GetDesc(obj); + if (otype) { + PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'SwigPyObject(%s)' is received", + type, otype); + return; + } + } else +#endif + { + const char *otype = (obj ? obj->ob_type->tp_name : 0); + if (otype) { + PyObject *str = PyObject_Str(obj); + const char *cstr = str ? SWIG_Python_str_AsChar(str) : 0; + if (cstr) { + PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received", + type, otype, cstr); + SWIG_Python_str_DelForPy3(cstr); + } else { + PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received", + type, otype); + } + Py_XDECREF(str); + return; + } + } + PyErr_Format(PyExc_TypeError, "a '%s' is expected", type); + } else { + PyErr_Format(PyExc_TypeError, "unexpected type is received"); + } +} + + +/* Convert a pointer value, signal an exception on a type mismatch */ +SWIGRUNTIME void * +SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int SWIGUNUSEDPARM(argnum), int flags) { + void *result; + if (SWIG_Python_ConvertPtr(obj, &result, ty, flags) == -1) { + PyErr_Clear(); +#if SWIG_POINTER_EXCEPTION + if (flags) { + SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj); + SWIG_Python_ArgFail(argnum); + } +#endif + } + return result; +} + +#ifdef SWIGPYTHON_BUILTIN +SWIGRUNTIME int +SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { + PyTypeObject *tp = obj->ob_type; + PyObject *descr; + PyObject *encoded_name; + descrsetfunc f; + int res = -1; + +# ifdef Py_USING_UNICODE + if (PyString_Check(name)) { + name = PyUnicode_Decode(PyString_AsString(name), PyString_Size(name), NULL, NULL); + if (!name) + return -1; + } else if (!PyUnicode_Check(name)) +# else + if (!PyString_Check(name)) +# endif + { + PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%.200s'", name->ob_type->tp_name); + return -1; + } else { + Py_INCREF(name); + } + + if (!tp->tp_dict) { + if (PyType_Ready(tp) < 0) + goto done; + } + + descr = _PyType_Lookup(tp, name); + f = NULL; + if (descr != NULL) + f = descr->ob_type->tp_descr_set; + if (!f) { + if (PyString_Check(name)) { + encoded_name = name; + Py_INCREF(name); + } else { + encoded_name = PyUnicode_AsUTF8String(name); + if (!encoded_name) + return -1; + } + PyErr_Format(PyExc_AttributeError, "'%.100s' object has no attribute '%.200s'", tp->tp_name, PyString_AsString(encoded_name)); + Py_DECREF(encoded_name); + } else { + res = f(descr, obj, value); + } + + done: + Py_DECREF(name); + return res; +} +#endif + + +#ifdef __cplusplus +} +#endif + + + +#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) + +#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else + + + +#ifdef __cplusplus +extern "C" { +#endif + +/* Method creation and docstring support functions */ + +SWIGINTERN PyMethodDef *SWIG_PythonGetProxyDoc(const char *name); +SWIGINTERN PyObject *SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *func); +SWIGINTERN PyObject *SWIG_PyStaticMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *func); + +#ifdef __cplusplus +} +#endif + + + #define SWIG_exception(code, msg) do { SWIG_Error(code, msg); SWIG_fail;; } while(0) + + +/* -------- TYPES TABLE (BEGIN) -------- */ + +#define SWIGTYPE_p_Cdi swig_types[0] +#define SWIGTYPE_p_CdiGrid swig_types[1] +#define SWIGTYPE_p_CdiTaxis swig_types[2] +#define SWIGTYPE_p_CdiVariable swig_types[3] +#define SWIGTYPE_p_CdiZaxis swig_types[4] +#define SWIGTYPE_p_allocator_type swig_types[5] +#define SWIGTYPE_p_char swig_types[6] +#define SWIGTYPE_p_difference_type swig_types[7] +#define SWIGTYPE_p_double swig_types[8] +#define SWIGTYPE_p_float swig_types[9] +#define SWIGTYPE_p_key_type swig_types[10] +#define SWIGTYPE_p_mapped_type swig_types[11] +#define SWIGTYPE_p_p_PyObject swig_types[12] +#define SWIGTYPE_p_p_double swig_types[13] +#define SWIGTYPE_p_size_type swig_types[14] +#define SWIGTYPE_p_std__allocatorT_CdiVariable_t swig_types[15] +#define SWIGTYPE_p_std__allocatorT_double_t swig_types[16] +#define SWIGTYPE_p_std__allocatorT_int_t swig_types[17] +#define SWIGTYPE_p_std__allocatorT_std__pairT_int_const_CdiGrid_t_t swig_types[18] +#define SWIGTYPE_p_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t swig_types[19] +#define SWIGTYPE_p_std__allocatorT_std__pairT_int_const_CdiVariable_t_t swig_types[20] +#define SWIGTYPE_p_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t swig_types[21] +#define SWIGTYPE_p_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t swig_types[22] +#define SWIGTYPE_p_std__allocatorT_std__string_t swig_types[23] +#define SWIGTYPE_p_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t swig_types[24] +#define SWIGTYPE_p_std__invalid_argument swig_types[25] +#define SWIGTYPE_p_std__lessT_int_t swig_types[26] +#define SWIGTYPE_p_std__lessT_std__string_t swig_types[27] +#define SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t swig_types[28] +#define SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t swig_types[29] +#define SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t swig_types[30] +#define SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t swig_types[31] +#define SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t swig_types[32] +#define SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t swig_types[33] +#define SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t swig_types[34] +#define SWIGTYPE_p_std__vectorT_float_std__allocatorT_float_t_t swig_types[35] +#define SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t swig_types[36] +#define SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t swig_types[37] +#define SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t swig_types[38] +#define SWIGTYPE_p_std__vectorT_std__vectorT_float_std__allocatorT_float_t_t_std__allocatorT_std__vectorT_float_std__allocatorT_float_t_t_t_t swig_types[39] +#define SWIGTYPE_p_swig__SwigPyIterator swig_types[40] +#define SWIGTYPE_p_value_type swig_types[41] +static swig_type_info *swig_types[43]; +static swig_module_info swig_module = {swig_types, 42, 0, 0, 0, 0}; +#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name) +#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name) + +/* -------- TYPES TABLE (END) -------- */ + +#ifdef SWIG_TypeQuery +# undef SWIG_TypeQuery +#endif +#define SWIG_TypeQuery SWIG_Python_TypeQuery + +/*----------------------------------------------- + @(target):= _Cdi.so + ------------------------------------------------*/ +#if PY_VERSION_HEX >= 0x03000000 +# define SWIG_init PyInit__Cdi + +#else +# define SWIG_init init_Cdi + +#endif +#define SWIG_name "_Cdi" + +#define SWIGVERSION 0x040002 +#define SWIG_VERSION SWIGVERSION + + +#define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a)) +#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),reinterpret_cast< void** >(a)) + + +#include <stdexcept> + + +namespace swig { + class SwigPtr_PyObject { + protected: + PyObject *_obj; + + public: + SwigPtr_PyObject() :_obj(0) + { + } + + SwigPtr_PyObject(const SwigPtr_PyObject& item) : _obj(item._obj) + { + SWIG_PYTHON_THREAD_BEGIN_BLOCK; + Py_XINCREF(_obj); + SWIG_PYTHON_THREAD_END_BLOCK; + } + + SwigPtr_PyObject(PyObject *obj, bool initial_ref = true) :_obj(obj) + { + if (initial_ref) { + SWIG_PYTHON_THREAD_BEGIN_BLOCK; + Py_XINCREF(_obj); + SWIG_PYTHON_THREAD_END_BLOCK; + } + } + + SwigPtr_PyObject & operator=(const SwigPtr_PyObject& item) + { + SWIG_PYTHON_THREAD_BEGIN_BLOCK; + Py_XINCREF(item._obj); + Py_XDECREF(_obj); + _obj = item._obj; + SWIG_PYTHON_THREAD_END_BLOCK; + return *this; + } + + ~SwigPtr_PyObject() + { + SWIG_PYTHON_THREAD_BEGIN_BLOCK; + Py_XDECREF(_obj); + SWIG_PYTHON_THREAD_END_BLOCK; + } + + operator PyObject *() const + { + return _obj; + } + + PyObject *operator->() const + { + return _obj; + } + }; +} + + +namespace swig { + struct SwigVar_PyObject : SwigPtr_PyObject { + SwigVar_PyObject(PyObject* obj = 0) : SwigPtr_PyObject(obj, false) { } + + SwigVar_PyObject & operator = (PyObject* obj) + { + Py_XDECREF(_obj); + _obj = obj; + return *this; + } + }; +} + + +#define SWIG_FILE_WITH_INIT +#include "cdi.hpp" + + +#include <typeinfo> +#include <stdexcept> + + +#if defined(__GNUC__) +# if __GNUC__ == 2 && __GNUC_MINOR <= 96 +# define SWIG_STD_NOMODERN_STL +# endif +#endif + + +#include <string> + + +#include <stddef.h> + + +#include <iostream> + +#if PY_VERSION_HEX >= 0x03020000 +# define SWIGPY_SLICE_ARG(obj) ((PyObject*) (obj)) +#else +# define SWIGPY_SLICE_ARG(obj) ((PySliceObject*) (obj)) +#endif + + +namespace swig { + struct stop_iteration { + }; + + struct SwigPyIterator { + private: + SwigPtr_PyObject _seq; + + protected: + SwigPyIterator(PyObject *seq) : _seq(seq) + { + } + + public: + virtual ~SwigPyIterator() {} + + // Access iterator method, required by Python + virtual PyObject *value() const = 0; + + // Forward iterator method, required by Python + virtual SwigPyIterator *incr(size_t n = 1) = 0; + + // Backward iterator method, very common in C++, but not required in Python + virtual SwigPyIterator *decr(size_t /*n*/ = 1) + { + throw stop_iteration(); + } + + // Random access iterator methods, but not required in Python + virtual ptrdiff_t distance(const SwigPyIterator &/*x*/) const + { + throw std::invalid_argument("operation not supported"); + } + + virtual bool equal (const SwigPyIterator &/*x*/) const + { + throw std::invalid_argument("operation not supported"); + } + + // C++ common/needed methods + virtual SwigPyIterator *copy() const = 0; + + PyObject *next() + { + SWIG_PYTHON_THREAD_BEGIN_BLOCK; // disable threads + PyObject *obj = value(); + incr(); + SWIG_PYTHON_THREAD_END_BLOCK; // re-enable threads + return obj; + } + + /* Make an alias for Python 3.x */ + PyObject *__next__() + { + return next(); + } + + PyObject *previous() + { + SWIG_PYTHON_THREAD_BEGIN_BLOCK; // disable threads + decr(); + PyObject *obj = value(); + SWIG_PYTHON_THREAD_END_BLOCK; // re-enable threads + return obj; + } + + SwigPyIterator *advance(ptrdiff_t n) + { + return (n > 0) ? incr(n) : decr(-n); + } + + bool operator == (const SwigPyIterator& x) const + { + return equal(x); + } + + bool operator != (const SwigPyIterator& x) const + { + return ! operator==(x); + } + + SwigPyIterator& operator += (ptrdiff_t n) + { + return *advance(n); + } + + SwigPyIterator& operator -= (ptrdiff_t n) + { + return *advance(-n); + } + + SwigPyIterator* operator + (ptrdiff_t n) const + { + return copy()->advance(n); + } + + SwigPyIterator* operator - (ptrdiff_t n) const + { + return copy()->advance(-n); + } + + ptrdiff_t operator - (const SwigPyIterator& x) const + { + return x.distance(*this); + } + + static swig_type_info* descriptor() { + static int init = 0; + static swig_type_info* desc = 0; + if (!init) { + desc = SWIG_TypeQuery("swig::SwigPyIterator *"); + init = 1; + } + return desc; + } + }; + +#if defined(SWIGPYTHON_BUILTIN) + inline PyObject* make_output_iterator_builtin (PyObject *pyself) + { + Py_INCREF(pyself); + return pyself; + } +#endif +} + + +SWIGINTERN int +SWIG_AsVal_double (PyObject *obj, double *val) +{ + int res = SWIG_TypeError; + if (PyFloat_Check(obj)) { + if (val) *val = PyFloat_AsDouble(obj); + return SWIG_OK; +#if PY_VERSION_HEX < 0x03000000 + } else if (PyInt_Check(obj)) { + if (val) *val = (double) PyInt_AsLong(obj); + return SWIG_OK; +#endif + } else if (PyLong_Check(obj)) { + double v = PyLong_AsDouble(obj); + if (!PyErr_Occurred()) { + if (val) *val = v; + return SWIG_OK; + } else { + PyErr_Clear(); + } + } +#ifdef SWIG_PYTHON_CAST_MODE + { + int dispatch = 0; + double d = PyFloat_AsDouble(obj); + if (!PyErr_Occurred()) { + if (val) *val = d; + return SWIG_AddCast(SWIG_OK); + } else { + PyErr_Clear(); + } + if (!dispatch) { + long v = PyLong_AsLong(obj); + if (!PyErr_Occurred()) { + if (val) *val = v; + return SWIG_AddCast(SWIG_AddCast(SWIG_OK)); + } else { + PyErr_Clear(); + } + } + } +#endif + return res; +} + + +#include <float.h> + + +#include <math.h> + + +SWIGINTERNINLINE int +SWIG_CanCastAsInteger(double *d, double min, double max) { + double x = *d; + if ((min <= x && x <= max)) { + double fx = floor(x); + double cx = ceil(x); + double rd = ((x - fx) < 0.5) ? fx : cx; /* simple rint */ + if ((errno == EDOM) || (errno == ERANGE)) { + errno = 0; + } else { + double summ, reps, diff; + if (rd < x) { + diff = x - rd; + } else if (rd > x) { + diff = rd - x; + } else { + return 1; + } + summ = rd + x; + reps = diff/summ; + if (reps < 8*DBL_EPSILON) { + *d = rd; + return 1; + } + } + } + return 0; +} + + +SWIGINTERN int +SWIG_AsVal_unsigned_SS_long (PyObject *obj, unsigned long *val) +{ +#if PY_VERSION_HEX < 0x03000000 + if (PyInt_Check(obj)) { + long v = PyInt_AsLong(obj); + if (v >= 0) { + if (val) *val = v; + return SWIG_OK; + } else { + return SWIG_OverflowError; + } + } else +#endif + if (PyLong_Check(obj)) { + unsigned long v = PyLong_AsUnsignedLong(obj); + if (!PyErr_Occurred()) { + if (val) *val = v; + return SWIG_OK; + } else { + PyErr_Clear(); + return SWIG_OverflowError; + } + } +#ifdef SWIG_PYTHON_CAST_MODE + { + int dispatch = 0; + unsigned long v = PyLong_AsUnsignedLong(obj); + if (!PyErr_Occurred()) { + if (val) *val = v; + return SWIG_AddCast(SWIG_OK); + } else { + PyErr_Clear(); + } + if (!dispatch) { + double d; + int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d)); + if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, 0, ULONG_MAX)) { + if (val) *val = (unsigned long)(d); + return res; + } + } + } +#endif + return SWIG_TypeError; +} + + +#include <limits.h> +#if !defined(SWIG_NO_LLONG_MAX) +# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__) +# define LLONG_MAX __LONG_LONG_MAX__ +# define LLONG_MIN (-LLONG_MAX - 1LL) +# define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL) +# endif +#endif + + +#if defined(LLONG_MAX) && !defined(SWIG_LONG_LONG_AVAILABLE) +# define SWIG_LONG_LONG_AVAILABLE +#endif + + +#ifdef SWIG_LONG_LONG_AVAILABLE +SWIGINTERN int +SWIG_AsVal_unsigned_SS_long_SS_long (PyObject *obj, unsigned long long *val) +{ + int res = SWIG_TypeError; + if (PyLong_Check(obj)) { + unsigned long long v = PyLong_AsUnsignedLongLong(obj); + if (!PyErr_Occurred()) { + if (val) *val = v; + return SWIG_OK; + } else { + PyErr_Clear(); + res = SWIG_OverflowError; + } + } else { + unsigned long v; + res = SWIG_AsVal_unsigned_SS_long (obj,&v); + if (SWIG_IsOK(res)) { + if (val) *val = v; + return res; + } + } +#ifdef SWIG_PYTHON_CAST_MODE + { + const double mant_max = 1LL << DBL_MANT_DIG; + double d; + res = SWIG_AsVal_double (obj,&d); + if (SWIG_IsOK(res) && !SWIG_CanCastAsInteger(&d, 0, mant_max)) + return SWIG_OverflowError; + if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, 0, mant_max)) { + if (val) *val = (unsigned long long)(d); + return SWIG_AddCast(res); + } + res = SWIG_TypeError; + } +#endif + return res; +} +#endif + + +SWIGINTERNINLINE int +SWIG_AsVal_size_t (PyObject * obj, size_t *val) +{ + int res = SWIG_TypeError; +#ifdef SWIG_LONG_LONG_AVAILABLE + if (sizeof(size_t) <= sizeof(unsigned long)) { +#endif + unsigned long v; + res = SWIG_AsVal_unsigned_SS_long (obj, val ? &v : 0); + if (SWIG_IsOK(res) && val) *val = static_cast< size_t >(v); +#ifdef SWIG_LONG_LONG_AVAILABLE + } else if (sizeof(size_t) <= sizeof(unsigned long long)) { + unsigned long long v; + res = SWIG_AsVal_unsigned_SS_long_SS_long (obj, val ? &v : 0); + if (SWIG_IsOK(res) && val) *val = static_cast< size_t >(v); + } +#endif + return res; +} + + + #define SWIG_From_long PyInt_FromLong + + +#ifdef SWIG_LONG_LONG_AVAILABLE +SWIGINTERNINLINE PyObject* +SWIG_From_long_SS_long (long long value) +{ + return ((value < LONG_MIN) || (value > LONG_MAX)) ? + PyLong_FromLongLong(value) : PyInt_FromLong(static_cast< long >(value)); +} +#endif + + +SWIGINTERNINLINE PyObject * +SWIG_From_ptrdiff_t (ptrdiff_t value) +{ +#ifdef SWIG_LONG_LONG_AVAILABLE + if (sizeof(ptrdiff_t) <= sizeof(long)) { +#endif + return SWIG_From_long (static_cast< long >(value)); +#ifdef SWIG_LONG_LONG_AVAILABLE + } else { + /* assume sizeof(ptrdiff_t) <= sizeof(long long) */ + return SWIG_From_long_SS_long (static_cast< long long >(value)); + } +#endif +} + + +SWIGINTERNINLINE PyObject* + SWIG_From_bool (bool value) +{ + return PyBool_FromLong(value ? 1 : 0); +} + + +SWIGINTERN int +SWIG_AsVal_long (PyObject *obj, long* val) +{ +#if PY_VERSION_HEX < 0x03000000 + if (PyInt_Check(obj)) { + if (val) *val = PyInt_AsLong(obj); + return SWIG_OK; + } else +#endif + if (PyLong_Check(obj)) { + long v = PyLong_AsLong(obj); + if (!PyErr_Occurred()) { + if (val) *val = v; + return SWIG_OK; + } else { + PyErr_Clear(); + return SWIG_OverflowError; + } + } +#ifdef SWIG_PYTHON_CAST_MODE + { + int dispatch = 0; + long v = PyInt_AsLong(obj); + if (!PyErr_Occurred()) { + if (val) *val = v; + return SWIG_AddCast(SWIG_OK); + } else { + PyErr_Clear(); + } + if (!dispatch) { + double d; + int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d)); + if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) { + if (val) *val = (long)(d); + return res; + } + } + } +#endif + return SWIG_TypeError; +} + + +#ifdef SWIG_LONG_LONG_AVAILABLE +SWIGINTERN int +SWIG_AsVal_long_SS_long (PyObject *obj, long long *val) +{ + int res = SWIG_TypeError; + if (PyLong_Check(obj)) { + long long v = PyLong_AsLongLong(obj); + if (!PyErr_Occurred()) { + if (val) *val = v; + return SWIG_OK; + } else { + PyErr_Clear(); + res = SWIG_OverflowError; + } + } else { + long v; + res = SWIG_AsVal_long (obj,&v); + if (SWIG_IsOK(res)) { + if (val) *val = v; + return res; + } + } +#ifdef SWIG_PYTHON_CAST_MODE + { + const double mant_max = 1LL << DBL_MANT_DIG; + const double mant_min = -mant_max; + double d; + res = SWIG_AsVal_double (obj,&d); + if (SWIG_IsOK(res) && !SWIG_CanCastAsInteger(&d, mant_min, mant_max)) + return SWIG_OverflowError; + if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, mant_min, mant_max)) { + if (val) *val = (long long)(d); + return SWIG_AddCast(res); + } + res = SWIG_TypeError; + } +#endif + return res; +} +#endif + + +SWIGINTERNINLINE int +SWIG_AsVal_ptrdiff_t (PyObject * obj, ptrdiff_t *val) +{ + int res = SWIG_TypeError; +#ifdef SWIG_LONG_LONG_AVAILABLE + if (sizeof(ptrdiff_t) <= sizeof(long)) { +#endif + long v; + res = SWIG_AsVal_long (obj, val ? &v : 0); + if (SWIG_IsOK(res) && val) *val = static_cast< ptrdiff_t >(v); +#ifdef SWIG_LONG_LONG_AVAILABLE + } else if (sizeof(ptrdiff_t) <= sizeof(long long)) { + long long v; + res = SWIG_AsVal_long_SS_long (obj, val ? &v : 0); + if (SWIG_IsOK(res) && val) *val = static_cast< ptrdiff_t >(v); + } +#endif + return res; +} + + +#include <algorithm> + + +#include <vector> + + +#include <utility> + + +#include <map> + + +#include <algorithm> + + +namespace swig { + template <class Type> + struct noconst_traits { + typedef Type noconst_type; + }; + + template <class Type> + struct noconst_traits<const Type> { + typedef Type noconst_type; + }; + + /* + type categories + */ + struct pointer_category { }; + struct value_category { }; + + /* + General traits that provides type_name and type_info + */ + template <class Type> struct traits { }; + + template <class Type> + inline const char* type_name() { + return traits<typename noconst_traits<Type >::noconst_type >::type_name(); + } + + template <class Type> struct traits_info { + static swig_type_info *type_query(std::string name) { + name += " *"; + return SWIG_TypeQuery(name.c_str()); + } + static swig_type_info *type_info() { + static swig_type_info *info = type_query(type_name<Type>()); + return info; + } + }; + + /* + Partial specialization for pointers (traits_info) + */ + template <class Type> struct traits_info<Type *> { + static swig_type_info *type_query(std::string name) { + name += " *"; + return SWIG_TypeQuery(name.c_str()); + } + static swig_type_info *type_info() { + static swig_type_info *info = type_query(type_name<Type>()); + return info; + } + }; + + template <class Type> + inline swig_type_info *type_info() { + return traits_info<Type>::type_info(); + } + + /* + Partial specialization for pointers (traits) + */ + template <class Type> struct traits <Type *> { + typedef pointer_category category; + static std::string make_ptr_name(const char* name) { + std::string ptrname = name; + ptrname += " *"; + return ptrname; + } + static const char* type_name() { + static std::string name = make_ptr_name(swig::type_name<Type>()); + return name.c_str(); + } + }; + + template <class Type, class Category> + struct traits_as { }; + + template <class Type, class Category> + struct traits_check { }; + +} + + +namespace swig { + /* + Traits that provides the from method + */ + template <class Type> struct traits_from_ptr { + static PyObject *from(Type *val, int owner = 0) { + return SWIG_InternalNewPointerObj(val, type_info<Type>(), owner); + } + }; + + template <class Type> struct traits_from { + static PyObject *from(const Type& val) { + return traits_from_ptr<Type>::from(new Type(val), 1); + } + }; + + template <class Type> struct traits_from<Type *> { + static PyObject *from(Type* val) { + return traits_from_ptr<Type>::from(val, 0); + } + }; + + template <class Type> struct traits_from<const Type *> { + static PyObject *from(const Type* val) { + return traits_from_ptr<Type>::from(const_cast<Type*>(val), 0); + } + }; + + + template <class Type> + inline PyObject *from(const Type& val) { + return traits_from<Type>::from(val); + } + + template <class Type> + inline PyObject *from_ptr(Type* val, int owner) { + return traits_from_ptr<Type>::from(val, owner); + } + + /* + Traits that provides the asval/as/check method + */ + template <class Type> + struct traits_asptr { + static int asptr(PyObject *obj, Type **val) { + int res = SWIG_ERROR; + swig_type_info *descriptor = type_info<Type>(); + if (val) { + Type *p = 0; + int newmem = 0; + res = descriptor ? SWIG_ConvertPtrAndOwn(obj, (void **)&p, descriptor, 0, &newmem) : SWIG_ERROR; + if (SWIG_IsOK(res)) { + if (newmem & SWIG_CAST_NEW_MEMORY) { + res |= SWIG_NEWOBJMASK; + } + *val = p; + } + } else { + res = descriptor ? SWIG_ConvertPtr(obj, 0, descriptor, 0) : SWIG_ERROR; + } + return res; + } + }; + + template <class Type> + inline int asptr(PyObject *obj, Type **vptr) { + return traits_asptr<Type>::asptr(obj, vptr); + } + + template <class Type> + struct traits_asval { + static int asval(PyObject *obj, Type *val) { + if (val) { + Type *p = 0; + int res = traits_asptr<Type>::asptr(obj, &p); + if (!SWIG_IsOK(res)) return res; + if (p) { + typedef typename noconst_traits<Type>::noconst_type noconst_type; + *(const_cast<noconst_type*>(val)) = *p; + if (SWIG_IsNewObj(res)){ + delete p; + res = SWIG_DelNewMask(res); + } + return res; + } else { + return SWIG_ERROR; + } + } else { + return traits_asptr<Type>::asptr(obj, (Type **)(0)); + } + } + }; + + template <class Type> struct traits_asval<Type*> { + static int asval(PyObject *obj, Type **val) { + if (val) { + typedef typename noconst_traits<Type>::noconst_type noconst_type; + noconst_type *p = 0; + int res = traits_asptr<noconst_type>::asptr(obj, &p); + if (SWIG_IsOK(res)) { + *(const_cast<noconst_type**>(val)) = p; + } + return res; + } else { + return traits_asptr<Type>::asptr(obj, (Type **)(0)); + } + } + }; + + template <class Type> + inline int asval(PyObject *obj, Type *val) { + return traits_asval<Type>::asval(obj, val); + } + + template <class Type> + struct traits_as<Type, value_category> { + static Type as(PyObject *obj) { + Type v; + int res = asval(obj, &v); + if (!obj || !SWIG_IsOK(res)) { + if (!PyErr_Occurred()) { + ::SWIG_Error(SWIG_TypeError, swig::type_name<Type>()); + } + throw std::invalid_argument("bad type"); + } + return v; + } + }; + + template <class Type> + struct traits_as<Type, pointer_category> { + static Type as(PyObject *obj) { + Type *v = 0; + int res = (obj ? traits_asptr<Type>::asptr(obj, &v) : SWIG_ERROR); + if (SWIG_IsOK(res) && v) { + if (SWIG_IsNewObj(res)) { + Type r(*v); + delete v; + return r; + } else { + return *v; + } + } else { + if (!PyErr_Occurred()) { + SWIG_Error(SWIG_TypeError, swig::type_name<Type>()); + } + throw std::invalid_argument("bad type"); + } + } + }; + + template <class Type> + struct traits_as<Type*, pointer_category> { + static Type* as(PyObject *obj) { + Type *v = 0; + int res = (obj ? traits_asptr<Type>::asptr(obj, &v) : SWIG_ERROR); + if (SWIG_IsOK(res)) { + return v; + } else { + if (!PyErr_Occurred()) { + SWIG_Error(SWIG_TypeError, swig::type_name<Type>()); + } + throw std::invalid_argument("bad type"); + } + } + }; + + template <class Type> + inline Type as(PyObject *obj) { + return traits_as<Type, typename traits<Type>::category>::as(obj); + } + + template <class Type> + struct traits_check<Type, value_category> { + static bool check(PyObject *obj) { + int res = obj ? asval(obj, (Type *)(0)) : SWIG_ERROR; + return SWIG_IsOK(res) ? true : false; + } + }; + + template <class Type> + struct traits_check<Type, pointer_category> { + static bool check(PyObject *obj) { + int res = obj ? asptr(obj, (Type **)(0)) : SWIG_ERROR; + return SWIG_IsOK(res) ? true : false; + } + }; + + template <class Type> + inline bool check(PyObject *obj) { + return traits_check<Type, typename traits<Type>::category>::check(obj); + } +} + + +#include <functional> + +namespace std { + template <> + struct less <PyObject *> + { + bool + operator()(PyObject * v, PyObject *w) const + { + bool res; + SWIG_PYTHON_THREAD_BEGIN_BLOCK; + res = PyObject_RichCompareBool(v, w, Py_LT) ? true : false; + /* This may fall into a case of inconsistent + eg. ObjA > ObjX > ObjB + but ObjA < ObjB + */ + if( PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_TypeError) ) + { + /* Objects can't be compared, this mostly occurred in Python 3.0 */ + /* Compare their ptr directly for a workaround */ + res = (v < w); + PyErr_Clear(); + } + SWIG_PYTHON_THREAD_END_BLOCK; + return res; + } + }; + + template <> + struct less <swig::SwigPtr_PyObject> + { + bool + operator()(const swig::SwigPtr_PyObject& v, const swig::SwigPtr_PyObject& w) const + { + return std::less<PyObject *>()(v, w); + } + }; + + template <> + struct less <swig::SwigVar_PyObject> + { + bool + operator()(const swig::SwigVar_PyObject& v, const swig::SwigVar_PyObject& w) const + { + return std::less<PyObject *>()(v, w); + } + }; + +} + +namespace swig { + template <> struct traits<PyObject *> { + typedef value_category category; + static const char* type_name() { return "PyObject *"; } + }; + + template <> struct traits_asval<PyObject * > { + typedef PyObject * value_type; + static int asval(PyObject *obj, value_type *val) { + if (val) *val = obj; + return SWIG_OK; + } + }; + + template <> + struct traits_check<PyObject *, value_category> { + static bool check(PyObject *) { + return true; + } + }; + + template <> struct traits_from<PyObject *> { + typedef PyObject * value_type; + static PyObject *from(const value_type& val) { + Py_XINCREF(val); + return val; + } + }; + +} + +namespace swig { + template <class Difference> + inline size_t + check_index(Difference i, size_t size, bool insert = false) { + if ( i < 0 ) { + if ((size_t) (-i) <= size) + return (size_t) (i + size); + } else if ( (size_t) i < size ) { + return (size_t) i; + } else if (insert && ((size_t) i == size)) { + return size; + } + throw std::out_of_range("index out of range"); + } + + template <class Difference> + void + slice_adjust(Difference i, Difference j, Py_ssize_t step, size_t size, Difference &ii, Difference &jj, bool insert = false) { + if (step == 0) { + throw std::invalid_argument("slice step cannot be zero"); + } else if (step > 0) { + // Required range: 0 <= i < size, 0 <= j < size, i <= j + if (i < 0) { + ii = 0; + } else if (i < (Difference)size) { + ii = i; + } else if (insert && (i >= (Difference)size)) { + ii = (Difference)size; + } + if (j < 0) { + jj = 0; + } else { + jj = (j < (Difference)size) ? j : (Difference)size; + } + if (jj < ii) + jj = ii; + } else { + // Required range: -1 <= i < size-1, -1 <= j < size-1, i >= j + if (i < -1) { + ii = -1; + } else if (i < (Difference) size) { + ii = i; + } else if (i >= (Difference)(size-1)) { + ii = (Difference)(size-1); + } + if (j < -1) { + jj = -1; + } else { + jj = (j < (Difference)size ) ? j : (Difference)(size-1); + } + if (ii < jj) + ii = jj; + } + } + + template <class Sequence, class Difference> + inline typename Sequence::iterator + getpos(Sequence* self, Difference i) { + typename Sequence::iterator pos = self->begin(); + std::advance(pos, check_index(i,self->size())); + return pos; + } + + template <class Sequence, class Difference> + inline typename Sequence::const_iterator + cgetpos(const Sequence* self, Difference i) { + typename Sequence::const_iterator pos = self->begin(); + std::advance(pos, check_index(i,self->size())); + return pos; + } + + template <class Sequence> + inline void + erase(Sequence* seq, const typename Sequence::iterator& position) { + seq->erase(position); + } + + template <class Sequence> + struct traits_reserve { + static void reserve(Sequence & /*seq*/, typename Sequence::size_type /*n*/) { + // This should be specialized for types that support reserve + } + }; + + template <class Sequence, class Difference> + inline Sequence* + getslice(const Sequence* self, Difference i, Difference j, Py_ssize_t step) { + typename Sequence::size_type size = self->size(); + Difference ii = 0; + Difference jj = 0; + swig::slice_adjust(i, j, step, size, ii, jj); + + if (step > 0) { + typename Sequence::const_iterator sb = self->begin(); + typename Sequence::const_iterator se = self->begin(); + std::advance(sb,ii); + std::advance(se,jj); + if (step == 1) { + return new Sequence(sb, se); + } else { + Sequence *sequence = new Sequence(); + swig::traits_reserve<Sequence>::reserve(*sequence, (jj - ii + step - 1) / step); + typename Sequence::const_iterator it = sb; + while (it!=se) { + sequence->push_back(*it); + for (Py_ssize_t c=0; c<step && it!=se; ++c) + it++; + } + return sequence; + } + } else { + Sequence *sequence = new Sequence(); + swig::traits_reserve<Sequence>::reserve(*sequence, (ii - jj - step - 1) / -step); + typename Sequence::const_reverse_iterator sb = self->rbegin(); + typename Sequence::const_reverse_iterator se = self->rbegin(); + std::advance(sb,size-ii-1); + std::advance(se,size-jj-1); + typename Sequence::const_reverse_iterator it = sb; + while (it!=se) { + sequence->push_back(*it); + for (Py_ssize_t c=0; c<-step && it!=se; ++c) + it++; + } + return sequence; + } + } + + template <class Sequence, class Difference, class InputSeq> + inline void + setslice(Sequence* self, Difference i, Difference j, Py_ssize_t step, const InputSeq& is = InputSeq()) { + typename Sequence::size_type size = self->size(); + Difference ii = 0; + Difference jj = 0; + swig::slice_adjust(i, j, step, size, ii, jj, true); + if (step > 0) { + if (step == 1) { + size_t ssize = jj - ii; + if (ssize <= is.size()) { + // expanding/staying the same size + swig::traits_reserve<Sequence>::reserve(*self, self->size() - ssize + is.size()); + typename Sequence::iterator sb = self->begin(); + typename InputSeq::const_iterator isit = is.begin(); + std::advance(sb,ii); + std::advance(isit, jj - ii); + self->insert(std::copy(is.begin(), isit, sb), isit, is.end()); + } else { + // shrinking + typename Sequence::iterator sb = self->begin(); + typename Sequence::iterator se = self->begin(); + std::advance(sb,ii); + std::advance(se,jj); + self->erase(sb,se); + sb = self->begin(); + std::advance(sb,ii); + self->insert(sb, is.begin(), is.end()); + } + } else { + size_t replacecount = (jj - ii + step - 1) / step; + if (is.size() != replacecount) { + char msg[1024]; + sprintf(msg, "attempt to assign sequence of size %lu to extended slice of size %lu", (unsigned long)is.size(), (unsigned long)replacecount); + throw std::invalid_argument(msg); + } + typename Sequence::const_iterator isit = is.begin(); + typename Sequence::iterator it = self->begin(); + std::advance(it,ii); + for (size_t rc=0; rc<replacecount && it != self->end(); ++rc) { + *it++ = *isit++; + for (Py_ssize_t c=0; c<(step-1) && it != self->end(); ++c) + it++; + } + } + } else { + size_t replacecount = (ii - jj - step - 1) / -step; + if (is.size() != replacecount) { + char msg[1024]; + sprintf(msg, "attempt to assign sequence of size %lu to extended slice of size %lu", (unsigned long)is.size(), (unsigned long)replacecount); + throw std::invalid_argument(msg); + } + typename Sequence::const_iterator isit = is.begin(); + typename Sequence::reverse_iterator it = self->rbegin(); + std::advance(it,size-ii-1); + for (size_t rc=0; rc<replacecount && it != self->rend(); ++rc) { + *it++ = *isit++; + for (Py_ssize_t c=0; c<(-step-1) && it != self->rend(); ++c) + it++; + } + } + } + + template <class Sequence, class Difference> + inline void + delslice(Sequence* self, Difference i, Difference j, Py_ssize_t step) { + typename Sequence::size_type size = self->size(); + Difference ii = 0; + Difference jj = 0; + swig::slice_adjust(i, j, step, size, ii, jj, true); + if (step > 0) { + typename Sequence::iterator sb = self->begin(); + std::advance(sb,ii); + if (step == 1) { + typename Sequence::iterator se = self->begin(); + std::advance(se,jj); + self->erase(sb,se); + } else { + typename Sequence::iterator it = sb; + size_t delcount = (jj - ii + step - 1) / step; + while (delcount) { + it = self->erase(it); + for (Py_ssize_t c=0; c<(step-1) && it != self->end(); ++c) + it++; + delcount--; + } + } + } else { + typename Sequence::reverse_iterator sb = self->rbegin(); + std::advance(sb,size-ii-1); + typename Sequence::reverse_iterator it = sb; + size_t delcount = (ii - jj - step - 1) / -step; + while (delcount) { + it = typename Sequence::reverse_iterator(self->erase((++it).base())); + for (Py_ssize_t c=0; c<(-step-1) && it != self->rend(); ++c) + it++; + delcount--; + } + } + } +} + + +#if defined(__SUNPRO_CC) && defined(_RWSTD_VER) +# if !defined(SWIG_NO_STD_NOITERATOR_TRAITS_STL) +# define SWIG_STD_NOITERATOR_TRAITS_STL +# endif +#endif + +#if !defined(SWIG_STD_NOITERATOR_TRAITS_STL) +#include <iterator> +#else +namespace std { + template <class Iterator> + struct iterator_traits { + typedef ptrdiff_t difference_type; + typedef typename Iterator::value_type value_type; + }; + + template <class Iterator, class Category,class T, class Reference, class Pointer, class Distance> + struct iterator_traits<__reverse_bi_iterator<Iterator,Category,T,Reference,Pointer,Distance> > { + typedef Distance difference_type; + typedef T value_type; + }; + + template <class T> + struct iterator_traits<T*> { + typedef T value_type; + typedef ptrdiff_t difference_type; + }; + + template<typename _InputIterator> + inline typename iterator_traits<_InputIterator>::difference_type + distance(_InputIterator __first, _InputIterator __last) + { + typename iterator_traits<_InputIterator>::difference_type __n = 0; + while (__first != __last) { + ++__first; ++__n; + } + return __n; + } +} +#endif + + +namespace swig { + template<typename OutIterator> + class SwigPyIterator_T : public SwigPyIterator + { + public: + typedef OutIterator out_iterator; + typedef typename std::iterator_traits<out_iterator>::value_type value_type; + typedef SwigPyIterator_T<out_iterator> self_type; + + SwigPyIterator_T(out_iterator curr, PyObject *seq) + : SwigPyIterator(seq), current(curr) + { + } + + const out_iterator& get_current() const + { + return current; + } + + + bool equal (const SwigPyIterator &iter) const + { + const self_type *iters = dynamic_cast<const self_type *>(&iter); + if (iters) { + return (current == iters->get_current()); + } else { + throw std::invalid_argument("bad iterator type"); + } + } + + ptrdiff_t distance(const SwigPyIterator &iter) const + { + const self_type *iters = dynamic_cast<const self_type *>(&iter); + if (iters) { + return std::distance(current, iters->get_current()); + } else { + throw std::invalid_argument("bad iterator type"); + } + } + + protected: + out_iterator current; + }; + + template <class ValueType> + struct from_oper + { + typedef const ValueType& argument_type; + typedef PyObject *result_type; + result_type operator()(argument_type v) const + { + return swig::from(v); + } + }; + + template<typename OutIterator, + typename ValueType = typename std::iterator_traits<OutIterator>::value_type, + typename FromOper = from_oper<ValueType> > + class SwigPyForwardIteratorOpen_T : public SwigPyIterator_T<OutIterator> + { + public: + FromOper from; + typedef OutIterator out_iterator; + typedef ValueType value_type; + typedef SwigPyIterator_T<out_iterator> base; + typedef SwigPyForwardIteratorOpen_T<OutIterator, ValueType, FromOper> self_type; + + SwigPyForwardIteratorOpen_T(out_iterator curr, PyObject *seq) + : SwigPyIterator_T<OutIterator>(curr, seq) + { + } + + PyObject *value() const { + return from(static_cast<const value_type&>(*(base::current))); + } + + SwigPyIterator *copy() const + { + return new self_type(*this); + } + + SwigPyIterator *incr(size_t n = 1) + { + while (n--) { + ++base::current; + } + return this; + } + + }; + + template<typename OutIterator, + typename ValueType = typename std::iterator_traits<OutIterator>::value_type, + typename FromOper = from_oper<ValueType> > + class SwigPyIteratorOpen_T : public SwigPyForwardIteratorOpen_T<OutIterator, ValueType, FromOper> + { + public: + FromOper from; + typedef OutIterator out_iterator; + typedef ValueType value_type; + typedef SwigPyIterator_T<out_iterator> base; + typedef SwigPyIteratorOpen_T<OutIterator, ValueType, FromOper> self_type; + + SwigPyIteratorOpen_T(out_iterator curr, PyObject *seq) + : SwigPyForwardIteratorOpen_T<OutIterator>(curr, seq) + { + } + + SwigPyIterator *decr(size_t n = 1) + { + while (n--) { + --base::current; + } + return this; + } + }; + + template<typename OutIterator, + typename ValueType = typename std::iterator_traits<OutIterator>::value_type, + typename FromOper = from_oper<ValueType> > + class SwigPyForwardIteratorClosed_T : public SwigPyIterator_T<OutIterator> + { + public: + FromOper from; + typedef OutIterator out_iterator; + typedef ValueType value_type; + typedef SwigPyIterator_T<out_iterator> base; + typedef SwigPyForwardIteratorClosed_T<OutIterator, ValueType, FromOper> self_type; + + SwigPyForwardIteratorClosed_T(out_iterator curr, out_iterator first, out_iterator last, PyObject *seq) + : SwigPyIterator_T<OutIterator>(curr, seq), begin(first), end(last) + { + } + + PyObject *value() const { + if (base::current == end) { + throw stop_iteration(); + } else { + return from(static_cast<const value_type&>(*(base::current))); + } + } + + SwigPyIterator *copy() const + { + return new self_type(*this); + } + + SwigPyIterator *incr(size_t n = 1) + { + while (n--) { + if (base::current == end) { + throw stop_iteration(); + } else { + ++base::current; + } + } + return this; + } + + protected: + out_iterator begin; + out_iterator end; + }; + + template<typename OutIterator, + typename ValueType = typename std::iterator_traits<OutIterator>::value_type, + typename FromOper = from_oper<ValueType> > + class SwigPyIteratorClosed_T : public SwigPyForwardIteratorClosed_T<OutIterator,ValueType,FromOper> + { + public: + FromOper from; + typedef OutIterator out_iterator; + typedef ValueType value_type; + typedef SwigPyIterator_T<out_iterator> base; + typedef SwigPyForwardIteratorClosed_T<OutIterator, ValueType, FromOper> base0; + typedef SwigPyIteratorClosed_T<OutIterator, ValueType, FromOper> self_type; + + SwigPyIteratorClosed_T(out_iterator curr, out_iterator first, out_iterator last, PyObject *seq) + : SwigPyForwardIteratorClosed_T<OutIterator,ValueType,FromOper>(curr, first, last, seq) + { + } + + SwigPyIterator *decr(size_t n = 1) + { + while (n--) { + if (base::current == base0::begin) { + throw stop_iteration(); + } else { + --base::current; + } + } + return this; + } + }; + + + template<typename OutIter> + inline SwigPyIterator* + make_output_forward_iterator(const OutIter& current, const OutIter& begin,const OutIter& end, PyObject *seq = 0) + { + return new SwigPyForwardIteratorClosed_T<OutIter>(current, begin, end, seq); + } + + template<typename OutIter> + inline SwigPyIterator* + make_output_iterator(const OutIter& current, const OutIter& begin,const OutIter& end, PyObject *seq = 0) + { + return new SwigPyIteratorClosed_T<OutIter>(current, begin, end, seq); + } + + template<typename OutIter> + inline SwigPyIterator* + make_output_forward_iterator(const OutIter& current, PyObject *seq = 0) + { + return new SwigPyForwardIteratorOpen_T<OutIter>(current, seq); + } + + template<typename OutIter> + inline SwigPyIterator* + make_output_iterator(const OutIter& current, PyObject *seq = 0) + { + return new SwigPyIteratorOpen_T<OutIter>(current, seq); + } + +} + + +namespace swig +{ + template <class T> + struct SwigPySequence_Ref + { + SwigPySequence_Ref(PyObject* seq, Py_ssize_t index) + : _seq(seq), _index(index) + { + } + + operator T () const + { + swig::SwigVar_PyObject item = PySequence_GetItem(_seq, _index); + try { + return swig::as<T>(item); + } catch (const std::invalid_argument& e) { + char msg[1024]; + sprintf(msg, "in sequence element %d ", (int)_index); + if (!PyErr_Occurred()) { + ::SWIG_Error(SWIG_TypeError, swig::type_name<T>()); + } + SWIG_Python_AddErrorMsg(msg); + SWIG_Python_AddErrorMsg(e.what()); + throw; + } + } + + SwigPySequence_Ref& operator=(const T& v) + { + PySequence_SetItem(_seq, _index, swig::from<T>(v)); + return *this; + } + + private: + PyObject* _seq; + Py_ssize_t _index; + }; + + template <class T> + struct SwigPySequence_ArrowProxy + { + SwigPySequence_ArrowProxy(const T& x): m_value(x) {} + const T* operator->() const { return &m_value; } + operator const T*() const { return &m_value; } + T m_value; + }; + + template <class T, class Reference > + struct SwigPySequence_InputIterator + { + typedef SwigPySequence_InputIterator<T, Reference > self; + + typedef std::random_access_iterator_tag iterator_category; + typedef Reference reference; + typedef T value_type; + typedef T* pointer; + typedef Py_ssize_t difference_type; + + SwigPySequence_InputIterator() + { + } + + SwigPySequence_InputIterator(PyObject* seq, Py_ssize_t index) + : _seq(seq), _index(index) + { + } + + reference operator*() const + { + return reference(_seq, _index); + } + + SwigPySequence_ArrowProxy<T> + operator->() const { + return SwigPySequence_ArrowProxy<T>(operator*()); + } + + bool operator==(const self& ri) const + { + return (_index == ri._index) && (_seq == ri._seq); + } + + bool operator!=(const self& ri) const + { + return !(operator==(ri)); + } + + self& operator ++ () + { + ++_index; + return *this; + } + + self& operator -- () + { + --_index; + return *this; + } + + self& operator += (difference_type n) + { + _index += n; + return *this; + } + + self operator +(difference_type n) const + { + return self(_seq, _index + n); + } + + self& operator -= (difference_type n) + { + _index -= n; + return *this; + } + + self operator -(difference_type n) const + { + return self(_seq, _index - n); + } + + difference_type operator - (const self& ri) const + { + return _index - ri._index; + } + + bool operator < (const self& ri) const + { + return _index < ri._index; + } + + reference + operator[](difference_type n) const + { + return reference(_seq, _index + n); + } + + private: + PyObject* _seq; + difference_type _index; + }; + + // STL container wrapper around a Python sequence + template <class T> + struct SwigPySequence_Cont + { + typedef SwigPySequence_Ref<T> reference; + typedef const SwigPySequence_Ref<T> const_reference; + typedef T value_type; + typedef T* pointer; + typedef Py_ssize_t difference_type; + typedef size_t size_type; + typedef const pointer const_pointer; + typedef SwigPySequence_InputIterator<T, reference> iterator; + typedef SwigPySequence_InputIterator<T, const_reference> const_iterator; + + SwigPySequence_Cont(PyObject* seq) : _seq(0) + { + if (!PySequence_Check(seq)) { + throw std::invalid_argument("a sequence is expected"); + } + _seq = seq; + Py_INCREF(_seq); + } + + ~SwigPySequence_Cont() + { + Py_XDECREF(_seq); + } + + size_type size() const + { + return static_cast<size_type>(PySequence_Size(_seq)); + } + + bool empty() const + { + return size() == 0; + } + + iterator begin() + { + return iterator(_seq, 0); + } + + const_iterator begin() const + { + return const_iterator(_seq, 0); + } + + iterator end() + { + return iterator(_seq, size()); + } + + const_iterator end() const + { + return const_iterator(_seq, size()); + } + + reference operator[](difference_type n) + { + return reference(_seq, n); + } + + const_reference operator[](difference_type n) const + { + return const_reference(_seq, n); + } + + bool check() const + { + Py_ssize_t s = size(); + for (Py_ssize_t i = 0; i < s; ++i) { + swig::SwigVar_PyObject item = PySequence_GetItem(_seq, i); + if (!swig::check<value_type>(item)) + return false; + } + return true; + } + + private: + PyObject* _seq; + }; + +} + + +SWIGINTERN int +SWIG_AsVal_int (PyObject * obj, int *val) +{ + long v; + int res = SWIG_AsVal_long (obj, &v); + if (SWIG_IsOK(res)) { + if ((v < INT_MIN || v > INT_MAX)) { + return SWIG_OverflowError; + } else { + if (val) *val = static_cast< int >(v); + } + } + return res; +} + + +SWIGINTERNINLINE PyObject* + SWIG_From_int (int value) +{ + return PyInt_FromLong((long) value); +} + + +namespace swig { + template <> struct traits< int > { + typedef value_category category; + static const char* type_name() { return"int"; } + }; + template <> struct traits_asval< int > { + typedef int value_type; + static int asval(PyObject *obj, value_type *val) { + return SWIG_AsVal_int (obj, val); + } + }; + template <> struct traits_from< int > { + typedef int value_type; + static PyObject *from(const value_type& val) { + return SWIG_From_int (val); + } + }; +} + + +namespace swig { + template <class SwigPySeq, class Seq> + inline void + assign(const SwigPySeq& swigpyseq, Seq* seq) { + // seq->assign(swigpyseq.begin(), swigpyseq.end()); // not used as not always implemented + typedef typename SwigPySeq::value_type value_type; + typename SwigPySeq::const_iterator it = swigpyseq.begin(); + for (;it != swigpyseq.end(); ++it) { + seq->insert(seq->end(),(value_type)(*it)); + } + } + + template <class Seq, class T = typename Seq::value_type > + struct traits_asptr_stdseq { + typedef Seq sequence; + typedef T value_type; + + static int asptr(PyObject *obj, sequence **seq) { + if (obj == Py_None || SWIG_Python_GetSwigThis(obj)) { + sequence *p; + swig_type_info *descriptor = swig::type_info<sequence>(); + if (descriptor && SWIG_IsOK(::SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0))) { + if (seq) *seq = p; + return SWIG_OLDOBJ; + } + } else if (PySequence_Check(obj)) { + try { + SwigPySequence_Cont<value_type> swigpyseq(obj); + if (seq) { + sequence *pseq = new sequence(); + assign(swigpyseq, pseq); + *seq = pseq; + return SWIG_NEWOBJ; + } else { + return swigpyseq.check() ? SWIG_OK : SWIG_ERROR; + } + } catch (std::exception& e) { + if (seq) { + if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, e.what()); + } + } + return SWIG_ERROR; + } + } + return SWIG_ERROR; + } + }; + + template <class Seq, class T = typename Seq::value_type > + struct traits_from_stdseq { + typedef Seq sequence; + typedef T value_type; + typedef typename Seq::size_type size_type; + typedef typename sequence::const_iterator const_iterator; + + static PyObject *from(const sequence& seq) { +#ifdef SWIG_PYTHON_EXTRA_NATIVE_CONTAINERS + swig_type_info *desc = swig::type_info<sequence>(); + if (desc && desc->clientdata) { + return SWIG_InternalNewPointerObj(new sequence(seq), desc, SWIG_POINTER_OWN); + } +#endif + size_type size = seq.size(); + if (size <= (size_type)INT_MAX) { + PyObject *obj = PyTuple_New((Py_ssize_t)size); + Py_ssize_t i = 0; + for (const_iterator it = seq.begin(); it != seq.end(); ++it, ++i) { + PyTuple_SetItem(obj,i,swig::from<value_type>(*it)); + } + return obj; + } else { + PyErr_SetString(PyExc_OverflowError,"sequence size not valid in python"); + return NULL; + } + } + }; +} + + + namespace swig { + template <class T> + struct traits_reserve<std::vector<T> > { + static void reserve(std::vector<T> &seq, typename std::vector<T>::size_type n) { + seq.reserve(n); + } + }; + + template <class T> + struct traits_asptr<std::vector<T> > { + static int asptr(PyObject *obj, std::vector<T> **vec) { + return traits_asptr_stdseq<std::vector<T> >::asptr(obj, vec); + } + }; + + template <class T> + struct traits_from<std::vector<T> > { + static PyObject *from(const std::vector<T>& vec) { + return traits_from_stdseq<std::vector<T> >::from(vec); + } + }; + } + + + namespace swig { + template <> struct traits<std::vector< int, std::allocator< int > > > { + typedef pointer_category category; + static const char* type_name() { + return "std::vector<" "int" "," "std::allocator< int >" " >"; + } + }; + } + +SWIGINTERN swig::SwigPyIterator *std_vector_Sl_int_Sg__iterator(std::vector< int > *self,PyObject **PYTHON_SELF){ + return swig::make_output_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF); + } +SWIGINTERN bool std_vector_Sl_int_Sg____nonzero__(std::vector< int > const *self){ + return !(self->empty()); + } +SWIGINTERN bool std_vector_Sl_int_Sg____bool__(std::vector< int > const *self){ + return !(self->empty()); + } +SWIGINTERN std::vector< int >::size_type std_vector_Sl_int_Sg____len__(std::vector< int > const *self){ + return self->size(); + } + +SWIGINTERNINLINE PyObject* +SWIG_From_unsigned_SS_long (unsigned long value) +{ + return (value > LONG_MAX) ? + PyLong_FromUnsignedLong(value) : PyInt_FromLong(static_cast< long >(value)); +} + + +#ifdef SWIG_LONG_LONG_AVAILABLE +SWIGINTERNINLINE PyObject* +SWIG_From_unsigned_SS_long_SS_long (unsigned long long value) +{ + return (value > LONG_MAX) ? + PyLong_FromUnsignedLongLong(value) : PyInt_FromLong(static_cast< long >(value)); +} +#endif + + +SWIGINTERNINLINE PyObject * +SWIG_From_size_t (size_t value) +{ +#ifdef SWIG_LONG_LONG_AVAILABLE + if (sizeof(size_t) <= sizeof(unsigned long)) { +#endif + return SWIG_From_unsigned_SS_long (static_cast< unsigned long >(value)); +#ifdef SWIG_LONG_LONG_AVAILABLE + } else { + /* assume sizeof(size_t) <= sizeof(unsigned long long) */ + return SWIG_From_unsigned_SS_long_SS_long (static_cast< unsigned long long >(value)); + } +#endif +} + +SWIGINTERN std::vector< int,std::allocator< int > > *std_vector_Sl_int_Sg____getslice__(std::vector< int > *self,std::vector< int >::difference_type i,std::vector< int >::difference_type j){ + return swig::getslice(self, i, j, 1); + } +SWIGINTERN void std_vector_Sl_int_Sg____setslice____SWIG_0(std::vector< int > *self,std::vector< int >::difference_type i,std::vector< int >::difference_type j){ + swig::setslice(self, i, j, 1, std::vector< int,std::allocator< int > >()); + } +SWIGINTERN void std_vector_Sl_int_Sg____setslice____SWIG_1(std::vector< int > *self,std::vector< int >::difference_type i,std::vector< int >::difference_type j,std::vector< int,std::allocator< int > > const &v){ + swig::setslice(self, i, j, 1, v); + } +SWIGINTERN void std_vector_Sl_int_Sg____delslice__(std::vector< int > *self,std::vector< int >::difference_type i,std::vector< int >::difference_type j){ + swig::delslice(self, i, j, 1); + } +SWIGINTERN void std_vector_Sl_int_Sg____delitem____SWIG_0(std::vector< int > *self,std::vector< int >::difference_type i){ + swig::erase(self, swig::getpos(self, i)); + } +SWIGINTERN std::vector< int,std::allocator< int > > *std_vector_Sl_int_Sg____getitem____SWIG_0(std::vector< int > *self,PySliceObject *slice){ + Py_ssize_t i, j, step; + if( !PySlice_Check(slice) ) { + SWIG_Error(SWIG_TypeError, "Slice object expected."); + return NULL; + } + PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step); + std::vector< int,std::allocator< int > >::difference_type id = i; + std::vector< int,std::allocator< int > >::difference_type jd = j; + return swig::getslice(self, id, jd, step); + } +SWIGINTERN void std_vector_Sl_int_Sg____setitem____SWIG_0(std::vector< int > *self,PySliceObject *slice,std::vector< int,std::allocator< int > > const &v){ + Py_ssize_t i, j, step; + if( !PySlice_Check(slice) ) { + SWIG_Error(SWIG_TypeError, "Slice object expected."); + return; + } + PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step); + std::vector< int,std::allocator< int > >::difference_type id = i; + std::vector< int,std::allocator< int > >::difference_type jd = j; + swig::setslice(self, id, jd, step, v); + } +SWIGINTERN void std_vector_Sl_int_Sg____setitem____SWIG_1(std::vector< int > *self,PySliceObject *slice){ + Py_ssize_t i, j, step; + if( !PySlice_Check(slice) ) { + SWIG_Error(SWIG_TypeError, "Slice object expected."); + return; + } + PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step); + std::vector< int,std::allocator< int > >::difference_type id = i; + std::vector< int,std::allocator< int > >::difference_type jd = j; + swig::delslice(self, id, jd, step); + } +SWIGINTERN void std_vector_Sl_int_Sg____delitem____SWIG_1(std::vector< int > *self,PySliceObject *slice){ + Py_ssize_t i, j, step; + if( !PySlice_Check(slice) ) { + SWIG_Error(SWIG_TypeError, "Slice object expected."); + return; + } + PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step); + std::vector< int,std::allocator< int > >::difference_type id = i; + std::vector< int,std::allocator< int > >::difference_type jd = j; + swig::delslice(self, id, jd, step); + } +SWIGINTERN std::vector< int >::value_type const &std_vector_Sl_int_Sg____getitem____SWIG_1(std::vector< int > const *self,std::vector< int >::difference_type i){ + return *(swig::cgetpos(self, i)); + } + +namespace swig { + static PyObject* container_owner_attribute() { + static PyObject* attr = SWIG_Python_str_FromChar("__swig_container"); + return attr; + } + + template <typename T> + struct container_owner { + // By default, do not add the back-reference (for value types) + // Specialization below will check the reference for pointer types. + static bool back_reference(PyObject* /*child*/, PyObject* /*owner*/) { + return false; + } + }; + + template <> + struct container_owner<swig::pointer_category> { + /* + * Call to add a back-reference to the owning object when returning a + * reference from a container. Will only set the reference if child + * is a SWIG wrapper object that does not own the pointer. + * + * returns whether the reference was set or not + */ + static bool back_reference(PyObject* child, PyObject* owner) { + SwigPyObject* swigThis = SWIG_Python_GetSwigThis(child); + if (swigThis && (swigThis->own & SWIG_POINTER_OWN) != SWIG_POINTER_OWN) { + return PyObject_SetAttr(child, container_owner_attribute(), owner) != -1; + } + return false; + } + }; +} + +SWIGINTERN void std_vector_Sl_int_Sg____setitem____SWIG_2(std::vector< int > *self,std::vector< int >::difference_type i,std::vector< int >::value_type const &x){ + *(swig::getpos(self,i)) = x; + } +SWIGINTERN std::vector< int >::value_type std_vector_Sl_int_Sg__pop(std::vector< int > *self){ + if (self->size() == 0) + throw std::out_of_range("pop from empty container"); + std::vector< int,std::allocator< int > >::value_type x = self->back(); + self->pop_back(); + return x; + } +SWIGINTERN void std_vector_Sl_int_Sg__append(std::vector< int > *self,std::vector< int >::value_type const &x){ + self->push_back(x); + } +SWIGINTERN std::vector< int >::iterator std_vector_Sl_int_Sg__erase__SWIG_0(std::vector< int > *self,std::vector< int >::iterator pos){ return self->erase(pos); } +SWIGINTERN std::vector< int >::iterator std_vector_Sl_int_Sg__erase__SWIG_1(std::vector< int > *self,std::vector< int >::iterator first,std::vector< int >::iterator last){ return self->erase(first, last); } +SWIGINTERN std::vector< int >::iterator std_vector_Sl_int_Sg__insert__SWIG_0(std::vector< int > *self,std::vector< int >::iterator pos,std::vector< int >::value_type const &x){ return self->insert(pos, x); } +SWIGINTERN void std_vector_Sl_int_Sg__insert__SWIG_1(std::vector< int > *self,std::vector< int >::iterator pos,std::vector< int >::size_type n,std::vector< int >::value_type const &x){ self->insert(pos, n, x); } + + #define SWIG_From_double PyFloat_FromDouble + + +namespace swig { + template <> struct traits< double > { + typedef value_category category; + static const char* type_name() { return"double"; } + }; + template <> struct traits_asval< double > { + typedef double value_type; + static int asval(PyObject *obj, value_type *val) { + return SWIG_AsVal_double (obj, val); + } + }; + template <> struct traits_from< double > { + typedef double value_type; + static PyObject *from(const value_type& val) { + return SWIG_From_double (val); + } + }; +} + + + namespace swig { + template <> struct traits<std::vector< double, std::allocator< double > > > { + typedef pointer_category category; + static const char* type_name() { + return "std::vector<" "double" "," "std::allocator< double >" " >"; + } + }; + } + +SWIGINTERN swig::SwigPyIterator *std_vector_Sl_double_Sg__iterator(std::vector< double > *self,PyObject **PYTHON_SELF){ + return swig::make_output_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF); + } +SWIGINTERN bool std_vector_Sl_double_Sg____nonzero__(std::vector< double > const *self){ + return !(self->empty()); + } +SWIGINTERN bool std_vector_Sl_double_Sg____bool__(std::vector< double > const *self){ + return !(self->empty()); + } +SWIGINTERN std::vector< double >::size_type std_vector_Sl_double_Sg____len__(std::vector< double > const *self){ + return self->size(); + } +SWIGINTERN std::vector< double,std::allocator< double > > *std_vector_Sl_double_Sg____getslice__(std::vector< double > *self,std::vector< double >::difference_type i,std::vector< double >::difference_type j){ + return swig::getslice(self, i, j, 1); + } +SWIGINTERN void std_vector_Sl_double_Sg____setslice____SWIG_0(std::vector< double > *self,std::vector< double >::difference_type i,std::vector< double >::difference_type j){ + swig::setslice(self, i, j, 1, std::vector< double,std::allocator< double > >()); + } +SWIGINTERN void std_vector_Sl_double_Sg____setslice____SWIG_1(std::vector< double > *self,std::vector< double >::difference_type i,std::vector< double >::difference_type j,std::vector< double,std::allocator< double > > const &v){ + swig::setslice(self, i, j, 1, v); + } +SWIGINTERN void std_vector_Sl_double_Sg____delslice__(std::vector< double > *self,std::vector< double >::difference_type i,std::vector< double >::difference_type j){ + swig::delslice(self, i, j, 1); + } +SWIGINTERN void std_vector_Sl_double_Sg____delitem____SWIG_0(std::vector< double > *self,std::vector< double >::difference_type i){ + swig::erase(self, swig::getpos(self, i)); + } +SWIGINTERN std::vector< double,std::allocator< double > > *std_vector_Sl_double_Sg____getitem____SWIG_0(std::vector< double > *self,PySliceObject *slice){ + Py_ssize_t i, j, step; + if( !PySlice_Check(slice) ) { + SWIG_Error(SWIG_TypeError, "Slice object expected."); + return NULL; + } + PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step); + std::vector< double,std::allocator< double > >::difference_type id = i; + std::vector< double,std::allocator< double > >::difference_type jd = j; + return swig::getslice(self, id, jd, step); + } +SWIGINTERN void std_vector_Sl_double_Sg____setitem____SWIG_0(std::vector< double > *self,PySliceObject *slice,std::vector< double,std::allocator< double > > const &v){ + Py_ssize_t i, j, step; + if( !PySlice_Check(slice) ) { + SWIG_Error(SWIG_TypeError, "Slice object expected."); + return; + } + PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step); + std::vector< double,std::allocator< double > >::difference_type id = i; + std::vector< double,std::allocator< double > >::difference_type jd = j; + swig::setslice(self, id, jd, step, v); + } +SWIGINTERN void std_vector_Sl_double_Sg____setitem____SWIG_1(std::vector< double > *self,PySliceObject *slice){ + Py_ssize_t i, j, step; + if( !PySlice_Check(slice) ) { + SWIG_Error(SWIG_TypeError, "Slice object expected."); + return; + } + PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step); + std::vector< double,std::allocator< double > >::difference_type id = i; + std::vector< double,std::allocator< double > >::difference_type jd = j; + swig::delslice(self, id, jd, step); + } +SWIGINTERN void std_vector_Sl_double_Sg____delitem____SWIG_1(std::vector< double > *self,PySliceObject *slice){ + Py_ssize_t i, j, step; + if( !PySlice_Check(slice) ) { + SWIG_Error(SWIG_TypeError, "Slice object expected."); + return; + } + PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step); + std::vector< double,std::allocator< double > >::difference_type id = i; + std::vector< double,std::allocator< double > >::difference_type jd = j; + swig::delslice(self, id, jd, step); + } +SWIGINTERN std::vector< double >::value_type const &std_vector_Sl_double_Sg____getitem____SWIG_1(std::vector< double > const *self,std::vector< double >::difference_type i){ + return *(swig::cgetpos(self, i)); + } +SWIGINTERN void std_vector_Sl_double_Sg____setitem____SWIG_2(std::vector< double > *self,std::vector< double >::difference_type i,std::vector< double >::value_type const &x){ + *(swig::getpos(self,i)) = x; + } +SWIGINTERN std::vector< double >::value_type std_vector_Sl_double_Sg__pop(std::vector< double > *self){ + if (self->size() == 0) + throw std::out_of_range("pop from empty container"); + std::vector< double,std::allocator< double > >::value_type x = self->back(); + self->pop_back(); + return x; + } +SWIGINTERN void std_vector_Sl_double_Sg__append(std::vector< double > *self,std::vector< double >::value_type const &x){ + self->push_back(x); + } +SWIGINTERN std::vector< double >::iterator std_vector_Sl_double_Sg__erase__SWIG_0(std::vector< double > *self,std::vector< double >::iterator pos){ return self->erase(pos); } +SWIGINTERN std::vector< double >::iterator std_vector_Sl_double_Sg__erase__SWIG_1(std::vector< double > *self,std::vector< double >::iterator first,std::vector< double >::iterator last){ return self->erase(first, last); } +SWIGINTERN std::vector< double >::iterator std_vector_Sl_double_Sg__insert__SWIG_0(std::vector< double > *self,std::vector< double >::iterator pos,std::vector< double >::value_type const &x){ return self->insert(pos, x); } +SWIGINTERN void std_vector_Sl_double_Sg__insert__SWIG_1(std::vector< double > *self,std::vector< double >::iterator pos,std::vector< double >::size_type n,std::vector< double >::value_type const &x){ self->insert(pos, n, x); } + + namespace swig { + template <> struct traits<std::vector< std::vector< double,std::allocator< double > >, std::allocator< std::vector< double,std::allocator< double > > > > > { + typedef pointer_category category; + static const char* type_name() { + return "std::vector<" "std::vector< double,std::allocator< double > >" "," "std::allocator< std::vector< double,std::allocator< double > > >" " >"; + } + }; + } + +SWIGINTERN swig::SwigPyIterator *std_vector_Sl_std_vector_Sl_double_Sg__Sg__iterator(std::vector< std::vector< double > > *self,PyObject **PYTHON_SELF){ + return swig::make_output_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF); + } +SWIGINTERN bool std_vector_Sl_std_vector_Sl_double_Sg__Sg____nonzero__(std::vector< std::vector< double > > const *self){ + return !(self->empty()); + } +SWIGINTERN bool std_vector_Sl_std_vector_Sl_double_Sg__Sg____bool__(std::vector< std::vector< double > > const *self){ + return !(self->empty()); + } +SWIGINTERN std::vector< std::vector< double > >::size_type std_vector_Sl_std_vector_Sl_double_Sg__Sg____len__(std::vector< std::vector< double > > const *self){ + return self->size(); + } +SWIGINTERN std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *std_vector_Sl_std_vector_Sl_double_Sg__Sg____getslice__(std::vector< std::vector< double > > *self,std::vector< std::vector< double > >::difference_type i,std::vector< std::vector< double > >::difference_type j){ + return swig::getslice(self, i, j, 1); + } +SWIGINTERN void std_vector_Sl_std_vector_Sl_double_Sg__Sg____setslice____SWIG_0(std::vector< std::vector< double > > *self,std::vector< std::vector< double > >::difference_type i,std::vector< std::vector< double > >::difference_type j){ + swig::setslice(self, i, j, 1, std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >()); + } +SWIGINTERN void std_vector_Sl_std_vector_Sl_double_Sg__Sg____setslice____SWIG_1(std::vector< std::vector< double > > *self,std::vector< std::vector< double > >::difference_type i,std::vector< std::vector< double > >::difference_type j,std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > const &v){ + swig::setslice(self, i, j, 1, v); + } +SWIGINTERN void std_vector_Sl_std_vector_Sl_double_Sg__Sg____delslice__(std::vector< std::vector< double > > *self,std::vector< std::vector< double > >::difference_type i,std::vector< std::vector< double > >::difference_type j){ + swig::delslice(self, i, j, 1); + } +SWIGINTERN void std_vector_Sl_std_vector_Sl_double_Sg__Sg____delitem____SWIG_0(std::vector< std::vector< double > > *self,std::vector< std::vector< double > >::difference_type i){ + swig::erase(self, swig::getpos(self, i)); + } +SWIGINTERN std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *std_vector_Sl_std_vector_Sl_double_Sg__Sg____getitem____SWIG_0(std::vector< std::vector< double > > *self,PySliceObject *slice){ + Py_ssize_t i, j, step; + if( !PySlice_Check(slice) ) { + SWIG_Error(SWIG_TypeError, "Slice object expected."); + return NULL; + } + PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step); + std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >::difference_type id = i; + std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >::difference_type jd = j; + return swig::getslice(self, id, jd, step); + } +SWIGINTERN void std_vector_Sl_std_vector_Sl_double_Sg__Sg____setitem____SWIG_0(std::vector< std::vector< double > > *self,PySliceObject *slice,std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > const &v){ + Py_ssize_t i, j, step; + if( !PySlice_Check(slice) ) { + SWIG_Error(SWIG_TypeError, "Slice object expected."); + return; + } + PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step); + std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >::difference_type id = i; + std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >::difference_type jd = j; + swig::setslice(self, id, jd, step, v); + } +SWIGINTERN void std_vector_Sl_std_vector_Sl_double_Sg__Sg____setitem____SWIG_1(std::vector< std::vector< double > > *self,PySliceObject *slice){ + Py_ssize_t i, j, step; + if( !PySlice_Check(slice) ) { + SWIG_Error(SWIG_TypeError, "Slice object expected."); + return; + } + PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step); + std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >::difference_type id = i; + std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >::difference_type jd = j; + swig::delslice(self, id, jd, step); + } +SWIGINTERN void std_vector_Sl_std_vector_Sl_double_Sg__Sg____delitem____SWIG_1(std::vector< std::vector< double > > *self,PySliceObject *slice){ + Py_ssize_t i, j, step; + if( !PySlice_Check(slice) ) { + SWIG_Error(SWIG_TypeError, "Slice object expected."); + return; + } + PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step); + std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >::difference_type id = i; + std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >::difference_type jd = j; + swig::delslice(self, id, jd, step); + } +SWIGINTERN std::vector< std::vector< double > >::value_type const &std_vector_Sl_std_vector_Sl_double_Sg__Sg____getitem____SWIG_1(std::vector< std::vector< double > > const *self,std::vector< std::vector< double > >::difference_type i){ + return *(swig::cgetpos(self, i)); + } +SWIGINTERN void std_vector_Sl_std_vector_Sl_double_Sg__Sg____setitem____SWIG_2(std::vector< std::vector< double > > *self,std::vector< std::vector< double > >::difference_type i,std::vector< std::vector< double > >::value_type const &x){ + *(swig::getpos(self,i)) = x; + } +SWIGINTERN std::vector< std::vector< double > >::value_type std_vector_Sl_std_vector_Sl_double_Sg__Sg__pop(std::vector< std::vector< double > > *self){ + if (self->size() == 0) + throw std::out_of_range("pop from empty container"); + std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >::value_type x = self->back(); + self->pop_back(); + return x; + } +SWIGINTERN void std_vector_Sl_std_vector_Sl_double_Sg__Sg__append(std::vector< std::vector< double > > *self,std::vector< std::vector< double > >::value_type const &x){ + self->push_back(x); + } +SWIGINTERN std::vector< std::vector< double > >::iterator std_vector_Sl_std_vector_Sl_double_Sg__Sg__erase__SWIG_0(std::vector< std::vector< double > > *self,std::vector< std::vector< double > >::iterator pos){ return self->erase(pos); } +SWIGINTERN std::vector< std::vector< double > >::iterator std_vector_Sl_std_vector_Sl_double_Sg__Sg__erase__SWIG_1(std::vector< std::vector< double > > *self,std::vector< std::vector< double > >::iterator first,std::vector< std::vector< double > >::iterator last){ return self->erase(first, last); } +SWIGINTERN std::vector< std::vector< double > >::iterator std_vector_Sl_std_vector_Sl_double_Sg__Sg__insert__SWIG_0(std::vector< std::vector< double > > *self,std::vector< std::vector< double > >::iterator pos,std::vector< std::vector< double > >::value_type const &x){ return self->insert(pos, x); } +SWIGINTERN void std_vector_Sl_std_vector_Sl_double_Sg__Sg__insert__SWIG_1(std::vector< std::vector< double > > *self,std::vector< std::vector< double > >::iterator pos,std::vector< std::vector< double > >::size_type n,std::vector< std::vector< double > >::value_type const &x){ self->insert(pos, n, x); } + +SWIGINTERN swig_type_info* +SWIG_pchar_descriptor(void) +{ + static int init = 0; + static swig_type_info* info = 0; + if (!init) { + info = SWIG_TypeQuery("_p_char"); + init = 1; + } + return info; +} + + +SWIGINTERN int +SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc) +{ +#if PY_VERSION_HEX>=0x03000000 +#if defined(SWIG_PYTHON_STRICT_BYTE_CHAR) + if (PyBytes_Check(obj)) +#else + if (PyUnicode_Check(obj)) +#endif +#else + if (PyString_Check(obj)) +#endif + { + char *cstr; Py_ssize_t len; + int ret = SWIG_OK; +#if PY_VERSION_HEX>=0x03000000 +#if !defined(SWIG_PYTHON_STRICT_BYTE_CHAR) + if (!alloc && cptr) { + /* We can't allow converting without allocation, since the internal + representation of string in Python 3 is UCS-2/UCS-4 but we require + a UTF-8 representation. + TODO(bhy) More detailed explanation */ + return SWIG_RuntimeError; + } + obj = PyUnicode_AsUTF8String(obj); + if (!obj) + return SWIG_TypeError; + if (alloc) + *alloc = SWIG_NEWOBJ; +#endif + if (PyBytes_AsStringAndSize(obj, &cstr, &len) == -1) + return SWIG_TypeError; +#else + if (PyString_AsStringAndSize(obj, &cstr, &len) == -1) + return SWIG_TypeError; +#endif + if (cptr) { + if (alloc) { + if (*alloc == SWIG_NEWOBJ) { + *cptr = reinterpret_cast< char* >(memcpy(new char[len + 1], cstr, sizeof(char)*(len + 1))); + *alloc = SWIG_NEWOBJ; + } else { + *cptr = cstr; + *alloc = SWIG_OLDOBJ; + } + } else { +#if PY_VERSION_HEX>=0x03000000 +#if defined(SWIG_PYTHON_STRICT_BYTE_CHAR) + *cptr = PyBytes_AsString(obj); +#else + assert(0); /* Should never reach here with Unicode strings in Python 3 */ +#endif +#else + *cptr = SWIG_Python_str_AsChar(obj); + if (!*cptr) + ret = SWIG_TypeError; +#endif + } + } + if (psize) *psize = len + 1; +#if PY_VERSION_HEX>=0x03000000 && !defined(SWIG_PYTHON_STRICT_BYTE_CHAR) + Py_XDECREF(obj); +#endif + return ret; + } else { +#if defined(SWIG_PYTHON_2_UNICODE) +#if defined(SWIG_PYTHON_STRICT_BYTE_CHAR) +#error "Cannot use both SWIG_PYTHON_2_UNICODE and SWIG_PYTHON_STRICT_BYTE_CHAR at once" +#endif +#if PY_VERSION_HEX<0x03000000 + if (PyUnicode_Check(obj)) { + char *cstr; Py_ssize_t len; + if (!alloc && cptr) { + return SWIG_RuntimeError; + } + obj = PyUnicode_AsUTF8String(obj); + if (!obj) + return SWIG_TypeError; + if (PyString_AsStringAndSize(obj, &cstr, &len) != -1) { + if (cptr) { + if (alloc) *alloc = SWIG_NEWOBJ; + *cptr = reinterpret_cast< char* >(memcpy(new char[len + 1], cstr, sizeof(char)*(len + 1))); + } + if (psize) *psize = len + 1; + + Py_XDECREF(obj); + return SWIG_OK; + } else { + Py_XDECREF(obj); + } + } +#endif +#endif + + swig_type_info* pchar_descriptor = SWIG_pchar_descriptor(); + if (pchar_descriptor) { + void* vptr = 0; + if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) { + if (cptr) *cptr = (char *) vptr; + if (psize) *psize = vptr ? (strlen((char *)vptr) + 1) : 0; + if (alloc) *alloc = SWIG_OLDOBJ; + return SWIG_OK; + } + } + } + return SWIG_TypeError; +} + + +SWIGINTERN int +SWIG_AsPtr_std_string (PyObject * obj, std::string **val) +{ + char* buf = 0 ; size_t size = 0; int alloc = SWIG_OLDOBJ; + if (SWIG_IsOK((SWIG_AsCharPtrAndSize(obj, &buf, &size, &alloc)))) { + if (buf) { + if (val) *val = new std::string(buf, size - 1); + if (alloc == SWIG_NEWOBJ) delete[] buf; + return SWIG_NEWOBJ; + } else { + if (val) *val = 0; + return SWIG_OLDOBJ; + } + } else { + static int init = 0; + static swig_type_info* descriptor = 0; + if (!init) { + descriptor = SWIG_TypeQuery("std::string" " *"); + init = 1; + } + if (descriptor) { + std::string *vptr; + int res = SWIG_ConvertPtr(obj, (void**)&vptr, descriptor, 0); + if (SWIG_IsOK(res) && val) *val = vptr; + return res; + } + } + return SWIG_ERROR; +} + + +SWIGINTERN int +SWIG_AsVal_std_string (PyObject * obj, std::string *val) +{ + std::string* v = (std::string *) 0; + int res = SWIG_AsPtr_std_string (obj, &v); + if (!SWIG_IsOK(res)) return res; + if (v) { + if (val) *val = *v; + if (SWIG_IsNewObj(res)) { + delete v; + res = SWIG_DelNewMask(res); + } + return res; + } + return SWIG_ERROR; +} + + +SWIGINTERNINLINE PyObject * +SWIG_FromCharPtrAndSize(const char* carray, size_t size) +{ + if (carray) { + if (size > INT_MAX) { + swig_type_info* pchar_descriptor = SWIG_pchar_descriptor(); + return pchar_descriptor ? + SWIG_InternalNewPointerObj(const_cast< char * >(carray), pchar_descriptor, 0) : SWIG_Py_Void(); + } else { +#if PY_VERSION_HEX >= 0x03000000 +#if defined(SWIG_PYTHON_STRICT_BYTE_CHAR) + return PyBytes_FromStringAndSize(carray, static_cast< Py_ssize_t >(size)); +#else + return PyUnicode_DecodeUTF8(carray, static_cast< Py_ssize_t >(size), "surrogateescape"); +#endif +#else + return PyString_FromStringAndSize(carray, static_cast< Py_ssize_t >(size)); +#endif + } + } else { + return SWIG_Py_Void(); + } +} + + +SWIGINTERNINLINE PyObject * +SWIG_From_std_string (const std::string& s) +{ + return SWIG_FromCharPtrAndSize(s.data(), s.size()); +} + + +namespace swig { + template <> struct traits< std::string > { + typedef value_category category; + static const char* type_name() { return"std::string"; } + }; + template <> struct traits_asval< std::string > { + typedef std::string value_type; + static int asval(PyObject *obj, value_type *val) { + return SWIG_AsVal_std_string (obj, val); + } + }; + template <> struct traits_from< std::string > { + typedef std::string value_type; + static PyObject *from(const value_type& val) { + return SWIG_From_std_string (val); + } + }; +} + + + namespace swig { + template <> struct traits<std::vector< std::string, std::allocator< std::string > > > { + typedef pointer_category category; + static const char* type_name() { + return "std::vector<" "std::string" "," "std::allocator< std::string >" " >"; + } + }; + } + +SWIGINTERN swig::SwigPyIterator *std_vector_Sl_std_string_Sg__iterator(std::vector< std::string > *self,PyObject **PYTHON_SELF){ + return swig::make_output_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF); + } +SWIGINTERN bool std_vector_Sl_std_string_Sg____nonzero__(std::vector< std::string > const *self){ + return !(self->empty()); + } +SWIGINTERN bool std_vector_Sl_std_string_Sg____bool__(std::vector< std::string > const *self){ + return !(self->empty()); + } +SWIGINTERN std::vector< std::string >::size_type std_vector_Sl_std_string_Sg____len__(std::vector< std::string > const *self){ + return self->size(); + } +SWIGINTERN std::vector< std::string,std::allocator< std::string > > *std_vector_Sl_std_string_Sg____getslice__(std::vector< std::string > *self,std::vector< std::string >::difference_type i,std::vector< std::string >::difference_type j){ + return swig::getslice(self, i, j, 1); + } +SWIGINTERN void std_vector_Sl_std_string_Sg____setslice____SWIG_0(std::vector< std::string > *self,std::vector< std::string >::difference_type i,std::vector< std::string >::difference_type j){ + swig::setslice(self, i, j, 1, std::vector< std::string,std::allocator< std::string > >()); + } +SWIGINTERN void std_vector_Sl_std_string_Sg____setslice____SWIG_1(std::vector< std::string > *self,std::vector< std::string >::difference_type i,std::vector< std::string >::difference_type j,std::vector< std::string,std::allocator< std::string > > const &v){ + swig::setslice(self, i, j, 1, v); + } +SWIGINTERN void std_vector_Sl_std_string_Sg____delslice__(std::vector< std::string > *self,std::vector< std::string >::difference_type i,std::vector< std::string >::difference_type j){ + swig::delslice(self, i, j, 1); + } +SWIGINTERN void std_vector_Sl_std_string_Sg____delitem____SWIG_0(std::vector< std::string > *self,std::vector< std::string >::difference_type i){ + swig::erase(self, swig::getpos(self, i)); + } +SWIGINTERN std::vector< std::string,std::allocator< std::string > > *std_vector_Sl_std_string_Sg____getitem____SWIG_0(std::vector< std::string > *self,PySliceObject *slice){ + Py_ssize_t i, j, step; + if( !PySlice_Check(slice) ) { + SWIG_Error(SWIG_TypeError, "Slice object expected."); + return NULL; + } + PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step); + std::vector< std::string,std::allocator< std::string > >::difference_type id = i; + std::vector< std::string,std::allocator< std::string > >::difference_type jd = j; + return swig::getslice(self, id, jd, step); + } +SWIGINTERN void std_vector_Sl_std_string_Sg____setitem____SWIG_0(std::vector< std::string > *self,PySliceObject *slice,std::vector< std::string,std::allocator< std::string > > const &v){ + Py_ssize_t i, j, step; + if( !PySlice_Check(slice) ) { + SWIG_Error(SWIG_TypeError, "Slice object expected."); + return; + } + PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step); + std::vector< std::string,std::allocator< std::string > >::difference_type id = i; + std::vector< std::string,std::allocator< std::string > >::difference_type jd = j; + swig::setslice(self, id, jd, step, v); + } +SWIGINTERN void std_vector_Sl_std_string_Sg____setitem____SWIG_1(std::vector< std::string > *self,PySliceObject *slice){ + Py_ssize_t i, j, step; + if( !PySlice_Check(slice) ) { + SWIG_Error(SWIG_TypeError, "Slice object expected."); + return; + } + PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step); + std::vector< std::string,std::allocator< std::string > >::difference_type id = i; + std::vector< std::string,std::allocator< std::string > >::difference_type jd = j; + swig::delslice(self, id, jd, step); + } +SWIGINTERN void std_vector_Sl_std_string_Sg____delitem____SWIG_1(std::vector< std::string > *self,PySliceObject *slice){ + Py_ssize_t i, j, step; + if( !PySlice_Check(slice) ) { + SWIG_Error(SWIG_TypeError, "Slice object expected."); + return; + } + PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step); + std::vector< std::string,std::allocator< std::string > >::difference_type id = i; + std::vector< std::string,std::allocator< std::string > >::difference_type jd = j; + swig::delslice(self, id, jd, step); + } +SWIGINTERN std::vector< std::string >::value_type const &std_vector_Sl_std_string_Sg____getitem____SWIG_1(std::vector< std::string > const *self,std::vector< std::string >::difference_type i){ + return *(swig::cgetpos(self, i)); + } +SWIGINTERN void std_vector_Sl_std_string_Sg____setitem____SWIG_2(std::vector< std::string > *self,std::vector< std::string >::difference_type i,std::vector< std::string >::value_type const &x){ + *(swig::getpos(self,i)) = x; + } +SWIGINTERN std::vector< std::string >::value_type std_vector_Sl_std_string_Sg__pop(std::vector< std::string > *self){ + if (self->size() == 0) + throw std::out_of_range("pop from empty container"); + std::vector< std::string,std::allocator< std::string > >::value_type x = self->back(); + self->pop_back(); + return x; + } +SWIGINTERN void std_vector_Sl_std_string_Sg__append(std::vector< std::string > *self,std::vector< std::string >::value_type const &x){ + self->push_back(x); + } +SWIGINTERN std::vector< std::string >::iterator std_vector_Sl_std_string_Sg__erase__SWIG_0(std::vector< std::string > *self,std::vector< std::string >::iterator pos){ return self->erase(pos); } +SWIGINTERN std::vector< std::string >::iterator std_vector_Sl_std_string_Sg__erase__SWIG_1(std::vector< std::string > *self,std::vector< std::string >::iterator first,std::vector< std::string >::iterator last){ return self->erase(first, last); } +SWIGINTERN std::vector< std::string >::iterator std_vector_Sl_std_string_Sg__insert__SWIG_0(std::vector< std::string > *self,std::vector< std::string >::iterator pos,std::vector< std::string >::value_type const &x){ return self->insert(pos, x); } +SWIGINTERN void std_vector_Sl_std_string_Sg__insert__SWIG_1(std::vector< std::string > *self,std::vector< std::string >::iterator pos,std::vector< std::string >::size_type n,std::vector< std::string >::value_type const &x){ self->insert(pos, n, x); } + + namespace swig { + template <> struct traits< CdiVariable > { + typedef pointer_category category; + static const char* type_name() { return"CdiVariable"; } + }; + } + + + namespace swig { + template <> struct traits<std::vector< CdiVariable, std::allocator< CdiVariable > > > { + typedef pointer_category category; + static const char* type_name() { + return "std::vector<" "CdiVariable" "," "std::allocator< CdiVariable >" " >"; + } + }; + } + +SWIGINTERN swig::SwigPyIterator *std_vector_Sl_CdiVariable_Sg__iterator(std::vector< CdiVariable > *self,PyObject **PYTHON_SELF){ + return swig::make_output_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF); + } +SWIGINTERN bool std_vector_Sl_CdiVariable_Sg____nonzero__(std::vector< CdiVariable > const *self){ + return !(self->empty()); + } +SWIGINTERN bool std_vector_Sl_CdiVariable_Sg____bool__(std::vector< CdiVariable > const *self){ + return !(self->empty()); + } +SWIGINTERN std::vector< CdiVariable >::size_type std_vector_Sl_CdiVariable_Sg____len__(std::vector< CdiVariable > const *self){ + return self->size(); + } +SWIGINTERN std::vector< CdiVariable,std::allocator< CdiVariable > > *std_vector_Sl_CdiVariable_Sg____getslice__(std::vector< CdiVariable > *self,std::vector< CdiVariable >::difference_type i,std::vector< CdiVariable >::difference_type j){ + return swig::getslice(self, i, j, 1); + } +SWIGINTERN void std_vector_Sl_CdiVariable_Sg____setslice____SWIG_0(std::vector< CdiVariable > *self,std::vector< CdiVariable >::difference_type i,std::vector< CdiVariable >::difference_type j){ + swig::setslice(self, i, j, 1, std::vector< CdiVariable,std::allocator< CdiVariable > >()); + } +SWIGINTERN void std_vector_Sl_CdiVariable_Sg____setslice____SWIG_1(std::vector< CdiVariable > *self,std::vector< CdiVariable >::difference_type i,std::vector< CdiVariable >::difference_type j,std::vector< CdiVariable,std::allocator< CdiVariable > > const &v){ + swig::setslice(self, i, j, 1, v); + } +SWIGINTERN void std_vector_Sl_CdiVariable_Sg____delslice__(std::vector< CdiVariable > *self,std::vector< CdiVariable >::difference_type i,std::vector< CdiVariable >::difference_type j){ + swig::delslice(self, i, j, 1); + } +SWIGINTERN void std_vector_Sl_CdiVariable_Sg____delitem____SWIG_0(std::vector< CdiVariable > *self,std::vector< CdiVariable >::difference_type i){ + swig::erase(self, swig::getpos(self, i)); + } +SWIGINTERN std::vector< CdiVariable,std::allocator< CdiVariable > > *std_vector_Sl_CdiVariable_Sg____getitem____SWIG_0(std::vector< CdiVariable > *self,PySliceObject *slice){ + Py_ssize_t i, j, step; + if( !PySlice_Check(slice) ) { + SWIG_Error(SWIG_TypeError, "Slice object expected."); + return NULL; + } + PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step); + std::vector< CdiVariable,std::allocator< CdiVariable > >::difference_type id = i; + std::vector< CdiVariable,std::allocator< CdiVariable > >::difference_type jd = j; + return swig::getslice(self, id, jd, step); + } +SWIGINTERN void std_vector_Sl_CdiVariable_Sg____setitem____SWIG_0(std::vector< CdiVariable > *self,PySliceObject *slice,std::vector< CdiVariable,std::allocator< CdiVariable > > const &v){ + Py_ssize_t i, j, step; + if( !PySlice_Check(slice) ) { + SWIG_Error(SWIG_TypeError, "Slice object expected."); + return; + } + PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step); + std::vector< CdiVariable,std::allocator< CdiVariable > >::difference_type id = i; + std::vector< CdiVariable,std::allocator< CdiVariable > >::difference_type jd = j; + swig::setslice(self, id, jd, step, v); + } +SWIGINTERN void std_vector_Sl_CdiVariable_Sg____setitem____SWIG_1(std::vector< CdiVariable > *self,PySliceObject *slice){ + Py_ssize_t i, j, step; + if( !PySlice_Check(slice) ) { + SWIG_Error(SWIG_TypeError, "Slice object expected."); + return; + } + PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step); + std::vector< CdiVariable,std::allocator< CdiVariable > >::difference_type id = i; + std::vector< CdiVariable,std::allocator< CdiVariable > >::difference_type jd = j; + swig::delslice(self, id, jd, step); + } +SWIGINTERN void std_vector_Sl_CdiVariable_Sg____delitem____SWIG_1(std::vector< CdiVariable > *self,PySliceObject *slice){ + Py_ssize_t i, j, step; + if( !PySlice_Check(slice) ) { + SWIG_Error(SWIG_TypeError, "Slice object expected."); + return; + } + PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step); + std::vector< CdiVariable,std::allocator< CdiVariable > >::difference_type id = i; + std::vector< CdiVariable,std::allocator< CdiVariable > >::difference_type jd = j; + swig::delslice(self, id, jd, step); + } +SWIGINTERN std::vector< CdiVariable >::value_type const &std_vector_Sl_CdiVariable_Sg____getitem____SWIG_1(std::vector< CdiVariable > const *self,std::vector< CdiVariable >::difference_type i){ + return *(swig::cgetpos(self, i)); + } +SWIGINTERN void std_vector_Sl_CdiVariable_Sg____setitem____SWIG_2(std::vector< CdiVariable > *self,std::vector< CdiVariable >::difference_type i,std::vector< CdiVariable >::value_type const &x){ + *(swig::getpos(self,i)) = x; + } +SWIGINTERN std::vector< CdiVariable >::value_type std_vector_Sl_CdiVariable_Sg__pop(std::vector< CdiVariable > *self){ + if (self->size() == 0) + throw std::out_of_range("pop from empty container"); + std::vector< CdiVariable,std::allocator< CdiVariable > >::value_type x = self->back(); + self->pop_back(); + return x; + } +SWIGINTERN void std_vector_Sl_CdiVariable_Sg__append(std::vector< CdiVariable > *self,std::vector< CdiVariable >::value_type const &x){ + self->push_back(x); + } +SWIGINTERN std::vector< CdiVariable >::iterator std_vector_Sl_CdiVariable_Sg__erase__SWIG_0(std::vector< CdiVariable > *self,std::vector< CdiVariable >::iterator pos){ return self->erase(pos); } +SWIGINTERN std::vector< CdiVariable >::iterator std_vector_Sl_CdiVariable_Sg__erase__SWIG_1(std::vector< CdiVariable > *self,std::vector< CdiVariable >::iterator first,std::vector< CdiVariable >::iterator last){ return self->erase(first, last); } +SWIGINTERN std::vector< CdiVariable >::iterator std_vector_Sl_CdiVariable_Sg__insert__SWIG_0(std::vector< CdiVariable > *self,std::vector< CdiVariable >::iterator pos,std::vector< CdiVariable >::value_type const &x){ return self->insert(pos, x); } +SWIGINTERN void std_vector_Sl_CdiVariable_Sg__insert__SWIG_1(std::vector< CdiVariable > *self,std::vector< CdiVariable >::iterator pos,std::vector< CdiVariable >::size_type n,std::vector< CdiVariable >::value_type const &x){ self->insert(pos, n, x); } + + namespace swig { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + template <class T, class U > + struct traits_asptr<std::pair<T,U> > { + typedef std::pair<T,U> value_type; + + static int get_pair(PyObject* first, PyObject* second, + std::pair<T,U> **val) + { + if (val) { + value_type *vp = (new std::pair<T,U>()); + T *pfirst = &(vp->first); + int res1 = swig::asval((PyObject*)first, pfirst); + if (!SWIG_IsOK(res1)) { + delete vp; + return res1; + } + U *psecond = &(vp->second); + int res2 = swig::asval((PyObject*)second, psecond); + if (!SWIG_IsOK(res2)) { + delete vp; + return res2; + } + *val = vp; + return SWIG_AddNewMask(res1 > res2 ? res1 : res2); + } else { + T *pfirst = 0; + int res1 = swig::asval((PyObject*)first, pfirst); + if (!SWIG_IsOK(res1)) return res1; + U *psecond = 0; + int res2 = swig::asval((PyObject*)second, psecond); + if (!SWIG_IsOK(res2)) return res2; + return res1 > res2 ? res1 : res2; + } + } + + static int asptr(PyObject *obj, std::pair<T,U> **val) { + int res = SWIG_ERROR; + if (PyTuple_Check(obj)) { + if (PyTuple_GET_SIZE(obj) == 2) { + res = get_pair(PyTuple_GET_ITEM(obj,0),PyTuple_GET_ITEM(obj,1), val); + } + } else if (PySequence_Check(obj)) { + if (PySequence_Size(obj) == 2) { + swig::SwigVar_PyObject first = PySequence_GetItem(obj,0); + swig::SwigVar_PyObject second = PySequence_GetItem(obj,1); + res = get_pair(first, second, val); + } + } else { + value_type *p = 0; + swig_type_info *descriptor = swig::type_info<value_type>(); + res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR; + if (SWIG_IsOK(res) && val) *val = p; + } + return res; + } + }; + + + template <class T, class U > + struct traits_from<std::pair<T,U> > { + static PyObject *from(const std::pair<T,U>& val) { + PyObject* obj = PyTuple_New(2); + PyTuple_SetItem(obj,0,swig::from(val.first)); + PyTuple_SetItem(obj,1,swig::from(val.second)); + return obj; + } + }; + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + namespace swig { + template <> struct traits<std::pair< std::string, CdiVariable > > { + typedef pointer_category category; + static const char* type_name() { + return "std::pair<" "std::string" "," "CdiVariable" " >"; + } + }; + } + + + namespace swig { + template <class ValueType> + struct from_key_oper + { + typedef const ValueType& argument_type; + typedef PyObject *result_type; + result_type operator()(argument_type v) const + { + return swig::from(v.first); + } + }; + + template <class ValueType> + struct from_value_oper + { + typedef const ValueType& argument_type; + typedef PyObject *result_type; + result_type operator()(argument_type v) const + { + return swig::from(v.second); + } + }; + + template<class OutIterator, class FromOper, class ValueType = typename OutIterator::value_type> + struct SwigPyMapIterator_T : SwigPyIteratorClosed_T<OutIterator, ValueType, FromOper> + { + SwigPyMapIterator_T(OutIterator curr, OutIterator first, OutIterator last, PyObject *seq) + : SwigPyIteratorClosed_T<OutIterator,ValueType,FromOper>(curr, first, last, seq) + { + } + }; + + + template<class OutIterator, + class FromOper = from_key_oper<typename OutIterator::value_type> > + struct SwigPyMapKeyIterator_T : SwigPyMapIterator_T<OutIterator, FromOper> + { + SwigPyMapKeyIterator_T(OutIterator curr, OutIterator first, OutIterator last, PyObject *seq) + : SwigPyMapIterator_T<OutIterator, FromOper>(curr, first, last, seq) + { + } + }; + + template<typename OutIter> + inline SwigPyIterator* + make_output_key_iterator(const OutIter& current, const OutIter& begin, const OutIter& end, PyObject *seq = 0) + { + return new SwigPyMapKeyIterator_T<OutIter>(current, begin, end, seq); + } + + template<class OutIterator, + class FromOper = from_value_oper<typename OutIterator::value_type> > + struct SwigPyMapValueIterator_T : SwigPyMapIterator_T<OutIterator, FromOper> + { + SwigPyMapValueIterator_T(OutIterator curr, OutIterator first, OutIterator last, PyObject *seq) + : SwigPyMapIterator_T<OutIterator, FromOper>(curr, first, last, seq) + { + } + }; + + + template<typename OutIter> + inline SwigPyIterator* + make_output_value_iterator(const OutIter& current, const OutIter& begin, const OutIter& end, PyObject *seq = 0) + { + return new SwigPyMapValueIterator_T<OutIter>(current, begin, end, seq); + } + } + + + namespace swig { + template <class SwigPySeq, class K, class T, class Compare, class Alloc > + inline void + assign(const SwigPySeq& swigpyseq, std::map<K,T,Compare,Alloc > *map) { + typedef typename std::map<K,T,Compare,Alloc >::value_type value_type; + typename SwigPySeq::const_iterator it = swigpyseq.begin(); + for (;it != swigpyseq.end(); ++it) { + map->insert(value_type(it->first, it->second)); + } + } + + template <class K, class T, class Compare, class Alloc> + struct traits_asptr<std::map<K,T,Compare,Alloc > > { + typedef std::map<K,T,Compare,Alloc > map_type; + static int asptr(PyObject *obj, map_type **val) { + int res = SWIG_ERROR; + SWIG_PYTHON_THREAD_BEGIN_BLOCK; + if (PyDict_Check(obj)) { + SwigVar_PyObject items = PyObject_CallMethod(obj,(char *)"items",NULL); +#if PY_VERSION_HEX >= 0x03000000 + /* In Python 3.x the ".items()" method returns a dict_items object */ + items = PySequence_Fast(items, ".items() didn't return a sequence!"); +#endif + res = traits_asptr_stdseq<map_type, std::pair<K, T> >::asptr(items, val); + } else { + map_type *p = 0; + swig_type_info *descriptor = swig::type_info<map_type>(); + res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR; + if (SWIG_IsOK(res) && val) *val = p; + } + SWIG_PYTHON_THREAD_END_BLOCK; + return res; + } + }; + + template <class K, class T, class Compare, class Alloc > + struct traits_from<std::map<K,T,Compare,Alloc > > { + typedef std::map<K,T,Compare,Alloc > map_type; + typedef typename map_type::const_iterator const_iterator; + typedef typename map_type::size_type size_type; + + static PyObject *asdict(const map_type& map) { + SWIG_PYTHON_THREAD_BEGIN_BLOCK; + size_type size = map.size(); + Py_ssize_t pysize = (size <= (size_type) INT_MAX) ? (Py_ssize_t) size : -1; + if (pysize < 0) { + PyErr_SetString(PyExc_OverflowError, "map size not valid in python"); + SWIG_PYTHON_THREAD_END_BLOCK; + return NULL; + } + PyObject *obj = PyDict_New(); + for (const_iterator i= map.begin(); i!= map.end(); ++i) { + swig::SwigVar_PyObject key = swig::from(i->first); + swig::SwigVar_PyObject val = swig::from(i->second); + PyDict_SetItem(obj, key, val); + } + SWIG_PYTHON_THREAD_END_BLOCK; + return obj; + } + + static PyObject *from(const map_type& map) { + swig_type_info *desc = swig::type_info<map_type>(); + if (desc && desc->clientdata) { + return SWIG_InternalNewPointerObj(new map_type(map), desc, SWIG_POINTER_OWN); + } else { + return asdict(map); + } + } + }; + } + + + namespace swig { + template <> struct traits<std::map< std::string, CdiVariable, std::less< std::string >, std::allocator< std::pair< std::string const,CdiVariable > > > > { + typedef pointer_category category; + static const char* type_name() { + return "std::map<" "std::string" "," "CdiVariable" "," "std::less< std::string >" "," "std::allocator< std::pair< std::string const,CdiVariable > >" " >"; + } + }; + } + +SWIGINTERN swig::SwigPyIterator *std_map_Sl_std_string_Sc_CdiVariable_Sg__iterator(std::map< std::string,CdiVariable > *self,PyObject **PYTHON_SELF){ + return swig::make_output_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF); + } +SWIGINTERN bool std_map_Sl_std_string_Sc_CdiVariable_Sg____nonzero__(std::map< std::string,CdiVariable > const *self){ + return !(self->empty()); + } +SWIGINTERN bool std_map_Sl_std_string_Sc_CdiVariable_Sg____bool__(std::map< std::string,CdiVariable > const *self){ + return !(self->empty()); + } +SWIGINTERN std::map< std::string,CdiVariable >::size_type std_map_Sl_std_string_Sc_CdiVariable_Sg____len__(std::map< std::string,CdiVariable > const *self){ + return self->size(); + } +SWIGINTERN std::map< std::string,CdiVariable >::mapped_type const &std_map_Sl_std_string_Sc_CdiVariable_Sg____getitem__(std::map< std::string,CdiVariable > *self,std::map< std::string,CdiVariable >::key_type const &key){ + std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::const_iterator i = self->find(key); + if (i != self->end()) + return i->second; + else + throw std::out_of_range("key not found"); + } +SWIGINTERN void std_map_Sl_std_string_Sc_CdiVariable_Sg____delitem__(std::map< std::string,CdiVariable > *self,std::map< std::string,CdiVariable >::key_type const &key){ + std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::iterator i = self->find(key); + if (i != self->end()) + self->erase(i); + else + throw std::out_of_range("key not found"); + } +SWIGINTERN bool std_map_Sl_std_string_Sc_CdiVariable_Sg__has_key(std::map< std::string,CdiVariable > const *self,std::map< std::string,CdiVariable >::key_type const &key){ + std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::const_iterator i = self->find(key); + return i != self->end(); + } +SWIGINTERN PyObject *std_map_Sl_std_string_Sc_CdiVariable_Sg__keys(std::map< std::string,CdiVariable > *self){ + std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::size_type size = self->size(); + Py_ssize_t pysize = (size <= (std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::size_type) INT_MAX) ? (Py_ssize_t) size : -1; + SWIG_PYTHON_THREAD_BEGIN_BLOCK; + if (pysize < 0) { + PyErr_SetString(PyExc_OverflowError, "map size not valid in python"); + SWIG_PYTHON_THREAD_END_BLOCK; + return NULL; + } + PyObject* keyList = PyList_New(pysize); + std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::const_iterator i = self->begin(); + for (Py_ssize_t j = 0; j < pysize; ++i, ++j) { + PyList_SET_ITEM(keyList, j, swig::from(i->first)); + } + SWIG_PYTHON_THREAD_END_BLOCK; + return keyList; + } +SWIGINTERN PyObject *std_map_Sl_std_string_Sc_CdiVariable_Sg__values(std::map< std::string,CdiVariable > *self){ + std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::size_type size = self->size(); + Py_ssize_t pysize = (size <= (std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::size_type) INT_MAX) ? (Py_ssize_t) size : -1; + SWIG_PYTHON_THREAD_BEGIN_BLOCK; + if (pysize < 0) { + PyErr_SetString(PyExc_OverflowError, "map size not valid in python"); + SWIG_PYTHON_THREAD_END_BLOCK; + return NULL; + } + PyObject* valList = PyList_New(pysize); + std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::const_iterator i = self->begin(); + for (Py_ssize_t j = 0; j < pysize; ++i, ++j) { + PyList_SET_ITEM(valList, j, swig::from(i->second)); + } + SWIG_PYTHON_THREAD_END_BLOCK; + return valList; + } +SWIGINTERN PyObject *std_map_Sl_std_string_Sc_CdiVariable_Sg__items(std::map< std::string,CdiVariable > *self){ + std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::size_type size = self->size(); + Py_ssize_t pysize = (size <= (std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::size_type) INT_MAX) ? (Py_ssize_t) size : -1; + SWIG_PYTHON_THREAD_BEGIN_BLOCK; + if (pysize < 0) { + PyErr_SetString(PyExc_OverflowError, "map size not valid in python"); + SWIG_PYTHON_THREAD_END_BLOCK; + return NULL; + } + PyObject* itemList = PyList_New(pysize); + std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::const_iterator i = self->begin(); + for (Py_ssize_t j = 0; j < pysize; ++i, ++j) { + PyList_SET_ITEM(itemList, j, swig::from(*i)); + } + SWIG_PYTHON_THREAD_END_BLOCK; + return itemList; + } +SWIGINTERN bool std_map_Sl_std_string_Sc_CdiVariable_Sg____contains__(std::map< std::string,CdiVariable > *self,std::map< std::string,CdiVariable >::key_type const &key){ + return self->find(key) != self->end(); + } +SWIGINTERN swig::SwigPyIterator *std_map_Sl_std_string_Sc_CdiVariable_Sg__key_iterator(std::map< std::string,CdiVariable > *self,PyObject **PYTHON_SELF){ + return swig::make_output_key_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF); + } +SWIGINTERN swig::SwigPyIterator *std_map_Sl_std_string_Sc_CdiVariable_Sg__value_iterator(std::map< std::string,CdiVariable > *self,PyObject **PYTHON_SELF){ + return swig::make_output_value_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF); + } +SWIGINTERN void std_map_Sl_std_string_Sc_CdiVariable_Sg____setitem____SWIG_0(std::map< std::string,CdiVariable > *self,std::map< std::string,CdiVariable >::key_type const &key){ + self->erase(key); + } +SWIGINTERN void std_map_Sl_std_string_Sc_CdiVariable_Sg____setitem____SWIG_1(std::map< std::string,CdiVariable > *self,std::map< std::string,CdiVariable >::key_type const &key,std::map< std::string,CdiVariable >::mapped_type const &x){ + (*self)[key] = x; + } +SWIGINTERN PyObject *std_map_Sl_std_string_Sc_CdiVariable_Sg__asdict(std::map< std::string,CdiVariable > *self){ + return swig::traits_from< std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > > >::asdict(*self); + } +SWIGINTERN void std_map_Sl_std_string_Sc_CdiVariable_Sg__erase__SWIG_1(std::map< std::string,CdiVariable > *self,std::map< std::string,CdiVariable >::iterator position){ self->erase(position); } +SWIGINTERN void std_map_Sl_std_string_Sc_CdiVariable_Sg__erase__SWIG_2(std::map< std::string,CdiVariable > *self,std::map< std::string,CdiVariable >::iterator first,std::map< std::string,CdiVariable >::iterator last){ self->erase(first, last); } + + namespace swig { + template <> struct traits<std::pair< int, CdiVariable > > { + typedef pointer_category category; + static const char* type_name() { + return "std::pair<" "int" "," "CdiVariable" " >"; + } + }; + } + + + namespace swig { + template <> struct traits<std::map< int, CdiVariable, std::less< int >, std::allocator< std::pair< int const,CdiVariable > > > > { + typedef pointer_category category; + static const char* type_name() { + return "std::map<" "int" "," "CdiVariable" "," "std::less< int >" "," "std::allocator< std::pair< int const,CdiVariable > >" " >"; + } + }; + } + +SWIGINTERN swig::SwigPyIterator *std_map_Sl_int_Sc_CdiVariable_Sg__iterator(std::map< int,CdiVariable > *self,PyObject **PYTHON_SELF){ + return swig::make_output_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF); + } +SWIGINTERN bool std_map_Sl_int_Sc_CdiVariable_Sg____nonzero__(std::map< int,CdiVariable > const *self){ + return !(self->empty()); + } +SWIGINTERN bool std_map_Sl_int_Sc_CdiVariable_Sg____bool__(std::map< int,CdiVariable > const *self){ + return !(self->empty()); + } +SWIGINTERN std::map< int,CdiVariable >::size_type std_map_Sl_int_Sc_CdiVariable_Sg____len__(std::map< int,CdiVariable > const *self){ + return self->size(); + } +SWIGINTERN std::map< int,CdiVariable >::mapped_type const &std_map_Sl_int_Sc_CdiVariable_Sg____getitem__(std::map< int,CdiVariable > *self,std::map< int,CdiVariable >::key_type const &key){ + std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::const_iterator i = self->find(key); + if (i != self->end()) + return i->second; + else + throw std::out_of_range("key not found"); + } +SWIGINTERN void std_map_Sl_int_Sc_CdiVariable_Sg____delitem__(std::map< int,CdiVariable > *self,std::map< int,CdiVariable >::key_type const &key){ + std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::iterator i = self->find(key); + if (i != self->end()) + self->erase(i); + else + throw std::out_of_range("key not found"); + } +SWIGINTERN bool std_map_Sl_int_Sc_CdiVariable_Sg__has_key(std::map< int,CdiVariable > const *self,std::map< int,CdiVariable >::key_type const &key){ + std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::const_iterator i = self->find(key); + return i != self->end(); + } +SWIGINTERN PyObject *std_map_Sl_int_Sc_CdiVariable_Sg__keys(std::map< int,CdiVariable > *self){ + std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::size_type size = self->size(); + Py_ssize_t pysize = (size <= (std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::size_type) INT_MAX) ? (Py_ssize_t) size : -1; + SWIG_PYTHON_THREAD_BEGIN_BLOCK; + if (pysize < 0) { + PyErr_SetString(PyExc_OverflowError, "map size not valid in python"); + SWIG_PYTHON_THREAD_END_BLOCK; + return NULL; + } + PyObject* keyList = PyList_New(pysize); + std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::const_iterator i = self->begin(); + for (Py_ssize_t j = 0; j < pysize; ++i, ++j) { + PyList_SET_ITEM(keyList, j, swig::from(i->first)); + } + SWIG_PYTHON_THREAD_END_BLOCK; + return keyList; + } +SWIGINTERN PyObject *std_map_Sl_int_Sc_CdiVariable_Sg__values(std::map< int,CdiVariable > *self){ + std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::size_type size = self->size(); + Py_ssize_t pysize = (size <= (std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::size_type) INT_MAX) ? (Py_ssize_t) size : -1; + SWIG_PYTHON_THREAD_BEGIN_BLOCK; + if (pysize < 0) { + PyErr_SetString(PyExc_OverflowError, "map size not valid in python"); + SWIG_PYTHON_THREAD_END_BLOCK; + return NULL; + } + PyObject* valList = PyList_New(pysize); + std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::const_iterator i = self->begin(); + for (Py_ssize_t j = 0; j < pysize; ++i, ++j) { + PyList_SET_ITEM(valList, j, swig::from(i->second)); + } + SWIG_PYTHON_THREAD_END_BLOCK; + return valList; + } +SWIGINTERN PyObject *std_map_Sl_int_Sc_CdiVariable_Sg__items(std::map< int,CdiVariable > *self){ + std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::size_type size = self->size(); + Py_ssize_t pysize = (size <= (std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::size_type) INT_MAX) ? (Py_ssize_t) size : -1; + SWIG_PYTHON_THREAD_BEGIN_BLOCK; + if (pysize < 0) { + PyErr_SetString(PyExc_OverflowError, "map size not valid in python"); + SWIG_PYTHON_THREAD_END_BLOCK; + return NULL; + } + PyObject* itemList = PyList_New(pysize); + std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::const_iterator i = self->begin(); + for (Py_ssize_t j = 0; j < pysize; ++i, ++j) { + PyList_SET_ITEM(itemList, j, swig::from(*i)); + } + SWIG_PYTHON_THREAD_END_BLOCK; + return itemList; + } +SWIGINTERN bool std_map_Sl_int_Sc_CdiVariable_Sg____contains__(std::map< int,CdiVariable > *self,std::map< int,CdiVariable >::key_type const &key){ + return self->find(key) != self->end(); + } +SWIGINTERN swig::SwigPyIterator *std_map_Sl_int_Sc_CdiVariable_Sg__key_iterator(std::map< int,CdiVariable > *self,PyObject **PYTHON_SELF){ + return swig::make_output_key_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF); + } +SWIGINTERN swig::SwigPyIterator *std_map_Sl_int_Sc_CdiVariable_Sg__value_iterator(std::map< int,CdiVariable > *self,PyObject **PYTHON_SELF){ + return swig::make_output_value_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF); + } +SWIGINTERN void std_map_Sl_int_Sc_CdiVariable_Sg____setitem____SWIG_0(std::map< int,CdiVariable > *self,std::map< int,CdiVariable >::key_type const &key){ + self->erase(key); + } +SWIGINTERN void std_map_Sl_int_Sc_CdiVariable_Sg____setitem____SWIG_1(std::map< int,CdiVariable > *self,std::map< int,CdiVariable >::key_type const &key,std::map< int,CdiVariable >::mapped_type const &x){ + (*self)[key] = x; + } +SWIGINTERN PyObject *std_map_Sl_int_Sc_CdiVariable_Sg__asdict(std::map< int,CdiVariable > *self){ + return swig::traits_from< std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > > >::asdict(*self); + } +SWIGINTERN void std_map_Sl_int_Sc_CdiVariable_Sg__erase__SWIG_1(std::map< int,CdiVariable > *self,std::map< int,CdiVariable >::iterator position){ self->erase(position); } +SWIGINTERN void std_map_Sl_int_Sc_CdiVariable_Sg__erase__SWIG_2(std::map< int,CdiVariable > *self,std::map< int,CdiVariable >::iterator first,std::map< int,CdiVariable >::iterator last){ self->erase(first, last); } + + namespace swig { + template <> struct traits< CdiTaxis > { + typedef pointer_category category; + static const char* type_name() { return"CdiTaxis"; } + }; + } + + + namespace swig { + template <> struct traits<std::pair< int, CdiTaxis > > { + typedef pointer_category category; + static const char* type_name() { + return "std::pair<" "int" "," "CdiTaxis" " >"; + } + }; + } + + + namespace swig { + template <> struct traits<std::map< int, CdiTaxis, std::less< int >, std::allocator< std::pair< int const,CdiTaxis > > > > { + typedef pointer_category category; + static const char* type_name() { + return "std::map<" "int" "," "CdiTaxis" "," "std::less< int >" "," "std::allocator< std::pair< int const,CdiTaxis > >" " >"; + } + }; + } + +SWIGINTERN swig::SwigPyIterator *std_map_Sl_int_Sc_CdiTaxis_Sg__iterator(std::map< int,CdiTaxis > *self,PyObject **PYTHON_SELF){ + return swig::make_output_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF); + } +SWIGINTERN bool std_map_Sl_int_Sc_CdiTaxis_Sg____nonzero__(std::map< int,CdiTaxis > const *self){ + return !(self->empty()); + } +SWIGINTERN bool std_map_Sl_int_Sc_CdiTaxis_Sg____bool__(std::map< int,CdiTaxis > const *self){ + return !(self->empty()); + } +SWIGINTERN std::map< int,CdiTaxis >::size_type std_map_Sl_int_Sc_CdiTaxis_Sg____len__(std::map< int,CdiTaxis > const *self){ + return self->size(); + } +SWIGINTERN std::map< int,CdiTaxis >::mapped_type const &std_map_Sl_int_Sc_CdiTaxis_Sg____getitem__(std::map< int,CdiTaxis > *self,std::map< int,CdiTaxis >::key_type const &key){ + std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::const_iterator i = self->find(key); + if (i != self->end()) + return i->second; + else + throw std::out_of_range("key not found"); + } +SWIGINTERN void std_map_Sl_int_Sc_CdiTaxis_Sg____delitem__(std::map< int,CdiTaxis > *self,std::map< int,CdiTaxis >::key_type const &key){ + std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::iterator i = self->find(key); + if (i != self->end()) + self->erase(i); + else + throw std::out_of_range("key not found"); + } +SWIGINTERN bool std_map_Sl_int_Sc_CdiTaxis_Sg__has_key(std::map< int,CdiTaxis > const *self,std::map< int,CdiTaxis >::key_type const &key){ + std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::const_iterator i = self->find(key); + return i != self->end(); + } +SWIGINTERN PyObject *std_map_Sl_int_Sc_CdiTaxis_Sg__keys(std::map< int,CdiTaxis > *self){ + std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::size_type size = self->size(); + Py_ssize_t pysize = (size <= (std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::size_type) INT_MAX) ? (Py_ssize_t) size : -1; + SWIG_PYTHON_THREAD_BEGIN_BLOCK; + if (pysize < 0) { + PyErr_SetString(PyExc_OverflowError, "map size not valid in python"); + SWIG_PYTHON_THREAD_END_BLOCK; + return NULL; + } + PyObject* keyList = PyList_New(pysize); + std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::const_iterator i = self->begin(); + for (Py_ssize_t j = 0; j < pysize; ++i, ++j) { + PyList_SET_ITEM(keyList, j, swig::from(i->first)); + } + SWIG_PYTHON_THREAD_END_BLOCK; + return keyList; + } +SWIGINTERN PyObject *std_map_Sl_int_Sc_CdiTaxis_Sg__values(std::map< int,CdiTaxis > *self){ + std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::size_type size = self->size(); + Py_ssize_t pysize = (size <= (std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::size_type) INT_MAX) ? (Py_ssize_t) size : -1; + SWIG_PYTHON_THREAD_BEGIN_BLOCK; + if (pysize < 0) { + PyErr_SetString(PyExc_OverflowError, "map size not valid in python"); + SWIG_PYTHON_THREAD_END_BLOCK; + return NULL; + } + PyObject* valList = PyList_New(pysize); + std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::const_iterator i = self->begin(); + for (Py_ssize_t j = 0; j < pysize; ++i, ++j) { + PyList_SET_ITEM(valList, j, swig::from(i->second)); + } + SWIG_PYTHON_THREAD_END_BLOCK; + return valList; + } +SWIGINTERN PyObject *std_map_Sl_int_Sc_CdiTaxis_Sg__items(std::map< int,CdiTaxis > *self){ + std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::size_type size = self->size(); + Py_ssize_t pysize = (size <= (std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::size_type) INT_MAX) ? (Py_ssize_t) size : -1; + SWIG_PYTHON_THREAD_BEGIN_BLOCK; + if (pysize < 0) { + PyErr_SetString(PyExc_OverflowError, "map size not valid in python"); + SWIG_PYTHON_THREAD_END_BLOCK; + return NULL; + } + PyObject* itemList = PyList_New(pysize); + std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::const_iterator i = self->begin(); + for (Py_ssize_t j = 0; j < pysize; ++i, ++j) { + PyList_SET_ITEM(itemList, j, swig::from(*i)); + } + SWIG_PYTHON_THREAD_END_BLOCK; + return itemList; + } +SWIGINTERN bool std_map_Sl_int_Sc_CdiTaxis_Sg____contains__(std::map< int,CdiTaxis > *self,std::map< int,CdiTaxis >::key_type const &key){ + return self->find(key) != self->end(); + } +SWIGINTERN swig::SwigPyIterator *std_map_Sl_int_Sc_CdiTaxis_Sg__key_iterator(std::map< int,CdiTaxis > *self,PyObject **PYTHON_SELF){ + return swig::make_output_key_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF); + } +SWIGINTERN swig::SwigPyIterator *std_map_Sl_int_Sc_CdiTaxis_Sg__value_iterator(std::map< int,CdiTaxis > *self,PyObject **PYTHON_SELF){ + return swig::make_output_value_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF); + } +SWIGINTERN void std_map_Sl_int_Sc_CdiTaxis_Sg____setitem____SWIG_0(std::map< int,CdiTaxis > *self,std::map< int,CdiTaxis >::key_type const &key){ + self->erase(key); + } +SWIGINTERN void std_map_Sl_int_Sc_CdiTaxis_Sg____setitem____SWIG_1(std::map< int,CdiTaxis > *self,std::map< int,CdiTaxis >::key_type const &key,std::map< int,CdiTaxis >::mapped_type const &x){ + (*self)[key] = x; + } +SWIGINTERN PyObject *std_map_Sl_int_Sc_CdiTaxis_Sg__asdict(std::map< int,CdiTaxis > *self){ + return swig::traits_from< std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > > >::asdict(*self); + } +SWIGINTERN void std_map_Sl_int_Sc_CdiTaxis_Sg__erase__SWIG_1(std::map< int,CdiTaxis > *self,std::map< int,CdiTaxis >::iterator position){ self->erase(position); } +SWIGINTERN void std_map_Sl_int_Sc_CdiTaxis_Sg__erase__SWIG_2(std::map< int,CdiTaxis > *self,std::map< int,CdiTaxis >::iterator first,std::map< int,CdiTaxis >::iterator last){ self->erase(first, last); } + + namespace swig { + template <> struct traits< CdiZaxis > { + typedef pointer_category category; + static const char* type_name() { return"CdiZaxis"; } + }; + } + + + namespace swig { + template <> struct traits<std::pair< int, CdiZaxis > > { + typedef pointer_category category; + static const char* type_name() { + return "std::pair<" "int" "," "CdiZaxis" " >"; + } + }; + } + + + namespace swig { + template <> struct traits<std::map< int, CdiZaxis, std::less< int >, std::allocator< std::pair< int const,CdiZaxis > > > > { + typedef pointer_category category; + static const char* type_name() { + return "std::map<" "int" "," "CdiZaxis" "," "std::less< int >" "," "std::allocator< std::pair< int const,CdiZaxis > >" " >"; + } + }; + } + +SWIGINTERN swig::SwigPyIterator *std_map_Sl_int_Sc_CdiZaxis_Sg__iterator(std::map< int,CdiZaxis > *self,PyObject **PYTHON_SELF){ + return swig::make_output_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF); + } +SWIGINTERN bool std_map_Sl_int_Sc_CdiZaxis_Sg____nonzero__(std::map< int,CdiZaxis > const *self){ + return !(self->empty()); + } +SWIGINTERN bool std_map_Sl_int_Sc_CdiZaxis_Sg____bool__(std::map< int,CdiZaxis > const *self){ + return !(self->empty()); + } +SWIGINTERN std::map< int,CdiZaxis >::size_type std_map_Sl_int_Sc_CdiZaxis_Sg____len__(std::map< int,CdiZaxis > const *self){ + return self->size(); + } +SWIGINTERN std::map< int,CdiZaxis >::mapped_type const &std_map_Sl_int_Sc_CdiZaxis_Sg____getitem__(std::map< int,CdiZaxis > *self,std::map< int,CdiZaxis >::key_type const &key){ + std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::const_iterator i = self->find(key); + if (i != self->end()) + return i->second; + else + throw std::out_of_range("key not found"); + } +SWIGINTERN void std_map_Sl_int_Sc_CdiZaxis_Sg____delitem__(std::map< int,CdiZaxis > *self,std::map< int,CdiZaxis >::key_type const &key){ + std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::iterator i = self->find(key); + if (i != self->end()) + self->erase(i); + else + throw std::out_of_range("key not found"); + } +SWIGINTERN bool std_map_Sl_int_Sc_CdiZaxis_Sg__has_key(std::map< int,CdiZaxis > const *self,std::map< int,CdiZaxis >::key_type const &key){ + std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::const_iterator i = self->find(key); + return i != self->end(); + } +SWIGINTERN PyObject *std_map_Sl_int_Sc_CdiZaxis_Sg__keys(std::map< int,CdiZaxis > *self){ + std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::size_type size = self->size(); + Py_ssize_t pysize = (size <= (std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::size_type) INT_MAX) ? (Py_ssize_t) size : -1; + SWIG_PYTHON_THREAD_BEGIN_BLOCK; + if (pysize < 0) { + PyErr_SetString(PyExc_OverflowError, "map size not valid in python"); + SWIG_PYTHON_THREAD_END_BLOCK; + return NULL; + } + PyObject* keyList = PyList_New(pysize); + std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::const_iterator i = self->begin(); + for (Py_ssize_t j = 0; j < pysize; ++i, ++j) { + PyList_SET_ITEM(keyList, j, swig::from(i->first)); + } + SWIG_PYTHON_THREAD_END_BLOCK; + return keyList; + } +SWIGINTERN PyObject *std_map_Sl_int_Sc_CdiZaxis_Sg__values(std::map< int,CdiZaxis > *self){ + std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::size_type size = self->size(); + Py_ssize_t pysize = (size <= (std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::size_type) INT_MAX) ? (Py_ssize_t) size : -1; + SWIG_PYTHON_THREAD_BEGIN_BLOCK; + if (pysize < 0) { + PyErr_SetString(PyExc_OverflowError, "map size not valid in python"); + SWIG_PYTHON_THREAD_END_BLOCK; + return NULL; + } + PyObject* valList = PyList_New(pysize); + std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::const_iterator i = self->begin(); + for (Py_ssize_t j = 0; j < pysize; ++i, ++j) { + PyList_SET_ITEM(valList, j, swig::from(i->second)); + } + SWIG_PYTHON_THREAD_END_BLOCK; + return valList; + } +SWIGINTERN PyObject *std_map_Sl_int_Sc_CdiZaxis_Sg__items(std::map< int,CdiZaxis > *self){ + std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::size_type size = self->size(); + Py_ssize_t pysize = (size <= (std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::size_type) INT_MAX) ? (Py_ssize_t) size : -1; + SWIG_PYTHON_THREAD_BEGIN_BLOCK; + if (pysize < 0) { + PyErr_SetString(PyExc_OverflowError, "map size not valid in python"); + SWIG_PYTHON_THREAD_END_BLOCK; + return NULL; + } + PyObject* itemList = PyList_New(pysize); + std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::const_iterator i = self->begin(); + for (Py_ssize_t j = 0; j < pysize; ++i, ++j) { + PyList_SET_ITEM(itemList, j, swig::from(*i)); + } + SWIG_PYTHON_THREAD_END_BLOCK; + return itemList; + } +SWIGINTERN bool std_map_Sl_int_Sc_CdiZaxis_Sg____contains__(std::map< int,CdiZaxis > *self,std::map< int,CdiZaxis >::key_type const &key){ + return self->find(key) != self->end(); + } +SWIGINTERN swig::SwigPyIterator *std_map_Sl_int_Sc_CdiZaxis_Sg__key_iterator(std::map< int,CdiZaxis > *self,PyObject **PYTHON_SELF){ + return swig::make_output_key_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF); + } +SWIGINTERN swig::SwigPyIterator *std_map_Sl_int_Sc_CdiZaxis_Sg__value_iterator(std::map< int,CdiZaxis > *self,PyObject **PYTHON_SELF){ + return swig::make_output_value_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF); + } +SWIGINTERN void std_map_Sl_int_Sc_CdiZaxis_Sg____setitem____SWIG_0(std::map< int,CdiZaxis > *self,std::map< int,CdiZaxis >::key_type const &key){ + self->erase(key); + } +SWIGINTERN void std_map_Sl_int_Sc_CdiZaxis_Sg____setitem____SWIG_1(std::map< int,CdiZaxis > *self,std::map< int,CdiZaxis >::key_type const &key,std::map< int,CdiZaxis >::mapped_type const &x){ + (*self)[key] = x; + } +SWIGINTERN PyObject *std_map_Sl_int_Sc_CdiZaxis_Sg__asdict(std::map< int,CdiZaxis > *self){ + return swig::traits_from< std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > > >::asdict(*self); + } +SWIGINTERN void std_map_Sl_int_Sc_CdiZaxis_Sg__erase__SWIG_1(std::map< int,CdiZaxis > *self,std::map< int,CdiZaxis >::iterator position){ self->erase(position); } +SWIGINTERN void std_map_Sl_int_Sc_CdiZaxis_Sg__erase__SWIG_2(std::map< int,CdiZaxis > *self,std::map< int,CdiZaxis >::iterator first,std::map< int,CdiZaxis >::iterator last){ self->erase(first, last); } + + namespace swig { + template <> struct traits< CdiGrid > { + typedef pointer_category category; + static const char* type_name() { return"CdiGrid"; } + }; + } + + + namespace swig { + template <> struct traits<std::pair< int, CdiGrid > > { + typedef pointer_category category; + static const char* type_name() { + return "std::pair<" "int" "," "CdiGrid" " >"; + } + }; + } + + + namespace swig { + template <> struct traits<std::map< int, CdiGrid, std::less< int >, std::allocator< std::pair< int const,CdiGrid > > > > { + typedef pointer_category category; + static const char* type_name() { + return "std::map<" "int" "," "CdiGrid" "," "std::less< int >" "," "std::allocator< std::pair< int const,CdiGrid > >" " >"; + } + }; + } + +SWIGINTERN swig::SwigPyIterator *std_map_Sl_int_Sc_CdiGrid_Sg__iterator(std::map< int,CdiGrid > *self,PyObject **PYTHON_SELF){ + return swig::make_output_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF); + } +SWIGINTERN bool std_map_Sl_int_Sc_CdiGrid_Sg____nonzero__(std::map< int,CdiGrid > const *self){ + return !(self->empty()); + } +SWIGINTERN bool std_map_Sl_int_Sc_CdiGrid_Sg____bool__(std::map< int,CdiGrid > const *self){ + return !(self->empty()); + } +SWIGINTERN std::map< int,CdiGrid >::size_type std_map_Sl_int_Sc_CdiGrid_Sg____len__(std::map< int,CdiGrid > const *self){ + return self->size(); + } +SWIGINTERN std::map< int,CdiGrid >::mapped_type const &std_map_Sl_int_Sc_CdiGrid_Sg____getitem__(std::map< int,CdiGrid > *self,std::map< int,CdiGrid >::key_type const &key){ + std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::const_iterator i = self->find(key); + if (i != self->end()) + return i->second; + else + throw std::out_of_range("key not found"); + } +SWIGINTERN void std_map_Sl_int_Sc_CdiGrid_Sg____delitem__(std::map< int,CdiGrid > *self,std::map< int,CdiGrid >::key_type const &key){ + std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::iterator i = self->find(key); + if (i != self->end()) + self->erase(i); + else + throw std::out_of_range("key not found"); + } +SWIGINTERN bool std_map_Sl_int_Sc_CdiGrid_Sg__has_key(std::map< int,CdiGrid > const *self,std::map< int,CdiGrid >::key_type const &key){ + std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::const_iterator i = self->find(key); + return i != self->end(); + } +SWIGINTERN PyObject *std_map_Sl_int_Sc_CdiGrid_Sg__keys(std::map< int,CdiGrid > *self){ + std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::size_type size = self->size(); + Py_ssize_t pysize = (size <= (std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::size_type) INT_MAX) ? (Py_ssize_t) size : -1; + SWIG_PYTHON_THREAD_BEGIN_BLOCK; + if (pysize < 0) { + PyErr_SetString(PyExc_OverflowError, "map size not valid in python"); + SWIG_PYTHON_THREAD_END_BLOCK; + return NULL; + } + PyObject* keyList = PyList_New(pysize); + std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::const_iterator i = self->begin(); + for (Py_ssize_t j = 0; j < pysize; ++i, ++j) { + PyList_SET_ITEM(keyList, j, swig::from(i->first)); + } + SWIG_PYTHON_THREAD_END_BLOCK; + return keyList; + } +SWIGINTERN PyObject *std_map_Sl_int_Sc_CdiGrid_Sg__values(std::map< int,CdiGrid > *self){ + std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::size_type size = self->size(); + Py_ssize_t pysize = (size <= (std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::size_type) INT_MAX) ? (Py_ssize_t) size : -1; + SWIG_PYTHON_THREAD_BEGIN_BLOCK; + if (pysize < 0) { + PyErr_SetString(PyExc_OverflowError, "map size not valid in python"); + SWIG_PYTHON_THREAD_END_BLOCK; + return NULL; + } + PyObject* valList = PyList_New(pysize); + std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::const_iterator i = self->begin(); + for (Py_ssize_t j = 0; j < pysize; ++i, ++j) { + PyList_SET_ITEM(valList, j, swig::from(i->second)); + } + SWIG_PYTHON_THREAD_END_BLOCK; + return valList; + } +SWIGINTERN PyObject *std_map_Sl_int_Sc_CdiGrid_Sg__items(std::map< int,CdiGrid > *self){ + std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::size_type size = self->size(); + Py_ssize_t pysize = (size <= (std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::size_type) INT_MAX) ? (Py_ssize_t) size : -1; + SWIG_PYTHON_THREAD_BEGIN_BLOCK; + if (pysize < 0) { + PyErr_SetString(PyExc_OverflowError, "map size not valid in python"); + SWIG_PYTHON_THREAD_END_BLOCK; + return NULL; + } + PyObject* itemList = PyList_New(pysize); + std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::const_iterator i = self->begin(); + for (Py_ssize_t j = 0; j < pysize; ++i, ++j) { + PyList_SET_ITEM(itemList, j, swig::from(*i)); + } + SWIG_PYTHON_THREAD_END_BLOCK; + return itemList; + } +SWIGINTERN bool std_map_Sl_int_Sc_CdiGrid_Sg____contains__(std::map< int,CdiGrid > *self,std::map< int,CdiGrid >::key_type const &key){ + return self->find(key) != self->end(); + } +SWIGINTERN swig::SwigPyIterator *std_map_Sl_int_Sc_CdiGrid_Sg__key_iterator(std::map< int,CdiGrid > *self,PyObject **PYTHON_SELF){ + return swig::make_output_key_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF); + } +SWIGINTERN swig::SwigPyIterator *std_map_Sl_int_Sc_CdiGrid_Sg__value_iterator(std::map< int,CdiGrid > *self,PyObject **PYTHON_SELF){ + return swig::make_output_value_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF); + } +SWIGINTERN void std_map_Sl_int_Sc_CdiGrid_Sg____setitem____SWIG_0(std::map< int,CdiGrid > *self,std::map< int,CdiGrid >::key_type const &key){ + self->erase(key); + } +SWIGINTERN void std_map_Sl_int_Sc_CdiGrid_Sg____setitem____SWIG_1(std::map< int,CdiGrid > *self,std::map< int,CdiGrid >::key_type const &key,std::map< int,CdiGrid >::mapped_type const &x){ + (*self)[key] = x; + } +SWIGINTERN PyObject *std_map_Sl_int_Sc_CdiGrid_Sg__asdict(std::map< int,CdiGrid > *self){ + return swig::traits_from< std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > > >::asdict(*self); + } +SWIGINTERN void std_map_Sl_int_Sc_CdiGrid_Sg__erase__SWIG_1(std::map< int,CdiGrid > *self,std::map< int,CdiGrid >::iterator position){ self->erase(position); } +SWIGINTERN void std_map_Sl_int_Sc_CdiGrid_Sg__erase__SWIG_2(std::map< int,CdiGrid > *self,std::map< int,CdiGrid >::iterator first,std::map< int,CdiGrid >::iterator last){ self->erase(first, last); } + +SWIGINTERN int +SWIG_AsVal_bool (PyObject *obj, bool *val) +{ + int r; + if (!PyBool_Check(obj)) + return SWIG_ERROR; + r = PyObject_IsTrue(obj); + if (r == -1) + return SWIG_ERROR; + if (val) *val = r ? true : false; + return SWIG_OK; +} + + +SWIGINTERN int +SWIG_AsCharArray(PyObject * obj, char *val, size_t size) +{ + char* cptr = 0; size_t csize = 0; int alloc = SWIG_OLDOBJ; + int res = SWIG_AsCharPtrAndSize(obj, &cptr, &csize, &alloc); + if (SWIG_IsOK(res)) { + /* special case of single char conversion when we don't need space for NUL */ + if (size == 1 && csize == 2 && cptr && !cptr[1]) --csize; + if (csize <= size) { + if (val) { + if (csize) memcpy(val, cptr, csize*sizeof(char)); + if (csize < size) memset(val + csize, 0, (size - csize)*sizeof(char)); + } + if (alloc == SWIG_NEWOBJ) { + delete[] cptr; + res = SWIG_DelNewMask(res); + } + return res; + } + if (alloc == SWIG_NEWOBJ) delete[] cptr; + } + return SWIG_TypeError; +} + + +SWIGINTERN size_t +SWIG_strnlen(const char* s, size_t maxlen) +{ + const char *p; + for (p = s; maxlen-- && *p; p++) + ; + return p - s; +} + + + + + +SWIGINTERNINLINE PyObject * +SWIG_FromCharPtr(const char *cptr) +{ + return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0)); +} + +#ifdef __cplusplus +extern "C" { +#endif +SWIGINTERN PyObject *_wrap_delete_SwigPyIterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_SwigPyIterator" "', argument " "1"" of type '" "swig::SwigPyIterator *""'"); + } + arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1); + delete arg1; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SwigPyIterator_value(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + PyObject *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator_value" "', argument " "1"" of type '" "swig::SwigPyIterator const *""'"); + } + arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1); + try { + result = (PyObject *)((swig::SwigPyIterator const *)arg1)->value(); + } catch(swig::stop_iteration &_e) { + { + (void)_e; + SWIG_SetErrorObj(PyExc_StopIteration, SWIG_Py_Void()); + SWIG_fail; + } + } + resultobj = result; + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SwigPyIterator_incr__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ; + size_t arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + size_t val2 ; + int ecode2 = 0 ; + swig::SwigPyIterator *result = 0 ; + + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator_incr" "', argument " "1"" of type '" "swig::SwigPyIterator *""'"); + } + arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1); + ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SwigPyIterator_incr" "', argument " "2"" of type '" "size_t""'"); + } + arg2 = static_cast< size_t >(val2); + try { + result = (swig::SwigPyIterator *)(arg1)->incr(arg2); + } catch(swig::stop_iteration &_e) { + { + (void)_e; + SWIG_SetErrorObj(PyExc_StopIteration, SWIG_Py_Void()); + SWIG_fail; + } + } + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SwigPyIterator_incr__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + swig::SwigPyIterator *result = 0 ; + + if ((nobjs < 1) || (nobjs > 1)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator_incr" "', argument " "1"" of type '" "swig::SwigPyIterator *""'"); + } + arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1); + try { + result = (swig::SwigPyIterator *)(arg1)->incr(); + } catch(swig::stop_iteration &_e) { + { + (void)_e; + SWIG_SetErrorObj(PyExc_StopIteration, SWIG_Py_Void()); + SWIG_fail; + } + } + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SwigPyIterator_incr(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[3] = { + 0 + }; + + if (!(argc = SWIG_Python_UnpackTuple(args, "SwigPyIterator_incr", 0, 2, argv))) SWIG_fail; + --argc; + if (argc == 1) { + int _v; + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__SwigPyIterator, 0); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_SwigPyIterator_incr__SWIG_1(self, argc, argv); + } + } + if (argc == 2) { + int _v; + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__SwigPyIterator, 0); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_size_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_SwigPyIterator_incr__SWIG_0(self, argc, argv); + } + } + } + +fail: + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'SwigPyIterator_incr'.\n" + " Possible C/C++ prototypes are:\n" + " swig::SwigPyIterator::incr(size_t)\n" + " swig::SwigPyIterator::incr()\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_SwigPyIterator_decr__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ; + size_t arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + size_t val2 ; + int ecode2 = 0 ; + swig::SwigPyIterator *result = 0 ; + + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator_decr" "', argument " "1"" of type '" "swig::SwigPyIterator *""'"); + } + arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1); + ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SwigPyIterator_decr" "', argument " "2"" of type '" "size_t""'"); + } + arg2 = static_cast< size_t >(val2); + try { + result = (swig::SwigPyIterator *)(arg1)->decr(arg2); + } catch(swig::stop_iteration &_e) { + { + (void)_e; + SWIG_SetErrorObj(PyExc_StopIteration, SWIG_Py_Void()); + SWIG_fail; + } + } + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SwigPyIterator_decr__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + swig::SwigPyIterator *result = 0 ; + + if ((nobjs < 1) || (nobjs > 1)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator_decr" "', argument " "1"" of type '" "swig::SwigPyIterator *""'"); + } + arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1); + try { + result = (swig::SwigPyIterator *)(arg1)->decr(); + } catch(swig::stop_iteration &_e) { + { + (void)_e; + SWIG_SetErrorObj(PyExc_StopIteration, SWIG_Py_Void()); + SWIG_fail; + } + } + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SwigPyIterator_decr(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[3] = { + 0 + }; + + if (!(argc = SWIG_Python_UnpackTuple(args, "SwigPyIterator_decr", 0, 2, argv))) SWIG_fail; + --argc; + if (argc == 1) { + int _v; + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__SwigPyIterator, 0); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_SwigPyIterator_decr__SWIG_1(self, argc, argv); + } + } + if (argc == 2) { + int _v; + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__SwigPyIterator, 0); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_size_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_SwigPyIterator_decr__SWIG_0(self, argc, argv); + } + } + } + +fail: + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'SwigPyIterator_decr'.\n" + " Possible C/C++ prototypes are:\n" + " swig::SwigPyIterator::decr(size_t)\n" + " swig::SwigPyIterator::decr()\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_SwigPyIterator_distance(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ; + swig::SwigPyIterator *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject *swig_obj[2] ; + ptrdiff_t result; + + if (!SWIG_Python_UnpackTuple(args, "SwigPyIterator_distance", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator_distance" "', argument " "1"" of type '" "swig::SwigPyIterator const *""'"); + } + arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_swig__SwigPyIterator, 0 | 0); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SwigPyIterator_distance" "', argument " "2"" of type '" "swig::SwigPyIterator const &""'"); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SwigPyIterator_distance" "', argument " "2"" of type '" "swig::SwigPyIterator const &""'"); + } + arg2 = reinterpret_cast< swig::SwigPyIterator * >(argp2); + try { + result = ((swig::SwigPyIterator const *)arg1)->distance((swig::SwigPyIterator const &)*arg2); + } catch(std::invalid_argument &_e) { + SWIG_Python_Raise(SWIG_NewPointerObj((new std::invalid_argument(static_cast< const std::invalid_argument& >(_e))),SWIGTYPE_p_std__invalid_argument,SWIG_POINTER_OWN), "std::invalid_argument", SWIGTYPE_p_std__invalid_argument); SWIG_fail; + } + resultobj = SWIG_From_ptrdiff_t(static_cast< ptrdiff_t >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SwigPyIterator_equal(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ; + swig::SwigPyIterator *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject *swig_obj[2] ; + bool result; + + if (!SWIG_Python_UnpackTuple(args, "SwigPyIterator_equal", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator_equal" "', argument " "1"" of type '" "swig::SwigPyIterator const *""'"); + } + arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_swig__SwigPyIterator, 0 | 0); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SwigPyIterator_equal" "', argument " "2"" of type '" "swig::SwigPyIterator const &""'"); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SwigPyIterator_equal" "', argument " "2"" of type '" "swig::SwigPyIterator const &""'"); + } + arg2 = reinterpret_cast< swig::SwigPyIterator * >(argp2); + try { + result = (bool)((swig::SwigPyIterator const *)arg1)->equal((swig::SwigPyIterator const &)*arg2); + } catch(std::invalid_argument &_e) { + SWIG_Python_Raise(SWIG_NewPointerObj((new std::invalid_argument(static_cast< const std::invalid_argument& >(_e))),SWIGTYPE_p_std__invalid_argument,SWIG_POINTER_OWN), "std::invalid_argument", SWIGTYPE_p_std__invalid_argument); SWIG_fail; + } + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SwigPyIterator_copy(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + swig::SwigPyIterator *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator_copy" "', argument " "1"" of type '" "swig::SwigPyIterator const *""'"); + } + arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1); + result = (swig::SwigPyIterator *)((swig::SwigPyIterator const *)arg1)->copy(); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SwigPyIterator_next(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + PyObject *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator_next" "', argument " "1"" of type '" "swig::SwigPyIterator *""'"); + } + arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1); + try { + result = (PyObject *)(arg1)->next(); + } catch(swig::stop_iteration &_e) { + { + (void)_e; + SWIG_SetErrorObj(PyExc_StopIteration, SWIG_Py_Void()); + SWIG_fail; + } + } + resultobj = result; + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SwigPyIterator___next__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + PyObject *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator___next__" "', argument " "1"" of type '" "swig::SwigPyIterator *""'"); + } + arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1); + try { + result = (PyObject *)(arg1)->__next__(); + } catch(swig::stop_iteration &_e) { + { + (void)_e; + SWIG_SetErrorObj(PyExc_StopIteration, SWIG_Py_Void()); + SWIG_fail; + } + } + resultobj = result; + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SwigPyIterator_previous(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + PyObject *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator_previous" "', argument " "1"" of type '" "swig::SwigPyIterator *""'"); + } + arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1); + try { + result = (PyObject *)(arg1)->previous(); + } catch(swig::stop_iteration &_e) { + { + (void)_e; + SWIG_SetErrorObj(PyExc_StopIteration, SWIG_Py_Void()); + SWIG_fail; + } + } + resultobj = result; + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SwigPyIterator_advance(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ; + ptrdiff_t arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + swig::SwigPyIterator *result = 0 ; + + if (!SWIG_Python_UnpackTuple(args, "SwigPyIterator_advance", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator_advance" "', argument " "1"" of type '" "swig::SwigPyIterator *""'"); + } + arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SwigPyIterator_advance" "', argument " "2"" of type '" "ptrdiff_t""'"); + } + arg2 = static_cast< ptrdiff_t >(val2); + try { + result = (swig::SwigPyIterator *)(arg1)->advance(arg2); + } catch(swig::stop_iteration &_e) { + { + (void)_e; + SWIG_SetErrorObj(PyExc_StopIteration, SWIG_Py_Void()); + SWIG_fail; + } + } + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SwigPyIterator___eq__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ; + swig::SwigPyIterator *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject *swig_obj[2] ; + bool result; + + if (!SWIG_Python_UnpackTuple(args, "SwigPyIterator___eq__", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator___eq__" "', argument " "1"" of type '" "swig::SwigPyIterator const *""'"); + } + arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_swig__SwigPyIterator, 0 | 0); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SwigPyIterator___eq__" "', argument " "2"" of type '" "swig::SwigPyIterator const &""'"); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SwigPyIterator___eq__" "', argument " "2"" of type '" "swig::SwigPyIterator const &""'"); + } + arg2 = reinterpret_cast< swig::SwigPyIterator * >(argp2); + result = (bool)((swig::SwigPyIterator const *)arg1)->operator ==((swig::SwigPyIterator const &)*arg2); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + PyErr_Clear(); + Py_INCREF(Py_NotImplemented); + return Py_NotImplemented; +} + + +SWIGINTERN PyObject *_wrap_SwigPyIterator___ne__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ; + swig::SwigPyIterator *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject *swig_obj[2] ; + bool result; + + if (!SWIG_Python_UnpackTuple(args, "SwigPyIterator___ne__", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator___ne__" "', argument " "1"" of type '" "swig::SwigPyIterator const *""'"); + } + arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_swig__SwigPyIterator, 0 | 0); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SwigPyIterator___ne__" "', argument " "2"" of type '" "swig::SwigPyIterator const &""'"); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SwigPyIterator___ne__" "', argument " "2"" of type '" "swig::SwigPyIterator const &""'"); + } + arg2 = reinterpret_cast< swig::SwigPyIterator * >(argp2); + result = (bool)((swig::SwigPyIterator const *)arg1)->operator !=((swig::SwigPyIterator const &)*arg2); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + PyErr_Clear(); + Py_INCREF(Py_NotImplemented); + return Py_NotImplemented; +} + + +SWIGINTERN PyObject *_wrap_SwigPyIterator___iadd__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ; + ptrdiff_t arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + swig::SwigPyIterator *result = 0 ; + + if (!SWIG_Python_UnpackTuple(args, "SwigPyIterator___iadd__", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator___iadd__" "', argument " "1"" of type '" "swig::SwigPyIterator *""'"); + } + arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SwigPyIterator___iadd__" "', argument " "2"" of type '" "ptrdiff_t""'"); + } + arg2 = static_cast< ptrdiff_t >(val2); + try { + result = (swig::SwigPyIterator *) &(arg1)->operator +=(arg2); + } catch(swig::stop_iteration &_e) { + { + (void)_e; + SWIG_SetErrorObj(PyExc_StopIteration, SWIG_Py_Void()); + SWIG_fail; + } + } + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SwigPyIterator___isub__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ; + ptrdiff_t arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + swig::SwigPyIterator *result = 0 ; + + if (!SWIG_Python_UnpackTuple(args, "SwigPyIterator___isub__", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator___isub__" "', argument " "1"" of type '" "swig::SwigPyIterator *""'"); + } + arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SwigPyIterator___isub__" "', argument " "2"" of type '" "ptrdiff_t""'"); + } + arg2 = static_cast< ptrdiff_t >(val2); + try { + result = (swig::SwigPyIterator *) &(arg1)->operator -=(arg2); + } catch(swig::stop_iteration &_e) { + { + (void)_e; + SWIG_SetErrorObj(PyExc_StopIteration, SWIG_Py_Void()); + SWIG_fail; + } + } + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SwigPyIterator___add__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ; + ptrdiff_t arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + swig::SwigPyIterator *result = 0 ; + + if (!SWIG_Python_UnpackTuple(args, "SwigPyIterator___add__", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator___add__" "', argument " "1"" of type '" "swig::SwigPyIterator const *""'"); + } + arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SwigPyIterator___add__" "', argument " "2"" of type '" "ptrdiff_t""'"); + } + arg2 = static_cast< ptrdiff_t >(val2); + try { + result = (swig::SwigPyIterator *)((swig::SwigPyIterator const *)arg1)->operator +(arg2); + } catch(swig::stop_iteration &_e) { + { + (void)_e; + SWIG_SetErrorObj(PyExc_StopIteration, SWIG_Py_Void()); + SWIG_fail; + } + } + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + PyErr_Clear(); + Py_INCREF(Py_NotImplemented); + return Py_NotImplemented; +} + + +SWIGINTERN PyObject *_wrap_SwigPyIterator___sub____SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ; + ptrdiff_t arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + swig::SwigPyIterator *result = 0 ; + + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator___sub__" "', argument " "1"" of type '" "swig::SwigPyIterator const *""'"); + } + arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SwigPyIterator___sub__" "', argument " "2"" of type '" "ptrdiff_t""'"); + } + arg2 = static_cast< ptrdiff_t >(val2); + try { + result = (swig::SwigPyIterator *)((swig::SwigPyIterator const *)arg1)->operator -(arg2); + } catch(swig::stop_iteration &_e) { + { + (void)_e; + SWIG_SetErrorObj(PyExc_StopIteration, SWIG_Py_Void()); + SWIG_fail; + } + } + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + PyErr_Clear(); + Py_INCREF(Py_NotImplemented); + return Py_NotImplemented; +} + + +SWIGINTERN PyObject *_wrap_SwigPyIterator___sub____SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ; + swig::SwigPyIterator *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + ptrdiff_t result; + + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator___sub__" "', argument " "1"" of type '" "swig::SwigPyIterator const *""'"); + } + arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_swig__SwigPyIterator, 0 | 0); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SwigPyIterator___sub__" "', argument " "2"" of type '" "swig::SwigPyIterator const &""'"); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SwigPyIterator___sub__" "', argument " "2"" of type '" "swig::SwigPyIterator const &""'"); + } + arg2 = reinterpret_cast< swig::SwigPyIterator * >(argp2); + result = ((swig::SwigPyIterator const *)arg1)->operator -((swig::SwigPyIterator const &)*arg2); + resultobj = SWIG_From_ptrdiff_t(static_cast< ptrdiff_t >(result)); + return resultobj; +fail: + PyErr_Clear(); + Py_INCREF(Py_NotImplemented); + return Py_NotImplemented; +} + + +SWIGINTERN PyObject *_wrap_SwigPyIterator___sub__(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[3] = { + 0 + }; + + if (!(argc = SWIG_Python_UnpackTuple(args, "SwigPyIterator___sub__", 0, 2, argv))) SWIG_fail; + --argc; + if (argc == 2) { + int _v; + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__SwigPyIterator, 0); + _v = SWIG_CheckState(res); + if (_v) { + int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_NO_NULL | 0); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_SwigPyIterator___sub____SWIG_1(self, argc, argv); + } + } + } + if (argc == 2) { + int _v; + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__SwigPyIterator, 0); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_SwigPyIterator___sub____SWIG_0(self, argc, argv); + } + } + } + +fail: + Py_INCREF(Py_NotImplemented); + return Py_NotImplemented; +} + + +SWIGINTERN PyObject *SwigPyIterator_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *obj; + if (!SWIG_Python_UnpackTuple(args, "swigregister", 1, 1, &obj)) return NULL; + SWIG_TypeNewClientData(SWIGTYPE_p_swig__SwigPyIterator, SWIG_NewClientData(obj)); + return SWIG_Py_Void(); +} + +SWIGINTERN PyObject *_wrap_IntVector_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + PyObject **arg2 = (PyObject **) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + swig::SwigPyIterator *result = 0 ; + + arg2 = &swig_obj[0]; + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_iterator" "', argument " "1"" of type '" "std::vector< int > *""'"); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + result = (swig::SwigPyIterator *)std_vector_Sl_int_Sg__iterator(arg1,arg2); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_IntVector___nonzero__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + bool result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector___nonzero__" "', argument " "1"" of type '" "std::vector< int > const *""'"); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + result = (bool)std_vector_Sl_int_Sg____nonzero__((std::vector< int > const *)arg1); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_IntVector___bool__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + bool result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector___bool__" "', argument " "1"" of type '" "std::vector< int > const *""'"); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + result = (bool)std_vector_Sl_int_Sg____bool__((std::vector< int > const *)arg1); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_IntVector___len__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::vector< int >::size_type result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector___len__" "', argument " "1"" of type '" "std::vector< int > const *""'"); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + result = std_vector_Sl_int_Sg____len__((std::vector< int > const *)arg1); + resultobj = SWIG_From_size_t(static_cast< size_t >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_IntVector___getslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + std::vector< int >::difference_type arg2 ; + std::vector< int >::difference_type arg3 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + ptrdiff_t val3 ; + int ecode3 = 0 ; + PyObject *swig_obj[3] ; + std::vector< int,std::allocator< int > > *result = 0 ; + + if (!SWIG_Python_UnpackTuple(args, "IntVector___getslice__", 3, 3, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector___getslice__" "', argument " "1"" of type '" "std::vector< int > *""'"); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "IntVector___getslice__" "', argument " "2"" of type '" "std::vector< int >::difference_type""'"); + } + arg2 = static_cast< std::vector< int >::difference_type >(val2); + ecode3 = SWIG_AsVal_ptrdiff_t(swig_obj[2], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "IntVector___getslice__" "', argument " "3"" of type '" "std::vector< int >::difference_type""'"); + } + arg3 = static_cast< std::vector< int >::difference_type >(val3); + try { + result = (std::vector< int,std::allocator< int > > *)std_vector_Sl_int_Sg____getslice__(arg1,arg2,arg3); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_IntVector___setslice____SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + std::vector< int >::difference_type arg2 ; + std::vector< int >::difference_type arg3 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + ptrdiff_t val3 ; + int ecode3 = 0 ; + + if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector___setslice__" "', argument " "1"" of type '" "std::vector< int > *""'"); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "IntVector___setslice__" "', argument " "2"" of type '" "std::vector< int >::difference_type""'"); + } + arg2 = static_cast< std::vector< int >::difference_type >(val2); + ecode3 = SWIG_AsVal_ptrdiff_t(swig_obj[2], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "IntVector___setslice__" "', argument " "3"" of type '" "std::vector< int >::difference_type""'"); + } + arg3 = static_cast< std::vector< int >::difference_type >(val3); + try { + std_vector_Sl_int_Sg____setslice____SWIG_0(arg1,arg2,arg3); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_IntVector___setslice____SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + std::vector< int >::difference_type arg2 ; + std::vector< int >::difference_type arg3 ; + std::vector< int,std::allocator< int > > *arg4 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + ptrdiff_t val3 ; + int ecode3 = 0 ; + int res4 = SWIG_OLDOBJ ; + + if ((nobjs < 4) || (nobjs > 4)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector___setslice__" "', argument " "1"" of type '" "std::vector< int > *""'"); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "IntVector___setslice__" "', argument " "2"" of type '" "std::vector< int >::difference_type""'"); + } + arg2 = static_cast< std::vector< int >::difference_type >(val2); + ecode3 = SWIG_AsVal_ptrdiff_t(swig_obj[2], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "IntVector___setslice__" "', argument " "3"" of type '" "std::vector< int >::difference_type""'"); + } + arg3 = static_cast< std::vector< int >::difference_type >(val3); + { + std::vector< int,std::allocator< int > > *ptr = (std::vector< int,std::allocator< int > > *)0; + res4 = swig::asptr(swig_obj[3], &ptr); + if (!SWIG_IsOK(res4)) { + SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "IntVector___setslice__" "', argument " "4"" of type '" "std::vector< int,std::allocator< int > > const &""'"); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "IntVector___setslice__" "', argument " "4"" of type '" "std::vector< int,std::allocator< int > > const &""'"); + } + arg4 = ptr; + } + try { + std_vector_Sl_int_Sg____setslice____SWIG_1(arg1,arg2,arg3,(std::vector< int,std::allocator< int > > const &)*arg4); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } + resultobj = SWIG_Py_Void(); + if (SWIG_IsNewObj(res4)) delete arg4; + return resultobj; +fail: + if (SWIG_IsNewObj(res4)) delete arg4; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_IntVector___setslice__(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[5] = { + 0 + }; + + if (!(argc = SWIG_Python_UnpackTuple(args, "IntVector___setslice__", 0, 4, argv))) SWIG_fail; + --argc; + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::vector< int,std::allocator< int > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_IntVector___setslice____SWIG_0(self, argc, argv); + } + } + } + } + if (argc == 4) { + int _v; + int res = swig::asptr(argv[0], (std::vector< int,std::allocator< int > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + int res = swig::asptr(argv[3], (std::vector< int,std::allocator< int > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_IntVector___setslice____SWIG_1(self, argc, argv); + } + } + } + } + } + +fail: + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'IntVector___setslice__'.\n" + " Possible C/C++ prototypes are:\n" + " std::vector< int >::__setslice__(std::vector< int >::difference_type,std::vector< int >::difference_type)\n" + " std::vector< int >::__setslice__(std::vector< int >::difference_type,std::vector< int >::difference_type,std::vector< int,std::allocator< int > > const &)\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_IntVector___delslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + std::vector< int >::difference_type arg2 ; + std::vector< int >::difference_type arg3 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + ptrdiff_t val3 ; + int ecode3 = 0 ; + PyObject *swig_obj[3] ; + + if (!SWIG_Python_UnpackTuple(args, "IntVector___delslice__", 3, 3, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector___delslice__" "', argument " "1"" of type '" "std::vector< int > *""'"); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "IntVector___delslice__" "', argument " "2"" of type '" "std::vector< int >::difference_type""'"); + } + arg2 = static_cast< std::vector< int >::difference_type >(val2); + ecode3 = SWIG_AsVal_ptrdiff_t(swig_obj[2], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "IntVector___delslice__" "', argument " "3"" of type '" "std::vector< int >::difference_type""'"); + } + arg3 = static_cast< std::vector< int >::difference_type >(val3); + try { + std_vector_Sl_int_Sg____delslice__(arg1,arg2,arg3); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_IntVector___delitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + std::vector< int >::difference_type arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector___delitem__" "', argument " "1"" of type '" "std::vector< int > *""'"); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "IntVector___delitem__" "', argument " "2"" of type '" "std::vector< int >::difference_type""'"); + } + arg2 = static_cast< std::vector< int >::difference_type >(val2); + try { + std_vector_Sl_int_Sg____delitem____SWIG_0(arg1,arg2); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_IntVector___getitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + PySliceObject *arg2 = (PySliceObject *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< int,std::allocator< int > > *result = 0 ; + + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector___getitem__" "', argument " "1"" of type '" "std::vector< int > *""'"); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + { + if (!PySlice_Check(swig_obj[1])) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "IntVector___getitem__" "', argument " "2"" of type '" "PySliceObject *""'"); + } + arg2 = (PySliceObject *) swig_obj[1]; + } + try { + result = (std::vector< int,std::allocator< int > > *)std_vector_Sl_int_Sg____getitem____SWIG_0(arg1,arg2); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_IntVector___setitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + PySliceObject *arg2 = (PySliceObject *) 0 ; + std::vector< int,std::allocator< int > > *arg3 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res3 = SWIG_OLDOBJ ; + + if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector___setitem__" "', argument " "1"" of type '" "std::vector< int > *""'"); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + { + if (!PySlice_Check(swig_obj[1])) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "IntVector___setitem__" "', argument " "2"" of type '" "PySliceObject *""'"); + } + arg2 = (PySliceObject *) swig_obj[1]; + } + { + std::vector< int,std::allocator< int > > *ptr = (std::vector< int,std::allocator< int > > *)0; + res3 = swig::asptr(swig_obj[2], &ptr); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "IntVector___setitem__" "', argument " "3"" of type '" "std::vector< int,std::allocator< int > > const &""'"); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "IntVector___setitem__" "', argument " "3"" of type '" "std::vector< int,std::allocator< int > > const &""'"); + } + arg3 = ptr; + } + try { + std_vector_Sl_int_Sg____setitem____SWIG_0(arg1,arg2,(std::vector< int,std::allocator< int > > const &)*arg3); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } + resultobj = SWIG_Py_Void(); + if (SWIG_IsNewObj(res3)) delete arg3; + return resultobj; +fail: + if (SWIG_IsNewObj(res3)) delete arg3; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_IntVector___setitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + PySliceObject *arg2 = (PySliceObject *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector___setitem__" "', argument " "1"" of type '" "std::vector< int > *""'"); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + { + if (!PySlice_Check(swig_obj[1])) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "IntVector___setitem__" "', argument " "2"" of type '" "PySliceObject *""'"); + } + arg2 = (PySliceObject *) swig_obj[1]; + } + try { + std_vector_Sl_int_Sg____setitem____SWIG_1(arg1,arg2); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_IntVector___delitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + PySliceObject *arg2 = (PySliceObject *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector___delitem__" "', argument " "1"" of type '" "std::vector< int > *""'"); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + { + if (!PySlice_Check(swig_obj[1])) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "IntVector___delitem__" "', argument " "2"" of type '" "PySliceObject *""'"); + } + arg2 = (PySliceObject *) swig_obj[1]; + } + try { + std_vector_Sl_int_Sg____delitem____SWIG_1(arg1,arg2); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_IntVector___delitem__(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[3] = { + 0 + }; + + if (!(argc = SWIG_Python_UnpackTuple(args, "IntVector___delitem__", 0, 2, argv))) SWIG_fail; + --argc; + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::vector< int,std::allocator< int > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + _v = PySlice_Check(argv[1]); + } + if (_v) { + return _wrap_IntVector___delitem____SWIG_1(self, argc, argv); + } + } + } + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::vector< int,std::allocator< int > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_IntVector___delitem____SWIG_0(self, argc, argv); + } + } + } + +fail: + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'IntVector___delitem__'.\n" + " Possible C/C++ prototypes are:\n" + " std::vector< int >::__delitem__(std::vector< int >::difference_type)\n" + " std::vector< int >::__delitem__(PySliceObject *)\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_IntVector___getitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + std::vector< int >::difference_type arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + std::vector< int >::value_type *result = 0 ; + + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector___getitem__" "', argument " "1"" of type '" "std::vector< int > const *""'"); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "IntVector___getitem__" "', argument " "2"" of type '" "std::vector< int >::difference_type""'"); + } + arg2 = static_cast< std::vector< int >::difference_type >(val2); + try { + result = (std::vector< int >::value_type *) &std_vector_Sl_int_Sg____getitem____SWIG_1((std::vector< int > const *)arg1,arg2); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } + resultobj = SWIG_From_int(static_cast< int >(*result)); + (void)swig::container_owner<swig::traits<std::vector< int >::value_type>::category>::back_reference(resultobj, swig_obj[0]); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_IntVector___getitem__(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[3] = { + 0 + }; + + if (!(argc = SWIG_Python_UnpackTuple(args, "IntVector___getitem__", 0, 2, argv))) SWIG_fail; + --argc; + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::vector< int,std::allocator< int > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + _v = PySlice_Check(argv[1]); + } + if (_v) { + return _wrap_IntVector___getitem____SWIG_0(self, argc, argv); + } + } + } + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::vector< int,std::allocator< int > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_IntVector___getitem____SWIG_1(self, argc, argv); + } + } + } + +fail: + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'IntVector___getitem__'.\n" + " Possible C/C++ prototypes are:\n" + " std::vector< int >::__getitem__(PySliceObject *)\n" + " std::vector< int >::__getitem__(std::vector< int >::difference_type) const\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_IntVector___setitem____SWIG_2(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + std::vector< int >::difference_type arg2 ; + std::vector< int >::value_type *arg3 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + std::vector< int >::value_type temp3 ; + int val3 ; + int ecode3 = 0 ; + + if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector___setitem__" "', argument " "1"" of type '" "std::vector< int > *""'"); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "IntVector___setitem__" "', argument " "2"" of type '" "std::vector< int >::difference_type""'"); + } + arg2 = static_cast< std::vector< int >::difference_type >(val2); + ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "IntVector___setitem__" "', argument " "3"" of type '" "std::vector< int >::value_type""'"); + } + temp3 = static_cast< std::vector< int >::value_type >(val3); + arg3 = &temp3; + try { + std_vector_Sl_int_Sg____setitem____SWIG_2(arg1,arg2,(int const &)*arg3); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_IntVector___setitem__(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[4] = { + 0 + }; + + if (!(argc = SWIG_Python_UnpackTuple(args, "IntVector___setitem__", 0, 3, argv))) SWIG_fail; + --argc; + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::vector< int,std::allocator< int > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + _v = PySlice_Check(argv[1]); + } + if (_v) { + return _wrap_IntVector___setitem____SWIG_1(self, argc, argv); + } + } + } + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::vector< int,std::allocator< int > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + _v = PySlice_Check(argv[1]); + } + if (_v) { + int res = swig::asptr(argv[2], (std::vector< int,std::allocator< int > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_IntVector___setitem____SWIG_0(self, argc, argv); + } + } + } + } + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::vector< int,std::allocator< int > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_IntVector___setitem____SWIG_2(self, argc, argv); + } + } + } + } + +fail: + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'IntVector___setitem__'.\n" + " Possible C/C++ prototypes are:\n" + " std::vector< int >::__setitem__(PySliceObject *,std::vector< int,std::allocator< int > > const &)\n" + " std::vector< int >::__setitem__(PySliceObject *)\n" + " std::vector< int >::__setitem__(std::vector< int >::difference_type,std::vector< int >::value_type const &)\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_IntVector_pop(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::vector< int >::value_type result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_pop" "', argument " "1"" of type '" "std::vector< int > *""'"); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + try { + result = (std::vector< int >::value_type)std_vector_Sl_int_Sg__pop(arg1); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_IntVector_append(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + std::vector< int >::value_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< int >::value_type temp2 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "IntVector_append", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_append" "', argument " "1"" of type '" "std::vector< int > *""'"); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "IntVector_append" "', argument " "2"" of type '" "std::vector< int >::value_type""'"); + } + temp2 = static_cast< std::vector< int >::value_type >(val2); + arg2 = &temp2; + std_vector_Sl_int_Sg__append(arg1,(int const &)*arg2); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_IntVector__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) { + PyObject *resultobj = 0; + std::vector< int > *result = 0 ; + + if ((nobjs < 0) || (nobjs > 0)) SWIG_fail; + result = (std::vector< int > *)new std::vector< int >(); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, SWIG_POINTER_NEW | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_IntVector__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< int > *arg1 = 0 ; + int res1 = SWIG_OLDOBJ ; + std::vector< int > *result = 0 ; + + if ((nobjs < 1) || (nobjs > 1)) SWIG_fail; + { + std::vector< int,std::allocator< int > > *ptr = (std::vector< int,std::allocator< int > > *)0; + res1 = swig::asptr(swig_obj[0], &ptr); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_IntVector" "', argument " "1"" of type '" "std::vector< int > const &""'"); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_IntVector" "', argument " "1"" of type '" "std::vector< int > const &""'"); + } + arg1 = ptr; + } + result = (std::vector< int > *)new std::vector< int >((std::vector< int > const &)*arg1); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, SWIG_POINTER_NEW | 0 ); + if (SWIG_IsNewObj(res1)) delete arg1; + return resultobj; +fail: + if (SWIG_IsNewObj(res1)) delete arg1; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_IntVector_empty(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + bool result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_empty" "', argument " "1"" of type '" "std::vector< int > const *""'"); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + result = (bool)((std::vector< int > const *)arg1)->empty(); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_IntVector_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::vector< int >::size_type result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_size" "', argument " "1"" of type '" "std::vector< int > const *""'"); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + result = ((std::vector< int > const *)arg1)->size(); + resultobj = SWIG_From_size_t(static_cast< size_t >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_IntVector_swap(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + std::vector< int > *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "IntVector_swap", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_swap" "', argument " "1"" of type '" "std::vector< int > *""'"); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "IntVector_swap" "', argument " "2"" of type '" "std::vector< int > &""'"); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "IntVector_swap" "', argument " "2"" of type '" "std::vector< int > &""'"); + } + arg2 = reinterpret_cast< std::vector< int > * >(argp2); + (arg1)->swap(*arg2); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_IntVector_begin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::vector< int >::iterator result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_begin" "', argument " "1"" of type '" "std::vector< int > *""'"); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + result = (arg1)->begin(); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< int >::iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_IntVector_end(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::vector< int >::iterator result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_end" "', argument " "1"" of type '" "std::vector< int > *""'"); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + result = (arg1)->end(); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< int >::iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_IntVector_rbegin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::vector< int >::reverse_iterator result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_rbegin" "', argument " "1"" of type '" "std::vector< int > *""'"); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + result = (arg1)->rbegin(); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< int >::reverse_iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_IntVector_rend(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::vector< int >::reverse_iterator result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_rend" "', argument " "1"" of type '" "std::vector< int > *""'"); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + result = (arg1)->rend(); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< int >::reverse_iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_IntVector_clear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_clear" "', argument " "1"" of type '" "std::vector< int > *""'"); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + (arg1)->clear(); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_IntVector_get_allocator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + SwigValueWrapper< std::allocator< int > > result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_get_allocator" "', argument " "1"" of type '" "std::vector< int > const *""'"); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + result = ((std::vector< int > const *)arg1)->get_allocator(); + resultobj = SWIG_NewPointerObj((new std::vector< int >::allocator_type(static_cast< const std::vector< int >::allocator_type& >(result))), SWIGTYPE_p_std__allocatorT_int_t, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_IntVector__SWIG_2(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< int >::size_type arg1 ; + size_t val1 ; + int ecode1 = 0 ; + std::vector< int > *result = 0 ; + + if ((nobjs < 1) || (nobjs > 1)) SWIG_fail; + ecode1 = SWIG_AsVal_size_t(swig_obj[0], &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_IntVector" "', argument " "1"" of type '" "std::vector< int >::size_type""'"); + } + arg1 = static_cast< std::vector< int >::size_type >(val1); + result = (std::vector< int > *)new std::vector< int >(arg1); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, SWIG_POINTER_NEW | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_IntVector_pop_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_pop_back" "', argument " "1"" of type '" "std::vector< int > *""'"); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + (arg1)->pop_back(); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_IntVector_resize__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + std::vector< int >::size_type arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + size_t val2 ; + int ecode2 = 0 ; + + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_resize" "', argument " "1"" of type '" "std::vector< int > *""'"); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "IntVector_resize" "', argument " "2"" of type '" "std::vector< int >::size_type""'"); + } + arg2 = static_cast< std::vector< int >::size_type >(val2); + (arg1)->resize(arg2); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_IntVector_erase__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + std::vector< int >::iterator arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + swig::SwigPyIterator *iter2 = 0 ; + int res2 ; + std::vector< int >::iterator result; + + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_erase" "', argument " "1"" of type '" "std::vector< int > *""'"); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0); + if (!SWIG_IsOK(res2) || !iter2) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "IntVector_erase" "', argument " "2"" of type '" "std::vector< int >::iterator""'"); + } else { + swig::SwigPyIterator_T<std::vector< int >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< int >::iterator > *>(iter2); + if (iter_t) { + arg2 = iter_t->get_current(); + } else { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "IntVector_erase" "', argument " "2"" of type '" "std::vector< int >::iterator""'"); + } + } + result = std_vector_Sl_int_Sg__erase__SWIG_0(arg1,arg2); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< int >::iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_IntVector_erase__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + std::vector< int >::iterator arg2 ; + std::vector< int >::iterator arg3 ; + void *argp1 = 0 ; + int res1 = 0 ; + swig::SwigPyIterator *iter2 = 0 ; + int res2 ; + swig::SwigPyIterator *iter3 = 0 ; + int res3 ; + std::vector< int >::iterator result; + + if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_erase" "', argument " "1"" of type '" "std::vector< int > *""'"); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0); + if (!SWIG_IsOK(res2) || !iter2) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "IntVector_erase" "', argument " "2"" of type '" "std::vector< int >::iterator""'"); + } else { + swig::SwigPyIterator_T<std::vector< int >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< int >::iterator > *>(iter2); + if (iter_t) { + arg2 = iter_t->get_current(); + } else { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "IntVector_erase" "', argument " "2"" of type '" "std::vector< int >::iterator""'"); + } + } + res3 = SWIG_ConvertPtr(swig_obj[2], SWIG_as_voidptrptr(&iter3), swig::SwigPyIterator::descriptor(), 0); + if (!SWIG_IsOK(res3) || !iter3) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "IntVector_erase" "', argument " "3"" of type '" "std::vector< int >::iterator""'"); + } else { + swig::SwigPyIterator_T<std::vector< int >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< int >::iterator > *>(iter3); + if (iter_t) { + arg3 = iter_t->get_current(); + } else { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "IntVector_erase" "', argument " "3"" of type '" "std::vector< int >::iterator""'"); + } + } + result = std_vector_Sl_int_Sg__erase__SWIG_1(arg1,arg2,arg3); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< int >::iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_IntVector_erase(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[4] = { + 0 + }; + + if (!(argc = SWIG_Python_UnpackTuple(args, "IntVector_erase", 0, 3, argv))) SWIG_fail; + --argc; + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::vector< int,std::allocator< int > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + swig::SwigPyIterator *iter = 0; + int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); + _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< int >::iterator > *>(iter) != 0)); + if (_v) { + return _wrap_IntVector_erase__SWIG_0(self, argc, argv); + } + } + } + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::vector< int,std::allocator< int > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + swig::SwigPyIterator *iter = 0; + int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); + _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< int >::iterator > *>(iter) != 0)); + if (_v) { + swig::SwigPyIterator *iter = 0; + int res = SWIG_ConvertPtr(argv[2], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); + _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< int >::iterator > *>(iter) != 0)); + if (_v) { + return _wrap_IntVector_erase__SWIG_1(self, argc, argv); + } + } + } + } + +fail: + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'IntVector_erase'.\n" + " Possible C/C++ prototypes are:\n" + " std::vector< int >::erase(std::vector< int >::iterator)\n" + " std::vector< int >::erase(std::vector< int >::iterator,std::vector< int >::iterator)\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_new_IntVector__SWIG_3(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< int >::size_type arg1 ; + std::vector< int >::value_type *arg2 = 0 ; + size_t val1 ; + int ecode1 = 0 ; + std::vector< int >::value_type temp2 ; + int val2 ; + int ecode2 = 0 ; + std::vector< int > *result = 0 ; + + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + ecode1 = SWIG_AsVal_size_t(swig_obj[0], &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_IntVector" "', argument " "1"" of type '" "std::vector< int >::size_type""'"); + } + arg1 = static_cast< std::vector< int >::size_type >(val1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_IntVector" "', argument " "2"" of type '" "std::vector< int >::value_type""'"); + } + temp2 = static_cast< std::vector< int >::value_type >(val2); + arg2 = &temp2; + result = (std::vector< int > *)new std::vector< int >(arg1,(std::vector< int >::value_type const &)*arg2); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, SWIG_POINTER_NEW | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_IntVector(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[3] = { + 0 + }; + + if (!(argc = SWIG_Python_UnpackTuple(args, "new_IntVector", 0, 2, argv))) SWIG_fail; + --argc; + if (argc == 0) { + return _wrap_new_IntVector__SWIG_0(self, argc, argv); + } + if (argc == 1) { + int _v; + { + int res = SWIG_AsVal_size_t(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_new_IntVector__SWIG_2(self, argc, argv); + } + } + if (argc == 1) { + int _v; + int res = swig::asptr(argv[0], (std::vector< int,std::allocator< int > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_new_IntVector__SWIG_1(self, argc, argv); + } + } + if (argc == 2) { + int _v; + { + int res = SWIG_AsVal_size_t(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_new_IntVector__SWIG_3(self, argc, argv); + } + } + } + +fail: + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'new_IntVector'.\n" + " Possible C/C++ prototypes are:\n" + " std::vector< int >::vector()\n" + " std::vector< int >::vector(std::vector< int > const &)\n" + " std::vector< int >::vector(std::vector< int >::size_type)\n" + " std::vector< int >::vector(std::vector< int >::size_type,std::vector< int >::value_type const &)\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_IntVector_push_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + std::vector< int >::value_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< int >::value_type temp2 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "IntVector_push_back", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_push_back" "', argument " "1"" of type '" "std::vector< int > *""'"); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "IntVector_push_back" "', argument " "2"" of type '" "std::vector< int >::value_type""'"); + } + temp2 = static_cast< std::vector< int >::value_type >(val2); + arg2 = &temp2; + (arg1)->push_back((std::vector< int >::value_type const &)*arg2); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_IntVector_front(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::vector< int >::value_type *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_front" "', argument " "1"" of type '" "std::vector< int > const *""'"); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + result = (std::vector< int >::value_type *) &((std::vector< int > const *)arg1)->front(); + resultobj = SWIG_From_int(static_cast< int >(*result)); + (void)swig::container_owner<swig::traits<std::vector< int >::value_type>::category>::back_reference(resultobj, swig_obj[0]); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_IntVector_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::vector< int >::value_type *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_back" "', argument " "1"" of type '" "std::vector< int > const *""'"); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + result = (std::vector< int >::value_type *) &((std::vector< int > const *)arg1)->back(); + resultobj = SWIG_From_int(static_cast< int >(*result)); + (void)swig::container_owner<swig::traits<std::vector< int >::value_type>::category>::back_reference(resultobj, swig_obj[0]); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_IntVector_assign(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + std::vector< int >::size_type arg2 ; + std::vector< int >::value_type *arg3 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + size_t val2 ; + int ecode2 = 0 ; + std::vector< int >::value_type temp3 ; + int val3 ; + int ecode3 = 0 ; + PyObject *swig_obj[3] ; + + if (!SWIG_Python_UnpackTuple(args, "IntVector_assign", 3, 3, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_assign" "', argument " "1"" of type '" "std::vector< int > *""'"); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "IntVector_assign" "', argument " "2"" of type '" "std::vector< int >::size_type""'"); + } + arg2 = static_cast< std::vector< int >::size_type >(val2); + ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "IntVector_assign" "', argument " "3"" of type '" "std::vector< int >::value_type""'"); + } + temp3 = static_cast< std::vector< int >::value_type >(val3); + arg3 = &temp3; + (arg1)->assign(arg2,(std::vector< int >::value_type const &)*arg3); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_IntVector_resize__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + std::vector< int >::size_type arg2 ; + std::vector< int >::value_type *arg3 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + size_t val2 ; + int ecode2 = 0 ; + std::vector< int >::value_type temp3 ; + int val3 ; + int ecode3 = 0 ; + + if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_resize" "', argument " "1"" of type '" "std::vector< int > *""'"); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "IntVector_resize" "', argument " "2"" of type '" "std::vector< int >::size_type""'"); + } + arg2 = static_cast< std::vector< int >::size_type >(val2); + ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "IntVector_resize" "', argument " "3"" of type '" "std::vector< int >::value_type""'"); + } + temp3 = static_cast< std::vector< int >::value_type >(val3); + arg3 = &temp3; + (arg1)->resize(arg2,(std::vector< int >::value_type const &)*arg3); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_IntVector_resize(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[4] = { + 0 + }; + + if (!(argc = SWIG_Python_UnpackTuple(args, "IntVector_resize", 0, 3, argv))) SWIG_fail; + --argc; + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::vector< int,std::allocator< int > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_size_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_IntVector_resize__SWIG_0(self, argc, argv); + } + } + } + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::vector< int,std::allocator< int > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_size_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_IntVector_resize__SWIG_1(self, argc, argv); + } + } + } + } + +fail: + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'IntVector_resize'.\n" + " Possible C/C++ prototypes are:\n" + " std::vector< int >::resize(std::vector< int >::size_type)\n" + " std::vector< int >::resize(std::vector< int >::size_type,std::vector< int >::value_type const &)\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_IntVector_insert__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + std::vector< int >::iterator arg2 ; + std::vector< int >::value_type *arg3 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + swig::SwigPyIterator *iter2 = 0 ; + int res2 ; + std::vector< int >::value_type temp3 ; + int val3 ; + int ecode3 = 0 ; + std::vector< int >::iterator result; + + if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_insert" "', argument " "1"" of type '" "std::vector< int > *""'"); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0); + if (!SWIG_IsOK(res2) || !iter2) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "IntVector_insert" "', argument " "2"" of type '" "std::vector< int >::iterator""'"); + } else { + swig::SwigPyIterator_T<std::vector< int >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< int >::iterator > *>(iter2); + if (iter_t) { + arg2 = iter_t->get_current(); + } else { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "IntVector_insert" "', argument " "2"" of type '" "std::vector< int >::iterator""'"); + } + } + ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "IntVector_insert" "', argument " "3"" of type '" "std::vector< int >::value_type""'"); + } + temp3 = static_cast< std::vector< int >::value_type >(val3); + arg3 = &temp3; + result = std_vector_Sl_int_Sg__insert__SWIG_0(arg1,arg2,(int const &)*arg3); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< int >::iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_IntVector_insert__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + std::vector< int >::iterator arg2 ; + std::vector< int >::size_type arg3 ; + std::vector< int >::value_type *arg4 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + swig::SwigPyIterator *iter2 = 0 ; + int res2 ; + size_t val3 ; + int ecode3 = 0 ; + std::vector< int >::value_type temp4 ; + int val4 ; + int ecode4 = 0 ; + + if ((nobjs < 4) || (nobjs > 4)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_insert" "', argument " "1"" of type '" "std::vector< int > *""'"); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0); + if (!SWIG_IsOK(res2) || !iter2) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "IntVector_insert" "', argument " "2"" of type '" "std::vector< int >::iterator""'"); + } else { + swig::SwigPyIterator_T<std::vector< int >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< int >::iterator > *>(iter2); + if (iter_t) { + arg2 = iter_t->get_current(); + } else { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "IntVector_insert" "', argument " "2"" of type '" "std::vector< int >::iterator""'"); + } + } + ecode3 = SWIG_AsVal_size_t(swig_obj[2], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "IntVector_insert" "', argument " "3"" of type '" "std::vector< int >::size_type""'"); + } + arg3 = static_cast< std::vector< int >::size_type >(val3); + ecode4 = SWIG_AsVal_int(swig_obj[3], &val4); + if (!SWIG_IsOK(ecode4)) { + SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "IntVector_insert" "', argument " "4"" of type '" "std::vector< int >::value_type""'"); + } + temp4 = static_cast< std::vector< int >::value_type >(val4); + arg4 = &temp4; + std_vector_Sl_int_Sg__insert__SWIG_1(arg1,arg2,arg3,(int const &)*arg4); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_IntVector_insert(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[5] = { + 0 + }; + + if (!(argc = SWIG_Python_UnpackTuple(args, "IntVector_insert", 0, 4, argv))) SWIG_fail; + --argc; + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::vector< int,std::allocator< int > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + swig::SwigPyIterator *iter = 0; + int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); + _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< int >::iterator > *>(iter) != 0)); + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_IntVector_insert__SWIG_0(self, argc, argv); + } + } + } + } + if (argc == 4) { + int _v; + int res = swig::asptr(argv[0], (std::vector< int,std::allocator< int > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + swig::SwigPyIterator *iter = 0; + int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); + _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< int >::iterator > *>(iter) != 0)); + if (_v) { + { + int res = SWIG_AsVal_size_t(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[3], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_IntVector_insert__SWIG_1(self, argc, argv); + } + } + } + } + } + +fail: + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'IntVector_insert'.\n" + " Possible C/C++ prototypes are:\n" + " std::vector< int >::insert(std::vector< int >::iterator,std::vector< int >::value_type const &)\n" + " std::vector< int >::insert(std::vector< int >::iterator,std::vector< int >::size_type,std::vector< int >::value_type const &)\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_IntVector_reserve(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + std::vector< int >::size_type arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + size_t val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "IntVector_reserve", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_reserve" "', argument " "1"" of type '" "std::vector< int > *""'"); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "IntVector_reserve" "', argument " "2"" of type '" "std::vector< int >::size_type""'"); + } + arg2 = static_cast< std::vector< int >::size_type >(val2); + (arg1)->reserve(arg2); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_IntVector_capacity(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::vector< int >::size_type result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_capacity" "', argument " "1"" of type '" "std::vector< int > const *""'"); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + result = ((std::vector< int > const *)arg1)->capacity(); + resultobj = SWIG_From_size_t(static_cast< size_t >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_delete_IntVector(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_IntVector" "', argument " "1"" of type '" "std::vector< int > *""'"); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + delete arg1; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *IntVector_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *obj; + if (!SWIG_Python_UnpackTuple(args, "swigregister", 1, 1, &obj)) return NULL; + SWIG_TypeNewClientData(SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, SWIG_NewClientData(obj)); + return SWIG_Py_Void(); +} + +SWIGINTERN PyObject *IntVector_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + return SWIG_Python_InitShadowInstance(args); +} + +SWIGINTERN PyObject *_wrap_DoubleVector_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + PyObject **arg2 = (PyObject **) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + swig::SwigPyIterator *result = 0 ; + + arg2 = &swig_obj[0]; + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_iterator" "', argument " "1"" of type '" "std::vector< double > *""'"); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + result = (swig::SwigPyIterator *)std_vector_Sl_double_Sg__iterator(arg1,arg2); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleVector___nonzero__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + bool result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector___nonzero__" "', argument " "1"" of type '" "std::vector< double > const *""'"); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + result = (bool)std_vector_Sl_double_Sg____nonzero__((std::vector< double > const *)arg1); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleVector___bool__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + bool result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector___bool__" "', argument " "1"" of type '" "std::vector< double > const *""'"); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + result = (bool)std_vector_Sl_double_Sg____bool__((std::vector< double > const *)arg1); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleVector___len__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::vector< double >::size_type result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector___len__" "', argument " "1"" of type '" "std::vector< double > const *""'"); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + result = std_vector_Sl_double_Sg____len__((std::vector< double > const *)arg1); + resultobj = SWIG_From_size_t(static_cast< size_t >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleVector___getslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + std::vector< double >::difference_type arg2 ; + std::vector< double >::difference_type arg3 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + ptrdiff_t val3 ; + int ecode3 = 0 ; + PyObject *swig_obj[3] ; + std::vector< double,std::allocator< double > > *result = 0 ; + + if (!SWIG_Python_UnpackTuple(args, "DoubleVector___getslice__", 3, 3, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector___getslice__" "', argument " "1"" of type '" "std::vector< double > *""'"); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleVector___getslice__" "', argument " "2"" of type '" "std::vector< double >::difference_type""'"); + } + arg2 = static_cast< std::vector< double >::difference_type >(val2); + ecode3 = SWIG_AsVal_ptrdiff_t(swig_obj[2], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DoubleVector___getslice__" "', argument " "3"" of type '" "std::vector< double >::difference_type""'"); + } + arg3 = static_cast< std::vector< double >::difference_type >(val3); + try { + result = (std::vector< double,std::allocator< double > > *)std_vector_Sl_double_Sg____getslice__(arg1,arg2,arg3); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleVector___setslice____SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + std::vector< double >::difference_type arg2 ; + std::vector< double >::difference_type arg3 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + ptrdiff_t val3 ; + int ecode3 = 0 ; + + if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector___setslice__" "', argument " "1"" of type '" "std::vector< double > *""'"); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleVector___setslice__" "', argument " "2"" of type '" "std::vector< double >::difference_type""'"); + } + arg2 = static_cast< std::vector< double >::difference_type >(val2); + ecode3 = SWIG_AsVal_ptrdiff_t(swig_obj[2], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DoubleVector___setslice__" "', argument " "3"" of type '" "std::vector< double >::difference_type""'"); + } + arg3 = static_cast< std::vector< double >::difference_type >(val3); + try { + std_vector_Sl_double_Sg____setslice____SWIG_0(arg1,arg2,arg3); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleVector___setslice____SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + std::vector< double >::difference_type arg2 ; + std::vector< double >::difference_type arg3 ; + std::vector< double,std::allocator< double > > *arg4 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + ptrdiff_t val3 ; + int ecode3 = 0 ; + int res4 = SWIG_OLDOBJ ; + + if ((nobjs < 4) || (nobjs > 4)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector___setslice__" "', argument " "1"" of type '" "std::vector< double > *""'"); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleVector___setslice__" "', argument " "2"" of type '" "std::vector< double >::difference_type""'"); + } + arg2 = static_cast< std::vector< double >::difference_type >(val2); + ecode3 = SWIG_AsVal_ptrdiff_t(swig_obj[2], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DoubleVector___setslice__" "', argument " "3"" of type '" "std::vector< double >::difference_type""'"); + } + arg3 = static_cast< std::vector< double >::difference_type >(val3); + { + std::vector< double,std::allocator< double > > *ptr = (std::vector< double,std::allocator< double > > *)0; + res4 = swig::asptr(swig_obj[3], &ptr); + if (!SWIG_IsOK(res4)) { + SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "DoubleVector___setslice__" "', argument " "4"" of type '" "std::vector< double,std::allocator< double > > const &""'"); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "DoubleVector___setslice__" "', argument " "4"" of type '" "std::vector< double,std::allocator< double > > const &""'"); + } + arg4 = ptr; + } + try { + std_vector_Sl_double_Sg____setslice____SWIG_1(arg1,arg2,arg3,(std::vector< double,std::allocator< double > > const &)*arg4); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } + resultobj = SWIG_Py_Void(); + if (SWIG_IsNewObj(res4)) delete arg4; + return resultobj; +fail: + if (SWIG_IsNewObj(res4)) delete arg4; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleVector___setslice__(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[5] = { + 0 + }; + + if (!(argc = SWIG_Python_UnpackTuple(args, "DoubleVector___setslice__", 0, 4, argv))) SWIG_fail; + --argc; + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::vector< double,std::allocator< double > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_DoubleVector___setslice____SWIG_0(self, argc, argv); + } + } + } + } + if (argc == 4) { + int _v; + int res = swig::asptr(argv[0], (std::vector< double,std::allocator< double > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + int res = swig::asptr(argv[3], (std::vector< double,std::allocator< double > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_DoubleVector___setslice____SWIG_1(self, argc, argv); + } + } + } + } + } + +fail: + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'DoubleVector___setslice__'.\n" + " Possible C/C++ prototypes are:\n" + " std::vector< double >::__setslice__(std::vector< double >::difference_type,std::vector< double >::difference_type)\n" + " std::vector< double >::__setslice__(std::vector< double >::difference_type,std::vector< double >::difference_type,std::vector< double,std::allocator< double > > const &)\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_DoubleVector___delslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + std::vector< double >::difference_type arg2 ; + std::vector< double >::difference_type arg3 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + ptrdiff_t val3 ; + int ecode3 = 0 ; + PyObject *swig_obj[3] ; + + if (!SWIG_Python_UnpackTuple(args, "DoubleVector___delslice__", 3, 3, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector___delslice__" "', argument " "1"" of type '" "std::vector< double > *""'"); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleVector___delslice__" "', argument " "2"" of type '" "std::vector< double >::difference_type""'"); + } + arg2 = static_cast< std::vector< double >::difference_type >(val2); + ecode3 = SWIG_AsVal_ptrdiff_t(swig_obj[2], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DoubleVector___delslice__" "', argument " "3"" of type '" "std::vector< double >::difference_type""'"); + } + arg3 = static_cast< std::vector< double >::difference_type >(val3); + try { + std_vector_Sl_double_Sg____delslice__(arg1,arg2,arg3); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleVector___delitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + std::vector< double >::difference_type arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector___delitem__" "', argument " "1"" of type '" "std::vector< double > *""'"); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleVector___delitem__" "', argument " "2"" of type '" "std::vector< double >::difference_type""'"); + } + arg2 = static_cast< std::vector< double >::difference_type >(val2); + try { + std_vector_Sl_double_Sg____delitem____SWIG_0(arg1,arg2); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleVector___getitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + PySliceObject *arg2 = (PySliceObject *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< double,std::allocator< double > > *result = 0 ; + + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector___getitem__" "', argument " "1"" of type '" "std::vector< double > *""'"); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + { + if (!PySlice_Check(swig_obj[1])) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleVector___getitem__" "', argument " "2"" of type '" "PySliceObject *""'"); + } + arg2 = (PySliceObject *) swig_obj[1]; + } + try { + result = (std::vector< double,std::allocator< double > > *)std_vector_Sl_double_Sg____getitem____SWIG_0(arg1,arg2); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleVector___setitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + PySliceObject *arg2 = (PySliceObject *) 0 ; + std::vector< double,std::allocator< double > > *arg3 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res3 = SWIG_OLDOBJ ; + + if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector___setitem__" "', argument " "1"" of type '" "std::vector< double > *""'"); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + { + if (!PySlice_Check(swig_obj[1])) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleVector___setitem__" "', argument " "2"" of type '" "PySliceObject *""'"); + } + arg2 = (PySliceObject *) swig_obj[1]; + } + { + std::vector< double,std::allocator< double > > *ptr = (std::vector< double,std::allocator< double > > *)0; + res3 = swig::asptr(swig_obj[2], &ptr); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "DoubleVector___setitem__" "', argument " "3"" of type '" "std::vector< double,std::allocator< double > > const &""'"); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "DoubleVector___setitem__" "', argument " "3"" of type '" "std::vector< double,std::allocator< double > > const &""'"); + } + arg3 = ptr; + } + try { + std_vector_Sl_double_Sg____setitem____SWIG_0(arg1,arg2,(std::vector< double,std::allocator< double > > const &)*arg3); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } + resultobj = SWIG_Py_Void(); + if (SWIG_IsNewObj(res3)) delete arg3; + return resultobj; +fail: + if (SWIG_IsNewObj(res3)) delete arg3; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleVector___setitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + PySliceObject *arg2 = (PySliceObject *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector___setitem__" "', argument " "1"" of type '" "std::vector< double > *""'"); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + { + if (!PySlice_Check(swig_obj[1])) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleVector___setitem__" "', argument " "2"" of type '" "PySliceObject *""'"); + } + arg2 = (PySliceObject *) swig_obj[1]; + } + try { + std_vector_Sl_double_Sg____setitem____SWIG_1(arg1,arg2); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleVector___delitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + PySliceObject *arg2 = (PySliceObject *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector___delitem__" "', argument " "1"" of type '" "std::vector< double > *""'"); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + { + if (!PySlice_Check(swig_obj[1])) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleVector___delitem__" "', argument " "2"" of type '" "PySliceObject *""'"); + } + arg2 = (PySliceObject *) swig_obj[1]; + } + try { + std_vector_Sl_double_Sg____delitem____SWIG_1(arg1,arg2); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleVector___delitem__(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[3] = { + 0 + }; + + if (!(argc = SWIG_Python_UnpackTuple(args, "DoubleVector___delitem__", 0, 2, argv))) SWIG_fail; + --argc; + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::vector< double,std::allocator< double > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + _v = PySlice_Check(argv[1]); + } + if (_v) { + return _wrap_DoubleVector___delitem____SWIG_1(self, argc, argv); + } + } + } + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::vector< double,std::allocator< double > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_DoubleVector___delitem____SWIG_0(self, argc, argv); + } + } + } + +fail: + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'DoubleVector___delitem__'.\n" + " Possible C/C++ prototypes are:\n" + " std::vector< double >::__delitem__(std::vector< double >::difference_type)\n" + " std::vector< double >::__delitem__(PySliceObject *)\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_DoubleVector___getitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + std::vector< double >::difference_type arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + std::vector< double >::value_type *result = 0 ; + + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector___getitem__" "', argument " "1"" of type '" "std::vector< double > const *""'"); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleVector___getitem__" "', argument " "2"" of type '" "std::vector< double >::difference_type""'"); + } + arg2 = static_cast< std::vector< double >::difference_type >(val2); + try { + result = (std::vector< double >::value_type *) &std_vector_Sl_double_Sg____getitem____SWIG_1((std::vector< double > const *)arg1,arg2); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } + resultobj = SWIG_From_double(static_cast< double >(*result)); + (void)swig::container_owner<swig::traits<std::vector< double >::value_type>::category>::back_reference(resultobj, swig_obj[0]); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleVector___getitem__(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[3] = { + 0 + }; + + if (!(argc = SWIG_Python_UnpackTuple(args, "DoubleVector___getitem__", 0, 2, argv))) SWIG_fail; + --argc; + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::vector< double,std::allocator< double > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + _v = PySlice_Check(argv[1]); + } + if (_v) { + return _wrap_DoubleVector___getitem____SWIG_0(self, argc, argv); + } + } + } + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::vector< double,std::allocator< double > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_DoubleVector___getitem____SWIG_1(self, argc, argv); + } + } + } + +fail: + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'DoubleVector___getitem__'.\n" + " Possible C/C++ prototypes are:\n" + " std::vector< double >::__getitem__(PySliceObject *)\n" + " std::vector< double >::__getitem__(std::vector< double >::difference_type) const\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_DoubleVector___setitem____SWIG_2(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + std::vector< double >::difference_type arg2 ; + std::vector< double >::value_type *arg3 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + std::vector< double >::value_type temp3 ; + double val3 ; + int ecode3 = 0 ; + + if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector___setitem__" "', argument " "1"" of type '" "std::vector< double > *""'"); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleVector___setitem__" "', argument " "2"" of type '" "std::vector< double >::difference_type""'"); + } + arg2 = static_cast< std::vector< double >::difference_type >(val2); + ecode3 = SWIG_AsVal_double(swig_obj[2], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DoubleVector___setitem__" "', argument " "3"" of type '" "std::vector< double >::value_type""'"); + } + temp3 = static_cast< std::vector< double >::value_type >(val3); + arg3 = &temp3; + try { + std_vector_Sl_double_Sg____setitem____SWIG_2(arg1,arg2,(double const &)*arg3); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleVector___setitem__(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[4] = { + 0 + }; + + if (!(argc = SWIG_Python_UnpackTuple(args, "DoubleVector___setitem__", 0, 3, argv))) SWIG_fail; + --argc; + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::vector< double,std::allocator< double > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + _v = PySlice_Check(argv[1]); + } + if (_v) { + return _wrap_DoubleVector___setitem____SWIG_1(self, argc, argv); + } + } + } + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::vector< double,std::allocator< double > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + _v = PySlice_Check(argv[1]); + } + if (_v) { + int res = swig::asptr(argv[2], (std::vector< double,std::allocator< double > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_DoubleVector___setitem____SWIG_0(self, argc, argv); + } + } + } + } + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::vector< double,std::allocator< double > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_double(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_DoubleVector___setitem____SWIG_2(self, argc, argv); + } + } + } + } + +fail: + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'DoubleVector___setitem__'.\n" + " Possible C/C++ prototypes are:\n" + " std::vector< double >::__setitem__(PySliceObject *,std::vector< double,std::allocator< double > > const &)\n" + " std::vector< double >::__setitem__(PySliceObject *)\n" + " std::vector< double >::__setitem__(std::vector< double >::difference_type,std::vector< double >::value_type const &)\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_DoubleVector_pop(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::vector< double >::value_type result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_pop" "', argument " "1"" of type '" "std::vector< double > *""'"); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + try { + result = (std::vector< double >::value_type)std_vector_Sl_double_Sg__pop(arg1); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } + resultobj = SWIG_From_double(static_cast< double >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleVector_append(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + std::vector< double >::value_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< double >::value_type temp2 ; + double val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "DoubleVector_append", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_append" "', argument " "1"" of type '" "std::vector< double > *""'"); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + ecode2 = SWIG_AsVal_double(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleVector_append" "', argument " "2"" of type '" "std::vector< double >::value_type""'"); + } + temp2 = static_cast< std::vector< double >::value_type >(val2); + arg2 = &temp2; + std_vector_Sl_double_Sg__append(arg1,(double const &)*arg2); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_DoubleVector__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) { + PyObject *resultobj = 0; + std::vector< double > *result = 0 ; + + if ((nobjs < 0) || (nobjs > 0)) SWIG_fail; + result = (std::vector< double > *)new std::vector< double >(); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, SWIG_POINTER_NEW | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_DoubleVector__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< double > *arg1 = 0 ; + int res1 = SWIG_OLDOBJ ; + std::vector< double > *result = 0 ; + + if ((nobjs < 1) || (nobjs > 1)) SWIG_fail; + { + std::vector< double,std::allocator< double > > *ptr = (std::vector< double,std::allocator< double > > *)0; + res1 = swig::asptr(swig_obj[0], &ptr); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_DoubleVector" "', argument " "1"" of type '" "std::vector< double > const &""'"); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_DoubleVector" "', argument " "1"" of type '" "std::vector< double > const &""'"); + } + arg1 = ptr; + } + result = (std::vector< double > *)new std::vector< double >((std::vector< double > const &)*arg1); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, SWIG_POINTER_NEW | 0 ); + if (SWIG_IsNewObj(res1)) delete arg1; + return resultobj; +fail: + if (SWIG_IsNewObj(res1)) delete arg1; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleVector_empty(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + bool result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_empty" "', argument " "1"" of type '" "std::vector< double > const *""'"); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + result = (bool)((std::vector< double > const *)arg1)->empty(); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleVector_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::vector< double >::size_type result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_size" "', argument " "1"" of type '" "std::vector< double > const *""'"); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + result = ((std::vector< double > const *)arg1)->size(); + resultobj = SWIG_From_size_t(static_cast< size_t >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleVector_swap(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + std::vector< double > *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "DoubleVector_swap", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_swap" "', argument " "1"" of type '" "std::vector< double > *""'"); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "DoubleVector_swap" "', argument " "2"" of type '" "std::vector< double > &""'"); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "DoubleVector_swap" "', argument " "2"" of type '" "std::vector< double > &""'"); + } + arg2 = reinterpret_cast< std::vector< double > * >(argp2); + (arg1)->swap(*arg2); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleVector_begin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::vector< double >::iterator result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_begin" "', argument " "1"" of type '" "std::vector< double > *""'"); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + result = (arg1)->begin(); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< double >::iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleVector_end(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::vector< double >::iterator result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_end" "', argument " "1"" of type '" "std::vector< double > *""'"); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + result = (arg1)->end(); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< double >::iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleVector_rbegin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::vector< double >::reverse_iterator result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_rbegin" "', argument " "1"" of type '" "std::vector< double > *""'"); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + result = (arg1)->rbegin(); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< double >::reverse_iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleVector_rend(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::vector< double >::reverse_iterator result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_rend" "', argument " "1"" of type '" "std::vector< double > *""'"); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + result = (arg1)->rend(); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< double >::reverse_iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleVector_clear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_clear" "', argument " "1"" of type '" "std::vector< double > *""'"); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + (arg1)->clear(); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleVector_get_allocator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + SwigValueWrapper< std::allocator< double > > result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_get_allocator" "', argument " "1"" of type '" "std::vector< double > const *""'"); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + result = ((std::vector< double > const *)arg1)->get_allocator(); + resultobj = SWIG_NewPointerObj((new std::vector< double >::allocator_type(static_cast< const std::vector< double >::allocator_type& >(result))), SWIGTYPE_p_std__allocatorT_double_t, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_DoubleVector__SWIG_2(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< double >::size_type arg1 ; + size_t val1 ; + int ecode1 = 0 ; + std::vector< double > *result = 0 ; + + if ((nobjs < 1) || (nobjs > 1)) SWIG_fail; + ecode1 = SWIG_AsVal_size_t(swig_obj[0], &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_DoubleVector" "', argument " "1"" of type '" "std::vector< double >::size_type""'"); + } + arg1 = static_cast< std::vector< double >::size_type >(val1); + result = (std::vector< double > *)new std::vector< double >(arg1); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, SWIG_POINTER_NEW | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleVector_pop_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_pop_back" "', argument " "1"" of type '" "std::vector< double > *""'"); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + (arg1)->pop_back(); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleVector_resize__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + std::vector< double >::size_type arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + size_t val2 ; + int ecode2 = 0 ; + + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_resize" "', argument " "1"" of type '" "std::vector< double > *""'"); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleVector_resize" "', argument " "2"" of type '" "std::vector< double >::size_type""'"); + } + arg2 = static_cast< std::vector< double >::size_type >(val2); + (arg1)->resize(arg2); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleVector_erase__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + std::vector< double >::iterator arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + swig::SwigPyIterator *iter2 = 0 ; + int res2 ; + std::vector< double >::iterator result; + + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_erase" "', argument " "1"" of type '" "std::vector< double > *""'"); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0); + if (!SWIG_IsOK(res2) || !iter2) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleVector_erase" "', argument " "2"" of type '" "std::vector< double >::iterator""'"); + } else { + swig::SwigPyIterator_T<std::vector< double >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< double >::iterator > *>(iter2); + if (iter_t) { + arg2 = iter_t->get_current(); + } else { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleVector_erase" "', argument " "2"" of type '" "std::vector< double >::iterator""'"); + } + } + result = std_vector_Sl_double_Sg__erase__SWIG_0(arg1,arg2); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< double >::iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleVector_erase__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + std::vector< double >::iterator arg2 ; + std::vector< double >::iterator arg3 ; + void *argp1 = 0 ; + int res1 = 0 ; + swig::SwigPyIterator *iter2 = 0 ; + int res2 ; + swig::SwigPyIterator *iter3 = 0 ; + int res3 ; + std::vector< double >::iterator result; + + if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_erase" "', argument " "1"" of type '" "std::vector< double > *""'"); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0); + if (!SWIG_IsOK(res2) || !iter2) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleVector_erase" "', argument " "2"" of type '" "std::vector< double >::iterator""'"); + } else { + swig::SwigPyIterator_T<std::vector< double >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< double >::iterator > *>(iter2); + if (iter_t) { + arg2 = iter_t->get_current(); + } else { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleVector_erase" "', argument " "2"" of type '" "std::vector< double >::iterator""'"); + } + } + res3 = SWIG_ConvertPtr(swig_obj[2], SWIG_as_voidptrptr(&iter3), swig::SwigPyIterator::descriptor(), 0); + if (!SWIG_IsOK(res3) || !iter3) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleVector_erase" "', argument " "3"" of type '" "std::vector< double >::iterator""'"); + } else { + swig::SwigPyIterator_T<std::vector< double >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< double >::iterator > *>(iter3); + if (iter_t) { + arg3 = iter_t->get_current(); + } else { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleVector_erase" "', argument " "3"" of type '" "std::vector< double >::iterator""'"); + } + } + result = std_vector_Sl_double_Sg__erase__SWIG_1(arg1,arg2,arg3); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< double >::iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleVector_erase(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[4] = { + 0 + }; + + if (!(argc = SWIG_Python_UnpackTuple(args, "DoubleVector_erase", 0, 3, argv))) SWIG_fail; + --argc; + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::vector< double,std::allocator< double > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + swig::SwigPyIterator *iter = 0; + int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); + _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< double >::iterator > *>(iter) != 0)); + if (_v) { + return _wrap_DoubleVector_erase__SWIG_0(self, argc, argv); + } + } + } + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::vector< double,std::allocator< double > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + swig::SwigPyIterator *iter = 0; + int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); + _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< double >::iterator > *>(iter) != 0)); + if (_v) { + swig::SwigPyIterator *iter = 0; + int res = SWIG_ConvertPtr(argv[2], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); + _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< double >::iterator > *>(iter) != 0)); + if (_v) { + return _wrap_DoubleVector_erase__SWIG_1(self, argc, argv); + } + } + } + } + +fail: + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'DoubleVector_erase'.\n" + " Possible C/C++ prototypes are:\n" + " std::vector< double >::erase(std::vector< double >::iterator)\n" + " std::vector< double >::erase(std::vector< double >::iterator,std::vector< double >::iterator)\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_new_DoubleVector__SWIG_3(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< double >::size_type arg1 ; + std::vector< double >::value_type *arg2 = 0 ; + size_t val1 ; + int ecode1 = 0 ; + std::vector< double >::value_type temp2 ; + double val2 ; + int ecode2 = 0 ; + std::vector< double > *result = 0 ; + + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + ecode1 = SWIG_AsVal_size_t(swig_obj[0], &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_DoubleVector" "', argument " "1"" of type '" "std::vector< double >::size_type""'"); + } + arg1 = static_cast< std::vector< double >::size_type >(val1); + ecode2 = SWIG_AsVal_double(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_DoubleVector" "', argument " "2"" of type '" "std::vector< double >::value_type""'"); + } + temp2 = static_cast< std::vector< double >::value_type >(val2); + arg2 = &temp2; + result = (std::vector< double > *)new std::vector< double >(arg1,(std::vector< double >::value_type const &)*arg2); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, SWIG_POINTER_NEW | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_DoubleVector(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[3] = { + 0 + }; + + if (!(argc = SWIG_Python_UnpackTuple(args, "new_DoubleVector", 0, 2, argv))) SWIG_fail; + --argc; + if (argc == 0) { + return _wrap_new_DoubleVector__SWIG_0(self, argc, argv); + } + if (argc == 1) { + int _v; + { + int res = SWIG_AsVal_size_t(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_new_DoubleVector__SWIG_2(self, argc, argv); + } + } + if (argc == 1) { + int _v; + int res = swig::asptr(argv[0], (std::vector< double,std::allocator< double > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_new_DoubleVector__SWIG_1(self, argc, argv); + } + } + if (argc == 2) { + int _v; + { + int res = SWIG_AsVal_size_t(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_double(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_new_DoubleVector__SWIG_3(self, argc, argv); + } + } + } + +fail: + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'new_DoubleVector'.\n" + " Possible C/C++ prototypes are:\n" + " std::vector< double >::vector()\n" + " std::vector< double >::vector(std::vector< double > const &)\n" + " std::vector< double >::vector(std::vector< double >::size_type)\n" + " std::vector< double >::vector(std::vector< double >::size_type,std::vector< double >::value_type const &)\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_DoubleVector_push_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + std::vector< double >::value_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< double >::value_type temp2 ; + double val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "DoubleVector_push_back", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_push_back" "', argument " "1"" of type '" "std::vector< double > *""'"); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + ecode2 = SWIG_AsVal_double(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleVector_push_back" "', argument " "2"" of type '" "std::vector< double >::value_type""'"); + } + temp2 = static_cast< std::vector< double >::value_type >(val2); + arg2 = &temp2; + (arg1)->push_back((std::vector< double >::value_type const &)*arg2); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleVector_front(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::vector< double >::value_type *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_front" "', argument " "1"" of type '" "std::vector< double > const *""'"); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + result = (std::vector< double >::value_type *) &((std::vector< double > const *)arg1)->front(); + resultobj = SWIG_From_double(static_cast< double >(*result)); + (void)swig::container_owner<swig::traits<std::vector< double >::value_type>::category>::back_reference(resultobj, swig_obj[0]); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleVector_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::vector< double >::value_type *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_back" "', argument " "1"" of type '" "std::vector< double > const *""'"); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + result = (std::vector< double >::value_type *) &((std::vector< double > const *)arg1)->back(); + resultobj = SWIG_From_double(static_cast< double >(*result)); + (void)swig::container_owner<swig::traits<std::vector< double >::value_type>::category>::back_reference(resultobj, swig_obj[0]); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleVector_assign(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + std::vector< double >::size_type arg2 ; + std::vector< double >::value_type *arg3 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + size_t val2 ; + int ecode2 = 0 ; + std::vector< double >::value_type temp3 ; + double val3 ; + int ecode3 = 0 ; + PyObject *swig_obj[3] ; + + if (!SWIG_Python_UnpackTuple(args, "DoubleVector_assign", 3, 3, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_assign" "', argument " "1"" of type '" "std::vector< double > *""'"); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleVector_assign" "', argument " "2"" of type '" "std::vector< double >::size_type""'"); + } + arg2 = static_cast< std::vector< double >::size_type >(val2); + ecode3 = SWIG_AsVal_double(swig_obj[2], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DoubleVector_assign" "', argument " "3"" of type '" "std::vector< double >::value_type""'"); + } + temp3 = static_cast< std::vector< double >::value_type >(val3); + arg3 = &temp3; + (arg1)->assign(arg2,(std::vector< double >::value_type const &)*arg3); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleVector_resize__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + std::vector< double >::size_type arg2 ; + std::vector< double >::value_type *arg3 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + size_t val2 ; + int ecode2 = 0 ; + std::vector< double >::value_type temp3 ; + double val3 ; + int ecode3 = 0 ; + + if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_resize" "', argument " "1"" of type '" "std::vector< double > *""'"); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleVector_resize" "', argument " "2"" of type '" "std::vector< double >::size_type""'"); + } + arg2 = static_cast< std::vector< double >::size_type >(val2); + ecode3 = SWIG_AsVal_double(swig_obj[2], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DoubleVector_resize" "', argument " "3"" of type '" "std::vector< double >::value_type""'"); + } + temp3 = static_cast< std::vector< double >::value_type >(val3); + arg3 = &temp3; + (arg1)->resize(arg2,(std::vector< double >::value_type const &)*arg3); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleVector_resize(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[4] = { + 0 + }; + + if (!(argc = SWIG_Python_UnpackTuple(args, "DoubleVector_resize", 0, 3, argv))) SWIG_fail; + --argc; + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::vector< double,std::allocator< double > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_size_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_DoubleVector_resize__SWIG_0(self, argc, argv); + } + } + } + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::vector< double,std::allocator< double > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_size_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_double(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_DoubleVector_resize__SWIG_1(self, argc, argv); + } + } + } + } + +fail: + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'DoubleVector_resize'.\n" + " Possible C/C++ prototypes are:\n" + " std::vector< double >::resize(std::vector< double >::size_type)\n" + " std::vector< double >::resize(std::vector< double >::size_type,std::vector< double >::value_type const &)\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_DoubleVector_insert__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + std::vector< double >::iterator arg2 ; + std::vector< double >::value_type *arg3 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + swig::SwigPyIterator *iter2 = 0 ; + int res2 ; + std::vector< double >::value_type temp3 ; + double val3 ; + int ecode3 = 0 ; + std::vector< double >::iterator result; + + if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_insert" "', argument " "1"" of type '" "std::vector< double > *""'"); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0); + if (!SWIG_IsOK(res2) || !iter2) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleVector_insert" "', argument " "2"" of type '" "std::vector< double >::iterator""'"); + } else { + swig::SwigPyIterator_T<std::vector< double >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< double >::iterator > *>(iter2); + if (iter_t) { + arg2 = iter_t->get_current(); + } else { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleVector_insert" "', argument " "2"" of type '" "std::vector< double >::iterator""'"); + } + } + ecode3 = SWIG_AsVal_double(swig_obj[2], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DoubleVector_insert" "', argument " "3"" of type '" "std::vector< double >::value_type""'"); + } + temp3 = static_cast< std::vector< double >::value_type >(val3); + arg3 = &temp3; + result = std_vector_Sl_double_Sg__insert__SWIG_0(arg1,arg2,(double const &)*arg3); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< double >::iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleVector_insert__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + std::vector< double >::iterator arg2 ; + std::vector< double >::size_type arg3 ; + std::vector< double >::value_type *arg4 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + swig::SwigPyIterator *iter2 = 0 ; + int res2 ; + size_t val3 ; + int ecode3 = 0 ; + std::vector< double >::value_type temp4 ; + double val4 ; + int ecode4 = 0 ; + + if ((nobjs < 4) || (nobjs > 4)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_insert" "', argument " "1"" of type '" "std::vector< double > *""'"); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0); + if (!SWIG_IsOK(res2) || !iter2) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleVector_insert" "', argument " "2"" of type '" "std::vector< double >::iterator""'"); + } else { + swig::SwigPyIterator_T<std::vector< double >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< double >::iterator > *>(iter2); + if (iter_t) { + arg2 = iter_t->get_current(); + } else { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleVector_insert" "', argument " "2"" of type '" "std::vector< double >::iterator""'"); + } + } + ecode3 = SWIG_AsVal_size_t(swig_obj[2], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DoubleVector_insert" "', argument " "3"" of type '" "std::vector< double >::size_type""'"); + } + arg3 = static_cast< std::vector< double >::size_type >(val3); + ecode4 = SWIG_AsVal_double(swig_obj[3], &val4); + if (!SWIG_IsOK(ecode4)) { + SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "DoubleVector_insert" "', argument " "4"" of type '" "std::vector< double >::value_type""'"); + } + temp4 = static_cast< std::vector< double >::value_type >(val4); + arg4 = &temp4; + std_vector_Sl_double_Sg__insert__SWIG_1(arg1,arg2,arg3,(double const &)*arg4); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleVector_insert(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[5] = { + 0 + }; + + if (!(argc = SWIG_Python_UnpackTuple(args, "DoubleVector_insert", 0, 4, argv))) SWIG_fail; + --argc; + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::vector< double,std::allocator< double > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + swig::SwigPyIterator *iter = 0; + int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); + _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< double >::iterator > *>(iter) != 0)); + if (_v) { + { + int res = SWIG_AsVal_double(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_DoubleVector_insert__SWIG_0(self, argc, argv); + } + } + } + } + if (argc == 4) { + int _v; + int res = swig::asptr(argv[0], (std::vector< double,std::allocator< double > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + swig::SwigPyIterator *iter = 0; + int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); + _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< double >::iterator > *>(iter) != 0)); + if (_v) { + { + int res = SWIG_AsVal_size_t(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_double(argv[3], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_DoubleVector_insert__SWIG_1(self, argc, argv); + } + } + } + } + } + +fail: + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'DoubleVector_insert'.\n" + " Possible C/C++ prototypes are:\n" + " std::vector< double >::insert(std::vector< double >::iterator,std::vector< double >::value_type const &)\n" + " std::vector< double >::insert(std::vector< double >::iterator,std::vector< double >::size_type,std::vector< double >::value_type const &)\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_DoubleVector_reserve(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + std::vector< double >::size_type arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + size_t val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "DoubleVector_reserve", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_reserve" "', argument " "1"" of type '" "std::vector< double > *""'"); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleVector_reserve" "', argument " "2"" of type '" "std::vector< double >::size_type""'"); + } + arg2 = static_cast< std::vector< double >::size_type >(val2); + (arg1)->reserve(arg2); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleVector_capacity(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::vector< double >::size_type result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_capacity" "', argument " "1"" of type '" "std::vector< double > const *""'"); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + result = ((std::vector< double > const *)arg1)->capacity(); + resultobj = SWIG_From_size_t(static_cast< size_t >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_delete_DoubleVector(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_DoubleVector" "', argument " "1"" of type '" "std::vector< double > *""'"); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + delete arg1; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *DoubleVector_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *obj; + if (!SWIG_Python_UnpackTuple(args, "swigregister", 1, 1, &obj)) return NULL; + SWIG_TypeNewClientData(SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, SWIG_NewClientData(obj)); + return SWIG_Py_Void(); +} + +SWIGINTERN PyObject *DoubleVector_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + return SWIG_Python_InitShadowInstance(args); +} + +SWIGINTERN PyObject *_wrap_DoubleDoubleVector_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + PyObject **arg2 = (PyObject **) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + swig::SwigPyIterator *result = 0 ; + + arg2 = &swig_obj[0]; + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_iterator" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + result = (swig::SwigPyIterator *)std_vector_Sl_std_vector_Sl_double_Sg__Sg__iterator(arg1,arg2); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleDoubleVector___nonzero__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + bool result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector___nonzero__" "', argument " "1"" of type '" "std::vector< std::vector< double > > const *""'"); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + result = (bool)std_vector_Sl_std_vector_Sl_double_Sg__Sg____nonzero__((std::vector< std::vector< double > > const *)arg1); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleDoubleVector___bool__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + bool result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector___bool__" "', argument " "1"" of type '" "std::vector< std::vector< double > > const *""'"); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + result = (bool)std_vector_Sl_std_vector_Sl_double_Sg__Sg____bool__((std::vector< std::vector< double > > const *)arg1); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleDoubleVector___len__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::vector< std::vector< double > >::size_type result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector___len__" "', argument " "1"" of type '" "std::vector< std::vector< double > > const *""'"); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + result = std_vector_Sl_std_vector_Sl_double_Sg__Sg____len__((std::vector< std::vector< double > > const *)arg1); + resultobj = SWIG_From_size_t(static_cast< size_t >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleDoubleVector___getslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + std::vector< std::vector< double > >::difference_type arg2 ; + std::vector< std::vector< double > >::difference_type arg3 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + ptrdiff_t val3 ; + int ecode3 = 0 ; + PyObject *swig_obj[3] ; + std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *result = 0 ; + + if (!SWIG_Python_UnpackTuple(args, "DoubleDoubleVector___getslice__", 3, 3, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector___getslice__" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleDoubleVector___getslice__" "', argument " "2"" of type '" "std::vector< std::vector< double > >::difference_type""'"); + } + arg2 = static_cast< std::vector< std::vector< double > >::difference_type >(val2); + ecode3 = SWIG_AsVal_ptrdiff_t(swig_obj[2], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DoubleDoubleVector___getslice__" "', argument " "3"" of type '" "std::vector< std::vector< double > >::difference_type""'"); + } + arg3 = static_cast< std::vector< std::vector< double > >::difference_type >(val3); + try { + result = (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *)std_vector_Sl_std_vector_Sl_double_Sg__Sg____getslice__(arg1,arg2,arg3); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleDoubleVector___setslice____SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + std::vector< std::vector< double > >::difference_type arg2 ; + std::vector< std::vector< double > >::difference_type arg3 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + ptrdiff_t val3 ; + int ecode3 = 0 ; + + if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector___setslice__" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleDoubleVector___setslice__" "', argument " "2"" of type '" "std::vector< std::vector< double > >::difference_type""'"); + } + arg2 = static_cast< std::vector< std::vector< double > >::difference_type >(val2); + ecode3 = SWIG_AsVal_ptrdiff_t(swig_obj[2], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DoubleDoubleVector___setslice__" "', argument " "3"" of type '" "std::vector< std::vector< double > >::difference_type""'"); + } + arg3 = static_cast< std::vector< std::vector< double > >::difference_type >(val3); + try { + std_vector_Sl_std_vector_Sl_double_Sg__Sg____setslice____SWIG_0(arg1,arg2,arg3); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleDoubleVector___setslice____SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + std::vector< std::vector< double > >::difference_type arg2 ; + std::vector< std::vector< double > >::difference_type arg3 ; + std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *arg4 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + ptrdiff_t val3 ; + int ecode3 = 0 ; + int res4 = SWIG_OLDOBJ ; + + if ((nobjs < 4) || (nobjs > 4)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector___setslice__" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleDoubleVector___setslice__" "', argument " "2"" of type '" "std::vector< std::vector< double > >::difference_type""'"); + } + arg2 = static_cast< std::vector< std::vector< double > >::difference_type >(val2); + ecode3 = SWIG_AsVal_ptrdiff_t(swig_obj[2], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DoubleDoubleVector___setslice__" "', argument " "3"" of type '" "std::vector< std::vector< double > >::difference_type""'"); + } + arg3 = static_cast< std::vector< std::vector< double > >::difference_type >(val3); + { + std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *ptr = (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *)0; + res4 = swig::asptr(swig_obj[3], &ptr); + if (!SWIG_IsOK(res4)) { + SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "DoubleDoubleVector___setslice__" "', argument " "4"" of type '" "std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > const &""'"); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "DoubleDoubleVector___setslice__" "', argument " "4"" of type '" "std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > const &""'"); + } + arg4 = ptr; + } + try { + std_vector_Sl_std_vector_Sl_double_Sg__Sg____setslice____SWIG_1(arg1,arg2,arg3,(std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > const &)*arg4); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } + resultobj = SWIG_Py_Void(); + if (SWIG_IsNewObj(res4)) delete arg4; + return resultobj; +fail: + if (SWIG_IsNewObj(res4)) delete arg4; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleDoubleVector___setslice__(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[5] = { + 0 + }; + + if (!(argc = SWIG_Python_UnpackTuple(args, "DoubleDoubleVector___setslice__", 0, 4, argv))) SWIG_fail; + --argc; + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_DoubleDoubleVector___setslice____SWIG_0(self, argc, argv); + } + } + } + } + if (argc == 4) { + int _v; + int res = swig::asptr(argv[0], (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + int res = swig::asptr(argv[3], (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_DoubleDoubleVector___setslice____SWIG_1(self, argc, argv); + } + } + } + } + } + +fail: + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'DoubleDoubleVector___setslice__'.\n" + " Possible C/C++ prototypes are:\n" + " std::vector< std::vector< double > >::__setslice__(std::vector< std::vector< double > >::difference_type,std::vector< std::vector< double > >::difference_type)\n" + " std::vector< std::vector< double > >::__setslice__(std::vector< std::vector< double > >::difference_type,std::vector< std::vector< double > >::difference_type,std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > const &)\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_DoubleDoubleVector___delslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + std::vector< std::vector< double > >::difference_type arg2 ; + std::vector< std::vector< double > >::difference_type arg3 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + ptrdiff_t val3 ; + int ecode3 = 0 ; + PyObject *swig_obj[3] ; + + if (!SWIG_Python_UnpackTuple(args, "DoubleDoubleVector___delslice__", 3, 3, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector___delslice__" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleDoubleVector___delslice__" "', argument " "2"" of type '" "std::vector< std::vector< double > >::difference_type""'"); + } + arg2 = static_cast< std::vector< std::vector< double > >::difference_type >(val2); + ecode3 = SWIG_AsVal_ptrdiff_t(swig_obj[2], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DoubleDoubleVector___delslice__" "', argument " "3"" of type '" "std::vector< std::vector< double > >::difference_type""'"); + } + arg3 = static_cast< std::vector< std::vector< double > >::difference_type >(val3); + try { + std_vector_Sl_std_vector_Sl_double_Sg__Sg____delslice__(arg1,arg2,arg3); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleDoubleVector___delitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + std::vector< std::vector< double > >::difference_type arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector___delitem__" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleDoubleVector___delitem__" "', argument " "2"" of type '" "std::vector< std::vector< double > >::difference_type""'"); + } + arg2 = static_cast< std::vector< std::vector< double > >::difference_type >(val2); + try { + std_vector_Sl_std_vector_Sl_double_Sg__Sg____delitem____SWIG_0(arg1,arg2); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleDoubleVector___getitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + PySliceObject *arg2 = (PySliceObject *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *result = 0 ; + + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector___getitem__" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + { + if (!PySlice_Check(swig_obj[1])) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleDoubleVector___getitem__" "', argument " "2"" of type '" "PySliceObject *""'"); + } + arg2 = (PySliceObject *) swig_obj[1]; + } + try { + result = (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *)std_vector_Sl_std_vector_Sl_double_Sg__Sg____getitem____SWIG_0(arg1,arg2); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleDoubleVector___setitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + PySliceObject *arg2 = (PySliceObject *) 0 ; + std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *arg3 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res3 = SWIG_OLDOBJ ; + + if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector___setitem__" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + { + if (!PySlice_Check(swig_obj[1])) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleDoubleVector___setitem__" "', argument " "2"" of type '" "PySliceObject *""'"); + } + arg2 = (PySliceObject *) swig_obj[1]; + } + { + std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *ptr = (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *)0; + res3 = swig::asptr(swig_obj[2], &ptr); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "DoubleDoubleVector___setitem__" "', argument " "3"" of type '" "std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > const &""'"); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "DoubleDoubleVector___setitem__" "', argument " "3"" of type '" "std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > const &""'"); + } + arg3 = ptr; + } + try { + std_vector_Sl_std_vector_Sl_double_Sg__Sg____setitem____SWIG_0(arg1,arg2,(std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > const &)*arg3); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } + resultobj = SWIG_Py_Void(); + if (SWIG_IsNewObj(res3)) delete arg3; + return resultobj; +fail: + if (SWIG_IsNewObj(res3)) delete arg3; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleDoubleVector___setitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + PySliceObject *arg2 = (PySliceObject *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector___setitem__" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + { + if (!PySlice_Check(swig_obj[1])) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleDoubleVector___setitem__" "', argument " "2"" of type '" "PySliceObject *""'"); + } + arg2 = (PySliceObject *) swig_obj[1]; + } + try { + std_vector_Sl_std_vector_Sl_double_Sg__Sg____setitem____SWIG_1(arg1,arg2); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleDoubleVector___delitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + PySliceObject *arg2 = (PySliceObject *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector___delitem__" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + { + if (!PySlice_Check(swig_obj[1])) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleDoubleVector___delitem__" "', argument " "2"" of type '" "PySliceObject *""'"); + } + arg2 = (PySliceObject *) swig_obj[1]; + } + try { + std_vector_Sl_std_vector_Sl_double_Sg__Sg____delitem____SWIG_1(arg1,arg2); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleDoubleVector___delitem__(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[3] = { + 0 + }; + + if (!(argc = SWIG_Python_UnpackTuple(args, "DoubleDoubleVector___delitem__", 0, 2, argv))) SWIG_fail; + --argc; + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + _v = PySlice_Check(argv[1]); + } + if (_v) { + return _wrap_DoubleDoubleVector___delitem____SWIG_1(self, argc, argv); + } + } + } + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_DoubleDoubleVector___delitem____SWIG_0(self, argc, argv); + } + } + } + +fail: + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'DoubleDoubleVector___delitem__'.\n" + " Possible C/C++ prototypes are:\n" + " std::vector< std::vector< double > >::__delitem__(std::vector< std::vector< double > >::difference_type)\n" + " std::vector< std::vector< double > >::__delitem__(PySliceObject *)\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_DoubleDoubleVector___getitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + std::vector< std::vector< double > >::difference_type arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + std::vector< std::vector< double > >::value_type *result = 0 ; + + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector___getitem__" "', argument " "1"" of type '" "std::vector< std::vector< double > > const *""'"); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleDoubleVector___getitem__" "', argument " "2"" of type '" "std::vector< std::vector< double > >::difference_type""'"); + } + arg2 = static_cast< std::vector< std::vector< double > >::difference_type >(val2); + try { + result = (std::vector< std::vector< double > >::value_type *) &std_vector_Sl_std_vector_Sl_double_Sg__Sg____getitem____SWIG_1((std::vector< std::vector< double > > const *)arg1,arg2); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } + resultobj = swig::from(static_cast< std::vector< double,std::allocator< double > > >(*result)); + (void)swig::container_owner<swig::traits<std::vector< std::vector< double > >::value_type>::category>::back_reference(resultobj, swig_obj[0]); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleDoubleVector___getitem__(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[3] = { + 0 + }; + + if (!(argc = SWIG_Python_UnpackTuple(args, "DoubleDoubleVector___getitem__", 0, 2, argv))) SWIG_fail; + --argc; + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + _v = PySlice_Check(argv[1]); + } + if (_v) { + return _wrap_DoubleDoubleVector___getitem____SWIG_0(self, argc, argv); + } + } + } + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_DoubleDoubleVector___getitem____SWIG_1(self, argc, argv); + } + } + } + +fail: + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'DoubleDoubleVector___getitem__'.\n" + " Possible C/C++ prototypes are:\n" + " std::vector< std::vector< double > >::__getitem__(PySliceObject *)\n" + " std::vector< std::vector< double > >::__getitem__(std::vector< std::vector< double > >::difference_type) const\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_DoubleDoubleVector___setitem____SWIG_2(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + std::vector< std::vector< double > >::difference_type arg2 ; + std::vector< std::vector< double > >::value_type *arg3 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + int res3 = SWIG_OLDOBJ ; + + if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector___setitem__" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleDoubleVector___setitem__" "', argument " "2"" of type '" "std::vector< std::vector< double > >::difference_type""'"); + } + arg2 = static_cast< std::vector< std::vector< double > >::difference_type >(val2); + { + std::vector< double,std::allocator< double > > *ptr = (std::vector< double,std::allocator< double > > *)0; + res3 = swig::asptr(swig_obj[2], &ptr); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "DoubleDoubleVector___setitem__" "', argument " "3"" of type '" "std::vector< std::vector< double > >::value_type const &""'"); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "DoubleDoubleVector___setitem__" "', argument " "3"" of type '" "std::vector< std::vector< double > >::value_type const &""'"); + } + arg3 = ptr; + } + try { + std_vector_Sl_std_vector_Sl_double_Sg__Sg____setitem____SWIG_2(arg1,arg2,(std::vector< double,std::allocator< double > > const &)*arg3); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } + resultobj = SWIG_Py_Void(); + if (SWIG_IsNewObj(res3)) delete arg3; + return resultobj; +fail: + if (SWIG_IsNewObj(res3)) delete arg3; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleDoubleVector___setitem__(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[4] = { + 0 + }; + + if (!(argc = SWIG_Python_UnpackTuple(args, "DoubleDoubleVector___setitem__", 0, 3, argv))) SWIG_fail; + --argc; + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + _v = PySlice_Check(argv[1]); + } + if (_v) { + return _wrap_DoubleDoubleVector___setitem____SWIG_1(self, argc, argv); + } + } + } + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + _v = PySlice_Check(argv[1]); + } + if (_v) { + int res = swig::asptr(argv[2], (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_DoubleDoubleVector___setitem____SWIG_0(self, argc, argv); + } + } + } + } + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + int res = swig::asptr(argv[2], (std::vector< double,std::allocator< double > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_DoubleDoubleVector___setitem____SWIG_2(self, argc, argv); + } + } + } + } + +fail: + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'DoubleDoubleVector___setitem__'.\n" + " Possible C/C++ prototypes are:\n" + " std::vector< std::vector< double > >::__setitem__(PySliceObject *,std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > const &)\n" + " std::vector< std::vector< double > >::__setitem__(PySliceObject *)\n" + " std::vector< std::vector< double > >::__setitem__(std::vector< std::vector< double > >::difference_type,std::vector< std::vector< double > >::value_type const &)\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_DoubleDoubleVector_pop(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::vector< std::vector< double > >::value_type result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_pop" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + try { + result = std_vector_Sl_std_vector_Sl_double_Sg__Sg__pop(arg1); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } + resultobj = swig::from(static_cast< std::vector< double,std::allocator< double > > >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleDoubleVector_append(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + std::vector< std::vector< double > >::value_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 = SWIG_OLDOBJ ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "DoubleDoubleVector_append", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_append" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + { + std::vector< double,std::allocator< double > > *ptr = (std::vector< double,std::allocator< double > > *)0; + res2 = swig::asptr(swig_obj[1], &ptr); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "DoubleDoubleVector_append" "', argument " "2"" of type '" "std::vector< std::vector< double > >::value_type const &""'"); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "DoubleDoubleVector_append" "', argument " "2"" of type '" "std::vector< std::vector< double > >::value_type const &""'"); + } + arg2 = ptr; + } + std_vector_Sl_std_vector_Sl_double_Sg__Sg__append(arg1,(std::vector< double,std::allocator< double > > const &)*arg2); + resultobj = SWIG_Py_Void(); + if (SWIG_IsNewObj(res2)) delete arg2; + return resultobj; +fail: + if (SWIG_IsNewObj(res2)) delete arg2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_DoubleDoubleVector__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) { + PyObject *resultobj = 0; + std::vector< std::vector< double > > *result = 0 ; + + if ((nobjs < 0) || (nobjs > 0)) SWIG_fail; + result = (std::vector< std::vector< double > > *)new std::vector< std::vector< double > >(); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, SWIG_POINTER_NEW | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_DoubleDoubleVector__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< std::vector< double,std::allocator< double > > > *arg1 = 0 ; + int res1 = SWIG_OLDOBJ ; + std::vector< std::vector< double > > *result = 0 ; + + if ((nobjs < 1) || (nobjs > 1)) SWIG_fail; + { + std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *ptr = (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *)0; + res1 = swig::asptr(swig_obj[0], &ptr); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_DoubleDoubleVector" "', argument " "1"" of type '" "std::vector< std::vector< double,std::allocator< double > > > const &""'"); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_DoubleDoubleVector" "', argument " "1"" of type '" "std::vector< std::vector< double,std::allocator< double > > > const &""'"); + } + arg1 = ptr; + } + result = (std::vector< std::vector< double > > *)new std::vector< std::vector< double > >((std::vector< std::vector< double,std::allocator< double > > > const &)*arg1); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, SWIG_POINTER_NEW | 0 ); + if (SWIG_IsNewObj(res1)) delete arg1; + return resultobj; +fail: + if (SWIG_IsNewObj(res1)) delete arg1; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleDoubleVector_empty(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + bool result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_empty" "', argument " "1"" of type '" "std::vector< std::vector< double > > const *""'"); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + result = (bool)((std::vector< std::vector< double > > const *)arg1)->empty(); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleDoubleVector_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::vector< std::vector< double > >::size_type result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_size" "', argument " "1"" of type '" "std::vector< std::vector< double > > const *""'"); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + result = ((std::vector< std::vector< double > > const *)arg1)->size(); + resultobj = SWIG_From_size_t(static_cast< size_t >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleDoubleVector_swap(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + std::vector< std::vector< double,std::allocator< double > > > *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "DoubleDoubleVector_swap", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_swap" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "DoubleDoubleVector_swap" "', argument " "2"" of type '" "std::vector< std::vector< double,std::allocator< double > > > &""'"); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "DoubleDoubleVector_swap" "', argument " "2"" of type '" "std::vector< std::vector< double,std::allocator< double > > > &""'"); + } + arg2 = reinterpret_cast< std::vector< std::vector< double,std::allocator< double > > > * >(argp2); + (arg1)->swap(*arg2); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleDoubleVector_begin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::vector< std::vector< double > >::iterator result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_begin" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + result = (arg1)->begin(); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< std::vector< double > >::iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleDoubleVector_end(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::vector< std::vector< double > >::iterator result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_end" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + result = (arg1)->end(); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< std::vector< double > >::iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleDoubleVector_rbegin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::vector< std::vector< double > >::reverse_iterator result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_rbegin" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + result = (arg1)->rbegin(); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< std::vector< double > >::reverse_iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleDoubleVector_rend(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::vector< std::vector< double > >::reverse_iterator result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_rend" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + result = (arg1)->rend(); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< std::vector< double > >::reverse_iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleDoubleVector_clear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_clear" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + (arg1)->clear(); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleDoubleVector_get_allocator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + SwigValueWrapper< std::allocator< std::vector< double,std::allocator< double > > > > result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_get_allocator" "', argument " "1"" of type '" "std::vector< std::vector< double > > const *""'"); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + result = ((std::vector< std::vector< double > > const *)arg1)->get_allocator(); + resultobj = SWIG_NewPointerObj((new std::vector< std::vector< double > >::allocator_type(static_cast< const std::vector< std::vector< double > >::allocator_type& >(result))), SWIGTYPE_p_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_DoubleDoubleVector__SWIG_2(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< std::vector< double > >::size_type arg1 ; + size_t val1 ; + int ecode1 = 0 ; + std::vector< std::vector< double > > *result = 0 ; + + if ((nobjs < 1) || (nobjs > 1)) SWIG_fail; + ecode1 = SWIG_AsVal_size_t(swig_obj[0], &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_DoubleDoubleVector" "', argument " "1"" of type '" "std::vector< std::vector< double > >::size_type""'"); + } + arg1 = static_cast< std::vector< std::vector< double > >::size_type >(val1); + result = (std::vector< std::vector< double > > *)new std::vector< std::vector< double > >(arg1); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, SWIG_POINTER_NEW | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleDoubleVector_pop_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_pop_back" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + (arg1)->pop_back(); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleDoubleVector_resize__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + std::vector< std::vector< double > >::size_type arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + size_t val2 ; + int ecode2 = 0 ; + + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_resize" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleDoubleVector_resize" "', argument " "2"" of type '" "std::vector< std::vector< double > >::size_type""'"); + } + arg2 = static_cast< std::vector< std::vector< double > >::size_type >(val2); + (arg1)->resize(arg2); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleDoubleVector_erase__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + std::vector< std::vector< double > >::iterator arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + swig::SwigPyIterator *iter2 = 0 ; + int res2 ; + std::vector< std::vector< double > >::iterator result; + + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_erase" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0); + if (!SWIG_IsOK(res2) || !iter2) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleDoubleVector_erase" "', argument " "2"" of type '" "std::vector< std::vector< double > >::iterator""'"); + } else { + swig::SwigPyIterator_T<std::vector< std::vector< double > >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< std::vector< double > >::iterator > *>(iter2); + if (iter_t) { + arg2 = iter_t->get_current(); + } else { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleDoubleVector_erase" "', argument " "2"" of type '" "std::vector< std::vector< double > >::iterator""'"); + } + } + result = std_vector_Sl_std_vector_Sl_double_Sg__Sg__erase__SWIG_0(arg1,arg2); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< std::vector< double > >::iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleDoubleVector_erase__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + std::vector< std::vector< double > >::iterator arg2 ; + std::vector< std::vector< double > >::iterator arg3 ; + void *argp1 = 0 ; + int res1 = 0 ; + swig::SwigPyIterator *iter2 = 0 ; + int res2 ; + swig::SwigPyIterator *iter3 = 0 ; + int res3 ; + std::vector< std::vector< double > >::iterator result; + + if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_erase" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0); + if (!SWIG_IsOK(res2) || !iter2) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleDoubleVector_erase" "', argument " "2"" of type '" "std::vector< std::vector< double > >::iterator""'"); + } else { + swig::SwigPyIterator_T<std::vector< std::vector< double > >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< std::vector< double > >::iterator > *>(iter2); + if (iter_t) { + arg2 = iter_t->get_current(); + } else { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleDoubleVector_erase" "', argument " "2"" of type '" "std::vector< std::vector< double > >::iterator""'"); + } + } + res3 = SWIG_ConvertPtr(swig_obj[2], SWIG_as_voidptrptr(&iter3), swig::SwigPyIterator::descriptor(), 0); + if (!SWIG_IsOK(res3) || !iter3) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleDoubleVector_erase" "', argument " "3"" of type '" "std::vector< std::vector< double > >::iterator""'"); + } else { + swig::SwigPyIterator_T<std::vector< std::vector< double > >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< std::vector< double > >::iterator > *>(iter3); + if (iter_t) { + arg3 = iter_t->get_current(); + } else { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleDoubleVector_erase" "', argument " "3"" of type '" "std::vector< std::vector< double > >::iterator""'"); + } + } + result = std_vector_Sl_std_vector_Sl_double_Sg__Sg__erase__SWIG_1(arg1,arg2,arg3); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< std::vector< double > >::iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleDoubleVector_erase(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[4] = { + 0 + }; + + if (!(argc = SWIG_Python_UnpackTuple(args, "DoubleDoubleVector_erase", 0, 3, argv))) SWIG_fail; + --argc; + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + swig::SwigPyIterator *iter = 0; + int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); + _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< std::vector< double > >::iterator > *>(iter) != 0)); + if (_v) { + return _wrap_DoubleDoubleVector_erase__SWIG_0(self, argc, argv); + } + } + } + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + swig::SwigPyIterator *iter = 0; + int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); + _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< std::vector< double > >::iterator > *>(iter) != 0)); + if (_v) { + swig::SwigPyIterator *iter = 0; + int res = SWIG_ConvertPtr(argv[2], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); + _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< std::vector< double > >::iterator > *>(iter) != 0)); + if (_v) { + return _wrap_DoubleDoubleVector_erase__SWIG_1(self, argc, argv); + } + } + } + } + +fail: + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'DoubleDoubleVector_erase'.\n" + " Possible C/C++ prototypes are:\n" + " std::vector< std::vector< double > >::erase(std::vector< std::vector< double > >::iterator)\n" + " std::vector< std::vector< double > >::erase(std::vector< std::vector< double > >::iterator,std::vector< std::vector< double > >::iterator)\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_new_DoubleDoubleVector__SWIG_3(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< std::vector< double > >::size_type arg1 ; + std::vector< std::vector< double > >::value_type *arg2 = 0 ; + size_t val1 ; + int ecode1 = 0 ; + int res2 = SWIG_OLDOBJ ; + std::vector< std::vector< double > > *result = 0 ; + + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + ecode1 = SWIG_AsVal_size_t(swig_obj[0], &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_DoubleDoubleVector" "', argument " "1"" of type '" "std::vector< std::vector< double > >::size_type""'"); + } + arg1 = static_cast< std::vector< std::vector< double > >::size_type >(val1); + { + std::vector< double,std::allocator< double > > *ptr = (std::vector< double,std::allocator< double > > *)0; + res2 = swig::asptr(swig_obj[1], &ptr); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_DoubleDoubleVector" "', argument " "2"" of type '" "std::vector< std::vector< double > >::value_type const &""'"); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_DoubleDoubleVector" "', argument " "2"" of type '" "std::vector< std::vector< double > >::value_type const &""'"); + } + arg2 = ptr; + } + result = (std::vector< std::vector< double > > *)new std::vector< std::vector< double > >(arg1,(std::vector< std::vector< double > >::value_type const &)*arg2); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, SWIG_POINTER_NEW | 0 ); + if (SWIG_IsNewObj(res2)) delete arg2; + return resultobj; +fail: + if (SWIG_IsNewObj(res2)) delete arg2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_DoubleDoubleVector(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[3] = { + 0 + }; + + if (!(argc = SWIG_Python_UnpackTuple(args, "new_DoubleDoubleVector", 0, 2, argv))) SWIG_fail; + --argc; + if (argc == 0) { + return _wrap_new_DoubleDoubleVector__SWIG_0(self, argc, argv); + } + if (argc == 1) { + int _v; + { + int res = SWIG_AsVal_size_t(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_new_DoubleDoubleVector__SWIG_2(self, argc, argv); + } + } + if (argc == 1) { + int _v; + int res = swig::asptr(argv[0], (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_new_DoubleDoubleVector__SWIG_1(self, argc, argv); + } + } + if (argc == 2) { + int _v; + { + int res = SWIG_AsVal_size_t(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + int res = swig::asptr(argv[1], (std::vector< double,std::allocator< double > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_new_DoubleDoubleVector__SWIG_3(self, argc, argv); + } + } + } + +fail: + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'new_DoubleDoubleVector'.\n" + " Possible C/C++ prototypes are:\n" + " std::vector< std::vector< double > >::vector()\n" + " std::vector< std::vector< double > >::vector(std::vector< std::vector< double,std::allocator< double > > > const &)\n" + " std::vector< std::vector< double > >::vector(std::vector< std::vector< double > >::size_type)\n" + " std::vector< std::vector< double > >::vector(std::vector< std::vector< double > >::size_type,std::vector< std::vector< double > >::value_type const &)\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_DoubleDoubleVector_push_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + std::vector< std::vector< double > >::value_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 = SWIG_OLDOBJ ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "DoubleDoubleVector_push_back", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_push_back" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + { + std::vector< double,std::allocator< double > > *ptr = (std::vector< double,std::allocator< double > > *)0; + res2 = swig::asptr(swig_obj[1], &ptr); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "DoubleDoubleVector_push_back" "', argument " "2"" of type '" "std::vector< std::vector< double > >::value_type const &""'"); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "DoubleDoubleVector_push_back" "', argument " "2"" of type '" "std::vector< std::vector< double > >::value_type const &""'"); + } + arg2 = ptr; + } + (arg1)->push_back((std::vector< std::vector< double > >::value_type const &)*arg2); + resultobj = SWIG_Py_Void(); + if (SWIG_IsNewObj(res2)) delete arg2; + return resultobj; +fail: + if (SWIG_IsNewObj(res2)) delete arg2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleDoubleVector_front(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::vector< std::vector< double > >::value_type *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_front" "', argument " "1"" of type '" "std::vector< std::vector< double > > const *""'"); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + result = (std::vector< std::vector< double > >::value_type *) &((std::vector< std::vector< double > > const *)arg1)->front(); + resultobj = swig::from(static_cast< std::vector< double,std::allocator< double > > >(*result)); + (void)swig::container_owner<swig::traits<std::vector< std::vector< double > >::value_type>::category>::back_reference(resultobj, swig_obj[0]); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleDoubleVector_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::vector< std::vector< double > >::value_type *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_back" "', argument " "1"" of type '" "std::vector< std::vector< double > > const *""'"); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + result = (std::vector< std::vector< double > >::value_type *) &((std::vector< std::vector< double > > const *)arg1)->back(); + resultobj = swig::from(static_cast< std::vector< double,std::allocator< double > > >(*result)); + (void)swig::container_owner<swig::traits<std::vector< std::vector< double > >::value_type>::category>::back_reference(resultobj, swig_obj[0]); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleDoubleVector_assign(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + std::vector< std::vector< double > >::size_type arg2 ; + std::vector< std::vector< double > >::value_type *arg3 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + size_t val2 ; + int ecode2 = 0 ; + int res3 = SWIG_OLDOBJ ; + PyObject *swig_obj[3] ; + + if (!SWIG_Python_UnpackTuple(args, "DoubleDoubleVector_assign", 3, 3, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_assign" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleDoubleVector_assign" "', argument " "2"" of type '" "std::vector< std::vector< double > >::size_type""'"); + } + arg2 = static_cast< std::vector< std::vector< double > >::size_type >(val2); + { + std::vector< double,std::allocator< double > > *ptr = (std::vector< double,std::allocator< double > > *)0; + res3 = swig::asptr(swig_obj[2], &ptr); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "DoubleDoubleVector_assign" "', argument " "3"" of type '" "std::vector< std::vector< double > >::value_type const &""'"); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "DoubleDoubleVector_assign" "', argument " "3"" of type '" "std::vector< std::vector< double > >::value_type const &""'"); + } + arg3 = ptr; + } + (arg1)->assign(arg2,(std::vector< std::vector< double > >::value_type const &)*arg3); + resultobj = SWIG_Py_Void(); + if (SWIG_IsNewObj(res3)) delete arg3; + return resultobj; +fail: + if (SWIG_IsNewObj(res3)) delete arg3; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleDoubleVector_resize__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + std::vector< std::vector< double > >::size_type arg2 ; + std::vector< std::vector< double > >::value_type *arg3 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + size_t val2 ; + int ecode2 = 0 ; + int res3 = SWIG_OLDOBJ ; + + if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_resize" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleDoubleVector_resize" "', argument " "2"" of type '" "std::vector< std::vector< double > >::size_type""'"); + } + arg2 = static_cast< std::vector< std::vector< double > >::size_type >(val2); + { + std::vector< double,std::allocator< double > > *ptr = (std::vector< double,std::allocator< double > > *)0; + res3 = swig::asptr(swig_obj[2], &ptr); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "DoubleDoubleVector_resize" "', argument " "3"" of type '" "std::vector< std::vector< double > >::value_type const &""'"); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "DoubleDoubleVector_resize" "', argument " "3"" of type '" "std::vector< std::vector< double > >::value_type const &""'"); + } + arg3 = ptr; + } + (arg1)->resize(arg2,(std::vector< std::vector< double > >::value_type const &)*arg3); + resultobj = SWIG_Py_Void(); + if (SWIG_IsNewObj(res3)) delete arg3; + return resultobj; +fail: + if (SWIG_IsNewObj(res3)) delete arg3; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleDoubleVector_resize(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[4] = { + 0 + }; + + if (!(argc = SWIG_Python_UnpackTuple(args, "DoubleDoubleVector_resize", 0, 3, argv))) SWIG_fail; + --argc; + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_size_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_DoubleDoubleVector_resize__SWIG_0(self, argc, argv); + } + } + } + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_size_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + int res = swig::asptr(argv[2], (std::vector< double,std::allocator< double > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_DoubleDoubleVector_resize__SWIG_1(self, argc, argv); + } + } + } + } + +fail: + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'DoubleDoubleVector_resize'.\n" + " Possible C/C++ prototypes are:\n" + " std::vector< std::vector< double > >::resize(std::vector< std::vector< double > >::size_type)\n" + " std::vector< std::vector< double > >::resize(std::vector< std::vector< double > >::size_type,std::vector< std::vector< double > >::value_type const &)\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_DoubleDoubleVector_insert__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + std::vector< std::vector< double > >::iterator arg2 ; + std::vector< std::vector< double > >::value_type *arg3 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + swig::SwigPyIterator *iter2 = 0 ; + int res2 ; + int res3 = SWIG_OLDOBJ ; + std::vector< std::vector< double > >::iterator result; + + if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_insert" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0); + if (!SWIG_IsOK(res2) || !iter2) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleDoubleVector_insert" "', argument " "2"" of type '" "std::vector< std::vector< double > >::iterator""'"); + } else { + swig::SwigPyIterator_T<std::vector< std::vector< double > >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< std::vector< double > >::iterator > *>(iter2); + if (iter_t) { + arg2 = iter_t->get_current(); + } else { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleDoubleVector_insert" "', argument " "2"" of type '" "std::vector< std::vector< double > >::iterator""'"); + } + } + { + std::vector< double,std::allocator< double > > *ptr = (std::vector< double,std::allocator< double > > *)0; + res3 = swig::asptr(swig_obj[2], &ptr); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "DoubleDoubleVector_insert" "', argument " "3"" of type '" "std::vector< std::vector< double > >::value_type const &""'"); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "DoubleDoubleVector_insert" "', argument " "3"" of type '" "std::vector< std::vector< double > >::value_type const &""'"); + } + arg3 = ptr; + } + result = std_vector_Sl_std_vector_Sl_double_Sg__Sg__insert__SWIG_0(arg1,arg2,(std::vector< double,std::allocator< double > > const &)*arg3); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< std::vector< double > >::iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + if (SWIG_IsNewObj(res3)) delete arg3; + return resultobj; +fail: + if (SWIG_IsNewObj(res3)) delete arg3; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleDoubleVector_insert__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + std::vector< std::vector< double > >::iterator arg2 ; + std::vector< std::vector< double > >::size_type arg3 ; + std::vector< std::vector< double > >::value_type *arg4 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + swig::SwigPyIterator *iter2 = 0 ; + int res2 ; + size_t val3 ; + int ecode3 = 0 ; + int res4 = SWIG_OLDOBJ ; + + if ((nobjs < 4) || (nobjs > 4)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_insert" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0); + if (!SWIG_IsOK(res2) || !iter2) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleDoubleVector_insert" "', argument " "2"" of type '" "std::vector< std::vector< double > >::iterator""'"); + } else { + swig::SwigPyIterator_T<std::vector< std::vector< double > >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< std::vector< double > >::iterator > *>(iter2); + if (iter_t) { + arg2 = iter_t->get_current(); + } else { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleDoubleVector_insert" "', argument " "2"" of type '" "std::vector< std::vector< double > >::iterator""'"); + } + } + ecode3 = SWIG_AsVal_size_t(swig_obj[2], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DoubleDoubleVector_insert" "', argument " "3"" of type '" "std::vector< std::vector< double > >::size_type""'"); + } + arg3 = static_cast< std::vector< std::vector< double > >::size_type >(val3); + { + std::vector< double,std::allocator< double > > *ptr = (std::vector< double,std::allocator< double > > *)0; + res4 = swig::asptr(swig_obj[3], &ptr); + if (!SWIG_IsOK(res4)) { + SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "DoubleDoubleVector_insert" "', argument " "4"" of type '" "std::vector< std::vector< double > >::value_type const &""'"); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "DoubleDoubleVector_insert" "', argument " "4"" of type '" "std::vector< std::vector< double > >::value_type const &""'"); + } + arg4 = ptr; + } + std_vector_Sl_std_vector_Sl_double_Sg__Sg__insert__SWIG_1(arg1,arg2,arg3,(std::vector< double,std::allocator< double > > const &)*arg4); + resultobj = SWIG_Py_Void(); + if (SWIG_IsNewObj(res4)) delete arg4; + return resultobj; +fail: + if (SWIG_IsNewObj(res4)) delete arg4; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleDoubleVector_insert(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[5] = { + 0 + }; + + if (!(argc = SWIG_Python_UnpackTuple(args, "DoubleDoubleVector_insert", 0, 4, argv))) SWIG_fail; + --argc; + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + swig::SwigPyIterator *iter = 0; + int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); + _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< std::vector< double > >::iterator > *>(iter) != 0)); + if (_v) { + int res = swig::asptr(argv[2], (std::vector< double,std::allocator< double > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_DoubleDoubleVector_insert__SWIG_0(self, argc, argv); + } + } + } + } + if (argc == 4) { + int _v; + int res = swig::asptr(argv[0], (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + swig::SwigPyIterator *iter = 0; + int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); + _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< std::vector< double > >::iterator > *>(iter) != 0)); + if (_v) { + { + int res = SWIG_AsVal_size_t(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + int res = swig::asptr(argv[3], (std::vector< double,std::allocator< double > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_DoubleDoubleVector_insert__SWIG_1(self, argc, argv); + } + } + } + } + } + +fail: + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'DoubleDoubleVector_insert'.\n" + " Possible C/C++ prototypes are:\n" + " std::vector< std::vector< double > >::insert(std::vector< std::vector< double > >::iterator,std::vector< std::vector< double > >::value_type const &)\n" + " std::vector< std::vector< double > >::insert(std::vector< std::vector< double > >::iterator,std::vector< std::vector< double > >::size_type,std::vector< std::vector< double > >::value_type const &)\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_DoubleDoubleVector_reserve(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + std::vector< std::vector< double > >::size_type arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + size_t val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "DoubleDoubleVector_reserve", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_reserve" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleDoubleVector_reserve" "', argument " "2"" of type '" "std::vector< std::vector< double > >::size_type""'"); + } + arg2 = static_cast< std::vector< std::vector< double > >::size_type >(val2); + (arg1)->reserve(arg2); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DoubleDoubleVector_capacity(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::vector< std::vector< double > >::size_type result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_capacity" "', argument " "1"" of type '" "std::vector< std::vector< double > > const *""'"); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + result = ((std::vector< std::vector< double > > const *)arg1)->capacity(); + resultobj = SWIG_From_size_t(static_cast< size_t >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_delete_DoubleDoubleVector(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_DoubleDoubleVector" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + delete arg1; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *DoubleDoubleVector_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *obj; + if (!SWIG_Python_UnpackTuple(args, "swigregister", 1, 1, &obj)) return NULL; + SWIG_TypeNewClientData(SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, SWIG_NewClientData(obj)); + return SWIG_Py_Void(); +} + +SWIGINTERN PyObject *DoubleDoubleVector_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + return SWIG_Python_InitShadowInstance(args); +} + +SWIGINTERN PyObject *_wrap_StringVector_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + PyObject **arg2 = (PyObject **) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + swig::SwigPyIterator *result = 0 ; + + arg2 = &swig_obj[0]; + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_iterator" "', argument " "1"" of type '" "std::vector< std::string > *""'"); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + result = (swig::SwigPyIterator *)std_vector_Sl_std_string_Sg__iterator(arg1,arg2); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_StringVector___nonzero__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + bool result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector___nonzero__" "', argument " "1"" of type '" "std::vector< std::string > const *""'"); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + result = (bool)std_vector_Sl_std_string_Sg____nonzero__((std::vector< std::string > const *)arg1); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_StringVector___bool__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + bool result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector___bool__" "', argument " "1"" of type '" "std::vector< std::string > const *""'"); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + result = (bool)std_vector_Sl_std_string_Sg____bool__((std::vector< std::string > const *)arg1); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_StringVector___len__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::vector< std::string >::size_type result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector___len__" "', argument " "1"" of type '" "std::vector< std::string > const *""'"); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + result = std_vector_Sl_std_string_Sg____len__((std::vector< std::string > const *)arg1); + resultobj = SWIG_From_size_t(static_cast< size_t >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_StringVector___getslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + std::vector< std::string >::difference_type arg2 ; + std::vector< std::string >::difference_type arg3 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + ptrdiff_t val3 ; + int ecode3 = 0 ; + PyObject *swig_obj[3] ; + std::vector< std::string,std::allocator< std::string > > *result = 0 ; + + if (!SWIG_Python_UnpackTuple(args, "StringVector___getslice__", 3, 3, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector___getslice__" "', argument " "1"" of type '" "std::vector< std::string > *""'"); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringVector___getslice__" "', argument " "2"" of type '" "std::vector< std::string >::difference_type""'"); + } + arg2 = static_cast< std::vector< std::string >::difference_type >(val2); + ecode3 = SWIG_AsVal_ptrdiff_t(swig_obj[2], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "StringVector___getslice__" "', argument " "3"" of type '" "std::vector< std::string >::difference_type""'"); + } + arg3 = static_cast< std::vector< std::string >::difference_type >(val3); + try { + result = (std::vector< std::string,std::allocator< std::string > > *)std_vector_Sl_std_string_Sg____getslice__(arg1,arg2,arg3); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_StringVector___setslice____SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + std::vector< std::string >::difference_type arg2 ; + std::vector< std::string >::difference_type arg3 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + ptrdiff_t val3 ; + int ecode3 = 0 ; + + if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector___setslice__" "', argument " "1"" of type '" "std::vector< std::string > *""'"); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringVector___setslice__" "', argument " "2"" of type '" "std::vector< std::string >::difference_type""'"); + } + arg2 = static_cast< std::vector< std::string >::difference_type >(val2); + ecode3 = SWIG_AsVal_ptrdiff_t(swig_obj[2], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "StringVector___setslice__" "', argument " "3"" of type '" "std::vector< std::string >::difference_type""'"); + } + arg3 = static_cast< std::vector< std::string >::difference_type >(val3); + try { + std_vector_Sl_std_string_Sg____setslice____SWIG_0(arg1,arg2,arg3); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_StringVector___setslice____SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + std::vector< std::string >::difference_type arg2 ; + std::vector< std::string >::difference_type arg3 ; + std::vector< std::string,std::allocator< std::string > > *arg4 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + ptrdiff_t val3 ; + int ecode3 = 0 ; + int res4 = SWIG_OLDOBJ ; + + if ((nobjs < 4) || (nobjs > 4)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector___setslice__" "', argument " "1"" of type '" "std::vector< std::string > *""'"); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringVector___setslice__" "', argument " "2"" of type '" "std::vector< std::string >::difference_type""'"); + } + arg2 = static_cast< std::vector< std::string >::difference_type >(val2); + ecode3 = SWIG_AsVal_ptrdiff_t(swig_obj[2], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "StringVector___setslice__" "', argument " "3"" of type '" "std::vector< std::string >::difference_type""'"); + } + arg3 = static_cast< std::vector< std::string >::difference_type >(val3); + { + std::vector< std::string,std::allocator< std::string > > *ptr = (std::vector< std::string,std::allocator< std::string > > *)0; + res4 = swig::asptr(swig_obj[3], &ptr); + if (!SWIG_IsOK(res4)) { + SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "StringVector___setslice__" "', argument " "4"" of type '" "std::vector< std::string,std::allocator< std::string > > const &""'"); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringVector___setslice__" "', argument " "4"" of type '" "std::vector< std::string,std::allocator< std::string > > const &""'"); + } + arg4 = ptr; + } + try { + std_vector_Sl_std_string_Sg____setslice____SWIG_1(arg1,arg2,arg3,(std::vector< std::string,std::allocator< std::string > > const &)*arg4); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } + resultobj = SWIG_Py_Void(); + if (SWIG_IsNewObj(res4)) delete arg4; + return resultobj; +fail: + if (SWIG_IsNewObj(res4)) delete arg4; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_StringVector___setslice__(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[5] = { + 0 + }; + + if (!(argc = SWIG_Python_UnpackTuple(args, "StringVector___setslice__", 0, 4, argv))) SWIG_fail; + --argc; + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::vector< std::string,std::allocator< std::string > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_StringVector___setslice____SWIG_0(self, argc, argv); + } + } + } + } + if (argc == 4) { + int _v; + int res = swig::asptr(argv[0], (std::vector< std::string,std::allocator< std::string > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + int res = swig::asptr(argv[3], (std::vector< std::string,std::allocator< std::string > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_StringVector___setslice____SWIG_1(self, argc, argv); + } + } + } + } + } + +fail: + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'StringVector___setslice__'.\n" + " Possible C/C++ prototypes are:\n" + " std::vector< std::string >::__setslice__(std::vector< std::string >::difference_type,std::vector< std::string >::difference_type)\n" + " std::vector< std::string >::__setslice__(std::vector< std::string >::difference_type,std::vector< std::string >::difference_type,std::vector< std::string,std::allocator< std::string > > const &)\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_StringVector___delslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + std::vector< std::string >::difference_type arg2 ; + std::vector< std::string >::difference_type arg3 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + ptrdiff_t val3 ; + int ecode3 = 0 ; + PyObject *swig_obj[3] ; + + if (!SWIG_Python_UnpackTuple(args, "StringVector___delslice__", 3, 3, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector___delslice__" "', argument " "1"" of type '" "std::vector< std::string > *""'"); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringVector___delslice__" "', argument " "2"" of type '" "std::vector< std::string >::difference_type""'"); + } + arg2 = static_cast< std::vector< std::string >::difference_type >(val2); + ecode3 = SWIG_AsVal_ptrdiff_t(swig_obj[2], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "StringVector___delslice__" "', argument " "3"" of type '" "std::vector< std::string >::difference_type""'"); + } + arg3 = static_cast< std::vector< std::string >::difference_type >(val3); + try { + std_vector_Sl_std_string_Sg____delslice__(arg1,arg2,arg3); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_StringVector___delitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + std::vector< std::string >::difference_type arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector___delitem__" "', argument " "1"" of type '" "std::vector< std::string > *""'"); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringVector___delitem__" "', argument " "2"" of type '" "std::vector< std::string >::difference_type""'"); + } + arg2 = static_cast< std::vector< std::string >::difference_type >(val2); + try { + std_vector_Sl_std_string_Sg____delitem____SWIG_0(arg1,arg2); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_StringVector___getitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + PySliceObject *arg2 = (PySliceObject *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< std::string,std::allocator< std::string > > *result = 0 ; + + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector___getitem__" "', argument " "1"" of type '" "std::vector< std::string > *""'"); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + { + if (!PySlice_Check(swig_obj[1])) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringVector___getitem__" "', argument " "2"" of type '" "PySliceObject *""'"); + } + arg2 = (PySliceObject *) swig_obj[1]; + } + try { + result = (std::vector< std::string,std::allocator< std::string > > *)std_vector_Sl_std_string_Sg____getitem____SWIG_0(arg1,arg2); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_StringVector___setitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + PySliceObject *arg2 = (PySliceObject *) 0 ; + std::vector< std::string,std::allocator< std::string > > *arg3 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res3 = SWIG_OLDOBJ ; + + if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector___setitem__" "', argument " "1"" of type '" "std::vector< std::string > *""'"); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + { + if (!PySlice_Check(swig_obj[1])) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringVector___setitem__" "', argument " "2"" of type '" "PySliceObject *""'"); + } + arg2 = (PySliceObject *) swig_obj[1]; + } + { + std::vector< std::string,std::allocator< std::string > > *ptr = (std::vector< std::string,std::allocator< std::string > > *)0; + res3 = swig::asptr(swig_obj[2], &ptr); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "StringVector___setitem__" "', argument " "3"" of type '" "std::vector< std::string,std::allocator< std::string > > const &""'"); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringVector___setitem__" "', argument " "3"" of type '" "std::vector< std::string,std::allocator< std::string > > const &""'"); + } + arg3 = ptr; + } + try { + std_vector_Sl_std_string_Sg____setitem____SWIG_0(arg1,arg2,(std::vector< std::string,std::allocator< std::string > > const &)*arg3); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } + resultobj = SWIG_Py_Void(); + if (SWIG_IsNewObj(res3)) delete arg3; + return resultobj; +fail: + if (SWIG_IsNewObj(res3)) delete arg3; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_StringVector___setitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + PySliceObject *arg2 = (PySliceObject *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector___setitem__" "', argument " "1"" of type '" "std::vector< std::string > *""'"); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + { + if (!PySlice_Check(swig_obj[1])) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringVector___setitem__" "', argument " "2"" of type '" "PySliceObject *""'"); + } + arg2 = (PySliceObject *) swig_obj[1]; + } + try { + std_vector_Sl_std_string_Sg____setitem____SWIG_1(arg1,arg2); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_StringVector___delitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + PySliceObject *arg2 = (PySliceObject *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector___delitem__" "', argument " "1"" of type '" "std::vector< std::string > *""'"); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + { + if (!PySlice_Check(swig_obj[1])) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringVector___delitem__" "', argument " "2"" of type '" "PySliceObject *""'"); + } + arg2 = (PySliceObject *) swig_obj[1]; + } + try { + std_vector_Sl_std_string_Sg____delitem____SWIG_1(arg1,arg2); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_StringVector___delitem__(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[3] = { + 0 + }; + + if (!(argc = SWIG_Python_UnpackTuple(args, "StringVector___delitem__", 0, 2, argv))) SWIG_fail; + --argc; + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::vector< std::string,std::allocator< std::string > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + _v = PySlice_Check(argv[1]); + } + if (_v) { + return _wrap_StringVector___delitem____SWIG_1(self, argc, argv); + } + } + } + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::vector< std::string,std::allocator< std::string > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_StringVector___delitem____SWIG_0(self, argc, argv); + } + } + } + +fail: + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'StringVector___delitem__'.\n" + " Possible C/C++ prototypes are:\n" + " std::vector< std::string >::__delitem__(std::vector< std::string >::difference_type)\n" + " std::vector< std::string >::__delitem__(PySliceObject *)\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_StringVector___getitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + std::vector< std::string >::difference_type arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + std::vector< std::string >::value_type *result = 0 ; + + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector___getitem__" "', argument " "1"" of type '" "std::vector< std::string > const *""'"); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringVector___getitem__" "', argument " "2"" of type '" "std::vector< std::string >::difference_type""'"); + } + arg2 = static_cast< std::vector< std::string >::difference_type >(val2); + try { + result = (std::vector< std::string >::value_type *) &std_vector_Sl_std_string_Sg____getitem____SWIG_1((std::vector< std::string > const *)arg1,arg2); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } + resultobj = SWIG_From_std_string(static_cast< std::string >(*result)); + (void)swig::container_owner<swig::traits<std::vector< std::string >::value_type>::category>::back_reference(resultobj, swig_obj[0]); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_StringVector___getitem__(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[3] = { + 0 + }; + + if (!(argc = SWIG_Python_UnpackTuple(args, "StringVector___getitem__", 0, 2, argv))) SWIG_fail; + --argc; + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::vector< std::string,std::allocator< std::string > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + _v = PySlice_Check(argv[1]); + } + if (_v) { + return _wrap_StringVector___getitem____SWIG_0(self, argc, argv); + } + } + } + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::vector< std::string,std::allocator< std::string > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_StringVector___getitem____SWIG_1(self, argc, argv); + } + } + } + +fail: + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'StringVector___getitem__'.\n" + " Possible C/C++ prototypes are:\n" + " std::vector< std::string >::__getitem__(PySliceObject *)\n" + " std::vector< std::string >::__getitem__(std::vector< std::string >::difference_type) const\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_StringVector___setitem____SWIG_2(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + std::vector< std::string >::difference_type arg2 ; + std::vector< std::string >::value_type *arg3 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + int res3 = SWIG_OLDOBJ ; + + if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector___setitem__" "', argument " "1"" of type '" "std::vector< std::string > *""'"); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringVector___setitem__" "', argument " "2"" of type '" "std::vector< std::string >::difference_type""'"); + } + arg2 = static_cast< std::vector< std::string >::difference_type >(val2); + { + std::string *ptr = (std::string *)0; + res3 = SWIG_AsPtr_std_string(swig_obj[2], &ptr); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "StringVector___setitem__" "', argument " "3"" of type '" "std::vector< std::string >::value_type const &""'"); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringVector___setitem__" "', argument " "3"" of type '" "std::vector< std::string >::value_type const &""'"); + } + arg3 = ptr; + } + try { + std_vector_Sl_std_string_Sg____setitem____SWIG_2(arg1,arg2,(std::string const &)*arg3); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } + resultobj = SWIG_Py_Void(); + if (SWIG_IsNewObj(res3)) delete arg3; + return resultobj; +fail: + if (SWIG_IsNewObj(res3)) delete arg3; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_StringVector___setitem__(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[4] = { + 0 + }; + + if (!(argc = SWIG_Python_UnpackTuple(args, "StringVector___setitem__", 0, 3, argv))) SWIG_fail; + --argc; + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::vector< std::string,std::allocator< std::string > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + _v = PySlice_Check(argv[1]); + } + if (_v) { + return _wrap_StringVector___setitem____SWIG_1(self, argc, argv); + } + } + } + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::vector< std::string,std::allocator< std::string > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + _v = PySlice_Check(argv[1]); + } + if (_v) { + int res = swig::asptr(argv[2], (std::vector< std::string,std::allocator< std::string > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_StringVector___setitem____SWIG_0(self, argc, argv); + } + } + } + } + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::vector< std::string,std::allocator< std::string > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + int res = SWIG_AsPtr_std_string(argv[2], (std::string**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_StringVector___setitem____SWIG_2(self, argc, argv); + } + } + } + } + +fail: + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'StringVector___setitem__'.\n" + " Possible C/C++ prototypes are:\n" + " std::vector< std::string >::__setitem__(PySliceObject *,std::vector< std::string,std::allocator< std::string > > const &)\n" + " std::vector< std::string >::__setitem__(PySliceObject *)\n" + " std::vector< std::string >::__setitem__(std::vector< std::string >::difference_type,std::vector< std::string >::value_type const &)\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_StringVector_pop(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::vector< std::string >::value_type result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_pop" "', argument " "1"" of type '" "std::vector< std::string > *""'"); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + try { + result = std_vector_Sl_std_string_Sg__pop(arg1); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } + resultobj = SWIG_From_std_string(static_cast< std::string >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_StringVector_append(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + std::vector< std::string >::value_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 = SWIG_OLDOBJ ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "StringVector_append", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_append" "', argument " "1"" of type '" "std::vector< std::string > *""'"); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + { + std::string *ptr = (std::string *)0; + res2 = SWIG_AsPtr_std_string(swig_obj[1], &ptr); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "StringVector_append" "', argument " "2"" of type '" "std::vector< std::string >::value_type const &""'"); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringVector_append" "', argument " "2"" of type '" "std::vector< std::string >::value_type const &""'"); + } + arg2 = ptr; + } + std_vector_Sl_std_string_Sg__append(arg1,(std::string const &)*arg2); + resultobj = SWIG_Py_Void(); + if (SWIG_IsNewObj(res2)) delete arg2; + return resultobj; +fail: + if (SWIG_IsNewObj(res2)) delete arg2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_StringVector__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) { + PyObject *resultobj = 0; + std::vector< std::string > *result = 0 ; + + if ((nobjs < 0) || (nobjs > 0)) SWIG_fail; + result = (std::vector< std::string > *)new std::vector< std::string >(); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, SWIG_POINTER_NEW | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_StringVector__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< std::string > *arg1 = 0 ; + int res1 = SWIG_OLDOBJ ; + std::vector< std::string > *result = 0 ; + + if ((nobjs < 1) || (nobjs > 1)) SWIG_fail; + { + std::vector< std::string,std::allocator< std::string > > *ptr = (std::vector< std::string,std::allocator< std::string > > *)0; + res1 = swig::asptr(swig_obj[0], &ptr); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_StringVector" "', argument " "1"" of type '" "std::vector< std::string > const &""'"); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_StringVector" "', argument " "1"" of type '" "std::vector< std::string > const &""'"); + } + arg1 = ptr; + } + result = (std::vector< std::string > *)new std::vector< std::string >((std::vector< std::string > const &)*arg1); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, SWIG_POINTER_NEW | 0 ); + if (SWIG_IsNewObj(res1)) delete arg1; + return resultobj; +fail: + if (SWIG_IsNewObj(res1)) delete arg1; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_StringVector_empty(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + bool result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_empty" "', argument " "1"" of type '" "std::vector< std::string > const *""'"); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + result = (bool)((std::vector< std::string > const *)arg1)->empty(); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_StringVector_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::vector< std::string >::size_type result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_size" "', argument " "1"" of type '" "std::vector< std::string > const *""'"); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + result = ((std::vector< std::string > const *)arg1)->size(); + resultobj = SWIG_From_size_t(static_cast< size_t >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_StringVector_swap(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + std::vector< std::string > *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "StringVector_swap", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_swap" "', argument " "1"" of type '" "std::vector< std::string > *""'"); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "StringVector_swap" "', argument " "2"" of type '" "std::vector< std::string > &""'"); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringVector_swap" "', argument " "2"" of type '" "std::vector< std::string > &""'"); + } + arg2 = reinterpret_cast< std::vector< std::string > * >(argp2); + (arg1)->swap(*arg2); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_StringVector_begin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::vector< std::string >::iterator result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_begin" "', argument " "1"" of type '" "std::vector< std::string > *""'"); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + result = (arg1)->begin(); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< std::string >::iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_StringVector_end(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::vector< std::string >::iterator result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_end" "', argument " "1"" of type '" "std::vector< std::string > *""'"); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + result = (arg1)->end(); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< std::string >::iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_StringVector_rbegin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::vector< std::string >::reverse_iterator result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_rbegin" "', argument " "1"" of type '" "std::vector< std::string > *""'"); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + result = (arg1)->rbegin(); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< std::string >::reverse_iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_StringVector_rend(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::vector< std::string >::reverse_iterator result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_rend" "', argument " "1"" of type '" "std::vector< std::string > *""'"); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + result = (arg1)->rend(); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< std::string >::reverse_iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_StringVector_clear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_clear" "', argument " "1"" of type '" "std::vector< std::string > *""'"); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + (arg1)->clear(); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_StringVector_get_allocator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + SwigValueWrapper< std::allocator< std::string > > result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_get_allocator" "', argument " "1"" of type '" "std::vector< std::string > const *""'"); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + result = ((std::vector< std::string > const *)arg1)->get_allocator(); + resultobj = SWIG_NewPointerObj((new std::vector< std::string >::allocator_type(static_cast< const std::vector< std::string >::allocator_type& >(result))), SWIGTYPE_p_std__allocatorT_std__string_t, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_StringVector__SWIG_2(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< std::string >::size_type arg1 ; + size_t val1 ; + int ecode1 = 0 ; + std::vector< std::string > *result = 0 ; + + if ((nobjs < 1) || (nobjs > 1)) SWIG_fail; + ecode1 = SWIG_AsVal_size_t(swig_obj[0], &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_StringVector" "', argument " "1"" of type '" "std::vector< std::string >::size_type""'"); + } + arg1 = static_cast< std::vector< std::string >::size_type >(val1); + result = (std::vector< std::string > *)new std::vector< std::string >(arg1); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, SWIG_POINTER_NEW | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_StringVector_pop_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_pop_back" "', argument " "1"" of type '" "std::vector< std::string > *""'"); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + (arg1)->pop_back(); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_StringVector_resize__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + std::vector< std::string >::size_type arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + size_t val2 ; + int ecode2 = 0 ; + + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_resize" "', argument " "1"" of type '" "std::vector< std::string > *""'"); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringVector_resize" "', argument " "2"" of type '" "std::vector< std::string >::size_type""'"); + } + arg2 = static_cast< std::vector< std::string >::size_type >(val2); + (arg1)->resize(arg2); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_StringVector_erase__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + std::vector< std::string >::iterator arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + swig::SwigPyIterator *iter2 = 0 ; + int res2 ; + std::vector< std::string >::iterator result; + + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_erase" "', argument " "1"" of type '" "std::vector< std::string > *""'"); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0); + if (!SWIG_IsOK(res2) || !iter2) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringVector_erase" "', argument " "2"" of type '" "std::vector< std::string >::iterator""'"); + } else { + swig::SwigPyIterator_T<std::vector< std::string >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< std::string >::iterator > *>(iter2); + if (iter_t) { + arg2 = iter_t->get_current(); + } else { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringVector_erase" "', argument " "2"" of type '" "std::vector< std::string >::iterator""'"); + } + } + result = std_vector_Sl_std_string_Sg__erase__SWIG_0(arg1,arg2); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< std::string >::iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_StringVector_erase__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + std::vector< std::string >::iterator arg2 ; + std::vector< std::string >::iterator arg3 ; + void *argp1 = 0 ; + int res1 = 0 ; + swig::SwigPyIterator *iter2 = 0 ; + int res2 ; + swig::SwigPyIterator *iter3 = 0 ; + int res3 ; + std::vector< std::string >::iterator result; + + if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_erase" "', argument " "1"" of type '" "std::vector< std::string > *""'"); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0); + if (!SWIG_IsOK(res2) || !iter2) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringVector_erase" "', argument " "2"" of type '" "std::vector< std::string >::iterator""'"); + } else { + swig::SwigPyIterator_T<std::vector< std::string >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< std::string >::iterator > *>(iter2); + if (iter_t) { + arg2 = iter_t->get_current(); + } else { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringVector_erase" "', argument " "2"" of type '" "std::vector< std::string >::iterator""'"); + } + } + res3 = SWIG_ConvertPtr(swig_obj[2], SWIG_as_voidptrptr(&iter3), swig::SwigPyIterator::descriptor(), 0); + if (!SWIG_IsOK(res3) || !iter3) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringVector_erase" "', argument " "3"" of type '" "std::vector< std::string >::iterator""'"); + } else { + swig::SwigPyIterator_T<std::vector< std::string >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< std::string >::iterator > *>(iter3); + if (iter_t) { + arg3 = iter_t->get_current(); + } else { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringVector_erase" "', argument " "3"" of type '" "std::vector< std::string >::iterator""'"); + } + } + result = std_vector_Sl_std_string_Sg__erase__SWIG_1(arg1,arg2,arg3); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< std::string >::iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_StringVector_erase(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[4] = { + 0 + }; + + if (!(argc = SWIG_Python_UnpackTuple(args, "StringVector_erase", 0, 3, argv))) SWIG_fail; + --argc; + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::vector< std::string,std::allocator< std::string > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + swig::SwigPyIterator *iter = 0; + int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); + _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< std::string >::iterator > *>(iter) != 0)); + if (_v) { + return _wrap_StringVector_erase__SWIG_0(self, argc, argv); + } + } + } + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::vector< std::string,std::allocator< std::string > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + swig::SwigPyIterator *iter = 0; + int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); + _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< std::string >::iterator > *>(iter) != 0)); + if (_v) { + swig::SwigPyIterator *iter = 0; + int res = SWIG_ConvertPtr(argv[2], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); + _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< std::string >::iterator > *>(iter) != 0)); + if (_v) { + return _wrap_StringVector_erase__SWIG_1(self, argc, argv); + } + } + } + } + +fail: + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'StringVector_erase'.\n" + " Possible C/C++ prototypes are:\n" + " std::vector< std::string >::erase(std::vector< std::string >::iterator)\n" + " std::vector< std::string >::erase(std::vector< std::string >::iterator,std::vector< std::string >::iterator)\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_new_StringVector__SWIG_3(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< std::string >::size_type arg1 ; + std::vector< std::string >::value_type *arg2 = 0 ; + size_t val1 ; + int ecode1 = 0 ; + int res2 = SWIG_OLDOBJ ; + std::vector< std::string > *result = 0 ; + + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + ecode1 = SWIG_AsVal_size_t(swig_obj[0], &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_StringVector" "', argument " "1"" of type '" "std::vector< std::string >::size_type""'"); + } + arg1 = static_cast< std::vector< std::string >::size_type >(val1); + { + std::string *ptr = (std::string *)0; + res2 = SWIG_AsPtr_std_string(swig_obj[1], &ptr); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_StringVector" "', argument " "2"" of type '" "std::vector< std::string >::value_type const &""'"); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_StringVector" "', argument " "2"" of type '" "std::vector< std::string >::value_type const &""'"); + } + arg2 = ptr; + } + result = (std::vector< std::string > *)new std::vector< std::string >(arg1,(std::vector< std::string >::value_type const &)*arg2); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, SWIG_POINTER_NEW | 0 ); + if (SWIG_IsNewObj(res2)) delete arg2; + return resultobj; +fail: + if (SWIG_IsNewObj(res2)) delete arg2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_StringVector(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[3] = { + 0 + }; + + if (!(argc = SWIG_Python_UnpackTuple(args, "new_StringVector", 0, 2, argv))) SWIG_fail; + --argc; + if (argc == 0) { + return _wrap_new_StringVector__SWIG_0(self, argc, argv); + } + if (argc == 1) { + int _v; + { + int res = SWIG_AsVal_size_t(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_new_StringVector__SWIG_2(self, argc, argv); + } + } + if (argc == 1) { + int _v; + int res = swig::asptr(argv[0], (std::vector< std::string,std::allocator< std::string > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_new_StringVector__SWIG_1(self, argc, argv); + } + } + if (argc == 2) { + int _v; + { + int res = SWIG_AsVal_size_t(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_new_StringVector__SWIG_3(self, argc, argv); + } + } + } + +fail: + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'new_StringVector'.\n" + " Possible C/C++ prototypes are:\n" + " std::vector< std::string >::vector()\n" + " std::vector< std::string >::vector(std::vector< std::string > const &)\n" + " std::vector< std::string >::vector(std::vector< std::string >::size_type)\n" + " std::vector< std::string >::vector(std::vector< std::string >::size_type,std::vector< std::string >::value_type const &)\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_StringVector_push_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + std::vector< std::string >::value_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 = SWIG_OLDOBJ ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "StringVector_push_back", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_push_back" "', argument " "1"" of type '" "std::vector< std::string > *""'"); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + { + std::string *ptr = (std::string *)0; + res2 = SWIG_AsPtr_std_string(swig_obj[1], &ptr); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "StringVector_push_back" "', argument " "2"" of type '" "std::vector< std::string >::value_type const &""'"); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringVector_push_back" "', argument " "2"" of type '" "std::vector< std::string >::value_type const &""'"); + } + arg2 = ptr; + } + (arg1)->push_back((std::vector< std::string >::value_type const &)*arg2); + resultobj = SWIG_Py_Void(); + if (SWIG_IsNewObj(res2)) delete arg2; + return resultobj; +fail: + if (SWIG_IsNewObj(res2)) delete arg2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_StringVector_front(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::vector< std::string >::value_type *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_front" "', argument " "1"" of type '" "std::vector< std::string > const *""'"); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + result = (std::vector< std::string >::value_type *) &((std::vector< std::string > const *)arg1)->front(); + resultobj = SWIG_From_std_string(static_cast< std::string >(*result)); + (void)swig::container_owner<swig::traits<std::vector< std::string >::value_type>::category>::back_reference(resultobj, swig_obj[0]); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_StringVector_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::vector< std::string >::value_type *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_back" "', argument " "1"" of type '" "std::vector< std::string > const *""'"); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + result = (std::vector< std::string >::value_type *) &((std::vector< std::string > const *)arg1)->back(); + resultobj = SWIG_From_std_string(static_cast< std::string >(*result)); + (void)swig::container_owner<swig::traits<std::vector< std::string >::value_type>::category>::back_reference(resultobj, swig_obj[0]); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_StringVector_assign(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + std::vector< std::string >::size_type arg2 ; + std::vector< std::string >::value_type *arg3 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + size_t val2 ; + int ecode2 = 0 ; + int res3 = SWIG_OLDOBJ ; + PyObject *swig_obj[3] ; + + if (!SWIG_Python_UnpackTuple(args, "StringVector_assign", 3, 3, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_assign" "', argument " "1"" of type '" "std::vector< std::string > *""'"); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringVector_assign" "', argument " "2"" of type '" "std::vector< std::string >::size_type""'"); + } + arg2 = static_cast< std::vector< std::string >::size_type >(val2); + { + std::string *ptr = (std::string *)0; + res3 = SWIG_AsPtr_std_string(swig_obj[2], &ptr); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "StringVector_assign" "', argument " "3"" of type '" "std::vector< std::string >::value_type const &""'"); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringVector_assign" "', argument " "3"" of type '" "std::vector< std::string >::value_type const &""'"); + } + arg3 = ptr; + } + (arg1)->assign(arg2,(std::vector< std::string >::value_type const &)*arg3); + resultobj = SWIG_Py_Void(); + if (SWIG_IsNewObj(res3)) delete arg3; + return resultobj; +fail: + if (SWIG_IsNewObj(res3)) delete arg3; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_StringVector_resize__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + std::vector< std::string >::size_type arg2 ; + std::vector< std::string >::value_type *arg3 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + size_t val2 ; + int ecode2 = 0 ; + int res3 = SWIG_OLDOBJ ; + + if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_resize" "', argument " "1"" of type '" "std::vector< std::string > *""'"); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringVector_resize" "', argument " "2"" of type '" "std::vector< std::string >::size_type""'"); + } + arg2 = static_cast< std::vector< std::string >::size_type >(val2); + { + std::string *ptr = (std::string *)0; + res3 = SWIG_AsPtr_std_string(swig_obj[2], &ptr); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "StringVector_resize" "', argument " "3"" of type '" "std::vector< std::string >::value_type const &""'"); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringVector_resize" "', argument " "3"" of type '" "std::vector< std::string >::value_type const &""'"); + } + arg3 = ptr; + } + (arg1)->resize(arg2,(std::vector< std::string >::value_type const &)*arg3); + resultobj = SWIG_Py_Void(); + if (SWIG_IsNewObj(res3)) delete arg3; + return resultobj; +fail: + if (SWIG_IsNewObj(res3)) delete arg3; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_StringVector_resize(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[4] = { + 0 + }; + + if (!(argc = SWIG_Python_UnpackTuple(args, "StringVector_resize", 0, 3, argv))) SWIG_fail; + --argc; + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::vector< std::string,std::allocator< std::string > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_size_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_StringVector_resize__SWIG_0(self, argc, argv); + } + } + } + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::vector< std::string,std::allocator< std::string > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_size_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + int res = SWIG_AsPtr_std_string(argv[2], (std::string**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_StringVector_resize__SWIG_1(self, argc, argv); + } + } + } + } + +fail: + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'StringVector_resize'.\n" + " Possible C/C++ prototypes are:\n" + " std::vector< std::string >::resize(std::vector< std::string >::size_type)\n" + " std::vector< std::string >::resize(std::vector< std::string >::size_type,std::vector< std::string >::value_type const &)\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_StringVector_insert__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + std::vector< std::string >::iterator arg2 ; + std::vector< std::string >::value_type *arg3 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + swig::SwigPyIterator *iter2 = 0 ; + int res2 ; + int res3 = SWIG_OLDOBJ ; + std::vector< std::string >::iterator result; + + if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_insert" "', argument " "1"" of type '" "std::vector< std::string > *""'"); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0); + if (!SWIG_IsOK(res2) || !iter2) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringVector_insert" "', argument " "2"" of type '" "std::vector< std::string >::iterator""'"); + } else { + swig::SwigPyIterator_T<std::vector< std::string >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< std::string >::iterator > *>(iter2); + if (iter_t) { + arg2 = iter_t->get_current(); + } else { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringVector_insert" "', argument " "2"" of type '" "std::vector< std::string >::iterator""'"); + } + } + { + std::string *ptr = (std::string *)0; + res3 = SWIG_AsPtr_std_string(swig_obj[2], &ptr); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "StringVector_insert" "', argument " "3"" of type '" "std::vector< std::string >::value_type const &""'"); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringVector_insert" "', argument " "3"" of type '" "std::vector< std::string >::value_type const &""'"); + } + arg3 = ptr; + } + result = std_vector_Sl_std_string_Sg__insert__SWIG_0(arg1,arg2,(std::string const &)*arg3); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< std::string >::iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + if (SWIG_IsNewObj(res3)) delete arg3; + return resultobj; +fail: + if (SWIG_IsNewObj(res3)) delete arg3; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_StringVector_insert__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + std::vector< std::string >::iterator arg2 ; + std::vector< std::string >::size_type arg3 ; + std::vector< std::string >::value_type *arg4 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + swig::SwigPyIterator *iter2 = 0 ; + int res2 ; + size_t val3 ; + int ecode3 = 0 ; + int res4 = SWIG_OLDOBJ ; + + if ((nobjs < 4) || (nobjs > 4)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_insert" "', argument " "1"" of type '" "std::vector< std::string > *""'"); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0); + if (!SWIG_IsOK(res2) || !iter2) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringVector_insert" "', argument " "2"" of type '" "std::vector< std::string >::iterator""'"); + } else { + swig::SwigPyIterator_T<std::vector< std::string >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< std::string >::iterator > *>(iter2); + if (iter_t) { + arg2 = iter_t->get_current(); + } else { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringVector_insert" "', argument " "2"" of type '" "std::vector< std::string >::iterator""'"); + } + } + ecode3 = SWIG_AsVal_size_t(swig_obj[2], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "StringVector_insert" "', argument " "3"" of type '" "std::vector< std::string >::size_type""'"); + } + arg3 = static_cast< std::vector< std::string >::size_type >(val3); + { + std::string *ptr = (std::string *)0; + res4 = SWIG_AsPtr_std_string(swig_obj[3], &ptr); + if (!SWIG_IsOK(res4)) { + SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "StringVector_insert" "', argument " "4"" of type '" "std::vector< std::string >::value_type const &""'"); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringVector_insert" "', argument " "4"" of type '" "std::vector< std::string >::value_type const &""'"); + } + arg4 = ptr; + } + std_vector_Sl_std_string_Sg__insert__SWIG_1(arg1,arg2,arg3,(std::string const &)*arg4); + resultobj = SWIG_Py_Void(); + if (SWIG_IsNewObj(res4)) delete arg4; + return resultobj; +fail: + if (SWIG_IsNewObj(res4)) delete arg4; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_StringVector_insert(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[5] = { + 0 + }; + + if (!(argc = SWIG_Python_UnpackTuple(args, "StringVector_insert", 0, 4, argv))) SWIG_fail; + --argc; + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::vector< std::string,std::allocator< std::string > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + swig::SwigPyIterator *iter = 0; + int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); + _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< std::string >::iterator > *>(iter) != 0)); + if (_v) { + int res = SWIG_AsPtr_std_string(argv[2], (std::string**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_StringVector_insert__SWIG_0(self, argc, argv); + } + } + } + } + if (argc == 4) { + int _v; + int res = swig::asptr(argv[0], (std::vector< std::string,std::allocator< std::string > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + swig::SwigPyIterator *iter = 0; + int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); + _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< std::string >::iterator > *>(iter) != 0)); + if (_v) { + { + int res = SWIG_AsVal_size_t(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + int res = SWIG_AsPtr_std_string(argv[3], (std::string**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_StringVector_insert__SWIG_1(self, argc, argv); + } + } + } + } + } + +fail: + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'StringVector_insert'.\n" + " Possible C/C++ prototypes are:\n" + " std::vector< std::string >::insert(std::vector< std::string >::iterator,std::vector< std::string >::value_type const &)\n" + " std::vector< std::string >::insert(std::vector< std::string >::iterator,std::vector< std::string >::size_type,std::vector< std::string >::value_type const &)\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_StringVector_reserve(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + std::vector< std::string >::size_type arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + size_t val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "StringVector_reserve", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_reserve" "', argument " "1"" of type '" "std::vector< std::string > *""'"); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringVector_reserve" "', argument " "2"" of type '" "std::vector< std::string >::size_type""'"); + } + arg2 = static_cast< std::vector< std::string >::size_type >(val2); + (arg1)->reserve(arg2); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_StringVector_capacity(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::vector< std::string >::size_type result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_capacity" "', argument " "1"" of type '" "std::vector< std::string > const *""'"); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + result = ((std::vector< std::string > const *)arg1)->capacity(); + resultobj = SWIG_From_size_t(static_cast< size_t >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_delete_StringVector(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_StringVector" "', argument " "1"" of type '" "std::vector< std::string > *""'"); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + delete arg1; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *StringVector_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *obj; + if (!SWIG_Python_UnpackTuple(args, "swigregister", 1, 1, &obj)) return NULL; + SWIG_TypeNewClientData(SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, SWIG_NewClientData(obj)); + return SWIG_Py_Void(); +} + +SWIGINTERN PyObject *StringVector_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + return SWIG_Python_InitShadowInstance(args); +} + +SWIGINTERN PyObject *_wrap_VarsVector_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + PyObject **arg2 = (PyObject **) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + swig::SwigPyIterator *result = 0 ; + + arg2 = &swig_obj[0]; + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_iterator" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + result = (swig::SwigPyIterator *)std_vector_Sl_CdiVariable_Sg__iterator(arg1,arg2); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsVector___nonzero__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + bool result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector___nonzero__" "', argument " "1"" of type '" "std::vector< CdiVariable > const *""'"); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + result = (bool)std_vector_Sl_CdiVariable_Sg____nonzero__((std::vector< CdiVariable > const *)arg1); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsVector___bool__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + bool result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector___bool__" "', argument " "1"" of type '" "std::vector< CdiVariable > const *""'"); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + result = (bool)std_vector_Sl_CdiVariable_Sg____bool__((std::vector< CdiVariable > const *)arg1); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsVector___len__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::vector< CdiVariable >::size_type result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector___len__" "', argument " "1"" of type '" "std::vector< CdiVariable > const *""'"); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + result = std_vector_Sl_CdiVariable_Sg____len__((std::vector< CdiVariable > const *)arg1); + resultobj = SWIG_From_size_t(static_cast< size_t >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsVector___getslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + std::vector< CdiVariable >::difference_type arg2 ; + std::vector< CdiVariable >::difference_type arg3 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + ptrdiff_t val3 ; + int ecode3 = 0 ; + PyObject *swig_obj[3] ; + std::vector< CdiVariable,std::allocator< CdiVariable > > *result = 0 ; + + if (!SWIG_Python_UnpackTuple(args, "VarsVector___getslice__", 3, 3, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector___getslice__" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsVector___getslice__" "', argument " "2"" of type '" "std::vector< CdiVariable >::difference_type""'"); + } + arg2 = static_cast< std::vector< CdiVariable >::difference_type >(val2); + ecode3 = SWIG_AsVal_ptrdiff_t(swig_obj[2], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VarsVector___getslice__" "', argument " "3"" of type '" "std::vector< CdiVariable >::difference_type""'"); + } + arg3 = static_cast< std::vector< CdiVariable >::difference_type >(val3); + try { + result = (std::vector< CdiVariable,std::allocator< CdiVariable > > *)std_vector_Sl_CdiVariable_Sg____getslice__(arg1,arg2,arg3); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsVector___setslice____SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + std::vector< CdiVariable >::difference_type arg2 ; + std::vector< CdiVariable >::difference_type arg3 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + ptrdiff_t val3 ; + int ecode3 = 0 ; + + if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector___setslice__" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsVector___setslice__" "', argument " "2"" of type '" "std::vector< CdiVariable >::difference_type""'"); + } + arg2 = static_cast< std::vector< CdiVariable >::difference_type >(val2); + ecode3 = SWIG_AsVal_ptrdiff_t(swig_obj[2], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VarsVector___setslice__" "', argument " "3"" of type '" "std::vector< CdiVariable >::difference_type""'"); + } + arg3 = static_cast< std::vector< CdiVariable >::difference_type >(val3); + try { + std_vector_Sl_CdiVariable_Sg____setslice____SWIG_0(arg1,arg2,arg3); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsVector___setslice____SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + std::vector< CdiVariable >::difference_type arg2 ; + std::vector< CdiVariable >::difference_type arg3 ; + std::vector< CdiVariable,std::allocator< CdiVariable > > *arg4 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + ptrdiff_t val3 ; + int ecode3 = 0 ; + int res4 = SWIG_OLDOBJ ; + + if ((nobjs < 4) || (nobjs > 4)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector___setslice__" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsVector___setslice__" "', argument " "2"" of type '" "std::vector< CdiVariable >::difference_type""'"); + } + arg2 = static_cast< std::vector< CdiVariable >::difference_type >(val2); + ecode3 = SWIG_AsVal_ptrdiff_t(swig_obj[2], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VarsVector___setslice__" "', argument " "3"" of type '" "std::vector< CdiVariable >::difference_type""'"); + } + arg3 = static_cast< std::vector< CdiVariable >::difference_type >(val3); + { + std::vector< CdiVariable,std::allocator< CdiVariable > > *ptr = (std::vector< CdiVariable,std::allocator< CdiVariable > > *)0; + res4 = swig::asptr(swig_obj[3], &ptr); + if (!SWIG_IsOK(res4)) { + SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "VarsVector___setslice__" "', argument " "4"" of type '" "std::vector< CdiVariable,std::allocator< CdiVariable > > const &""'"); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsVector___setslice__" "', argument " "4"" of type '" "std::vector< CdiVariable,std::allocator< CdiVariable > > const &""'"); + } + arg4 = ptr; + } + try { + std_vector_Sl_CdiVariable_Sg____setslice____SWIG_1(arg1,arg2,arg3,(std::vector< CdiVariable,std::allocator< CdiVariable > > const &)*arg4); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } + resultobj = SWIG_Py_Void(); + if (SWIG_IsNewObj(res4)) delete arg4; + return resultobj; +fail: + if (SWIG_IsNewObj(res4)) delete arg4; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsVector___setslice__(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[5] = { + 0 + }; + + if (!(argc = SWIG_Python_UnpackTuple(args, "VarsVector___setslice__", 0, 4, argv))) SWIG_fail; + --argc; + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::vector< CdiVariable,std::allocator< CdiVariable > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_VarsVector___setslice____SWIG_0(self, argc, argv); + } + } + } + } + if (argc == 4) { + int _v; + int res = swig::asptr(argv[0], (std::vector< CdiVariable,std::allocator< CdiVariable > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + int res = swig::asptr(argv[3], (std::vector< CdiVariable,std::allocator< CdiVariable > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_VarsVector___setslice____SWIG_1(self, argc, argv); + } + } + } + } + } + +fail: + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'VarsVector___setslice__'.\n" + " Possible C/C++ prototypes are:\n" + " std::vector< CdiVariable >::__setslice__(std::vector< CdiVariable >::difference_type,std::vector< CdiVariable >::difference_type)\n" + " std::vector< CdiVariable >::__setslice__(std::vector< CdiVariable >::difference_type,std::vector< CdiVariable >::difference_type,std::vector< CdiVariable,std::allocator< CdiVariable > > const &)\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_VarsVector___delslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + std::vector< CdiVariable >::difference_type arg2 ; + std::vector< CdiVariable >::difference_type arg3 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + ptrdiff_t val3 ; + int ecode3 = 0 ; + PyObject *swig_obj[3] ; + + if (!SWIG_Python_UnpackTuple(args, "VarsVector___delslice__", 3, 3, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector___delslice__" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsVector___delslice__" "', argument " "2"" of type '" "std::vector< CdiVariable >::difference_type""'"); + } + arg2 = static_cast< std::vector< CdiVariable >::difference_type >(val2); + ecode3 = SWIG_AsVal_ptrdiff_t(swig_obj[2], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VarsVector___delslice__" "', argument " "3"" of type '" "std::vector< CdiVariable >::difference_type""'"); + } + arg3 = static_cast< std::vector< CdiVariable >::difference_type >(val3); + try { + std_vector_Sl_CdiVariable_Sg____delslice__(arg1,arg2,arg3); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsVector___delitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + std::vector< CdiVariable >::difference_type arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector___delitem__" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsVector___delitem__" "', argument " "2"" of type '" "std::vector< CdiVariable >::difference_type""'"); + } + arg2 = static_cast< std::vector< CdiVariable >::difference_type >(val2); + try { + std_vector_Sl_CdiVariable_Sg____delitem____SWIG_0(arg1,arg2); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsVector___getitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + PySliceObject *arg2 = (PySliceObject *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< CdiVariable,std::allocator< CdiVariable > > *result = 0 ; + + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector___getitem__" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + { + if (!PySlice_Check(swig_obj[1])) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsVector___getitem__" "', argument " "2"" of type '" "PySliceObject *""'"); + } + arg2 = (PySliceObject *) swig_obj[1]; + } + try { + result = (std::vector< CdiVariable,std::allocator< CdiVariable > > *)std_vector_Sl_CdiVariable_Sg____getitem____SWIG_0(arg1,arg2); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsVector___setitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + PySliceObject *arg2 = (PySliceObject *) 0 ; + std::vector< CdiVariable,std::allocator< CdiVariable > > *arg3 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res3 = SWIG_OLDOBJ ; + + if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector___setitem__" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + { + if (!PySlice_Check(swig_obj[1])) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsVector___setitem__" "', argument " "2"" of type '" "PySliceObject *""'"); + } + arg2 = (PySliceObject *) swig_obj[1]; + } + { + std::vector< CdiVariable,std::allocator< CdiVariable > > *ptr = (std::vector< CdiVariable,std::allocator< CdiVariable > > *)0; + res3 = swig::asptr(swig_obj[2], &ptr); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "VarsVector___setitem__" "', argument " "3"" of type '" "std::vector< CdiVariable,std::allocator< CdiVariable > > const &""'"); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsVector___setitem__" "', argument " "3"" of type '" "std::vector< CdiVariable,std::allocator< CdiVariable > > const &""'"); + } + arg3 = ptr; + } + try { + std_vector_Sl_CdiVariable_Sg____setitem____SWIG_0(arg1,arg2,(std::vector< CdiVariable,std::allocator< CdiVariable > > const &)*arg3); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } + resultobj = SWIG_Py_Void(); + if (SWIG_IsNewObj(res3)) delete arg3; + return resultobj; +fail: + if (SWIG_IsNewObj(res3)) delete arg3; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsVector___setitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + PySliceObject *arg2 = (PySliceObject *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector___setitem__" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + { + if (!PySlice_Check(swig_obj[1])) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsVector___setitem__" "', argument " "2"" of type '" "PySliceObject *""'"); + } + arg2 = (PySliceObject *) swig_obj[1]; + } + try { + std_vector_Sl_CdiVariable_Sg____setitem____SWIG_1(arg1,arg2); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsVector___delitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + PySliceObject *arg2 = (PySliceObject *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector___delitem__" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + { + if (!PySlice_Check(swig_obj[1])) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsVector___delitem__" "', argument " "2"" of type '" "PySliceObject *""'"); + } + arg2 = (PySliceObject *) swig_obj[1]; + } + try { + std_vector_Sl_CdiVariable_Sg____delitem____SWIG_1(arg1,arg2); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsVector___delitem__(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[3] = { + 0 + }; + + if (!(argc = SWIG_Python_UnpackTuple(args, "VarsVector___delitem__", 0, 2, argv))) SWIG_fail; + --argc; + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::vector< CdiVariable,std::allocator< CdiVariable > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + _v = PySlice_Check(argv[1]); + } + if (_v) { + return _wrap_VarsVector___delitem____SWIG_1(self, argc, argv); + } + } + } + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::vector< CdiVariable,std::allocator< CdiVariable > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_VarsVector___delitem____SWIG_0(self, argc, argv); + } + } + } + +fail: + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'VarsVector___delitem__'.\n" + " Possible C/C++ prototypes are:\n" + " std::vector< CdiVariable >::__delitem__(std::vector< CdiVariable >::difference_type)\n" + " std::vector< CdiVariable >::__delitem__(PySliceObject *)\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_VarsVector___getitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + std::vector< CdiVariable >::difference_type arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + std::vector< CdiVariable >::value_type *result = 0 ; + + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector___getitem__" "', argument " "1"" of type '" "std::vector< CdiVariable > const *""'"); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsVector___getitem__" "', argument " "2"" of type '" "std::vector< CdiVariable >::difference_type""'"); + } + arg2 = static_cast< std::vector< CdiVariable >::difference_type >(val2); + try { + result = (std::vector< CdiVariable >::value_type *) &std_vector_Sl_CdiVariable_Sg____getitem____SWIG_1((std::vector< CdiVariable > const *)arg1,arg2); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CdiVariable, 0 | 0 ); + (void)swig::container_owner<swig::traits<std::vector< CdiVariable >::value_type>::category>::back_reference(resultobj, swig_obj[0]); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsVector___getitem__(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[3] = { + 0 + }; + + if (!(argc = SWIG_Python_UnpackTuple(args, "VarsVector___getitem__", 0, 2, argv))) SWIG_fail; + --argc; + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::vector< CdiVariable,std::allocator< CdiVariable > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + _v = PySlice_Check(argv[1]); + } + if (_v) { + return _wrap_VarsVector___getitem____SWIG_0(self, argc, argv); + } + } + } + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::vector< CdiVariable,std::allocator< CdiVariable > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_VarsVector___getitem____SWIG_1(self, argc, argv); + } + } + } + +fail: + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'VarsVector___getitem__'.\n" + " Possible C/C++ prototypes are:\n" + " std::vector< CdiVariable >::__getitem__(PySliceObject *)\n" + " std::vector< CdiVariable >::__getitem__(std::vector< CdiVariable >::difference_type) const\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_VarsVector___setitem____SWIG_2(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + std::vector< CdiVariable >::difference_type arg2 ; + std::vector< CdiVariable >::value_type *arg3 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + void *argp3 = 0 ; + int res3 = 0 ; + + if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector___setitem__" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsVector___setitem__" "', argument " "2"" of type '" "std::vector< CdiVariable >::difference_type""'"); + } + arg2 = static_cast< std::vector< CdiVariable >::difference_type >(val2); + res3 = SWIG_ConvertPtr(swig_obj[2], &argp3, SWIGTYPE_p_CdiVariable, 0 | 0); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "VarsVector___setitem__" "', argument " "3"" of type '" "std::vector< CdiVariable >::value_type const &""'"); + } + if (!argp3) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsVector___setitem__" "', argument " "3"" of type '" "std::vector< CdiVariable >::value_type const &""'"); + } + arg3 = reinterpret_cast< std::vector< CdiVariable >::value_type * >(argp3); + try { + std_vector_Sl_CdiVariable_Sg____setitem____SWIG_2(arg1,arg2,(CdiVariable const &)*arg3); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsVector___setitem__(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[4] = { + 0 + }; + + if (!(argc = SWIG_Python_UnpackTuple(args, "VarsVector___setitem__", 0, 3, argv))) SWIG_fail; + --argc; + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::vector< CdiVariable,std::allocator< CdiVariable > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + _v = PySlice_Check(argv[1]); + } + if (_v) { + return _wrap_VarsVector___setitem____SWIG_1(self, argc, argv); + } + } + } + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::vector< CdiVariable,std::allocator< CdiVariable > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + _v = PySlice_Check(argv[1]); + } + if (_v) { + int res = swig::asptr(argv[2], (std::vector< CdiVariable,std::allocator< CdiVariable > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_VarsVector___setitem____SWIG_0(self, argc, argv); + } + } + } + } + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::vector< CdiVariable,std::allocator< CdiVariable > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + int res = SWIG_ConvertPtr(argv[2], 0, SWIGTYPE_p_CdiVariable, SWIG_POINTER_NO_NULL | 0); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_VarsVector___setitem____SWIG_2(self, argc, argv); + } + } + } + } + +fail: + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'VarsVector___setitem__'.\n" + " Possible C/C++ prototypes are:\n" + " std::vector< CdiVariable >::__setitem__(PySliceObject *,std::vector< CdiVariable,std::allocator< CdiVariable > > const &)\n" + " std::vector< CdiVariable >::__setitem__(PySliceObject *)\n" + " std::vector< CdiVariable >::__setitem__(std::vector< CdiVariable >::difference_type,std::vector< CdiVariable >::value_type const &)\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_VarsVector_pop(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::vector< CdiVariable >::value_type result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_pop" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + try { + result = std_vector_Sl_CdiVariable_Sg__pop(arg1); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } + resultobj = SWIG_NewPointerObj((new std::vector< CdiVariable >::value_type(static_cast< const std::vector< CdiVariable >::value_type& >(result))), SWIGTYPE_p_CdiVariable, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsVector_append(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + std::vector< CdiVariable >::value_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "VarsVector_append", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_append" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_CdiVariable, 0 | 0); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VarsVector_append" "', argument " "2"" of type '" "std::vector< CdiVariable >::value_type const &""'"); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsVector_append" "', argument " "2"" of type '" "std::vector< CdiVariable >::value_type const &""'"); + } + arg2 = reinterpret_cast< std::vector< CdiVariable >::value_type * >(argp2); + std_vector_Sl_CdiVariable_Sg__append(arg1,(CdiVariable const &)*arg2); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_VarsVector__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) { + PyObject *resultobj = 0; + std::vector< CdiVariable > *result = 0 ; + + if ((nobjs < 0) || (nobjs > 0)) SWIG_fail; + result = (std::vector< CdiVariable > *)new std::vector< CdiVariable >(); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, SWIG_POINTER_NEW | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_VarsVector__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< CdiVariable > *arg1 = 0 ; + int res1 = SWIG_OLDOBJ ; + std::vector< CdiVariable > *result = 0 ; + + if ((nobjs < 1) || (nobjs > 1)) SWIG_fail; + { + std::vector< CdiVariable,std::allocator< CdiVariable > > *ptr = (std::vector< CdiVariable,std::allocator< CdiVariable > > *)0; + res1 = swig::asptr(swig_obj[0], &ptr); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_VarsVector" "', argument " "1"" of type '" "std::vector< CdiVariable > const &""'"); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_VarsVector" "', argument " "1"" of type '" "std::vector< CdiVariable > const &""'"); + } + arg1 = ptr; + } + result = (std::vector< CdiVariable > *)new std::vector< CdiVariable >((std::vector< CdiVariable > const &)*arg1); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, SWIG_POINTER_NEW | 0 ); + if (SWIG_IsNewObj(res1)) delete arg1; + return resultobj; +fail: + if (SWIG_IsNewObj(res1)) delete arg1; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsVector_empty(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + bool result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_empty" "', argument " "1"" of type '" "std::vector< CdiVariable > const *""'"); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + result = (bool)((std::vector< CdiVariable > const *)arg1)->empty(); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsVector_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::vector< CdiVariable >::size_type result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_size" "', argument " "1"" of type '" "std::vector< CdiVariable > const *""'"); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + result = ((std::vector< CdiVariable > const *)arg1)->size(); + resultobj = SWIG_From_size_t(static_cast< size_t >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsVector_swap(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + std::vector< CdiVariable > *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "VarsVector_swap", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_swap" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VarsVector_swap" "', argument " "2"" of type '" "std::vector< CdiVariable > &""'"); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsVector_swap" "', argument " "2"" of type '" "std::vector< CdiVariable > &""'"); + } + arg2 = reinterpret_cast< std::vector< CdiVariable > * >(argp2); + (arg1)->swap(*arg2); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsVector_begin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::vector< CdiVariable >::iterator result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_begin" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + result = (arg1)->begin(); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< CdiVariable >::iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsVector_end(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::vector< CdiVariable >::iterator result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_end" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + result = (arg1)->end(); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< CdiVariable >::iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsVector_rbegin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::vector< CdiVariable >::reverse_iterator result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_rbegin" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + result = (arg1)->rbegin(); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< CdiVariable >::reverse_iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsVector_rend(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::vector< CdiVariable >::reverse_iterator result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_rend" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + result = (arg1)->rend(); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< CdiVariable >::reverse_iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsVector_clear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_clear" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + (arg1)->clear(); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsVector_get_allocator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + SwigValueWrapper< std::allocator< CdiVariable > > result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_get_allocator" "', argument " "1"" of type '" "std::vector< CdiVariable > const *""'"); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + result = ((std::vector< CdiVariable > const *)arg1)->get_allocator(); + resultobj = SWIG_NewPointerObj((new std::vector< CdiVariable >::allocator_type(static_cast< const std::vector< CdiVariable >::allocator_type& >(result))), SWIGTYPE_p_std__allocatorT_CdiVariable_t, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_VarsVector__SWIG_2(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< CdiVariable >::size_type arg1 ; + size_t val1 ; + int ecode1 = 0 ; + std::vector< CdiVariable > *result = 0 ; + + if ((nobjs < 1) || (nobjs > 1)) SWIG_fail; + ecode1 = SWIG_AsVal_size_t(swig_obj[0], &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_VarsVector" "', argument " "1"" of type '" "std::vector< CdiVariable >::size_type""'"); + } + arg1 = static_cast< std::vector< CdiVariable >::size_type >(val1); + result = (std::vector< CdiVariable > *)new std::vector< CdiVariable >(arg1); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, SWIG_POINTER_NEW | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsVector_pop_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_pop_back" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + (arg1)->pop_back(); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsVector_resize__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + std::vector< CdiVariable >::size_type arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + size_t val2 ; + int ecode2 = 0 ; + + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_resize" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsVector_resize" "', argument " "2"" of type '" "std::vector< CdiVariable >::size_type""'"); + } + arg2 = static_cast< std::vector< CdiVariable >::size_type >(val2); + (arg1)->resize(arg2); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsVector_erase__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + std::vector< CdiVariable >::iterator arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + swig::SwigPyIterator *iter2 = 0 ; + int res2 ; + std::vector< CdiVariable >::iterator result; + + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_erase" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0); + if (!SWIG_IsOK(res2) || !iter2) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsVector_erase" "', argument " "2"" of type '" "std::vector< CdiVariable >::iterator""'"); + } else { + swig::SwigPyIterator_T<std::vector< CdiVariable >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< CdiVariable >::iterator > *>(iter2); + if (iter_t) { + arg2 = iter_t->get_current(); + } else { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsVector_erase" "', argument " "2"" of type '" "std::vector< CdiVariable >::iterator""'"); + } + } + result = std_vector_Sl_CdiVariable_Sg__erase__SWIG_0(arg1,arg2); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< CdiVariable >::iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsVector_erase__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + std::vector< CdiVariable >::iterator arg2 ; + std::vector< CdiVariable >::iterator arg3 ; + void *argp1 = 0 ; + int res1 = 0 ; + swig::SwigPyIterator *iter2 = 0 ; + int res2 ; + swig::SwigPyIterator *iter3 = 0 ; + int res3 ; + std::vector< CdiVariable >::iterator result; + + if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_erase" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0); + if (!SWIG_IsOK(res2) || !iter2) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsVector_erase" "', argument " "2"" of type '" "std::vector< CdiVariable >::iterator""'"); + } else { + swig::SwigPyIterator_T<std::vector< CdiVariable >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< CdiVariable >::iterator > *>(iter2); + if (iter_t) { + arg2 = iter_t->get_current(); + } else { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsVector_erase" "', argument " "2"" of type '" "std::vector< CdiVariable >::iterator""'"); + } + } + res3 = SWIG_ConvertPtr(swig_obj[2], SWIG_as_voidptrptr(&iter3), swig::SwigPyIterator::descriptor(), 0); + if (!SWIG_IsOK(res3) || !iter3) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsVector_erase" "', argument " "3"" of type '" "std::vector< CdiVariable >::iterator""'"); + } else { + swig::SwigPyIterator_T<std::vector< CdiVariable >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< CdiVariable >::iterator > *>(iter3); + if (iter_t) { + arg3 = iter_t->get_current(); + } else { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsVector_erase" "', argument " "3"" of type '" "std::vector< CdiVariable >::iterator""'"); + } + } + result = std_vector_Sl_CdiVariable_Sg__erase__SWIG_1(arg1,arg2,arg3); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< CdiVariable >::iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsVector_erase(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[4] = { + 0 + }; + + if (!(argc = SWIG_Python_UnpackTuple(args, "VarsVector_erase", 0, 3, argv))) SWIG_fail; + --argc; + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::vector< CdiVariable,std::allocator< CdiVariable > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + swig::SwigPyIterator *iter = 0; + int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); + _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< CdiVariable >::iterator > *>(iter) != 0)); + if (_v) { + return _wrap_VarsVector_erase__SWIG_0(self, argc, argv); + } + } + } + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::vector< CdiVariable,std::allocator< CdiVariable > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + swig::SwigPyIterator *iter = 0; + int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); + _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< CdiVariable >::iterator > *>(iter) != 0)); + if (_v) { + swig::SwigPyIterator *iter = 0; + int res = SWIG_ConvertPtr(argv[2], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); + _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< CdiVariable >::iterator > *>(iter) != 0)); + if (_v) { + return _wrap_VarsVector_erase__SWIG_1(self, argc, argv); + } + } + } + } + +fail: + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'VarsVector_erase'.\n" + " Possible C/C++ prototypes are:\n" + " std::vector< CdiVariable >::erase(std::vector< CdiVariable >::iterator)\n" + " std::vector< CdiVariable >::erase(std::vector< CdiVariable >::iterator,std::vector< CdiVariable >::iterator)\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_new_VarsVector__SWIG_3(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< CdiVariable >::size_type arg1 ; + std::vector< CdiVariable >::value_type *arg2 = 0 ; + size_t val1 ; + int ecode1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + std::vector< CdiVariable > *result = 0 ; + + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + ecode1 = SWIG_AsVal_size_t(swig_obj[0], &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_VarsVector" "', argument " "1"" of type '" "std::vector< CdiVariable >::size_type""'"); + } + arg1 = static_cast< std::vector< CdiVariable >::size_type >(val1); + res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_CdiVariable, 0 | 0); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_VarsVector" "', argument " "2"" of type '" "std::vector< CdiVariable >::value_type const &""'"); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_VarsVector" "', argument " "2"" of type '" "std::vector< CdiVariable >::value_type const &""'"); + } + arg2 = reinterpret_cast< std::vector< CdiVariable >::value_type * >(argp2); + result = (std::vector< CdiVariable > *)new std::vector< CdiVariable >(arg1,(std::vector< CdiVariable >::value_type const &)*arg2); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, SWIG_POINTER_NEW | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_VarsVector(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[3] = { + 0 + }; + + if (!(argc = SWIG_Python_UnpackTuple(args, "new_VarsVector", 0, 2, argv))) SWIG_fail; + --argc; + if (argc == 0) { + return _wrap_new_VarsVector__SWIG_0(self, argc, argv); + } + if (argc == 1) { + int _v; + { + int res = SWIG_AsVal_size_t(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_new_VarsVector__SWIG_2(self, argc, argv); + } + } + if (argc == 1) { + int _v; + int res = swig::asptr(argv[0], (std::vector< CdiVariable,std::allocator< CdiVariable > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_new_VarsVector__SWIG_1(self, argc, argv); + } + } + if (argc == 2) { + int _v; + { + int res = SWIG_AsVal_size_t(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_CdiVariable, SWIG_POINTER_NO_NULL | 0); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_new_VarsVector__SWIG_3(self, argc, argv); + } + } + } + +fail: + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'new_VarsVector'.\n" + " Possible C/C++ prototypes are:\n" + " std::vector< CdiVariable >::vector()\n" + " std::vector< CdiVariable >::vector(std::vector< CdiVariable > const &)\n" + " std::vector< CdiVariable >::vector(std::vector< CdiVariable >::size_type)\n" + " std::vector< CdiVariable >::vector(std::vector< CdiVariable >::size_type,std::vector< CdiVariable >::value_type const &)\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_VarsVector_push_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + std::vector< CdiVariable >::value_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "VarsVector_push_back", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_push_back" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_CdiVariable, 0 | 0); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VarsVector_push_back" "', argument " "2"" of type '" "std::vector< CdiVariable >::value_type const &""'"); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsVector_push_back" "', argument " "2"" of type '" "std::vector< CdiVariable >::value_type const &""'"); + } + arg2 = reinterpret_cast< std::vector< CdiVariable >::value_type * >(argp2); + (arg1)->push_back((std::vector< CdiVariable >::value_type const &)*arg2); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsVector_front(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::vector< CdiVariable >::value_type *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_front" "', argument " "1"" of type '" "std::vector< CdiVariable > const *""'"); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + result = (std::vector< CdiVariable >::value_type *) &((std::vector< CdiVariable > const *)arg1)->front(); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CdiVariable, 0 | 0 ); + (void)swig::container_owner<swig::traits<std::vector< CdiVariable >::value_type>::category>::back_reference(resultobj, swig_obj[0]); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsVector_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::vector< CdiVariable >::value_type *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_back" "', argument " "1"" of type '" "std::vector< CdiVariable > const *""'"); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + result = (std::vector< CdiVariable >::value_type *) &((std::vector< CdiVariable > const *)arg1)->back(); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CdiVariable, 0 | 0 ); + (void)swig::container_owner<swig::traits<std::vector< CdiVariable >::value_type>::category>::back_reference(resultobj, swig_obj[0]); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsVector_assign(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + std::vector< CdiVariable >::size_type arg2 ; + std::vector< CdiVariable >::value_type *arg3 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + size_t val2 ; + int ecode2 = 0 ; + void *argp3 = 0 ; + int res3 = 0 ; + PyObject *swig_obj[3] ; + + if (!SWIG_Python_UnpackTuple(args, "VarsVector_assign", 3, 3, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_assign" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsVector_assign" "', argument " "2"" of type '" "std::vector< CdiVariable >::size_type""'"); + } + arg2 = static_cast< std::vector< CdiVariable >::size_type >(val2); + res3 = SWIG_ConvertPtr(swig_obj[2], &argp3, SWIGTYPE_p_CdiVariable, 0 | 0); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "VarsVector_assign" "', argument " "3"" of type '" "std::vector< CdiVariable >::value_type const &""'"); + } + if (!argp3) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsVector_assign" "', argument " "3"" of type '" "std::vector< CdiVariable >::value_type const &""'"); + } + arg3 = reinterpret_cast< std::vector< CdiVariable >::value_type * >(argp3); + (arg1)->assign(arg2,(std::vector< CdiVariable >::value_type const &)*arg3); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsVector_resize__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + std::vector< CdiVariable >::size_type arg2 ; + std::vector< CdiVariable >::value_type *arg3 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + size_t val2 ; + int ecode2 = 0 ; + void *argp3 = 0 ; + int res3 = 0 ; + + if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_resize" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsVector_resize" "', argument " "2"" of type '" "std::vector< CdiVariable >::size_type""'"); + } + arg2 = static_cast< std::vector< CdiVariable >::size_type >(val2); + res3 = SWIG_ConvertPtr(swig_obj[2], &argp3, SWIGTYPE_p_CdiVariable, 0 | 0); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "VarsVector_resize" "', argument " "3"" of type '" "std::vector< CdiVariable >::value_type const &""'"); + } + if (!argp3) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsVector_resize" "', argument " "3"" of type '" "std::vector< CdiVariable >::value_type const &""'"); + } + arg3 = reinterpret_cast< std::vector< CdiVariable >::value_type * >(argp3); + (arg1)->resize(arg2,(std::vector< CdiVariable >::value_type const &)*arg3); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsVector_resize(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[4] = { + 0 + }; + + if (!(argc = SWIG_Python_UnpackTuple(args, "VarsVector_resize", 0, 3, argv))) SWIG_fail; + --argc; + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::vector< CdiVariable,std::allocator< CdiVariable > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_size_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_VarsVector_resize__SWIG_0(self, argc, argv); + } + } + } + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::vector< CdiVariable,std::allocator< CdiVariable > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_size_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + int res = SWIG_ConvertPtr(argv[2], 0, SWIGTYPE_p_CdiVariable, SWIG_POINTER_NO_NULL | 0); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_VarsVector_resize__SWIG_1(self, argc, argv); + } + } + } + } + +fail: + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'VarsVector_resize'.\n" + " Possible C/C++ prototypes are:\n" + " std::vector< CdiVariable >::resize(std::vector< CdiVariable >::size_type)\n" + " std::vector< CdiVariable >::resize(std::vector< CdiVariable >::size_type,std::vector< CdiVariable >::value_type const &)\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_VarsVector_insert__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + std::vector< CdiVariable >::iterator arg2 ; + std::vector< CdiVariable >::value_type *arg3 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + swig::SwigPyIterator *iter2 = 0 ; + int res2 ; + void *argp3 = 0 ; + int res3 = 0 ; + std::vector< CdiVariable >::iterator result; + + if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_insert" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0); + if (!SWIG_IsOK(res2) || !iter2) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsVector_insert" "', argument " "2"" of type '" "std::vector< CdiVariable >::iterator""'"); + } else { + swig::SwigPyIterator_T<std::vector< CdiVariable >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< CdiVariable >::iterator > *>(iter2); + if (iter_t) { + arg2 = iter_t->get_current(); + } else { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsVector_insert" "', argument " "2"" of type '" "std::vector< CdiVariable >::iterator""'"); + } + } + res3 = SWIG_ConvertPtr(swig_obj[2], &argp3, SWIGTYPE_p_CdiVariable, 0 | 0); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "VarsVector_insert" "', argument " "3"" of type '" "std::vector< CdiVariable >::value_type const &""'"); + } + if (!argp3) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsVector_insert" "', argument " "3"" of type '" "std::vector< CdiVariable >::value_type const &""'"); + } + arg3 = reinterpret_cast< std::vector< CdiVariable >::value_type * >(argp3); + result = std_vector_Sl_CdiVariable_Sg__insert__SWIG_0(arg1,arg2,(CdiVariable const &)*arg3); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< CdiVariable >::iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsVector_insert__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + std::vector< CdiVariable >::iterator arg2 ; + std::vector< CdiVariable >::size_type arg3 ; + std::vector< CdiVariable >::value_type *arg4 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + swig::SwigPyIterator *iter2 = 0 ; + int res2 ; + size_t val3 ; + int ecode3 = 0 ; + void *argp4 = 0 ; + int res4 = 0 ; + + if ((nobjs < 4) || (nobjs > 4)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_insert" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0); + if (!SWIG_IsOK(res2) || !iter2) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsVector_insert" "', argument " "2"" of type '" "std::vector< CdiVariable >::iterator""'"); + } else { + swig::SwigPyIterator_T<std::vector< CdiVariable >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< CdiVariable >::iterator > *>(iter2); + if (iter_t) { + arg2 = iter_t->get_current(); + } else { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsVector_insert" "', argument " "2"" of type '" "std::vector< CdiVariable >::iterator""'"); + } + } + ecode3 = SWIG_AsVal_size_t(swig_obj[2], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VarsVector_insert" "', argument " "3"" of type '" "std::vector< CdiVariable >::size_type""'"); + } + arg3 = static_cast< std::vector< CdiVariable >::size_type >(val3); + res4 = SWIG_ConvertPtr(swig_obj[3], &argp4, SWIGTYPE_p_CdiVariable, 0 | 0); + if (!SWIG_IsOK(res4)) { + SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "VarsVector_insert" "', argument " "4"" of type '" "std::vector< CdiVariable >::value_type const &""'"); + } + if (!argp4) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsVector_insert" "', argument " "4"" of type '" "std::vector< CdiVariable >::value_type const &""'"); + } + arg4 = reinterpret_cast< std::vector< CdiVariable >::value_type * >(argp4); + std_vector_Sl_CdiVariable_Sg__insert__SWIG_1(arg1,arg2,arg3,(CdiVariable const &)*arg4); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsVector_insert(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[5] = { + 0 + }; + + if (!(argc = SWIG_Python_UnpackTuple(args, "VarsVector_insert", 0, 4, argv))) SWIG_fail; + --argc; + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::vector< CdiVariable,std::allocator< CdiVariable > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + swig::SwigPyIterator *iter = 0; + int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); + _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< CdiVariable >::iterator > *>(iter) != 0)); + if (_v) { + int res = SWIG_ConvertPtr(argv[2], 0, SWIGTYPE_p_CdiVariable, SWIG_POINTER_NO_NULL | 0); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_VarsVector_insert__SWIG_0(self, argc, argv); + } + } + } + } + if (argc == 4) { + int _v; + int res = swig::asptr(argv[0], (std::vector< CdiVariable,std::allocator< CdiVariable > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + swig::SwigPyIterator *iter = 0; + int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); + _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< CdiVariable >::iterator > *>(iter) != 0)); + if (_v) { + { + int res = SWIG_AsVal_size_t(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + int res = SWIG_ConvertPtr(argv[3], 0, SWIGTYPE_p_CdiVariable, SWIG_POINTER_NO_NULL | 0); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_VarsVector_insert__SWIG_1(self, argc, argv); + } + } + } + } + } + +fail: + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'VarsVector_insert'.\n" + " Possible C/C++ prototypes are:\n" + " std::vector< CdiVariable >::insert(std::vector< CdiVariable >::iterator,std::vector< CdiVariable >::value_type const &)\n" + " std::vector< CdiVariable >::insert(std::vector< CdiVariable >::iterator,std::vector< CdiVariable >::size_type,std::vector< CdiVariable >::value_type const &)\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_VarsVector_reserve(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + std::vector< CdiVariable >::size_type arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + size_t val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "VarsVector_reserve", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_reserve" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsVector_reserve" "', argument " "2"" of type '" "std::vector< CdiVariable >::size_type""'"); + } + arg2 = static_cast< std::vector< CdiVariable >::size_type >(val2); + (arg1)->reserve(arg2); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsVector_capacity(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::vector< CdiVariable >::size_type result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_capacity" "', argument " "1"" of type '" "std::vector< CdiVariable > const *""'"); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + result = ((std::vector< CdiVariable > const *)arg1)->capacity(); + resultobj = SWIG_From_size_t(static_cast< size_t >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_delete_VarsVector(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_VarsVector" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + delete arg1; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *VarsVector_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *obj; + if (!SWIG_Python_UnpackTuple(args, "swigregister", 1, 1, &obj)) return NULL; + SWIG_TypeNewClientData(SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, SWIG_NewClientData(obj)); + return SWIG_Py_Void(); +} + +SWIGINTERN PyObject *VarsVector_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + return SWIG_Python_InitShadowInstance(args); +} + +SWIGINTERN PyObject *_wrap_new_VarsMap__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::less< std::string > *arg1 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< std::string,CdiVariable > *result = 0 ; + + if ((nobjs < 1) || (nobjs > 1)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1, SWIGTYPE_p_std__lessT_std__string_t, 0 | 0); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_VarsMap" "', argument " "1"" of type '" "std::less< std::string > const &""'"); + } + if (!argp1) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_VarsMap" "', argument " "1"" of type '" "std::less< std::string > const &""'"); + } + arg1 = reinterpret_cast< std::less< std::string > * >(argp1); + result = (std::map< std::string,CdiVariable > *)new std::map< std::string,CdiVariable >((std::less< std::string > const &)*arg1); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, SWIG_POINTER_NEW | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsMap_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; + PyObject **arg2 = (PyObject **) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + swig::SwigPyIterator *result = 0 ; + + arg2 = &swig_obj[0]; + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_iterator" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); + result = (swig::SwigPyIterator *)std_map_Sl_std_string_Sc_CdiVariable_Sg__iterator(arg1,arg2); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsMap___nonzero__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + bool result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap___nonzero__" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > const *""'"); + } + arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); + result = (bool)std_map_Sl_std_string_Sc_CdiVariable_Sg____nonzero__((std::map< std::string,CdiVariable > const *)arg1); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsMap___bool__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + bool result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap___bool__" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > const *""'"); + } + arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); + result = (bool)std_map_Sl_std_string_Sc_CdiVariable_Sg____bool__((std::map< std::string,CdiVariable > const *)arg1); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsMap___len__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::map< std::string,CdiVariable >::size_type result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap___len__" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > const *""'"); + } + arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); + result = std_map_Sl_std_string_Sc_CdiVariable_Sg____len__((std::map< std::string,CdiVariable > const *)arg1); + resultobj = SWIG_From_size_t(static_cast< size_t >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsMap___getitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; + std::map< std::string,CdiVariable >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 = SWIG_OLDOBJ ; + PyObject *swig_obj[2] ; + std::map< std::string,CdiVariable >::mapped_type *result = 0 ; + + if (!SWIG_Python_UnpackTuple(args, "VarsMap___getitem__", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap___getitem__" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); + { + std::string *ptr = (std::string *)0; + res2 = SWIG_AsPtr_std_string(swig_obj[1], &ptr); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VarsMap___getitem__" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::key_type const &""'"); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsMap___getitem__" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::key_type const &""'"); + } + arg2 = ptr; + } + try { + result = (std::map< std::string,CdiVariable >::mapped_type *) &std_map_Sl_std_string_Sc_CdiVariable_Sg____getitem__(arg1,(std::string const &)*arg2); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (SWIG_IsNewObj(res2)) delete arg2; + return resultobj; +fail: + if (SWIG_IsNewObj(res2)) delete arg2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsMap___delitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; + std::map< std::string,CdiVariable >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 = SWIG_OLDOBJ ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "VarsMap___delitem__", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap___delitem__" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); + { + std::string *ptr = (std::string *)0; + res2 = SWIG_AsPtr_std_string(swig_obj[1], &ptr); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VarsMap___delitem__" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::key_type const &""'"); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsMap___delitem__" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::key_type const &""'"); + } + arg2 = ptr; + } + try { + std_map_Sl_std_string_Sc_CdiVariable_Sg____delitem__(arg1,(std::string const &)*arg2); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } + resultobj = SWIG_Py_Void(); + if (SWIG_IsNewObj(res2)) delete arg2; + return resultobj; +fail: + if (SWIG_IsNewObj(res2)) delete arg2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsMap_has_key(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; + std::map< std::string,CdiVariable >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 = SWIG_OLDOBJ ; + PyObject *swig_obj[2] ; + bool result; + + if (!SWIG_Python_UnpackTuple(args, "VarsMap_has_key", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_has_key" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > const *""'"); + } + arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); + { + std::string *ptr = (std::string *)0; + res2 = SWIG_AsPtr_std_string(swig_obj[1], &ptr); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VarsMap_has_key" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::key_type const &""'"); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsMap_has_key" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::key_type const &""'"); + } + arg2 = ptr; + } + result = (bool)std_map_Sl_std_string_Sc_CdiVariable_Sg__has_key((std::map< std::string,CdiVariable > const *)arg1,(std::string const &)*arg2); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + if (SWIG_IsNewObj(res2)) delete arg2; + return resultobj; +fail: + if (SWIG_IsNewObj(res2)) delete arg2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsMap_keys(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + PyObject *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_keys" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); + result = (PyObject *)std_map_Sl_std_string_Sc_CdiVariable_Sg__keys(arg1); + resultobj = result; + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsMap_values(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + PyObject *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_values" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); + result = (PyObject *)std_map_Sl_std_string_Sc_CdiVariable_Sg__values(arg1); + resultobj = result; + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsMap_items(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + PyObject *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_items" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); + result = (PyObject *)std_map_Sl_std_string_Sc_CdiVariable_Sg__items(arg1); + resultobj = result; + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsMap___contains__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; + std::map< std::string,CdiVariable >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 = SWIG_OLDOBJ ; + PyObject *swig_obj[2] ; + bool result; + + if (!SWIG_Python_UnpackTuple(args, "VarsMap___contains__", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap___contains__" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); + { + std::string *ptr = (std::string *)0; + res2 = SWIG_AsPtr_std_string(swig_obj[1], &ptr); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VarsMap___contains__" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::key_type const &""'"); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsMap___contains__" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::key_type const &""'"); + } + arg2 = ptr; + } + result = (bool)std_map_Sl_std_string_Sc_CdiVariable_Sg____contains__(arg1,(std::string const &)*arg2); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + if (SWIG_IsNewObj(res2)) delete arg2; + return resultobj; +fail: + if (SWIG_IsNewObj(res2)) delete arg2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsMap_key_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; + PyObject **arg2 = (PyObject **) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + swig::SwigPyIterator *result = 0 ; + + arg2 = &swig_obj[0]; + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_key_iterator" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); + result = (swig::SwigPyIterator *)std_map_Sl_std_string_Sc_CdiVariable_Sg__key_iterator(arg1,arg2); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsMap_value_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; + PyObject **arg2 = (PyObject **) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + swig::SwigPyIterator *result = 0 ; + + arg2 = &swig_obj[0]; + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_value_iterator" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); + result = (swig::SwigPyIterator *)std_map_Sl_std_string_Sc_CdiVariable_Sg__value_iterator(arg1,arg2); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsMap___setitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; + std::map< std::string,CdiVariable >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 = SWIG_OLDOBJ ; + + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap___setitem__" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); + { + std::string *ptr = (std::string *)0; + res2 = SWIG_AsPtr_std_string(swig_obj[1], &ptr); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VarsMap___setitem__" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::key_type const &""'"); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsMap___setitem__" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::key_type const &""'"); + } + arg2 = ptr; + } + std_map_Sl_std_string_Sc_CdiVariable_Sg____setitem____SWIG_0(arg1,(std::string const &)*arg2); + resultobj = SWIG_Py_Void(); + if (SWIG_IsNewObj(res2)) delete arg2; + return resultobj; +fail: + if (SWIG_IsNewObj(res2)) delete arg2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsMap___setitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; + std::map< std::string,CdiVariable >::key_type *arg2 = 0 ; + std::map< std::string,CdiVariable >::mapped_type *arg3 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 = SWIG_OLDOBJ ; + void *argp3 = 0 ; + int res3 = 0 ; + + if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap___setitem__" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); + { + std::string *ptr = (std::string *)0; + res2 = SWIG_AsPtr_std_string(swig_obj[1], &ptr); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VarsMap___setitem__" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::key_type const &""'"); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsMap___setitem__" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::key_type const &""'"); + } + arg2 = ptr; + } + res3 = SWIG_ConvertPtr(swig_obj[2], &argp3, SWIGTYPE_p_CdiVariable, 0 | 0); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "VarsMap___setitem__" "', argument " "3"" of type '" "std::map< std::string,CdiVariable >::mapped_type const &""'"); + } + if (!argp3) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsMap___setitem__" "', argument " "3"" of type '" "std::map< std::string,CdiVariable >::mapped_type const &""'"); + } + arg3 = reinterpret_cast< std::map< std::string,CdiVariable >::mapped_type * >(argp3); + try { + std_map_Sl_std_string_Sc_CdiVariable_Sg____setitem____SWIG_1(arg1,(std::string const &)*arg2,(CdiVariable const &)*arg3); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } + resultobj = SWIG_Py_Void(); + if (SWIG_IsNewObj(res2)) delete arg2; + return resultobj; +fail: + if (SWIG_IsNewObj(res2)) delete arg2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsMap___setitem__(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[4] = { + 0 + }; + + if (!(argc = SWIG_Python_UnpackTuple(args, "VarsMap___setitem__", 0, 3, argv))) SWIG_fail; + --argc; + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_VarsMap___setitem____SWIG_0(self, argc, argv); + } + } + } + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + int res = SWIG_ConvertPtr(argv[2], 0, SWIGTYPE_p_CdiVariable, SWIG_POINTER_NO_NULL | 0); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_VarsMap___setitem____SWIG_1(self, argc, argv); + } + } + } + } + +fail: + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'VarsMap___setitem__'.\n" + " Possible C/C++ prototypes are:\n" + " std::map< std::string,CdiVariable >::__setitem__(std::map< std::string,CdiVariable >::key_type const &)\n" + " std::map< std::string,CdiVariable >::__setitem__(std::map< std::string,CdiVariable >::key_type const &,std::map< std::string,CdiVariable >::mapped_type const &)\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_VarsMap_asdict(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + PyObject *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_asdict" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); + result = (PyObject *)std_map_Sl_std_string_Sc_CdiVariable_Sg__asdict(arg1); + resultobj = result; + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_VarsMap__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) { + PyObject *resultobj = 0; + std::map< std::string,CdiVariable > *result = 0 ; + + if ((nobjs < 0) || (nobjs > 0)) SWIG_fail; + result = (std::map< std::string,CdiVariable > *)new std::map< std::string,CdiVariable >(); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, SWIG_POINTER_NEW | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_VarsMap__SWIG_2(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::map< std::string,CdiVariable > *arg1 = 0 ; + int res1 = SWIG_OLDOBJ ; + std::map< std::string,CdiVariable > *result = 0 ; + + if ((nobjs < 1) || (nobjs > 1)) SWIG_fail; + { + std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > > *ptr = (std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > > *)0; + res1 = swig::asptr(swig_obj[0], &ptr); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_VarsMap" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > const &""'"); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_VarsMap" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > const &""'"); + } + arg1 = ptr; + } + result = (std::map< std::string,CdiVariable > *)new std::map< std::string,CdiVariable >((std::map< std::string,CdiVariable > const &)*arg1); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, SWIG_POINTER_NEW | 0 ); + if (SWIG_IsNewObj(res1)) delete arg1; + return resultobj; +fail: + if (SWIG_IsNewObj(res1)) delete arg1; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_VarsMap(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[2] = { + 0 + }; + + if (!(argc = SWIG_Python_UnpackTuple(args, "new_VarsMap", 0, 1, argv))) SWIG_fail; + --argc; + if (argc == 0) { + return _wrap_new_VarsMap__SWIG_1(self, argc, argv); + } + if (argc == 1) { + int _v; + int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_std__lessT_std__string_t, SWIG_POINTER_NO_NULL | 0); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_new_VarsMap__SWIG_0(self, argc, argv); + } + } + if (argc == 1) { + int _v; + int res = swig::asptr(argv[0], (std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_new_VarsMap__SWIG_2(self, argc, argv); + } + } + +fail: + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'new_VarsMap'.\n" + " Possible C/C++ prototypes are:\n" + " std::map< std::string,CdiVariable >::map(std::less< std::string > const &)\n" + " std::map< std::string,CdiVariable >::map()\n" + " std::map< std::string,CdiVariable >::map(std::map< std::string,CdiVariable > const &)\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_VarsMap_empty(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + bool result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_empty" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > const *""'"); + } + arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); + result = (bool)((std::map< std::string,CdiVariable > const *)arg1)->empty(); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsMap_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::map< std::string,CdiVariable >::size_type result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_size" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > const *""'"); + } + arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); + result = ((std::map< std::string,CdiVariable > const *)arg1)->size(); + resultobj = SWIG_From_size_t(static_cast< size_t >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsMap_swap(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; + std::map< std::string,CdiVariable > *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "VarsMap_swap", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_swap" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VarsMap_swap" "', argument " "2"" of type '" "std::map< std::string,CdiVariable > &""'"); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsMap_swap" "', argument " "2"" of type '" "std::map< std::string,CdiVariable > &""'"); + } + arg2 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp2); + (arg1)->swap(*arg2); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsMap_begin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::map< std::string,CdiVariable >::iterator result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_begin" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); + result = (arg1)->begin(); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< std::string,CdiVariable >::iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsMap_end(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::map< std::string,CdiVariable >::iterator result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_end" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); + result = (arg1)->end(); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< std::string,CdiVariable >::iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsMap_rbegin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::map< std::string,CdiVariable >::reverse_iterator result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_rbegin" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); + result = (arg1)->rbegin(); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< std::string,CdiVariable >::reverse_iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsMap_rend(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::map< std::string,CdiVariable >::reverse_iterator result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_rend" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); + result = (arg1)->rend(); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< std::string,CdiVariable >::reverse_iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsMap_clear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_clear" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); + (arg1)->clear(); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsMap_get_allocator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + SwigValueWrapper< std::allocator< std::pair< std::string const,CdiVariable > > > result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_get_allocator" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > const *""'"); + } + arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); + result = ((std::map< std::string,CdiVariable > const *)arg1)->get_allocator(); + resultobj = SWIG_NewPointerObj((new std::map< std::string,CdiVariable >::allocator_type(static_cast< const std::map< std::string,CdiVariable >::allocator_type& >(result))), SWIGTYPE_p_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsMap_erase__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; + std::map< std::string,CdiVariable >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 = SWIG_OLDOBJ ; + std::map< std::string,CdiVariable >::size_type result; + + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_erase" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); + { + std::string *ptr = (std::string *)0; + res2 = SWIG_AsPtr_std_string(swig_obj[1], &ptr); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VarsMap_erase" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::key_type const &""'"); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsMap_erase" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::key_type const &""'"); + } + arg2 = ptr; + } + result = (arg1)->erase((std::map< std::string,CdiVariable >::key_type const &)*arg2); + resultobj = SWIG_From_size_t(static_cast< size_t >(result)); + if (SWIG_IsNewObj(res2)) delete arg2; + return resultobj; +fail: + if (SWIG_IsNewObj(res2)) delete arg2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsMap_count(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; + std::map< std::string,CdiVariable >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 = SWIG_OLDOBJ ; + PyObject *swig_obj[2] ; + std::map< std::string,CdiVariable >::size_type result; + + if (!SWIG_Python_UnpackTuple(args, "VarsMap_count", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_count" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > const *""'"); + } + arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); + { + std::string *ptr = (std::string *)0; + res2 = SWIG_AsPtr_std_string(swig_obj[1], &ptr); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VarsMap_count" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::key_type const &""'"); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsMap_count" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::key_type const &""'"); + } + arg2 = ptr; + } + result = ((std::map< std::string,CdiVariable > const *)arg1)->count((std::map< std::string,CdiVariable >::key_type const &)*arg2); + resultobj = SWIG_From_size_t(static_cast< size_t >(result)); + if (SWIG_IsNewObj(res2)) delete arg2; + return resultobj; +fail: + if (SWIG_IsNewObj(res2)) delete arg2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsMap_erase__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; + std::map< std::string,CdiVariable >::iterator arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + swig::SwigPyIterator *iter2 = 0 ; + int res2 ; + + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_erase" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0); + if (!SWIG_IsOK(res2) || !iter2) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsMap_erase" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::iterator""'"); + } else { + swig::SwigPyIterator_T<std::map< std::string,CdiVariable >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::map< std::string,CdiVariable >::iterator > *>(iter2); + if (iter_t) { + arg2 = iter_t->get_current(); + } else { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsMap_erase" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::iterator""'"); + } + } + std_map_Sl_std_string_Sc_CdiVariable_Sg__erase__SWIG_1(arg1,arg2); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsMap_erase__SWIG_2(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; + std::map< std::string,CdiVariable >::iterator arg2 ; + std::map< std::string,CdiVariable >::iterator arg3 ; + void *argp1 = 0 ; + int res1 = 0 ; + swig::SwigPyIterator *iter2 = 0 ; + int res2 ; + swig::SwigPyIterator *iter3 = 0 ; + int res3 ; + + if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_erase" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0); + if (!SWIG_IsOK(res2) || !iter2) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsMap_erase" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::iterator""'"); + } else { + swig::SwigPyIterator_T<std::map< std::string,CdiVariable >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::map< std::string,CdiVariable >::iterator > *>(iter2); + if (iter_t) { + arg2 = iter_t->get_current(); + } else { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsMap_erase" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::iterator""'"); + } + } + res3 = SWIG_ConvertPtr(swig_obj[2], SWIG_as_voidptrptr(&iter3), swig::SwigPyIterator::descriptor(), 0); + if (!SWIG_IsOK(res3) || !iter3) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsMap_erase" "', argument " "3"" of type '" "std::map< std::string,CdiVariable >::iterator""'"); + } else { + swig::SwigPyIterator_T<std::map< std::string,CdiVariable >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::map< std::string,CdiVariable >::iterator > *>(iter3); + if (iter_t) { + arg3 = iter_t->get_current(); + } else { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsMap_erase" "', argument " "3"" of type '" "std::map< std::string,CdiVariable >::iterator""'"); + } + } + std_map_Sl_std_string_Sc_CdiVariable_Sg__erase__SWIG_2(arg1,arg2,arg3); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsMap_erase(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[4] = { + 0 + }; + + if (!(argc = SWIG_Python_UnpackTuple(args, "VarsMap_erase", 0, 3, argv))) SWIG_fail; + --argc; + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + swig::SwigPyIterator *iter = 0; + int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); + _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::map< std::string,CdiVariable >::iterator > *>(iter) != 0)); + if (_v) { + return _wrap_VarsMap_erase__SWIG_1(self, argc, argv); + } + } + } + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_VarsMap_erase__SWIG_0(self, argc, argv); + } + } + } + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + swig::SwigPyIterator *iter = 0; + int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); + _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::map< std::string,CdiVariable >::iterator > *>(iter) != 0)); + if (_v) { + swig::SwigPyIterator *iter = 0; + int res = SWIG_ConvertPtr(argv[2], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); + _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::map< std::string,CdiVariable >::iterator > *>(iter) != 0)); + if (_v) { + return _wrap_VarsMap_erase__SWIG_2(self, argc, argv); + } + } + } + } + +fail: + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'VarsMap_erase'.\n" + " Possible C/C++ prototypes are:\n" + " std::map< std::string,CdiVariable >::erase(std::map< std::string,CdiVariable >::key_type const &)\n" + " std::map< std::string,CdiVariable >::erase(std::map< std::string,CdiVariable >::iterator)\n" + " std::map< std::string,CdiVariable >::erase(std::map< std::string,CdiVariable >::iterator,std::map< std::string,CdiVariable >::iterator)\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_VarsMap_find(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; + std::map< std::string,CdiVariable >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 = SWIG_OLDOBJ ; + PyObject *swig_obj[2] ; + std::map< std::string,CdiVariable >::iterator result; + + if (!SWIG_Python_UnpackTuple(args, "VarsMap_find", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_find" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); + { + std::string *ptr = (std::string *)0; + res2 = SWIG_AsPtr_std_string(swig_obj[1], &ptr); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VarsMap_find" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::key_type const &""'"); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsMap_find" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::key_type const &""'"); + } + arg2 = ptr; + } + result = (arg1)->find((std::map< std::string,CdiVariable >::key_type const &)*arg2); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< std::string,CdiVariable >::iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + if (SWIG_IsNewObj(res2)) delete arg2; + return resultobj; +fail: + if (SWIG_IsNewObj(res2)) delete arg2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsMap_lower_bound(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; + std::map< std::string,CdiVariable >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 = SWIG_OLDOBJ ; + PyObject *swig_obj[2] ; + std::map< std::string,CdiVariable >::iterator result; + + if (!SWIG_Python_UnpackTuple(args, "VarsMap_lower_bound", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_lower_bound" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); + { + std::string *ptr = (std::string *)0; + res2 = SWIG_AsPtr_std_string(swig_obj[1], &ptr); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VarsMap_lower_bound" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::key_type const &""'"); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsMap_lower_bound" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::key_type const &""'"); + } + arg2 = ptr; + } + result = (arg1)->lower_bound((std::map< std::string,CdiVariable >::key_type const &)*arg2); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< std::string,CdiVariable >::iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + if (SWIG_IsNewObj(res2)) delete arg2; + return resultobj; +fail: + if (SWIG_IsNewObj(res2)) delete arg2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsMap_upper_bound(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; + std::map< std::string,CdiVariable >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 = SWIG_OLDOBJ ; + PyObject *swig_obj[2] ; + std::map< std::string,CdiVariable >::iterator result; + + if (!SWIG_Python_UnpackTuple(args, "VarsMap_upper_bound", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_upper_bound" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); + { + std::string *ptr = (std::string *)0; + res2 = SWIG_AsPtr_std_string(swig_obj[1], &ptr); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VarsMap_upper_bound" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::key_type const &""'"); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsMap_upper_bound" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::key_type const &""'"); + } + arg2 = ptr; + } + result = (arg1)->upper_bound((std::map< std::string,CdiVariable >::key_type const &)*arg2); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< std::string,CdiVariable >::iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + if (SWIG_IsNewObj(res2)) delete arg2; + return resultobj; +fail: + if (SWIG_IsNewObj(res2)) delete arg2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_delete_VarsMap(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_VarsMap" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); + delete arg1; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *VarsMap_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *obj; + if (!SWIG_Python_UnpackTuple(args, "swigregister", 1, 1, &obj)) return NULL; + SWIG_TypeNewClientData(SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, SWIG_NewClientData(obj)); + return SWIG_Py_Void(); +} + +SWIGINTERN PyObject *VarsMap_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + return SWIG_Python_InitShadowInstance(args); +} + +SWIGINTERN PyObject *_wrap_new_VarsByCode__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::less< int > *arg1 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiVariable > *result = 0 ; + + if ((nobjs < 1) || (nobjs > 1)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1, SWIGTYPE_p_std__lessT_int_t, 0 | 0); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_VarsByCode" "', argument " "1"" of type '" "std::less< int > const &""'"); + } + if (!argp1) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_VarsByCode" "', argument " "1"" of type '" "std::less< int > const &""'"); + } + arg1 = reinterpret_cast< std::less< int > * >(argp1); + result = (std::map< int,CdiVariable > *)new std::map< int,CdiVariable >((std::less< int > const &)*arg1); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, SWIG_POINTER_NEW | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsByCode_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; + PyObject **arg2 = (PyObject **) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + swig::SwigPyIterator *result = 0 ; + + arg2 = &swig_obj[0]; + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_iterator" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); + result = (swig::SwigPyIterator *)std_map_Sl_int_Sc_CdiVariable_Sg__iterator(arg1,arg2); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsByCode___nonzero__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + bool result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode___nonzero__" "', argument " "1"" of type '" "std::map< int,CdiVariable > const *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); + result = (bool)std_map_Sl_int_Sc_CdiVariable_Sg____nonzero__((std::map< int,CdiVariable > const *)arg1); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsByCode___bool__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + bool result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode___bool__" "', argument " "1"" of type '" "std::map< int,CdiVariable > const *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); + result = (bool)std_map_Sl_int_Sc_CdiVariable_Sg____bool__((std::map< int,CdiVariable > const *)arg1); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsByCode___len__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::map< int,CdiVariable >::size_type result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode___len__" "', argument " "1"" of type '" "std::map< int,CdiVariable > const *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); + result = std_map_Sl_int_Sc_CdiVariable_Sg____len__((std::map< int,CdiVariable > const *)arg1); + resultobj = SWIG_From_size_t(static_cast< size_t >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsByCode___getitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; + std::map< int,CdiVariable >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiVariable >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + std::map< int,CdiVariable >::mapped_type *result = 0 ; + + if (!SWIG_Python_UnpackTuple(args, "VarsByCode___getitem__", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode___getitem__" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsByCode___getitem__" "', argument " "2"" of type '" "std::map< int,CdiVariable >::key_type""'"); + } + temp2 = static_cast< std::map< int,CdiVariable >::key_type >(val2); + arg2 = &temp2; + try { + result = (std::map< int,CdiVariable >::mapped_type *) &std_map_Sl_int_Sc_CdiVariable_Sg____getitem__(arg1,(int const &)*arg2); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CdiVariable, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsByCode___delitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; + std::map< int,CdiVariable >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiVariable >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "VarsByCode___delitem__", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode___delitem__" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsByCode___delitem__" "', argument " "2"" of type '" "std::map< int,CdiVariable >::key_type""'"); + } + temp2 = static_cast< std::map< int,CdiVariable >::key_type >(val2); + arg2 = &temp2; + try { + std_map_Sl_int_Sc_CdiVariable_Sg____delitem__(arg1,(int const &)*arg2); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsByCode_has_key(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; + std::map< int,CdiVariable >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiVariable >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + bool result; + + if (!SWIG_Python_UnpackTuple(args, "VarsByCode_has_key", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_has_key" "', argument " "1"" of type '" "std::map< int,CdiVariable > const *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsByCode_has_key" "', argument " "2"" of type '" "std::map< int,CdiVariable >::key_type""'"); + } + temp2 = static_cast< std::map< int,CdiVariable >::key_type >(val2); + arg2 = &temp2; + result = (bool)std_map_Sl_int_Sc_CdiVariable_Sg__has_key((std::map< int,CdiVariable > const *)arg1,(int const &)*arg2); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsByCode_keys(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + PyObject *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_keys" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); + result = (PyObject *)std_map_Sl_int_Sc_CdiVariable_Sg__keys(arg1); + resultobj = result; + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsByCode_values(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + PyObject *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_values" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); + result = (PyObject *)std_map_Sl_int_Sc_CdiVariable_Sg__values(arg1); + resultobj = result; + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsByCode_items(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + PyObject *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_items" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); + result = (PyObject *)std_map_Sl_int_Sc_CdiVariable_Sg__items(arg1); + resultobj = result; + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsByCode___contains__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; + std::map< int,CdiVariable >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiVariable >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + bool result; + + if (!SWIG_Python_UnpackTuple(args, "VarsByCode___contains__", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode___contains__" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsByCode___contains__" "', argument " "2"" of type '" "std::map< int,CdiVariable >::key_type""'"); + } + temp2 = static_cast< std::map< int,CdiVariable >::key_type >(val2); + arg2 = &temp2; + result = (bool)std_map_Sl_int_Sc_CdiVariable_Sg____contains__(arg1,(int const &)*arg2); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsByCode_key_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; + PyObject **arg2 = (PyObject **) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + swig::SwigPyIterator *result = 0 ; + + arg2 = &swig_obj[0]; + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_key_iterator" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); + result = (swig::SwigPyIterator *)std_map_Sl_int_Sc_CdiVariable_Sg__key_iterator(arg1,arg2); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsByCode_value_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; + PyObject **arg2 = (PyObject **) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + swig::SwigPyIterator *result = 0 ; + + arg2 = &swig_obj[0]; + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_value_iterator" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); + result = (swig::SwigPyIterator *)std_map_Sl_int_Sc_CdiVariable_Sg__value_iterator(arg1,arg2); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsByCode___setitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; + std::map< int,CdiVariable >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiVariable >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode___setitem__" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsByCode___setitem__" "', argument " "2"" of type '" "std::map< int,CdiVariable >::key_type""'"); + } + temp2 = static_cast< std::map< int,CdiVariable >::key_type >(val2); + arg2 = &temp2; + std_map_Sl_int_Sc_CdiVariable_Sg____setitem____SWIG_0(arg1,(int const &)*arg2); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsByCode___setitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; + std::map< int,CdiVariable >::key_type *arg2 = 0 ; + std::map< int,CdiVariable >::mapped_type *arg3 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiVariable >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + void *argp3 = 0 ; + int res3 = 0 ; + + if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode___setitem__" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsByCode___setitem__" "', argument " "2"" of type '" "std::map< int,CdiVariable >::key_type""'"); + } + temp2 = static_cast< std::map< int,CdiVariable >::key_type >(val2); + arg2 = &temp2; + res3 = SWIG_ConvertPtr(swig_obj[2], &argp3, SWIGTYPE_p_CdiVariable, 0 | 0); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "VarsByCode___setitem__" "', argument " "3"" of type '" "std::map< int,CdiVariable >::mapped_type const &""'"); + } + if (!argp3) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsByCode___setitem__" "', argument " "3"" of type '" "std::map< int,CdiVariable >::mapped_type const &""'"); + } + arg3 = reinterpret_cast< std::map< int,CdiVariable >::mapped_type * >(argp3); + try { + std_map_Sl_int_Sc_CdiVariable_Sg____setitem____SWIG_1(arg1,(int const &)*arg2,(CdiVariable const &)*arg3); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsByCode___setitem__(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[4] = { + 0 + }; + + if (!(argc = SWIG_Python_UnpackTuple(args, "VarsByCode___setitem__", 0, 3, argv))) SWIG_fail; + --argc; + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_VarsByCode___setitem____SWIG_0(self, argc, argv); + } + } + } + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + int res = SWIG_ConvertPtr(argv[2], 0, SWIGTYPE_p_CdiVariable, SWIG_POINTER_NO_NULL | 0); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_VarsByCode___setitem____SWIG_1(self, argc, argv); + } + } + } + } + +fail: + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'VarsByCode___setitem__'.\n" + " Possible C/C++ prototypes are:\n" + " std::map< int,CdiVariable >::__setitem__(std::map< int,CdiVariable >::key_type const &)\n" + " std::map< int,CdiVariable >::__setitem__(std::map< int,CdiVariable >::key_type const &,std::map< int,CdiVariable >::mapped_type const &)\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_VarsByCode_asdict(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + PyObject *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_asdict" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); + result = (PyObject *)std_map_Sl_int_Sc_CdiVariable_Sg__asdict(arg1); + resultobj = result; + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_VarsByCode__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) { + PyObject *resultobj = 0; + std::map< int,CdiVariable > *result = 0 ; + + if ((nobjs < 0) || (nobjs > 0)) SWIG_fail; + result = (std::map< int,CdiVariable > *)new std::map< int,CdiVariable >(); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, SWIG_POINTER_NEW | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_VarsByCode__SWIG_2(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::map< int,CdiVariable > *arg1 = 0 ; + int res1 = SWIG_OLDOBJ ; + std::map< int,CdiVariable > *result = 0 ; + + if ((nobjs < 1) || (nobjs > 1)) SWIG_fail; + { + std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > > *ptr = (std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > > *)0; + res1 = swig::asptr(swig_obj[0], &ptr); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_VarsByCode" "', argument " "1"" of type '" "std::map< int,CdiVariable > const &""'"); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_VarsByCode" "', argument " "1"" of type '" "std::map< int,CdiVariable > const &""'"); + } + arg1 = ptr; + } + result = (std::map< int,CdiVariable > *)new std::map< int,CdiVariable >((std::map< int,CdiVariable > const &)*arg1); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, SWIG_POINTER_NEW | 0 ); + if (SWIG_IsNewObj(res1)) delete arg1; + return resultobj; +fail: + if (SWIG_IsNewObj(res1)) delete arg1; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_VarsByCode(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[2] = { + 0 + }; + + if (!(argc = SWIG_Python_UnpackTuple(args, "new_VarsByCode", 0, 1, argv))) SWIG_fail; + --argc; + if (argc == 0) { + return _wrap_new_VarsByCode__SWIG_1(self, argc, argv); + } + if (argc == 1) { + int _v; + int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_std__lessT_int_t, SWIG_POINTER_NO_NULL | 0); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_new_VarsByCode__SWIG_0(self, argc, argv); + } + } + if (argc == 1) { + int _v; + int res = swig::asptr(argv[0], (std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_new_VarsByCode__SWIG_2(self, argc, argv); + } + } + +fail: + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'new_VarsByCode'.\n" + " Possible C/C++ prototypes are:\n" + " std::map< int,CdiVariable >::map(std::less< int > const &)\n" + " std::map< int,CdiVariable >::map()\n" + " std::map< int,CdiVariable >::map(std::map< int,CdiVariable > const &)\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_VarsByCode_empty(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + bool result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_empty" "', argument " "1"" of type '" "std::map< int,CdiVariable > const *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); + result = (bool)((std::map< int,CdiVariable > const *)arg1)->empty(); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsByCode_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::map< int,CdiVariable >::size_type result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_size" "', argument " "1"" of type '" "std::map< int,CdiVariable > const *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); + result = ((std::map< int,CdiVariable > const *)arg1)->size(); + resultobj = SWIG_From_size_t(static_cast< size_t >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsByCode_swap(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; + std::map< int,CdiVariable > *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "VarsByCode_swap", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_swap" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VarsByCode_swap" "', argument " "2"" of type '" "std::map< int,CdiVariable > &""'"); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsByCode_swap" "', argument " "2"" of type '" "std::map< int,CdiVariable > &""'"); + } + arg2 = reinterpret_cast< std::map< int,CdiVariable > * >(argp2); + (arg1)->swap(*arg2); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsByCode_begin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::map< int,CdiVariable >::iterator result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_begin" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); + result = (arg1)->begin(); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiVariable >::iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsByCode_end(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::map< int,CdiVariable >::iterator result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_end" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); + result = (arg1)->end(); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiVariable >::iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsByCode_rbegin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::map< int,CdiVariable >::reverse_iterator result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_rbegin" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); + result = (arg1)->rbegin(); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiVariable >::reverse_iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsByCode_rend(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::map< int,CdiVariable >::reverse_iterator result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_rend" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); + result = (arg1)->rend(); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiVariable >::reverse_iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsByCode_clear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_clear" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); + (arg1)->clear(); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsByCode_get_allocator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + SwigValueWrapper< std::allocator< std::pair< int const,CdiVariable > > > result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_get_allocator" "', argument " "1"" of type '" "std::map< int,CdiVariable > const *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); + result = ((std::map< int,CdiVariable > const *)arg1)->get_allocator(); + resultobj = SWIG_NewPointerObj((new std::map< int,CdiVariable >::allocator_type(static_cast< const std::map< int,CdiVariable >::allocator_type& >(result))), SWIGTYPE_p_std__allocatorT_std__pairT_int_const_CdiVariable_t_t, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsByCode_erase__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; + std::map< int,CdiVariable >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiVariable >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + std::map< int,CdiVariable >::size_type result; + + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_erase" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsByCode_erase" "', argument " "2"" of type '" "std::map< int,CdiVariable >::key_type""'"); + } + temp2 = static_cast< std::map< int,CdiVariable >::key_type >(val2); + arg2 = &temp2; + result = (arg1)->erase((std::map< int,CdiVariable >::key_type const &)*arg2); + resultobj = SWIG_From_size_t(static_cast< size_t >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsByCode_count(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; + std::map< int,CdiVariable >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiVariable >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + std::map< int,CdiVariable >::size_type result; + + if (!SWIG_Python_UnpackTuple(args, "VarsByCode_count", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_count" "', argument " "1"" of type '" "std::map< int,CdiVariable > const *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsByCode_count" "', argument " "2"" of type '" "std::map< int,CdiVariable >::key_type""'"); + } + temp2 = static_cast< std::map< int,CdiVariable >::key_type >(val2); + arg2 = &temp2; + result = ((std::map< int,CdiVariable > const *)arg1)->count((std::map< int,CdiVariable >::key_type const &)*arg2); + resultobj = SWIG_From_size_t(static_cast< size_t >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsByCode_erase__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; + std::map< int,CdiVariable >::iterator arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + swig::SwigPyIterator *iter2 = 0 ; + int res2 ; + + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_erase" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0); + if (!SWIG_IsOK(res2) || !iter2) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsByCode_erase" "', argument " "2"" of type '" "std::map< int,CdiVariable >::iterator""'"); + } else { + swig::SwigPyIterator_T<std::map< int,CdiVariable >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiVariable >::iterator > *>(iter2); + if (iter_t) { + arg2 = iter_t->get_current(); + } else { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsByCode_erase" "', argument " "2"" of type '" "std::map< int,CdiVariable >::iterator""'"); + } + } + std_map_Sl_int_Sc_CdiVariable_Sg__erase__SWIG_1(arg1,arg2); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsByCode_erase__SWIG_2(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; + std::map< int,CdiVariable >::iterator arg2 ; + std::map< int,CdiVariable >::iterator arg3 ; + void *argp1 = 0 ; + int res1 = 0 ; + swig::SwigPyIterator *iter2 = 0 ; + int res2 ; + swig::SwigPyIterator *iter3 = 0 ; + int res3 ; + + if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_erase" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0); + if (!SWIG_IsOK(res2) || !iter2) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsByCode_erase" "', argument " "2"" of type '" "std::map< int,CdiVariable >::iterator""'"); + } else { + swig::SwigPyIterator_T<std::map< int,CdiVariable >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiVariable >::iterator > *>(iter2); + if (iter_t) { + arg2 = iter_t->get_current(); + } else { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsByCode_erase" "', argument " "2"" of type '" "std::map< int,CdiVariable >::iterator""'"); + } + } + res3 = SWIG_ConvertPtr(swig_obj[2], SWIG_as_voidptrptr(&iter3), swig::SwigPyIterator::descriptor(), 0); + if (!SWIG_IsOK(res3) || !iter3) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsByCode_erase" "', argument " "3"" of type '" "std::map< int,CdiVariable >::iterator""'"); + } else { + swig::SwigPyIterator_T<std::map< int,CdiVariable >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiVariable >::iterator > *>(iter3); + if (iter_t) { + arg3 = iter_t->get_current(); + } else { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsByCode_erase" "', argument " "3"" of type '" "std::map< int,CdiVariable >::iterator""'"); + } + } + std_map_Sl_int_Sc_CdiVariable_Sg__erase__SWIG_2(arg1,arg2,arg3); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsByCode_erase(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[4] = { + 0 + }; + + if (!(argc = SWIG_Python_UnpackTuple(args, "VarsByCode_erase", 0, 3, argv))) SWIG_fail; + --argc; + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + swig::SwigPyIterator *iter = 0; + int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); + _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiVariable >::iterator > *>(iter) != 0)); + if (_v) { + return _wrap_VarsByCode_erase__SWIG_1(self, argc, argv); + } + } + } + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_VarsByCode_erase__SWIG_0(self, argc, argv); + } + } + } + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + swig::SwigPyIterator *iter = 0; + int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); + _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiVariable >::iterator > *>(iter) != 0)); + if (_v) { + swig::SwigPyIterator *iter = 0; + int res = SWIG_ConvertPtr(argv[2], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); + _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiVariable >::iterator > *>(iter) != 0)); + if (_v) { + return _wrap_VarsByCode_erase__SWIG_2(self, argc, argv); + } + } + } + } + +fail: + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'VarsByCode_erase'.\n" + " Possible C/C++ prototypes are:\n" + " std::map< int,CdiVariable >::erase(std::map< int,CdiVariable >::key_type const &)\n" + " std::map< int,CdiVariable >::erase(std::map< int,CdiVariable >::iterator)\n" + " std::map< int,CdiVariable >::erase(std::map< int,CdiVariable >::iterator,std::map< int,CdiVariable >::iterator)\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_VarsByCode_find(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; + std::map< int,CdiVariable >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiVariable >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + std::map< int,CdiVariable >::iterator result; + + if (!SWIG_Python_UnpackTuple(args, "VarsByCode_find", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_find" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsByCode_find" "', argument " "2"" of type '" "std::map< int,CdiVariable >::key_type""'"); + } + temp2 = static_cast< std::map< int,CdiVariable >::key_type >(val2); + arg2 = &temp2; + result = (arg1)->find((std::map< int,CdiVariable >::key_type const &)*arg2); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiVariable >::iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsByCode_lower_bound(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; + std::map< int,CdiVariable >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiVariable >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + std::map< int,CdiVariable >::iterator result; + + if (!SWIG_Python_UnpackTuple(args, "VarsByCode_lower_bound", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_lower_bound" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsByCode_lower_bound" "', argument " "2"" of type '" "std::map< int,CdiVariable >::key_type""'"); + } + temp2 = static_cast< std::map< int,CdiVariable >::key_type >(val2); + arg2 = &temp2; + result = (arg1)->lower_bound((std::map< int,CdiVariable >::key_type const &)*arg2); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiVariable >::iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_VarsByCode_upper_bound(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; + std::map< int,CdiVariable >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiVariable >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + std::map< int,CdiVariable >::iterator result; + + if (!SWIG_Python_UnpackTuple(args, "VarsByCode_upper_bound", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_upper_bound" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsByCode_upper_bound" "', argument " "2"" of type '" "std::map< int,CdiVariable >::key_type""'"); + } + temp2 = static_cast< std::map< int,CdiVariable >::key_type >(val2); + arg2 = &temp2; + result = (arg1)->upper_bound((std::map< int,CdiVariable >::key_type const &)*arg2); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiVariable >::iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_delete_VarsByCode(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_VarsByCode" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); + delete arg1; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *VarsByCode_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *obj; + if (!SWIG_Python_UnpackTuple(args, "swigregister", 1, 1, &obj)) return NULL; + SWIG_TypeNewClientData(SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, SWIG_NewClientData(obj)); + return SWIG_Py_Void(); +} + +SWIGINTERN PyObject *VarsByCode_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + return SWIG_Python_InitShadowInstance(args); +} + +SWIGINTERN PyObject *_wrap_new_TaxesMap__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::less< int > *arg1 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiTaxis > *result = 0 ; + + if ((nobjs < 1) || (nobjs > 1)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1, SWIGTYPE_p_std__lessT_int_t, 0 | 0); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_TaxesMap" "', argument " "1"" of type '" "std::less< int > const &""'"); + } + if (!argp1) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_TaxesMap" "', argument " "1"" of type '" "std::less< int > const &""'"); + } + arg1 = reinterpret_cast< std::less< int > * >(argp1); + result = (std::map< int,CdiTaxis > *)new std::map< int,CdiTaxis >((std::less< int > const &)*arg1); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, SWIG_POINTER_NEW | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_TaxesMap_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; + PyObject **arg2 = (PyObject **) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + swig::SwigPyIterator *result = 0 ; + + arg2 = &swig_obj[0]; + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_iterator" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); + result = (swig::SwigPyIterator *)std_map_Sl_int_Sc_CdiTaxis_Sg__iterator(arg1,arg2); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_TaxesMap___nonzero__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + bool result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap___nonzero__" "', argument " "1"" of type '" "std::map< int,CdiTaxis > const *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); + result = (bool)std_map_Sl_int_Sc_CdiTaxis_Sg____nonzero__((std::map< int,CdiTaxis > const *)arg1); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_TaxesMap___bool__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + bool result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap___bool__" "', argument " "1"" of type '" "std::map< int,CdiTaxis > const *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); + result = (bool)std_map_Sl_int_Sc_CdiTaxis_Sg____bool__((std::map< int,CdiTaxis > const *)arg1); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_TaxesMap___len__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::map< int,CdiTaxis >::size_type result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap___len__" "', argument " "1"" of type '" "std::map< int,CdiTaxis > const *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); + result = std_map_Sl_int_Sc_CdiTaxis_Sg____len__((std::map< int,CdiTaxis > const *)arg1); + resultobj = SWIG_From_size_t(static_cast< size_t >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_TaxesMap___getitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; + std::map< int,CdiTaxis >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiTaxis >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + std::map< int,CdiTaxis >::mapped_type *result = 0 ; + + if (!SWIG_Python_UnpackTuple(args, "TaxesMap___getitem__", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap___getitem__" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "TaxesMap___getitem__" "', argument " "2"" of type '" "std::map< int,CdiTaxis >::key_type""'"); + } + temp2 = static_cast< std::map< int,CdiTaxis >::key_type >(val2); + arg2 = &temp2; + try { + result = (std::map< int,CdiTaxis >::mapped_type *) &std_map_Sl_int_Sc_CdiTaxis_Sg____getitem__(arg1,(int const &)*arg2); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CdiTaxis, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_TaxesMap___delitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; + std::map< int,CdiTaxis >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiTaxis >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "TaxesMap___delitem__", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap___delitem__" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "TaxesMap___delitem__" "', argument " "2"" of type '" "std::map< int,CdiTaxis >::key_type""'"); + } + temp2 = static_cast< std::map< int,CdiTaxis >::key_type >(val2); + arg2 = &temp2; + try { + std_map_Sl_int_Sc_CdiTaxis_Sg____delitem__(arg1,(int const &)*arg2); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_TaxesMap_has_key(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; + std::map< int,CdiTaxis >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiTaxis >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + bool result; + + if (!SWIG_Python_UnpackTuple(args, "TaxesMap_has_key", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_has_key" "', argument " "1"" of type '" "std::map< int,CdiTaxis > const *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "TaxesMap_has_key" "', argument " "2"" of type '" "std::map< int,CdiTaxis >::key_type""'"); + } + temp2 = static_cast< std::map< int,CdiTaxis >::key_type >(val2); + arg2 = &temp2; + result = (bool)std_map_Sl_int_Sc_CdiTaxis_Sg__has_key((std::map< int,CdiTaxis > const *)arg1,(int const &)*arg2); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_TaxesMap_keys(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + PyObject *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_keys" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); + result = (PyObject *)std_map_Sl_int_Sc_CdiTaxis_Sg__keys(arg1); + resultobj = result; + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_TaxesMap_values(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + PyObject *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_values" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); + result = (PyObject *)std_map_Sl_int_Sc_CdiTaxis_Sg__values(arg1); + resultobj = result; + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_TaxesMap_items(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + PyObject *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_items" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); + result = (PyObject *)std_map_Sl_int_Sc_CdiTaxis_Sg__items(arg1); + resultobj = result; + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_TaxesMap___contains__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; + std::map< int,CdiTaxis >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiTaxis >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + bool result; + + if (!SWIG_Python_UnpackTuple(args, "TaxesMap___contains__", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap___contains__" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "TaxesMap___contains__" "', argument " "2"" of type '" "std::map< int,CdiTaxis >::key_type""'"); + } + temp2 = static_cast< std::map< int,CdiTaxis >::key_type >(val2); + arg2 = &temp2; + result = (bool)std_map_Sl_int_Sc_CdiTaxis_Sg____contains__(arg1,(int const &)*arg2); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_TaxesMap_key_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; + PyObject **arg2 = (PyObject **) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + swig::SwigPyIterator *result = 0 ; + + arg2 = &swig_obj[0]; + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_key_iterator" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); + result = (swig::SwigPyIterator *)std_map_Sl_int_Sc_CdiTaxis_Sg__key_iterator(arg1,arg2); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_TaxesMap_value_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; + PyObject **arg2 = (PyObject **) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + swig::SwigPyIterator *result = 0 ; + + arg2 = &swig_obj[0]; + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_value_iterator" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); + result = (swig::SwigPyIterator *)std_map_Sl_int_Sc_CdiTaxis_Sg__value_iterator(arg1,arg2); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_TaxesMap___setitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; + std::map< int,CdiTaxis >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiTaxis >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap___setitem__" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "TaxesMap___setitem__" "', argument " "2"" of type '" "std::map< int,CdiTaxis >::key_type""'"); + } + temp2 = static_cast< std::map< int,CdiTaxis >::key_type >(val2); + arg2 = &temp2; + std_map_Sl_int_Sc_CdiTaxis_Sg____setitem____SWIG_0(arg1,(int const &)*arg2); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_TaxesMap___setitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; + std::map< int,CdiTaxis >::key_type *arg2 = 0 ; + std::map< int,CdiTaxis >::mapped_type *arg3 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiTaxis >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + void *argp3 = 0 ; + int res3 = 0 ; + + if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap___setitem__" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "TaxesMap___setitem__" "', argument " "2"" of type '" "std::map< int,CdiTaxis >::key_type""'"); + } + temp2 = static_cast< std::map< int,CdiTaxis >::key_type >(val2); + arg2 = &temp2; + res3 = SWIG_ConvertPtr(swig_obj[2], &argp3, SWIGTYPE_p_CdiTaxis, 0 | 0); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "TaxesMap___setitem__" "', argument " "3"" of type '" "std::map< int,CdiTaxis >::mapped_type const &""'"); + } + if (!argp3) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "TaxesMap___setitem__" "', argument " "3"" of type '" "std::map< int,CdiTaxis >::mapped_type const &""'"); + } + arg3 = reinterpret_cast< std::map< int,CdiTaxis >::mapped_type * >(argp3); + try { + std_map_Sl_int_Sc_CdiTaxis_Sg____setitem____SWIG_1(arg1,(int const &)*arg2,(CdiTaxis const &)*arg3); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_TaxesMap___setitem__(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[4] = { + 0 + }; + + if (!(argc = SWIG_Python_UnpackTuple(args, "TaxesMap___setitem__", 0, 3, argv))) SWIG_fail; + --argc; + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_TaxesMap___setitem____SWIG_0(self, argc, argv); + } + } + } + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + int res = SWIG_ConvertPtr(argv[2], 0, SWIGTYPE_p_CdiTaxis, SWIG_POINTER_NO_NULL | 0); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_TaxesMap___setitem____SWIG_1(self, argc, argv); + } + } + } + } + +fail: + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'TaxesMap___setitem__'.\n" + " Possible C/C++ prototypes are:\n" + " std::map< int,CdiTaxis >::__setitem__(std::map< int,CdiTaxis >::key_type const &)\n" + " std::map< int,CdiTaxis >::__setitem__(std::map< int,CdiTaxis >::key_type const &,std::map< int,CdiTaxis >::mapped_type const &)\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_TaxesMap_asdict(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + PyObject *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_asdict" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); + result = (PyObject *)std_map_Sl_int_Sc_CdiTaxis_Sg__asdict(arg1); + resultobj = result; + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_TaxesMap__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) { + PyObject *resultobj = 0; + std::map< int,CdiTaxis > *result = 0 ; + + if ((nobjs < 0) || (nobjs > 0)) SWIG_fail; + result = (std::map< int,CdiTaxis > *)new std::map< int,CdiTaxis >(); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, SWIG_POINTER_NEW | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_TaxesMap__SWIG_2(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::map< int,CdiTaxis > *arg1 = 0 ; + int res1 = SWIG_OLDOBJ ; + std::map< int,CdiTaxis > *result = 0 ; + + if ((nobjs < 1) || (nobjs > 1)) SWIG_fail; + { + std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > > *ptr = (std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > > *)0; + res1 = swig::asptr(swig_obj[0], &ptr); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_TaxesMap" "', argument " "1"" of type '" "std::map< int,CdiTaxis > const &""'"); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_TaxesMap" "', argument " "1"" of type '" "std::map< int,CdiTaxis > const &""'"); + } + arg1 = ptr; + } + result = (std::map< int,CdiTaxis > *)new std::map< int,CdiTaxis >((std::map< int,CdiTaxis > const &)*arg1); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, SWIG_POINTER_NEW | 0 ); + if (SWIG_IsNewObj(res1)) delete arg1; + return resultobj; +fail: + if (SWIG_IsNewObj(res1)) delete arg1; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_TaxesMap(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[2] = { + 0 + }; + + if (!(argc = SWIG_Python_UnpackTuple(args, "new_TaxesMap", 0, 1, argv))) SWIG_fail; + --argc; + if (argc == 0) { + return _wrap_new_TaxesMap__SWIG_1(self, argc, argv); + } + if (argc == 1) { + int _v; + int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_std__lessT_int_t, SWIG_POINTER_NO_NULL | 0); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_new_TaxesMap__SWIG_0(self, argc, argv); + } + } + if (argc == 1) { + int _v; + int res = swig::asptr(argv[0], (std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_new_TaxesMap__SWIG_2(self, argc, argv); + } + } + +fail: + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'new_TaxesMap'.\n" + " Possible C/C++ prototypes are:\n" + " std::map< int,CdiTaxis >::map(std::less< int > const &)\n" + " std::map< int,CdiTaxis >::map()\n" + " std::map< int,CdiTaxis >::map(std::map< int,CdiTaxis > const &)\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_TaxesMap_empty(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + bool result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_empty" "', argument " "1"" of type '" "std::map< int,CdiTaxis > const *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); + result = (bool)((std::map< int,CdiTaxis > const *)arg1)->empty(); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_TaxesMap_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::map< int,CdiTaxis >::size_type result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_size" "', argument " "1"" of type '" "std::map< int,CdiTaxis > const *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); + result = ((std::map< int,CdiTaxis > const *)arg1)->size(); + resultobj = SWIG_From_size_t(static_cast< size_t >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_TaxesMap_swap(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; + std::map< int,CdiTaxis > *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "TaxesMap_swap", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_swap" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "TaxesMap_swap" "', argument " "2"" of type '" "std::map< int,CdiTaxis > &""'"); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "TaxesMap_swap" "', argument " "2"" of type '" "std::map< int,CdiTaxis > &""'"); + } + arg2 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp2); + (arg1)->swap(*arg2); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_TaxesMap_begin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::map< int,CdiTaxis >::iterator result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_begin" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); + result = (arg1)->begin(); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiTaxis >::iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_TaxesMap_end(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::map< int,CdiTaxis >::iterator result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_end" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); + result = (arg1)->end(); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiTaxis >::iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_TaxesMap_rbegin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::map< int,CdiTaxis >::reverse_iterator result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_rbegin" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); + result = (arg1)->rbegin(); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiTaxis >::reverse_iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_TaxesMap_rend(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::map< int,CdiTaxis >::reverse_iterator result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_rend" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); + result = (arg1)->rend(); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiTaxis >::reverse_iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_TaxesMap_clear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_clear" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); + (arg1)->clear(); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_TaxesMap_get_allocator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + SwigValueWrapper< std::allocator< std::pair< int const,CdiTaxis > > > result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_get_allocator" "', argument " "1"" of type '" "std::map< int,CdiTaxis > const *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); + result = ((std::map< int,CdiTaxis > const *)arg1)->get_allocator(); + resultobj = SWIG_NewPointerObj((new std::map< int,CdiTaxis >::allocator_type(static_cast< const std::map< int,CdiTaxis >::allocator_type& >(result))), SWIGTYPE_p_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_TaxesMap_erase__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; + std::map< int,CdiTaxis >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiTaxis >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + std::map< int,CdiTaxis >::size_type result; + + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_erase" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "TaxesMap_erase" "', argument " "2"" of type '" "std::map< int,CdiTaxis >::key_type""'"); + } + temp2 = static_cast< std::map< int,CdiTaxis >::key_type >(val2); + arg2 = &temp2; + result = (arg1)->erase((std::map< int,CdiTaxis >::key_type const &)*arg2); + resultobj = SWIG_From_size_t(static_cast< size_t >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_TaxesMap_count(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; + std::map< int,CdiTaxis >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiTaxis >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + std::map< int,CdiTaxis >::size_type result; + + if (!SWIG_Python_UnpackTuple(args, "TaxesMap_count", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_count" "', argument " "1"" of type '" "std::map< int,CdiTaxis > const *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "TaxesMap_count" "', argument " "2"" of type '" "std::map< int,CdiTaxis >::key_type""'"); + } + temp2 = static_cast< std::map< int,CdiTaxis >::key_type >(val2); + arg2 = &temp2; + result = ((std::map< int,CdiTaxis > const *)arg1)->count((std::map< int,CdiTaxis >::key_type const &)*arg2); + resultobj = SWIG_From_size_t(static_cast< size_t >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_TaxesMap_erase__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; + std::map< int,CdiTaxis >::iterator arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + swig::SwigPyIterator *iter2 = 0 ; + int res2 ; + + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_erase" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0); + if (!SWIG_IsOK(res2) || !iter2) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "TaxesMap_erase" "', argument " "2"" of type '" "std::map< int,CdiTaxis >::iterator""'"); + } else { + swig::SwigPyIterator_T<std::map< int,CdiTaxis >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiTaxis >::iterator > *>(iter2); + if (iter_t) { + arg2 = iter_t->get_current(); + } else { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "TaxesMap_erase" "', argument " "2"" of type '" "std::map< int,CdiTaxis >::iterator""'"); + } + } + std_map_Sl_int_Sc_CdiTaxis_Sg__erase__SWIG_1(arg1,arg2); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_TaxesMap_erase__SWIG_2(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; + std::map< int,CdiTaxis >::iterator arg2 ; + std::map< int,CdiTaxis >::iterator arg3 ; + void *argp1 = 0 ; + int res1 = 0 ; + swig::SwigPyIterator *iter2 = 0 ; + int res2 ; + swig::SwigPyIterator *iter3 = 0 ; + int res3 ; + + if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_erase" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0); + if (!SWIG_IsOK(res2) || !iter2) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "TaxesMap_erase" "', argument " "2"" of type '" "std::map< int,CdiTaxis >::iterator""'"); + } else { + swig::SwigPyIterator_T<std::map< int,CdiTaxis >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiTaxis >::iterator > *>(iter2); + if (iter_t) { + arg2 = iter_t->get_current(); + } else { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "TaxesMap_erase" "', argument " "2"" of type '" "std::map< int,CdiTaxis >::iterator""'"); + } + } + res3 = SWIG_ConvertPtr(swig_obj[2], SWIG_as_voidptrptr(&iter3), swig::SwigPyIterator::descriptor(), 0); + if (!SWIG_IsOK(res3) || !iter3) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "TaxesMap_erase" "', argument " "3"" of type '" "std::map< int,CdiTaxis >::iterator""'"); + } else { + swig::SwigPyIterator_T<std::map< int,CdiTaxis >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiTaxis >::iterator > *>(iter3); + if (iter_t) { + arg3 = iter_t->get_current(); + } else { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "TaxesMap_erase" "', argument " "3"" of type '" "std::map< int,CdiTaxis >::iterator""'"); + } + } + std_map_Sl_int_Sc_CdiTaxis_Sg__erase__SWIG_2(arg1,arg2,arg3); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_TaxesMap_erase(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[4] = { + 0 + }; + + if (!(argc = SWIG_Python_UnpackTuple(args, "TaxesMap_erase", 0, 3, argv))) SWIG_fail; + --argc; + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + swig::SwigPyIterator *iter = 0; + int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); + _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiTaxis >::iterator > *>(iter) != 0)); + if (_v) { + return _wrap_TaxesMap_erase__SWIG_1(self, argc, argv); + } + } + } + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_TaxesMap_erase__SWIG_0(self, argc, argv); + } + } + } + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + swig::SwigPyIterator *iter = 0; + int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); + _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiTaxis >::iterator > *>(iter) != 0)); + if (_v) { + swig::SwigPyIterator *iter = 0; + int res = SWIG_ConvertPtr(argv[2], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); + _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiTaxis >::iterator > *>(iter) != 0)); + if (_v) { + return _wrap_TaxesMap_erase__SWIG_2(self, argc, argv); + } + } + } + } + +fail: + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'TaxesMap_erase'.\n" + " Possible C/C++ prototypes are:\n" + " std::map< int,CdiTaxis >::erase(std::map< int,CdiTaxis >::key_type const &)\n" + " std::map< int,CdiTaxis >::erase(std::map< int,CdiTaxis >::iterator)\n" + " std::map< int,CdiTaxis >::erase(std::map< int,CdiTaxis >::iterator,std::map< int,CdiTaxis >::iterator)\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_TaxesMap_find(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; + std::map< int,CdiTaxis >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiTaxis >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + std::map< int,CdiTaxis >::iterator result; + + if (!SWIG_Python_UnpackTuple(args, "TaxesMap_find", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_find" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "TaxesMap_find" "', argument " "2"" of type '" "std::map< int,CdiTaxis >::key_type""'"); + } + temp2 = static_cast< std::map< int,CdiTaxis >::key_type >(val2); + arg2 = &temp2; + result = (arg1)->find((std::map< int,CdiTaxis >::key_type const &)*arg2); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiTaxis >::iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_TaxesMap_lower_bound(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; + std::map< int,CdiTaxis >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiTaxis >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + std::map< int,CdiTaxis >::iterator result; + + if (!SWIG_Python_UnpackTuple(args, "TaxesMap_lower_bound", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_lower_bound" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "TaxesMap_lower_bound" "', argument " "2"" of type '" "std::map< int,CdiTaxis >::key_type""'"); + } + temp2 = static_cast< std::map< int,CdiTaxis >::key_type >(val2); + arg2 = &temp2; + result = (arg1)->lower_bound((std::map< int,CdiTaxis >::key_type const &)*arg2); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiTaxis >::iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_TaxesMap_upper_bound(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; + std::map< int,CdiTaxis >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiTaxis >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + std::map< int,CdiTaxis >::iterator result; + + if (!SWIG_Python_UnpackTuple(args, "TaxesMap_upper_bound", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_upper_bound" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "TaxesMap_upper_bound" "', argument " "2"" of type '" "std::map< int,CdiTaxis >::key_type""'"); + } + temp2 = static_cast< std::map< int,CdiTaxis >::key_type >(val2); + arg2 = &temp2; + result = (arg1)->upper_bound((std::map< int,CdiTaxis >::key_type const &)*arg2); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiTaxis >::iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_delete_TaxesMap(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_TaxesMap" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); + delete arg1; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *TaxesMap_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *obj; + if (!SWIG_Python_UnpackTuple(args, "swigregister", 1, 1, &obj)) return NULL; + SWIG_TypeNewClientData(SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, SWIG_NewClientData(obj)); + return SWIG_Py_Void(); +} + +SWIGINTERN PyObject *TaxesMap_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + return SWIG_Python_InitShadowInstance(args); +} + +SWIGINTERN PyObject *_wrap_new_ZaxesMap__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::less< int > *arg1 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiZaxis > *result = 0 ; + + if ((nobjs < 1) || (nobjs > 1)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1, SWIGTYPE_p_std__lessT_int_t, 0 | 0); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_ZaxesMap" "', argument " "1"" of type '" "std::less< int > const &""'"); + } + if (!argp1) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_ZaxesMap" "', argument " "1"" of type '" "std::less< int > const &""'"); + } + arg1 = reinterpret_cast< std::less< int > * >(argp1); + result = (std::map< int,CdiZaxis > *)new std::map< int,CdiZaxis >((std::less< int > const &)*arg1); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, SWIG_POINTER_NEW | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ZaxesMap_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; + PyObject **arg2 = (PyObject **) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + swig::SwigPyIterator *result = 0 ; + + arg2 = &swig_obj[0]; + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_iterator" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); + result = (swig::SwigPyIterator *)std_map_Sl_int_Sc_CdiZaxis_Sg__iterator(arg1,arg2); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ZaxesMap___nonzero__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + bool result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap___nonzero__" "', argument " "1"" of type '" "std::map< int,CdiZaxis > const *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); + result = (bool)std_map_Sl_int_Sc_CdiZaxis_Sg____nonzero__((std::map< int,CdiZaxis > const *)arg1); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ZaxesMap___bool__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + bool result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap___bool__" "', argument " "1"" of type '" "std::map< int,CdiZaxis > const *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); + result = (bool)std_map_Sl_int_Sc_CdiZaxis_Sg____bool__((std::map< int,CdiZaxis > const *)arg1); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ZaxesMap___len__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::map< int,CdiZaxis >::size_type result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap___len__" "', argument " "1"" of type '" "std::map< int,CdiZaxis > const *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); + result = std_map_Sl_int_Sc_CdiZaxis_Sg____len__((std::map< int,CdiZaxis > const *)arg1); + resultobj = SWIG_From_size_t(static_cast< size_t >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ZaxesMap___getitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; + std::map< int,CdiZaxis >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiZaxis >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + std::map< int,CdiZaxis >::mapped_type *result = 0 ; + + if (!SWIG_Python_UnpackTuple(args, "ZaxesMap___getitem__", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap___getitem__" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ZaxesMap___getitem__" "', argument " "2"" of type '" "std::map< int,CdiZaxis >::key_type""'"); + } + temp2 = static_cast< std::map< int,CdiZaxis >::key_type >(val2); + arg2 = &temp2; + try { + result = (std::map< int,CdiZaxis >::mapped_type *) &std_map_Sl_int_Sc_CdiZaxis_Sg____getitem__(arg1,(int const &)*arg2); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CdiZaxis, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ZaxesMap___delitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; + std::map< int,CdiZaxis >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiZaxis >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "ZaxesMap___delitem__", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap___delitem__" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ZaxesMap___delitem__" "', argument " "2"" of type '" "std::map< int,CdiZaxis >::key_type""'"); + } + temp2 = static_cast< std::map< int,CdiZaxis >::key_type >(val2); + arg2 = &temp2; + try { + std_map_Sl_int_Sc_CdiZaxis_Sg____delitem__(arg1,(int const &)*arg2); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ZaxesMap_has_key(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; + std::map< int,CdiZaxis >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiZaxis >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + bool result; + + if (!SWIG_Python_UnpackTuple(args, "ZaxesMap_has_key", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_has_key" "', argument " "1"" of type '" "std::map< int,CdiZaxis > const *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ZaxesMap_has_key" "', argument " "2"" of type '" "std::map< int,CdiZaxis >::key_type""'"); + } + temp2 = static_cast< std::map< int,CdiZaxis >::key_type >(val2); + arg2 = &temp2; + result = (bool)std_map_Sl_int_Sc_CdiZaxis_Sg__has_key((std::map< int,CdiZaxis > const *)arg1,(int const &)*arg2); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ZaxesMap_keys(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + PyObject *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_keys" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); + result = (PyObject *)std_map_Sl_int_Sc_CdiZaxis_Sg__keys(arg1); + resultobj = result; + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ZaxesMap_values(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + PyObject *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_values" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); + result = (PyObject *)std_map_Sl_int_Sc_CdiZaxis_Sg__values(arg1); + resultobj = result; + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ZaxesMap_items(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + PyObject *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_items" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); + result = (PyObject *)std_map_Sl_int_Sc_CdiZaxis_Sg__items(arg1); + resultobj = result; + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ZaxesMap___contains__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; + std::map< int,CdiZaxis >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiZaxis >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + bool result; + + if (!SWIG_Python_UnpackTuple(args, "ZaxesMap___contains__", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap___contains__" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ZaxesMap___contains__" "', argument " "2"" of type '" "std::map< int,CdiZaxis >::key_type""'"); + } + temp2 = static_cast< std::map< int,CdiZaxis >::key_type >(val2); + arg2 = &temp2; + result = (bool)std_map_Sl_int_Sc_CdiZaxis_Sg____contains__(arg1,(int const &)*arg2); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ZaxesMap_key_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; + PyObject **arg2 = (PyObject **) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + swig::SwigPyIterator *result = 0 ; + + arg2 = &swig_obj[0]; + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_key_iterator" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); + result = (swig::SwigPyIterator *)std_map_Sl_int_Sc_CdiZaxis_Sg__key_iterator(arg1,arg2); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ZaxesMap_value_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; + PyObject **arg2 = (PyObject **) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + swig::SwigPyIterator *result = 0 ; + + arg2 = &swig_obj[0]; + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_value_iterator" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); + result = (swig::SwigPyIterator *)std_map_Sl_int_Sc_CdiZaxis_Sg__value_iterator(arg1,arg2); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ZaxesMap___setitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; + std::map< int,CdiZaxis >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiZaxis >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap___setitem__" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ZaxesMap___setitem__" "', argument " "2"" of type '" "std::map< int,CdiZaxis >::key_type""'"); + } + temp2 = static_cast< std::map< int,CdiZaxis >::key_type >(val2); + arg2 = &temp2; + std_map_Sl_int_Sc_CdiZaxis_Sg____setitem____SWIG_0(arg1,(int const &)*arg2); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ZaxesMap___setitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; + std::map< int,CdiZaxis >::key_type *arg2 = 0 ; + std::map< int,CdiZaxis >::mapped_type *arg3 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiZaxis >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + void *argp3 = 0 ; + int res3 = 0 ; + + if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap___setitem__" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ZaxesMap___setitem__" "', argument " "2"" of type '" "std::map< int,CdiZaxis >::key_type""'"); + } + temp2 = static_cast< std::map< int,CdiZaxis >::key_type >(val2); + arg2 = &temp2; + res3 = SWIG_ConvertPtr(swig_obj[2], &argp3, SWIGTYPE_p_CdiZaxis, 0 | 0); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ZaxesMap___setitem__" "', argument " "3"" of type '" "std::map< int,CdiZaxis >::mapped_type const &""'"); + } + if (!argp3) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "ZaxesMap___setitem__" "', argument " "3"" of type '" "std::map< int,CdiZaxis >::mapped_type const &""'"); + } + arg3 = reinterpret_cast< std::map< int,CdiZaxis >::mapped_type * >(argp3); + try { + std_map_Sl_int_Sc_CdiZaxis_Sg____setitem____SWIG_1(arg1,(int const &)*arg2,(CdiZaxis const &)*arg3); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ZaxesMap___setitem__(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[4] = { + 0 + }; + + if (!(argc = SWIG_Python_UnpackTuple(args, "ZaxesMap___setitem__", 0, 3, argv))) SWIG_fail; + --argc; + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_ZaxesMap___setitem____SWIG_0(self, argc, argv); + } + } + } + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + int res = SWIG_ConvertPtr(argv[2], 0, SWIGTYPE_p_CdiZaxis, SWIG_POINTER_NO_NULL | 0); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_ZaxesMap___setitem____SWIG_1(self, argc, argv); + } + } + } + } + +fail: + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'ZaxesMap___setitem__'.\n" + " Possible C/C++ prototypes are:\n" + " std::map< int,CdiZaxis >::__setitem__(std::map< int,CdiZaxis >::key_type const &)\n" + " std::map< int,CdiZaxis >::__setitem__(std::map< int,CdiZaxis >::key_type const &,std::map< int,CdiZaxis >::mapped_type const &)\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_ZaxesMap_asdict(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + PyObject *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_asdict" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); + result = (PyObject *)std_map_Sl_int_Sc_CdiZaxis_Sg__asdict(arg1); + resultobj = result; + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_ZaxesMap__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) { + PyObject *resultobj = 0; + std::map< int,CdiZaxis > *result = 0 ; + + if ((nobjs < 0) || (nobjs > 0)) SWIG_fail; + result = (std::map< int,CdiZaxis > *)new std::map< int,CdiZaxis >(); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, SWIG_POINTER_NEW | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_ZaxesMap__SWIG_2(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::map< int,CdiZaxis > *arg1 = 0 ; + int res1 = SWIG_OLDOBJ ; + std::map< int,CdiZaxis > *result = 0 ; + + if ((nobjs < 1) || (nobjs > 1)) SWIG_fail; + { + std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > > *ptr = (std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > > *)0; + res1 = swig::asptr(swig_obj[0], &ptr); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_ZaxesMap" "', argument " "1"" of type '" "std::map< int,CdiZaxis > const &""'"); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_ZaxesMap" "', argument " "1"" of type '" "std::map< int,CdiZaxis > const &""'"); + } + arg1 = ptr; + } + result = (std::map< int,CdiZaxis > *)new std::map< int,CdiZaxis >((std::map< int,CdiZaxis > const &)*arg1); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, SWIG_POINTER_NEW | 0 ); + if (SWIG_IsNewObj(res1)) delete arg1; + return resultobj; +fail: + if (SWIG_IsNewObj(res1)) delete arg1; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_ZaxesMap(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[2] = { + 0 + }; + + if (!(argc = SWIG_Python_UnpackTuple(args, "new_ZaxesMap", 0, 1, argv))) SWIG_fail; + --argc; + if (argc == 0) { + return _wrap_new_ZaxesMap__SWIG_1(self, argc, argv); + } + if (argc == 1) { + int _v; + int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_std__lessT_int_t, SWIG_POINTER_NO_NULL | 0); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_new_ZaxesMap__SWIG_0(self, argc, argv); + } + } + if (argc == 1) { + int _v; + int res = swig::asptr(argv[0], (std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_new_ZaxesMap__SWIG_2(self, argc, argv); + } + } + +fail: + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'new_ZaxesMap'.\n" + " Possible C/C++ prototypes are:\n" + " std::map< int,CdiZaxis >::map(std::less< int > const &)\n" + " std::map< int,CdiZaxis >::map()\n" + " std::map< int,CdiZaxis >::map(std::map< int,CdiZaxis > const &)\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_ZaxesMap_empty(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + bool result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_empty" "', argument " "1"" of type '" "std::map< int,CdiZaxis > const *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); + result = (bool)((std::map< int,CdiZaxis > const *)arg1)->empty(); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ZaxesMap_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::map< int,CdiZaxis >::size_type result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_size" "', argument " "1"" of type '" "std::map< int,CdiZaxis > const *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); + result = ((std::map< int,CdiZaxis > const *)arg1)->size(); + resultobj = SWIG_From_size_t(static_cast< size_t >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ZaxesMap_swap(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; + std::map< int,CdiZaxis > *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "ZaxesMap_swap", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_swap" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ZaxesMap_swap" "', argument " "2"" of type '" "std::map< int,CdiZaxis > &""'"); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "ZaxesMap_swap" "', argument " "2"" of type '" "std::map< int,CdiZaxis > &""'"); + } + arg2 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp2); + (arg1)->swap(*arg2); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ZaxesMap_begin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::map< int,CdiZaxis >::iterator result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_begin" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); + result = (arg1)->begin(); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiZaxis >::iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ZaxesMap_end(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::map< int,CdiZaxis >::iterator result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_end" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); + result = (arg1)->end(); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiZaxis >::iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ZaxesMap_rbegin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::map< int,CdiZaxis >::reverse_iterator result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_rbegin" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); + result = (arg1)->rbegin(); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiZaxis >::reverse_iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ZaxesMap_rend(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::map< int,CdiZaxis >::reverse_iterator result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_rend" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); + result = (arg1)->rend(); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiZaxis >::reverse_iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ZaxesMap_clear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_clear" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); + (arg1)->clear(); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ZaxesMap_get_allocator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + SwigValueWrapper< std::allocator< std::pair< int const,CdiZaxis > > > result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_get_allocator" "', argument " "1"" of type '" "std::map< int,CdiZaxis > const *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); + result = ((std::map< int,CdiZaxis > const *)arg1)->get_allocator(); + resultobj = SWIG_NewPointerObj((new std::map< int,CdiZaxis >::allocator_type(static_cast< const std::map< int,CdiZaxis >::allocator_type& >(result))), SWIGTYPE_p_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ZaxesMap_erase__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; + std::map< int,CdiZaxis >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiZaxis >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + std::map< int,CdiZaxis >::size_type result; + + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_erase" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ZaxesMap_erase" "', argument " "2"" of type '" "std::map< int,CdiZaxis >::key_type""'"); + } + temp2 = static_cast< std::map< int,CdiZaxis >::key_type >(val2); + arg2 = &temp2; + result = (arg1)->erase((std::map< int,CdiZaxis >::key_type const &)*arg2); + resultobj = SWIG_From_size_t(static_cast< size_t >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ZaxesMap_count(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; + std::map< int,CdiZaxis >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiZaxis >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + std::map< int,CdiZaxis >::size_type result; + + if (!SWIG_Python_UnpackTuple(args, "ZaxesMap_count", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_count" "', argument " "1"" of type '" "std::map< int,CdiZaxis > const *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ZaxesMap_count" "', argument " "2"" of type '" "std::map< int,CdiZaxis >::key_type""'"); + } + temp2 = static_cast< std::map< int,CdiZaxis >::key_type >(val2); + arg2 = &temp2; + result = ((std::map< int,CdiZaxis > const *)arg1)->count((std::map< int,CdiZaxis >::key_type const &)*arg2); + resultobj = SWIG_From_size_t(static_cast< size_t >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ZaxesMap_erase__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; + std::map< int,CdiZaxis >::iterator arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + swig::SwigPyIterator *iter2 = 0 ; + int res2 ; + + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_erase" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0); + if (!SWIG_IsOK(res2) || !iter2) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "ZaxesMap_erase" "', argument " "2"" of type '" "std::map< int,CdiZaxis >::iterator""'"); + } else { + swig::SwigPyIterator_T<std::map< int,CdiZaxis >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiZaxis >::iterator > *>(iter2); + if (iter_t) { + arg2 = iter_t->get_current(); + } else { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "ZaxesMap_erase" "', argument " "2"" of type '" "std::map< int,CdiZaxis >::iterator""'"); + } + } + std_map_Sl_int_Sc_CdiZaxis_Sg__erase__SWIG_1(arg1,arg2); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ZaxesMap_erase__SWIG_2(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; + std::map< int,CdiZaxis >::iterator arg2 ; + std::map< int,CdiZaxis >::iterator arg3 ; + void *argp1 = 0 ; + int res1 = 0 ; + swig::SwigPyIterator *iter2 = 0 ; + int res2 ; + swig::SwigPyIterator *iter3 = 0 ; + int res3 ; + + if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_erase" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0); + if (!SWIG_IsOK(res2) || !iter2) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "ZaxesMap_erase" "', argument " "2"" of type '" "std::map< int,CdiZaxis >::iterator""'"); + } else { + swig::SwigPyIterator_T<std::map< int,CdiZaxis >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiZaxis >::iterator > *>(iter2); + if (iter_t) { + arg2 = iter_t->get_current(); + } else { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "ZaxesMap_erase" "', argument " "2"" of type '" "std::map< int,CdiZaxis >::iterator""'"); + } + } + res3 = SWIG_ConvertPtr(swig_obj[2], SWIG_as_voidptrptr(&iter3), swig::SwigPyIterator::descriptor(), 0); + if (!SWIG_IsOK(res3) || !iter3) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "ZaxesMap_erase" "', argument " "3"" of type '" "std::map< int,CdiZaxis >::iterator""'"); + } else { + swig::SwigPyIterator_T<std::map< int,CdiZaxis >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiZaxis >::iterator > *>(iter3); + if (iter_t) { + arg3 = iter_t->get_current(); + } else { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "ZaxesMap_erase" "', argument " "3"" of type '" "std::map< int,CdiZaxis >::iterator""'"); + } + } + std_map_Sl_int_Sc_CdiZaxis_Sg__erase__SWIG_2(arg1,arg2,arg3); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ZaxesMap_erase(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[4] = { + 0 + }; + + if (!(argc = SWIG_Python_UnpackTuple(args, "ZaxesMap_erase", 0, 3, argv))) SWIG_fail; + --argc; + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + swig::SwigPyIterator *iter = 0; + int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); + _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiZaxis >::iterator > *>(iter) != 0)); + if (_v) { + return _wrap_ZaxesMap_erase__SWIG_1(self, argc, argv); + } + } + } + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_ZaxesMap_erase__SWIG_0(self, argc, argv); + } + } + } + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + swig::SwigPyIterator *iter = 0; + int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); + _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiZaxis >::iterator > *>(iter) != 0)); + if (_v) { + swig::SwigPyIterator *iter = 0; + int res = SWIG_ConvertPtr(argv[2], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); + _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiZaxis >::iterator > *>(iter) != 0)); + if (_v) { + return _wrap_ZaxesMap_erase__SWIG_2(self, argc, argv); + } + } + } + } + +fail: + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'ZaxesMap_erase'.\n" + " Possible C/C++ prototypes are:\n" + " std::map< int,CdiZaxis >::erase(std::map< int,CdiZaxis >::key_type const &)\n" + " std::map< int,CdiZaxis >::erase(std::map< int,CdiZaxis >::iterator)\n" + " std::map< int,CdiZaxis >::erase(std::map< int,CdiZaxis >::iterator,std::map< int,CdiZaxis >::iterator)\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_ZaxesMap_find(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; + std::map< int,CdiZaxis >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiZaxis >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + std::map< int,CdiZaxis >::iterator result; + + if (!SWIG_Python_UnpackTuple(args, "ZaxesMap_find", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_find" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ZaxesMap_find" "', argument " "2"" of type '" "std::map< int,CdiZaxis >::key_type""'"); + } + temp2 = static_cast< std::map< int,CdiZaxis >::key_type >(val2); + arg2 = &temp2; + result = (arg1)->find((std::map< int,CdiZaxis >::key_type const &)*arg2); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiZaxis >::iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ZaxesMap_lower_bound(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; + std::map< int,CdiZaxis >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiZaxis >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + std::map< int,CdiZaxis >::iterator result; + + if (!SWIG_Python_UnpackTuple(args, "ZaxesMap_lower_bound", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_lower_bound" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ZaxesMap_lower_bound" "', argument " "2"" of type '" "std::map< int,CdiZaxis >::key_type""'"); + } + temp2 = static_cast< std::map< int,CdiZaxis >::key_type >(val2); + arg2 = &temp2; + result = (arg1)->lower_bound((std::map< int,CdiZaxis >::key_type const &)*arg2); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiZaxis >::iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ZaxesMap_upper_bound(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; + std::map< int,CdiZaxis >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiZaxis >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + std::map< int,CdiZaxis >::iterator result; + + if (!SWIG_Python_UnpackTuple(args, "ZaxesMap_upper_bound", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_upper_bound" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ZaxesMap_upper_bound" "', argument " "2"" of type '" "std::map< int,CdiZaxis >::key_type""'"); + } + temp2 = static_cast< std::map< int,CdiZaxis >::key_type >(val2); + arg2 = &temp2; + result = (arg1)->upper_bound((std::map< int,CdiZaxis >::key_type const &)*arg2); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiZaxis >::iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_delete_ZaxesMap(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_ZaxesMap" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); + delete arg1; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *ZaxesMap_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *obj; + if (!SWIG_Python_UnpackTuple(args, "swigregister", 1, 1, &obj)) return NULL; + SWIG_TypeNewClientData(SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, SWIG_NewClientData(obj)); + return SWIG_Py_Void(); +} + +SWIGINTERN PyObject *ZaxesMap_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + return SWIG_Python_InitShadowInstance(args); +} + +SWIGINTERN PyObject *_wrap_new_GridsMap__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::less< int > *arg1 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiGrid > *result = 0 ; + + if ((nobjs < 1) || (nobjs > 1)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1, SWIGTYPE_p_std__lessT_int_t, 0 | 0); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_GridsMap" "', argument " "1"" of type '" "std::less< int > const &""'"); + } + if (!argp1) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_GridsMap" "', argument " "1"" of type '" "std::less< int > const &""'"); + } + arg1 = reinterpret_cast< std::less< int > * >(argp1); + result = (std::map< int,CdiGrid > *)new std::map< int,CdiGrid >((std::less< int > const &)*arg1); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, SWIG_POINTER_NEW | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_GridsMap_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; + PyObject **arg2 = (PyObject **) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + swig::SwigPyIterator *result = 0 ; + + arg2 = &swig_obj[0]; + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_iterator" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); + result = (swig::SwigPyIterator *)std_map_Sl_int_Sc_CdiGrid_Sg__iterator(arg1,arg2); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_GridsMap___nonzero__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + bool result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap___nonzero__" "', argument " "1"" of type '" "std::map< int,CdiGrid > const *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); + result = (bool)std_map_Sl_int_Sc_CdiGrid_Sg____nonzero__((std::map< int,CdiGrid > const *)arg1); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_GridsMap___bool__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + bool result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap___bool__" "', argument " "1"" of type '" "std::map< int,CdiGrid > const *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); + result = (bool)std_map_Sl_int_Sc_CdiGrid_Sg____bool__((std::map< int,CdiGrid > const *)arg1); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_GridsMap___len__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::map< int,CdiGrid >::size_type result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap___len__" "', argument " "1"" of type '" "std::map< int,CdiGrid > const *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); + result = std_map_Sl_int_Sc_CdiGrid_Sg____len__((std::map< int,CdiGrid > const *)arg1); + resultobj = SWIG_From_size_t(static_cast< size_t >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_GridsMap___getitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; + std::map< int,CdiGrid >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiGrid >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + std::map< int,CdiGrid >::mapped_type *result = 0 ; + + if (!SWIG_Python_UnpackTuple(args, "GridsMap___getitem__", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap___getitem__" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GridsMap___getitem__" "', argument " "2"" of type '" "std::map< int,CdiGrid >::key_type""'"); + } + temp2 = static_cast< std::map< int,CdiGrid >::key_type >(val2); + arg2 = &temp2; + try { + result = (std::map< int,CdiGrid >::mapped_type *) &std_map_Sl_int_Sc_CdiGrid_Sg____getitem__(arg1,(int const &)*arg2); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CdiGrid, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_GridsMap___delitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; + std::map< int,CdiGrid >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiGrid >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "GridsMap___delitem__", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap___delitem__" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GridsMap___delitem__" "', argument " "2"" of type '" "std::map< int,CdiGrid >::key_type""'"); + } + temp2 = static_cast< std::map< int,CdiGrid >::key_type >(val2); + arg2 = &temp2; + try { + std_map_Sl_int_Sc_CdiGrid_Sg____delitem__(arg1,(int const &)*arg2); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_GridsMap_has_key(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; + std::map< int,CdiGrid >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiGrid >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + bool result; + + if (!SWIG_Python_UnpackTuple(args, "GridsMap_has_key", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_has_key" "', argument " "1"" of type '" "std::map< int,CdiGrid > const *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GridsMap_has_key" "', argument " "2"" of type '" "std::map< int,CdiGrid >::key_type""'"); + } + temp2 = static_cast< std::map< int,CdiGrid >::key_type >(val2); + arg2 = &temp2; + result = (bool)std_map_Sl_int_Sc_CdiGrid_Sg__has_key((std::map< int,CdiGrid > const *)arg1,(int const &)*arg2); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_GridsMap_keys(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + PyObject *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_keys" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); + result = (PyObject *)std_map_Sl_int_Sc_CdiGrid_Sg__keys(arg1); + resultobj = result; + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_GridsMap_values(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + PyObject *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_values" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); + result = (PyObject *)std_map_Sl_int_Sc_CdiGrid_Sg__values(arg1); + resultobj = result; + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_GridsMap_items(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + PyObject *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_items" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); + result = (PyObject *)std_map_Sl_int_Sc_CdiGrid_Sg__items(arg1); + resultobj = result; + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_GridsMap___contains__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; + std::map< int,CdiGrid >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiGrid >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + bool result; + + if (!SWIG_Python_UnpackTuple(args, "GridsMap___contains__", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap___contains__" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GridsMap___contains__" "', argument " "2"" of type '" "std::map< int,CdiGrid >::key_type""'"); + } + temp2 = static_cast< std::map< int,CdiGrid >::key_type >(val2); + arg2 = &temp2; + result = (bool)std_map_Sl_int_Sc_CdiGrid_Sg____contains__(arg1,(int const &)*arg2); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_GridsMap_key_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; + PyObject **arg2 = (PyObject **) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + swig::SwigPyIterator *result = 0 ; + + arg2 = &swig_obj[0]; + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_key_iterator" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); + result = (swig::SwigPyIterator *)std_map_Sl_int_Sc_CdiGrid_Sg__key_iterator(arg1,arg2); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_GridsMap_value_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; + PyObject **arg2 = (PyObject **) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + swig::SwigPyIterator *result = 0 ; + + arg2 = &swig_obj[0]; + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_value_iterator" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); + result = (swig::SwigPyIterator *)std_map_Sl_int_Sc_CdiGrid_Sg__value_iterator(arg1,arg2); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_GridsMap___setitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; + std::map< int,CdiGrid >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiGrid >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap___setitem__" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GridsMap___setitem__" "', argument " "2"" of type '" "std::map< int,CdiGrid >::key_type""'"); + } + temp2 = static_cast< std::map< int,CdiGrid >::key_type >(val2); + arg2 = &temp2; + std_map_Sl_int_Sc_CdiGrid_Sg____setitem____SWIG_0(arg1,(int const &)*arg2); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_GridsMap___setitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; + std::map< int,CdiGrid >::key_type *arg2 = 0 ; + std::map< int,CdiGrid >::mapped_type *arg3 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiGrid >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + void *argp3 = 0 ; + int res3 = 0 ; + + if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap___setitem__" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GridsMap___setitem__" "', argument " "2"" of type '" "std::map< int,CdiGrid >::key_type""'"); + } + temp2 = static_cast< std::map< int,CdiGrid >::key_type >(val2); + arg2 = &temp2; + res3 = SWIG_ConvertPtr(swig_obj[2], &argp3, SWIGTYPE_p_CdiGrid, 0 | 0); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "GridsMap___setitem__" "', argument " "3"" of type '" "std::map< int,CdiGrid >::mapped_type const &""'"); + } + if (!argp3) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "GridsMap___setitem__" "', argument " "3"" of type '" "std::map< int,CdiGrid >::mapped_type const &""'"); + } + arg3 = reinterpret_cast< std::map< int,CdiGrid >::mapped_type * >(argp3); + try { + std_map_Sl_int_Sc_CdiGrid_Sg____setitem____SWIG_1(arg1,(int const &)*arg2,(CdiGrid const &)*arg3); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_GridsMap___setitem__(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[4] = { + 0 + }; + + if (!(argc = SWIG_Python_UnpackTuple(args, "GridsMap___setitem__", 0, 3, argv))) SWIG_fail; + --argc; + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_GridsMap___setitem____SWIG_0(self, argc, argv); + } + } + } + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + int res = SWIG_ConvertPtr(argv[2], 0, SWIGTYPE_p_CdiGrid, SWIG_POINTER_NO_NULL | 0); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_GridsMap___setitem____SWIG_1(self, argc, argv); + } + } + } + } + +fail: + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'GridsMap___setitem__'.\n" + " Possible C/C++ prototypes are:\n" + " std::map< int,CdiGrid >::__setitem__(std::map< int,CdiGrid >::key_type const &)\n" + " std::map< int,CdiGrid >::__setitem__(std::map< int,CdiGrid >::key_type const &,std::map< int,CdiGrid >::mapped_type const &)\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_GridsMap_asdict(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + PyObject *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_asdict" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); + result = (PyObject *)std_map_Sl_int_Sc_CdiGrid_Sg__asdict(arg1); + resultobj = result; + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_GridsMap__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) { + PyObject *resultobj = 0; + std::map< int,CdiGrid > *result = 0 ; + + if ((nobjs < 0) || (nobjs > 0)) SWIG_fail; + result = (std::map< int,CdiGrid > *)new std::map< int,CdiGrid >(); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, SWIG_POINTER_NEW | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_GridsMap__SWIG_2(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::map< int,CdiGrid > *arg1 = 0 ; + int res1 = SWIG_OLDOBJ ; + std::map< int,CdiGrid > *result = 0 ; + + if ((nobjs < 1) || (nobjs > 1)) SWIG_fail; + { + std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > > *ptr = (std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > > *)0; + res1 = swig::asptr(swig_obj[0], &ptr); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_GridsMap" "', argument " "1"" of type '" "std::map< int,CdiGrid > const &""'"); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_GridsMap" "', argument " "1"" of type '" "std::map< int,CdiGrid > const &""'"); + } + arg1 = ptr; + } + result = (std::map< int,CdiGrid > *)new std::map< int,CdiGrid >((std::map< int,CdiGrid > const &)*arg1); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, SWIG_POINTER_NEW | 0 ); + if (SWIG_IsNewObj(res1)) delete arg1; + return resultobj; +fail: + if (SWIG_IsNewObj(res1)) delete arg1; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_GridsMap(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[2] = { + 0 + }; + + if (!(argc = SWIG_Python_UnpackTuple(args, "new_GridsMap", 0, 1, argv))) SWIG_fail; + --argc; + if (argc == 0) { + return _wrap_new_GridsMap__SWIG_1(self, argc, argv); + } + if (argc == 1) { + int _v; + int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_std__lessT_int_t, SWIG_POINTER_NO_NULL | 0); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_new_GridsMap__SWIG_0(self, argc, argv); + } + } + if (argc == 1) { + int _v; + int res = swig::asptr(argv[0], (std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_new_GridsMap__SWIG_2(self, argc, argv); + } + } + +fail: + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'new_GridsMap'.\n" + " Possible C/C++ prototypes are:\n" + " std::map< int,CdiGrid >::map(std::less< int > const &)\n" + " std::map< int,CdiGrid >::map()\n" + " std::map< int,CdiGrid >::map(std::map< int,CdiGrid > const &)\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_GridsMap_empty(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + bool result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_empty" "', argument " "1"" of type '" "std::map< int,CdiGrid > const *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); + result = (bool)((std::map< int,CdiGrid > const *)arg1)->empty(); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_GridsMap_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::map< int,CdiGrid >::size_type result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_size" "', argument " "1"" of type '" "std::map< int,CdiGrid > const *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); + result = ((std::map< int,CdiGrid > const *)arg1)->size(); + resultobj = SWIG_From_size_t(static_cast< size_t >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_GridsMap_swap(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; + std::map< int,CdiGrid > *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "GridsMap_swap", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_swap" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "GridsMap_swap" "', argument " "2"" of type '" "std::map< int,CdiGrid > &""'"); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "GridsMap_swap" "', argument " "2"" of type '" "std::map< int,CdiGrid > &""'"); + } + arg2 = reinterpret_cast< std::map< int,CdiGrid > * >(argp2); + (arg1)->swap(*arg2); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_GridsMap_begin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::map< int,CdiGrid >::iterator result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_begin" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); + result = (arg1)->begin(); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiGrid >::iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_GridsMap_end(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::map< int,CdiGrid >::iterator result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_end" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); + result = (arg1)->end(); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiGrid >::iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_GridsMap_rbegin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::map< int,CdiGrid >::reverse_iterator result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_rbegin" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); + result = (arg1)->rbegin(); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiGrid >::reverse_iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_GridsMap_rend(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::map< int,CdiGrid >::reverse_iterator result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_rend" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); + result = (arg1)->rend(); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiGrid >::reverse_iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_GridsMap_clear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_clear" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); + (arg1)->clear(); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_GridsMap_get_allocator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + SwigValueWrapper< std::allocator< std::pair< int const,CdiGrid > > > result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_get_allocator" "', argument " "1"" of type '" "std::map< int,CdiGrid > const *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); + result = ((std::map< int,CdiGrid > const *)arg1)->get_allocator(); + resultobj = SWIG_NewPointerObj((new std::map< int,CdiGrid >::allocator_type(static_cast< const std::map< int,CdiGrid >::allocator_type& >(result))), SWIGTYPE_p_std__allocatorT_std__pairT_int_const_CdiGrid_t_t, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_GridsMap_erase__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; + std::map< int,CdiGrid >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiGrid >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + std::map< int,CdiGrid >::size_type result; + + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_erase" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GridsMap_erase" "', argument " "2"" of type '" "std::map< int,CdiGrid >::key_type""'"); + } + temp2 = static_cast< std::map< int,CdiGrid >::key_type >(val2); + arg2 = &temp2; + result = (arg1)->erase((std::map< int,CdiGrid >::key_type const &)*arg2); + resultobj = SWIG_From_size_t(static_cast< size_t >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_GridsMap_count(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; + std::map< int,CdiGrid >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiGrid >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + std::map< int,CdiGrid >::size_type result; + + if (!SWIG_Python_UnpackTuple(args, "GridsMap_count", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_count" "', argument " "1"" of type '" "std::map< int,CdiGrid > const *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GridsMap_count" "', argument " "2"" of type '" "std::map< int,CdiGrid >::key_type""'"); + } + temp2 = static_cast< std::map< int,CdiGrid >::key_type >(val2); + arg2 = &temp2; + result = ((std::map< int,CdiGrid > const *)arg1)->count((std::map< int,CdiGrid >::key_type const &)*arg2); + resultobj = SWIG_From_size_t(static_cast< size_t >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_GridsMap_erase__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; + std::map< int,CdiGrid >::iterator arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + swig::SwigPyIterator *iter2 = 0 ; + int res2 ; + + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_erase" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0); + if (!SWIG_IsOK(res2) || !iter2) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "GridsMap_erase" "', argument " "2"" of type '" "std::map< int,CdiGrid >::iterator""'"); + } else { + swig::SwigPyIterator_T<std::map< int,CdiGrid >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiGrid >::iterator > *>(iter2); + if (iter_t) { + arg2 = iter_t->get_current(); + } else { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "GridsMap_erase" "', argument " "2"" of type '" "std::map< int,CdiGrid >::iterator""'"); + } + } + std_map_Sl_int_Sc_CdiGrid_Sg__erase__SWIG_1(arg1,arg2); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_GridsMap_erase__SWIG_2(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; + std::map< int,CdiGrid >::iterator arg2 ; + std::map< int,CdiGrid >::iterator arg3 ; + void *argp1 = 0 ; + int res1 = 0 ; + swig::SwigPyIterator *iter2 = 0 ; + int res2 ; + swig::SwigPyIterator *iter3 = 0 ; + int res3 ; + + if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_erase" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0); + if (!SWIG_IsOK(res2) || !iter2) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "GridsMap_erase" "', argument " "2"" of type '" "std::map< int,CdiGrid >::iterator""'"); + } else { + swig::SwigPyIterator_T<std::map< int,CdiGrid >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiGrid >::iterator > *>(iter2); + if (iter_t) { + arg2 = iter_t->get_current(); + } else { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "GridsMap_erase" "', argument " "2"" of type '" "std::map< int,CdiGrid >::iterator""'"); + } + } + res3 = SWIG_ConvertPtr(swig_obj[2], SWIG_as_voidptrptr(&iter3), swig::SwigPyIterator::descriptor(), 0); + if (!SWIG_IsOK(res3) || !iter3) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "GridsMap_erase" "', argument " "3"" of type '" "std::map< int,CdiGrid >::iterator""'"); + } else { + swig::SwigPyIterator_T<std::map< int,CdiGrid >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiGrid >::iterator > *>(iter3); + if (iter_t) { + arg3 = iter_t->get_current(); + } else { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "GridsMap_erase" "', argument " "3"" of type '" "std::map< int,CdiGrid >::iterator""'"); + } + } + std_map_Sl_int_Sc_CdiGrid_Sg__erase__SWIG_2(arg1,arg2,arg3); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_GridsMap_erase(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[4] = { + 0 + }; + + if (!(argc = SWIG_Python_UnpackTuple(args, "GridsMap_erase", 0, 3, argv))) SWIG_fail; + --argc; + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + swig::SwigPyIterator *iter = 0; + int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); + _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiGrid >::iterator > *>(iter) != 0)); + if (_v) { + return _wrap_GridsMap_erase__SWIG_1(self, argc, argv); + } + } + } + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_GridsMap_erase__SWIG_0(self, argc, argv); + } + } + } + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + swig::SwigPyIterator *iter = 0; + int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); + _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiGrid >::iterator > *>(iter) != 0)); + if (_v) { + swig::SwigPyIterator *iter = 0; + int res = SWIG_ConvertPtr(argv[2], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); + _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiGrid >::iterator > *>(iter) != 0)); + if (_v) { + return _wrap_GridsMap_erase__SWIG_2(self, argc, argv); + } + } + } + } + +fail: + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'GridsMap_erase'.\n" + " Possible C/C++ prototypes are:\n" + " std::map< int,CdiGrid >::erase(std::map< int,CdiGrid >::key_type const &)\n" + " std::map< int,CdiGrid >::erase(std::map< int,CdiGrid >::iterator)\n" + " std::map< int,CdiGrid >::erase(std::map< int,CdiGrid >::iterator,std::map< int,CdiGrid >::iterator)\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_GridsMap_find(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; + std::map< int,CdiGrid >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiGrid >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + std::map< int,CdiGrid >::iterator result; + + if (!SWIG_Python_UnpackTuple(args, "GridsMap_find", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_find" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GridsMap_find" "', argument " "2"" of type '" "std::map< int,CdiGrid >::key_type""'"); + } + temp2 = static_cast< std::map< int,CdiGrid >::key_type >(val2); + arg2 = &temp2; + result = (arg1)->find((std::map< int,CdiGrid >::key_type const &)*arg2); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiGrid >::iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_GridsMap_lower_bound(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; + std::map< int,CdiGrid >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiGrid >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + std::map< int,CdiGrid >::iterator result; + + if (!SWIG_Python_UnpackTuple(args, "GridsMap_lower_bound", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_lower_bound" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GridsMap_lower_bound" "', argument " "2"" of type '" "std::map< int,CdiGrid >::key_type""'"); + } + temp2 = static_cast< std::map< int,CdiGrid >::key_type >(val2); + arg2 = &temp2; + result = (arg1)->lower_bound((std::map< int,CdiGrid >::key_type const &)*arg2); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiGrid >::iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_GridsMap_upper_bound(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; + std::map< int,CdiGrid >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiGrid >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + std::map< int,CdiGrid >::iterator result; + + if (!SWIG_Python_UnpackTuple(args, "GridsMap_upper_bound", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_upper_bound" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GridsMap_upper_bound" "', argument " "2"" of type '" "std::map< int,CdiGrid >::key_type""'"); + } + temp2 = static_cast< std::map< int,CdiGrid >::key_type >(val2); + arg2 = &temp2; + result = (arg1)->upper_bound((std::map< int,CdiGrid >::key_type const &)*arg2); + resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiGrid >::iterator & >(result)), + swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_delete_GridsMap(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_GridsMap" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); + } + arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); + delete arg1; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *GridsMap_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *obj; + if (!SWIG_Python_UnpackTuple(args, "swigregister", 1, 1, &obj)) return NULL; + SWIG_TypeNewClientData(SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, SWIG_NewClientData(obj)); + return SWIG_Py_Void(); +} + +SWIGINTERN PyObject *GridsMap_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + return SWIG_Python_InitShadowInstance(args); +} + +SWIGINTERN PyObject *_wrap_new_CdiGrid__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) { + PyObject *resultobj = 0; + CdiGrid *result = 0 ; + + if ((nobjs < 0) || (nobjs > 0)) SWIG_fail; + result = (CdiGrid *)new CdiGrid(); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CdiGrid, SWIG_POINTER_NEW | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_CdiGrid__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + int arg1 ; + int val1 ; + int ecode1 = 0 ; + CdiGrid *result = 0 ; + + if ((nobjs < 1) || (nobjs > 1)) SWIG_fail; + ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_CdiGrid" "', argument " "1"" of type '" "int""'"); + } + arg1 = static_cast< int >(val1); + result = (CdiGrid *)new CdiGrid(arg1); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CdiGrid, SWIG_POINTER_NEW | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_CdiGrid(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[2] = { + 0 + }; + + if (!(argc = SWIG_Python_UnpackTuple(args, "new_CdiGrid", 0, 1, argv))) SWIG_fail; + --argc; + if (argc == 0) { + return _wrap_new_CdiGrid__SWIG_0(self, argc, argv); + } + if (argc == 1) { + int _v; + { + int res = SWIG_AsVal_int(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_new_CdiGrid__SWIG_1(self, argc, argv); + } + } + +fail: + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'new_CdiGrid'.\n" + " Possible C/C++ prototypes are:\n" + " CdiGrid::CdiGrid()\n" + " CdiGrid::CdiGrid(int)\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_delete_CdiGrid(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiGrid *arg1 = (CdiGrid *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_CdiGrid" "', argument " "1"" of type '" "CdiGrid *""'"); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + delete arg1; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiGrid_gridID_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiGrid *arg1 = (CdiGrid *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiGrid_gridID_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_gridID_set" "', argument " "1"" of type '" "CdiGrid *""'"); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiGrid_gridID_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->gridID = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiGrid_gridID_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiGrid *arg1 = (CdiGrid *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + int result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_gridID_get" "', argument " "1"" of type '" "CdiGrid *""'"); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + result = (int) ((arg1)->gridID); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiGrid_type_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiGrid *arg1 = (CdiGrid *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiGrid_type_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_type_set" "', argument " "1"" of type '" "CdiGrid *""'"); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiGrid_type_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->type = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiGrid_type_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiGrid *arg1 = (CdiGrid *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + int result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_type_get" "', argument " "1"" of type '" "CdiGrid *""'"); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + result = (int) ((arg1)->type); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiGrid_size_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiGrid *arg1 = (CdiGrid *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiGrid_size_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_size_set" "', argument " "1"" of type '" "CdiGrid *""'"); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiGrid_size_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->size = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiGrid_size_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiGrid *arg1 = (CdiGrid *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + int result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_size_get" "', argument " "1"" of type '" "CdiGrid *""'"); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + result = (int) ((arg1)->size); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiGrid_xsize_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiGrid *arg1 = (CdiGrid *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiGrid_xsize_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_xsize_set" "', argument " "1"" of type '" "CdiGrid *""'"); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiGrid_xsize_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->xsize = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiGrid_xsize_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiGrid *arg1 = (CdiGrid *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + int result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_xsize_get" "', argument " "1"" of type '" "CdiGrid *""'"); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + result = (int) ((arg1)->xsize); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiGrid_ysize_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiGrid *arg1 = (CdiGrid *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiGrid_ysize_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_ysize_set" "', argument " "1"" of type '" "CdiGrid *""'"); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiGrid_ysize_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->ysize = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiGrid_ysize_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiGrid *arg1 = (CdiGrid *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + int result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_ysize_get" "', argument " "1"" of type '" "CdiGrid *""'"); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + result = (int) ((arg1)->ysize); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiGrid_prec_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiGrid *arg1 = (CdiGrid *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiGrid_prec_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_prec_set" "', argument " "1"" of type '" "CdiGrid *""'"); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiGrid_prec_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->prec = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiGrid_prec_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiGrid *arg1 = (CdiGrid *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + int result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_prec_get" "', argument " "1"" of type '" "CdiGrid *""'"); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + result = (int) ((arg1)->prec); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiGrid_ncorner_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiGrid *arg1 = (CdiGrid *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiGrid_ncorner_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_ncorner_set" "', argument " "1"" of type '" "CdiGrid *""'"); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiGrid_ncorner_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->ncorner = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiGrid_ncorner_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiGrid *arg1 = (CdiGrid *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + int result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_ncorner_get" "', argument " "1"" of type '" "CdiGrid *""'"); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + result = (int) ((arg1)->ncorner); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiGrid_hasXValues_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiGrid *arg1 = (CdiGrid *) 0 ; + bool arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + bool val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiGrid_hasXValues_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_hasXValues_set" "', argument " "1"" of type '" "CdiGrid *""'"); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + ecode2 = SWIG_AsVal_bool(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiGrid_hasXValues_set" "', argument " "2"" of type '" "bool""'"); + } + arg2 = static_cast< bool >(val2); + if (arg1) (arg1)->hasXValues = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiGrid_hasXValues_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiGrid *arg1 = (CdiGrid *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + bool result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_hasXValues_get" "', argument " "1"" of type '" "CdiGrid *""'"); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + result = (bool) ((arg1)->hasXValues); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiGrid_hasYValues_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiGrid *arg1 = (CdiGrid *) 0 ; + bool arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + bool val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiGrid_hasYValues_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_hasYValues_set" "', argument " "1"" of type '" "CdiGrid *""'"); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + ecode2 = SWIG_AsVal_bool(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiGrid_hasYValues_set" "', argument " "2"" of type '" "bool""'"); + } + arg2 = static_cast< bool >(val2); + if (arg1) (arg1)->hasYValues = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiGrid_hasYValues_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiGrid *arg1 = (CdiGrid *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + bool result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_hasYValues_get" "', argument " "1"" of type '" "CdiGrid *""'"); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + result = (bool) ((arg1)->hasYValues); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiGrid_hasBounds_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiGrid *arg1 = (CdiGrid *) 0 ; + bool arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + bool val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiGrid_hasBounds_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_hasBounds_set" "', argument " "1"" of type '" "CdiGrid *""'"); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + ecode2 = SWIG_AsVal_bool(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiGrid_hasBounds_set" "', argument " "2"" of type '" "bool""'"); + } + arg2 = static_cast< bool >(val2); + if (arg1) (arg1)->hasBounds = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiGrid_hasBounds_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiGrid *arg1 = (CdiGrid *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + bool result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_hasBounds_get" "', argument " "1"" of type '" "CdiGrid *""'"); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + result = (bool) ((arg1)->hasBounds); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiGrid_xvalues_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiGrid *arg1 = (CdiGrid *) 0 ; + std::vector< double,std::allocator< double > > *arg2 = (std::vector< double,std::allocator< double > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiGrid_xvalues_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_xvalues_set" "', argument " "1"" of type '" "CdiGrid *""'"); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiGrid_xvalues_set" "', argument " "2"" of type '" "std::vector< double,std::allocator< double > > *""'"); + } + arg2 = reinterpret_cast< std::vector< double,std::allocator< double > > * >(argp2); + if (arg1) (arg1)->xvalues = *arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiGrid_xvalues_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiGrid *arg1 = (CdiGrid *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::vector< double,std::allocator< double > > *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_xvalues_get" "', argument " "1"" of type '" "CdiGrid *""'"); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + result = (std::vector< double,std::allocator< double > > *)& ((arg1)->xvalues); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiGrid_yvalues_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiGrid *arg1 = (CdiGrid *) 0 ; + std::vector< double,std::allocator< double > > *arg2 = (std::vector< double,std::allocator< double > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiGrid_yvalues_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_yvalues_set" "', argument " "1"" of type '" "CdiGrid *""'"); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiGrid_yvalues_set" "', argument " "2"" of type '" "std::vector< double,std::allocator< double > > *""'"); + } + arg2 = reinterpret_cast< std::vector< double,std::allocator< double > > * >(argp2); + if (arg1) (arg1)->yvalues = *arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiGrid_yvalues_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiGrid *arg1 = (CdiGrid *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::vector< double,std::allocator< double > > *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_yvalues_get" "', argument " "1"" of type '" "CdiGrid *""'"); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + result = (std::vector< double,std::allocator< double > > *)& ((arg1)->yvalues); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiGrid_xbounds_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiGrid *arg1 = (CdiGrid *) 0 ; + std::vector< double,std::allocator< double > > *arg2 = (std::vector< double,std::allocator< double > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiGrid_xbounds_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_xbounds_set" "', argument " "1"" of type '" "CdiGrid *""'"); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiGrid_xbounds_set" "', argument " "2"" of type '" "std::vector< double,std::allocator< double > > *""'"); + } + arg2 = reinterpret_cast< std::vector< double,std::allocator< double > > * >(argp2); + if (arg1) (arg1)->xbounds = *arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiGrid_xbounds_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiGrid *arg1 = (CdiGrid *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::vector< double,std::allocator< double > > *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_xbounds_get" "', argument " "1"" of type '" "CdiGrid *""'"); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + result = (std::vector< double,std::allocator< double > > *)& ((arg1)->xbounds); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiGrid_ybounds_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiGrid *arg1 = (CdiGrid *) 0 ; + std::vector< double,std::allocator< double > > *arg2 = (std::vector< double,std::allocator< double > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiGrid_ybounds_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_ybounds_set" "', argument " "1"" of type '" "CdiGrid *""'"); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiGrid_ybounds_set" "', argument " "2"" of type '" "std::vector< double,std::allocator< double > > *""'"); + } + arg2 = reinterpret_cast< std::vector< double,std::allocator< double > > * >(argp2); + if (arg1) (arg1)->ybounds = *arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiGrid_ybounds_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiGrid *arg1 = (CdiGrid *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::vector< double,std::allocator< double > > *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_ybounds_get" "', argument " "1"" of type '" "CdiGrid *""'"); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + result = (std::vector< double,std::allocator< double > > *)& ((arg1)->ybounds); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiGrid_xname_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiGrid *arg1 = (CdiGrid *) 0 ; + std::string *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 = SWIG_OLDOBJ ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiGrid_xname_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_xname_set" "', argument " "1"" of type '" "CdiGrid *""'"); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + { + std::string *ptr = (std::string *)0; + res2 = SWIG_AsPtr_std_string(swig_obj[1], &ptr); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiGrid_xname_set" "', argument " "2"" of type '" "std::string const &""'"); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "CdiGrid_xname_set" "', argument " "2"" of type '" "std::string const &""'"); + } + arg2 = ptr; + } + if (arg1) (arg1)->xname = *arg2; + resultobj = SWIG_Py_Void(); + if (SWIG_IsNewObj(res2)) delete arg2; + return resultobj; +fail: + if (SWIG_IsNewObj(res2)) delete arg2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiGrid_xname_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiGrid *arg1 = (CdiGrid *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::string *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_xname_get" "', argument " "1"" of type '" "CdiGrid *""'"); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + result = (std::string *) & ((arg1)->xname); + resultobj = SWIG_From_std_string(static_cast< std::string >(*result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiGrid_xlongname_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiGrid *arg1 = (CdiGrid *) 0 ; + std::string *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 = SWIG_OLDOBJ ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiGrid_xlongname_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_xlongname_set" "', argument " "1"" of type '" "CdiGrid *""'"); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + { + std::string *ptr = (std::string *)0; + res2 = SWIG_AsPtr_std_string(swig_obj[1], &ptr); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiGrid_xlongname_set" "', argument " "2"" of type '" "std::string const &""'"); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "CdiGrid_xlongname_set" "', argument " "2"" of type '" "std::string const &""'"); + } + arg2 = ptr; + } + if (arg1) (arg1)->xlongname = *arg2; + resultobj = SWIG_Py_Void(); + if (SWIG_IsNewObj(res2)) delete arg2; + return resultobj; +fail: + if (SWIG_IsNewObj(res2)) delete arg2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiGrid_xlongname_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiGrid *arg1 = (CdiGrid *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::string *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_xlongname_get" "', argument " "1"" of type '" "CdiGrid *""'"); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + result = (std::string *) & ((arg1)->xlongname); + resultobj = SWIG_From_std_string(static_cast< std::string >(*result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiGrid_xstdname_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiGrid *arg1 = (CdiGrid *) 0 ; + std::string *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 = SWIG_OLDOBJ ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiGrid_xstdname_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_xstdname_set" "', argument " "1"" of type '" "CdiGrid *""'"); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + { + std::string *ptr = (std::string *)0; + res2 = SWIG_AsPtr_std_string(swig_obj[1], &ptr); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiGrid_xstdname_set" "', argument " "2"" of type '" "std::string const &""'"); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "CdiGrid_xstdname_set" "', argument " "2"" of type '" "std::string const &""'"); + } + arg2 = ptr; + } + if (arg1) (arg1)->xstdname = *arg2; + resultobj = SWIG_Py_Void(); + if (SWIG_IsNewObj(res2)) delete arg2; + return resultobj; +fail: + if (SWIG_IsNewObj(res2)) delete arg2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiGrid_xstdname_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiGrid *arg1 = (CdiGrid *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::string *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_xstdname_get" "', argument " "1"" of type '" "CdiGrid *""'"); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + result = (std::string *) & ((arg1)->xstdname); + resultobj = SWIG_From_std_string(static_cast< std::string >(*result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiGrid_xunits_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiGrid *arg1 = (CdiGrid *) 0 ; + std::string *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 = SWIG_OLDOBJ ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiGrid_xunits_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_xunits_set" "', argument " "1"" of type '" "CdiGrid *""'"); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + { + std::string *ptr = (std::string *)0; + res2 = SWIG_AsPtr_std_string(swig_obj[1], &ptr); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiGrid_xunits_set" "', argument " "2"" of type '" "std::string const &""'"); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "CdiGrid_xunits_set" "', argument " "2"" of type '" "std::string const &""'"); + } + arg2 = ptr; + } + if (arg1) (arg1)->xunits = *arg2; + resultobj = SWIG_Py_Void(); + if (SWIG_IsNewObj(res2)) delete arg2; + return resultobj; +fail: + if (SWIG_IsNewObj(res2)) delete arg2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiGrid_xunits_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiGrid *arg1 = (CdiGrid *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::string *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_xunits_get" "', argument " "1"" of type '" "CdiGrid *""'"); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + result = (std::string *) & ((arg1)->xunits); + resultobj = SWIG_From_std_string(static_cast< std::string >(*result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiGrid_yname_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiGrid *arg1 = (CdiGrid *) 0 ; + std::string *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 = SWIG_OLDOBJ ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiGrid_yname_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_yname_set" "', argument " "1"" of type '" "CdiGrid *""'"); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + { + std::string *ptr = (std::string *)0; + res2 = SWIG_AsPtr_std_string(swig_obj[1], &ptr); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiGrid_yname_set" "', argument " "2"" of type '" "std::string const &""'"); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "CdiGrid_yname_set" "', argument " "2"" of type '" "std::string const &""'"); + } + arg2 = ptr; + } + if (arg1) (arg1)->yname = *arg2; + resultobj = SWIG_Py_Void(); + if (SWIG_IsNewObj(res2)) delete arg2; + return resultobj; +fail: + if (SWIG_IsNewObj(res2)) delete arg2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiGrid_yname_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiGrid *arg1 = (CdiGrid *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::string *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_yname_get" "', argument " "1"" of type '" "CdiGrid *""'"); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + result = (std::string *) & ((arg1)->yname); + resultobj = SWIG_From_std_string(static_cast< std::string >(*result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiGrid_ylongname_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiGrid *arg1 = (CdiGrid *) 0 ; + std::string *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 = SWIG_OLDOBJ ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiGrid_ylongname_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_ylongname_set" "', argument " "1"" of type '" "CdiGrid *""'"); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + { + std::string *ptr = (std::string *)0; + res2 = SWIG_AsPtr_std_string(swig_obj[1], &ptr); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiGrid_ylongname_set" "', argument " "2"" of type '" "std::string const &""'"); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "CdiGrid_ylongname_set" "', argument " "2"" of type '" "std::string const &""'"); + } + arg2 = ptr; + } + if (arg1) (arg1)->ylongname = *arg2; + resultobj = SWIG_Py_Void(); + if (SWIG_IsNewObj(res2)) delete arg2; + return resultobj; +fail: + if (SWIG_IsNewObj(res2)) delete arg2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiGrid_ylongname_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiGrid *arg1 = (CdiGrid *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::string *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_ylongname_get" "', argument " "1"" of type '" "CdiGrid *""'"); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + result = (std::string *) & ((arg1)->ylongname); + resultobj = SWIG_From_std_string(static_cast< std::string >(*result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiGrid_ystdname_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiGrid *arg1 = (CdiGrid *) 0 ; + std::string *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 = SWIG_OLDOBJ ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiGrid_ystdname_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_ystdname_set" "', argument " "1"" of type '" "CdiGrid *""'"); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + { + std::string *ptr = (std::string *)0; + res2 = SWIG_AsPtr_std_string(swig_obj[1], &ptr); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiGrid_ystdname_set" "', argument " "2"" of type '" "std::string const &""'"); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "CdiGrid_ystdname_set" "', argument " "2"" of type '" "std::string const &""'"); + } + arg2 = ptr; + } + if (arg1) (arg1)->ystdname = *arg2; + resultobj = SWIG_Py_Void(); + if (SWIG_IsNewObj(res2)) delete arg2; + return resultobj; +fail: + if (SWIG_IsNewObj(res2)) delete arg2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiGrid_ystdname_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiGrid *arg1 = (CdiGrid *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::string *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_ystdname_get" "', argument " "1"" of type '" "CdiGrid *""'"); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + result = (std::string *) & ((arg1)->ystdname); + resultobj = SWIG_From_std_string(static_cast< std::string >(*result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiGrid_yunits_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiGrid *arg1 = (CdiGrid *) 0 ; + std::string *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 = SWIG_OLDOBJ ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiGrid_yunits_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_yunits_set" "', argument " "1"" of type '" "CdiGrid *""'"); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + { + std::string *ptr = (std::string *)0; + res2 = SWIG_AsPtr_std_string(swig_obj[1], &ptr); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiGrid_yunits_set" "', argument " "2"" of type '" "std::string const &""'"); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "CdiGrid_yunits_set" "', argument " "2"" of type '" "std::string const &""'"); + } + arg2 = ptr; + } + if (arg1) (arg1)->yunits = *arg2; + resultobj = SWIG_Py_Void(); + if (SWIG_IsNewObj(res2)) delete arg2; + return resultobj; +fail: + if (SWIG_IsNewObj(res2)) delete arg2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiGrid_yunits_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiGrid *arg1 = (CdiGrid *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::string *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_yunits_get" "', argument " "1"" of type '" "CdiGrid *""'"); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + result = (std::string *) & ((arg1)->yunits); + resultobj = SWIG_From_std_string(static_cast< std::string >(*result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiGrid_name_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiGrid *arg1 = (CdiGrid *) 0 ; + std::string *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 = SWIG_OLDOBJ ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiGrid_name_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_name_set" "', argument " "1"" of type '" "CdiGrid *""'"); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + { + std::string *ptr = (std::string *)0; + res2 = SWIG_AsPtr_std_string(swig_obj[1], &ptr); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiGrid_name_set" "', argument " "2"" of type '" "std::string const &""'"); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "CdiGrid_name_set" "', argument " "2"" of type '" "std::string const &""'"); + } + arg2 = ptr; + } + if (arg1) (arg1)->name = *arg2; + resultobj = SWIG_Py_Void(); + if (SWIG_IsNewObj(res2)) delete arg2; + return resultobj; +fail: + if (SWIG_IsNewObj(res2)) delete arg2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiGrid_name_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiGrid *arg1 = (CdiGrid *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::string *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_name_get" "', argument " "1"" of type '" "CdiGrid *""'"); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + result = (std::string *) & ((arg1)->name); + resultobj = SWIG_From_std_string(static_cast< std::string >(*result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiGrid_getValues(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiGrid *arg1 = (CdiGrid *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_getValues" "', argument " "1"" of type '" "CdiGrid *""'"); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + (arg1)->getValues(); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiGrid_getBounds(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiGrid *arg1 = (CdiGrid *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_getBounds" "', argument " "1"" of type '" "CdiGrid *""'"); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + (arg1)->getBounds(); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiGrid_getValuesAsPointer(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiGrid *arg1 = (CdiGrid *) 0 ; + double *arg2 = (double *) 0 ; + double *arg3 = (double *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + void *argp3 = 0 ; + int res3 = 0 ; + PyObject *swig_obj[3] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiGrid_getValuesAsPointer", 3, 3, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_getValuesAsPointer" "', argument " "1"" of type '" "CdiGrid *""'"); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_double, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiGrid_getValuesAsPointer" "', argument " "2"" of type '" "double *""'"); + } + arg2 = reinterpret_cast< double * >(argp2); + res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_double, 0 | 0 ); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CdiGrid_getValuesAsPointer" "', argument " "3"" of type '" "double *""'"); + } + arg3 = reinterpret_cast< double * >(argp3); + (arg1)->getValuesAsPointer(arg2,arg3); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiGrid_getBoundsAsPointer(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiGrid *arg1 = (CdiGrid *) 0 ; + double *arg2 = (double *) 0 ; + double *arg3 = (double *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + void *argp3 = 0 ; + int res3 = 0 ; + PyObject *swig_obj[3] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiGrid_getBoundsAsPointer", 3, 3, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_getBoundsAsPointer" "', argument " "1"" of type '" "CdiGrid *""'"); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_double, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiGrid_getBoundsAsPointer" "', argument " "2"" of type '" "double *""'"); + } + arg2 = reinterpret_cast< double * >(argp2); + res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_double, 0 | 0 ); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CdiGrid_getBoundsAsPointer" "', argument " "3"" of type '" "double *""'"); + } + arg3 = reinterpret_cast< double * >(argp3); + (arg1)->getBoundsAsPointer(arg2,arg3); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiGrid_getFloatVals(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiGrid *arg1 = (CdiGrid *) 0 ; + float *arg2 = (float *) 0 ; + float *arg3 = (float *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + void *argp3 = 0 ; + int res3 = 0 ; + PyObject *swig_obj[3] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiGrid_getFloatVals", 3, 3, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_getFloatVals" "', argument " "1"" of type '" "CdiGrid *""'"); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_float, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiGrid_getFloatVals" "', argument " "2"" of type '" "float *""'"); + } + arg2 = reinterpret_cast< float * >(argp2); + res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_float, 0 | 0 ); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CdiGrid_getFloatVals" "', argument " "3"" of type '" "float *""'"); + } + arg3 = reinterpret_cast< float * >(argp3); + (arg1)->getFloatVals(arg2,arg3); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiGrid_getFloatBounds(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiGrid *arg1 = (CdiGrid *) 0 ; + float *arg2 = (float *) 0 ; + float *arg3 = (float *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + void *argp3 = 0 ; + int res3 = 0 ; + PyObject *swig_obj[3] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiGrid_getFloatBounds", 3, 3, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_getFloatBounds" "', argument " "1"" of type '" "CdiGrid *""'"); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_float, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiGrid_getFloatBounds" "', argument " "2"" of type '" "float *""'"); + } + arg2 = reinterpret_cast< float * >(argp2); + res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_float, 0 | 0 ); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CdiGrid_getFloatBounds" "', argument " "3"" of type '" "float *""'"); + } + arg3 = reinterpret_cast< float * >(argp3); + (arg1)->getFloatBounds(arg2,arg3); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *CdiGrid_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *obj; + if (!SWIG_Python_UnpackTuple(args, "swigregister", 1, 1, &obj)) return NULL; + SWIG_TypeNewClientData(SWIGTYPE_p_CdiGrid, SWIG_NewClientData(obj)); + return SWIG_Py_Void(); +} + +SWIGINTERN PyObject *CdiGrid_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + return SWIG_Python_InitShadowInstance(args); +} + +SWIGINTERN PyObject *_wrap_new_CdiTaxis__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) { + PyObject *resultobj = 0; + CdiTaxis *result = 0 ; + + if ((nobjs < 0) || (nobjs > 0)) SWIG_fail; + result = (CdiTaxis *)new CdiTaxis(); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CdiTaxis, SWIG_POINTER_NEW | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_CdiTaxis__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + int arg1 ; + int val1 ; + int ecode1 = 0 ; + CdiTaxis *result = 0 ; + + if ((nobjs < 1) || (nobjs > 1)) SWIG_fail; + ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_CdiTaxis" "', argument " "1"" of type '" "int""'"); + } + arg1 = static_cast< int >(val1); + result = (CdiTaxis *)new CdiTaxis(arg1); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CdiTaxis, SWIG_POINTER_NEW | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_CdiTaxis(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[2] = { + 0 + }; + + if (!(argc = SWIG_Python_UnpackTuple(args, "new_CdiTaxis", 0, 1, argv))) SWIG_fail; + --argc; + if (argc == 0) { + return _wrap_new_CdiTaxis__SWIG_0(self, argc, argv); + } + if (argc == 1) { + int _v; + { + int res = SWIG_AsVal_int(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_new_CdiTaxis__SWIG_1(self, argc, argv); + } + } + +fail: + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'new_CdiTaxis'.\n" + " Possible C/C++ prototypes are:\n" + " CdiTaxis::CdiTaxis()\n" + " CdiTaxis::CdiTaxis(int)\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_delete_CdiTaxis(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiTaxis *arg1 = (CdiTaxis *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiTaxis, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_CdiTaxis" "', argument " "1"" of type '" "CdiTaxis *""'"); + } + arg1 = reinterpret_cast< CdiTaxis * >(argp1); + delete arg1; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiTaxis_taxisID_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiTaxis *arg1 = (CdiTaxis *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiTaxis_taxisID_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiTaxis_taxisID_set" "', argument " "1"" of type '" "CdiTaxis *""'"); + } + arg1 = reinterpret_cast< CdiTaxis * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiTaxis_taxisID_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->taxisID = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiTaxis_taxisID_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiTaxis *arg1 = (CdiTaxis *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + int result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiTaxis_taxisID_get" "', argument " "1"" of type '" "CdiTaxis *""'"); + } + arg1 = reinterpret_cast< CdiTaxis * >(argp1); + result = (int) ((arg1)->taxisID); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiTaxis_ntsteps_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiTaxis *arg1 = (CdiTaxis *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiTaxis_ntsteps_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiTaxis_ntsteps_set" "', argument " "1"" of type '" "CdiTaxis *""'"); + } + arg1 = reinterpret_cast< CdiTaxis * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiTaxis_ntsteps_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->ntsteps = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiTaxis_ntsteps_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiTaxis *arg1 = (CdiTaxis *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + int result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiTaxis_ntsteps_get" "', argument " "1"" of type '" "CdiTaxis *""'"); + } + arg1 = reinterpret_cast< CdiTaxis * >(argp1); + result = (int) ((arg1)->ntsteps); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiTaxis_unit_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiTaxis *arg1 = (CdiTaxis *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiTaxis_unit_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiTaxis_unit_set" "', argument " "1"" of type '" "CdiTaxis *""'"); + } + arg1 = reinterpret_cast< CdiTaxis * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiTaxis_unit_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->unit = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiTaxis_unit_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiTaxis *arg1 = (CdiTaxis *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + int result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiTaxis_unit_get" "', argument " "1"" of type '" "CdiTaxis *""'"); + } + arg1 = reinterpret_cast< CdiTaxis * >(argp1); + result = (int) ((arg1)->unit); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiTaxis_rdate_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiTaxis *arg1 = (CdiTaxis *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiTaxis_rdate_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiTaxis_rdate_set" "', argument " "1"" of type '" "CdiTaxis *""'"); + } + arg1 = reinterpret_cast< CdiTaxis * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiTaxis_rdate_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->rdate = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiTaxis_rdate_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiTaxis *arg1 = (CdiTaxis *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + int result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiTaxis_rdate_get" "', argument " "1"" of type '" "CdiTaxis *""'"); + } + arg1 = reinterpret_cast< CdiTaxis * >(argp1); + result = (int) ((arg1)->rdate); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiTaxis_rtime_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiTaxis *arg1 = (CdiTaxis *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiTaxis_rtime_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiTaxis_rtime_set" "', argument " "1"" of type '" "CdiTaxis *""'"); + } + arg1 = reinterpret_cast< CdiTaxis * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiTaxis_rtime_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->rtime = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiTaxis_rtime_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiTaxis *arg1 = (CdiTaxis *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + int result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiTaxis_rtime_get" "', argument " "1"" of type '" "CdiTaxis *""'"); + } + arg1 = reinterpret_cast< CdiTaxis * >(argp1); + result = (int) ((arg1)->rtime); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiTaxis_vdate_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiTaxis *arg1 = (CdiTaxis *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiTaxis_vdate_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiTaxis_vdate_set" "', argument " "1"" of type '" "CdiTaxis *""'"); + } + arg1 = reinterpret_cast< CdiTaxis * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiTaxis_vdate_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->vdate = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiTaxis_vdate_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiTaxis *arg1 = (CdiTaxis *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + int result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiTaxis_vdate_get" "', argument " "1"" of type '" "CdiTaxis *""'"); + } + arg1 = reinterpret_cast< CdiTaxis * >(argp1); + result = (int) ((arg1)->vdate); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiTaxis_vtime_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiTaxis *arg1 = (CdiTaxis *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiTaxis_vtime_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiTaxis_vtime_set" "', argument " "1"" of type '" "CdiTaxis *""'"); + } + arg1 = reinterpret_cast< CdiTaxis * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiTaxis_vtime_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->vtime = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiTaxis_vtime_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiTaxis *arg1 = (CdiTaxis *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + int result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiTaxis_vtime_get" "', argument " "1"" of type '" "CdiTaxis *""'"); + } + arg1 = reinterpret_cast< CdiTaxis * >(argp1); + result = (int) ((arg1)->vtime); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiTaxis_type_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiTaxis *arg1 = (CdiTaxis *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiTaxis_type_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiTaxis_type_set" "', argument " "1"" of type '" "CdiTaxis *""'"); + } + arg1 = reinterpret_cast< CdiTaxis * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiTaxis_type_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->type = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiTaxis_type_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiTaxis *arg1 = (CdiTaxis *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + int result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiTaxis_type_get" "', argument " "1"" of type '" "CdiTaxis *""'"); + } + arg1 = reinterpret_cast< CdiTaxis * >(argp1); + result = (int) ((arg1)->type); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiTaxis_calendar_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiTaxis *arg1 = (CdiTaxis *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiTaxis_calendar_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiTaxis_calendar_set" "', argument " "1"" of type '" "CdiTaxis *""'"); + } + arg1 = reinterpret_cast< CdiTaxis * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiTaxis_calendar_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->calendar = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiTaxis_calendar_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiTaxis *arg1 = (CdiTaxis *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + int result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiTaxis_calendar_get" "', argument " "1"" of type '" "CdiTaxis *""'"); + } + arg1 = reinterpret_cast< CdiTaxis * >(argp1); + result = (int) ((arg1)->calendar); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiTaxis_hasBounds_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiTaxis *arg1 = (CdiTaxis *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiTaxis_hasBounds_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiTaxis_hasBounds_set" "', argument " "1"" of type '" "CdiTaxis *""'"); + } + arg1 = reinterpret_cast< CdiTaxis * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiTaxis_hasBounds_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->hasBounds = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiTaxis_hasBounds_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiTaxis *arg1 = (CdiTaxis *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + int result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiTaxis_hasBounds_get" "', argument " "1"" of type '" "CdiTaxis *""'"); + } + arg1 = reinterpret_cast< CdiTaxis * >(argp1); + result = (int) ((arg1)->hasBounds); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiTaxis_name_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiTaxis *arg1 = (CdiTaxis *) 0 ; + char *arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + char temp2[CDI_MAX_NAME] ; + int res2 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiTaxis_name_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiTaxis_name_set" "', argument " "1"" of type '" "CdiTaxis *""'"); + } + arg1 = reinterpret_cast< CdiTaxis * >(argp1); + res2 = SWIG_AsCharArray(swig_obj[1], temp2, CDI_MAX_NAME); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiTaxis_name_set" "', argument " "2"" of type '" "char [CDI_MAX_NAME]""'"); + } + arg2 = reinterpret_cast< char * >(temp2); + if (arg2) memcpy(arg1->name,arg2,CDI_MAX_NAME*sizeof(char)); + else memset(arg1->name,0,CDI_MAX_NAME*sizeof(char)); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiTaxis_name_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiTaxis *arg1 = (CdiTaxis *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + char *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiTaxis_name_get" "', argument " "1"" of type '" "CdiTaxis *""'"); + } + arg1 = reinterpret_cast< CdiTaxis * >(argp1); + result = (char *)(char *) ((arg1)->name); + { + size_t size = SWIG_strnlen(result, CDI_MAX_NAME); + + + + resultobj = SWIG_FromCharPtrAndSize(result, size); + } + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiTaxis_unitname_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiTaxis *arg1 = (CdiTaxis *) 0 ; + char *arg2 = (char *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiTaxis_unitname_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiTaxis_unitname_set" "', argument " "1"" of type '" "CdiTaxis *""'"); + } + arg1 = reinterpret_cast< CdiTaxis * >(argp1); + res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiTaxis_unitname_set" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + if (arg2) { + size_t size = strlen(reinterpret_cast< const char * >(reinterpret_cast< const char * >(arg2))) + 1; + arg1->unitname = (char const *)reinterpret_cast< char* >(memcpy(new char[size], arg2, sizeof(char)*(size))); + } else { + arg1->unitname = 0; + } + resultobj = SWIG_Py_Void(); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiTaxis_unitname_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiTaxis *arg1 = (CdiTaxis *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + char *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiTaxis_unitname_get" "', argument " "1"" of type '" "CdiTaxis *""'"); + } + arg1 = reinterpret_cast< CdiTaxis * >(argp1); + result = (char *) ((arg1)->unitname); + resultobj = SWIG_FromCharPtr((const char *)result); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *CdiTaxis_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *obj; + if (!SWIG_Python_UnpackTuple(args, "swigregister", 1, 1, &obj)) return NULL; + SWIG_TypeNewClientData(SWIGTYPE_p_CdiTaxis, SWIG_NewClientData(obj)); + return SWIG_Py_Void(); +} + +SWIGINTERN PyObject *CdiTaxis_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + return SWIG_Python_InitShadowInstance(args); +} + +SWIGINTERN PyObject *_wrap_new_CdiZaxis__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) { + PyObject *resultobj = 0; + CdiZaxis *result = 0 ; + + if ((nobjs < 0) || (nobjs > 0)) SWIG_fail; + result = (CdiZaxis *)new CdiZaxis(); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CdiZaxis, SWIG_POINTER_NEW | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_CdiZaxis__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + int arg1 ; + int val1 ; + int ecode1 = 0 ; + CdiZaxis *result = 0 ; + + if ((nobjs < 1) || (nobjs > 1)) SWIG_fail; + ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_CdiZaxis" "', argument " "1"" of type '" "int""'"); + } + arg1 = static_cast< int >(val1); + result = (CdiZaxis *)new CdiZaxis(arg1); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CdiZaxis, SWIG_POINTER_NEW | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_CdiZaxis(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[2] = { + 0 + }; + + if (!(argc = SWIG_Python_UnpackTuple(args, "new_CdiZaxis", 0, 1, argv))) SWIG_fail; + --argc; + if (argc == 0) { + return _wrap_new_CdiZaxis__SWIG_0(self, argc, argv); + } + if (argc == 1) { + int _v; + { + int res = SWIG_AsVal_int(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_new_CdiZaxis__SWIG_1(self, argc, argv); + } + } + +fail: + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'new_CdiZaxis'.\n" + " Possible C/C++ prototypes are:\n" + " CdiZaxis::CdiZaxis()\n" + " CdiZaxis::CdiZaxis(int)\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_delete_CdiZaxis(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiZaxis *arg1 = (CdiZaxis *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiZaxis, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_CdiZaxis" "', argument " "1"" of type '" "CdiZaxis *""'"); + } + arg1 = reinterpret_cast< CdiZaxis * >(argp1); + delete arg1; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiZaxis_zaxisID_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiZaxis *arg1 = (CdiZaxis *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiZaxis_zaxisID_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_zaxisID_set" "', argument " "1"" of type '" "CdiZaxis *""'"); + } + arg1 = reinterpret_cast< CdiZaxis * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiZaxis_zaxisID_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->zaxisID = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiZaxis_zaxisID_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiZaxis *arg1 = (CdiZaxis *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + int result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_zaxisID_get" "', argument " "1"" of type '" "CdiZaxis *""'"); + } + arg1 = reinterpret_cast< CdiZaxis * >(argp1); + result = (int) ((arg1)->zaxisID); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiZaxis_type_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiZaxis *arg1 = (CdiZaxis *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiZaxis_type_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_type_set" "', argument " "1"" of type '" "CdiZaxis *""'"); + } + arg1 = reinterpret_cast< CdiZaxis * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiZaxis_type_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->type = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiZaxis_type_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiZaxis *arg1 = (CdiZaxis *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + int result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_type_get" "', argument " "1"" of type '" "CdiZaxis *""'"); + } + arg1 = reinterpret_cast< CdiZaxis * >(argp1); + result = (int) ((arg1)->type); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiZaxis_ltype_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiZaxis *arg1 = (CdiZaxis *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiZaxis_ltype_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_ltype_set" "', argument " "1"" of type '" "CdiZaxis *""'"); + } + arg1 = reinterpret_cast< CdiZaxis * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiZaxis_ltype_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->ltype = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiZaxis_ltype_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiZaxis *arg1 = (CdiZaxis *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + int result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_ltype_get" "', argument " "1"" of type '" "CdiZaxis *""'"); + } + arg1 = reinterpret_cast< CdiZaxis * >(argp1); + result = (int) ((arg1)->ltype); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiZaxis_size_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiZaxis *arg1 = (CdiZaxis *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiZaxis_size_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_size_set" "', argument " "1"" of type '" "CdiZaxis *""'"); + } + arg1 = reinterpret_cast< CdiZaxis * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiZaxis_size_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->size = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiZaxis_size_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiZaxis *arg1 = (CdiZaxis *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + int result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_size_get" "', argument " "1"" of type '" "CdiZaxis *""'"); + } + arg1 = reinterpret_cast< CdiZaxis * >(argp1); + result = (int) ((arg1)->size); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiZaxis_prec_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiZaxis *arg1 = (CdiZaxis *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiZaxis_prec_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_prec_set" "', argument " "1"" of type '" "CdiZaxis *""'"); + } + arg1 = reinterpret_cast< CdiZaxis * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiZaxis_prec_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->prec = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiZaxis_prec_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiZaxis *arg1 = (CdiZaxis *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + int result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_prec_get" "', argument " "1"" of type '" "CdiZaxis *""'"); + } + arg1 = reinterpret_cast< CdiZaxis * >(argp1); + result = (int) ((arg1)->prec); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiZaxis_plevels_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiZaxis *arg1 = (CdiZaxis *) 0 ; + double *arg2 = (double *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiZaxis_plevels_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_plevels_set" "', argument " "1"" of type '" "CdiZaxis *""'"); + } + arg1 = reinterpret_cast< CdiZaxis * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_double, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiZaxis_plevels_set" "', argument " "2"" of type '" "double *""'"); + } + arg2 = reinterpret_cast< double * >(argp2); + if (arg1) (arg1)->plevels = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiZaxis_plevels_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiZaxis *arg1 = (CdiZaxis *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + double *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_plevels_get" "', argument " "1"" of type '" "CdiZaxis *""'"); + } + arg1 = reinterpret_cast< CdiZaxis * >(argp1); + result = (double *) ((arg1)->plevels); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_double, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiZaxis_plbounds_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiZaxis *arg1 = (CdiZaxis *) 0 ; + double *arg2 = (double *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiZaxis_plbounds_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_plbounds_set" "', argument " "1"" of type '" "CdiZaxis *""'"); + } + arg1 = reinterpret_cast< CdiZaxis * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_double, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiZaxis_plbounds_set" "', argument " "2"" of type '" "double *""'"); + } + arg2 = reinterpret_cast< double * >(argp2); + if (arg1) (arg1)->plbounds = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiZaxis_plbounds_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiZaxis *arg1 = (CdiZaxis *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + double *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_plbounds_get" "', argument " "1"" of type '" "CdiZaxis *""'"); + } + arg1 = reinterpret_cast< CdiZaxis * >(argp1); + result = (double *) ((arg1)->plbounds); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_double, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiZaxis_pubounds_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiZaxis *arg1 = (CdiZaxis *) 0 ; + double *arg2 = (double *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiZaxis_pubounds_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_pubounds_set" "', argument " "1"" of type '" "CdiZaxis *""'"); + } + arg1 = reinterpret_cast< CdiZaxis * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_double, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiZaxis_pubounds_set" "', argument " "2"" of type '" "double *""'"); + } + arg2 = reinterpret_cast< double * >(argp2); + if (arg1) (arg1)->pubounds = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiZaxis_pubounds_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiZaxis *arg1 = (CdiZaxis *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + double *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_pubounds_get" "', argument " "1"" of type '" "CdiZaxis *""'"); + } + arg1 = reinterpret_cast< CdiZaxis * >(argp1); + result = (double *) ((arg1)->pubounds); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_double, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiZaxis_pweights_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiZaxis *arg1 = (CdiZaxis *) 0 ; + double *arg2 = (double *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiZaxis_pweights_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_pweights_set" "', argument " "1"" of type '" "CdiZaxis *""'"); + } + arg1 = reinterpret_cast< CdiZaxis * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_double, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiZaxis_pweights_set" "', argument " "2"" of type '" "double *""'"); + } + arg2 = reinterpret_cast< double * >(argp2); + if (arg1) (arg1)->pweights = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiZaxis_pweights_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiZaxis *arg1 = (CdiZaxis *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + double *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_pweights_get" "', argument " "1"" of type '" "CdiZaxis *""'"); + } + arg1 = reinterpret_cast< CdiZaxis * >(argp1); + result = (double *) ((arg1)->pweights); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_double, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiZaxis_levels_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiZaxis *arg1 = (CdiZaxis *) 0 ; + std::vector< double,std::allocator< double > > *arg2 = (std::vector< double,std::allocator< double > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiZaxis_levels_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_levels_set" "', argument " "1"" of type '" "CdiZaxis *""'"); + } + arg1 = reinterpret_cast< CdiZaxis * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiZaxis_levels_set" "', argument " "2"" of type '" "std::vector< double,std::allocator< double > > *""'"); + } + arg2 = reinterpret_cast< std::vector< double,std::allocator< double > > * >(argp2); + if (arg1) (arg1)->levels = *arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiZaxis_levels_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiZaxis *arg1 = (CdiZaxis *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::vector< double,std::allocator< double > > *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_levels_get" "', argument " "1"" of type '" "CdiZaxis *""'"); + } + arg1 = reinterpret_cast< CdiZaxis * >(argp1); + result = (std::vector< double,std::allocator< double > > *)& ((arg1)->levels); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiZaxis_lbounds_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiZaxis *arg1 = (CdiZaxis *) 0 ; + std::vector< double,std::allocator< double > > *arg2 = (std::vector< double,std::allocator< double > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiZaxis_lbounds_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_lbounds_set" "', argument " "1"" of type '" "CdiZaxis *""'"); + } + arg1 = reinterpret_cast< CdiZaxis * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiZaxis_lbounds_set" "', argument " "2"" of type '" "std::vector< double,std::allocator< double > > *""'"); + } + arg2 = reinterpret_cast< std::vector< double,std::allocator< double > > * >(argp2); + if (arg1) (arg1)->lbounds = *arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiZaxis_lbounds_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiZaxis *arg1 = (CdiZaxis *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::vector< double,std::allocator< double > > *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_lbounds_get" "', argument " "1"" of type '" "CdiZaxis *""'"); + } + arg1 = reinterpret_cast< CdiZaxis * >(argp1); + result = (std::vector< double,std::allocator< double > > *)& ((arg1)->lbounds); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiZaxis_ubounds_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiZaxis *arg1 = (CdiZaxis *) 0 ; + std::vector< double,std::allocator< double > > *arg2 = (std::vector< double,std::allocator< double > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiZaxis_ubounds_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_ubounds_set" "', argument " "1"" of type '" "CdiZaxis *""'"); + } + arg1 = reinterpret_cast< CdiZaxis * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiZaxis_ubounds_set" "', argument " "2"" of type '" "std::vector< double,std::allocator< double > > *""'"); + } + arg2 = reinterpret_cast< std::vector< double,std::allocator< double > > * >(argp2); + if (arg1) (arg1)->ubounds = *arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiZaxis_ubounds_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiZaxis *arg1 = (CdiZaxis *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::vector< double,std::allocator< double > > *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_ubounds_get" "', argument " "1"" of type '" "CdiZaxis *""'"); + } + arg1 = reinterpret_cast< CdiZaxis * >(argp1); + result = (std::vector< double,std::allocator< double > > *)& ((arg1)->ubounds); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiZaxis_weights_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiZaxis *arg1 = (CdiZaxis *) 0 ; + std::vector< double,std::allocator< double > > *arg2 = (std::vector< double,std::allocator< double > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiZaxis_weights_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_weights_set" "', argument " "1"" of type '" "CdiZaxis *""'"); + } + arg1 = reinterpret_cast< CdiZaxis * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiZaxis_weights_set" "', argument " "2"" of type '" "std::vector< double,std::allocator< double > > *""'"); + } + arg2 = reinterpret_cast< std::vector< double,std::allocator< double > > * >(argp2); + if (arg1) (arg1)->weights = *arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiZaxis_weights_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiZaxis *arg1 = (CdiZaxis *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::vector< double,std::allocator< double > > *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_weights_get" "', argument " "1"" of type '" "CdiZaxis *""'"); + } + arg1 = reinterpret_cast< CdiZaxis * >(argp1); + result = (std::vector< double,std::allocator< double > > *)& ((arg1)->weights); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiZaxis_name_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiZaxis *arg1 = (CdiZaxis *) 0 ; + std::string *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 = SWIG_OLDOBJ ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiZaxis_name_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_name_set" "', argument " "1"" of type '" "CdiZaxis *""'"); + } + arg1 = reinterpret_cast< CdiZaxis * >(argp1); + { + std::string *ptr = (std::string *)0; + res2 = SWIG_AsPtr_std_string(swig_obj[1], &ptr); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiZaxis_name_set" "', argument " "2"" of type '" "std::string const &""'"); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "CdiZaxis_name_set" "', argument " "2"" of type '" "std::string const &""'"); + } + arg2 = ptr; + } + if (arg1) (arg1)->name = *arg2; + resultobj = SWIG_Py_Void(); + if (SWIG_IsNewObj(res2)) delete arg2; + return resultobj; +fail: + if (SWIG_IsNewObj(res2)) delete arg2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiZaxis_name_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiZaxis *arg1 = (CdiZaxis *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::string *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_name_get" "', argument " "1"" of type '" "CdiZaxis *""'"); + } + arg1 = reinterpret_cast< CdiZaxis * >(argp1); + result = (std::string *) & ((arg1)->name); + resultobj = SWIG_From_std_string(static_cast< std::string >(*result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiZaxis_longname_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiZaxis *arg1 = (CdiZaxis *) 0 ; + std::string *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 = SWIG_OLDOBJ ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiZaxis_longname_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_longname_set" "', argument " "1"" of type '" "CdiZaxis *""'"); + } + arg1 = reinterpret_cast< CdiZaxis * >(argp1); + { + std::string *ptr = (std::string *)0; + res2 = SWIG_AsPtr_std_string(swig_obj[1], &ptr); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiZaxis_longname_set" "', argument " "2"" of type '" "std::string const &""'"); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "CdiZaxis_longname_set" "', argument " "2"" of type '" "std::string const &""'"); + } + arg2 = ptr; + } + if (arg1) (arg1)->longname = *arg2; + resultobj = SWIG_Py_Void(); + if (SWIG_IsNewObj(res2)) delete arg2; + return resultobj; +fail: + if (SWIG_IsNewObj(res2)) delete arg2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiZaxis_longname_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiZaxis *arg1 = (CdiZaxis *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::string *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_longname_get" "', argument " "1"" of type '" "CdiZaxis *""'"); + } + arg1 = reinterpret_cast< CdiZaxis * >(argp1); + result = (std::string *) & ((arg1)->longname); + resultobj = SWIG_From_std_string(static_cast< std::string >(*result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiZaxis_units_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiZaxis *arg1 = (CdiZaxis *) 0 ; + std::string *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 = SWIG_OLDOBJ ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiZaxis_units_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_units_set" "', argument " "1"" of type '" "CdiZaxis *""'"); + } + arg1 = reinterpret_cast< CdiZaxis * >(argp1); + { + std::string *ptr = (std::string *)0; + res2 = SWIG_AsPtr_std_string(swig_obj[1], &ptr); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiZaxis_units_set" "', argument " "2"" of type '" "std::string const &""'"); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "CdiZaxis_units_set" "', argument " "2"" of type '" "std::string const &""'"); + } + arg2 = ptr; + } + if (arg1) (arg1)->units = *arg2; + resultobj = SWIG_Py_Void(); + if (SWIG_IsNewObj(res2)) delete arg2; + return resultobj; +fail: + if (SWIG_IsNewObj(res2)) delete arg2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiZaxis_units_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiZaxis *arg1 = (CdiZaxis *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::string *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_units_get" "', argument " "1"" of type '" "CdiZaxis *""'"); + } + arg1 = reinterpret_cast< CdiZaxis * >(argp1); + result = (std::string *) & ((arg1)->units); + resultobj = SWIG_From_std_string(static_cast< std::string >(*result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *CdiZaxis_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *obj; + if (!SWIG_Python_UnpackTuple(args, "swigregister", 1, 1, &obj)) return NULL; + SWIG_TypeNewClientData(SWIGTYPE_p_CdiZaxis, SWIG_NewClientData(obj)); + return SWIG_Py_Void(); +} + +SWIGINTERN PyObject *CdiZaxis_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + return SWIG_Python_InitShadowInstance(args); +} + +SWIGINTERN PyObject *_wrap_new_CdiVariable__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) { + PyObject *resultobj = 0; + CdiVariable *result = 0 ; + + if ((nobjs < 0) || (nobjs > 0)) SWIG_fail; + result = (CdiVariable *)new CdiVariable(); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CdiVariable, SWIG_POINTER_NEW | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_CdiVariable__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + int arg1 ; + int arg2 ; + int arg3 ; + int val1 ; + int ecode1 = 0 ; + int val2 ; + int ecode2 = 0 ; + int val3 ; + int ecode3 = 0 ; + CdiVariable *result = 0 ; + + if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; + ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_CdiVariable" "', argument " "1"" of type '" "int""'"); + } + arg1 = static_cast< int >(val1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_CdiVariable" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "new_CdiVariable" "', argument " "3"" of type '" "int""'"); + } + arg3 = static_cast< int >(val3); + result = (CdiVariable *)new CdiVariable(arg1,arg2,arg3); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CdiVariable, SWIG_POINTER_NEW | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_CdiVariable(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[4] = { + 0 + }; + + if (!(argc = SWIG_Python_UnpackTuple(args, "new_CdiVariable", 0, 3, argv))) SWIG_fail; + --argc; + if (argc == 0) { + return _wrap_new_CdiVariable__SWIG_0(self, argc, argv); + } + if (argc == 3) { + int _v; + { + int res = SWIG_AsVal_int(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_new_CdiVariable__SWIG_1(self, argc, argv); + } + } + } + } + +fail: + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'new_CdiVariable'.\n" + " Possible C/C++ prototypes are:\n" + " CdiVariable::CdiVariable()\n" + " CdiVariable::CdiVariable(int,int,int)\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_delete_CdiVariable(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiVariable *arg1 = (CdiVariable *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_CdiVariable" "', argument " "1"" of type '" "CdiVariable *""'"); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + delete arg1; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiVariable_varID_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiVariable *arg1 = (CdiVariable *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiVariable_varID_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_varID_set" "', argument " "1"" of type '" "CdiVariable *""'"); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiVariable_varID_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->varID = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiVariable_varID_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiVariable *arg1 = (CdiVariable *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + int result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_varID_get" "', argument " "1"" of type '" "CdiVariable *""'"); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + result = (int) ((arg1)->varID); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiVariable_zaxisID_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiVariable *arg1 = (CdiVariable *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiVariable_zaxisID_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_zaxisID_set" "', argument " "1"" of type '" "CdiVariable *""'"); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiVariable_zaxisID_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->zaxisID = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiVariable_zaxisID_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiVariable *arg1 = (CdiVariable *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + int result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_zaxisID_get" "', argument " "1"" of type '" "CdiVariable *""'"); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + result = (int) ((arg1)->zaxisID); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiVariable_gridID_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiVariable *arg1 = (CdiVariable *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiVariable_gridID_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_gridID_set" "', argument " "1"" of type '" "CdiVariable *""'"); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiVariable_gridID_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->gridID = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiVariable_gridID_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiVariable *arg1 = (CdiVariable *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + int result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_gridID_get" "', argument " "1"" of type '" "CdiVariable *""'"); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + result = (int) ((arg1)->gridID); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiVariable_taxisID_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiVariable *arg1 = (CdiVariable *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiVariable_taxisID_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_taxisID_set" "', argument " "1"" of type '" "CdiVariable *""'"); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiVariable_taxisID_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->taxisID = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiVariable_taxisID_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiVariable *arg1 = (CdiVariable *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + int result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_taxisID_get" "', argument " "1"" of type '" "CdiVariable *""'"); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + result = (int) ((arg1)->taxisID); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiVariable_timeID_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiVariable *arg1 = (CdiVariable *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiVariable_timeID_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_timeID_set" "', argument " "1"" of type '" "CdiVariable *""'"); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiVariable_timeID_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->timeID = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiVariable_timeID_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiVariable *arg1 = (CdiVariable *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + int result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_timeID_get" "', argument " "1"" of type '" "CdiVariable *""'"); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + result = (int) ((arg1)->timeID); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiVariable_vlistID_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiVariable *arg1 = (CdiVariable *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiVariable_vlistID_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_vlistID_set" "', argument " "1"" of type '" "CdiVariable *""'"); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiVariable_vlistID_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->vlistID = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiVariable_vlistID_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiVariable *arg1 = (CdiVariable *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + int result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_vlistID_get" "', argument " "1"" of type '" "CdiVariable *""'"); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + result = (int) ((arg1)->vlistID); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiVariable_size_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiVariable *arg1 = (CdiVariable *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiVariable_size_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_size_set" "', argument " "1"" of type '" "CdiVariable *""'"); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiVariable_size_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->size = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiVariable_size_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiVariable *arg1 = (CdiVariable *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + int result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_size_get" "', argument " "1"" of type '" "CdiVariable *""'"); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + result = (int) ((arg1)->size); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiVariable_code_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiVariable *arg1 = (CdiVariable *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiVariable_code_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_code_set" "', argument " "1"" of type '" "CdiVariable *""'"); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiVariable_code_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->code = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiVariable_code_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiVariable *arg1 = (CdiVariable *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + int result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_code_get" "', argument " "1"" of type '" "CdiVariable *""'"); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + result = (int) ((arg1)->code); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiVariable_datatype_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiVariable *arg1 = (CdiVariable *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiVariable_datatype_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_datatype_set" "', argument " "1"" of type '" "CdiVariable *""'"); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiVariable_datatype_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->datatype = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiVariable_datatype_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiVariable *arg1 = (CdiVariable *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + int result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_datatype_get" "', argument " "1"" of type '" "CdiVariable *""'"); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + result = (int) ((arg1)->datatype); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiVariable_streamID_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiVariable *arg1 = (CdiVariable *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiVariable_streamID_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_streamID_set" "', argument " "1"" of type '" "CdiVariable *""'"); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiVariable_streamID_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->streamID = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiVariable_streamID_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiVariable *arg1 = (CdiVariable *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + int result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_streamID_get" "', argument " "1"" of type '" "CdiVariable *""'"); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + result = (int) ((arg1)->streamID); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiVariable_name_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiVariable *arg1 = (CdiVariable *) 0 ; + std::string *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 = SWIG_OLDOBJ ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiVariable_name_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_name_set" "', argument " "1"" of type '" "CdiVariable *""'"); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + { + std::string *ptr = (std::string *)0; + res2 = SWIG_AsPtr_std_string(swig_obj[1], &ptr); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiVariable_name_set" "', argument " "2"" of type '" "std::string const &""'"); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "CdiVariable_name_set" "', argument " "2"" of type '" "std::string const &""'"); + } + arg2 = ptr; + } + if (arg1) (arg1)->name = *arg2; + resultobj = SWIG_Py_Void(); + if (SWIG_IsNewObj(res2)) delete arg2; + return resultobj; +fail: + if (SWIG_IsNewObj(res2)) delete arg2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiVariable_name_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiVariable *arg1 = (CdiVariable *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::string *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_name_get" "', argument " "1"" of type '" "CdiVariable *""'"); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + result = (std::string *) & ((arg1)->name); + resultobj = SWIG_From_std_string(static_cast< std::string >(*result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiVariable_longname_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiVariable *arg1 = (CdiVariable *) 0 ; + std::string *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 = SWIG_OLDOBJ ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiVariable_longname_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_longname_set" "', argument " "1"" of type '" "CdiVariable *""'"); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + { + std::string *ptr = (std::string *)0; + res2 = SWIG_AsPtr_std_string(swig_obj[1], &ptr); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiVariable_longname_set" "', argument " "2"" of type '" "std::string const &""'"); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "CdiVariable_longname_set" "', argument " "2"" of type '" "std::string const &""'"); + } + arg2 = ptr; + } + if (arg1) (arg1)->longname = *arg2; + resultobj = SWIG_Py_Void(); + if (SWIG_IsNewObj(res2)) delete arg2; + return resultobj; +fail: + if (SWIG_IsNewObj(res2)) delete arg2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiVariable_longname_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiVariable *arg1 = (CdiVariable *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::string *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_longname_get" "', argument " "1"" of type '" "CdiVariable *""'"); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + result = (std::string *) & ((arg1)->longname); + resultobj = SWIG_From_std_string(static_cast< std::string >(*result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiVariable_units_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiVariable *arg1 = (CdiVariable *) 0 ; + std::string *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 = SWIG_OLDOBJ ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiVariable_units_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_units_set" "', argument " "1"" of type '" "CdiVariable *""'"); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + { + std::string *ptr = (std::string *)0; + res2 = SWIG_AsPtr_std_string(swig_obj[1], &ptr); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiVariable_units_set" "', argument " "2"" of type '" "std::string const &""'"); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "CdiVariable_units_set" "', argument " "2"" of type '" "std::string const &""'"); + } + arg2 = ptr; + } + if (arg1) (arg1)->units = *arg2; + resultobj = SWIG_Py_Void(); + if (SWIG_IsNewObj(res2)) delete arg2; + return resultobj; +fail: + if (SWIG_IsNewObj(res2)) delete arg2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiVariable_units_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiVariable *arg1 = (CdiVariable *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::string *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_units_get" "', argument " "1"" of type '" "CdiVariable *""'"); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + result = (std::string *) & ((arg1)->units); + resultobj = SWIG_From_std_string(static_cast< std::string >(*result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiVariable_stdname_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiVariable *arg1 = (CdiVariable *) 0 ; + std::string *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 = SWIG_OLDOBJ ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiVariable_stdname_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_stdname_set" "', argument " "1"" of type '" "CdiVariable *""'"); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + { + std::string *ptr = (std::string *)0; + res2 = SWIG_AsPtr_std_string(swig_obj[1], &ptr); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiVariable_stdname_set" "', argument " "2"" of type '" "std::string const &""'"); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "CdiVariable_stdname_set" "', argument " "2"" of type '" "std::string const &""'"); + } + arg2 = ptr; + } + if (arg1) (arg1)->stdname = *arg2; + resultobj = SWIG_Py_Void(); + if (SWIG_IsNewObj(res2)) delete arg2; + return resultobj; +fail: + if (SWIG_IsNewObj(res2)) delete arg2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiVariable_stdname_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiVariable *arg1 = (CdiVariable *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::string *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_stdname_get" "', argument " "1"" of type '" "CdiVariable *""'"); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + result = (std::string *) & ((arg1)->stdname); + resultobj = SWIG_From_std_string(static_cast< std::string >(*result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiVariable_missval_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiVariable *arg1 = (CdiVariable *) 0 ; + double arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + double val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiVariable_missval_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_missval_set" "', argument " "1"" of type '" "CdiVariable *""'"); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + ecode2 = SWIG_AsVal_double(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiVariable_missval_set" "', argument " "2"" of type '" "double""'"); + } + arg2 = static_cast< double >(val2); + if (arg1) (arg1)->missval = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiVariable_missval_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiVariable *arg1 = (CdiVariable *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + double result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_missval_get" "', argument " "1"" of type '" "CdiVariable *""'"); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + result = (double) ((arg1)->missval); + resultobj = SWIG_From_double(static_cast< double >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiVariable_values_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiVariable *arg1 = (CdiVariable *) 0 ; + std::vector< double,std::allocator< double > > *arg2 = (std::vector< double,std::allocator< double > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiVariable_values_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_values_set" "', argument " "1"" of type '" "CdiVariable *""'"); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiVariable_values_set" "', argument " "2"" of type '" "std::vector< double,std::allocator< double > > *""'"); + } + arg2 = reinterpret_cast< std::vector< double,std::allocator< double > > * >(argp2); + if (arg1) (arg1)->values = *arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiVariable_values_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiVariable *arg1 = (CdiVariable *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::vector< double,std::allocator< double > > *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_values_get" "', argument " "1"" of type '" "CdiVariable *""'"); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + result = (std::vector< double,std::allocator< double > > *)& ((arg1)->values); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiVariable_valuesWithLevel_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiVariable *arg1 = (CdiVariable *) 0 ; + std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *arg2 = (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiVariable_valuesWithLevel_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_valuesWithLevel_set" "', argument " "1"" of type '" "CdiVariable *""'"); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiVariable_valuesWithLevel_set" "', argument " "2"" of type '" "std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *""'"); + } + arg2 = reinterpret_cast< std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > * >(argp2); + if (arg1) (arg1)->valuesWithLevel = *arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiVariable_valuesWithLevel_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiVariable *arg1 = (CdiVariable *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_valuesWithLevel_get" "', argument " "1"" of type '" "CdiVariable *""'"); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + result = (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *)& ((arg1)->valuesWithLevel); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiVariable_grid_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiVariable *arg1 = (CdiVariable *) 0 ; + CdiGrid *arg2 = (CdiGrid *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiVariable_grid_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_grid_set" "', argument " "1"" of type '" "CdiVariable *""'"); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiVariable_grid_set" "', argument " "2"" of type '" "CdiGrid *""'"); + } + arg2 = reinterpret_cast< CdiGrid * >(argp2); + if (arg1) (arg1)->grid = *arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiVariable_grid_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiVariable *arg1 = (CdiVariable *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + CdiGrid *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_grid_get" "', argument " "1"" of type '" "CdiVariable *""'"); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + result = (CdiGrid *)& ((arg1)->grid); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CdiGrid, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiVariable_zaxis_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiVariable *arg1 = (CdiVariable *) 0 ; + CdiZaxis *arg2 = (CdiZaxis *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiVariable_zaxis_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_zaxis_set" "', argument " "1"" of type '" "CdiVariable *""'"); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_CdiZaxis, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiVariable_zaxis_set" "', argument " "2"" of type '" "CdiZaxis *""'"); + } + arg2 = reinterpret_cast< CdiZaxis * >(argp2); + if (arg1) (arg1)->zaxis = *arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiVariable_zaxis_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiVariable *arg1 = (CdiVariable *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + CdiZaxis *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_zaxis_get" "', argument " "1"" of type '" "CdiVariable *""'"); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + result = (CdiZaxis *)& ((arg1)->zaxis); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CdiZaxis, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiVariable_taxis_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiVariable *arg1 = (CdiVariable *) 0 ; + CdiTaxis *arg2 = (CdiTaxis *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "CdiVariable_taxis_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_taxis_set" "', argument " "1"" of type '" "CdiVariable *""'"); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_CdiTaxis, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiVariable_taxis_set" "', argument " "2"" of type '" "CdiTaxis *""'"); + } + arg2 = reinterpret_cast< CdiTaxis * >(argp2); + if (arg1) (arg1)->taxis = *arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiVariable_taxis_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiVariable *arg1 = (CdiVariable *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + CdiTaxis *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_taxis_get" "', argument " "1"" of type '" "CdiVariable *""'"); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + result = (CdiTaxis *)& ((arg1)->taxis); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CdiTaxis, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiVariable_sinfo(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiVariable *arg1 = (CdiVariable *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_sinfo" "', argument " "1"" of type '" "CdiVariable *""'"); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + (arg1)->sinfo(); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiVariable_getValues(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiVariable *arg1 = (CdiVariable *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_getValues" "', argument " "1"" of type '" "CdiVariable *""'"); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + (arg1)->getValues(); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiVariable_getValuesWithLevel__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + CdiVariable *arg1 = (CdiVariable *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_getValuesWithLevel" "', argument " "1"" of type '" "CdiVariable *""'"); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiVariable_getValuesWithLevel" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + (arg1)->getValuesWithLevel(arg2); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiVariable_getValuesWithLevel__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + CdiVariable *arg1 = (CdiVariable *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + + if ((nobjs < 1) || (nobjs > 1)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_getValuesWithLevel" "', argument " "1"" of type '" "CdiVariable *""'"); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + (arg1)->getValuesWithLevel(); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiVariable_getValuesWithLevel(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[3] = { + 0 + }; + + if (!(argc = SWIG_Python_UnpackTuple(args, "CdiVariable_getValuesWithLevel", 0, 2, argv))) SWIG_fail; + --argc; + if (argc == 1) { + int _v; + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CdiVariable, 0); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_CdiVariable_getValuesWithLevel__SWIG_1(self, argc, argv); + } + } + if (argc == 2) { + int _v; + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CdiVariable, 0); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_CdiVariable_getValuesWithLevel__SWIG_0(self, argc, argv); + } + } + } + +fail: + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'CdiVariable_getValuesWithLevel'.\n" + " Possible C/C++ prototypes are:\n" + " CdiVariable::getValuesWithLevel(int)\n" + " CdiVariable::getValuesWithLevel()\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_CdiVariable_getFValues(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiVariable *arg1 = (CdiVariable *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + SwigValueWrapper< std::vector< float,std::allocator< float > > > result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_getFValues" "', argument " "1"" of type '" "CdiVariable *""'"); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + result = (arg1)->getFValues(); + resultobj = SWIG_NewPointerObj((new std::vector< float,std::allocator< float > >(static_cast< const std::vector< float,std::allocator< float > >& >(result))), SWIGTYPE_p_std__vectorT_float_std__allocatorT_float_t_t, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiVariable_getFValuesWithLevel__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + CdiVariable *arg1 = (CdiVariable *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + SwigValueWrapper< std::vector< std::vector< float,std::allocator< float > >,std::allocator< std::vector< float,std::allocator< float > > > > > result; + + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_getFValuesWithLevel" "', argument " "1"" of type '" "CdiVariable *""'"); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiVariable_getFValuesWithLevel" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + result = (arg1)->getFValuesWithLevel(arg2); + resultobj = SWIG_NewPointerObj((new std::vector< std::vector< float,std::allocator< float > >,std::allocator< std::vector< float,std::allocator< float > > > >(static_cast< const std::vector< std::vector< float,std::allocator< float > >,std::allocator< std::vector< float,std::allocator< float > > > >& >(result))), SWIGTYPE_p_std__vectorT_std__vectorT_float_std__allocatorT_float_t_t_std__allocatorT_std__vectorT_float_std__allocatorT_float_t_t_t_t, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiVariable_getFValuesWithLevel__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + CdiVariable *arg1 = (CdiVariable *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + SwigValueWrapper< std::vector< std::vector< float,std::allocator< float > >,std::allocator< std::vector< float,std::allocator< float > > > > > result; + + if ((nobjs < 1) || (nobjs > 1)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_getFValuesWithLevel" "', argument " "1"" of type '" "CdiVariable *""'"); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + result = (arg1)->getFValuesWithLevel(); + resultobj = SWIG_NewPointerObj((new std::vector< std::vector< float,std::allocator< float > >,std::allocator< std::vector< float,std::allocator< float > > > >(static_cast< const std::vector< std::vector< float,std::allocator< float > >,std::allocator< std::vector< float,std::allocator< float > > > >& >(result))), SWIGTYPE_p_std__vectorT_std__vectorT_float_std__allocatorT_float_t_t_std__allocatorT_std__vectorT_float_std__allocatorT_float_t_t_t_t, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiVariable_getFValuesWithLevel(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[3] = { + 0 + }; + + if (!(argc = SWIG_Python_UnpackTuple(args, "CdiVariable_getFValuesWithLevel", 0, 2, argv))) SWIG_fail; + --argc; + if (argc == 1) { + int _v; + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CdiVariable, 0); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_CdiVariable_getFValuesWithLevel__SWIG_1(self, argc, argv); + } + } + if (argc == 2) { + int _v; + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CdiVariable, 0); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_CdiVariable_getFValuesWithLevel__SWIG_0(self, argc, argv); + } + } + } + +fail: + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'CdiVariable_getFValuesWithLevel'.\n" + " Possible C/C++ prototypes are:\n" + " CdiVariable::getFValuesWithLevel(int)\n" + " CdiVariable::getFValuesWithLevel()\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_CdiVariable_getValuesAsPointer(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CdiVariable *arg1 = (CdiVariable *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + double *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_getValuesAsPointer" "', argument " "1"" of type '" "CdiVariable *""'"); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + result = (double *)(arg1)->getValuesAsPointer(); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_double, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiVariable_getValuesWithLevelAsPointer__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + CdiVariable *arg1 = (CdiVariable *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + double **result = 0 ; + + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_getValuesWithLevelAsPointer" "', argument " "1"" of type '" "CdiVariable *""'"); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiVariable_getValuesWithLevelAsPointer" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + result = (double **)(arg1)->getValuesWithLevelAsPointer(arg2); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_p_double, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiVariable_getValuesWithLevelAsPointer__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + CdiVariable *arg1 = (CdiVariable *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + double **result = 0 ; + + if ((nobjs < 1) || (nobjs > 1)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_getValuesWithLevelAsPointer" "', argument " "1"" of type '" "CdiVariable *""'"); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + result = (double **)(arg1)->getValuesWithLevelAsPointer(); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_p_double, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CdiVariable_getValuesWithLevelAsPointer(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[3] = { + 0 + }; + + if (!(argc = SWIG_Python_UnpackTuple(args, "CdiVariable_getValuesWithLevelAsPointer", 0, 2, argv))) SWIG_fail; + --argc; + if (argc == 1) { + int _v; + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CdiVariable, 0); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_CdiVariable_getValuesWithLevelAsPointer__SWIG_1(self, argc, argv); + } + } + if (argc == 2) { + int _v; + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CdiVariable, 0); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_CdiVariable_getValuesWithLevelAsPointer__SWIG_0(self, argc, argv); + } + } + } + +fail: + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'CdiVariable_getValuesWithLevelAsPointer'.\n" + " Possible C/C++ prototypes are:\n" + " CdiVariable::getValuesWithLevelAsPointer(int)\n" + " CdiVariable::getValuesWithLevelAsPointer()\n"); + return 0; +} + + +SWIGINTERN PyObject *CdiVariable_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *obj; + if (!SWIG_Python_UnpackTuple(args, "swigregister", 1, 1, &obj)) return NULL; + SWIG_TypeNewClientData(SWIGTYPE_p_CdiVariable, SWIG_NewClientData(obj)); + return SWIG_Py_Void(); +} + +SWIGINTERN PyObject *CdiVariable_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + return SWIG_Python_InitShadowInstance(args); +} + +SWIGINTERN PyObject *_wrap_new_Cdi(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + char *arg1 = (char *) 0 ; + int res1 ; + char *buf1 = 0 ; + int alloc1 = 0 ; + PyObject *swig_obj[1] ; + Cdi *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_AsCharPtrAndSize(swig_obj[0], &buf1, NULL, &alloc1); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Cdi" "', argument " "1"" of type '" "char const *""'"); + } + arg1 = reinterpret_cast< char * >(buf1); + result = (Cdi *)new Cdi((char const *)arg1); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Cdi, SWIG_POINTER_NEW | 0 ); + if (alloc1 == SWIG_NEWOBJ) delete[] buf1; + return resultobj; +fail: + if (alloc1 == SWIG_NEWOBJ) delete[] buf1; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_delete_Cdi(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Cdi *arg1 = (Cdi *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Cdi, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Cdi" "', argument " "1"" of type '" "Cdi *""'"); + } + arg1 = reinterpret_cast< Cdi * >(argp1); + delete arg1; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Cdi_streamID_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Cdi *arg1 = (Cdi *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "Cdi_streamID_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_streamID_set" "', argument " "1"" of type '" "Cdi *""'"); + } + arg1 = reinterpret_cast< Cdi * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Cdi_streamID_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->streamID = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Cdi_streamID_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Cdi *arg1 = (Cdi *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + int result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_streamID_get" "', argument " "1"" of type '" "Cdi *""'"); + } + arg1 = reinterpret_cast< Cdi * >(argp1); + result = (int) ((arg1)->streamID); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Cdi_vlistID_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Cdi *arg1 = (Cdi *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "Cdi_vlistID_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_vlistID_set" "', argument " "1"" of type '" "Cdi *""'"); + } + arg1 = reinterpret_cast< Cdi * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Cdi_vlistID_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->vlistID = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Cdi_vlistID_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Cdi *arg1 = (Cdi *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + int result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_vlistID_get" "', argument " "1"" of type '" "Cdi *""'"); + } + arg1 = reinterpret_cast< Cdi * >(argp1); + result = (int) ((arg1)->vlistID); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Cdi_nvars_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Cdi *arg1 = (Cdi *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "Cdi_nvars_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_nvars_set" "', argument " "1"" of type '" "Cdi *""'"); + } + arg1 = reinterpret_cast< Cdi * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Cdi_nvars_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->nvars = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Cdi_nvars_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Cdi *arg1 = (Cdi *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + int result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_nvars_get" "', argument " "1"" of type '" "Cdi *""'"); + } + arg1 = reinterpret_cast< Cdi * >(argp1); + result = (int) ((arg1)->nvars); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Cdi_nzaxes_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Cdi *arg1 = (Cdi *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "Cdi_nzaxes_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_nzaxes_set" "', argument " "1"" of type '" "Cdi *""'"); + } + arg1 = reinterpret_cast< Cdi * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Cdi_nzaxes_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->nzaxes = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Cdi_nzaxes_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Cdi *arg1 = (Cdi *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + int result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_nzaxes_get" "', argument " "1"" of type '" "Cdi *""'"); + } + arg1 = reinterpret_cast< Cdi * >(argp1); + result = (int) ((arg1)->nzaxes); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Cdi_ngrids_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Cdi *arg1 = (Cdi *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "Cdi_ngrids_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_ngrids_set" "', argument " "1"" of type '" "Cdi *""'"); + } + arg1 = reinterpret_cast< Cdi * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Cdi_ngrids_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->ngrids = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Cdi_ngrids_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Cdi *arg1 = (Cdi *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + int result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_ngrids_get" "', argument " "1"" of type '" "Cdi *""'"); + } + arg1 = reinterpret_cast< Cdi * >(argp1); + result = (int) ((arg1)->ngrids); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Cdi_ntaxes_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Cdi *arg1 = (Cdi *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "Cdi_ntaxes_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_ntaxes_set" "', argument " "1"" of type '" "Cdi *""'"); + } + arg1 = reinterpret_cast< Cdi * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Cdi_ntaxes_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->ntaxes = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Cdi_ntaxes_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Cdi *arg1 = (Cdi *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + int result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_ntaxes_get" "', argument " "1"" of type '" "Cdi *""'"); + } + arg1 = reinterpret_cast< Cdi * >(argp1); + result = (int) ((arg1)->ntaxes); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Cdi_taxisID_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Cdi *arg1 = (Cdi *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "Cdi_taxisID_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_taxisID_set" "', argument " "1"" of type '" "Cdi *""'"); + } + arg1 = reinterpret_cast< Cdi * >(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Cdi_taxisID_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->taxisID = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Cdi_taxisID_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Cdi *arg1 = (Cdi *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + int result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_taxisID_get" "', argument " "1"" of type '" "Cdi *""'"); + } + arg1 = reinterpret_cast< Cdi * >(argp1); + result = (int) ((arg1)->taxisID); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Cdi_varnames_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Cdi *arg1 = (Cdi *) 0 ; + std::vector< std::string,std::allocator< std::string > > *arg2 = (std::vector< std::string,std::allocator< std::string > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "Cdi_varnames_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_varnames_set" "', argument " "1"" of type '" "Cdi *""'"); + } + arg1 = reinterpret_cast< Cdi * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Cdi_varnames_set" "', argument " "2"" of type '" "std::vector< std::string,std::allocator< std::string > > *""'"); + } + arg2 = reinterpret_cast< std::vector< std::string,std::allocator< std::string > > * >(argp2); + if (arg1) (arg1)->varnames = *arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Cdi_varnames_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Cdi *arg1 = (Cdi *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::vector< std::string,std::allocator< std::string > > *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_varnames_get" "', argument " "1"" of type '" "Cdi *""'"); + } + arg1 = reinterpret_cast< Cdi * >(argp1); + result = (std::vector< std::string,std::allocator< std::string > > *)& ((arg1)->varnames); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Cdi_codes_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Cdi *arg1 = (Cdi *) 0 ; + std::vector< int,std::allocator< int > > *arg2 = (std::vector< int,std::allocator< int > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "Cdi_codes_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_codes_set" "', argument " "1"" of type '" "Cdi *""'"); + } + arg1 = reinterpret_cast< Cdi * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Cdi_codes_set" "', argument " "2"" of type '" "std::vector< int,std::allocator< int > > *""'"); + } + arg2 = reinterpret_cast< std::vector< int,std::allocator< int > > * >(argp2); + if (arg1) (arg1)->codes = *arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Cdi_codes_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Cdi *arg1 = (Cdi *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::vector< int,std::allocator< int > > *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_codes_get" "', argument " "1"" of type '" "Cdi *""'"); + } + arg1 = reinterpret_cast< Cdi * >(argp1); + result = (std::vector< int,std::allocator< int > > *)& ((arg1)->codes); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Cdi_variables_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Cdi *arg1 = (Cdi *) 0 ; + std::vector< CdiVariable,std::allocator< CdiVariable > > *arg2 = (std::vector< CdiVariable,std::allocator< CdiVariable > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "Cdi_variables_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_variables_set" "', argument " "1"" of type '" "Cdi *""'"); + } + arg1 = reinterpret_cast< Cdi * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Cdi_variables_set" "', argument " "2"" of type '" "std::vector< CdiVariable,std::allocator< CdiVariable > > *""'"); + } + arg2 = reinterpret_cast< std::vector< CdiVariable,std::allocator< CdiVariable > > * >(argp2); + if (arg1) (arg1)->variables = *arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Cdi_variables_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Cdi *arg1 = (Cdi *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::vector< CdiVariable,std::allocator< CdiVariable > > *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_variables_get" "', argument " "1"" of type '" "Cdi *""'"); + } + arg1 = reinterpret_cast< Cdi * >(argp1); + result = (std::vector< CdiVariable,std::allocator< CdiVariable > > *)& ((arg1)->variables); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Cdi_var_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Cdi *arg1 = (Cdi *) 0 ; + std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > > *arg2 = (std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "Cdi_var_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_var_set" "', argument " "1"" of type '" "Cdi *""'"); + } + arg1 = reinterpret_cast< Cdi * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Cdi_var_set" "', argument " "2"" of type '" "std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > > *""'"); + } + arg2 = reinterpret_cast< std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > > * >(argp2); + if (arg1) (arg1)->var = *arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Cdi_var_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Cdi *arg1 = (Cdi *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > > *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_var_get" "', argument " "1"" of type '" "Cdi *""'"); + } + arg1 = reinterpret_cast< Cdi * >(argp1); + result = (std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > > *)& ((arg1)->var); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Cdi_varByCode_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Cdi *arg1 = (Cdi *) 0 ; + std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > > *arg2 = (std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "Cdi_varByCode_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_varByCode_set" "', argument " "1"" of type '" "Cdi *""'"); + } + arg1 = reinterpret_cast< Cdi * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Cdi_varByCode_set" "', argument " "2"" of type '" "std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > > *""'"); + } + arg2 = reinterpret_cast< std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > > * >(argp2); + if (arg1) (arg1)->varByCode = *arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Cdi_varByCode_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Cdi *arg1 = (Cdi *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > > *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_varByCode_get" "', argument " "1"" of type '" "Cdi *""'"); + } + arg1 = reinterpret_cast< Cdi * >(argp1); + result = (std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > > *)& ((arg1)->varByCode); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Cdi_taxes_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Cdi *arg1 = (Cdi *) 0 ; + std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > > *arg2 = (std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "Cdi_taxes_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_taxes_set" "', argument " "1"" of type '" "Cdi *""'"); + } + arg1 = reinterpret_cast< Cdi * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Cdi_taxes_set" "', argument " "2"" of type '" "std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > > *""'"); + } + arg2 = reinterpret_cast< std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > > * >(argp2); + if (arg1) (arg1)->taxes = *arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Cdi_taxes_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Cdi *arg1 = (Cdi *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > > *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_taxes_get" "', argument " "1"" of type '" "Cdi *""'"); + } + arg1 = reinterpret_cast< Cdi * >(argp1); + result = (std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > > *)& ((arg1)->taxes); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Cdi_zaxes_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Cdi *arg1 = (Cdi *) 0 ; + std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > > *arg2 = (std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "Cdi_zaxes_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_zaxes_set" "', argument " "1"" of type '" "Cdi *""'"); + } + arg1 = reinterpret_cast< Cdi * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Cdi_zaxes_set" "', argument " "2"" of type '" "std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > > *""'"); + } + arg2 = reinterpret_cast< std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > > * >(argp2); + if (arg1) (arg1)->zaxes = *arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Cdi_zaxes_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Cdi *arg1 = (Cdi *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > > *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_zaxes_get" "', argument " "1"" of type '" "Cdi *""'"); + } + arg1 = reinterpret_cast< Cdi * >(argp1); + result = (std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > > *)& ((arg1)->zaxes); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Cdi_grids_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Cdi *arg1 = (Cdi *) 0 ; + std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > > *arg2 = (std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "Cdi_grids_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_grids_set" "', argument " "1"" of type '" "Cdi *""'"); + } + arg1 = reinterpret_cast< Cdi * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Cdi_grids_set" "', argument " "2"" of type '" "std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > > *""'"); + } + arg2 = reinterpret_cast< std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > > * >(argp2); + if (arg1) (arg1)->grids = *arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Cdi_grids_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Cdi *arg1 = (Cdi *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > > *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_grids_get" "', argument " "1"" of type '" "Cdi *""'"); + } + arg1 = reinterpret_cast< Cdi * >(argp1); + result = (std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > > *)& ((arg1)->grids); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Cdi_griddes(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Cdi *arg1 = (Cdi *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_griddes" "', argument " "1"" of type '" "Cdi *""'"); + } + arg1 = reinterpret_cast< Cdi * >(argp1); + (arg1)->griddes(); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *Cdi_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *obj; + if (!SWIG_Python_UnpackTuple(args, "swigregister", 1, 1, &obj)) return NULL; + SWIG_TypeNewClientData(SWIGTYPE_p_Cdi, SWIG_NewClientData(obj)); + return SWIG_Py_Void(); +} + +SWIGINTERN PyObject *Cdi_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + return SWIG_Python_InitShadowInstance(args); +} + +static PyMethodDef SwigMethods[] = { + { "SWIG_PyInstanceMethod_New", SWIG_PyInstanceMethod_New, METH_O, NULL}, + { "delete_SwigPyIterator", _wrap_delete_SwigPyIterator, METH_O, NULL}, + { "SwigPyIterator_value", _wrap_SwigPyIterator_value, METH_O, NULL}, + { "SwigPyIterator_incr", _wrap_SwigPyIterator_incr, METH_VARARGS, NULL}, + { "SwigPyIterator_decr", _wrap_SwigPyIterator_decr, METH_VARARGS, NULL}, + { "SwigPyIterator_distance", _wrap_SwigPyIterator_distance, METH_VARARGS, NULL}, + { "SwigPyIterator_equal", _wrap_SwigPyIterator_equal, METH_VARARGS, NULL}, + { "SwigPyIterator_copy", _wrap_SwigPyIterator_copy, METH_O, NULL}, + { "SwigPyIterator_next", _wrap_SwigPyIterator_next, METH_O, NULL}, + { "SwigPyIterator___next__", _wrap_SwigPyIterator___next__, METH_O, NULL}, + { "SwigPyIterator_previous", _wrap_SwigPyIterator_previous, METH_O, NULL}, + { "SwigPyIterator_advance", _wrap_SwigPyIterator_advance, METH_VARARGS, NULL}, + { "SwigPyIterator___eq__", _wrap_SwigPyIterator___eq__, METH_VARARGS, NULL}, + { "SwigPyIterator___ne__", _wrap_SwigPyIterator___ne__, METH_VARARGS, NULL}, + { "SwigPyIterator___iadd__", _wrap_SwigPyIterator___iadd__, METH_VARARGS, NULL}, + { "SwigPyIterator___isub__", _wrap_SwigPyIterator___isub__, METH_VARARGS, NULL}, + { "SwigPyIterator___add__", _wrap_SwigPyIterator___add__, METH_VARARGS, NULL}, + { "SwigPyIterator___sub__", _wrap_SwigPyIterator___sub__, METH_VARARGS, NULL}, + { "SwigPyIterator_swigregister", SwigPyIterator_swigregister, METH_O, NULL}, + { "IntVector_iterator", _wrap_IntVector_iterator, METH_O, NULL}, + { "IntVector___nonzero__", _wrap_IntVector___nonzero__, METH_O, NULL}, + { "IntVector___bool__", _wrap_IntVector___bool__, METH_O, NULL}, + { "IntVector___len__", _wrap_IntVector___len__, METH_O, NULL}, + { "IntVector___getslice__", _wrap_IntVector___getslice__, METH_VARARGS, NULL}, + { "IntVector___setslice__", _wrap_IntVector___setslice__, METH_VARARGS, NULL}, + { "IntVector___delslice__", _wrap_IntVector___delslice__, METH_VARARGS, NULL}, + { "IntVector___delitem__", _wrap_IntVector___delitem__, METH_VARARGS, NULL}, + { "IntVector___getitem__", _wrap_IntVector___getitem__, METH_VARARGS, NULL}, + { "IntVector___setitem__", _wrap_IntVector___setitem__, METH_VARARGS, NULL}, + { "IntVector_pop", _wrap_IntVector_pop, METH_O, NULL}, + { "IntVector_append", _wrap_IntVector_append, METH_VARARGS, NULL}, + { "IntVector_empty", _wrap_IntVector_empty, METH_O, NULL}, + { "IntVector_size", _wrap_IntVector_size, METH_O, NULL}, + { "IntVector_swap", _wrap_IntVector_swap, METH_VARARGS, NULL}, + { "IntVector_begin", _wrap_IntVector_begin, METH_O, NULL}, + { "IntVector_end", _wrap_IntVector_end, METH_O, NULL}, + { "IntVector_rbegin", _wrap_IntVector_rbegin, METH_O, NULL}, + { "IntVector_rend", _wrap_IntVector_rend, METH_O, NULL}, + { "IntVector_clear", _wrap_IntVector_clear, METH_O, NULL}, + { "IntVector_get_allocator", _wrap_IntVector_get_allocator, METH_O, NULL}, + { "IntVector_pop_back", _wrap_IntVector_pop_back, METH_O, NULL}, + { "IntVector_erase", _wrap_IntVector_erase, METH_VARARGS, NULL}, + { "new_IntVector", _wrap_new_IntVector, METH_VARARGS, NULL}, + { "IntVector_push_back", _wrap_IntVector_push_back, METH_VARARGS, NULL}, + { "IntVector_front", _wrap_IntVector_front, METH_O, NULL}, + { "IntVector_back", _wrap_IntVector_back, METH_O, NULL}, + { "IntVector_assign", _wrap_IntVector_assign, METH_VARARGS, NULL}, + { "IntVector_resize", _wrap_IntVector_resize, METH_VARARGS, NULL}, + { "IntVector_insert", _wrap_IntVector_insert, METH_VARARGS, NULL}, + { "IntVector_reserve", _wrap_IntVector_reserve, METH_VARARGS, NULL}, + { "IntVector_capacity", _wrap_IntVector_capacity, METH_O, NULL}, + { "delete_IntVector", _wrap_delete_IntVector, METH_O, NULL}, + { "IntVector_swigregister", IntVector_swigregister, METH_O, NULL}, + { "IntVector_swiginit", IntVector_swiginit, METH_VARARGS, NULL}, + { "DoubleVector_iterator", _wrap_DoubleVector_iterator, METH_O, NULL}, + { "DoubleVector___nonzero__", _wrap_DoubleVector___nonzero__, METH_O, NULL}, + { "DoubleVector___bool__", _wrap_DoubleVector___bool__, METH_O, NULL}, + { "DoubleVector___len__", _wrap_DoubleVector___len__, METH_O, NULL}, + { "DoubleVector___getslice__", _wrap_DoubleVector___getslice__, METH_VARARGS, NULL}, + { "DoubleVector___setslice__", _wrap_DoubleVector___setslice__, METH_VARARGS, NULL}, + { "DoubleVector___delslice__", _wrap_DoubleVector___delslice__, METH_VARARGS, NULL}, + { "DoubleVector___delitem__", _wrap_DoubleVector___delitem__, METH_VARARGS, NULL}, + { "DoubleVector___getitem__", _wrap_DoubleVector___getitem__, METH_VARARGS, NULL}, + { "DoubleVector___setitem__", _wrap_DoubleVector___setitem__, METH_VARARGS, NULL}, + { "DoubleVector_pop", _wrap_DoubleVector_pop, METH_O, NULL}, + { "DoubleVector_append", _wrap_DoubleVector_append, METH_VARARGS, NULL}, + { "DoubleVector_empty", _wrap_DoubleVector_empty, METH_O, NULL}, + { "DoubleVector_size", _wrap_DoubleVector_size, METH_O, NULL}, + { "DoubleVector_swap", _wrap_DoubleVector_swap, METH_VARARGS, NULL}, + { "DoubleVector_begin", _wrap_DoubleVector_begin, METH_O, NULL}, + { "DoubleVector_end", _wrap_DoubleVector_end, METH_O, NULL}, + { "DoubleVector_rbegin", _wrap_DoubleVector_rbegin, METH_O, NULL}, + { "DoubleVector_rend", _wrap_DoubleVector_rend, METH_O, NULL}, + { "DoubleVector_clear", _wrap_DoubleVector_clear, METH_O, NULL}, + { "DoubleVector_get_allocator", _wrap_DoubleVector_get_allocator, METH_O, NULL}, + { "DoubleVector_pop_back", _wrap_DoubleVector_pop_back, METH_O, NULL}, + { "DoubleVector_erase", _wrap_DoubleVector_erase, METH_VARARGS, NULL}, + { "new_DoubleVector", _wrap_new_DoubleVector, METH_VARARGS, NULL}, + { "DoubleVector_push_back", _wrap_DoubleVector_push_back, METH_VARARGS, NULL}, + { "DoubleVector_front", _wrap_DoubleVector_front, METH_O, NULL}, + { "DoubleVector_back", _wrap_DoubleVector_back, METH_O, NULL}, + { "DoubleVector_assign", _wrap_DoubleVector_assign, METH_VARARGS, NULL}, + { "DoubleVector_resize", _wrap_DoubleVector_resize, METH_VARARGS, NULL}, + { "DoubleVector_insert", _wrap_DoubleVector_insert, METH_VARARGS, NULL}, + { "DoubleVector_reserve", _wrap_DoubleVector_reserve, METH_VARARGS, NULL}, + { "DoubleVector_capacity", _wrap_DoubleVector_capacity, METH_O, NULL}, + { "delete_DoubleVector", _wrap_delete_DoubleVector, METH_O, NULL}, + { "DoubleVector_swigregister", DoubleVector_swigregister, METH_O, NULL}, + { "DoubleVector_swiginit", DoubleVector_swiginit, METH_VARARGS, NULL}, + { "DoubleDoubleVector_iterator", _wrap_DoubleDoubleVector_iterator, METH_O, NULL}, + { "DoubleDoubleVector___nonzero__", _wrap_DoubleDoubleVector___nonzero__, METH_O, NULL}, + { "DoubleDoubleVector___bool__", _wrap_DoubleDoubleVector___bool__, METH_O, NULL}, + { "DoubleDoubleVector___len__", _wrap_DoubleDoubleVector___len__, METH_O, NULL}, + { "DoubleDoubleVector___getslice__", _wrap_DoubleDoubleVector___getslice__, METH_VARARGS, NULL}, + { "DoubleDoubleVector___setslice__", _wrap_DoubleDoubleVector___setslice__, METH_VARARGS, NULL}, + { "DoubleDoubleVector___delslice__", _wrap_DoubleDoubleVector___delslice__, METH_VARARGS, NULL}, + { "DoubleDoubleVector___delitem__", _wrap_DoubleDoubleVector___delitem__, METH_VARARGS, NULL}, + { "DoubleDoubleVector___getitem__", _wrap_DoubleDoubleVector___getitem__, METH_VARARGS, NULL}, + { "DoubleDoubleVector___setitem__", _wrap_DoubleDoubleVector___setitem__, METH_VARARGS, NULL}, + { "DoubleDoubleVector_pop", _wrap_DoubleDoubleVector_pop, METH_O, NULL}, + { "DoubleDoubleVector_append", _wrap_DoubleDoubleVector_append, METH_VARARGS, NULL}, + { "DoubleDoubleVector_empty", _wrap_DoubleDoubleVector_empty, METH_O, NULL}, + { "DoubleDoubleVector_size", _wrap_DoubleDoubleVector_size, METH_O, NULL}, + { "DoubleDoubleVector_swap", _wrap_DoubleDoubleVector_swap, METH_VARARGS, NULL}, + { "DoubleDoubleVector_begin", _wrap_DoubleDoubleVector_begin, METH_O, NULL}, + { "DoubleDoubleVector_end", _wrap_DoubleDoubleVector_end, METH_O, NULL}, + { "DoubleDoubleVector_rbegin", _wrap_DoubleDoubleVector_rbegin, METH_O, NULL}, + { "DoubleDoubleVector_rend", _wrap_DoubleDoubleVector_rend, METH_O, NULL}, + { "DoubleDoubleVector_clear", _wrap_DoubleDoubleVector_clear, METH_O, NULL}, + { "DoubleDoubleVector_get_allocator", _wrap_DoubleDoubleVector_get_allocator, METH_O, NULL}, + { "DoubleDoubleVector_pop_back", _wrap_DoubleDoubleVector_pop_back, METH_O, NULL}, + { "DoubleDoubleVector_erase", _wrap_DoubleDoubleVector_erase, METH_VARARGS, NULL}, + { "new_DoubleDoubleVector", _wrap_new_DoubleDoubleVector, METH_VARARGS, NULL}, + { "DoubleDoubleVector_push_back", _wrap_DoubleDoubleVector_push_back, METH_VARARGS, NULL}, + { "DoubleDoubleVector_front", _wrap_DoubleDoubleVector_front, METH_O, NULL}, + { "DoubleDoubleVector_back", _wrap_DoubleDoubleVector_back, METH_O, NULL}, + { "DoubleDoubleVector_assign", _wrap_DoubleDoubleVector_assign, METH_VARARGS, NULL}, + { "DoubleDoubleVector_resize", _wrap_DoubleDoubleVector_resize, METH_VARARGS, NULL}, + { "DoubleDoubleVector_insert", _wrap_DoubleDoubleVector_insert, METH_VARARGS, NULL}, + { "DoubleDoubleVector_reserve", _wrap_DoubleDoubleVector_reserve, METH_VARARGS, NULL}, + { "DoubleDoubleVector_capacity", _wrap_DoubleDoubleVector_capacity, METH_O, NULL}, + { "delete_DoubleDoubleVector", _wrap_delete_DoubleDoubleVector, METH_O, NULL}, + { "DoubleDoubleVector_swigregister", DoubleDoubleVector_swigregister, METH_O, NULL}, + { "DoubleDoubleVector_swiginit", DoubleDoubleVector_swiginit, METH_VARARGS, NULL}, + { "StringVector_iterator", _wrap_StringVector_iterator, METH_O, NULL}, + { "StringVector___nonzero__", _wrap_StringVector___nonzero__, METH_O, NULL}, + { "StringVector___bool__", _wrap_StringVector___bool__, METH_O, NULL}, + { "StringVector___len__", _wrap_StringVector___len__, METH_O, NULL}, + { "StringVector___getslice__", _wrap_StringVector___getslice__, METH_VARARGS, NULL}, + { "StringVector___setslice__", _wrap_StringVector___setslice__, METH_VARARGS, NULL}, + { "StringVector___delslice__", _wrap_StringVector___delslice__, METH_VARARGS, NULL}, + { "StringVector___delitem__", _wrap_StringVector___delitem__, METH_VARARGS, NULL}, + { "StringVector___getitem__", _wrap_StringVector___getitem__, METH_VARARGS, NULL}, + { "StringVector___setitem__", _wrap_StringVector___setitem__, METH_VARARGS, NULL}, + { "StringVector_pop", _wrap_StringVector_pop, METH_O, NULL}, + { "StringVector_append", _wrap_StringVector_append, METH_VARARGS, NULL}, + { "StringVector_empty", _wrap_StringVector_empty, METH_O, NULL}, + { "StringVector_size", _wrap_StringVector_size, METH_O, NULL}, + { "StringVector_swap", _wrap_StringVector_swap, METH_VARARGS, NULL}, + { "StringVector_begin", _wrap_StringVector_begin, METH_O, NULL}, + { "StringVector_end", _wrap_StringVector_end, METH_O, NULL}, + { "StringVector_rbegin", _wrap_StringVector_rbegin, METH_O, NULL}, + { "StringVector_rend", _wrap_StringVector_rend, METH_O, NULL}, + { "StringVector_clear", _wrap_StringVector_clear, METH_O, NULL}, + { "StringVector_get_allocator", _wrap_StringVector_get_allocator, METH_O, NULL}, + { "StringVector_pop_back", _wrap_StringVector_pop_back, METH_O, NULL}, + { "StringVector_erase", _wrap_StringVector_erase, METH_VARARGS, NULL}, + { "new_StringVector", _wrap_new_StringVector, METH_VARARGS, NULL}, + { "StringVector_push_back", _wrap_StringVector_push_back, METH_VARARGS, NULL}, + { "StringVector_front", _wrap_StringVector_front, METH_O, NULL}, + { "StringVector_back", _wrap_StringVector_back, METH_O, NULL}, + { "StringVector_assign", _wrap_StringVector_assign, METH_VARARGS, NULL}, + { "StringVector_resize", _wrap_StringVector_resize, METH_VARARGS, NULL}, + { "StringVector_insert", _wrap_StringVector_insert, METH_VARARGS, NULL}, + { "StringVector_reserve", _wrap_StringVector_reserve, METH_VARARGS, NULL}, + { "StringVector_capacity", _wrap_StringVector_capacity, METH_O, NULL}, + { "delete_StringVector", _wrap_delete_StringVector, METH_O, NULL}, + { "StringVector_swigregister", StringVector_swigregister, METH_O, NULL}, + { "StringVector_swiginit", StringVector_swiginit, METH_VARARGS, NULL}, + { "VarsVector_iterator", _wrap_VarsVector_iterator, METH_O, NULL}, + { "VarsVector___nonzero__", _wrap_VarsVector___nonzero__, METH_O, NULL}, + { "VarsVector___bool__", _wrap_VarsVector___bool__, METH_O, NULL}, + { "VarsVector___len__", _wrap_VarsVector___len__, METH_O, NULL}, + { "VarsVector___getslice__", _wrap_VarsVector___getslice__, METH_VARARGS, NULL}, + { "VarsVector___setslice__", _wrap_VarsVector___setslice__, METH_VARARGS, NULL}, + { "VarsVector___delslice__", _wrap_VarsVector___delslice__, METH_VARARGS, NULL}, + { "VarsVector___delitem__", _wrap_VarsVector___delitem__, METH_VARARGS, NULL}, + { "VarsVector___getitem__", _wrap_VarsVector___getitem__, METH_VARARGS, NULL}, + { "VarsVector___setitem__", _wrap_VarsVector___setitem__, METH_VARARGS, NULL}, + { "VarsVector_pop", _wrap_VarsVector_pop, METH_O, NULL}, + { "VarsVector_append", _wrap_VarsVector_append, METH_VARARGS, NULL}, + { "VarsVector_empty", _wrap_VarsVector_empty, METH_O, NULL}, + { "VarsVector_size", _wrap_VarsVector_size, METH_O, NULL}, + { "VarsVector_swap", _wrap_VarsVector_swap, METH_VARARGS, NULL}, + { "VarsVector_begin", _wrap_VarsVector_begin, METH_O, NULL}, + { "VarsVector_end", _wrap_VarsVector_end, METH_O, NULL}, + { "VarsVector_rbegin", _wrap_VarsVector_rbegin, METH_O, NULL}, + { "VarsVector_rend", _wrap_VarsVector_rend, METH_O, NULL}, + { "VarsVector_clear", _wrap_VarsVector_clear, METH_O, NULL}, + { "VarsVector_get_allocator", _wrap_VarsVector_get_allocator, METH_O, NULL}, + { "VarsVector_pop_back", _wrap_VarsVector_pop_back, METH_O, NULL}, + { "VarsVector_erase", _wrap_VarsVector_erase, METH_VARARGS, NULL}, + { "new_VarsVector", _wrap_new_VarsVector, METH_VARARGS, NULL}, + { "VarsVector_push_back", _wrap_VarsVector_push_back, METH_VARARGS, NULL}, + { "VarsVector_front", _wrap_VarsVector_front, METH_O, NULL}, + { "VarsVector_back", _wrap_VarsVector_back, METH_O, NULL}, + { "VarsVector_assign", _wrap_VarsVector_assign, METH_VARARGS, NULL}, + { "VarsVector_resize", _wrap_VarsVector_resize, METH_VARARGS, NULL}, + { "VarsVector_insert", _wrap_VarsVector_insert, METH_VARARGS, NULL}, + { "VarsVector_reserve", _wrap_VarsVector_reserve, METH_VARARGS, NULL}, + { "VarsVector_capacity", _wrap_VarsVector_capacity, METH_O, NULL}, + { "delete_VarsVector", _wrap_delete_VarsVector, METH_O, NULL}, + { "VarsVector_swigregister", VarsVector_swigregister, METH_O, NULL}, + { "VarsVector_swiginit", VarsVector_swiginit, METH_VARARGS, NULL}, + { "VarsMap_iterator", _wrap_VarsMap_iterator, METH_O, NULL}, + { "VarsMap___nonzero__", _wrap_VarsMap___nonzero__, METH_O, NULL}, + { "VarsMap___bool__", _wrap_VarsMap___bool__, METH_O, NULL}, + { "VarsMap___len__", _wrap_VarsMap___len__, METH_O, NULL}, + { "VarsMap___getitem__", _wrap_VarsMap___getitem__, METH_VARARGS, NULL}, + { "VarsMap___delitem__", _wrap_VarsMap___delitem__, METH_VARARGS, NULL}, + { "VarsMap_has_key", _wrap_VarsMap_has_key, METH_VARARGS, NULL}, + { "VarsMap_keys", _wrap_VarsMap_keys, METH_O, NULL}, + { "VarsMap_values", _wrap_VarsMap_values, METH_O, NULL}, + { "VarsMap_items", _wrap_VarsMap_items, METH_O, NULL}, + { "VarsMap___contains__", _wrap_VarsMap___contains__, METH_VARARGS, NULL}, + { "VarsMap_key_iterator", _wrap_VarsMap_key_iterator, METH_O, NULL}, + { "VarsMap_value_iterator", _wrap_VarsMap_value_iterator, METH_O, NULL}, + { "VarsMap___setitem__", _wrap_VarsMap___setitem__, METH_VARARGS, NULL}, + { "VarsMap_asdict", _wrap_VarsMap_asdict, METH_O, NULL}, + { "new_VarsMap", _wrap_new_VarsMap, METH_VARARGS, NULL}, + { "VarsMap_empty", _wrap_VarsMap_empty, METH_O, NULL}, + { "VarsMap_size", _wrap_VarsMap_size, METH_O, NULL}, + { "VarsMap_swap", _wrap_VarsMap_swap, METH_VARARGS, NULL}, + { "VarsMap_begin", _wrap_VarsMap_begin, METH_O, NULL}, + { "VarsMap_end", _wrap_VarsMap_end, METH_O, NULL}, + { "VarsMap_rbegin", _wrap_VarsMap_rbegin, METH_O, NULL}, + { "VarsMap_rend", _wrap_VarsMap_rend, METH_O, NULL}, + { "VarsMap_clear", _wrap_VarsMap_clear, METH_O, NULL}, + { "VarsMap_get_allocator", _wrap_VarsMap_get_allocator, METH_O, NULL}, + { "VarsMap_count", _wrap_VarsMap_count, METH_VARARGS, NULL}, + { "VarsMap_erase", _wrap_VarsMap_erase, METH_VARARGS, NULL}, + { "VarsMap_find", _wrap_VarsMap_find, METH_VARARGS, NULL}, + { "VarsMap_lower_bound", _wrap_VarsMap_lower_bound, METH_VARARGS, NULL}, + { "VarsMap_upper_bound", _wrap_VarsMap_upper_bound, METH_VARARGS, NULL}, + { "delete_VarsMap", _wrap_delete_VarsMap, METH_O, NULL}, + { "VarsMap_swigregister", VarsMap_swigregister, METH_O, NULL}, + { "VarsMap_swiginit", VarsMap_swiginit, METH_VARARGS, NULL}, + { "VarsByCode_iterator", _wrap_VarsByCode_iterator, METH_O, NULL}, + { "VarsByCode___nonzero__", _wrap_VarsByCode___nonzero__, METH_O, NULL}, + { "VarsByCode___bool__", _wrap_VarsByCode___bool__, METH_O, NULL}, + { "VarsByCode___len__", _wrap_VarsByCode___len__, METH_O, NULL}, + { "VarsByCode___getitem__", _wrap_VarsByCode___getitem__, METH_VARARGS, NULL}, + { "VarsByCode___delitem__", _wrap_VarsByCode___delitem__, METH_VARARGS, NULL}, + { "VarsByCode_has_key", _wrap_VarsByCode_has_key, METH_VARARGS, NULL}, + { "VarsByCode_keys", _wrap_VarsByCode_keys, METH_O, NULL}, + { "VarsByCode_values", _wrap_VarsByCode_values, METH_O, NULL}, + { "VarsByCode_items", _wrap_VarsByCode_items, METH_O, NULL}, + { "VarsByCode___contains__", _wrap_VarsByCode___contains__, METH_VARARGS, NULL}, + { "VarsByCode_key_iterator", _wrap_VarsByCode_key_iterator, METH_O, NULL}, + { "VarsByCode_value_iterator", _wrap_VarsByCode_value_iterator, METH_O, NULL}, + { "VarsByCode___setitem__", _wrap_VarsByCode___setitem__, METH_VARARGS, NULL}, + { "VarsByCode_asdict", _wrap_VarsByCode_asdict, METH_O, NULL}, + { "new_VarsByCode", _wrap_new_VarsByCode, METH_VARARGS, NULL}, + { "VarsByCode_empty", _wrap_VarsByCode_empty, METH_O, NULL}, + { "VarsByCode_size", _wrap_VarsByCode_size, METH_O, NULL}, + { "VarsByCode_swap", _wrap_VarsByCode_swap, METH_VARARGS, NULL}, + { "VarsByCode_begin", _wrap_VarsByCode_begin, METH_O, NULL}, + { "VarsByCode_end", _wrap_VarsByCode_end, METH_O, NULL}, + { "VarsByCode_rbegin", _wrap_VarsByCode_rbegin, METH_O, NULL}, + { "VarsByCode_rend", _wrap_VarsByCode_rend, METH_O, NULL}, + { "VarsByCode_clear", _wrap_VarsByCode_clear, METH_O, NULL}, + { "VarsByCode_get_allocator", _wrap_VarsByCode_get_allocator, METH_O, NULL}, + { "VarsByCode_count", _wrap_VarsByCode_count, METH_VARARGS, NULL}, + { "VarsByCode_erase", _wrap_VarsByCode_erase, METH_VARARGS, NULL}, + { "VarsByCode_find", _wrap_VarsByCode_find, METH_VARARGS, NULL}, + { "VarsByCode_lower_bound", _wrap_VarsByCode_lower_bound, METH_VARARGS, NULL}, + { "VarsByCode_upper_bound", _wrap_VarsByCode_upper_bound, METH_VARARGS, NULL}, + { "delete_VarsByCode", _wrap_delete_VarsByCode, METH_O, NULL}, + { "VarsByCode_swigregister", VarsByCode_swigregister, METH_O, NULL}, + { "VarsByCode_swiginit", VarsByCode_swiginit, METH_VARARGS, NULL}, + { "TaxesMap_iterator", _wrap_TaxesMap_iterator, METH_O, NULL}, + { "TaxesMap___nonzero__", _wrap_TaxesMap___nonzero__, METH_O, NULL}, + { "TaxesMap___bool__", _wrap_TaxesMap___bool__, METH_O, NULL}, + { "TaxesMap___len__", _wrap_TaxesMap___len__, METH_O, NULL}, + { "TaxesMap___getitem__", _wrap_TaxesMap___getitem__, METH_VARARGS, NULL}, + { "TaxesMap___delitem__", _wrap_TaxesMap___delitem__, METH_VARARGS, NULL}, + { "TaxesMap_has_key", _wrap_TaxesMap_has_key, METH_VARARGS, NULL}, + { "TaxesMap_keys", _wrap_TaxesMap_keys, METH_O, NULL}, + { "TaxesMap_values", _wrap_TaxesMap_values, METH_O, NULL}, + { "TaxesMap_items", _wrap_TaxesMap_items, METH_O, NULL}, + { "TaxesMap___contains__", _wrap_TaxesMap___contains__, METH_VARARGS, NULL}, + { "TaxesMap_key_iterator", _wrap_TaxesMap_key_iterator, METH_O, NULL}, + { "TaxesMap_value_iterator", _wrap_TaxesMap_value_iterator, METH_O, NULL}, + { "TaxesMap___setitem__", _wrap_TaxesMap___setitem__, METH_VARARGS, NULL}, + { "TaxesMap_asdict", _wrap_TaxesMap_asdict, METH_O, NULL}, + { "new_TaxesMap", _wrap_new_TaxesMap, METH_VARARGS, NULL}, + { "TaxesMap_empty", _wrap_TaxesMap_empty, METH_O, NULL}, + { "TaxesMap_size", _wrap_TaxesMap_size, METH_O, NULL}, + { "TaxesMap_swap", _wrap_TaxesMap_swap, METH_VARARGS, NULL}, + { "TaxesMap_begin", _wrap_TaxesMap_begin, METH_O, NULL}, + { "TaxesMap_end", _wrap_TaxesMap_end, METH_O, NULL}, + { "TaxesMap_rbegin", _wrap_TaxesMap_rbegin, METH_O, NULL}, + { "TaxesMap_rend", _wrap_TaxesMap_rend, METH_O, NULL}, + { "TaxesMap_clear", _wrap_TaxesMap_clear, METH_O, NULL}, + { "TaxesMap_get_allocator", _wrap_TaxesMap_get_allocator, METH_O, NULL}, + { "TaxesMap_count", _wrap_TaxesMap_count, METH_VARARGS, NULL}, + { "TaxesMap_erase", _wrap_TaxesMap_erase, METH_VARARGS, NULL}, + { "TaxesMap_find", _wrap_TaxesMap_find, METH_VARARGS, NULL}, + { "TaxesMap_lower_bound", _wrap_TaxesMap_lower_bound, METH_VARARGS, NULL}, + { "TaxesMap_upper_bound", _wrap_TaxesMap_upper_bound, METH_VARARGS, NULL}, + { "delete_TaxesMap", _wrap_delete_TaxesMap, METH_O, NULL}, + { "TaxesMap_swigregister", TaxesMap_swigregister, METH_O, NULL}, + { "TaxesMap_swiginit", TaxesMap_swiginit, METH_VARARGS, NULL}, + { "ZaxesMap_iterator", _wrap_ZaxesMap_iterator, METH_O, NULL}, + { "ZaxesMap___nonzero__", _wrap_ZaxesMap___nonzero__, METH_O, NULL}, + { "ZaxesMap___bool__", _wrap_ZaxesMap___bool__, METH_O, NULL}, + { "ZaxesMap___len__", _wrap_ZaxesMap___len__, METH_O, NULL}, + { "ZaxesMap___getitem__", _wrap_ZaxesMap___getitem__, METH_VARARGS, NULL}, + { "ZaxesMap___delitem__", _wrap_ZaxesMap___delitem__, METH_VARARGS, NULL}, + { "ZaxesMap_has_key", _wrap_ZaxesMap_has_key, METH_VARARGS, NULL}, + { "ZaxesMap_keys", _wrap_ZaxesMap_keys, METH_O, NULL}, + { "ZaxesMap_values", _wrap_ZaxesMap_values, METH_O, NULL}, + { "ZaxesMap_items", _wrap_ZaxesMap_items, METH_O, NULL}, + { "ZaxesMap___contains__", _wrap_ZaxesMap___contains__, METH_VARARGS, NULL}, + { "ZaxesMap_key_iterator", _wrap_ZaxesMap_key_iterator, METH_O, NULL}, + { "ZaxesMap_value_iterator", _wrap_ZaxesMap_value_iterator, METH_O, NULL}, + { "ZaxesMap___setitem__", _wrap_ZaxesMap___setitem__, METH_VARARGS, NULL}, + { "ZaxesMap_asdict", _wrap_ZaxesMap_asdict, METH_O, NULL}, + { "new_ZaxesMap", _wrap_new_ZaxesMap, METH_VARARGS, NULL}, + { "ZaxesMap_empty", _wrap_ZaxesMap_empty, METH_O, NULL}, + { "ZaxesMap_size", _wrap_ZaxesMap_size, METH_O, NULL}, + { "ZaxesMap_swap", _wrap_ZaxesMap_swap, METH_VARARGS, NULL}, + { "ZaxesMap_begin", _wrap_ZaxesMap_begin, METH_O, NULL}, + { "ZaxesMap_end", _wrap_ZaxesMap_end, METH_O, NULL}, + { "ZaxesMap_rbegin", _wrap_ZaxesMap_rbegin, METH_O, NULL}, + { "ZaxesMap_rend", _wrap_ZaxesMap_rend, METH_O, NULL}, + { "ZaxesMap_clear", _wrap_ZaxesMap_clear, METH_O, NULL}, + { "ZaxesMap_get_allocator", _wrap_ZaxesMap_get_allocator, METH_O, NULL}, + { "ZaxesMap_count", _wrap_ZaxesMap_count, METH_VARARGS, NULL}, + { "ZaxesMap_erase", _wrap_ZaxesMap_erase, METH_VARARGS, NULL}, + { "ZaxesMap_find", _wrap_ZaxesMap_find, METH_VARARGS, NULL}, + { "ZaxesMap_lower_bound", _wrap_ZaxesMap_lower_bound, METH_VARARGS, NULL}, + { "ZaxesMap_upper_bound", _wrap_ZaxesMap_upper_bound, METH_VARARGS, NULL}, + { "delete_ZaxesMap", _wrap_delete_ZaxesMap, METH_O, NULL}, + { "ZaxesMap_swigregister", ZaxesMap_swigregister, METH_O, NULL}, + { "ZaxesMap_swiginit", ZaxesMap_swiginit, METH_VARARGS, NULL}, + { "GridsMap_iterator", _wrap_GridsMap_iterator, METH_O, NULL}, + { "GridsMap___nonzero__", _wrap_GridsMap___nonzero__, METH_O, NULL}, + { "GridsMap___bool__", _wrap_GridsMap___bool__, METH_O, NULL}, + { "GridsMap___len__", _wrap_GridsMap___len__, METH_O, NULL}, + { "GridsMap___getitem__", _wrap_GridsMap___getitem__, METH_VARARGS, NULL}, + { "GridsMap___delitem__", _wrap_GridsMap___delitem__, METH_VARARGS, NULL}, + { "GridsMap_has_key", _wrap_GridsMap_has_key, METH_VARARGS, NULL}, + { "GridsMap_keys", _wrap_GridsMap_keys, METH_O, NULL}, + { "GridsMap_values", _wrap_GridsMap_values, METH_O, NULL}, + { "GridsMap_items", _wrap_GridsMap_items, METH_O, NULL}, + { "GridsMap___contains__", _wrap_GridsMap___contains__, METH_VARARGS, NULL}, + { "GridsMap_key_iterator", _wrap_GridsMap_key_iterator, METH_O, NULL}, + { "GridsMap_value_iterator", _wrap_GridsMap_value_iterator, METH_O, NULL}, + { "GridsMap___setitem__", _wrap_GridsMap___setitem__, METH_VARARGS, NULL}, + { "GridsMap_asdict", _wrap_GridsMap_asdict, METH_O, NULL}, + { "new_GridsMap", _wrap_new_GridsMap, METH_VARARGS, NULL}, + { "GridsMap_empty", _wrap_GridsMap_empty, METH_O, NULL}, + { "GridsMap_size", _wrap_GridsMap_size, METH_O, NULL}, + { "GridsMap_swap", _wrap_GridsMap_swap, METH_VARARGS, NULL}, + { "GridsMap_begin", _wrap_GridsMap_begin, METH_O, NULL}, + { "GridsMap_end", _wrap_GridsMap_end, METH_O, NULL}, + { "GridsMap_rbegin", _wrap_GridsMap_rbegin, METH_O, NULL}, + { "GridsMap_rend", _wrap_GridsMap_rend, METH_O, NULL}, + { "GridsMap_clear", _wrap_GridsMap_clear, METH_O, NULL}, + { "GridsMap_get_allocator", _wrap_GridsMap_get_allocator, METH_O, NULL}, + { "GridsMap_count", _wrap_GridsMap_count, METH_VARARGS, NULL}, + { "GridsMap_erase", _wrap_GridsMap_erase, METH_VARARGS, NULL}, + { "GridsMap_find", _wrap_GridsMap_find, METH_VARARGS, NULL}, + { "GridsMap_lower_bound", _wrap_GridsMap_lower_bound, METH_VARARGS, NULL}, + { "GridsMap_upper_bound", _wrap_GridsMap_upper_bound, METH_VARARGS, NULL}, + { "delete_GridsMap", _wrap_delete_GridsMap, METH_O, NULL}, + { "GridsMap_swigregister", GridsMap_swigregister, METH_O, NULL}, + { "GridsMap_swiginit", GridsMap_swiginit, METH_VARARGS, NULL}, + { "new_CdiGrid", _wrap_new_CdiGrid, METH_VARARGS, NULL}, + { "delete_CdiGrid", _wrap_delete_CdiGrid, METH_O, NULL}, + { "CdiGrid_gridID_set", _wrap_CdiGrid_gridID_set, METH_VARARGS, NULL}, + { "CdiGrid_gridID_get", _wrap_CdiGrid_gridID_get, METH_O, NULL}, + { "CdiGrid_type_set", _wrap_CdiGrid_type_set, METH_VARARGS, NULL}, + { "CdiGrid_type_get", _wrap_CdiGrid_type_get, METH_O, NULL}, + { "CdiGrid_size_set", _wrap_CdiGrid_size_set, METH_VARARGS, NULL}, + { "CdiGrid_size_get", _wrap_CdiGrid_size_get, METH_O, NULL}, + { "CdiGrid_xsize_set", _wrap_CdiGrid_xsize_set, METH_VARARGS, NULL}, + { "CdiGrid_xsize_get", _wrap_CdiGrid_xsize_get, METH_O, NULL}, + { "CdiGrid_ysize_set", _wrap_CdiGrid_ysize_set, METH_VARARGS, NULL}, + { "CdiGrid_ysize_get", _wrap_CdiGrid_ysize_get, METH_O, NULL}, + { "CdiGrid_prec_set", _wrap_CdiGrid_prec_set, METH_VARARGS, NULL}, + { "CdiGrid_prec_get", _wrap_CdiGrid_prec_get, METH_O, NULL}, + { "CdiGrid_ncorner_set", _wrap_CdiGrid_ncorner_set, METH_VARARGS, NULL}, + { "CdiGrid_ncorner_get", _wrap_CdiGrid_ncorner_get, METH_O, NULL}, + { "CdiGrid_hasXValues_set", _wrap_CdiGrid_hasXValues_set, METH_VARARGS, NULL}, + { "CdiGrid_hasXValues_get", _wrap_CdiGrid_hasXValues_get, METH_O, NULL}, + { "CdiGrid_hasYValues_set", _wrap_CdiGrid_hasYValues_set, METH_VARARGS, NULL}, + { "CdiGrid_hasYValues_get", _wrap_CdiGrid_hasYValues_get, METH_O, NULL}, + { "CdiGrid_hasBounds_set", _wrap_CdiGrid_hasBounds_set, METH_VARARGS, NULL}, + { "CdiGrid_hasBounds_get", _wrap_CdiGrid_hasBounds_get, METH_O, NULL}, + { "CdiGrid_xvalues_set", _wrap_CdiGrid_xvalues_set, METH_VARARGS, NULL}, + { "CdiGrid_xvalues_get", _wrap_CdiGrid_xvalues_get, METH_O, NULL}, + { "CdiGrid_yvalues_set", _wrap_CdiGrid_yvalues_set, METH_VARARGS, NULL}, + { "CdiGrid_yvalues_get", _wrap_CdiGrid_yvalues_get, METH_O, NULL}, + { "CdiGrid_xbounds_set", _wrap_CdiGrid_xbounds_set, METH_VARARGS, NULL}, + { "CdiGrid_xbounds_get", _wrap_CdiGrid_xbounds_get, METH_O, NULL}, + { "CdiGrid_ybounds_set", _wrap_CdiGrid_ybounds_set, METH_VARARGS, NULL}, + { "CdiGrid_ybounds_get", _wrap_CdiGrid_ybounds_get, METH_O, NULL}, + { "CdiGrid_xname_set", _wrap_CdiGrid_xname_set, METH_VARARGS, NULL}, + { "CdiGrid_xname_get", _wrap_CdiGrid_xname_get, METH_O, NULL}, + { "CdiGrid_xlongname_set", _wrap_CdiGrid_xlongname_set, METH_VARARGS, NULL}, + { "CdiGrid_xlongname_get", _wrap_CdiGrid_xlongname_get, METH_O, NULL}, + { "CdiGrid_xstdname_set", _wrap_CdiGrid_xstdname_set, METH_VARARGS, NULL}, + { "CdiGrid_xstdname_get", _wrap_CdiGrid_xstdname_get, METH_O, NULL}, + { "CdiGrid_xunits_set", _wrap_CdiGrid_xunits_set, METH_VARARGS, NULL}, + { "CdiGrid_xunits_get", _wrap_CdiGrid_xunits_get, METH_O, NULL}, + { "CdiGrid_yname_set", _wrap_CdiGrid_yname_set, METH_VARARGS, NULL}, + { "CdiGrid_yname_get", _wrap_CdiGrid_yname_get, METH_O, NULL}, + { "CdiGrid_ylongname_set", _wrap_CdiGrid_ylongname_set, METH_VARARGS, NULL}, + { "CdiGrid_ylongname_get", _wrap_CdiGrid_ylongname_get, METH_O, NULL}, + { "CdiGrid_ystdname_set", _wrap_CdiGrid_ystdname_set, METH_VARARGS, NULL}, + { "CdiGrid_ystdname_get", _wrap_CdiGrid_ystdname_get, METH_O, NULL}, + { "CdiGrid_yunits_set", _wrap_CdiGrid_yunits_set, METH_VARARGS, NULL}, + { "CdiGrid_yunits_get", _wrap_CdiGrid_yunits_get, METH_O, NULL}, + { "CdiGrid_name_set", _wrap_CdiGrid_name_set, METH_VARARGS, NULL}, + { "CdiGrid_name_get", _wrap_CdiGrid_name_get, METH_O, NULL}, + { "CdiGrid_getValues", _wrap_CdiGrid_getValues, METH_O, NULL}, + { "CdiGrid_getBounds", _wrap_CdiGrid_getBounds, METH_O, NULL}, + { "CdiGrid_getValuesAsPointer", _wrap_CdiGrid_getValuesAsPointer, METH_VARARGS, NULL}, + { "CdiGrid_getBoundsAsPointer", _wrap_CdiGrid_getBoundsAsPointer, METH_VARARGS, NULL}, + { "CdiGrid_getFloatVals", _wrap_CdiGrid_getFloatVals, METH_VARARGS, NULL}, + { "CdiGrid_getFloatBounds", _wrap_CdiGrid_getFloatBounds, METH_VARARGS, NULL}, + { "CdiGrid_swigregister", CdiGrid_swigregister, METH_O, NULL}, + { "CdiGrid_swiginit", CdiGrid_swiginit, METH_VARARGS, NULL}, + { "new_CdiTaxis", _wrap_new_CdiTaxis, METH_VARARGS, NULL}, + { "delete_CdiTaxis", _wrap_delete_CdiTaxis, METH_O, NULL}, + { "CdiTaxis_taxisID_set", _wrap_CdiTaxis_taxisID_set, METH_VARARGS, NULL}, + { "CdiTaxis_taxisID_get", _wrap_CdiTaxis_taxisID_get, METH_O, NULL}, + { "CdiTaxis_ntsteps_set", _wrap_CdiTaxis_ntsteps_set, METH_VARARGS, NULL}, + { "CdiTaxis_ntsteps_get", _wrap_CdiTaxis_ntsteps_get, METH_O, NULL}, + { "CdiTaxis_unit_set", _wrap_CdiTaxis_unit_set, METH_VARARGS, NULL}, + { "CdiTaxis_unit_get", _wrap_CdiTaxis_unit_get, METH_O, NULL}, + { "CdiTaxis_rdate_set", _wrap_CdiTaxis_rdate_set, METH_VARARGS, NULL}, + { "CdiTaxis_rdate_get", _wrap_CdiTaxis_rdate_get, METH_O, NULL}, + { "CdiTaxis_rtime_set", _wrap_CdiTaxis_rtime_set, METH_VARARGS, NULL}, + { "CdiTaxis_rtime_get", _wrap_CdiTaxis_rtime_get, METH_O, NULL}, + { "CdiTaxis_vdate_set", _wrap_CdiTaxis_vdate_set, METH_VARARGS, NULL}, + { "CdiTaxis_vdate_get", _wrap_CdiTaxis_vdate_get, METH_O, NULL}, + { "CdiTaxis_vtime_set", _wrap_CdiTaxis_vtime_set, METH_VARARGS, NULL}, + { "CdiTaxis_vtime_get", _wrap_CdiTaxis_vtime_get, METH_O, NULL}, + { "CdiTaxis_type_set", _wrap_CdiTaxis_type_set, METH_VARARGS, NULL}, + { "CdiTaxis_type_get", _wrap_CdiTaxis_type_get, METH_O, NULL}, + { "CdiTaxis_calendar_set", _wrap_CdiTaxis_calendar_set, METH_VARARGS, NULL}, + { "CdiTaxis_calendar_get", _wrap_CdiTaxis_calendar_get, METH_O, NULL}, + { "CdiTaxis_hasBounds_set", _wrap_CdiTaxis_hasBounds_set, METH_VARARGS, NULL}, + { "CdiTaxis_hasBounds_get", _wrap_CdiTaxis_hasBounds_get, METH_O, NULL}, + { "CdiTaxis_name_set", _wrap_CdiTaxis_name_set, METH_VARARGS, NULL}, + { "CdiTaxis_name_get", _wrap_CdiTaxis_name_get, METH_O, NULL}, + { "CdiTaxis_unitname_set", _wrap_CdiTaxis_unitname_set, METH_VARARGS, NULL}, + { "CdiTaxis_unitname_get", _wrap_CdiTaxis_unitname_get, METH_O, NULL}, + { "CdiTaxis_swigregister", CdiTaxis_swigregister, METH_O, NULL}, + { "CdiTaxis_swiginit", CdiTaxis_swiginit, METH_VARARGS, NULL}, + { "new_CdiZaxis", _wrap_new_CdiZaxis, METH_VARARGS, NULL}, + { "delete_CdiZaxis", _wrap_delete_CdiZaxis, METH_O, NULL}, + { "CdiZaxis_zaxisID_set", _wrap_CdiZaxis_zaxisID_set, METH_VARARGS, NULL}, + { "CdiZaxis_zaxisID_get", _wrap_CdiZaxis_zaxisID_get, METH_O, NULL}, + { "CdiZaxis_type_set", _wrap_CdiZaxis_type_set, METH_VARARGS, NULL}, + { "CdiZaxis_type_get", _wrap_CdiZaxis_type_get, METH_O, NULL}, + { "CdiZaxis_ltype_set", _wrap_CdiZaxis_ltype_set, METH_VARARGS, NULL}, + { "CdiZaxis_ltype_get", _wrap_CdiZaxis_ltype_get, METH_O, NULL}, + { "CdiZaxis_size_set", _wrap_CdiZaxis_size_set, METH_VARARGS, NULL}, + { "CdiZaxis_size_get", _wrap_CdiZaxis_size_get, METH_O, NULL}, + { "CdiZaxis_prec_set", _wrap_CdiZaxis_prec_set, METH_VARARGS, NULL}, + { "CdiZaxis_prec_get", _wrap_CdiZaxis_prec_get, METH_O, NULL}, + { "CdiZaxis_plevels_set", _wrap_CdiZaxis_plevels_set, METH_VARARGS, NULL}, + { "CdiZaxis_plevels_get", _wrap_CdiZaxis_plevels_get, METH_O, NULL}, + { "CdiZaxis_plbounds_set", _wrap_CdiZaxis_plbounds_set, METH_VARARGS, NULL}, + { "CdiZaxis_plbounds_get", _wrap_CdiZaxis_plbounds_get, METH_O, NULL}, + { "CdiZaxis_pubounds_set", _wrap_CdiZaxis_pubounds_set, METH_VARARGS, NULL}, + { "CdiZaxis_pubounds_get", _wrap_CdiZaxis_pubounds_get, METH_O, NULL}, + { "CdiZaxis_pweights_set", _wrap_CdiZaxis_pweights_set, METH_VARARGS, NULL}, + { "CdiZaxis_pweights_get", _wrap_CdiZaxis_pweights_get, METH_O, NULL}, + { "CdiZaxis_levels_set", _wrap_CdiZaxis_levels_set, METH_VARARGS, NULL}, + { "CdiZaxis_levels_get", _wrap_CdiZaxis_levels_get, METH_O, NULL}, + { "CdiZaxis_lbounds_set", _wrap_CdiZaxis_lbounds_set, METH_VARARGS, NULL}, + { "CdiZaxis_lbounds_get", _wrap_CdiZaxis_lbounds_get, METH_O, NULL}, + { "CdiZaxis_ubounds_set", _wrap_CdiZaxis_ubounds_set, METH_VARARGS, NULL}, + { "CdiZaxis_ubounds_get", _wrap_CdiZaxis_ubounds_get, METH_O, NULL}, + { "CdiZaxis_weights_set", _wrap_CdiZaxis_weights_set, METH_VARARGS, NULL}, + { "CdiZaxis_weights_get", _wrap_CdiZaxis_weights_get, METH_O, NULL}, + { "CdiZaxis_name_set", _wrap_CdiZaxis_name_set, METH_VARARGS, NULL}, + { "CdiZaxis_name_get", _wrap_CdiZaxis_name_get, METH_O, NULL}, + { "CdiZaxis_longname_set", _wrap_CdiZaxis_longname_set, METH_VARARGS, NULL}, + { "CdiZaxis_longname_get", _wrap_CdiZaxis_longname_get, METH_O, NULL}, + { "CdiZaxis_units_set", _wrap_CdiZaxis_units_set, METH_VARARGS, NULL}, + { "CdiZaxis_units_get", _wrap_CdiZaxis_units_get, METH_O, NULL}, + { "CdiZaxis_swigregister", CdiZaxis_swigregister, METH_O, NULL}, + { "CdiZaxis_swiginit", CdiZaxis_swiginit, METH_VARARGS, NULL}, + { "new_CdiVariable", _wrap_new_CdiVariable, METH_VARARGS, NULL}, + { "delete_CdiVariable", _wrap_delete_CdiVariable, METH_O, NULL}, + { "CdiVariable_varID_set", _wrap_CdiVariable_varID_set, METH_VARARGS, NULL}, + { "CdiVariable_varID_get", _wrap_CdiVariable_varID_get, METH_O, NULL}, + { "CdiVariable_zaxisID_set", _wrap_CdiVariable_zaxisID_set, METH_VARARGS, NULL}, + { "CdiVariable_zaxisID_get", _wrap_CdiVariable_zaxisID_get, METH_O, NULL}, + { "CdiVariable_gridID_set", _wrap_CdiVariable_gridID_set, METH_VARARGS, NULL}, + { "CdiVariable_gridID_get", _wrap_CdiVariable_gridID_get, METH_O, NULL}, + { "CdiVariable_taxisID_set", _wrap_CdiVariable_taxisID_set, METH_VARARGS, NULL}, + { "CdiVariable_taxisID_get", _wrap_CdiVariable_taxisID_get, METH_O, NULL}, + { "CdiVariable_timeID_set", _wrap_CdiVariable_timeID_set, METH_VARARGS, NULL}, + { "CdiVariable_timeID_get", _wrap_CdiVariable_timeID_get, METH_O, NULL}, + { "CdiVariable_vlistID_set", _wrap_CdiVariable_vlistID_set, METH_VARARGS, NULL}, + { "CdiVariable_vlistID_get", _wrap_CdiVariable_vlistID_get, METH_O, NULL}, + { "CdiVariable_size_set", _wrap_CdiVariable_size_set, METH_VARARGS, NULL}, + { "CdiVariable_size_get", _wrap_CdiVariable_size_get, METH_O, NULL}, + { "CdiVariable_code_set", _wrap_CdiVariable_code_set, METH_VARARGS, NULL}, + { "CdiVariable_code_get", _wrap_CdiVariable_code_get, METH_O, NULL}, + { "CdiVariable_datatype_set", _wrap_CdiVariable_datatype_set, METH_VARARGS, NULL}, + { "CdiVariable_datatype_get", _wrap_CdiVariable_datatype_get, METH_O, NULL}, + { "CdiVariable_streamID_set", _wrap_CdiVariable_streamID_set, METH_VARARGS, NULL}, + { "CdiVariable_streamID_get", _wrap_CdiVariable_streamID_get, METH_O, NULL}, + { "CdiVariable_name_set", _wrap_CdiVariable_name_set, METH_VARARGS, NULL}, + { "CdiVariable_name_get", _wrap_CdiVariable_name_get, METH_O, NULL}, + { "CdiVariable_longname_set", _wrap_CdiVariable_longname_set, METH_VARARGS, NULL}, + { "CdiVariable_longname_get", _wrap_CdiVariable_longname_get, METH_O, NULL}, + { "CdiVariable_units_set", _wrap_CdiVariable_units_set, METH_VARARGS, NULL}, + { "CdiVariable_units_get", _wrap_CdiVariable_units_get, METH_O, NULL}, + { "CdiVariable_stdname_set", _wrap_CdiVariable_stdname_set, METH_VARARGS, NULL}, + { "CdiVariable_stdname_get", _wrap_CdiVariable_stdname_get, METH_O, NULL}, + { "CdiVariable_missval_set", _wrap_CdiVariable_missval_set, METH_VARARGS, NULL}, + { "CdiVariable_missval_get", _wrap_CdiVariable_missval_get, METH_O, NULL}, + { "CdiVariable_values_set", _wrap_CdiVariable_values_set, METH_VARARGS, NULL}, + { "CdiVariable_values_get", _wrap_CdiVariable_values_get, METH_O, NULL}, + { "CdiVariable_valuesWithLevel_set", _wrap_CdiVariable_valuesWithLevel_set, METH_VARARGS, NULL}, + { "CdiVariable_valuesWithLevel_get", _wrap_CdiVariable_valuesWithLevel_get, METH_O, NULL}, + { "CdiVariable_grid_set", _wrap_CdiVariable_grid_set, METH_VARARGS, NULL}, + { "CdiVariable_grid_get", _wrap_CdiVariable_grid_get, METH_O, NULL}, + { "CdiVariable_zaxis_set", _wrap_CdiVariable_zaxis_set, METH_VARARGS, NULL}, + { "CdiVariable_zaxis_get", _wrap_CdiVariable_zaxis_get, METH_O, NULL}, + { "CdiVariable_taxis_set", _wrap_CdiVariable_taxis_set, METH_VARARGS, NULL}, + { "CdiVariable_taxis_get", _wrap_CdiVariable_taxis_get, METH_O, NULL}, + { "CdiVariable_sinfo", _wrap_CdiVariable_sinfo, METH_O, NULL}, + { "CdiVariable_getValues", _wrap_CdiVariable_getValues, METH_O, NULL}, + { "CdiVariable_getValuesWithLevel", _wrap_CdiVariable_getValuesWithLevel, METH_VARARGS, NULL}, + { "CdiVariable_getFValues", _wrap_CdiVariable_getFValues, METH_O, NULL}, + { "CdiVariable_getFValuesWithLevel", _wrap_CdiVariable_getFValuesWithLevel, METH_VARARGS, NULL}, + { "CdiVariable_getValuesAsPointer", _wrap_CdiVariable_getValuesAsPointer, METH_O, NULL}, + { "CdiVariable_getValuesWithLevelAsPointer", _wrap_CdiVariable_getValuesWithLevelAsPointer, METH_VARARGS, NULL}, + { "CdiVariable_swigregister", CdiVariable_swigregister, METH_O, NULL}, + { "CdiVariable_swiginit", CdiVariable_swiginit, METH_VARARGS, NULL}, + { "new_Cdi", _wrap_new_Cdi, METH_O, NULL}, + { "delete_Cdi", _wrap_delete_Cdi, METH_O, NULL}, + { "Cdi_streamID_set", _wrap_Cdi_streamID_set, METH_VARARGS, NULL}, + { "Cdi_streamID_get", _wrap_Cdi_streamID_get, METH_O, NULL}, + { "Cdi_vlistID_set", _wrap_Cdi_vlistID_set, METH_VARARGS, NULL}, + { "Cdi_vlistID_get", _wrap_Cdi_vlistID_get, METH_O, NULL}, + { "Cdi_nvars_set", _wrap_Cdi_nvars_set, METH_VARARGS, NULL}, + { "Cdi_nvars_get", _wrap_Cdi_nvars_get, METH_O, NULL}, + { "Cdi_nzaxes_set", _wrap_Cdi_nzaxes_set, METH_VARARGS, NULL}, + { "Cdi_nzaxes_get", _wrap_Cdi_nzaxes_get, METH_O, NULL}, + { "Cdi_ngrids_set", _wrap_Cdi_ngrids_set, METH_VARARGS, NULL}, + { "Cdi_ngrids_get", _wrap_Cdi_ngrids_get, METH_O, NULL}, + { "Cdi_ntaxes_set", _wrap_Cdi_ntaxes_set, METH_VARARGS, NULL}, + { "Cdi_ntaxes_get", _wrap_Cdi_ntaxes_get, METH_O, NULL}, + { "Cdi_taxisID_set", _wrap_Cdi_taxisID_set, METH_VARARGS, NULL}, + { "Cdi_taxisID_get", _wrap_Cdi_taxisID_get, METH_O, NULL}, + { "Cdi_varnames_set", _wrap_Cdi_varnames_set, METH_VARARGS, NULL}, + { "Cdi_varnames_get", _wrap_Cdi_varnames_get, METH_O, NULL}, + { "Cdi_codes_set", _wrap_Cdi_codes_set, METH_VARARGS, NULL}, + { "Cdi_codes_get", _wrap_Cdi_codes_get, METH_O, NULL}, + { "Cdi_variables_set", _wrap_Cdi_variables_set, METH_VARARGS, NULL}, + { "Cdi_variables_get", _wrap_Cdi_variables_get, METH_O, NULL}, + { "Cdi_var_set", _wrap_Cdi_var_set, METH_VARARGS, NULL}, + { "Cdi_var_get", _wrap_Cdi_var_get, METH_O, NULL}, + { "Cdi_varByCode_set", _wrap_Cdi_varByCode_set, METH_VARARGS, NULL}, + { "Cdi_varByCode_get", _wrap_Cdi_varByCode_get, METH_O, NULL}, + { "Cdi_taxes_set", _wrap_Cdi_taxes_set, METH_VARARGS, NULL}, + { "Cdi_taxes_get", _wrap_Cdi_taxes_get, METH_O, NULL}, + { "Cdi_zaxes_set", _wrap_Cdi_zaxes_set, METH_VARARGS, NULL}, + { "Cdi_zaxes_get", _wrap_Cdi_zaxes_get, METH_O, NULL}, + { "Cdi_grids_set", _wrap_Cdi_grids_set, METH_VARARGS, NULL}, + { "Cdi_grids_get", _wrap_Cdi_grids_get, METH_O, NULL}, + { "Cdi_griddes", _wrap_Cdi_griddes, METH_O, NULL}, + { "Cdi_swigregister", Cdi_swigregister, METH_O, NULL}, + { "Cdi_swiginit", Cdi_swiginit, METH_VARARGS, NULL}, + { NULL, NULL, 0, NULL } +}; + +static PyMethodDef SwigMethods_proxydocs[] = { + { NULL, NULL, 0, NULL } +}; + + +/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */ + +static swig_type_info _swigt__p_Cdi = {"_p_Cdi", "Cdi *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_CdiGrid = {"_p_CdiGrid", "std::map< int,CdiGrid >::mapped_type *|CdiGrid *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_CdiTaxis = {"_p_CdiTaxis", "std::map< int,CdiTaxis >::mapped_type *|CdiTaxis *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_CdiVariable = {"_p_CdiVariable", "std::map< std::string,CdiVariable >::mapped_type *|std::vector< CdiVariable >::value_type *|std::map< int,CdiVariable >::mapped_type *|CdiVariable *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_CdiZaxis = {"_p_CdiZaxis", "std::map< int,CdiZaxis >::mapped_type *|CdiZaxis *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_allocator_type = {"_p_allocator_type", "allocator_type *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_difference_type = {"_p_difference_type", "difference_type *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_double = {"_p_double", "double *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_float = {"_p_float", "float *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_key_type = {"_p_key_type", "key_type *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_mapped_type = {"_p_mapped_type", "mapped_type *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_p_PyObject = {"_p_p_PyObject", "PyObject **", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_p_double = {"_p_p_double", "double **", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_size_type = {"_p_size_type", "size_type *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_std__allocatorT_CdiVariable_t = {"_p_std__allocatorT_CdiVariable_t", "std::vector< CdiVariable >::allocator_type *|std::allocator< CdiVariable > *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_std__allocatorT_double_t = {"_p_std__allocatorT_double_t", "std::vector< double >::allocator_type *|std::allocator< double > *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_std__allocatorT_int_t = {"_p_std__allocatorT_int_t", "std::vector< int >::allocator_type *|std::allocator< int > *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_std__allocatorT_std__pairT_int_const_CdiGrid_t_t = {"_p_std__allocatorT_std__pairT_int_const_CdiGrid_t_t", "std::map< int,CdiGrid >::allocator_type *|std::allocator< std::pair< int const,CdiGrid > > *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t = {"_p_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t", "std::map< int,CdiTaxis >::allocator_type *|std::allocator< std::pair< int const,CdiTaxis > > *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_std__allocatorT_std__pairT_int_const_CdiVariable_t_t = {"_p_std__allocatorT_std__pairT_int_const_CdiVariable_t_t", "std::map< int,CdiVariable >::allocator_type *|std::allocator< std::pair< int const,CdiVariable > > *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t = {"_p_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t", "std::map< int,CdiZaxis >::allocator_type *|std::allocator< std::pair< int const,CdiZaxis > > *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t = {"_p_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t", "std::allocator< std::pair< std::string const,CdiVariable > > *|std::map< std::string,CdiVariable >::allocator_type *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_std__allocatorT_std__string_t = {"_p_std__allocatorT_std__string_t", "std::vector< std::string >::allocator_type *|std::allocator< std::string > *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t = {"_p_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t", "std::vector< std::vector< double > >::allocator_type *|std::allocator< std::vector< double,std::allocator< double > > > *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_std__invalid_argument = {"_p_std__invalid_argument", "std::invalid_argument *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_std__lessT_int_t = {"_p_std__lessT_int_t", "std::less< int > *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_std__lessT_std__string_t = {"_p_std__lessT_std__string_t", "std::less< std::string > *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t = {"_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t", "std::map< int,CdiGrid > *|std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > > *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t = {"_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t", "std::map< int,CdiTaxis > *|std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > > *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t = {"_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t", "std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > > *|std::map< int,CdiVariable > *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t = {"_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t", "std::map< int,CdiZaxis > *|std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > > *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t = {"_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t", "std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > > *|std::map< std::string,CdiVariable > *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t = {"_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t", "std::vector< CdiVariable,std::allocator< CdiVariable > > *|std::vector< CdiVariable > *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_std__vectorT_double_std__allocatorT_double_t_t = {"_p_std__vectorT_double_std__allocatorT_double_t_t", "std::vector< double,std::allocator< double > > *|std::vector< double > *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_std__vectorT_float_std__allocatorT_float_t_t = {"_p_std__vectorT_float_std__allocatorT_float_t_t", "std::vector< float,std::allocator< float > > *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_std__vectorT_int_std__allocatorT_int_t_t = {"_p_std__vectorT_int_std__allocatorT_int_t_t", "std::vector< int,std::allocator< int > > *|std::vector< int > *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_std__vectorT_std__string_std__allocatorT_std__string_t_t = {"_p_std__vectorT_std__string_std__allocatorT_std__string_t_t", "std::vector< std::string,std::allocator< std::string > > *|std::vector< std::string > *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t = {"_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t", "std::vector< std::vector< double > > *|std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *|std::vector< std::vector< double,std::allocator< double > > > *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_std__vectorT_std__vectorT_float_std__allocatorT_float_t_t_std__allocatorT_std__vectorT_float_std__allocatorT_float_t_t_t_t = {"_p_std__vectorT_std__vectorT_float_std__allocatorT_float_t_t_std__allocatorT_std__vectorT_float_std__allocatorT_float_t_t_t_t", "std::vector< std::vector< float,std::allocator< float > >,std::allocator< std::vector< float,std::allocator< float > > > > *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_swig__SwigPyIterator = {"_p_swig__SwigPyIterator", "swig::SwigPyIterator *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_value_type = {"_p_value_type", "value_type *", 0, 0, (void*)0, 0}; + +static swig_type_info *swig_type_initial[] = { + &_swigt__p_Cdi, + &_swigt__p_CdiGrid, + &_swigt__p_CdiTaxis, + &_swigt__p_CdiVariable, + &_swigt__p_CdiZaxis, + &_swigt__p_allocator_type, + &_swigt__p_char, + &_swigt__p_difference_type, + &_swigt__p_double, + &_swigt__p_float, + &_swigt__p_key_type, + &_swigt__p_mapped_type, + &_swigt__p_p_PyObject, + &_swigt__p_p_double, + &_swigt__p_size_type, + &_swigt__p_std__allocatorT_CdiVariable_t, + &_swigt__p_std__allocatorT_double_t, + &_swigt__p_std__allocatorT_int_t, + &_swigt__p_std__allocatorT_std__pairT_int_const_CdiGrid_t_t, + &_swigt__p_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t, + &_swigt__p_std__allocatorT_std__pairT_int_const_CdiVariable_t_t, + &_swigt__p_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t, + &_swigt__p_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t, + &_swigt__p_std__allocatorT_std__string_t, + &_swigt__p_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t, + &_swigt__p_std__invalid_argument, + &_swigt__p_std__lessT_int_t, + &_swigt__p_std__lessT_std__string_t, + &_swigt__p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, + &_swigt__p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, + &_swigt__p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, + &_swigt__p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, + &_swigt__p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, + &_swigt__p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, + &_swigt__p_std__vectorT_double_std__allocatorT_double_t_t, + &_swigt__p_std__vectorT_float_std__allocatorT_float_t_t, + &_swigt__p_std__vectorT_int_std__allocatorT_int_t_t, + &_swigt__p_std__vectorT_std__string_std__allocatorT_std__string_t_t, + &_swigt__p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, + &_swigt__p_std__vectorT_std__vectorT_float_std__allocatorT_float_t_t_std__allocatorT_std__vectorT_float_std__allocatorT_float_t_t_t_t, + &_swigt__p_swig__SwigPyIterator, + &_swigt__p_value_type, +}; + +static swig_cast_info _swigc__p_Cdi[] = { {&_swigt__p_Cdi, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_CdiGrid[] = { {&_swigt__p_CdiGrid, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_CdiTaxis[] = { {&_swigt__p_CdiTaxis, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_CdiVariable[] = { {&_swigt__p_CdiVariable, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_CdiZaxis[] = { {&_swigt__p_CdiZaxis, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_allocator_type[] = { {&_swigt__p_allocator_type, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_difference_type[] = { {&_swigt__p_difference_type, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_double[] = { {&_swigt__p_double, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_float[] = { {&_swigt__p_float, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_key_type[] = { {&_swigt__p_key_type, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_mapped_type[] = { {&_swigt__p_mapped_type, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_p_PyObject[] = { {&_swigt__p_p_PyObject, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_p_double[] = { {&_swigt__p_p_double, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_size_type[] = { {&_swigt__p_size_type, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_std__allocatorT_CdiVariable_t[] = { {&_swigt__p_std__allocatorT_CdiVariable_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_std__allocatorT_double_t[] = { {&_swigt__p_std__allocatorT_double_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_std__allocatorT_int_t[] = { {&_swigt__p_std__allocatorT_int_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_std__allocatorT_std__pairT_int_const_CdiGrid_t_t[] = { {&_swigt__p_std__allocatorT_std__pairT_int_const_CdiGrid_t_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t[] = { {&_swigt__p_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_std__allocatorT_std__pairT_int_const_CdiVariable_t_t[] = { {&_swigt__p_std__allocatorT_std__pairT_int_const_CdiVariable_t_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t[] = { {&_swigt__p_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t[] = { {&_swigt__p_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_std__allocatorT_std__string_t[] = { {&_swigt__p_std__allocatorT_std__string_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t[] = { {&_swigt__p_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_std__invalid_argument[] = { {&_swigt__p_std__invalid_argument, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_std__lessT_int_t[] = { {&_swigt__p_std__lessT_int_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_std__lessT_std__string_t[] = { {&_swigt__p_std__lessT_std__string_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t[] = { {&_swigt__p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t[] = { {&_swigt__p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t[] = { {&_swigt__p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t[] = { {&_swigt__p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t[] = { {&_swigt__p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t[] = { {&_swigt__p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_std__vectorT_double_std__allocatorT_double_t_t[] = { {&_swigt__p_std__vectorT_double_std__allocatorT_double_t_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_std__vectorT_float_std__allocatorT_float_t_t[] = { {&_swigt__p_std__vectorT_float_std__allocatorT_float_t_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_std__vectorT_int_std__allocatorT_int_t_t[] = { {&_swigt__p_std__vectorT_int_std__allocatorT_int_t_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_std__vectorT_std__string_std__allocatorT_std__string_t_t[] = { {&_swigt__p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t[] = { {&_swigt__p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_std__vectorT_std__vectorT_float_std__allocatorT_float_t_t_std__allocatorT_std__vectorT_float_std__allocatorT_float_t_t_t_t[] = { {&_swigt__p_std__vectorT_std__vectorT_float_std__allocatorT_float_t_t_std__allocatorT_std__vectorT_float_std__allocatorT_float_t_t_t_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_swig__SwigPyIterator[] = { {&_swigt__p_swig__SwigPyIterator, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_value_type[] = { {&_swigt__p_value_type, 0, 0, 0},{0, 0, 0, 0}}; + +static swig_cast_info *swig_cast_initial[] = { + _swigc__p_Cdi, + _swigc__p_CdiGrid, + _swigc__p_CdiTaxis, + _swigc__p_CdiVariable, + _swigc__p_CdiZaxis, + _swigc__p_allocator_type, + _swigc__p_char, + _swigc__p_difference_type, + _swigc__p_double, + _swigc__p_float, + _swigc__p_key_type, + _swigc__p_mapped_type, + _swigc__p_p_PyObject, + _swigc__p_p_double, + _swigc__p_size_type, + _swigc__p_std__allocatorT_CdiVariable_t, + _swigc__p_std__allocatorT_double_t, + _swigc__p_std__allocatorT_int_t, + _swigc__p_std__allocatorT_std__pairT_int_const_CdiGrid_t_t, + _swigc__p_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t, + _swigc__p_std__allocatorT_std__pairT_int_const_CdiVariable_t_t, + _swigc__p_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t, + _swigc__p_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t, + _swigc__p_std__allocatorT_std__string_t, + _swigc__p_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t, + _swigc__p_std__invalid_argument, + _swigc__p_std__lessT_int_t, + _swigc__p_std__lessT_std__string_t, + _swigc__p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, + _swigc__p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, + _swigc__p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, + _swigc__p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, + _swigc__p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, + _swigc__p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, + _swigc__p_std__vectorT_double_std__allocatorT_double_t_t, + _swigc__p_std__vectorT_float_std__allocatorT_float_t_t, + _swigc__p_std__vectorT_int_std__allocatorT_int_t_t, + _swigc__p_std__vectorT_std__string_std__allocatorT_std__string_t_t, + _swigc__p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, + _swigc__p_std__vectorT_std__vectorT_float_std__allocatorT_float_t_t_std__allocatorT_std__vectorT_float_std__allocatorT_float_t_t_t_t, + _swigc__p_swig__SwigPyIterator, + _swigc__p_value_type, +}; + + +/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */ + +static swig_const_info swig_const_table[] = { +{0, 0, 0, 0.0, 0, 0}}; + +#ifdef __cplusplus +} +#endif +/* ----------------------------------------------------------------------------- + * Type initialization: + * This problem is tough by the requirement that no dynamic + * memory is used. Also, since swig_type_info structures store pointers to + * swig_cast_info structures and swig_cast_info structures store pointers back + * to swig_type_info structures, we need some lookup code at initialization. + * The idea is that swig generates all the structures that are needed. + * The runtime then collects these partially filled structures. + * The SWIG_InitializeModule function takes these initial arrays out of + * swig_module, and does all the lookup, filling in the swig_module.types + * array with the correct data and linking the correct swig_cast_info + * structures together. + * + * The generated swig_type_info structures are assigned statically to an initial + * array. We just loop through that array, and handle each type individually. + * First we lookup if this type has been already loaded, and if so, use the + * loaded structure instead of the generated one. Then we have to fill in the + * cast linked list. The cast data is initially stored in something like a + * two-dimensional array. Each row corresponds to a type (there are the same + * number of rows as there are in the swig_type_initial array). Each entry in + * a column is one of the swig_cast_info structures for that type. + * The cast_initial array is actually an array of arrays, because each row has + * a variable number of columns. So to actually build the cast linked list, + * we find the array of casts associated with the type, and loop through it + * adding the casts to the list. The one last trick we need to do is making + * sure the type pointer in the swig_cast_info struct is correct. + * + * First off, we lookup the cast->type name to see if it is already loaded. + * There are three cases to handle: + * 1) If the cast->type has already been loaded AND the type we are adding + * casting info to has not been loaded (it is in this module), THEN we + * replace the cast->type pointer with the type pointer that has already + * been loaded. + * 2) If BOTH types (the one we are adding casting info to, and the + * cast->type) are loaded, THEN the cast info has already been loaded by + * the previous module so we just ignore it. + * 3) Finally, if cast->type has not already been loaded, then we add that + * swig_cast_info to the linked list (because the cast->type) pointer will + * be correct. + * ----------------------------------------------------------------------------- */ + +#ifdef __cplusplus +extern "C" { +#if 0 +} /* c-mode */ +#endif +#endif + +#if 0 +#define SWIGRUNTIME_DEBUG +#endif + + +SWIGRUNTIME void +SWIG_InitializeModule(void *clientdata) { + size_t i; + swig_module_info *module_head, *iter; + int init; + + /* check to see if the circular list has been setup, if not, set it up */ + if (swig_module.next==0) { + /* Initialize the swig_module */ + swig_module.type_initial = swig_type_initial; + swig_module.cast_initial = swig_cast_initial; + swig_module.next = &swig_module; + init = 1; + } else { + init = 0; + } + + /* Try and load any already created modules */ + module_head = SWIG_GetModule(clientdata); + if (!module_head) { + /* This is the first module loaded for this interpreter */ + /* so set the swig module into the interpreter */ + SWIG_SetModule(clientdata, &swig_module); + } else { + /* the interpreter has loaded a SWIG module, but has it loaded this one? */ + iter=module_head; + do { + if (iter==&swig_module) { + /* Our module is already in the list, so there's nothing more to do. */ + return; + } + iter=iter->next; + } while (iter!= module_head); + + /* otherwise we must add our module into the list */ + swig_module.next = module_head->next; + module_head->next = &swig_module; + } + + /* When multiple interpreters are used, a module could have already been initialized in + a different interpreter, but not yet have a pointer in this interpreter. + In this case, we do not want to continue adding types... everything should be + set up already */ + if (init == 0) return; + + /* Now work on filling in swig_module.types */ +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: size %lu\n", (unsigned long)swig_module.size); +#endif + for (i = 0; i < swig_module.size; ++i) { + swig_type_info *type = 0; + swig_type_info *ret; + swig_cast_info *cast; + +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: type %lu %s\n", (unsigned long)i, swig_module.type_initial[i]->name); +#endif + + /* if there is another module already loaded */ + if (swig_module.next != &swig_module) { + type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name); + } + if (type) { + /* Overwrite clientdata field */ +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: found type %s\n", type->name); +#endif + if (swig_module.type_initial[i]->clientdata) { + type->clientdata = swig_module.type_initial[i]->clientdata; +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name); +#endif + } + } else { + type = swig_module.type_initial[i]; + } + + /* Insert casting types */ + cast = swig_module.cast_initial[i]; + while (cast->type) { + /* Don't need to add information already in the list */ + ret = 0; +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: look cast %s\n", cast->type->name); +#endif + if (swig_module.next != &swig_module) { + ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name); +#ifdef SWIGRUNTIME_DEBUG + if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name); +#endif + } + if (ret) { + if (type == swig_module.type_initial[i]) { +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: skip old type %s\n", ret->name); +#endif + cast->type = ret; + ret = 0; + } else { + /* Check for casting already in the list */ + swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type); +#ifdef SWIGRUNTIME_DEBUG + if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name); +#endif + if (!ocast) ret = 0; + } + } + + if (!ret) { +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name); +#endif + if (type->cast) { + type->cast->prev = cast; + cast->next = type->cast; + } + type->cast = cast; + } + cast++; + } + /* Set entry in modules->types array equal to the type */ + swig_module.types[i] = type; + } + swig_module.types[i] = 0; + +#ifdef SWIGRUNTIME_DEBUG + printf("**** SWIG_InitializeModule: Cast List ******\n"); + for (i = 0; i < swig_module.size; ++i) { + int j = 0; + swig_cast_info *cast = swig_module.cast_initial[i]; + printf("SWIG_InitializeModule: type %lu %s\n", (unsigned long)i, swig_module.type_initial[i]->name); + while (cast->type) { + printf("SWIG_InitializeModule: cast type %s\n", cast->type->name); + cast++; + ++j; + } + printf("---- Total casts: %d\n",j); + } + printf("**** SWIG_InitializeModule: Cast List ******\n"); +#endif +} + +/* This function will propagate the clientdata field of type to +* any new swig_type_info structures that have been added into the list +* of equivalent types. It is like calling +* SWIG_TypeClientData(type, clientdata) a second time. +*/ +SWIGRUNTIME void +SWIG_PropagateClientData(void) { + size_t i; + swig_cast_info *equiv; + static int init_run = 0; + + if (init_run) return; + init_run = 1; + + for (i = 0; i < swig_module.size; i++) { + if (swig_module.types[i]->clientdata) { + equiv = swig_module.types[i]->cast; + while (equiv) { + if (!equiv->converter) { + if (equiv->type && !equiv->type->clientdata) + SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata); + } + equiv = equiv->next; + } + } + } +} + +#ifdef __cplusplus +#if 0 +{ + /* c-mode */ +#endif +} +#endif + + + +#ifdef __cplusplus +extern "C" { +#endif + + /* Python-specific SWIG API */ +#define SWIG_newvarlink() SWIG_Python_newvarlink() +#define SWIG_addvarlink(p, name, get_attr, set_attr) SWIG_Python_addvarlink(p, name, get_attr, set_attr) +#define SWIG_InstallConstants(d, constants) SWIG_Python_InstallConstants(d, constants) + + /* ----------------------------------------------------------------------------- + * global variable support code. + * ----------------------------------------------------------------------------- */ + + typedef struct swig_globalvar { + char *name; /* Name of global variable */ + PyObject *(*get_attr)(void); /* Return the current value */ + int (*set_attr)(PyObject *); /* Set the value */ + struct swig_globalvar *next; + } swig_globalvar; + + typedef struct swig_varlinkobject { + PyObject_HEAD + swig_globalvar *vars; + } swig_varlinkobject; + + SWIGINTERN PyObject * + swig_varlink_repr(swig_varlinkobject *SWIGUNUSEDPARM(v)) { +#if PY_VERSION_HEX >= 0x03000000 + return PyUnicode_InternFromString("<Swig global variables>"); +#else + return PyString_FromString("<Swig global variables>"); +#endif + } + + SWIGINTERN PyObject * + swig_varlink_str(swig_varlinkobject *v) { +#if PY_VERSION_HEX >= 0x03000000 + PyObject *str = PyUnicode_InternFromString("("); + PyObject *tail; + PyObject *joined; + swig_globalvar *var; + for (var = v->vars; var; var=var->next) { + tail = PyUnicode_FromString(var->name); + joined = PyUnicode_Concat(str, tail); + Py_DecRef(str); + Py_DecRef(tail); + str = joined; + if (var->next) { + tail = PyUnicode_InternFromString(", "); + joined = PyUnicode_Concat(str, tail); + Py_DecRef(str); + Py_DecRef(tail); + str = joined; + } + } + tail = PyUnicode_InternFromString(")"); + joined = PyUnicode_Concat(str, tail); + Py_DecRef(str); + Py_DecRef(tail); + str = joined; +#else + PyObject *str = PyString_FromString("("); + swig_globalvar *var; + for (var = v->vars; var; var=var->next) { + PyString_ConcatAndDel(&str,PyString_FromString(var->name)); + if (var->next) PyString_ConcatAndDel(&str,PyString_FromString(", ")); + } + PyString_ConcatAndDel(&str,PyString_FromString(")")); +#endif + return str; + } + + SWIGINTERN void + swig_varlink_dealloc(swig_varlinkobject *v) { + swig_globalvar *var = v->vars; + while (var) { + swig_globalvar *n = var->next; + free(var->name); + free(var); + var = n; + } + } + + SWIGINTERN PyObject * + swig_varlink_getattr(swig_varlinkobject *v, char *n) { + PyObject *res = NULL; + swig_globalvar *var = v->vars; + while (var) { + if (strcmp(var->name,n) == 0) { + res = (*var->get_attr)(); + break; + } + var = var->next; + } + if (res == NULL && !PyErr_Occurred()) { + PyErr_Format(PyExc_AttributeError, "Unknown C global variable '%s'", n); + } + return res; + } + + SWIGINTERN int + swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p) { + int res = 1; + swig_globalvar *var = v->vars; + while (var) { + if (strcmp(var->name,n) == 0) { + res = (*var->set_attr)(p); + break; + } + var = var->next; + } + if (res == 1 && !PyErr_Occurred()) { + PyErr_Format(PyExc_AttributeError, "Unknown C global variable '%s'", n); + } + return res; + } + + SWIGINTERN PyTypeObject* + swig_varlink_type(void) { + static char varlink__doc__[] = "Swig var link object"; + static PyTypeObject varlink_type; + static int type_init = 0; + if (!type_init) { + const PyTypeObject tmp = { +#if PY_VERSION_HEX >= 0x03000000 + PyVarObject_HEAD_INIT(NULL, 0) +#else + PyObject_HEAD_INIT(NULL) + 0, /* ob_size */ +#endif + "swigvarlink", /* tp_name */ + sizeof(swig_varlinkobject), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor) swig_varlink_dealloc, /* tp_dealloc */ + 0, /* tp_print */ + (getattrfunc) swig_varlink_getattr, /* tp_getattr */ + (setattrfunc) swig_varlink_setattr, /* tp_setattr */ + 0, /* tp_compare */ + (reprfunc) swig_varlink_repr, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + (reprfunc) swig_varlink_str, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + 0, /* tp_flags */ + varlink__doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* tp_iter -> tp_weaklist */ + 0, /* tp_del */ + 0, /* tp_version_tag */ +#if PY_VERSION_HEX >= 0x03040000 + 0, /* tp_finalize */ +#endif +#if PY_VERSION_HEX >= 0x03080000 + 0, /* tp_vectorcall */ +#endif +#if (PY_VERSION_HEX >= 0x03080000) && (PY_VERSION_HEX < 0x03090000) + 0, /* tp_print */ +#endif +#ifdef COUNT_ALLOCS + 0, /* tp_allocs */ + 0, /* tp_frees */ + 0, /* tp_maxalloc */ + 0, /* tp_prev */ + 0 /* tp_next */ +#endif + }; + varlink_type = tmp; + type_init = 1; + if (PyType_Ready(&varlink_type) < 0) + return NULL; + } + return &varlink_type; + } + + /* Create a variable linking object for use later */ + SWIGINTERN PyObject * + SWIG_Python_newvarlink(void) { + swig_varlinkobject *result = PyObject_NEW(swig_varlinkobject, swig_varlink_type()); + if (result) { + result->vars = 0; + } + return ((PyObject*) result); + } + + SWIGINTERN void + SWIG_Python_addvarlink(PyObject *p, const char *name, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) { + swig_varlinkobject *v = (swig_varlinkobject *) p; + swig_globalvar *gv = (swig_globalvar *) malloc(sizeof(swig_globalvar)); + if (gv) { + size_t size = strlen(name)+1; + gv->name = (char *)malloc(size); + if (gv->name) { + memcpy(gv->name, name, size); + gv->get_attr = get_attr; + gv->set_attr = set_attr; + gv->next = v->vars; + } + } + v->vars = gv; + } + + SWIGINTERN PyObject * + SWIG_globals(void) { + static PyObject *globals = 0; + if (!globals) { + globals = SWIG_newvarlink(); + } + return globals; + } + + /* ----------------------------------------------------------------------------- + * constants/methods manipulation + * ----------------------------------------------------------------------------- */ + + /* Install Constants */ + SWIGINTERN void + SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]) { + PyObject *obj = 0; + size_t i; + for (i = 0; constants[i].type; ++i) { + switch(constants[i].type) { + case SWIG_PY_POINTER: + obj = SWIG_InternalNewPointerObj(constants[i].pvalue, *(constants[i]).ptype,0); + break; + case SWIG_PY_BINARY: + obj = SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype)); + break; + default: + obj = 0; + break; + } + if (obj) { + PyDict_SetItemString(d, constants[i].name, obj); + Py_DECREF(obj); + } + } + } + + /* -----------------------------------------------------------------------------*/ + /* Fix SwigMethods to carry the callback ptrs when needed */ + /* -----------------------------------------------------------------------------*/ + + SWIGINTERN void + SWIG_Python_FixMethods(PyMethodDef *methods, + swig_const_info *const_table, + swig_type_info **types, + swig_type_info **types_initial) { + size_t i; + for (i = 0; methods[i].ml_name; ++i) { + const char *c = methods[i].ml_doc; + if (!c) continue; + c = strstr(c, "swig_ptr: "); + if (c) { + int j; + swig_const_info *ci = 0; + const char *name = c + 10; + for (j = 0; const_table[j].type; ++j) { + if (strncmp(const_table[j].name, name, + strlen(const_table[j].name)) == 0) { + ci = &(const_table[j]); + break; + } + } + if (ci) { + void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0; + if (ptr) { + size_t shift = (ci->ptype) - types; + swig_type_info *ty = types_initial[shift]; + size_t ldoc = (c - methods[i].ml_doc); + size_t lptr = strlen(ty->name)+2*sizeof(void*)+2; + char *ndoc = (char*)malloc(ldoc + lptr + 10); + if (ndoc) { + char *buff = ndoc; + memcpy(buff, methods[i].ml_doc, ldoc); + buff += ldoc; + memcpy(buff, "swig_ptr: ", 10); + buff += 10; + SWIG_PackVoidPtr(buff, ptr, ty->name, lptr); + methods[i].ml_doc = ndoc; + } + } + } + } + } + } + + /* ----------------------------------------------------------------------------- + * Method creation and docstring support functions + * ----------------------------------------------------------------------------- */ + + /* ----------------------------------------------------------------------------- + * Function to find the method definition with the correct docstring for the + * proxy module as opposed to the low-level API + * ----------------------------------------------------------------------------- */ + + SWIGINTERN PyMethodDef *SWIG_PythonGetProxyDoc(const char *name) { + /* Find the function in the modified method table */ + size_t offset = 0; + int found = 0; + while (SwigMethods_proxydocs[offset].ml_meth != NULL) { + if (strcmp(SwigMethods_proxydocs[offset].ml_name, name) == 0) { + found = 1; + break; + } + offset++; + } + /* Use the copy with the modified docstring if available */ + return found ? &SwigMethods_proxydocs[offset] : NULL; + } + + /* ----------------------------------------------------------------------------- + * Wrapper of PyInstanceMethod_New() used in Python 3 + * It is exported to the generated module, used for -fastproxy + * ----------------------------------------------------------------------------- */ + + SWIGINTERN PyObject *SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *func) { + if (PyCFunction_Check(func)) { + PyCFunctionObject *funcobj = (PyCFunctionObject *)func; + PyMethodDef *ml = SWIG_PythonGetProxyDoc(funcobj->m_ml->ml_name); + if (ml) + func = PyCFunction_NewEx(ml, funcobj->m_self, funcobj->m_module); + } +#if PY_VERSION_HEX >= 0x03000000 + return PyInstanceMethod_New(func); +#else + return PyMethod_New(func, NULL, NULL); +#endif + } + + /* ----------------------------------------------------------------------------- + * Wrapper of PyStaticMethod_New() + * It is exported to the generated module, used for -fastproxy + * ----------------------------------------------------------------------------- */ + + SWIGINTERN PyObject *SWIG_PyStaticMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *func) { + if (PyCFunction_Check(func)) { + PyCFunctionObject *funcobj = (PyCFunctionObject *)func; + PyMethodDef *ml = SWIG_PythonGetProxyDoc(funcobj->m_ml->ml_name); + if (ml) + func = PyCFunction_NewEx(ml, funcobj->m_self, funcobj->m_module); + } + return PyStaticMethod_New(func); + } + +#ifdef __cplusplus +} +#endif + +/* -----------------------------------------------------------------------------* + * Partial Init method + * -----------------------------------------------------------------------------*/ + +#ifdef __cplusplus +extern "C" +#endif + +SWIGEXPORT +#if PY_VERSION_HEX >= 0x03000000 +PyObject* +#else +void +#endif +SWIG_init(void) { + PyObject *m, *d, *md, *globals; + +#if PY_VERSION_HEX >= 0x03000000 + static struct PyModuleDef SWIG_module = { + PyModuleDef_HEAD_INIT, + SWIG_name, + NULL, + -1, + SwigMethods, + NULL, + NULL, + NULL, + NULL + }; +#endif + +#if defined(SWIGPYTHON_BUILTIN) + static SwigPyClientData SwigPyObject_clientdata = { + 0, 0, 0, 0, 0, 0, 0 + }; + static PyGetSetDef this_getset_def = { + (char *)"this", &SwigPyBuiltin_ThisClosure, NULL, NULL, NULL + }; + static SwigPyGetSet thisown_getset_closure = { + SwigPyObject_own, + SwigPyObject_own + }; + static PyGetSetDef thisown_getset_def = { + (char *)"thisown", SwigPyBuiltin_GetterClosure, SwigPyBuiltin_SetterClosure, NULL, &thisown_getset_closure + }; + PyTypeObject *builtin_pytype; + int builtin_base_count; + swig_type_info *builtin_basetype; + PyObject *tuple; + PyGetSetDescrObject *static_getset; + PyTypeObject *metatype; + PyTypeObject *swigpyobject; + SwigPyClientData *cd; + PyObject *public_interface, *public_symbol; + PyObject *this_descr; + PyObject *thisown_descr; + PyObject *self = 0; + int i; + + (void)builtin_pytype; + (void)builtin_base_count; + (void)builtin_basetype; + (void)tuple; + (void)static_getset; + (void)self; + + /* Metaclass is used to implement static member variables */ + metatype = SwigPyObjectType(); + assert(metatype); +#endif + + (void)globals; + + /* Create singletons now to avoid potential deadlocks with multi-threaded usage after module initialization */ + SWIG_This(); + SWIG_Python_TypeCache(); + SwigPyPacked_type(); +#ifndef SWIGPYTHON_BUILTIN + SwigPyObject_type(); +#endif + + /* Fix SwigMethods to carry the callback ptrs when needed */ + SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial); + +#if PY_VERSION_HEX >= 0x03000000 + m = PyModule_Create(&SWIG_module); +#else + m = Py_InitModule(SWIG_name, SwigMethods); +#endif + + md = d = PyModule_GetDict(m); + (void)md; + + SWIG_InitializeModule(0); + +#ifdef SWIGPYTHON_BUILTIN + swigpyobject = SwigPyObject_TypeOnce(); + + SwigPyObject_stype = SWIG_MangledTypeQuery("_p_SwigPyObject"); + assert(SwigPyObject_stype); + cd = (SwigPyClientData*) SwigPyObject_stype->clientdata; + if (!cd) { + SwigPyObject_stype->clientdata = &SwigPyObject_clientdata; + SwigPyObject_clientdata.pytype = swigpyobject; + } else if (swigpyobject->tp_basicsize != cd->pytype->tp_basicsize) { + PyErr_SetString(PyExc_RuntimeError, "Import error: attempted to load two incompatible swig-generated modules."); +# if PY_VERSION_HEX >= 0x03000000 + return NULL; +# else + return; +# endif + } + + /* All objects have a 'this' attribute */ + this_descr = PyDescr_NewGetSet(SwigPyObject_type(), &this_getset_def); + (void)this_descr; + + /* All objects have a 'thisown' attribute */ + thisown_descr = PyDescr_NewGetSet(SwigPyObject_type(), &thisown_getset_def); + (void)thisown_descr; + + public_interface = PyList_New(0); + public_symbol = 0; + (void)public_symbol; + + PyDict_SetItemString(md, "__all__", public_interface); + Py_DECREF(public_interface); + for (i = 0; SwigMethods[i].ml_name != NULL; ++i) + SwigPyBuiltin_AddPublicSymbol(public_interface, SwigMethods[i].ml_name); + for (i = 0; swig_const_table[i].name != 0; ++i) + SwigPyBuiltin_AddPublicSymbol(public_interface, swig_const_table[i].name); +#endif + + SWIG_InstallConstants(d,swig_const_table); + + + // thread safe initialization + swig::container_owner_attribute(); + +#if PY_VERSION_HEX >= 0x03000000 + return m; +#else + return; +#endif +} + diff --git a/interfaces/ruby/cdi_wrapper.cpp b/interfaces/ruby/cdi_wrapper.cpp new file mode 100644 index 0000000000000000000000000000000000000000..701e66dcd99312e01ea82ff1ef2bdf937c4ef673 --- /dev/null +++ b/interfaces/ruby/cdi_wrapper.cpp @@ -0,0 +1,33805 @@ +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 4.0.2 + * + * This file is not intended to be easily readable and contains a number of + * coding conventions designed to improve portability and efficiency. Do not make + * changes to this file unless you know what you are doing--modify the SWIG + * interface file instead. + * ----------------------------------------------------------------------------- */ + + +#ifndef SWIGRUBY +#define SWIGRUBY +#endif + + + +#ifdef __cplusplus +/* SwigValueWrapper is described in swig.swg */ +template<typename T> class SwigValueWrapper { + struct SwigMovePointer { + T *ptr; + SwigMovePointer(T *p) : ptr(p) { } + ~SwigMovePointer() { delete ptr; } + SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; } + } pointer; + SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs); + SwigValueWrapper(const SwigValueWrapper<T>& rhs); +public: + SwigValueWrapper() : pointer(0) { } + SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; } + operator T&() const { return *pointer.ptr; } + T *operator&() { return pointer.ptr; } +}; + +template <typename T> T SwigValueInit() { + return T(); +} +#endif + +/* ----------------------------------------------------------------------------- + * This section contains generic SWIG labels for method/variable + * declarations/attributes, and other compiler dependent labels. + * ----------------------------------------------------------------------------- */ + +/* template workaround for compilers that cannot correctly implement the C++ standard */ +#ifndef SWIGTEMPLATEDISAMBIGUATOR +# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560) +# define SWIGTEMPLATEDISAMBIGUATOR template +# elif defined(__HP_aCC) +/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */ +/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */ +# define SWIGTEMPLATEDISAMBIGUATOR template +# else +# define SWIGTEMPLATEDISAMBIGUATOR +# endif +#endif + +/* inline attribute */ +#ifndef SWIGINLINE +# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__)) +# define SWIGINLINE inline +# else +# define SWIGINLINE +# endif +#endif + +/* attribute recognised by some compilers to avoid 'unused' warnings */ +#ifndef SWIGUNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define SWIGUNUSED __attribute__ ((__unused__)) +# else +# define SWIGUNUSED +# endif +# elif defined(__ICC) +# define SWIGUNUSED __attribute__ ((__unused__)) +# else +# define SWIGUNUSED +# endif +#endif + +#ifndef SWIG_MSC_UNSUPPRESS_4505 +# if defined(_MSC_VER) +# pragma warning(disable : 4505) /* unreferenced local function has been removed */ +# endif +#endif + +#ifndef SWIGUNUSEDPARM +# ifdef __cplusplus +# define SWIGUNUSEDPARM(p) +# else +# define SWIGUNUSEDPARM(p) p SWIGUNUSED +# endif +#endif + +/* internal SWIG method */ +#ifndef SWIGINTERN +# define SWIGINTERN static SWIGUNUSED +#endif + +/* internal inline SWIG method */ +#ifndef SWIGINTERNINLINE +# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE +#endif + +/* exporting methods */ +#if defined(__GNUC__) +# if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) +# ifndef GCC_HASCLASSVISIBILITY +# define GCC_HASCLASSVISIBILITY +# endif +# endif +#endif + +#ifndef SWIGEXPORT +# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# if defined(STATIC_LINKED) +# define SWIGEXPORT +# else +# define SWIGEXPORT __declspec(dllexport) +# endif +# else +# if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY) +# define SWIGEXPORT __attribute__ ((visibility("default"))) +# else +# define SWIGEXPORT +# endif +# endif +#endif + +/* calling conventions for Windows */ +#ifndef SWIGSTDCALL +# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# define SWIGSTDCALL __stdcall +# else +# define SWIGSTDCALL +# endif +#endif + +/* Deal with Microsoft's attempt at deprecating C standard runtime functions */ +#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) +# define _CRT_SECURE_NO_DEPRECATE +#endif + +/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */ +#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE) +# define _SCL_SECURE_NO_DEPRECATE +#endif + +/* Deal with Apple's deprecated 'AssertMacros.h' from Carbon-framework */ +#if defined(__APPLE__) && !defined(__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES) +# define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0 +#endif + +/* Intel's compiler complains if a variable which was never initialised is + * cast to void, which is a common idiom which we use to indicate that we + * are aware a variable isn't used. So we just silence that warning. + * See: https://github.com/swig/swig/issues/192 for more discussion. + */ +#ifdef __INTEL_COMPILER +# pragma warning disable 592 +#endif + +/* ----------------------------------------------------------------------------- + * This section contains generic SWIG labels for method/variable + * declarations/attributes, and other compiler dependent labels. + * ----------------------------------------------------------------------------- */ + +/* template workaround for compilers that cannot correctly implement the C++ standard */ +#ifndef SWIGTEMPLATEDISAMBIGUATOR +# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560) +# define SWIGTEMPLATEDISAMBIGUATOR template +# elif defined(__HP_aCC) +/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */ +/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */ +# define SWIGTEMPLATEDISAMBIGUATOR template +# else +# define SWIGTEMPLATEDISAMBIGUATOR +# endif +#endif + +/* inline attribute */ +#ifndef SWIGINLINE +# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__)) +# define SWIGINLINE inline +# else +# define SWIGINLINE +# endif +#endif + +/* attribute recognised by some compilers to avoid 'unused' warnings */ +#ifndef SWIGUNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define SWIGUNUSED __attribute__ ((__unused__)) +# else +# define SWIGUNUSED +# endif +# elif defined(__ICC) +# define SWIGUNUSED __attribute__ ((__unused__)) +# else +# define SWIGUNUSED +# endif +#endif + +#ifndef SWIG_MSC_UNSUPPRESS_4505 +# if defined(_MSC_VER) +# pragma warning(disable : 4505) /* unreferenced local function has been removed */ +# endif +#endif + +#ifndef SWIGUNUSEDPARM +# ifdef __cplusplus +# define SWIGUNUSEDPARM(p) +# else +# define SWIGUNUSEDPARM(p) p SWIGUNUSED +# endif +#endif + +/* internal SWIG method */ +#ifndef SWIGINTERN +# define SWIGINTERN static SWIGUNUSED +#endif + +/* internal inline SWIG method */ +#ifndef SWIGINTERNINLINE +# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE +#endif + +/* exporting methods */ +#if defined(__GNUC__) +# if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) +# ifndef GCC_HASCLASSVISIBILITY +# define GCC_HASCLASSVISIBILITY +# endif +# endif +#endif + +#ifndef SWIGEXPORT +# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# if defined(STATIC_LINKED) +# define SWIGEXPORT +# else +# define SWIGEXPORT __declspec(dllexport) +# endif +# else +# if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY) +# define SWIGEXPORT __attribute__ ((visibility("default"))) +# else +# define SWIGEXPORT +# endif +# endif +#endif + +/* calling conventions for Windows */ +#ifndef SWIGSTDCALL +# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# define SWIGSTDCALL __stdcall +# else +# define SWIGSTDCALL +# endif +#endif + +/* Deal with Microsoft's attempt at deprecating C standard runtime functions */ +#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) +# define _CRT_SECURE_NO_DEPRECATE +#endif + +/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */ +#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE) +# define _SCL_SECURE_NO_DEPRECATE +#endif + +/* Deal with Apple's deprecated 'AssertMacros.h' from Carbon-framework */ +#if defined(__APPLE__) && !defined(__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES) +# define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0 +#endif + +/* Intel's compiler complains if a variable which was never initialised is + * cast to void, which is a common idiom which we use to indicate that we + * are aware a variable isn't used. So we just silence that warning. + * See: https://github.com/swig/swig/issues/192 for more discussion. + */ +#ifdef __INTEL_COMPILER +# pragma warning disable 592 +#endif + +/* ----------------------------------------------------------------------------- + * swigrun.swg + * + * This file contains generic C API SWIG runtime support for pointer + * type checking. + * ----------------------------------------------------------------------------- */ + +/* This should only be incremented when either the layout of swig_type_info changes, + or for whatever reason, the runtime changes incompatibly */ +#define SWIG_RUNTIME_VERSION "4" + +/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */ +#ifdef SWIG_TYPE_TABLE +# define SWIG_QUOTE_STRING(x) #x +# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x) +# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE) +#else +# define SWIG_TYPE_TABLE_NAME +#endif + +/* + You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for + creating a static or dynamic library from the SWIG runtime code. + In 99.9% of the cases, SWIG just needs to declare them as 'static'. + + But only do this if strictly necessary, ie, if you have problems + with your compiler or suchlike. +*/ + +#ifndef SWIGRUNTIME +# define SWIGRUNTIME SWIGINTERN +#endif + +#ifndef SWIGRUNTIMEINLINE +# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE +#endif + +/* Generic buffer size */ +#ifndef SWIG_BUFFER_SIZE +# define SWIG_BUFFER_SIZE 1024 +#endif + +/* Flags for pointer conversions */ +#define SWIG_POINTER_DISOWN 0x1 +#define SWIG_CAST_NEW_MEMORY 0x2 +#define SWIG_POINTER_NO_NULL 0x4 + +/* Flags for new pointer objects */ +#define SWIG_POINTER_OWN 0x1 + + +/* + Flags/methods for returning states. + + The SWIG conversion methods, as ConvertPtr, return an integer + that tells if the conversion was successful or not. And if not, + an error code can be returned (see swigerrors.swg for the codes). + + Use the following macros/flags to set or process the returning + states. + + In old versions of SWIG, code such as the following was usually written: + + if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) { + // success code + } else { + //fail code + } + + Now you can be more explicit: + + int res = SWIG_ConvertPtr(obj,vptr,ty.flags); + if (SWIG_IsOK(res)) { + // success code + } else { + // fail code + } + + which is the same really, but now you can also do + + Type *ptr; + int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags); + if (SWIG_IsOK(res)) { + // success code + if (SWIG_IsNewObj(res) { + ... + delete *ptr; + } else { + ... + } + } else { + // fail code + } + + I.e., now SWIG_ConvertPtr can return new objects and you can + identify the case and take care of the deallocation. Of course that + also requires SWIG_ConvertPtr to return new result values, such as + + int SWIG_ConvertPtr(obj, ptr,...) { + if (<obj is ok>) { + if (<need new object>) { + *ptr = <ptr to new allocated object>; + return SWIG_NEWOBJ; + } else { + *ptr = <ptr to old object>; + return SWIG_OLDOBJ; + } + } else { + return SWIG_BADOBJ; + } + } + + Of course, returning the plain '0(success)/-1(fail)' still works, but you can be + more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the + SWIG errors code. + + Finally, if the SWIG_CASTRANK_MODE is enabled, the result code + allows to return the 'cast rank', for example, if you have this + + int food(double) + int fooi(int); + + and you call + + food(1) // cast rank '1' (1 -> 1.0) + fooi(1) // cast rank '0' + + just use the SWIG_AddCast()/SWIG_CheckState() +*/ + +#define SWIG_OK (0) +#define SWIG_ERROR (-1) +#define SWIG_IsOK(r) (r >= 0) +#define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError) + +/* The CastRankLimit says how many bits are used for the cast rank */ +#define SWIG_CASTRANKLIMIT (1 << 8) +/* The NewMask denotes the object was created (using new/malloc) */ +#define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1) +/* The TmpMask is for in/out typemaps that use temporal objects */ +#define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1) +/* Simple returning values */ +#define SWIG_BADOBJ (SWIG_ERROR) +#define SWIG_OLDOBJ (SWIG_OK) +#define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK) +#define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK) +/* Check, add and del mask methods */ +#define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r) +#define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r) +#define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK)) +#define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r) +#define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r) +#define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK)) + +/* Cast-Rank Mode */ +#if defined(SWIG_CASTRANK_MODE) +# ifndef SWIG_TypeRank +# define SWIG_TypeRank unsigned long +# endif +# ifndef SWIG_MAXCASTRANK /* Default cast allowed */ +# define SWIG_MAXCASTRANK (2) +# endif +# define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1) +# define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK) +SWIGINTERNINLINE int SWIG_AddCast(int r) { + return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r; +} +SWIGINTERNINLINE int SWIG_CheckState(int r) { + return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; +} +#else /* no cast-rank mode */ +# define SWIG_AddCast(r) (r) +# define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0) +#endif + + +#include <string.h> + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void *(*swig_converter_func)(void *, int *); +typedef struct swig_type_info *(*swig_dycast_func)(void **); + +/* Structure to store information on one type */ +typedef struct swig_type_info { + const char *name; /* mangled name of this type */ + const char *str; /* human readable name of this type */ + swig_dycast_func dcast; /* dynamic cast function down a hierarchy */ + struct swig_cast_info *cast; /* linked list of types that can cast into this type */ + void *clientdata; /* language specific type data */ + int owndata; /* flag if the structure owns the clientdata */ +} swig_type_info; + +/* Structure to store a type and conversion function used for casting */ +typedef struct swig_cast_info { + swig_type_info *type; /* pointer to type that is equivalent to this type */ + swig_converter_func converter; /* function to cast the void pointers */ + struct swig_cast_info *next; /* pointer to next cast in linked list */ + struct swig_cast_info *prev; /* pointer to the previous cast */ +} swig_cast_info; + +/* Structure used to store module information + * Each module generates one structure like this, and the runtime collects + * all of these structures and stores them in a circularly linked list.*/ +typedef struct swig_module_info { + swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */ + size_t size; /* Number of types in this module */ + struct swig_module_info *next; /* Pointer to next element in circularly linked list */ + swig_type_info **type_initial; /* Array of initially generated type structures */ + swig_cast_info **cast_initial; /* Array of initially generated casting structures */ + void *clientdata; /* Language specific module data */ +} swig_module_info; + +/* + Compare two type names skipping the space characters, therefore + "char*" == "char *" and "Class<int>" == "Class<int >", etc. + + Return 0 when the two name types are equivalent, as in + strncmp, but skipping ' '. +*/ +SWIGRUNTIME int +SWIG_TypeNameComp(const char *f1, const char *l1, + const char *f2, const char *l2) { + for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) { + while ((*f1 == ' ') && (f1 != l1)) ++f1; + while ((*f2 == ' ') && (f2 != l2)) ++f2; + if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1; + } + return (int)((l1 - f1) - (l2 - f2)); +} + +/* + Check type equivalence in a name list like <name1>|<name2>|... + Return 0 if equal, -1 if nb < tb, 1 if nb > tb +*/ +SWIGRUNTIME int +SWIG_TypeCmp(const char *nb, const char *tb) { + int equiv = 1; + const char* te = tb + strlen(tb); + const char* ne = nb; + while (equiv != 0 && *ne) { + for (nb = ne; *ne; ++ne) { + if (*ne == '|') break; + } + equiv = SWIG_TypeNameComp(nb, ne, tb, te); + if (*ne) ++ne; + } + return equiv; +} + +/* + Check type equivalence in a name list like <name1>|<name2>|... + Return 0 if not equal, 1 if equal +*/ +SWIGRUNTIME int +SWIG_TypeEquiv(const char *nb, const char *tb) { + return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0; +} + +/* + Check the typename +*/ +SWIGRUNTIME swig_cast_info * +SWIG_TypeCheck(const char *c, swig_type_info *ty) { + if (ty) { + swig_cast_info *iter = ty->cast; + while (iter) { + if (strcmp(iter->type->name, c) == 0) { + if (iter == ty->cast) + return iter; + /* Move iter to the top of the linked list */ + iter->prev->next = iter->next; + if (iter->next) + iter->next->prev = iter->prev; + iter->next = ty->cast; + iter->prev = 0; + if (ty->cast) ty->cast->prev = iter; + ty->cast = iter; + return iter; + } + iter = iter->next; + } + } + return 0; +} + +/* + Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison +*/ +SWIGRUNTIME swig_cast_info * +SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) { + if (ty) { + swig_cast_info *iter = ty->cast; + while (iter) { + if (iter->type == from) { + if (iter == ty->cast) + return iter; + /* Move iter to the top of the linked list */ + iter->prev->next = iter->next; + if (iter->next) + iter->next->prev = iter->prev; + iter->next = ty->cast; + iter->prev = 0; + if (ty->cast) ty->cast->prev = iter; + ty->cast = iter; + return iter; + } + iter = iter->next; + } + } + return 0; +} + +/* + Cast a pointer up an inheritance hierarchy +*/ +SWIGRUNTIMEINLINE void * +SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) { + return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory); +} + +/* + Dynamic pointer casting. Down an inheritance hierarchy +*/ +SWIGRUNTIME swig_type_info * +SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) { + swig_type_info *lastty = ty; + if (!ty || !ty->dcast) return ty; + while (ty && (ty->dcast)) { + ty = (*ty->dcast)(ptr); + if (ty) lastty = ty; + } + return lastty; +} + +/* + Return the name associated with this type +*/ +SWIGRUNTIMEINLINE const char * +SWIG_TypeName(const swig_type_info *ty) { + return ty->name; +} + +/* + Return the pretty name associated with this type, + that is an unmangled type name in a form presentable to the user. +*/ +SWIGRUNTIME const char * +SWIG_TypePrettyName(const swig_type_info *type) { + /* The "str" field contains the equivalent pretty names of the + type, separated by vertical-bar characters. We choose + to print the last name, as it is often (?) the most + specific. */ + if (!type) return NULL; + if (type->str != NULL) { + const char *last_name = type->str; + const char *s; + for (s = type->str; *s; s++) + if (*s == '|') last_name = s+1; + return last_name; + } + else + return type->name; +} + +/* + Set the clientdata field for a type +*/ +SWIGRUNTIME void +SWIG_TypeClientData(swig_type_info *ti, void *clientdata) { + swig_cast_info *cast = ti->cast; + /* if (ti->clientdata == clientdata) return; */ + ti->clientdata = clientdata; + + while (cast) { + if (!cast->converter) { + swig_type_info *tc = cast->type; + if (!tc->clientdata) { + SWIG_TypeClientData(tc, clientdata); + } + } + cast = cast->next; + } +} +SWIGRUNTIME void +SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) { + SWIG_TypeClientData(ti, clientdata); + ti->owndata = 1; +} + +/* + Search for a swig_type_info structure only by mangled name + Search is a O(log #types) + + We start searching at module start, and finish searching when start == end. + Note: if start == end at the beginning of the function, we go all the way around + the circular list. +*/ +SWIGRUNTIME swig_type_info * +SWIG_MangledTypeQueryModule(swig_module_info *start, + swig_module_info *end, + const char *name) { + swig_module_info *iter = start; + do { + if (iter->size) { + size_t l = 0; + size_t r = iter->size - 1; + do { + /* since l+r >= 0, we can (>> 1) instead (/ 2) */ + size_t i = (l + r) >> 1; + const char *iname = iter->types[i]->name; + if (iname) { + int compare = strcmp(name, iname); + if (compare == 0) { + return iter->types[i]; + } else if (compare < 0) { + if (i) { + r = i - 1; + } else { + break; + } + } else if (compare > 0) { + l = i + 1; + } + } else { + break; /* should never happen */ + } + } while (l <= r); + } + iter = iter->next; + } while (iter != end); + return 0; +} + +/* + Search for a swig_type_info structure for either a mangled name or a human readable name. + It first searches the mangled names of the types, which is a O(log #types) + If a type is not found it then searches the human readable names, which is O(#types). + + We start searching at module start, and finish searching when start == end. + Note: if start == end at the beginning of the function, we go all the way around + the circular list. +*/ +SWIGRUNTIME swig_type_info * +SWIG_TypeQueryModule(swig_module_info *start, + swig_module_info *end, + const char *name) { + /* STEP 1: Search the name field using binary search */ + swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name); + if (ret) { + return ret; + } else { + /* STEP 2: If the type hasn't been found, do a complete search + of the str field (the human readable name) */ + swig_module_info *iter = start; + do { + size_t i = 0; + for (; i < iter->size; ++i) { + if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name))) + return iter->types[i]; + } + iter = iter->next; + } while (iter != end); + } + + /* neither found a match */ + return 0; +} + +/* + Pack binary data into a string +*/ +SWIGRUNTIME char * +SWIG_PackData(char *c, void *ptr, size_t sz) { + static const char hex[17] = "0123456789abcdef"; + const unsigned char *u = (unsigned char *) ptr; + const unsigned char *eu = u + sz; + for (; u != eu; ++u) { + unsigned char uu = *u; + *(c++) = hex[(uu & 0xf0) >> 4]; + *(c++) = hex[uu & 0xf]; + } + return c; +} + +/* + Unpack binary data from a string +*/ +SWIGRUNTIME const char * +SWIG_UnpackData(const char *c, void *ptr, size_t sz) { + unsigned char *u = (unsigned char *) ptr; + const unsigned char *eu = u + sz; + for (; u != eu; ++u) { + char d = *(c++); + unsigned char uu; + if ((d >= '0') && (d <= '9')) + uu = (unsigned char)((d - '0') << 4); + else if ((d >= 'a') && (d <= 'f')) + uu = (unsigned char)((d - ('a'-10)) << 4); + else + return (char *) 0; + d = *(c++); + if ((d >= '0') && (d <= '9')) + uu |= (unsigned char)(d - '0'); + else if ((d >= 'a') && (d <= 'f')) + uu |= (unsigned char)(d - ('a'-10)); + else + return (char *) 0; + *u = uu; + } + return c; +} + +/* + Pack 'void *' into a string buffer. +*/ +SWIGRUNTIME char * +SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) { + char *r = buff; + if ((2*sizeof(void *) + 2) > bsz) return 0; + *(r++) = '_'; + r = SWIG_PackData(r,&ptr,sizeof(void *)); + if (strlen(name) + 1 > (bsz - (r - buff))) return 0; + strcpy(r,name); + return buff; +} + +SWIGRUNTIME const char * +SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) { + if (*c != '_') { + if (strcmp(c,"NULL") == 0) { + *ptr = (void *) 0; + return name; + } else { + return 0; + } + } + return SWIG_UnpackData(++c,ptr,sizeof(void *)); +} + +SWIGRUNTIME char * +SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) { + char *r = buff; + size_t lname = (name ? strlen(name) : 0); + if ((2*sz + 2 + lname) > bsz) return 0; + *(r++) = '_'; + r = SWIG_PackData(r,ptr,sz); + if (lname) { + strncpy(r,name,lname+1); + } else { + *r = 0; + } + return buff; +} + +SWIGRUNTIME const char * +SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { + if (*c != '_') { + if (strcmp(c,"NULL") == 0) { + memset(ptr,0,sz); + return name; + } else { + return 0; + } + } + return SWIG_UnpackData(++c,ptr,sz); +} + +#ifdef __cplusplus +} +#endif + +/* Errors in SWIG */ +#define SWIG_UnknownError -1 +#define SWIG_IOError -2 +#define SWIG_RuntimeError -3 +#define SWIG_IndexError -4 +#define SWIG_TypeError -5 +#define SWIG_DivisionByZero -6 +#define SWIG_OverflowError -7 +#define SWIG_SyntaxError -8 +#define SWIG_ValueError -9 +#define SWIG_SystemError -10 +#define SWIG_AttributeError -11 +#define SWIG_MemoryError -12 +#define SWIG_NullReferenceError -13 + + + +#include <ruby.h> + +/* Ruby 1.9.1 has a "memoisation optimisation" when compiling with GCC which + * breaks using rb_intern as an lvalue, as SWIG does. We work around this + * issue for now by disabling this. + * https://sourceforge.net/tracker/?func=detail&aid=2859614&group_id=1645&atid=101645 + */ +#ifdef rb_intern +# undef rb_intern +#endif + +/* Remove global macros defined in Ruby's win32.h */ +#ifdef write +# undef write +#endif +#ifdef read +# undef read +#endif +#ifdef bind +# undef bind +#endif +#ifdef close +# undef close +#endif +#ifdef connect +# undef connect +#endif + + +/* Ruby 1.7 defines NUM2LL(), LL2NUM() and ULL2NUM() macros */ +#ifndef NUM2LL +#define NUM2LL(x) NUM2LONG((x)) +#endif +#ifndef LL2NUM +#define LL2NUM(x) INT2NUM((long) (x)) +#endif +#ifndef ULL2NUM +#define ULL2NUM(x) UINT2NUM((unsigned long) (x)) +#endif + +/* Ruby 1.7 doesn't (yet) define NUM2ULL() */ +#ifndef NUM2ULL +#ifdef HAVE_LONG_LONG +#define NUM2ULL(x) rb_num2ull((x)) +#else +#define NUM2ULL(x) NUM2ULONG(x) +#endif +#endif + +/* RSTRING_LEN, etc are new in Ruby 1.9, but ->ptr and ->len no longer work */ +/* Define these for older versions so we can just write code the new way */ +#ifndef RSTRING_LEN +# define RSTRING_LEN(x) RSTRING(x)->len +#endif +#ifndef RSTRING_PTR +# define RSTRING_PTR(x) RSTRING(x)->ptr +#endif +#ifndef RSTRING_END +# define RSTRING_END(x) (RSTRING_PTR(x) + RSTRING_LEN(x)) +#endif +#ifndef RARRAY_LEN +# define RARRAY_LEN(x) RARRAY(x)->len +#endif +#ifndef RARRAY_PTR +# define RARRAY_PTR(x) RARRAY(x)->ptr +#endif +#ifndef RFLOAT_VALUE +# define RFLOAT_VALUE(x) RFLOAT(x)->value +#endif +#ifndef DOUBLE2NUM +# define DOUBLE2NUM(x) rb_float_new(x) +#endif +#ifndef RHASH_TBL +# define RHASH_TBL(x) (RHASH(x)->tbl) +#endif +#ifndef RHASH_ITER_LEV +# define RHASH_ITER_LEV(x) (RHASH(x)->iter_lev) +#endif +#ifndef RHASH_IFNONE +# define RHASH_IFNONE(x) (RHASH(x)->ifnone) +#endif +#ifndef RHASH_SIZE +# define RHASH_SIZE(x) (RHASH(x)->tbl->num_entries) +#endif +#ifndef RHASH_EMPTY_P +# define RHASH_EMPTY_P(x) (RHASH_SIZE(x) == 0) +#endif +#ifndef RSTRUCT_LEN +# define RSTRUCT_LEN(x) RSTRUCT(x)->len +#endif +#ifndef RSTRUCT_PTR +# define RSTRUCT_PTR(x) RSTRUCT(x)->ptr +#endif +#ifndef RTYPEDDATA_P +# define RTYPEDDATA_P(x) (TYPE(x) != T_DATA) +#endif + + + +/* + * The following macros are used for providing the correct type of a + * function pointer to the Ruby C API. + * Starting with Ruby 2.7 (corresponding to RB_METHOD_DEFINITION_DECL being + * defined) these macros act transparently due to Ruby's moving away from + * ANYARGS and instead employing strict function signatures. + * + * Note: In case of C (not C++) the macros are transparent even before + * Ruby 2.7 due to the fact that the Ruby C API used function declarators + * with empty parentheses, which allows for an unspecified number of + * arguments. + * + * PROTECTFUNC(f) is used for the function pointer argument of the Ruby + * C API function rb_protect(). + * + * VALUEFUNC(f) is used for the function pointer argument(s) of Ruby C API + * functions like rb_define_method() and rb_define_singleton_method(). + * + * VOIDFUNC(f) is used to typecast a C function that implements either + * the "mark" or "free" stuff for a Ruby Data object, so that it can be + * passed as an argument to Ruby C API functions like Data_Wrap_Struct() + * and Data_Make_Struct(). + * + * SWIG_RUBY_VOID_ANYARGS_FUNC(f) is used for the function pointer + * argument(s) of Ruby C API functions like rb_define_virtual_variable(). + * + * SWIG_RUBY_INT_ANYARGS_FUNC(f) is used for the function pointer + * argument(s) of Ruby C API functions like st_foreach(). + */ +#if defined(__cplusplus) && !defined(RB_METHOD_DEFINITION_DECL) +# define PROTECTFUNC(f) ((VALUE (*)(VALUE)) f) +# define VALUEFUNC(f) ((VALUE (*)(ANYARGS)) f) +# define VOIDFUNC(f) ((RUBY_DATA_FUNC) f) +# define SWIG_RUBY_VOID_ANYARGS_FUNC(f) ((void (*)(ANYARGS))(f)) +# define SWIG_RUBY_INT_ANYARGS_FUNC(f) ((int (*)(ANYARGS))(f)) +#else +# define PROTECTFUNC(f) (f) +# define VALUEFUNC(f) (f) +# define VOIDFUNC(f) (f) +# define SWIG_RUBY_VOID_ANYARGS_FUNC(f) (f) +# define SWIG_RUBY_INT_ANYARGS_FUNC(f) (f) +#endif + +/* Don't use for expressions have side effect */ +#ifndef RB_STRING_VALUE +#define RB_STRING_VALUE(s) (TYPE(s) == T_STRING ? (s) : (*(volatile VALUE *)&(s) = rb_str_to_str(s))) +#endif +#ifndef StringValue +#define StringValue(s) RB_STRING_VALUE(s) +#endif +#ifndef StringValuePtr +#define StringValuePtr(s) RSTRING_PTR(RB_STRING_VALUE(s)) +#endif +#ifndef StringValueLen +#define StringValueLen(s) RSTRING_LEN(RB_STRING_VALUE(s)) +#endif +#ifndef SafeStringValue +#define SafeStringValue(v) do {\ + StringValue(v);\ + rb_check_safe_str(v);\ +} while (0) +#endif + +#ifndef HAVE_RB_DEFINE_ALLOC_FUNC +#define rb_define_alloc_func(klass, func) rb_define_singleton_method((klass), "new", VALUEFUNC((func)), -1) +#define rb_undef_alloc_func(klass) rb_undef_method(CLASS_OF((klass)), "new") +#endif + +static VALUE _mSWIG = Qnil; + +/* ----------------------------------------------------------------------------- + * error manipulation + * ----------------------------------------------------------------------------- */ + + +/* Define some additional error types */ +#define SWIG_ObjectPreviouslyDeletedError -100 + + +/* Define custom exceptions for errors that do not map to existing Ruby + exceptions. Note this only works for C++ since a global cannot be + initialized by a function in C. For C, fallback to rb_eRuntimeError.*/ + +SWIGINTERN VALUE +getNullReferenceError(void) { + static int init = 0; + static VALUE rb_eNullReferenceError ; + if (!init) { + init = 1; + rb_eNullReferenceError = rb_define_class("NullReferenceError", rb_eRuntimeError); + } + return rb_eNullReferenceError; +} + +SWIGINTERN VALUE +getObjectPreviouslyDeletedError(void) { + static int init = 0; + static VALUE rb_eObjectPreviouslyDeleted ; + if (!init) { + init = 1; + rb_eObjectPreviouslyDeleted = rb_define_class("ObjectPreviouslyDeleted", rb_eRuntimeError); + } + return rb_eObjectPreviouslyDeleted; +} + + +SWIGINTERN VALUE +SWIG_Ruby_ErrorType(int SWIG_code) { + VALUE type; + switch (SWIG_code) { + case SWIG_MemoryError: + type = rb_eNoMemError; + break; + case SWIG_IOError: + type = rb_eIOError; + break; + case SWIG_RuntimeError: + type = rb_eRuntimeError; + break; + case SWIG_IndexError: + type = rb_eIndexError; + break; + case SWIG_TypeError: + type = rb_eTypeError; + break; + case SWIG_DivisionByZero: + type = rb_eZeroDivError; + break; + case SWIG_OverflowError: + type = rb_eRangeError; + break; + case SWIG_SyntaxError: + type = rb_eSyntaxError; + break; + case SWIG_ValueError: + type = rb_eArgError; + break; + case SWIG_SystemError: + type = rb_eFatal; + break; + case SWIG_AttributeError: + type = rb_eRuntimeError; + break; + case SWIG_NullReferenceError: + type = getNullReferenceError(); + break; + case SWIG_ObjectPreviouslyDeletedError: + type = getObjectPreviouslyDeletedError(); + break; + case SWIG_UnknownError: + type = rb_eRuntimeError; + break; + default: + type = rb_eRuntimeError; + } + return type; +} + + +/* This function is called when a user inputs a wrong argument to + a method. + */ +SWIGINTERN +const char* Ruby_Format_TypeError( const char* msg, + const char* type, + const char* name, + const int argn, + VALUE input ) +{ + char buf[128]; + VALUE str; + VALUE asStr; + if ( msg && *msg ) + { + str = rb_str_new2(msg); + } + else + { + str = rb_str_new(NULL, 0); + } + + str = rb_str_cat2( str, "Expected argument " ); + sprintf( buf, "%d of type ", argn-1 ); + str = rb_str_cat2( str, buf ); + str = rb_str_cat2( str, type ); + str = rb_str_cat2( str, ", but got " ); + str = rb_str_cat2( str, rb_obj_classname(input) ); + str = rb_str_cat2( str, " " ); + asStr = rb_inspect(input); + if ( RSTRING_LEN(asStr) > 30 ) + { + str = rb_str_cat( str, StringValuePtr(asStr), 30 ); + str = rb_str_cat2( str, "..." ); + } + else + { + str = rb_str_append( str, asStr ); + } + + if ( name ) + { + str = rb_str_cat2( str, "\n\tin SWIG method '" ); + str = rb_str_cat2( str, name ); + str = rb_str_cat2( str, "'" ); + } + + return StringValuePtr( str ); +} + +/* This function is called when an overloaded method fails */ +SWIGINTERN +void Ruby_Format_OverloadedError( + const int argc, + const int maxargs, + const char* method, + const char* prototypes + ) +{ + const char* msg = "Wrong # of arguments"; + if ( argc <= maxargs ) msg = "Wrong arguments"; + rb_raise(rb_eArgError,"%s for overloaded method '%s'.\n" + "Possible C/C++ prototypes are:\n%s", + msg, method, prototypes); +} + +/* ----------------------------------------------------------------------------- + * rubytracking.swg + * + * This file contains support for tracking mappings from + * Ruby objects to C++ objects. This functionality is needed + * to implement mark functions for Ruby's mark and sweep + * garbage collector. + * ----------------------------------------------------------------------------- */ + +#ifdef __cplusplus +extern "C" { +#endif + +#if !defined(ST_DATA_T_DEFINED) +/* Needs to be explicitly included for Ruby 1.8 and earlier */ +#include <st.h> +#endif + +/* Ruby 1.8 actually assumes the first case. */ +#if SIZEOF_VOIDP == SIZEOF_LONG +# define SWIG2NUM(v) LONG2NUM((unsigned long)v) +# define NUM2SWIG(x) (unsigned long)NUM2LONG(x) +#elif SIZEOF_VOIDP == SIZEOF_LONG_LONG +# define SWIG2NUM(v) LL2NUM((unsigned long long)v) +# define NUM2SWIG(x) (unsigned long long)NUM2LL(x) +#else +# error sizeof(void*) is not the same as long or long long +#endif + +/* Global hash table to store Trackings from C/C++ + structs to Ruby Objects. +*/ +static st_table* swig_ruby_trackings = NULL; + +static VALUE swig_ruby_trackings_count(ID id, VALUE *var) { + return SWIG2NUM(swig_ruby_trackings->num_entries); +} + + +/* Setup a hash table to store Trackings */ +SWIGRUNTIME void SWIG_RubyInitializeTrackings(void) { + /* Create a hash table to store Trackings from C++ + objects to Ruby objects. */ + + /* Try to see if some other .so has already created a + tracking hash table, which we keep hidden in an instance var + in the SWIG module. + This is done to allow multiple DSOs to share the same + tracking table. + */ + VALUE trackings_value = Qnil; + /* change the variable name so that we can mix modules + compiled with older SWIG's - this used to be called "@__trackings__" */ + ID trackings_id = rb_intern( "@__safetrackings__" ); + VALUE verbose = rb_gv_get("VERBOSE"); + rb_gv_set("VERBOSE", Qfalse); + trackings_value = rb_ivar_get( _mSWIG, trackings_id ); + rb_gv_set("VERBOSE", verbose); + + /* The trick here is that we have to store the hash table + pointer in a Ruby variable. We do not want Ruby's GC to + treat this pointer as a Ruby object, so we convert it to + a Ruby numeric value. */ + if (trackings_value == Qnil) { + /* No, it hasn't. Create one ourselves */ + swig_ruby_trackings = st_init_numtable(); + rb_ivar_set( _mSWIG, trackings_id, SWIG2NUM(swig_ruby_trackings) ); + } else { + swig_ruby_trackings = (st_table*)NUM2SWIG(trackings_value); + } + + rb_define_virtual_variable("SWIG_TRACKINGS_COUNT", + VALUEFUNC(swig_ruby_trackings_count), + SWIG_RUBY_VOID_ANYARGS_FUNC((rb_gvar_setter_t*)NULL)); +} + +/* Add a Tracking from a C/C++ struct to a Ruby object */ +SWIGRUNTIME void SWIG_RubyAddTracking(void* ptr, VALUE object) { + /* Store the mapping to the global hash table. */ + st_insert(swig_ruby_trackings, (st_data_t)ptr, object); +} + +/* Get the Ruby object that owns the specified C/C++ struct */ +SWIGRUNTIME VALUE SWIG_RubyInstanceFor(void* ptr) { + /* Now lookup the value stored in the global hash table */ + VALUE value; + + if (st_lookup(swig_ruby_trackings, (st_data_t)ptr, &value)) { + return value; + } else { + return Qnil; + } +} + +/* Remove a Tracking from a C/C++ struct to a Ruby object. It + is very important to remove objects once they are destroyed + since the same memory address may be reused later to create + a new object. */ +SWIGRUNTIME void SWIG_RubyRemoveTracking(void* ptr) { + /* Delete the object from the hash table */ + st_delete(swig_ruby_trackings, (st_data_t *)&ptr, NULL); +} + +/* This is a helper method that unlinks a Ruby object from its + underlying C++ object. This is needed if the lifetime of the + Ruby object is longer than the C++ object. */ +SWIGRUNTIME void SWIG_RubyUnlinkObjects(void* ptr) { + VALUE object = SWIG_RubyInstanceFor(ptr); + + if (object != Qnil) { + // object might have the T_ZOMBIE type, but that's just + // because the GC has flagged it as such for a deferred + // destruction. Until then, it's still a T_DATA object. + DATA_PTR(object) = 0; + } +} + +/* This is a helper method that iterates over all the trackings + passing the C++ object pointer and its related Ruby object + to the passed callback function. */ + +/* Proxy method to abstract the internal trackings datatype */ +static int swig_ruby_internal_iterate_callback(st_data_t ptr, st_data_t obj, st_data_t meth) { + ((void (*) (void *, VALUE))meth)((void *)ptr, (VALUE)obj); + return ST_CONTINUE; +} + +SWIGRUNTIME void SWIG_RubyIterateTrackings( void(*meth)(void* ptr, VALUE obj) ) { + st_foreach(swig_ruby_trackings, + SWIG_RUBY_INT_ANYARGS_FUNC(swig_ruby_internal_iterate_callback), + (st_data_t)meth); +} + +#ifdef __cplusplus +} +#endif + +/* ----------------------------------------------------------------------------- + * Ruby API portion that goes into the runtime + * ----------------------------------------------------------------------------- */ + +#ifdef __cplusplus +extern "C" { +#endif + +SWIGINTERN VALUE +SWIG_Ruby_AppendOutput(VALUE target, VALUE o) { + if (NIL_P(target)) { + target = o; + } else { + if (TYPE(target) != T_ARRAY) { + VALUE o2 = target; + target = rb_ary_new(); + rb_ary_push(target, o2); + } + rb_ary_push(target, o); + } + return target; +} + +/* For ruby1.8.4 and earlier. */ +#ifndef RUBY_INIT_STACK + RUBY_EXTERN void Init_stack(VALUE* addr); +# define RUBY_INIT_STACK \ + VALUE variable_in_this_stack_frame; \ + Init_stack(&variable_in_this_stack_frame); +#endif + + +#ifdef __cplusplus +} +#endif + + +/* ----------------------------------------------------------------------------- + * rubyrun.swg + * + * This file contains the runtime support for Ruby modules + * and includes code for managing global variables and pointer + * type checking. + * ----------------------------------------------------------------------------- */ + +/* For backward compatibility only */ +#define SWIG_POINTER_EXCEPTION 0 + +/* for raw pointers */ +#define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_Ruby_ConvertPtrAndOwn(obj, pptr, type, flags, 0) +#define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_Ruby_ConvertPtrAndOwn(obj, pptr, type, flags, own) +#define SWIG_NewPointerObj(ptr, type, flags) SWIG_Ruby_NewPointerObj(ptr, type, flags) +#define SWIG_AcquirePtr(ptr, own) SWIG_Ruby_AcquirePtr(ptr, own) +#define swig_owntype swig_ruby_owntype + +/* for raw packed data */ +#define SWIG_ConvertPacked(obj, ptr, sz, ty) SWIG_Ruby_ConvertPacked(obj, ptr, sz, ty, flags) +#define SWIG_NewPackedObj(ptr, sz, type) SWIG_Ruby_NewPackedObj(ptr, sz, type) + +/* for class or struct pointers */ +#define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_ConvertPtr(obj, pptr, type, flags) +#define SWIG_NewInstanceObj(ptr, type, flags) SWIG_NewPointerObj(ptr, type, flags) + +/* for C or C++ function pointers */ +#define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_ConvertPtr(obj, pptr, type, 0) +#define SWIG_NewFunctionPtrObj(ptr, type) SWIG_NewPointerObj(ptr, type, 0) + +/* for C++ member pointers, ie, member methods */ +#define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_Ruby_ConvertPacked(obj, ptr, sz, ty) +#define SWIG_NewMemberObj(ptr, sz, type) SWIG_Ruby_NewPackedObj(ptr, sz, type) + + +/* Runtime API */ + +#define SWIG_GetModule(clientdata) SWIG_Ruby_GetModule(clientdata) +#define SWIG_SetModule(clientdata, pointer) SWIG_Ruby_SetModule(pointer) + + +/* Error manipulation */ + +#define SWIG_ErrorType(code) SWIG_Ruby_ErrorType(code) +#define SWIG_Error(code, msg) rb_raise(SWIG_Ruby_ErrorType(code), "%s", msg) +#define SWIG_fail goto fail + + +/* Ruby-specific SWIG API */ + +#define SWIG_InitRuntime() SWIG_Ruby_InitRuntime() +#define SWIG_define_class(ty) SWIG_Ruby_define_class(ty) +#define SWIG_NewClassInstance(value, ty) SWIG_Ruby_NewClassInstance(value, ty) +#define SWIG_MangleStr(value) SWIG_Ruby_MangleStr(value) +#define SWIG_CheckConvert(value, ty) SWIG_Ruby_CheckConvert(value, ty) + +#include "assert.h" + +/* ----------------------------------------------------------------------------- + * pointers/data manipulation + * ----------------------------------------------------------------------------- */ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct { + VALUE klass; + VALUE mImpl; + void (*mark)(void *); + void (*destroy)(void *); + int trackObjects; +} swig_class; + + +/* Global pointer used to keep some internal SWIG stuff */ +static VALUE _cSWIG_Pointer = Qnil; +static VALUE swig_runtime_data_type_pointer = Qnil; + +/* Global IDs used to keep some internal SWIG stuff */ +static ID swig_arity_id = 0; +static ID swig_call_id = 0; + +/* + If your swig extension is to be run within an embedded ruby and has + director callbacks, you should set -DRUBY_EMBEDDED during compilation. + This will reset ruby's stack frame on each entry point from the main + program the first time a virtual director function is invoked (in a + non-recursive way). + If this is not done, you run the risk of Ruby trashing the stack. +*/ + +#ifdef RUBY_EMBEDDED + +# define SWIG_INIT_STACK \ + if ( !swig_virtual_calls ) { RUBY_INIT_STACK } \ + ++swig_virtual_calls; +# define SWIG_RELEASE_STACK --swig_virtual_calls; +# define Ruby_DirectorTypeMismatchException(x) \ + rb_raise( rb_eTypeError, "%s", x ); return c_result; + + static unsigned int swig_virtual_calls = 0; + +#else /* normal non-embedded extension */ + +# define SWIG_INIT_STACK +# define SWIG_RELEASE_STACK +# define Ruby_DirectorTypeMismatchException(x) \ + throw Swig::DirectorTypeMismatchException( x ); + +#endif /* RUBY_EMBEDDED */ + + +SWIGRUNTIME VALUE +getExceptionClass(void) { + static int init = 0; + static VALUE rubyExceptionClass ; + if (!init) { + init = 1; + rubyExceptionClass = rb_const_get(_mSWIG, rb_intern("Exception")); + } + return rubyExceptionClass; +} + +/* This code checks to see if the Ruby object being raised as part + of an exception inherits from the Ruby class Exception. If so, + the object is simply returned. If not, then a new Ruby exception + object is created and that will be returned to Ruby.*/ +SWIGRUNTIME VALUE +SWIG_Ruby_ExceptionType(swig_type_info *desc, VALUE obj) { + VALUE exceptionClass = getExceptionClass(); + if (rb_obj_is_kind_of(obj, exceptionClass)) { + return obj; + } else { + return rb_exc_new3(rb_eRuntimeError, rb_obj_as_string(obj)); + } +} + +/* Initialize Ruby runtime support */ +SWIGRUNTIME void +SWIG_Ruby_InitRuntime(void) +{ + if (_mSWIG == Qnil) { + _mSWIG = rb_define_module("SWIG"); + swig_call_id = rb_intern("call"); + swig_arity_id = rb_intern("arity"); + } +} + +/* Define Ruby class for C type */ +SWIGRUNTIME void +SWIG_Ruby_define_class(swig_type_info *type) +{ + char *klass_name = (char *) malloc(4 + strlen(type->name) + 1); + sprintf(klass_name, "TYPE%s", type->name); + if (NIL_P(_cSWIG_Pointer)) { + _cSWIG_Pointer = rb_define_class_under(_mSWIG, "Pointer", rb_cObject); + rb_undef_method(CLASS_OF(_cSWIG_Pointer), "new"); + } + rb_define_class_under(_mSWIG, klass_name, _cSWIG_Pointer); + free((void *) klass_name); +} + +/* Create a new pointer object */ +SWIGRUNTIME VALUE +SWIG_Ruby_NewPointerObj(void *ptr, swig_type_info *type, int flags) +{ + int own = flags & SWIG_POINTER_OWN; + int track; + char *klass_name; + swig_class *sklass; + VALUE klass; + VALUE obj; + + if (!ptr) + return Qnil; + + assert(type); + if (type->clientdata) { + sklass = (swig_class *) type->clientdata; + + /* Are we tracking this class and have we already returned this Ruby object? */ + track = sklass->trackObjects; + if (track) { + obj = SWIG_RubyInstanceFor(ptr); + + /* Check the object's type and make sure it has the correct type. + It might not in cases where methods do things like + downcast methods. */ + if (obj != Qnil) { + VALUE value = rb_iv_get(obj, "@__swigtype__"); + const char* type_name = RSTRING_PTR(value); + + if (strcmp(type->name, type_name) == 0) { + return obj; + } + } + } + + /* Create a new Ruby object */ + obj = Data_Wrap_Struct(sklass->klass, VOIDFUNC(sklass->mark), + ( own ? VOIDFUNC(sklass->destroy) : + (track ? VOIDFUNC(SWIG_RubyRemoveTracking) : 0 ) + ), ptr); + + /* If tracking is on for this class then track this object. */ + if (track) { + SWIG_RubyAddTracking(ptr, obj); + } + } else { + klass_name = (char *) malloc(4 + strlen(type->name) + 1); + sprintf(klass_name, "TYPE%s", type->name); + klass = rb_const_get(_mSWIG, rb_intern(klass_name)); + free((void *) klass_name); + obj = Data_Wrap_Struct(klass, 0, 0, ptr); + } + rb_iv_set(obj, "@__swigtype__", rb_str_new2(type->name)); + + return obj; +} + +/* Create a new class instance (always owned) */ +SWIGRUNTIME VALUE +SWIG_Ruby_NewClassInstance(VALUE klass, swig_type_info *type) +{ + VALUE obj; + swig_class *sklass = (swig_class *) type->clientdata; + obj = Data_Wrap_Struct(klass, VOIDFUNC(sklass->mark), VOIDFUNC(sklass->destroy), 0); + rb_iv_set(obj, "@__swigtype__", rb_str_new2(type->name)); + return obj; +} + +/* Get type mangle from class name */ +SWIGRUNTIMEINLINE char * +SWIG_Ruby_MangleStr(VALUE obj) +{ + VALUE stype = rb_iv_get(obj, "@__swigtype__"); + if (NIL_P(stype)) + return NULL; + return StringValuePtr(stype); +} + +/* Acquire a pointer value */ +typedef struct { + void (*datafree)(void *); + int own; +} swig_ruby_owntype; + +SWIGRUNTIME swig_ruby_owntype +SWIG_Ruby_AcquirePtr(VALUE obj, swig_ruby_owntype own) { + swig_ruby_owntype oldown = {0, 0}; + if (TYPE(obj) == T_DATA && !RTYPEDDATA_P(obj)) { + oldown.datafree = RDATA(obj)->dfree; + RDATA(obj)->dfree = own.datafree; + } + return oldown; +} + +/* Convert a pointer value */ +SWIGRUNTIME int +SWIG_Ruby_ConvertPtrAndOwn(VALUE obj, void **ptr, swig_type_info *ty, int flags, swig_ruby_owntype *own) +{ + char *c; + swig_cast_info *tc; + void *vptr = 0; + + /* Grab the pointer */ + if (NIL_P(obj)) { + if (ptr) + *ptr = 0; + return (flags & SWIG_POINTER_NO_NULL) ? SWIG_NullReferenceError : SWIG_OK; + } else { + if (TYPE(obj) != T_DATA || (TYPE(obj) == T_DATA && RTYPEDDATA_P(obj))) { + return SWIG_ERROR; + } + Data_Get_Struct(obj, void, vptr); + } + + if (own) { + own->datafree = RDATA(obj)->dfree; + own->own = 0; + } + + /* Check to see if the input object is giving up ownership + of the underlying C struct or C++ object. If so then we + need to reset the destructor since the Ruby object no + longer owns the underlying C++ object.*/ + if (flags & SWIG_POINTER_DISOWN) { + /* Is tracking on for this class? */ + int track = 0; + if (ty && ty->clientdata) { + swig_class *sklass = (swig_class *) ty->clientdata; + track = sklass->trackObjects; + } + + if (track) { + /* We are tracking objects for this class. Thus we change the destructor + * to SWIG_RubyRemoveTracking. This allows us to + * remove the mapping from the C++ to Ruby object + * when the Ruby object is garbage collected. If we don't + * do this, then it is possible we will return a reference + * to a Ruby object that no longer exists thereby crashing Ruby. */ + RDATA(obj)->dfree = SWIG_RubyRemoveTracking; + } else { + RDATA(obj)->dfree = 0; + } + } + + /* Do type-checking if type info was provided */ + if (ty) { + if (ty->clientdata) { + if (rb_obj_is_kind_of(obj, ((swig_class *) (ty->clientdata))->klass)) { + if (vptr == 0) { + /* The object has already been deleted */ + return SWIG_ObjectPreviouslyDeletedError; + } + } + } + if ((c = SWIG_MangleStr(obj)) == NULL) { + return SWIG_ERROR; + } + tc = SWIG_TypeCheck(c, ty); + if (!tc) { + return SWIG_ERROR; + } else { + if (ptr) { + if (tc->type == ty) { + *ptr = vptr; + } else { + int newmemory = 0; + *ptr = SWIG_TypeCast(tc, vptr, &newmemory); + if (newmemory == SWIG_CAST_NEW_MEMORY) { + assert(own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */ + if (own) + own->own = own->own | SWIG_CAST_NEW_MEMORY; + } + } + } + } + } else { + if (ptr) + *ptr = vptr; + } + + return SWIG_OK; +} + +/* Check convert */ +SWIGRUNTIMEINLINE int +SWIG_Ruby_CheckConvert(VALUE obj, swig_type_info *ty) +{ + char *c = SWIG_MangleStr(obj); + if (!c) return 0; + return SWIG_TypeCheck(c,ty) != 0; +} + +SWIGRUNTIME VALUE +SWIG_Ruby_NewPackedObj(void *ptr, int sz, swig_type_info *type) { + char result[1024]; + char *r = result; + if ((2*sz + 1 + strlen(type->name)) > 1000) return 0; + *(r++) = '_'; + r = SWIG_PackData(r, ptr, sz); + strcpy(r, type->name); + return rb_str_new2(result); +} + +/* Convert a packed pointer value */ +SWIGRUNTIME int +SWIG_Ruby_ConvertPacked(VALUE obj, void *ptr, int sz, swig_type_info *ty) { + swig_cast_info *tc; + const char *c; + + if (TYPE(obj) != T_STRING) goto type_error; + c = StringValuePtr(obj); + /* Pointer values must start with leading underscore */ + if (*c != '_') goto type_error; + c++; + c = SWIG_UnpackData(c, ptr, sz); + if (ty) { + tc = SWIG_TypeCheck(c, ty); + if (!tc) goto type_error; + } + return SWIG_OK; + + type_error: + return SWIG_ERROR; +} + +SWIGRUNTIME swig_module_info * +SWIG_Ruby_GetModule(void *SWIGUNUSEDPARM(clientdata)) +{ + VALUE pointer; + swig_module_info *ret = 0; + VALUE verbose = rb_gv_get("VERBOSE"); + + /* temporarily disable warnings, since the pointer check causes warnings with 'ruby -w' */ + rb_gv_set("VERBOSE", Qfalse); + + /* first check if pointer already created */ + pointer = rb_gv_get("$swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME); + if (pointer != Qnil) { + Data_Get_Struct(pointer, swig_module_info, ret); + } + + /* reinstate warnings */ + rb_gv_set("VERBOSE", verbose); + return ret; +} + +SWIGRUNTIME void +SWIG_Ruby_SetModule(swig_module_info *pointer) +{ + /* register a new class */ + VALUE cl = rb_define_class("swig_runtime_data", rb_cObject); + /* create and store the structure pointer to a global variable */ + swig_runtime_data_type_pointer = Data_Wrap_Struct(cl, 0, 0, pointer); + rb_define_readonly_variable("$swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, &swig_runtime_data_type_pointer); +} + +/* This function can be used to check whether a proc or method or similarly + callable function has been passed. Usually used in a %typecheck, like: + + %typecheck(c_callback_t, precedence=SWIG_TYPECHECK_POINTER) { + $result = SWIG_Ruby_isCallable( $input ); + } + */ +SWIGINTERN +int SWIG_Ruby_isCallable( VALUE proc ) +{ + if ( rb_respond_to( proc, swig_call_id ) ) + return 1; + return 0; +} + +/* This function can be used to check the arity (number of arguments) + a proc or method can take. Usually used in a %typecheck. + Valid arities will be that equal to minimal or those < 0 + which indicate a variable number of parameters at the end. + */ +SWIGINTERN +int SWIG_Ruby_arity( VALUE proc, int minimal ) +{ + if ( rb_respond_to( proc, swig_arity_id ) ) + { + VALUE num = rb_funcall( proc, swig_arity_id, 0 ); + int arity = NUM2INT(num); + if ( arity < 0 && (arity+1) < -minimal ) return 1; + if ( arity == minimal ) return 1; + return 1; + } + return 0; +} + + +#ifdef __cplusplus +} +#endif + + + +#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) + +#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else + + + + #define SWIG_exception(code, msg) do { SWIG_Error(code, msg);; } while(0) + + +/* -------- TYPES TABLE (BEGIN) -------- */ + +#define SWIGTYPE_p_Cdi swig_types[0] +#define SWIGTYPE_p_CdiGrid swig_types[1] +#define SWIGTYPE_p_CdiTaxis swig_types[2] +#define SWIGTYPE_p_CdiVariable swig_types[3] +#define SWIGTYPE_p_CdiZaxis swig_types[4] +#define SWIGTYPE_p_allocator_type swig_types[5] +#define SWIGTYPE_p_char swig_types[6] +#define SWIGTYPE_p_difference_type swig_types[7] +#define SWIGTYPE_p_double swig_types[8] +#define SWIGTYPE_p_float swig_types[9] +#define SWIGTYPE_p_key_type swig_types[10] +#define SWIGTYPE_p_mapped_type swig_types[11] +#define SWIGTYPE_p_p_double swig_types[12] +#define SWIGTYPE_p_p_void swig_types[13] +#define SWIGTYPE_p_size_type swig_types[14] +#define SWIGTYPE_p_std__allocatorT_CdiVariable_t swig_types[15] +#define SWIGTYPE_p_std__allocatorT_double_t swig_types[16] +#define SWIGTYPE_p_std__allocatorT_int_t swig_types[17] +#define SWIGTYPE_p_std__allocatorT_std__pairT_int_const_CdiGrid_t_t swig_types[18] +#define SWIGTYPE_p_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t swig_types[19] +#define SWIGTYPE_p_std__allocatorT_std__pairT_int_const_CdiVariable_t_t swig_types[20] +#define SWIGTYPE_p_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t swig_types[21] +#define SWIGTYPE_p_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t swig_types[22] +#define SWIGTYPE_p_std__allocatorT_std__string_t swig_types[23] +#define SWIGTYPE_p_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t swig_types[24] +#define SWIGTYPE_p_std__lessT_int_t swig_types[25] +#define SWIGTYPE_p_std__lessT_std__string_t swig_types[26] +#define SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t swig_types[27] +#define SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t__iterator swig_types[28] +#define SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t__reverse_iterator swig_types[29] +#define SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t swig_types[30] +#define SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t__iterator swig_types[31] +#define SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t__reverse_iterator swig_types[32] +#define SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t swig_types[33] +#define SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t__iterator swig_types[34] +#define SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t__reverse_iterator swig_types[35] +#define SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t swig_types[36] +#define SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t__iterator swig_types[37] +#define SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t__reverse_iterator swig_types[38] +#define SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t swig_types[39] +#define SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t__iterator swig_types[40] +#define SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t__reverse_iterator swig_types[41] +#define SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t swig_types[42] +#define SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t swig_types[43] +#define SWIGTYPE_p_std__vectorT_float_std__allocatorT_float_t_t swig_types[44] +#define SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t swig_types[45] +#define SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t swig_types[46] +#define SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t swig_types[47] +#define SWIGTYPE_p_std__vectorT_std__vectorT_float_std__allocatorT_float_t_t_std__allocatorT_std__vectorT_float_std__allocatorT_float_t_t_t_t swig_types[48] +#define SWIGTYPE_p_swig__ConstIterator swig_types[49] +#define SWIGTYPE_p_swig__GC_VALUE swig_types[50] +#define SWIGTYPE_p_swig__Iterator swig_types[51] +#define SWIGTYPE_p_value_type swig_types[52] +#define SWIGTYPE_p_void swig_types[53] +static swig_type_info *swig_types[55]; +static swig_module_info swig_module = {swig_types, 54, 0, 0, 0, 0}; +#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name) +#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name) + +/* -------- TYPES TABLE (END) -------- */ + +#define SWIG_init Init_Cdi +#define SWIG_name "Cdi" + +static VALUE mCdi; + +#define SWIG_RUBY_THREAD_BEGIN_BLOCK +#define SWIG_RUBY_THREAD_END_BLOCK + + +#define SWIGVERSION 0x040002 +#define SWIG_VERSION SWIGVERSION + + +#define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a)) +#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),reinterpret_cast< void** >(a)) + + +#include <stdexcept> + + +#define SWIG_FILE_WITH_INIT +#include "cdi.hpp" + + +#include <typeinfo> +#include <stdexcept> + + +namespace swig { + class SwigGCReferences { + VALUE _hash; + + SwigGCReferences() : _hash(Qnil) { + } + ~SwigGCReferences() { + if (_hash != Qnil) + rb_gc_unregister_address(&_hash); + } + static void EndProcHandler(VALUE) { + // Ruby interpreter ending - _hash can no longer be accessed. + SwigGCReferences &s_references = instance(); + s_references._hash = Qnil; + } + public: + static SwigGCReferences& instance() { + // Hash of all GC_VALUE's currently in use + static SwigGCReferences s_references; + + return s_references; + } + static void initialize() { + SwigGCReferences &s_references = instance(); + if (s_references._hash == Qnil) { + rb_set_end_proc(&EndProcHandler, Qnil); + s_references._hash = rb_hash_new(); + rb_gc_register_address(&s_references._hash); + } + } + void GC_register(VALUE& obj) { + if (FIXNUM_P(obj) || SPECIAL_CONST_P(obj) || SYMBOL_P(obj)) + return; + if (_hash != Qnil) { + VALUE val = rb_hash_aref(_hash, obj); + unsigned n = FIXNUM_P(val) ? NUM2UINT(val) : 0; + ++n; + rb_hash_aset(_hash, obj, INT2NUM(n)); + } + } + void GC_unregister(const VALUE& obj) { + if (FIXNUM_P(obj) || SPECIAL_CONST_P(obj) || SYMBOL_P(obj)) + return; + // this test should not be needed but I've noticed some very erratic + // behavior of none being unregistered in some very rare situations. + if (BUILTIN_TYPE(obj) == T_NONE) + return; + if (_hash != Qnil) { + VALUE val = rb_hash_aref(_hash, obj); + unsigned n = FIXNUM_P(val) ? NUM2UINT(val) : 1; + --n; + if (n) + rb_hash_aset(_hash, obj, INT2NUM(n)); + else + rb_hash_delete(_hash, obj); + } + } + }; + + class GC_VALUE { + protected: + VALUE _obj; + + static ID hash_id; + static ID lt_id; + static ID gt_id; + static ID eq_id; + static ID le_id; + static ID ge_id; + + static ID pos_id; + static ID neg_id; + static ID inv_id; + + static ID add_id; + static ID sub_id; + static ID mul_id; + static ID div_id; + static ID mod_id; + + static ID and_id; + static ID or_id; + static ID xor_id; + + static ID lshift_id; + static ID rshift_id; + + struct OpArgs + { + VALUE src; + ID id; + int nargs; + VALUE target; + }; + + + public: + GC_VALUE() : _obj(Qnil) + { + } + + GC_VALUE(const GC_VALUE& item) : _obj(item._obj) + { + SwigGCReferences::instance().GC_register(_obj); + } + + GC_VALUE(VALUE obj) :_obj(obj) + { + SwigGCReferences::instance().GC_register(_obj); + } + + ~GC_VALUE() + { + SwigGCReferences::instance().GC_unregister(_obj); + } + + GC_VALUE & operator=(const GC_VALUE& item) + { + SwigGCReferences::instance().GC_unregister(_obj); + _obj = item._obj; + SwigGCReferences::instance().GC_register(_obj); + return *this; + } + + operator VALUE() const + { + return _obj; + } + + VALUE inspect() const + { + return rb_inspect(_obj); + } + + VALUE to_s() const + { + return rb_inspect(_obj); + } + + static VALUE swig_rescue_swallow(VALUE, VALUE) + { + /* + VALUE errstr = rb_obj_as_string(rb_errinfo()); + printf("Swallowing error: '%s'\n", RSTRING_PTR(StringValue(errstr))); + */ + return Qnil; /* Swallow Ruby exception */ + } + + static VALUE swig_rescue_funcall(VALUE p) + { + OpArgs* args = (OpArgs*) p; + return rb_funcall(args->src, args->id, args->nargs, args->target); + } + + bool relational_equal_op(const GC_VALUE& other, const ID& op_id, bool (*op_func)(const VALUE& a, const VALUE& b)) const + { + if (FIXNUM_P(_obj) && FIXNUM_P(other._obj)) { + return op_func(_obj, other._obj); + } + bool res = false; + VALUE ret = Qnil; + SWIG_RUBY_THREAD_BEGIN_BLOCK; + if (rb_respond_to(_obj, op_id)) { + OpArgs args; + args.src = _obj; + args.id = op_id; + args.nargs = 1; + args.target = VALUE(other); + ret = rb_rescue(VALUEFUNC(swig_rescue_funcall), VALUE(&args), + (VALUEFUNC(swig_rescue_swallow)), Qnil); + } + if (ret == Qnil) { + VALUE a = rb_funcall( _obj, hash_id, 0 ); + VALUE b = rb_funcall( VALUE(other), hash_id, 0 ); + res = op_func(a, b); + } else { + res = RTEST(ret); + } + SWIG_RUBY_THREAD_END_BLOCK; + return res; + } + + static bool operator_eq(const VALUE& a, const VALUE& b) { return a == b; } + static bool operator_lt(const VALUE& a, const VALUE& b) { return a < b; } + static bool operator_le(const VALUE& a, const VALUE& b) { return a <= b; } + static bool operator_gt(const VALUE& a, const VALUE& b) { return a > b; } + static bool operator_ge(const VALUE& a, const VALUE& b) { return a >= b; } + + bool operator==(const GC_VALUE& other) const { return relational_equal_op(other, eq_id, operator_eq); } + bool operator<(const GC_VALUE& other) const { return relational_equal_op(other, lt_id, operator_lt); } + bool operator<=(const GC_VALUE& other) const { return relational_equal_op(other, le_id, operator_le); } + bool operator>(const GC_VALUE& other) const { return relational_equal_op(other, gt_id, operator_gt); } + bool operator>=(const GC_VALUE& other) const { return relational_equal_op(other, ge_id, operator_ge); } + + bool operator!=(const GC_VALUE& other) const + { + return !(this->operator==(other)); + } + + GC_VALUE unary_op(const ID& op_id) const + { + VALUE ret = Qnil; + SWIG_RUBY_THREAD_BEGIN_BLOCK; + OpArgs args; + args.src = _obj; + args.id = op_id; + args.nargs = 0; + args.target = Qnil; + ret = rb_rescue(VALUEFUNC(swig_rescue_funcall), VALUE(&args), + (VALUEFUNC(swig_rescue_swallow)), Qnil); + SWIG_RUBY_THREAD_END_BLOCK; + return ret; + } + + GC_VALUE operator+() const { return unary_op(pos_id); } + GC_VALUE operator-() const { return unary_op(neg_id); } + GC_VALUE operator~() const { return unary_op(inv_id); } + + GC_VALUE binary_op(const GC_VALUE& other, const ID& op_id) const + { + VALUE ret = Qnil; + SWIG_RUBY_THREAD_BEGIN_BLOCK; + OpArgs args; + args.src = _obj; + args.id = op_id; + args.nargs = 1; + args.target = VALUE(other); + ret = rb_rescue(VALUEFUNC(swig_rescue_funcall), VALUE(&args), + (VALUEFUNC(swig_rescue_swallow)), Qnil); + SWIG_RUBY_THREAD_END_BLOCK; + return GC_VALUE(ret); + } + + GC_VALUE operator+(const GC_VALUE& other) const { return binary_op(other, add_id); } + GC_VALUE operator-(const GC_VALUE& other) const { return binary_op(other, sub_id); } + GC_VALUE operator*(const GC_VALUE& other) const { return binary_op(other, mul_id); } + GC_VALUE operator/(const GC_VALUE& other) const { return binary_op(other, div_id); } + GC_VALUE operator%(const GC_VALUE& other) const { return binary_op(other, mod_id); } + GC_VALUE operator&(const GC_VALUE& other) const { return binary_op(other, and_id); } + GC_VALUE operator^(const GC_VALUE& other) const { return binary_op(other, xor_id); } + GC_VALUE operator|(const GC_VALUE& other) const { return binary_op(other, or_id); } + GC_VALUE operator<<(const GC_VALUE& other) const { return binary_op(other, lshift_id); } + GC_VALUE operator>>(const GC_VALUE& other) const { return binary_op(other, rshift_id); } + }; + + ID GC_VALUE::hash_id = rb_intern("hash"); + ID GC_VALUE::lt_id = rb_intern("<"); + ID GC_VALUE::gt_id = rb_intern(">"); + ID GC_VALUE::eq_id = rb_intern("=="); + ID GC_VALUE::le_id = rb_intern("<="); + ID GC_VALUE::ge_id = rb_intern(">="); + + ID GC_VALUE::pos_id = rb_intern("+@"); + ID GC_VALUE::neg_id = rb_intern("-@"); + ID GC_VALUE::inv_id = rb_intern("~"); + + ID GC_VALUE::add_id = rb_intern("+"); + ID GC_VALUE::sub_id = rb_intern("-"); + ID GC_VALUE::mul_id = rb_intern("*"); + ID GC_VALUE::div_id = rb_intern("/"); + ID GC_VALUE::mod_id = rb_intern("%"); + + ID GC_VALUE::and_id = rb_intern("&"); + ID GC_VALUE::or_id = rb_intern("|"); + ID GC_VALUE::xor_id = rb_intern("^"); + + ID GC_VALUE::lshift_id = rb_intern("<<"); + ID GC_VALUE::rshift_id = rb_intern(">>"); + + typedef GC_VALUE LANGUAGE_OBJ; + +} // namespace swig + + + +#if defined(__GNUC__) +# if __GNUC__ == 2 && __GNUC_MINOR <= 96 +# define SWIG_STD_NOMODERN_STL +# endif +#endif + + +#include <string> + + +#include <stddef.h> + + +#include <iostream> + + +namespace swig { + struct stop_iteration { + }; + + /** + * Abstract base class used to represent all iterators of STL containers. + */ + struct ConstIterator { + public: + typedef ConstIterator self_type; + + protected: + GC_VALUE _seq; + + protected: + ConstIterator(VALUE seq) : _seq(seq) + { + } + + // Random access iterator methods, but not required in Ruby + virtual ptrdiff_t distance(const ConstIterator &x) const + { + throw std::invalid_argument("distance not supported"); + } + + virtual bool equal (const ConstIterator &x) const + { + throw std::invalid_argument("equal not supported"); + } + + virtual self_type* advance(ptrdiff_t n) + { + throw std::invalid_argument("advance not supported"); + } + + public: + virtual ~ConstIterator() {} + + // Access iterator method, required by Ruby + virtual VALUE value() const { + throw std::invalid_argument("value not supported"); + return Qnil; + }; + + virtual VALUE setValue( const VALUE& v ) { + throw std::invalid_argument("value= not supported"); + return Qnil; + } + + virtual self_type* next( size_t n = 1 ) + { + return this->advance( n ); + } + + virtual self_type* previous( size_t n = 1 ) + { + ptrdiff_t nn = n; + return this->advance( -nn ); + } + + virtual VALUE to_s() const { + throw std::invalid_argument("to_s not supported"); + return Qnil; + } + + virtual VALUE inspect() const { + throw std::invalid_argument("inspect not supported"); + return Qnil; + } + + virtual ConstIterator *dup() const + { + throw std::invalid_argument("dup not supported"); + return NULL; + } + + // + // C++ common/needed methods. We emulate a bidirectional + // operator, to be compatible with all the STL. + // The iterator traits will then tell the STL what type of + // iterator we really are. + // + ConstIterator() : _seq( Qnil ) + { + } + + ConstIterator( const self_type& b ) : _seq( b._seq ) + { + } + + self_type& operator=( const self_type& b ) + { + _seq = b._seq; + return *this; + } + + bool operator == (const ConstIterator& x) const + { + return equal(x); + } + + bool operator != (const ConstIterator& x) const + { + return ! operator==(x); + } + + // Pre-decrement operator + self_type& operator--() + { + return *previous(); + } + + // Pre-increment operator + self_type& operator++() + { + return *next(); + } + + // Post-decrement operator + self_type operator--(int) + { + self_type r = *this; + previous(); + return r; + } + + // Post-increment operator + self_type operator++(int) + { + self_type r = *this; + next(); + return r; + } + + ConstIterator& operator += (ptrdiff_t n) + { + return *advance(n); + } + + ConstIterator& operator -= (ptrdiff_t n) + { + return *advance(-n); + } + + ConstIterator* operator + (ptrdiff_t n) const + { + return dup()->advance(n); + } + + ConstIterator* operator - (ptrdiff_t n) const + { + return dup()->advance(-n); + } + + ptrdiff_t operator - (const ConstIterator& x) const + { + return x.distance(*this); + } + + static swig_type_info* descriptor() { + static int init = 0; + static swig_type_info* desc = 0; + if (!init) { + desc = SWIG_TypeQuery("swig::ConstIterator *"); + init = 1; + } + return desc; + } + }; + + + /** + * Abstract base class used to represent all non-const iterators of STL containers. + * + */ + struct Iterator : public ConstIterator { + public: + typedef Iterator self_type; + + protected: + Iterator(VALUE seq) : ConstIterator(seq) + { + } + + virtual self_type* advance(ptrdiff_t n) + { + throw std::invalid_argument("operation not supported"); + } + + public: + static swig_type_info* descriptor() { + static int init = 0; + static swig_type_info* desc = 0; + if (!init) { + desc = SWIG_TypeQuery("swig::Iterator *"); + init = 1; + } + return desc; + } + + virtual Iterator *dup() const + { + throw std::invalid_argument("dup not supported"); + return NULL; + } + + virtual self_type* next( size_t n = 1 ) + { + return this->advance( n ); + } + + virtual self_type* previous( size_t n = 1 ) + { + ptrdiff_t nn = n; + return this->advance( -nn ); + } + + bool operator == (const ConstIterator& x) const + { + return equal(x); + } + + bool operator != (const Iterator& x) const + { + return ! operator==(x); + } + + Iterator& operator += (ptrdiff_t n) + { + return *advance(n); + } + + Iterator& operator -= (ptrdiff_t n) + { + return *advance(-n); + } + + Iterator* operator + (ptrdiff_t n) const + { + return dup()->advance(n); + } + + Iterator* operator - (ptrdiff_t n) const + { + return dup()->advance(-n); + } + + ptrdiff_t operator - (const Iterator& x) const + { + return x.distance(*this); + } + }; + +} + + +SWIGINTERN VALUE +SWIG_ruby_failed(VALUE SWIGUNUSEDPARM(arg1), VALUE SWIGUNUSEDPARM(arg2)) +{ + return Qnil; +} + + +/*@SWIG:/usr/share/swig4.0/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/ +SWIGINTERN VALUE SWIG_AUX_NUM2ULONG(VALUE arg) +{ + VALUE *args = (VALUE *)arg; + VALUE obj = args[0]; + VALUE type = TYPE(obj); + unsigned long *res = (unsigned long *)(args[1]); + *res = type == T_FIXNUM ? NUM2ULONG(obj) : rb_big2ulong(obj); + return obj; +} +/*@SWIG@*/ + +SWIGINTERN int +SWIG_AsVal_unsigned_SS_long (VALUE obj, unsigned long *val) +{ + VALUE type = TYPE(obj); + if ((type == T_FIXNUM) || (type == T_BIGNUM)) { + unsigned long v; + VALUE a[2]; + a[0] = obj; + a[1] = (VALUE)(&v); + if (rb_rescue(VALUEFUNC(SWIG_AUX_NUM2ULONG), (VALUE)a, VALUEFUNC(SWIG_ruby_failed), 0) != Qnil) { + if (val) *val = v; + return SWIG_OK; + } + } + return SWIG_TypeError; +} + + +#include <limits.h> +#if !defined(SWIG_NO_LLONG_MAX) +# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__) +# define LLONG_MAX __LONG_LONG_MAX__ +# define LLONG_MIN (-LLONG_MAX - 1LL) +# define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL) +# endif +#endif + + +#if defined(LLONG_MAX) && !defined(SWIG_LONG_LONG_AVAILABLE) +# define SWIG_LONG_LONG_AVAILABLE +#endif + + +#ifdef SWIG_LONG_LONG_AVAILABLE +/*@SWIG:/usr/share/swig4.0/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/ +SWIGINTERN VALUE SWIG_AUX_NUM2ULL(VALUE arg) +{ + VALUE *args = (VALUE *)arg; + VALUE obj = args[0]; + VALUE type = TYPE(obj); + long long *res = (long long *)(args[1]); + *res = type == T_FIXNUM ? NUM2ULL(obj) : rb_big2ull(obj); + return obj; +} +/*@SWIG@*/ + +SWIGINTERN int +SWIG_AsVal_unsigned_SS_long_SS_long (VALUE obj, unsigned long long *val) +{ + VALUE type = TYPE(obj); + if ((type == T_FIXNUM) || (type == T_BIGNUM)) { + unsigned long long v; + VALUE a[2]; + a[0] = obj; + a[1] = (VALUE)(&v); + if (rb_rescue(VALUEFUNC(SWIG_AUX_NUM2ULL), (VALUE)a, VALUEFUNC(SWIG_ruby_failed), 0) != Qnil) { + if (val) *val = v; + return SWIG_OK; + } + } + return SWIG_TypeError; +} +#endif + + +SWIGINTERNINLINE int +SWIG_AsVal_size_t (VALUE obj, size_t *val) +{ + int res = SWIG_TypeError; +#ifdef SWIG_LONG_LONG_AVAILABLE + if (sizeof(size_t) <= sizeof(unsigned long)) { +#endif + unsigned long v; + res = SWIG_AsVal_unsigned_SS_long (obj, val ? &v : 0); + if (SWIG_IsOK(res) && val) *val = static_cast< size_t >(v); +#ifdef SWIG_LONG_LONG_AVAILABLE + } else if (sizeof(size_t) <= sizeof(unsigned long long)) { + unsigned long long v; + res = SWIG_AsVal_unsigned_SS_long_SS_long (obj, val ? &v : 0); + if (SWIG_IsOK(res) && val) *val = static_cast< size_t >(v); + } +#endif + return res; +} + + +SWIGINTERNINLINE VALUE +SWIG_From_bool (bool value) +{ + return value ? Qtrue : Qfalse; +} + + +/*@SWIG:/usr/share/swig4.0/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/ +SWIGINTERN VALUE SWIG_AUX_NUM2LONG(VALUE arg) +{ + VALUE *args = (VALUE *)arg; + VALUE obj = args[0]; + VALUE type = TYPE(obj); + long *res = (long *)(args[1]); + *res = type == T_FIXNUM ? NUM2LONG(obj) : rb_big2long(obj); + return obj; +} +/*@SWIG@*/ + +SWIGINTERN int +SWIG_AsVal_long (VALUE obj, long* val) +{ + VALUE type = TYPE(obj); + if ((type == T_FIXNUM) || (type == T_BIGNUM)) { + long v; + VALUE a[2]; + a[0] = obj; + a[1] = (VALUE)(&v); + if (rb_rescue(VALUEFUNC(SWIG_AUX_NUM2LONG), (VALUE)a, VALUEFUNC(SWIG_ruby_failed), 0) != Qnil) { + if (val) *val = v; + return SWIG_OK; + } + } + return SWIG_TypeError; +} + + +#ifdef SWIG_LONG_LONG_AVAILABLE +/*@SWIG:/usr/share/swig4.0/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/ +SWIGINTERN VALUE SWIG_AUX_NUM2LL(VALUE arg) +{ + VALUE *args = (VALUE *)arg; + VALUE obj = args[0]; + VALUE type = TYPE(obj); + long long *res = (long long *)(args[1]); + *res = type == T_FIXNUM ? NUM2LL(obj) : rb_big2ll(obj); + return obj; +} +/*@SWIG@*/ + +SWIGINTERN int +SWIG_AsVal_long_SS_long (VALUE obj, long long *val) +{ + VALUE type = TYPE(obj); + if ((type == T_FIXNUM) || (type == T_BIGNUM)) { + long long v; + VALUE a[2]; + a[0] = obj; + a[1] = (VALUE)(&v); + if (rb_rescue(VALUEFUNC(SWIG_AUX_NUM2LL), (VALUE)a, VALUEFUNC(SWIG_ruby_failed), 0) != Qnil) { + if (val) *val = v; + return SWIG_OK; + } + } + return SWIG_TypeError; +} +#endif + + +SWIGINTERNINLINE int +SWIG_AsVal_ptrdiff_t (VALUE obj, ptrdiff_t *val) +{ + int res = SWIG_TypeError; +#ifdef SWIG_LONG_LONG_AVAILABLE + if (sizeof(ptrdiff_t) <= sizeof(long)) { +#endif + long v; + res = SWIG_AsVal_long (obj, val ? &v : 0); + if (SWIG_IsOK(res) && val) *val = static_cast< ptrdiff_t >(v); +#ifdef SWIG_LONG_LONG_AVAILABLE + } else if (sizeof(ptrdiff_t) <= sizeof(long long)) { + long long v; + res = SWIG_AsVal_long_SS_long (obj, val ? &v : 0); + if (SWIG_IsOK(res) && val) *val = static_cast< ptrdiff_t >(v); + } +#endif + return res; +} + + + #define SWIG_From_long LONG2NUM + + +#ifdef SWIG_LONG_LONG_AVAILABLE +SWIGINTERNINLINE VALUE +SWIG_From_long_SS_long (long long value) +{ + return LL2NUM(value); +} +#endif + + +SWIGINTERNINLINE VALUE +SWIG_From_ptrdiff_t (ptrdiff_t value) +{ +#ifdef SWIG_LONG_LONG_AVAILABLE + if (sizeof(ptrdiff_t) <= sizeof(long)) { +#endif + return SWIG_From_long (static_cast< long >(value)); +#ifdef SWIG_LONG_LONG_AVAILABLE + } else { + /* assume sizeof(ptrdiff_t) <= sizeof(long long) */ + return SWIG_From_long_SS_long (static_cast< long long >(value)); + } +#endif +} + + +#include <algorithm> + + +#include <vector> + + +#include <utility> + + +#include <map> + + +#include <algorithm> + + +SWIGINTERN int +SWIG_AsVal_int (VALUE obj, int *val) +{ + long v; + int res = SWIG_AsVal_long (obj, &v); + if (SWIG_IsOK(res)) { + if ((v < INT_MIN || v > INT_MAX)) { + return SWIG_OverflowError; + } else { + if (val) *val = static_cast< int >(v); + } + } + return res; +} + + +SWIGINTERNINLINE VALUE +SWIG_From_int (int value) +{ + return SWIG_From_long (value); +} + + +namespace swig { + template <class Type> + struct noconst_traits { + typedef Type noconst_type; + }; + + template <class Type> + struct noconst_traits<const Type> { + typedef Type noconst_type; + }; + + /* + type categories + */ + struct pointer_category { }; + struct value_category { }; + + /* + General traits that provides type_name and type_info + */ + template <class Type> struct traits { }; + + template <class Type> + inline const char* type_name() { + return traits<typename noconst_traits<Type >::noconst_type >::type_name(); + } + + template <class Type> struct traits_info { + static swig_type_info *type_query(std::string name) { + name += " *"; + return SWIG_TypeQuery(name.c_str()); + } + static swig_type_info *type_info() { + static swig_type_info *info = type_query(type_name<Type>()); + return info; + } + }; + + /* + Partial specialization for pointers (traits_info) + */ + template <class Type> struct traits_info<Type *> { + static swig_type_info *type_query(std::string name) { + name += " *"; + return SWIG_TypeQuery(name.c_str()); + } + static swig_type_info *type_info() { + static swig_type_info *info = type_query(type_name<Type>()); + return info; + } + }; + + template <class Type> + inline swig_type_info *type_info() { + return traits_info<Type>::type_info(); + } + + /* + Partial specialization for pointers (traits) + */ + template <class Type> struct traits <Type *> { + typedef pointer_category category; + static std::string make_ptr_name(const char* name) { + std::string ptrname = name; + ptrname += " *"; + return ptrname; + } + static const char* type_name() { + static std::string name = make_ptr_name(swig::type_name<Type>()); + return name.c_str(); + } + }; + + template <class Type, class Category> + struct traits_as { }; + + template <class Type, class Category> + struct traits_check { }; + +} + + +namespace swig { + template <class Type> struct traits_asptr; + template <class Type> struct traits_asval; + struct pointer_category; + template <class Type, class Category> struct traits_as; + template <class Type> struct traits_from; + template <class Type> struct traits_from_ptr; + template <class Type> struct noconst_traits; + template <class Type> swig_type_info* type_info(); + template <class Type> const char* type_name(); + template <class Type> VALUE from(const Type& val); +} + + + +namespace swig { + /* + Traits that provides the from method + */ + template <class Type> struct traits_from_ptr { + static VALUE from(Type *val, int owner = 0) { + return SWIG_NewPointerObj(val, type_info<Type>(), owner); + } + }; + + template <class Type> struct traits_from { + static VALUE from(const Type& val) { + return traits_from_ptr<Type>::from(new Type(val), 1); + } + }; + + template <class Type> struct traits_from<Type *> { + static VALUE from(Type* val) { + return traits_from_ptr<Type>::from(val, 0); + } + }; + + template <class Type> struct traits_from<const Type *> { + static VALUE from(const Type* val) { + return traits_from_ptr<Type>::from(const_cast<Type*>(val), 0); + } + }; + + + template <class Type> + inline VALUE from(const Type& val) { + return traits_from<Type>::from(val); + } + + template <class Type> + inline VALUE from_ptr(Type* val, int owner) { + return traits_from_ptr<Type>::from(val, owner); + } + + /* + Traits that provides the asval/as/check method + */ + template <class Type> + struct traits_asptr { + static int asptr(VALUE obj, Type **val) { + Type *p = 0; + swig_type_info *descriptor = type_info<Type>(); + int res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR; + if (SWIG_IsOK(res)) { + if (val) *val = p; + } + return res; + } + }; + + template <class Type> + inline int asptr(VALUE obj, Type **vptr) { + return traits_asptr<Type>::asptr(obj, vptr); + } + + template <class Type> + struct traits_asval { + static int asval(VALUE obj, Type *val) { + if (val) { + Type *p = 0; + int res = traits_asptr<Type>::asptr(obj, &p); + if (!SWIG_IsOK(res)) return res; + if (p) { + typedef typename noconst_traits<Type>::noconst_type noconst_type; + *(const_cast<noconst_type*>(val)) = *p; + if (SWIG_IsNewObj(res)){ + delete p; + res = SWIG_DelNewMask(res); + } + return res; + } else { + return SWIG_ERROR; + } + } else { + return traits_asptr<Type>::asptr(obj, (Type **)(0)); + } + } + }; + + template <class Type> struct traits_asval<Type*> { + static int asval(VALUE obj, Type **val) { + if (val) { + typedef typename noconst_traits<Type>::noconst_type noconst_type; + noconst_type *p = 0; + int res = traits_asptr<noconst_type>::asptr(obj, &p); + if (SWIG_IsOK(res)) { + *(const_cast<noconst_type**>(val)) = p; + } + return res; + } else { + return traits_asptr<Type>::asptr(obj, (Type **)(0)); + } + } + }; + + template <class Type> + inline int asval(VALUE obj, Type *val) { + return traits_asval<Type>::asval(obj, val); + } + + template <class Type> + struct traits_as<Type, value_category> { + static Type as(VALUE obj) { + Type v; + int res = asval(obj, &v); + if (!SWIG_IsOK(res)) { + VALUE lastErr = rb_gv_get("$!"); + if (lastErr == Qnil) { + SWIG_Error(SWIG_TypeError, swig::type_name<Type>()); + } + throw std::invalid_argument("bad type"); + } + return v; + } + }; + + template <class Type> + struct traits_as<Type, pointer_category> { + static Type as(VALUE obj) { + Type *v = 0; + int res = traits_asptr<Type>::asptr(obj, &v); + if (SWIG_IsOK(res) && v) { + if (SWIG_IsNewObj(res)) { + Type r(*v); + delete v; + return r; + } else { + return *v; + } + } else { + VALUE lastErr = rb_gv_get("$!"); + if (lastErr == Qnil) { + SWIG_Error(SWIG_TypeError, swig::type_name<Type>()); + } + throw std::invalid_argument("bad type"); + } + } + }; + + template <class Type> + struct traits_as<Type*, pointer_category> { + static Type* as(VALUE obj) { + Type *v = 0; + int res = traits_asptr<Type>::asptr(obj, &v); + if (SWIG_IsOK(res)) { + return v; + } else { + VALUE lastErr = rb_gv_get("$!"); + if (lastErr == Qnil) { + SWIG_Error(SWIG_TypeError, swig::type_name<Type>()); + } + throw std::invalid_argument("bad type"); + } + } + }; + + template <class Type> + inline Type as(VALUE obj) { + return traits_as< Type, typename traits< Type >::category >::as(obj); + } + + template <class Type> + struct traits_check<Type, value_category> { + static bool check(VALUE obj) { + int res = asval(obj, (Type *)(0)); + return SWIG_IsOK(res) ? true : false; + } + }; + + template <class Type> + struct traits_check<Type, pointer_category> { + static bool check(VALUE obj) { + int res = asptr(obj, (Type **)(0)); + return SWIG_IsOK(res) ? true : false; + } + }; + + template <class Type> + inline bool check(VALUE obj) { + return traits_check<Type, typename traits<Type>::category>::check(obj); + } +} + + +namespace swig { + template <> struct traits< int > { + typedef value_category category; + static const char* type_name() { return"int"; } + }; + template <> struct traits_asval< int > { + typedef int value_type; + static int asval(VALUE obj, value_type *val) { + return SWIG_AsVal_int (obj, val); + } + }; + template <> struct traits_from< int > { + typedef int value_type; + static VALUE from(const value_type& val) { + return SWIG_From_int (val); + } + }; +} + + +#include <functional> + + +namespace swig { + template < class T > + struct yield + { + bool + operator()( const T& v ) const + { + return RTEST( rb_yield( swig::from< T >(v) ) ); + } + }; + + + inline size_t + check_index(ptrdiff_t i, size_t size, bool insert = false) { + if ( i < 0 ) { + if ((size_t) (-i) <= size) + return (size_t) (i + size); + } else if ( (size_t) i < size ) { + return (size_t) i; + } else if (insert && ((size_t) i == size)) { + return size; + } + + throw std::out_of_range("index out of range"); + } + + inline size_t + slice_index(ptrdiff_t i, size_t size) { + if ( i < 0 ) { + if ((size_t) (-i) <= size) { + return (size_t) (i + size); + } else { + throw std::out_of_range("index out of range"); + } + } else { + return ( (size_t) i < size ) ? ((size_t) i) : size; + } + } + + template <class Sequence, class Difference> + inline typename Sequence::iterator + getpos(Sequence* self, Difference i) { + typename Sequence::iterator pos = self->begin(); + std::advance(pos, check_index(i,self->size())); + return pos; + } + + template <class Sequence, class Difference> + inline typename Sequence::const_iterator + cgetpos(const Sequence* self, Difference i) { + typename Sequence::const_iterator pos = self->begin(); + std::advance(pos, check_index(i,self->size())); + return pos; + } + + template <class Sequence> + inline void + resize(Sequence *seq, typename Sequence::size_type n, typename Sequence::value_type x) { + seq->resize(n, x); + } + + template <class Sequence, class Difference> + inline Sequence* + getslice(const Sequence* self, Difference i, Difference j) { + typename Sequence::size_type size = self->size(); + typename Sequence::size_type ii = swig::check_index(i, size, (i == size && j == size)); + typename Sequence::size_type jj = swig::slice_index(j, size); + + if (jj > ii) { + typename Sequence::const_iterator vb = self->begin(); + typename Sequence::const_iterator ve = self->begin(); + std::advance(vb,ii); + std::advance(ve,jj); + return new Sequence(vb, ve); + } else { + return new Sequence(); + } + } + + template <class Sequence, class Difference, class InputSeq> + inline void + setslice(Sequence* self, Difference i, Difference j, const InputSeq& v) { + typename Sequence::size_type size = self->size(); + typename Sequence::size_type ii = swig::check_index(i, size, true); + typename Sequence::size_type jj = swig::slice_index(j, size); + if (jj < ii) jj = ii; + size_t ssize = jj - ii; + if (ssize <= v.size()) { + typename Sequence::iterator sb = self->begin(); + typename InputSeq::const_iterator vmid = v.begin(); + std::advance(sb,ii); + std::advance(vmid, jj - ii); + self->insert(std::copy(v.begin(), vmid, sb), vmid, v.end()); + } else { + typename Sequence::iterator sb = self->begin(); + typename Sequence::iterator se = self->begin(); + std::advance(sb,ii); + std::advance(se,jj); + self->erase(sb,se); + self->insert(sb, v.begin(), v.end()); + } + } + + template <class Sequence, class Difference> + inline void + delslice(Sequence* self, Difference i, Difference j) { + typename Sequence::size_type size = self->size(); + typename Sequence::size_type ii = swig::check_index(i, size, true); + typename Sequence::size_type jj = swig::slice_index(j, size); + if (jj > ii) { + typename Sequence::iterator sb = self->begin(); + typename Sequence::iterator se = self->begin(); + std::advance(sb,ii); + std::advance(se,jj); + self->erase(sb,se); + } + } +} + + +#if defined(__SUNPRO_CC) && defined(_RWSTD_VER) +# if !defined(SWIG_NO_STD_NOITERATOR_TRAITS_STL) +# define SWIG_STD_NOITERATOR_TRAITS_STL +# endif +#endif + +#if !defined(SWIG_STD_NOITERATOR_TRAITS_STL) +#include <iterator> +#else +namespace std { + template <class Iterator> + struct iterator_traits { + typedef ptrdiff_t difference_type; + typedef typename Iterator::value_type value_type; + }; + + template <class Iterator, class Category,class T, class Reference, class Pointer, class Distance> + struct iterator_traits<__reverse_bi_iterator<Iterator,Category,T,Reference,Pointer,Distance> > { + typedef Distance difference_type; + typedef T value_type; + }; + + template <class T> + struct iterator_traits<T*> { + typedef T value_type; + typedef ptrdiff_t difference_type; + }; + + template<typename _InputIterator> + inline typename iterator_traits<_InputIterator>::difference_type + distance(_InputIterator __first, _InputIterator __last) + { + typename iterator_traits<_InputIterator>::difference_type __n = 0; + while (__first != __last) { + ++__first; ++__n; + } + return __n; + } +} +#endif + + +namespace swig { + + /** + * Templated base classes for all custom const_iterators. + * + */ + template<typename OutConstIterator> + class ConstIterator_T : public ConstIterator + { + public: + typedef OutConstIterator const_iter; + typedef typename std::iterator_traits<const_iter>::value_type value_type; + typedef ConstIterator_T<const_iter> self_type; + + protected: + + + virtual bool equal (const ConstIterator &iter) const + { + const self_type *iters = dynamic_cast<const self_type *>(&iter); + if (iters) { + return (current == iters->get_current()); + } else { + throw std::invalid_argument("bad iterator type"); + } + } + + virtual ptrdiff_t distance(const ConstIterator &iter) const + { + const self_type *iters = dynamic_cast<const self_type *>(&iter); + if (iters) { + return std::distance(current, iters->get_current()); + } else { + throw std::invalid_argument("bad iterator type"); + } + } + + virtual ConstIterator* advance(ptrdiff_t n) + { + std::advance( current, n ); + return this; + } + + public: + ConstIterator_T() : ConstIterator(Qnil) + { + } + + ConstIterator_T(const_iter curr, VALUE seq = Qnil) + : ConstIterator(seq), current(curr) + { + } + + const const_iter& get_current() const + { + return current; + } + + const value_type& operator*() const + { + return *current; + } + + virtual VALUE inspect() const + { + VALUE ret = rb_str_new2("#<"); + ret = rb_str_cat2( ret, rb_obj_classname(_seq) ); + ret = rb_str_cat2( ret, "::const_iterator " ); + VALUE cur = value(); + ret = rb_str_concat( ret, rb_inspect(cur) ); + ret = rb_str_cat2( ret, ">" ); + return ret; + } + + virtual VALUE to_s() const + { + VALUE ret = rb_str_new2( rb_obj_classname(_seq) ); + ret = rb_str_cat2( ret, "::const_iterator " ); + VALUE cur = value(); + ret = rb_str_concat( ret, rb_obj_as_string(cur) ); + return ret; + } + + protected: + const_iter current; + }; + + + /** + * Templated base classes for all custom non-const iterators. + * + */ + template<typename InOutIterator> + class Iterator_T : public Iterator + { + public: + typedef InOutIterator nonconst_iter; + + // Make this class iterator STL compatible, by using iterator_traits + typedef typename std::iterator_traits<nonconst_iter >::iterator_category iterator_category; + typedef typename std::iterator_traits<nonconst_iter >::value_type value_type; + typedef typename std::iterator_traits<nonconst_iter >::difference_type difference_type; + typedef typename std::iterator_traits<nonconst_iter >::pointer pointer; + typedef typename std::iterator_traits<nonconst_iter >::reference reference; + + typedef Iterator base; + typedef Iterator_T< nonconst_iter > self_type; + + protected: + + virtual bool equal (const ConstIterator &iter) const + { + const self_type *iters = dynamic_cast<const self_type *>(&iter); + if (iters) { + return (current == iters->get_current()); + } else { + throw std::invalid_argument("bad iterator type"); + } + } + + virtual ptrdiff_t distance(const ConstIterator &iter) const + { + const self_type *iters = dynamic_cast<const self_type *>(&iter); + if (iters) { + return std::distance(current, iters->get_current()); + } else { + throw std::invalid_argument("bad iterator type"); + } + } + + virtual Iterator* advance(ptrdiff_t n) + { + std::advance( current, n ); + return this; + } + + public: + + Iterator_T(nonconst_iter curr, VALUE seq = Qnil) + : Iterator(seq), current(curr) + { + } + + const nonconst_iter& get_current() const + { + return current; + } + + self_type& operator=( const self_type& b ) + { + base::operator=( b ); + return *this; + } + + self_type& operator=( const value_type& b ) + { + *current = b; + return *this; + } + + const value_type& operator*() const + { + return *current; + } + + value_type& operator*() + { + return *current; + } + + virtual VALUE inspect() const + { + VALUE ret = rb_str_new2("#<"); + ret = rb_str_cat2( ret, rb_obj_classname(_seq) ); + ret = rb_str_cat2( ret, "::iterator " ); + VALUE cur = value(); + ret = rb_str_concat( ret, rb_inspect(cur) ); + ret = rb_str_cat2( ret, ">" ); + return ret; + } + + virtual VALUE to_s() const + { + VALUE ret = rb_str_new2( rb_obj_classname(_seq) ); + ret = rb_str_cat2( ret, "::iterator " ); + VALUE cur = value(); + ret = rb_str_concat( ret, rb_obj_as_string(cur) ); + return ret; + } + + protected: + nonconst_iter current; + }; + + + /** + * Auxiliary functor to store the value of a ruby object inside + * a reference of a compatible C++ type. ie: Ruby -> C++ + * + */ + template <class ValueType> + struct asval_oper + { + typedef ValueType value_type; + typedef bool result_type; + bool operator()(VALUE obj, value_type& v) const + { + return ( swig::asval< value_type >(obj, &v) == SWIG_OK ); + } + }; + + /** + * Auxiliary functor to return a ruby object from a C++ type. + * ie: C++ -> Ruby + * + */ + template <class ValueType> + struct from_oper + { + typedef const ValueType& argument_type; + typedef VALUE result_type; + result_type operator()(argument_type v) const + { + return swig::from(v); + } + }; + + + /** + * ConstIterator class for a const_iterator with no end() boundaries. + * + */ + template<typename OutConstIterator, + typename ValueType = typename std::iterator_traits<OutConstIterator>::value_type, + typename FromOper = from_oper<ValueType> > + class ConstIteratorOpen_T : public ConstIterator_T<OutConstIterator> + { + public: + FromOper from; + typedef OutConstIterator const_iter; + typedef ValueType value_type; + typedef ConstIterator_T<const_iter> base; + typedef ConstIteratorOpen_T<OutConstIterator, ValueType, FromOper> self_type; + + ConstIteratorOpen_T(const_iter curr, VALUE seq = Qnil) + : ConstIterator_T<OutConstIterator>(curr, seq) + { + } + + virtual VALUE value() const { + return from(static_cast<const value_type&>(*(base::current))); + } + + ConstIterator *dup() const + { + return new self_type(*this); + } + }; + + /** + * Iterator class for an iterator with no end() boundaries. + * + */ + template<typename InOutIterator, + typename ValueType = typename std::iterator_traits<InOutIterator>::value_type, + typename FromOper = from_oper<ValueType>, + typename AsvalOper = asval_oper<ValueType> > + class IteratorOpen_T : public Iterator_T<InOutIterator> + { + public: + FromOper from; + AsvalOper asval; + typedef InOutIterator nonconst_iter; + typedef ValueType value_type; + typedef Iterator_T<nonconst_iter> base; + typedef IteratorOpen_T<InOutIterator, ValueType, FromOper, AsvalOper> self_type; + + public: + IteratorOpen_T(nonconst_iter curr, VALUE seq = Qnil) + : Iterator_T<InOutIterator>(curr, seq) + { + } + + virtual VALUE value() const { + return from(static_cast<const value_type&>(*(base::current))); + } + + virtual VALUE setValue( const VALUE& v ) + { + value_type& dst = *base::current; + if ( asval(v, dst) ) return v; + return Qnil; + } + + Iterator *dup() const + { + return new self_type(*this); + } + }; + + /** + * ConstIterator class for a const_iterator where begin() and end() boundaries are known. + * + */ + template<typename OutConstIterator, + typename ValueType = typename std::iterator_traits<OutConstIterator>::value_type, + typename FromOper = from_oper<ValueType> > + class ConstIteratorClosed_T : public ConstIterator_T<OutConstIterator> + { + public: + FromOper from; + typedef OutConstIterator const_iter; + typedef ValueType value_type; + typedef ConstIterator_T<const_iter> base; + typedef ConstIteratorClosed_T<OutConstIterator, ValueType, FromOper> self_type; + + protected: + virtual ConstIterator* advance(ptrdiff_t n) + { + std::advance( base::current, n ); + if ( base::current == end ) + throw stop_iteration(); + return this; + } + + public: + ConstIteratorClosed_T(const_iter curr, const_iter first, + const_iter last, VALUE seq = Qnil) + : ConstIterator_T<OutConstIterator>(curr, seq), begin(first), end(last) + { + } + + virtual VALUE value() const { + if (base::current == end) { + throw stop_iteration(); + } else { + return from(static_cast<const value_type&>(*(base::current))); + } + } + + ConstIterator *dup() const + { + return new self_type(*this); + } + + + private: + const_iter begin; + const_iter end; + }; + + /** + * Iterator class for a iterator where begin() and end() boundaries are known. + * + */ + template<typename InOutIterator, + typename ValueType = typename std::iterator_traits<InOutIterator>::value_type, + typename FromOper = from_oper<ValueType>, + typename AsvalOper = asval_oper<ValueType> > + class IteratorClosed_T : public Iterator_T<InOutIterator> + { + public: + FromOper from; + AsvalOper asval; + typedef InOutIterator nonconst_iter; + typedef ValueType value_type; + typedef Iterator_T<nonconst_iter> base; + typedef IteratorClosed_T<InOutIterator, ValueType, FromOper, AsvalOper> self_type; + + protected: + virtual Iterator* advance(ptrdiff_t n) + { + std::advance( base::current, n ); + if ( base::current == end ) + throw stop_iteration(); + return this; + } + + public: + IteratorClosed_T(nonconst_iter curr, nonconst_iter first, + nonconst_iter last, VALUE seq = Qnil) + : Iterator_T<InOutIterator>(curr, seq), begin(first), end(last) + { + } + + virtual VALUE value() const { + if (base::current == end) { + throw stop_iteration(); + } else { + return from(static_cast<const value_type&>(*(base::current))); + } + } + + // Iterator setter method, required by Ruby + virtual VALUE setValue( const VALUE& v ) + { + if (base::current == end) + throw stop_iteration(); + + value_type& dst = *base::current; + if ( asval( v, dst ) ) return v; + return Qnil; + } + + Iterator *dup() const + { + return new self_type(*this); + } + + private: + nonconst_iter begin; + nonconst_iter end; + }; + + /* Partial specialization for bools which don't allow de-referencing */ + template< typename InOutIterator, typename FromOper, typename AsvalOper > + class IteratorOpen_T< InOutIterator, bool, FromOper, AsvalOper > : + public Iterator_T<InOutIterator> + { + public: + FromOper from; + AsvalOper asval; + typedef InOutIterator nonconst_iter; + typedef bool value_type; + typedef Iterator_T<nonconst_iter> base; + typedef IteratorOpen_T<InOutIterator, bool, FromOper, AsvalOper> self_type; + + IteratorOpen_T(nonconst_iter curr, VALUE seq = Qnil) + : Iterator_T<InOutIterator>(curr, seq) + { + } + + virtual VALUE value() const { + return from(static_cast<const value_type&>(*(base::current))); + } + + virtual VALUE setValue( const VALUE& v ) + { + bool tmp = *base::current; + if ( asval( v, tmp ) ) + { + *base::current = tmp; + return v; + } + return Qnil; + } + + Iterator *dup() const + { + return new self_type(*this); + } + + }; + + /* Partial specialization for bools which don't allow de-referencing */ + template< typename InOutIterator, typename FromOper, typename AsvalOper > + class IteratorClosed_T< InOutIterator, bool, FromOper, AsvalOper > : + public Iterator_T<InOutIterator> + { + public: + FromOper from; + AsvalOper asval; + typedef InOutIterator nonconst_iter; + typedef bool value_type; + typedef Iterator_T<nonconst_iter> base; + typedef IteratorClosed_T<InOutIterator, bool, FromOper, AsvalOper> self_type; + + protected: + virtual Iterator* advance(ptrdiff_t n) + { + std::advance( base::current, n ); + if ( base::current == end ) + throw stop_iteration(); + return this; + } + + public: + IteratorClosed_T(nonconst_iter curr, nonconst_iter first, + nonconst_iter last, VALUE seq = Qnil) + : Iterator_T<InOutIterator>(curr, seq), begin(first), end(last) + { + } + + virtual VALUE value() const { + if (base::current == end) { + throw stop_iteration(); + } else { + return from(static_cast<const value_type&>(*(base::current))); + } + } + + virtual VALUE setValue( const VALUE& v ) + { + if (base::current == end) + throw stop_iteration(); + + bool tmp = *base::current; + if ( asval( v, tmp ) ) + { + *base::current = tmp; + return v; + } + return Qnil; + } + + Iterator *dup() const + { + return new self_type(*this); + } + + private: + nonconst_iter begin; + nonconst_iter end; + }; + + + /** + * Helper function used to wrap a bounded const_iterator. This is to be used in + * a %typemap(out), for example. + * + */ + template<typename InOutIter> + inline Iterator* + make_nonconst_iterator(const InOutIter& current, const InOutIter& begin, + const InOutIter& end, VALUE seq = Qnil) + { + return new IteratorClosed_T<InOutIter>(current, begin, end, seq); + } + + /** + * Helper function used to wrap an unbounded const_iterator. This is to be used in + * a %typemap(out), for example. + * + */ + template<typename InOutIter> + inline Iterator* + make_nonconst_iterator(const InOutIter& current, VALUE seq = Qnil) + { + return new IteratorOpen_T<InOutIter>(current, seq); + } + + /** + * Helper function used to wrap a bounded const_iterator. This is to be used in + * a %typemap(out), for example. + * + */ + template<typename OutIter> + inline ConstIterator* + make_const_iterator(const OutIter& current, const OutIter& begin, + const OutIter& end, VALUE seq = Qnil) + { + return new ConstIteratorClosed_T<OutIter>(current, begin, end, seq); + } + + /** + * Helper function used to wrap an unbounded const_iterator. This is to be used in + * a %typemap(out), for example. + * + */ + template<typename OutIter> + inline ConstIterator* + make_const_iterator(const OutIter& current, VALUE seq = Qnil) + { + return new ConstIteratorOpen_T<OutIter>(current, seq); + } +} + + +namespace swig +{ + + /** + * This class is a proxy class for references, used to return and set values + * of an element of a Ruby Array of stuff. + * It can be used by RubySequence_InputIterator to make it work with STL + * algorithms. + */ + template <class T> + struct RubySequence_Ref + { + RubySequence_Ref(VALUE seq, int index) + : _seq(seq), _index(index) + { + } + + operator T () const + { + VALUE item = rb_ary_entry(_seq, _index ); + try { + return swig::as<T>(item); + } catch (const std::invalid_argument& e) { + char msg[1024]; + sprintf(msg, "in sequence element %d ", _index); + VALUE lastErr = rb_gv_get("$!"); + if ( lastErr == Qnil ) { + SWIG_Error(SWIG_TypeError, swig::type_name<T>()); + } + VALUE str = rb_str_new2(msg); + str = rb_str_cat2( str, e.what() ); + SWIG_Ruby_ExceptionType( NULL, str ); + throw; + } + } + + RubySequence_Ref& operator=(const T& v) + { + rb_ary_set(_seq, _index, swig::from< T >(v)); + return *this; + } + + private: + VALUE _seq; + int _index; + }; + + + /** + * This class is a proxy to return a pointer to a class, usually + * RubySequence_Ref. + * It can be used by RubySequence_InputIterator to make it work with STL + * algorithms. + */ + template <class T> + struct RubySequence_ArrowProxy + { + RubySequence_ArrowProxy(const T& x): m_value(x) {} + const T* operator->() const { return &m_value; } + operator const T*() const { return &m_value; } + T m_value; + }; + + + /** + * Input Iterator. This adapator class is a random access iterator that + * allows you to use STL algorithms with a Ruby class (a Ruby Array by default). + */ + template <class T, class Reference = RubySequence_Ref< T > > + struct RubySequence_InputIterator + { + typedef RubySequence_InputIterator<T, Reference > self; + + typedef std::random_access_iterator_tag iterator_category; + typedef Reference reference; + typedef T value_type; + typedef T* pointer; + typedef ptrdiff_t difference_type; + + RubySequence_InputIterator() + { + } + + RubySequence_InputIterator(VALUE seq, int index) + : _seq(seq), _index(index) + { + } + + reference operator*() const + { + return reference(_seq, _index); + } + + RubySequence_ArrowProxy<T> + operator->() const { + return RubySequence_ArrowProxy<T>(operator*()); + } + + bool operator==(const self& ri) const + { + return (_index == ri._index) && (_seq == ri._seq); + } + + bool operator!=(const self& ri) const + { + return !(operator==(ri)); + } + + self& operator ++ () + { + ++_index; + return *this; + } + + self& operator -- () + { + --_index; + return *this; + } + + self& operator += (difference_type n) + { + _index += n; + return *this; + } + + self operator +(difference_type n) const + { + return self(_seq, _index + n); + } + + self& operator -= (difference_type n) + { + _index -= n; + return *this; + } + + self operator -(difference_type n) const + { + return self(_seq, _index - n); + } + + difference_type operator - (const self& ri) const + { + return _index - ri._index; + } + + bool operator < (const self& ri) const + { + return _index < ri._index; + } + + reference + operator[](difference_type n) const + { + return reference(_seq, _index + n); + } + + private: + VALUE _seq; + difference_type _index; + }; + + + /** + * This adaptor class allows you to use a Ruby Array as if it was an STL + * container, giving it begin(), end(), and iterators. + */ + template <class T> + struct RubySequence_Cont + { + typedef RubySequence_Ref<T> reference; + typedef const RubySequence_Ref<T> const_reference; + typedef T value_type; + typedef T* pointer; + typedef int difference_type; + typedef int size_type; + typedef const pointer const_pointer; + typedef RubySequence_InputIterator<T, reference> iterator; + typedef RubySequence_InputIterator<T, const_reference> const_iterator; + + RubySequence_Cont(VALUE seq) : _seq(0) + { + if (!rb_obj_is_kind_of(seq, rb_cArray)) { + throw std::invalid_argument("an Array is expected"); + } + _seq = seq; + } + + ~RubySequence_Cont() + { + } + + size_type size() const + { + return RARRAY_LEN(_seq); + } + + bool empty() const + { + return size() == 0; + } + + iterator begin() + { + return iterator(_seq, 0); + } + + const_iterator begin() const + { + return const_iterator(_seq, 0); + } + + iterator end() + { + return iterator(_seq, size()); + } + + const_iterator end() const + { + return const_iterator(_seq, size()); + } + + reference operator[](difference_type n) + { + return reference(_seq, n); + } + + const_reference operator[](difference_type n) const + { + return const_reference(_seq, n); + } + + bool check() const + { + int s = (int) size(); + for (int i = 0; i < s; ++i) { + VALUE item = rb_ary_entry(_seq, i ); + if (!swig::check<value_type>(item)) + return false; + } + return true; + } + + private: + VALUE _seq; + }; + +} + + +namespace swig { + template <class RubySeq, class Seq> + inline void + assign(const RubySeq& rubyseq, Seq* seq) { + // seq->assign(rubyseq.begin(), rubyseq.end()); // not used as not always implemented + typedef typename RubySeq::value_type value_type; + typename RubySeq::const_iterator it = rubyseq.begin(); + for (;it != rubyseq.end(); ++it) { + seq->insert(seq->end(),(value_type)(*it)); + } + } + + template <class Seq, class T = typename Seq::value_type > + struct traits_asptr_stdseq { + typedef Seq sequence; + typedef T value_type; + + static int asptr(VALUE obj, sequence **seq) { + if (rb_obj_is_kind_of(obj, rb_cArray) == Qtrue) { + try { + RubySequence_Cont<value_type> rubyseq(obj); + if (seq) { + sequence *pseq = new sequence(); + assign(rubyseq, pseq); + *seq = pseq; + return SWIG_NEWOBJ; + } else { + return rubyseq.check() ? SWIG_OK : SWIG_ERROR; + } + } catch (const std::exception& e) { + if (seq) { + VALUE lastErr = rb_gv_get("$!"); + if (lastErr == Qnil) { + rb_raise(rb_eTypeError, "%s", e.what()); + } + } + return SWIG_ERROR; + } + } else { + sequence *p; + swig_type_info *descriptor = swig::type_info<sequence>(); + if (descriptor && SWIG_IsOK(SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0))) { + if (seq) *seq = p; + return SWIG_OLDOBJ; + } + } + return SWIG_ERROR; + } + }; + + // Partial specialization for GC_VALUE's. No need to typecheck each + // element. + template< class Seq > + struct traits_asptr_stdseq< Seq, swig::GC_VALUE > { + typedef Seq sequence; + typedef swig::GC_VALUE value_type; + + static int asptr(VALUE obj, sequence **seq) { + if (rb_obj_is_kind_of(obj, rb_cArray) == Qtrue) { + try { + if (seq) { + RubySequence_Cont<value_type> rubyseq(obj); + sequence *pseq = new sequence(); + assign(rubyseq, pseq); + *seq = pseq; + return SWIG_NEWOBJ; + } else { + return true; + } + } catch (const std::exception& e) { + if (seq) { + VALUE lastErr = rb_gv_get("$!"); + if (lastErr == Qnil) { + rb_raise(rb_eTypeError, "%s", e.what()); + } + } + return SWIG_ERROR; + } + } else { + sequence *p; + swig_type_info *descriptor = swig::type_info<sequence>(); + if (descriptor && SWIG_IsOK(SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0))) { + if (seq) *seq = p; + return SWIG_OLDOBJ; + } + } + return SWIG_ERROR; + } + }; + + template <class Seq, class T = typename Seq::value_type > + struct traits_from_stdseq { + typedef Seq sequence; + typedef T value_type; + typedef typename Seq::size_type size_type; + typedef typename sequence::const_iterator const_iterator; + + static VALUE from(const sequence& seq) { + + + + + + + size_type size = seq.size(); + if (size <= (size_type)INT_MAX) { + VALUE obj = rb_ary_new2((int)size); + int i = 0; + for (const_iterator it = seq.begin(); + it != seq.end(); ++it, ++i) { + rb_ary_push(obj, swig::from< value_type >(*it)); + } + rb_obj_freeze(obj); // treat as immutable result + return obj; + } else { + rb_raise(rb_eRangeError,"sequence size not valid in ruby"); + return Qnil; + } + } + }; +} + + + namespace swig { + template <class T> + struct traits_asptr<std::vector<T> > { + static int asptr(VALUE obj, std::vector<T> **vec) { + return traits_asptr_stdseq<std::vector<T> >::asptr(obj, vec); + } + }; + + template <class T> + struct traits_from<std::vector<T> > { + static VALUE from(const std::vector<T>& vec) { + return traits_from_stdseq<std::vector<T> >::from(vec); + } + }; + } + + + namespace swig { + template <> struct traits<std::vector< int, std::allocator< int > > > { + typedef pointer_category category; + static const char* type_name() { + return "std::vector<" "int" "," "std::allocator< int >" " >"; + } + }; + } + +SWIGINTERN std::vector< int,std::allocator< int > > *std_vector_Sl_int_Sg__dup(std::vector< int > *self){ + return new std::vector< int,std::allocator< int > >(*self); + } +SWIGINTERN VALUE std_vector_Sl_int_Sg__inspect(std::vector< int > *self){ + std::vector< int,std::allocator< int > >::const_iterator i = self->begin(); + std::vector< int,std::allocator< int > >::const_iterator e = self->end(); + const char *type_name = swig::type_name< std::vector< int,std::allocator< int > > >(); + VALUE str = rb_str_new2(type_name); + str = rb_str_cat2( str, " [" ); + bool comma = false; + VALUE tmp; + for ( ; i != e; ++i, comma = true ) + { + if (comma) str = rb_str_cat2( str, "," ); + tmp = swig::from< std::vector< int,std::allocator< int > >::value_type >( *i ); + tmp = rb_inspect( tmp ); + str = rb_str_buf_append( str, tmp ); + } + str = rb_str_cat2( str, "]" ); + return str; + } +SWIGINTERN VALUE std_vector_Sl_int_Sg__to_a(std::vector< int > *self){ + std::vector< int,std::allocator< int > >::const_iterator i = self->begin(); + std::vector< int,std::allocator< int > >::const_iterator e = self->end(); + VALUE ary = rb_ary_new2( std::distance( i, e ) ); + VALUE tmp; + for ( ; i != e; ++i ) + { + tmp = swig::from< std::vector< int,std::allocator< int > >::value_type >( *i ); + rb_ary_push( ary, tmp ); + } + return ary; + } +SWIGINTERN VALUE std_vector_Sl_int_Sg__to_s(std::vector< int > *self){ + std::vector< int,std::allocator< int > >::iterator i = self->begin(); + std::vector< int,std::allocator< int > >::iterator e = self->end(); + VALUE str = rb_str_new2( "" ); + VALUE tmp; + for ( ; i != e; ++i ) + { + tmp = swig::from< std::vector< int,std::allocator< int > >::value_type >( *i ); + tmp = rb_obj_as_string( tmp ); + str = rb_str_buf_append( str, tmp ); + } + return str; + } +SWIGINTERN VALUE std_vector_Sl_int_Sg__slice(std::vector< int > *self,std::vector< int >::difference_type i,std::vector< int >::difference_type length){ + if ( length < 0 ) + return Qnil; + std::size_t len = self->size(); + if ( i < 0 ) { + if ( i + static_cast<std::vector< int,std::allocator< int > >::difference_type>(len) < 0 ) + return Qnil; + else + i = len + i; + } + std::vector< int,std::allocator< int > >::difference_type j = length + i; + if ( j > static_cast<std::vector< int,std::allocator< int > >::difference_type>(len) ) + j = len; + + VALUE r = Qnil; + try { + r = swig::from< const std::vector< int,std::allocator< int > >* >( swig::getslice(self, i, j) ); + } + catch( const std::out_of_range& ) { + } + return r; + } +SWIGINTERN std::vector< int,std::allocator< int > > *std_vector_Sl_int_Sg__each(std::vector< int > *self){ + if ( !rb_block_given_p() ) + rb_raise( rb_eArgError, "no block given"); + + VALUE r; + std::vector< int,std::allocator< int > >::const_iterator i = self->begin(); + std::vector< int,std::allocator< int > >::const_iterator e = self->end(); + for ( ; i != e; ++i ) + { + r = swig::from< std::vector< int,std::allocator< int > >::value_type >(*i); + rb_yield(r); + } + + return self; + } +SWIGINTERN VALUE std_vector_Sl_int_Sg____delete2__(std::vector< int > *self,std::vector< int >::value_type const &i){ + VALUE r = Qnil; + return r; + } +SWIGINTERN std::vector< int,std::allocator< int > > *std_vector_Sl_int_Sg__select(std::vector< int > *self){ + if ( !rb_block_given_p() ) + rb_raise( rb_eArgError, "no block given" ); + + std::vector< int,std::allocator< int > >* r = new std::vector< int,std::allocator< int > >(); + std::vector< int,std::allocator< int > >::const_iterator i = self->begin(); + std::vector< int,std::allocator< int > >::const_iterator e = self->end(); + for ( ; i != e; ++i ) + { + VALUE v = swig::from< std::vector< int,std::allocator< int > >::value_type >(*i); + if ( RTEST( rb_yield(v) ) ) + self->insert( r->end(), *i); + } + + return r; + } +SWIGINTERN VALUE std_vector_Sl_int_Sg__delete_at(std::vector< int > *self,std::vector< int >::difference_type i){ + VALUE r = Qnil; + try { + std::vector< int,std::allocator< int > >::iterator at = swig::getpos(self, i); + r = swig::from< std::vector< int,std::allocator< int > >::value_type >( *(at) ); + self->erase(at); + } + catch (const std::out_of_range&) { + } + return r; + } +SWIGINTERN VALUE std_vector_Sl_int_Sg__at(std::vector< int > const *self,std::vector< int >::difference_type i){ + VALUE r = Qnil; + try { + r = swig::from< std::vector< int,std::allocator< int > >::value_type >( *(swig::cgetpos(self, i)) ); + } + catch( const std::out_of_range& ) { + } + return r; + } +SWIGINTERN VALUE std_vector_Sl_int_Sg____getitem____SWIG_0(std::vector< int > const *self,std::vector< int >::difference_type i,std::vector< int >::difference_type length){ + if ( length < 0 ) + return Qnil; + std::size_t len = self->size(); + if ( i < 0 ) { + if ( i + static_cast<std::vector< int,std::allocator< int > >::difference_type>(len) < 0 ) + return Qnil; + else + i = len + i; + } + std::vector< int,std::allocator< int > >::difference_type j = length + i; + if ( j > static_cast<std::vector< int,std::allocator< int > >::difference_type>(len) ) + j = len; + + VALUE r = Qnil; + try { + r = swig::from< const std::vector< int,std::allocator< int > >* >( swig::getslice(self, i, j) ); + } + catch( const std::out_of_range& ) { + } + return r; + } +SWIGINTERN VALUE std_vector_Sl_int_Sg____getitem____SWIG_1(std::vector< int > const *self,std::vector< int >::difference_type i){ + VALUE r = Qnil; + try { + r = swig::from< std::vector< int,std::allocator< int > >::value_type >( *(swig::cgetpos(self, i)) ); + } + catch( const std::out_of_range& ) { + } + return r; + } +SWIGINTERN VALUE std_vector_Sl_int_Sg____getitem____SWIG_2(std::vector< int > const *self,VALUE i){ + if ( rb_obj_is_kind_of( i, rb_cRange ) == Qfalse ) { + rb_raise( rb_eTypeError, "not a valid index or range" ); + } + + static ID id_end = rb_intern("end"); + static ID id_start = rb_intern("begin"); + static ID id_noend = rb_intern("exclude_end?"); + + VALUE start = rb_funcall( i, id_start, 0 ); + VALUE end = rb_funcall( i, id_end, 0 ); + bool noend = ( rb_funcall( i, id_noend, 0 ) == Qtrue ); + + int len = self->size(); + + int s = NUM2INT( start ); + if ( s < 0 ) { + s = len + s; + if ( s < 0 ) + return Qnil; + } else if ( s > len ) + return Qnil; + + int e = NUM2INT( end ); + if ( e < 0 ) e = len + e; + if ( noend ) e -= 1; + if ( e < 0 ) e = -1; + if ( e >= len ) e = len - 1; + if ( s == len ) e = len - 1; + + return swig::from< std::vector< int,std::allocator< int > >* >( swig::getslice(self, s, e+1) ); + } +SWIGINTERN VALUE std_vector_Sl_int_Sg____setitem____SWIG_0(std::vector< int > *self,std::vector< int >::difference_type i,std::vector< int >::value_type const &x){ + if ( i >= static_cast<std::vector< int,std::allocator< int > >::difference_type>( self->size()) ) + swig::resize( self, i+1, x ); + else + *(swig::getpos(self, i)) = x; + + return swig::from< std::vector< int,std::allocator< int > >::value_type >( x ); + } +SWIGINTERN VALUE std_vector_Sl_int_Sg____setitem____SWIG_1(std::vector< int > *self,std::vector< int >::difference_type i,std::vector< int >::difference_type length,std::vector< int,std::allocator< int > > const &v){ + + if ( length < 0 ) + return Qnil; + std::size_t len = self->size(); + if ( i < 0 ) { + if ( i + static_cast<std::vector< int,std::allocator< int > >::difference_type>(len) < 0 ) + return Qnil; + else + i = len + i; + } + std::vector< int,std::allocator< int > >::difference_type j = length + i; + if ( j > static_cast<std::vector< int,std::allocator< int > >::difference_type>(len) ) { + swig::resize( self, j, *(v.begin()) ); + } + + VALUE r = Qnil; + swig::setslice(self, i, j, v); + r = swig::from< const std::vector< int,std::allocator< int > >* >( &v ); + return r; + } +SWIGINTERN std::vector< int,std::allocator< int > > *std_vector_Sl_int_Sg__reject_bang(std::vector< int > *self){ + if ( !rb_block_given_p() ) + rb_raise( rb_eArgError, "no block given" ); + + self->erase( std::remove_if( self->begin(), self->end(), + swig::yield< std::vector< int,std::allocator< int > >::value_type >() ), self->end() ); + return self; + } +SWIGINTERN VALUE std_vector_Sl_int_Sg__pop(std::vector< int > *self){ + if (self->empty()) return Qnil; + std::vector< int,std::allocator< int > >::value_type x = self->back(); + self->pop_back(); + return swig::from< std::vector< int,std::allocator< int > >::value_type >( x ); + } +SWIGINTERN std::vector< int >::value_type const std_vector_Sl_int_Sg__push(std::vector< int > *self,std::vector< int >::value_type const &e){ + self->push_back( e ); + return e; + } +SWIGINTERN std::vector< int,std::allocator< int > > *std_vector_Sl_int_Sg__reject(std::vector< int > *self){ + if ( !rb_block_given_p() ) + rb_raise( rb_eArgError, "no block given" ); + + std::vector< int,std::allocator< int > >* r = new std::vector< int,std::allocator< int > >(); + std::remove_copy_if( self->begin(), self->end(), + std::back_inserter(*r), + swig::yield< std::vector< int,std::allocator< int > >::value_type >() ); + return r; + } +SWIGINTERN VALUE std_vector_Sl_int_Sg__shift(std::vector< int > *self){ + if (self->empty()) return Qnil; + std::vector< int,std::allocator< int > >::value_type x = self->front(); + self->erase( self->begin() ); + return swig::from< std::vector< int,std::allocator< int > >::value_type >( x ); + } +SWIGINTERN std::vector< int,std::allocator< int > > *std_vector_Sl_int_Sg__insert__SWIG_0(std::vector< int > *self,std::vector< int >::difference_type pos,int argc,VALUE *argv,...){ + std::size_t len = self->size(); + std::size_t i = swig::check_index( pos, len, true ); + std::vector< int,std::allocator< int > >::iterator start; + + VALUE elem = argv[0]; + int idx = 0; + try { + std::vector< int,std::allocator< int > >::value_type val = swig::as<std::vector< int,std::allocator< int > >::value_type>( elem ); + if ( i >= len ) { + self->resize(i-1, val); + return self; + } + start = self->begin(); + std::advance( start, i ); + self->insert( start++, val ); + + for ( ++idx; idx < argc; ++idx ) + { + elem = argv[idx]; + val = swig::as<std::vector< int,std::allocator< int > >::value_type>( elem ); + self->insert( start++, val ); + } + + } + catch(const std::invalid_argument &) + { + rb_raise( rb_eArgError, "%s", + Ruby_Format_TypeError( "", + swig::type_name<std::vector< int,std::allocator< int > >::value_type>(), + __FUNCTION__, idx+2, elem )); + } + + + return self; + } +SWIGINTERN std::vector< int,std::allocator< int > > *std_vector_Sl_int_Sg__unshift(std::vector< int > *self,int argc,VALUE *argv,...){ + for ( int idx = argc-1; idx >= 0; --idx ) + { + std::vector< int,std::allocator< int > >::iterator start = self->begin(); + VALUE elem = argv[idx]; + try { + std::vector< int,std::allocator< int > >::value_type val = swig::as<std::vector< int,std::allocator< int > >::value_type>( elem ); + self->insert( start, val ); + } + catch(const std::invalid_argument &) + { + rb_raise( rb_eArgError, "%s", + Ruby_Format_TypeError( "", + swig::type_name<std::vector< int,std::allocator< int > >::value_type>(), + __FUNCTION__, idx+2, elem )); + } + } + + return self; + } + +SWIGINTERNINLINE VALUE +SWIG_From_unsigned_SS_long (unsigned long value) +{ + return ULONG2NUM(value); +} + + +#ifdef SWIG_LONG_LONG_AVAILABLE +SWIGINTERNINLINE VALUE +SWIG_From_unsigned_SS_long_SS_long (unsigned long long value) +{ + return ULL2NUM(value); +} +#endif + + +SWIGINTERNINLINE VALUE +SWIG_From_size_t (size_t value) +{ +#ifdef SWIG_LONG_LONG_AVAILABLE + if (sizeof(size_t) <= sizeof(unsigned long)) { +#endif + return SWIG_From_unsigned_SS_long (static_cast< unsigned long >(value)); +#ifdef SWIG_LONG_LONG_AVAILABLE + } else { + /* assume sizeof(size_t) <= sizeof(unsigned long long) */ + return SWIG_From_unsigned_SS_long_SS_long (static_cast< unsigned long long >(value)); + } +#endif +} + +SWIGINTERN std::vector< int >::iterator std_vector_Sl_int_Sg__erase__SWIG_0(std::vector< int > *self,std::vector< int >::iterator pos){ return self->erase(pos); } +SWIGINTERN std::vector< int >::iterator std_vector_Sl_int_Sg__erase__SWIG_1(std::vector< int > *self,std::vector< int >::iterator first,std::vector< int >::iterator last){ return self->erase(first, last); } +SWIGINTERN std::vector< int >::iterator std_vector_Sl_int_Sg__insert__SWIG_1(std::vector< int > *self,std::vector< int >::iterator pos,std::vector< int >::value_type const &x){ return self->insert(pos, x); } +SWIGINTERN void std_vector_Sl_int_Sg__insert__SWIG_2(std::vector< int > *self,std::vector< int >::iterator pos,std::vector< int >::size_type n,std::vector< int >::value_type const &x){ self->insert(pos, n, x); } +SWIGINTERN std::vector< int,std::allocator< int > > *std_vector_Sl_int_Sg__map_bang(std::vector< int > *self){ + + if ( !rb_block_given_p() ) + rb_raise( rb_eArgError, "No block given" ); + + VALUE r = Qnil; + std::vector< int >::iterator i = self->begin(); + std::vector< int >::iterator e = self->end(); + + try { + for ( ; i != e; ++i ) + { + r = swig::from< int >( *i ); + r = rb_yield( r ); + *i = swig::as< int >( r ); + } + } + catch (const std::invalid_argument&) + { + rb_raise(rb_eTypeError, + "Yield block did not return a valid element for " "std::vector"); + } + + return self; + } +SWIGINTERN VALUE std_vector_Sl_int_Sg____delete__(std::vector< int > *self,int const &val){ + VALUE r = Qnil; + std::vector<int >::iterator e = self->end(); + std::vector<int >::iterator i = std::remove( self->begin(), e, val ); + // remove dangling elements now + self->erase( i, e ); + + if ( i != e ) + r = swig::from< int >( val ); + else if ( rb_block_given_p() ) + r = rb_yield(Qnil); + return r; + } + +/*@SWIG:/usr/share/swig4.0/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/ +SWIGINTERN VALUE SWIG_AUX_NUM2DBL(VALUE arg) +{ + VALUE *args = (VALUE *)arg; + VALUE obj = args[0]; + VALUE type = TYPE(obj); + double *res = (double *)(args[1]); + *res = NUM2DBL(obj); (void)type; + return obj; +} +/*@SWIG@*/ + +SWIGINTERN int +SWIG_AsVal_double (VALUE obj, double *val) +{ + VALUE type = TYPE(obj); + if ((type == T_FLOAT) || (type == T_FIXNUM) || (type == T_BIGNUM)) { + double v; + VALUE a[2]; + a[0] = obj; + a[1] = (VALUE)(&v); + if (rb_rescue(VALUEFUNC(SWIG_AUX_NUM2DBL), (VALUE)a, VALUEFUNC(SWIG_ruby_failed), 0) != Qnil) { + if (val) *val = v; + return SWIG_OK; + } + } + return SWIG_TypeError; +} + + + #define SWIG_From_double rb_float_new + + +namespace swig { + template <> struct traits< double > { + typedef value_category category; + static const char* type_name() { return"double"; } + }; + template <> struct traits_asval< double > { + typedef double value_type; + static int asval(VALUE obj, value_type *val) { + return SWIG_AsVal_double (obj, val); + } + }; + template <> struct traits_from< double > { + typedef double value_type; + static VALUE from(const value_type& val) { + return SWIG_From_double (val); + } + }; +} + + + namespace swig { + template <> struct traits<std::vector< double, std::allocator< double > > > { + typedef pointer_category category; + static const char* type_name() { + return "std::vector<" "double" "," "std::allocator< double >" " >"; + } + }; + } + +SWIGINTERN std::vector< double,std::allocator< double > > *std_vector_Sl_double_Sg__dup(std::vector< double > *self){ + return new std::vector< double,std::allocator< double > >(*self); + } +SWIGINTERN VALUE std_vector_Sl_double_Sg__inspect(std::vector< double > *self){ + std::vector< double,std::allocator< double > >::const_iterator i = self->begin(); + std::vector< double,std::allocator< double > >::const_iterator e = self->end(); + const char *type_name = swig::type_name< std::vector< double,std::allocator< double > > >(); + VALUE str = rb_str_new2(type_name); + str = rb_str_cat2( str, " [" ); + bool comma = false; + VALUE tmp; + for ( ; i != e; ++i, comma = true ) + { + if (comma) str = rb_str_cat2( str, "," ); + tmp = swig::from< std::vector< double,std::allocator< double > >::value_type >( *i ); + tmp = rb_inspect( tmp ); + str = rb_str_buf_append( str, tmp ); + } + str = rb_str_cat2( str, "]" ); + return str; + } +SWIGINTERN VALUE std_vector_Sl_double_Sg__to_a(std::vector< double > *self){ + std::vector< double,std::allocator< double > >::const_iterator i = self->begin(); + std::vector< double,std::allocator< double > >::const_iterator e = self->end(); + VALUE ary = rb_ary_new2( std::distance( i, e ) ); + VALUE tmp; + for ( ; i != e; ++i ) + { + tmp = swig::from< std::vector< double,std::allocator< double > >::value_type >( *i ); + rb_ary_push( ary, tmp ); + } + return ary; + } +SWIGINTERN VALUE std_vector_Sl_double_Sg__to_s(std::vector< double > *self){ + std::vector< double,std::allocator< double > >::iterator i = self->begin(); + std::vector< double,std::allocator< double > >::iterator e = self->end(); + VALUE str = rb_str_new2( "" ); + VALUE tmp; + for ( ; i != e; ++i ) + { + tmp = swig::from< std::vector< double,std::allocator< double > >::value_type >( *i ); + tmp = rb_obj_as_string( tmp ); + str = rb_str_buf_append( str, tmp ); + } + return str; + } +SWIGINTERN VALUE std_vector_Sl_double_Sg__slice(std::vector< double > *self,std::vector< double >::difference_type i,std::vector< double >::difference_type length){ + if ( length < 0 ) + return Qnil; + std::size_t len = self->size(); + if ( i < 0 ) { + if ( i + static_cast<std::vector< double,std::allocator< double > >::difference_type>(len) < 0 ) + return Qnil; + else + i = len + i; + } + std::vector< double,std::allocator< double > >::difference_type j = length + i; + if ( j > static_cast<std::vector< double,std::allocator< double > >::difference_type>(len) ) + j = len; + + VALUE r = Qnil; + try { + r = swig::from< const std::vector< double,std::allocator< double > >* >( swig::getslice(self, i, j) ); + } + catch( const std::out_of_range& ) { + } + return r; + } +SWIGINTERN std::vector< double,std::allocator< double > > *std_vector_Sl_double_Sg__each(std::vector< double > *self){ + if ( !rb_block_given_p() ) + rb_raise( rb_eArgError, "no block given"); + + VALUE r; + std::vector< double,std::allocator< double > >::const_iterator i = self->begin(); + std::vector< double,std::allocator< double > >::const_iterator e = self->end(); + for ( ; i != e; ++i ) + { + r = swig::from< std::vector< double,std::allocator< double > >::value_type >(*i); + rb_yield(r); + } + + return self; + } +SWIGINTERN VALUE std_vector_Sl_double_Sg____delete2__(std::vector< double > *self,std::vector< double >::value_type const &i){ + VALUE r = Qnil; + return r; + } +SWIGINTERN std::vector< double,std::allocator< double > > *std_vector_Sl_double_Sg__select(std::vector< double > *self){ + if ( !rb_block_given_p() ) + rb_raise( rb_eArgError, "no block given" ); + + std::vector< double,std::allocator< double > >* r = new std::vector< double,std::allocator< double > >(); + std::vector< double,std::allocator< double > >::const_iterator i = self->begin(); + std::vector< double,std::allocator< double > >::const_iterator e = self->end(); + for ( ; i != e; ++i ) + { + VALUE v = swig::from< std::vector< double,std::allocator< double > >::value_type >(*i); + if ( RTEST( rb_yield(v) ) ) + self->insert( r->end(), *i); + } + + return r; + } +SWIGINTERN VALUE std_vector_Sl_double_Sg__delete_at(std::vector< double > *self,std::vector< double >::difference_type i){ + VALUE r = Qnil; + try { + std::vector< double,std::allocator< double > >::iterator at = swig::getpos(self, i); + r = swig::from< std::vector< double,std::allocator< double > >::value_type >( *(at) ); + self->erase(at); + } + catch (const std::out_of_range&) { + } + return r; + } +SWIGINTERN VALUE std_vector_Sl_double_Sg__at(std::vector< double > const *self,std::vector< double >::difference_type i){ + VALUE r = Qnil; + try { + r = swig::from< std::vector< double,std::allocator< double > >::value_type >( *(swig::cgetpos(self, i)) ); + } + catch( const std::out_of_range& ) { + } + return r; + } +SWIGINTERN VALUE std_vector_Sl_double_Sg____getitem____SWIG_0(std::vector< double > const *self,std::vector< double >::difference_type i,std::vector< double >::difference_type length){ + if ( length < 0 ) + return Qnil; + std::size_t len = self->size(); + if ( i < 0 ) { + if ( i + static_cast<std::vector< double,std::allocator< double > >::difference_type>(len) < 0 ) + return Qnil; + else + i = len + i; + } + std::vector< double,std::allocator< double > >::difference_type j = length + i; + if ( j > static_cast<std::vector< double,std::allocator< double > >::difference_type>(len) ) + j = len; + + VALUE r = Qnil; + try { + r = swig::from< const std::vector< double,std::allocator< double > >* >( swig::getslice(self, i, j) ); + } + catch( const std::out_of_range& ) { + } + return r; + } +SWIGINTERN VALUE std_vector_Sl_double_Sg____getitem____SWIG_1(std::vector< double > const *self,std::vector< double >::difference_type i){ + VALUE r = Qnil; + try { + r = swig::from< std::vector< double,std::allocator< double > >::value_type >( *(swig::cgetpos(self, i)) ); + } + catch( const std::out_of_range& ) { + } + return r; + } +SWIGINTERN VALUE std_vector_Sl_double_Sg____getitem____SWIG_2(std::vector< double > const *self,VALUE i){ + if ( rb_obj_is_kind_of( i, rb_cRange ) == Qfalse ) { + rb_raise( rb_eTypeError, "not a valid index or range" ); + } + + static ID id_end = rb_intern("end"); + static ID id_start = rb_intern("begin"); + static ID id_noend = rb_intern("exclude_end?"); + + VALUE start = rb_funcall( i, id_start, 0 ); + VALUE end = rb_funcall( i, id_end, 0 ); + bool noend = ( rb_funcall( i, id_noend, 0 ) == Qtrue ); + + int len = self->size(); + + int s = NUM2INT( start ); + if ( s < 0 ) { + s = len + s; + if ( s < 0 ) + return Qnil; + } else if ( s > len ) + return Qnil; + + int e = NUM2INT( end ); + if ( e < 0 ) e = len + e; + if ( noend ) e -= 1; + if ( e < 0 ) e = -1; + if ( e >= len ) e = len - 1; + if ( s == len ) e = len - 1; + + return swig::from< std::vector< double,std::allocator< double > >* >( swig::getslice(self, s, e+1) ); + } +SWIGINTERN VALUE std_vector_Sl_double_Sg____setitem____SWIG_0(std::vector< double > *self,std::vector< double >::difference_type i,std::vector< double >::value_type const &x){ + if ( i >= static_cast<std::vector< double,std::allocator< double > >::difference_type>( self->size()) ) + swig::resize( self, i+1, x ); + else + *(swig::getpos(self, i)) = x; + + return swig::from< std::vector< double,std::allocator< double > >::value_type >( x ); + } +SWIGINTERN VALUE std_vector_Sl_double_Sg____setitem____SWIG_1(std::vector< double > *self,std::vector< double >::difference_type i,std::vector< double >::difference_type length,std::vector< double,std::allocator< double > > const &v){ + + if ( length < 0 ) + return Qnil; + std::size_t len = self->size(); + if ( i < 0 ) { + if ( i + static_cast<std::vector< double,std::allocator< double > >::difference_type>(len) < 0 ) + return Qnil; + else + i = len + i; + } + std::vector< double,std::allocator< double > >::difference_type j = length + i; + if ( j > static_cast<std::vector< double,std::allocator< double > >::difference_type>(len) ) { + swig::resize( self, j, *(v.begin()) ); + } + + VALUE r = Qnil; + swig::setslice(self, i, j, v); + r = swig::from< const std::vector< double,std::allocator< double > >* >( &v ); + return r; + } +SWIGINTERN std::vector< double,std::allocator< double > > *std_vector_Sl_double_Sg__reject_bang(std::vector< double > *self){ + if ( !rb_block_given_p() ) + rb_raise( rb_eArgError, "no block given" ); + + self->erase( std::remove_if( self->begin(), self->end(), + swig::yield< std::vector< double,std::allocator< double > >::value_type >() ), self->end() ); + return self; + } +SWIGINTERN VALUE std_vector_Sl_double_Sg__pop(std::vector< double > *self){ + if (self->empty()) return Qnil; + std::vector< double,std::allocator< double > >::value_type x = self->back(); + self->pop_back(); + return swig::from< std::vector< double,std::allocator< double > >::value_type >( x ); + } +SWIGINTERN std::vector< double >::value_type const std_vector_Sl_double_Sg__push(std::vector< double > *self,std::vector< double >::value_type const &e){ + self->push_back( e ); + return e; + } +SWIGINTERN std::vector< double,std::allocator< double > > *std_vector_Sl_double_Sg__reject(std::vector< double > *self){ + if ( !rb_block_given_p() ) + rb_raise( rb_eArgError, "no block given" ); + + std::vector< double,std::allocator< double > >* r = new std::vector< double,std::allocator< double > >(); + std::remove_copy_if( self->begin(), self->end(), + std::back_inserter(*r), + swig::yield< std::vector< double,std::allocator< double > >::value_type >() ); + return r; + } +SWIGINTERN VALUE std_vector_Sl_double_Sg__shift(std::vector< double > *self){ + if (self->empty()) return Qnil; + std::vector< double,std::allocator< double > >::value_type x = self->front(); + self->erase( self->begin() ); + return swig::from< std::vector< double,std::allocator< double > >::value_type >( x ); + } +SWIGINTERN std::vector< double,std::allocator< double > > *std_vector_Sl_double_Sg__insert__SWIG_0(std::vector< double > *self,std::vector< double >::difference_type pos,int argc,VALUE *argv,...){ + std::size_t len = self->size(); + std::size_t i = swig::check_index( pos, len, true ); + std::vector< double,std::allocator< double > >::iterator start; + + VALUE elem = argv[0]; + int idx = 0; + try { + std::vector< double,std::allocator< double > >::value_type val = swig::as<std::vector< double,std::allocator< double > >::value_type>( elem ); + if ( i >= len ) { + self->resize(i-1, val); + return self; + } + start = self->begin(); + std::advance( start, i ); + self->insert( start++, val ); + + for ( ++idx; idx < argc; ++idx ) + { + elem = argv[idx]; + val = swig::as<std::vector< double,std::allocator< double > >::value_type>( elem ); + self->insert( start++, val ); + } + + } + catch(const std::invalid_argument &) + { + rb_raise( rb_eArgError, "%s", + Ruby_Format_TypeError( "", + swig::type_name<std::vector< double,std::allocator< double > >::value_type>(), + __FUNCTION__, idx+2, elem )); + } + + + return self; + } +SWIGINTERN std::vector< double,std::allocator< double > > *std_vector_Sl_double_Sg__unshift(std::vector< double > *self,int argc,VALUE *argv,...){ + for ( int idx = argc-1; idx >= 0; --idx ) + { + std::vector< double,std::allocator< double > >::iterator start = self->begin(); + VALUE elem = argv[idx]; + try { + std::vector< double,std::allocator< double > >::value_type val = swig::as<std::vector< double,std::allocator< double > >::value_type>( elem ); + self->insert( start, val ); + } + catch(const std::invalid_argument &) + { + rb_raise( rb_eArgError, "%s", + Ruby_Format_TypeError( "", + swig::type_name<std::vector< double,std::allocator< double > >::value_type>(), + __FUNCTION__, idx+2, elem )); + } + } + + return self; + } +SWIGINTERN std::vector< double >::iterator std_vector_Sl_double_Sg__erase__SWIG_0(std::vector< double > *self,std::vector< double >::iterator pos){ return self->erase(pos); } +SWIGINTERN std::vector< double >::iterator std_vector_Sl_double_Sg__erase__SWIG_1(std::vector< double > *self,std::vector< double >::iterator first,std::vector< double >::iterator last){ return self->erase(first, last); } +SWIGINTERN std::vector< double >::iterator std_vector_Sl_double_Sg__insert__SWIG_1(std::vector< double > *self,std::vector< double >::iterator pos,std::vector< double >::value_type const &x){ return self->insert(pos, x); } +SWIGINTERN void std_vector_Sl_double_Sg__insert__SWIG_2(std::vector< double > *self,std::vector< double >::iterator pos,std::vector< double >::size_type n,std::vector< double >::value_type const &x){ self->insert(pos, n, x); } +SWIGINTERN std::vector< double,std::allocator< double > > *std_vector_Sl_double_Sg__map_bang(std::vector< double > *self){ + + if ( !rb_block_given_p() ) + rb_raise( rb_eArgError, "No block given" ); + + VALUE r = Qnil; + std::vector< double >::iterator i = self->begin(); + std::vector< double >::iterator e = self->end(); + + try { + for ( ; i != e; ++i ) + { + r = swig::from< double >( *i ); + r = rb_yield( r ); + *i = swig::as< double >( r ); + } + } + catch (const std::invalid_argument&) + { + rb_raise(rb_eTypeError, + "Yield block did not return a valid element for " "std::vector"); + } + + return self; + } +SWIGINTERN VALUE std_vector_Sl_double_Sg____delete__(std::vector< double > *self,double const &val){ + VALUE r = Qnil; + std::vector<double >::iterator e = self->end(); + std::vector<double >::iterator i = std::remove( self->begin(), e, val ); + // remove dangling elements now + self->erase( i, e ); + + if ( i != e ) + r = swig::from< double >( val ); + else if ( rb_block_given_p() ) + r = rb_yield(Qnil); + return r; + } + + namespace swig { + template <> struct traits<std::vector< std::vector< double,std::allocator< double > >, std::allocator< std::vector< double,std::allocator< double > > > > > { + typedef pointer_category category; + static const char* type_name() { + return "std::vector<" "std::vector< double,std::allocator< double > >" "," "std::allocator< std::vector< double,std::allocator< double > > >" " >"; + } + }; + } + +SWIGINTERN std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *std_vector_Sl_std_vector_Sl_double_Sg__Sg__dup(std::vector< std::vector< double > > *self){ + return new std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >(*self); + } +SWIGINTERN VALUE std_vector_Sl_std_vector_Sl_double_Sg__Sg__inspect(std::vector< std::vector< double > > *self){ + std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >::const_iterator i = self->begin(); + std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >::const_iterator e = self->end(); + const char *type_name = swig::type_name< std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > >(); + VALUE str = rb_str_new2(type_name); + str = rb_str_cat2( str, " [" ); + bool comma = false; + VALUE tmp; + for ( ; i != e; ++i, comma = true ) + { + if (comma) str = rb_str_cat2( str, "," ); + tmp = swig::from< std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >::value_type >( *i ); + tmp = rb_inspect( tmp ); + str = rb_str_buf_append( str, tmp ); + } + str = rb_str_cat2( str, "]" ); + return str; + } +SWIGINTERN VALUE std_vector_Sl_std_vector_Sl_double_Sg__Sg__to_a(std::vector< std::vector< double > > *self){ + std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >::const_iterator i = self->begin(); + std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >::const_iterator e = self->end(); + VALUE ary = rb_ary_new2( std::distance( i, e ) ); + VALUE tmp; + for ( ; i != e; ++i ) + { + tmp = swig::from< std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >::value_type >( *i ); + rb_ary_push( ary, tmp ); + } + return ary; + } +SWIGINTERN VALUE std_vector_Sl_std_vector_Sl_double_Sg__Sg__to_s(std::vector< std::vector< double > > *self){ + std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >::iterator i = self->begin(); + std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >::iterator e = self->end(); + VALUE str = rb_str_new2( "" ); + VALUE tmp; + for ( ; i != e; ++i ) + { + tmp = swig::from< std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >::value_type >( *i ); + tmp = rb_obj_as_string( tmp ); + str = rb_str_buf_append( str, tmp ); + } + return str; + } +SWIGINTERN VALUE std_vector_Sl_std_vector_Sl_double_Sg__Sg__slice(std::vector< std::vector< double > > *self,std::vector< std::vector< double > >::difference_type i,std::vector< std::vector< double > >::difference_type length){ + if ( length < 0 ) + return Qnil; + std::size_t len = self->size(); + if ( i < 0 ) { + if ( i + static_cast<std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >::difference_type>(len) < 0 ) + return Qnil; + else + i = len + i; + } + std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >::difference_type j = length + i; + if ( j > static_cast<std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >::difference_type>(len) ) + j = len; + + VALUE r = Qnil; + try { + r = swig::from< const std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >* >( swig::getslice(self, i, j) ); + } + catch( const std::out_of_range& ) { + } + return r; + } +SWIGINTERN std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *std_vector_Sl_std_vector_Sl_double_Sg__Sg__each(std::vector< std::vector< double > > *self){ + if ( !rb_block_given_p() ) + rb_raise( rb_eArgError, "no block given"); + + VALUE r; + std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >::const_iterator i = self->begin(); + std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >::const_iterator e = self->end(); + for ( ; i != e; ++i ) + { + r = swig::from< std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >::value_type >(*i); + rb_yield(r); + } + + return self; + } +SWIGINTERN VALUE std_vector_Sl_std_vector_Sl_double_Sg__Sg____delete2__(std::vector< std::vector< double > > *self,std::vector< std::vector< double > >::value_type const &i){ + VALUE r = Qnil; + return r; + } +SWIGINTERN std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *std_vector_Sl_std_vector_Sl_double_Sg__Sg__select(std::vector< std::vector< double > > *self){ + if ( !rb_block_given_p() ) + rb_raise( rb_eArgError, "no block given" ); + + std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >* r = new std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >(); + std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >::const_iterator i = self->begin(); + std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >::const_iterator e = self->end(); + for ( ; i != e; ++i ) + { + VALUE v = swig::from< std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >::value_type >(*i); + if ( RTEST( rb_yield(v) ) ) + self->insert( r->end(), *i); + } + + return r; + } +SWIGINTERN VALUE std_vector_Sl_std_vector_Sl_double_Sg__Sg__delete_at(std::vector< std::vector< double > > *self,std::vector< std::vector< double > >::difference_type i){ + VALUE r = Qnil; + try { + std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >::iterator at = swig::getpos(self, i); + r = swig::from< std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >::value_type >( *(at) ); + self->erase(at); + } + catch (const std::out_of_range&) { + } + return r; + } +SWIGINTERN VALUE std_vector_Sl_std_vector_Sl_double_Sg__Sg__at(std::vector< std::vector< double > > const *self,std::vector< std::vector< double > >::difference_type i){ + VALUE r = Qnil; + try { + r = swig::from< std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >::value_type >( *(swig::cgetpos(self, i)) ); + } + catch( const std::out_of_range& ) { + } + return r; + } +SWIGINTERN VALUE std_vector_Sl_std_vector_Sl_double_Sg__Sg____getitem____SWIG_0(std::vector< std::vector< double > > const *self,std::vector< std::vector< double > >::difference_type i,std::vector< std::vector< double > >::difference_type length){ + if ( length < 0 ) + return Qnil; + std::size_t len = self->size(); + if ( i < 0 ) { + if ( i + static_cast<std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >::difference_type>(len) < 0 ) + return Qnil; + else + i = len + i; + } + std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >::difference_type j = length + i; + if ( j > static_cast<std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >::difference_type>(len) ) + j = len; + + VALUE r = Qnil; + try { + r = swig::from< const std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >* >( swig::getslice(self, i, j) ); + } + catch( const std::out_of_range& ) { + } + return r; + } +SWIGINTERN VALUE std_vector_Sl_std_vector_Sl_double_Sg__Sg____getitem____SWIG_1(std::vector< std::vector< double > > const *self,std::vector< std::vector< double > >::difference_type i){ + VALUE r = Qnil; + try { + r = swig::from< std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >::value_type >( *(swig::cgetpos(self, i)) ); + } + catch( const std::out_of_range& ) { + } + return r; + } +SWIGINTERN VALUE std_vector_Sl_std_vector_Sl_double_Sg__Sg____getitem____SWIG_2(std::vector< std::vector< double > > const *self,VALUE i){ + if ( rb_obj_is_kind_of( i, rb_cRange ) == Qfalse ) { + rb_raise( rb_eTypeError, "not a valid index or range" ); + } + + static ID id_end = rb_intern("end"); + static ID id_start = rb_intern("begin"); + static ID id_noend = rb_intern("exclude_end?"); + + VALUE start = rb_funcall( i, id_start, 0 ); + VALUE end = rb_funcall( i, id_end, 0 ); + bool noend = ( rb_funcall( i, id_noend, 0 ) == Qtrue ); + + int len = self->size(); + + int s = NUM2INT( start ); + if ( s < 0 ) { + s = len + s; + if ( s < 0 ) + return Qnil; + } else if ( s > len ) + return Qnil; + + int e = NUM2INT( end ); + if ( e < 0 ) e = len + e; + if ( noend ) e -= 1; + if ( e < 0 ) e = -1; + if ( e >= len ) e = len - 1; + if ( s == len ) e = len - 1; + + return swig::from< std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >* >( swig::getslice(self, s, e+1) ); + } +SWIGINTERN VALUE std_vector_Sl_std_vector_Sl_double_Sg__Sg____setitem____SWIG_0(std::vector< std::vector< double > > *self,std::vector< std::vector< double > >::difference_type i,std::vector< std::vector< double > >::value_type const &x){ + if ( i >= static_cast<std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >::difference_type>( self->size()) ) + swig::resize( self, i+1, x ); + else + *(swig::getpos(self, i)) = x; + + return swig::from< std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >::value_type >( x ); + } +SWIGINTERN VALUE std_vector_Sl_std_vector_Sl_double_Sg__Sg____setitem____SWIG_1(std::vector< std::vector< double > > *self,std::vector< std::vector< double > >::difference_type i,std::vector< std::vector< double > >::difference_type length,std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > const &v){ + + if ( length < 0 ) + return Qnil; + std::size_t len = self->size(); + if ( i < 0 ) { + if ( i + static_cast<std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >::difference_type>(len) < 0 ) + return Qnil; + else + i = len + i; + } + std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >::difference_type j = length + i; + if ( j > static_cast<std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >::difference_type>(len) ) { + swig::resize( self, j, *(v.begin()) ); + } + + VALUE r = Qnil; + swig::setslice(self, i, j, v); + r = swig::from< const std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >* >( &v ); + return r; + } +SWIGINTERN std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *std_vector_Sl_std_vector_Sl_double_Sg__Sg__reject_bang(std::vector< std::vector< double > > *self){ + if ( !rb_block_given_p() ) + rb_raise( rb_eArgError, "no block given" ); + + self->erase( std::remove_if( self->begin(), self->end(), + swig::yield< std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >::value_type >() ), self->end() ); + return self; + } +SWIGINTERN VALUE std_vector_Sl_std_vector_Sl_double_Sg__Sg__pop(std::vector< std::vector< double > > *self){ + if (self->empty()) return Qnil; + std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >::value_type x = self->back(); + self->pop_back(); + return swig::from< std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >::value_type >( x ); + } +SWIGINTERN std::vector< std::vector< double > >::value_type const std_vector_Sl_std_vector_Sl_double_Sg__Sg__push(std::vector< std::vector< double > > *self,std::vector< std::vector< double > >::value_type const &e){ + self->push_back( e ); + return e; + } +SWIGINTERN std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *std_vector_Sl_std_vector_Sl_double_Sg__Sg__reject(std::vector< std::vector< double > > *self){ + if ( !rb_block_given_p() ) + rb_raise( rb_eArgError, "no block given" ); + + std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >* r = new std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >(); + std::remove_copy_if( self->begin(), self->end(), + std::back_inserter(*r), + swig::yield< std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >::value_type >() ); + return r; + } +SWIGINTERN VALUE std_vector_Sl_std_vector_Sl_double_Sg__Sg__shift(std::vector< std::vector< double > > *self){ + if (self->empty()) return Qnil; + std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >::value_type x = self->front(); + self->erase( self->begin() ); + return swig::from< std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >::value_type >( x ); + } +SWIGINTERN std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *std_vector_Sl_std_vector_Sl_double_Sg__Sg__insert__SWIG_0(std::vector< std::vector< double > > *self,std::vector< std::vector< double > >::difference_type pos,int argc,VALUE *argv,...){ + std::size_t len = self->size(); + std::size_t i = swig::check_index( pos, len, true ); + std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >::iterator start; + + VALUE elem = argv[0]; + int idx = 0; + try { + std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >::value_type val = swig::as<std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >::value_type>( elem ); + if ( i >= len ) { + self->resize(i-1, val); + return self; + } + start = self->begin(); + std::advance( start, i ); + self->insert( start++, val ); + + for ( ++idx; idx < argc; ++idx ) + { + elem = argv[idx]; + val = swig::as<std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >::value_type>( elem ); + self->insert( start++, val ); + } + + } + catch(const std::invalid_argument &) + { + rb_raise( rb_eArgError, "%s", + Ruby_Format_TypeError( "", + swig::type_name<std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >::value_type>(), + __FUNCTION__, idx+2, elem )); + } + + + return self; + } +SWIGINTERN std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *std_vector_Sl_std_vector_Sl_double_Sg__Sg__unshift(std::vector< std::vector< double > > *self,int argc,VALUE *argv,...){ + for ( int idx = argc-1; idx >= 0; --idx ) + { + std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >::iterator start = self->begin(); + VALUE elem = argv[idx]; + try { + std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >::value_type val = swig::as<std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >::value_type>( elem ); + self->insert( start, val ); + } + catch(const std::invalid_argument &) + { + rb_raise( rb_eArgError, "%s", + Ruby_Format_TypeError( "", + swig::type_name<std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >::value_type>(), + __FUNCTION__, idx+2, elem )); + } + } + + return self; + } +SWIGINTERN std::vector< std::vector< double > >::iterator std_vector_Sl_std_vector_Sl_double_Sg__Sg__erase__SWIG_0(std::vector< std::vector< double > > *self,std::vector< std::vector< double > >::iterator pos){ return self->erase(pos); } +SWIGINTERN std::vector< std::vector< double > >::iterator std_vector_Sl_std_vector_Sl_double_Sg__Sg__erase__SWIG_1(std::vector< std::vector< double > > *self,std::vector< std::vector< double > >::iterator first,std::vector< std::vector< double > >::iterator last){ return self->erase(first, last); } +SWIGINTERN std::vector< std::vector< double > >::iterator std_vector_Sl_std_vector_Sl_double_Sg__Sg__insert__SWIG_1(std::vector< std::vector< double > > *self,std::vector< std::vector< double > >::iterator pos,std::vector< std::vector< double > >::value_type const &x){ return self->insert(pos, x); } +SWIGINTERN void std_vector_Sl_std_vector_Sl_double_Sg__Sg__insert__SWIG_2(std::vector< std::vector< double > > *self,std::vector< std::vector< double > >::iterator pos,std::vector< std::vector< double > >::size_type n,std::vector< std::vector< double > >::value_type const &x){ self->insert(pos, n, x); } + +SWIGINTERN swig_type_info* +SWIG_pchar_descriptor(void) +{ + static int init = 0; + static swig_type_info* info = 0; + if (!init) { + info = SWIG_TypeQuery("_p_char"); + init = 1; + } + return info; +} + + +SWIGINTERN int +SWIG_AsCharPtrAndSize(VALUE obj, char** cptr, size_t* psize, int *alloc) +{ + if (TYPE(obj) == T_STRING) { + char *cstr = StringValuePtr(obj); + size_t size = RSTRING_LEN(obj) + 1; + if (cptr) { + if (alloc) { + if (*alloc == SWIG_NEWOBJ) { + *cptr = reinterpret_cast< char* >(memcpy(new char[size], cstr, sizeof(char)*(size))); + } else { + *cptr = cstr; + *alloc = SWIG_OLDOBJ; + } + } + } + if (psize) *psize = size; + return SWIG_OK; + } else { + swig_type_info* pchar_descriptor = SWIG_pchar_descriptor(); + if (pchar_descriptor) { + void* vptr = 0; + if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) { + if (cptr) *cptr = (char *)vptr; + if (psize) *psize = vptr ? (strlen((char*)vptr) + 1) : 0; + if (alloc) *alloc = SWIG_OLDOBJ; + return SWIG_OK; + } + } + } + return SWIG_TypeError; +} + + +SWIGINTERN int +SWIG_AsPtr_std_string (VALUE obj, std::string **val) +{ + char* buf = 0 ; size_t size = 0; int alloc = SWIG_OLDOBJ; + if (SWIG_IsOK((SWIG_AsCharPtrAndSize(obj, &buf, &size, &alloc)))) { + if (buf) { + if (val) *val = new std::string(buf, size - 1); + if (alloc == SWIG_NEWOBJ) delete[] buf; + return SWIG_NEWOBJ; + } else { + if (val) *val = 0; + return SWIG_OLDOBJ; + } + } else { + static int init = 0; + static swig_type_info* descriptor = 0; + if (!init) { + descriptor = SWIG_TypeQuery("std::string" " *"); + init = 1; + } + if (descriptor) { + std::string *vptr; + int res = SWIG_ConvertPtr(obj, (void**)&vptr, descriptor, 0); + if (SWIG_IsOK(res) && val) *val = vptr; + return res; + } + } + return SWIG_ERROR; +} + + +SWIGINTERN int +SWIG_AsVal_std_string (VALUE obj, std::string *val) +{ + std::string* v = (std::string *) 0; + int res = SWIG_AsPtr_std_string (obj, &v); + if (!SWIG_IsOK(res)) return res; + if (v) { + if (val) *val = *v; + if (SWIG_IsNewObj(res)) { + delete v; + res = SWIG_DelNewMask(res); + } + return res; + } + return SWIG_ERROR; +} + + +SWIGINTERNINLINE VALUE +SWIG_FromCharPtrAndSize(const char* carray, size_t size) +{ + if (carray) { + if (size > LONG_MAX) { + swig_type_info* pchar_descriptor = SWIG_pchar_descriptor(); + return pchar_descriptor ? + SWIG_NewPointerObj(const_cast< char * >(carray), pchar_descriptor, 0) : Qnil; + } else { + return rb_str_new(carray, static_cast< long >(size)); + } + } else { + return Qnil; + } +} + + +SWIGINTERNINLINE VALUE +SWIG_From_std_string (const std::string& s) +{ + return SWIG_FromCharPtrAndSize(s.data(), s.size()); +} + + +namespace swig { + template <> struct traits< std::string > { + typedef value_category category; + static const char* type_name() { return"std::string"; } + }; + template <> struct traits_asval< std::string > { + typedef std::string value_type; + static int asval(VALUE obj, value_type *val) { + return SWIG_AsVal_std_string (obj, val); + } + }; + template <> struct traits_from< std::string > { + typedef std::string value_type; + static VALUE from(const value_type& val) { + return SWIG_From_std_string (val); + } + }; +} + + + namespace swig { + template <> struct traits<std::vector< std::string, std::allocator< std::string > > > { + typedef pointer_category category; + static const char* type_name() { + return "std::vector<" "std::string" "," "std::allocator< std::string >" " >"; + } + }; + } + +SWIGINTERN std::vector< std::string,std::allocator< std::string > > *std_vector_Sl_std_string_Sg__dup(std::vector< std::string > *self){ + return new std::vector< std::string,std::allocator< std::string > >(*self); + } +SWIGINTERN VALUE std_vector_Sl_std_string_Sg__inspect(std::vector< std::string > *self){ + std::vector< std::string,std::allocator< std::string > >::const_iterator i = self->begin(); + std::vector< std::string,std::allocator< std::string > >::const_iterator e = self->end(); + const char *type_name = swig::type_name< std::vector< std::string,std::allocator< std::string > > >(); + VALUE str = rb_str_new2(type_name); + str = rb_str_cat2( str, " [" ); + bool comma = false; + VALUE tmp; + for ( ; i != e; ++i, comma = true ) + { + if (comma) str = rb_str_cat2( str, "," ); + tmp = swig::from< std::vector< std::string,std::allocator< std::string > >::value_type >( *i ); + tmp = rb_inspect( tmp ); + str = rb_str_buf_append( str, tmp ); + } + str = rb_str_cat2( str, "]" ); + return str; + } +SWIGINTERN VALUE std_vector_Sl_std_string_Sg__to_a(std::vector< std::string > *self){ + std::vector< std::string,std::allocator< std::string > >::const_iterator i = self->begin(); + std::vector< std::string,std::allocator< std::string > >::const_iterator e = self->end(); + VALUE ary = rb_ary_new2( std::distance( i, e ) ); + VALUE tmp; + for ( ; i != e; ++i ) + { + tmp = swig::from< std::vector< std::string,std::allocator< std::string > >::value_type >( *i ); + rb_ary_push( ary, tmp ); + } + return ary; + } +SWIGINTERN VALUE std_vector_Sl_std_string_Sg__to_s(std::vector< std::string > *self){ + std::vector< std::string,std::allocator< std::string > >::iterator i = self->begin(); + std::vector< std::string,std::allocator< std::string > >::iterator e = self->end(); + VALUE str = rb_str_new2( "" ); + VALUE tmp; + for ( ; i != e; ++i ) + { + tmp = swig::from< std::vector< std::string,std::allocator< std::string > >::value_type >( *i ); + tmp = rb_obj_as_string( tmp ); + str = rb_str_buf_append( str, tmp ); + } + return str; + } +SWIGINTERN VALUE std_vector_Sl_std_string_Sg__slice(std::vector< std::string > *self,std::vector< std::string >::difference_type i,std::vector< std::string >::difference_type length){ + if ( length < 0 ) + return Qnil; + std::size_t len = self->size(); + if ( i < 0 ) { + if ( i + static_cast<std::vector< std::string,std::allocator< std::string > >::difference_type>(len) < 0 ) + return Qnil; + else + i = len + i; + } + std::vector< std::string,std::allocator< std::string > >::difference_type j = length + i; + if ( j > static_cast<std::vector< std::string,std::allocator< std::string > >::difference_type>(len) ) + j = len; + + VALUE r = Qnil; + try { + r = swig::from< const std::vector< std::string,std::allocator< std::string > >* >( swig::getslice(self, i, j) ); + } + catch( const std::out_of_range& ) { + } + return r; + } +SWIGINTERN std::vector< std::string,std::allocator< std::string > > *std_vector_Sl_std_string_Sg__each(std::vector< std::string > *self){ + if ( !rb_block_given_p() ) + rb_raise( rb_eArgError, "no block given"); + + VALUE r; + std::vector< std::string,std::allocator< std::string > >::const_iterator i = self->begin(); + std::vector< std::string,std::allocator< std::string > >::const_iterator e = self->end(); + for ( ; i != e; ++i ) + { + r = swig::from< std::vector< std::string,std::allocator< std::string > >::value_type >(*i); + rb_yield(r); + } + + return self; + } +SWIGINTERN VALUE std_vector_Sl_std_string_Sg____delete2__(std::vector< std::string > *self,std::vector< std::string >::value_type const &i){ + VALUE r = Qnil; + return r; + } +SWIGINTERN std::vector< std::string,std::allocator< std::string > > *std_vector_Sl_std_string_Sg__select(std::vector< std::string > *self){ + if ( !rb_block_given_p() ) + rb_raise( rb_eArgError, "no block given" ); + + std::vector< std::string,std::allocator< std::string > >* r = new std::vector< std::string,std::allocator< std::string > >(); + std::vector< std::string,std::allocator< std::string > >::const_iterator i = self->begin(); + std::vector< std::string,std::allocator< std::string > >::const_iterator e = self->end(); + for ( ; i != e; ++i ) + { + VALUE v = swig::from< std::vector< std::string,std::allocator< std::string > >::value_type >(*i); + if ( RTEST( rb_yield(v) ) ) + self->insert( r->end(), *i); + } + + return r; + } +SWIGINTERN VALUE std_vector_Sl_std_string_Sg__delete_at(std::vector< std::string > *self,std::vector< std::string >::difference_type i){ + VALUE r = Qnil; + try { + std::vector< std::string,std::allocator< std::string > >::iterator at = swig::getpos(self, i); + r = swig::from< std::vector< std::string,std::allocator< std::string > >::value_type >( *(at) ); + self->erase(at); + } + catch (const std::out_of_range&) { + } + return r; + } +SWIGINTERN VALUE std_vector_Sl_std_string_Sg__at(std::vector< std::string > const *self,std::vector< std::string >::difference_type i){ + VALUE r = Qnil; + try { + r = swig::from< std::vector< std::string,std::allocator< std::string > >::value_type >( *(swig::cgetpos(self, i)) ); + } + catch( const std::out_of_range& ) { + } + return r; + } +SWIGINTERN VALUE std_vector_Sl_std_string_Sg____getitem____SWIG_0(std::vector< std::string > const *self,std::vector< std::string >::difference_type i,std::vector< std::string >::difference_type length){ + if ( length < 0 ) + return Qnil; + std::size_t len = self->size(); + if ( i < 0 ) { + if ( i + static_cast<std::vector< std::string,std::allocator< std::string > >::difference_type>(len) < 0 ) + return Qnil; + else + i = len + i; + } + std::vector< std::string,std::allocator< std::string > >::difference_type j = length + i; + if ( j > static_cast<std::vector< std::string,std::allocator< std::string > >::difference_type>(len) ) + j = len; + + VALUE r = Qnil; + try { + r = swig::from< const std::vector< std::string,std::allocator< std::string > >* >( swig::getslice(self, i, j) ); + } + catch( const std::out_of_range& ) { + } + return r; + } +SWIGINTERN VALUE std_vector_Sl_std_string_Sg____getitem____SWIG_1(std::vector< std::string > const *self,std::vector< std::string >::difference_type i){ + VALUE r = Qnil; + try { + r = swig::from< std::vector< std::string,std::allocator< std::string > >::value_type >( *(swig::cgetpos(self, i)) ); + } + catch( const std::out_of_range& ) { + } + return r; + } +SWIGINTERN VALUE std_vector_Sl_std_string_Sg____getitem____SWIG_2(std::vector< std::string > const *self,VALUE i){ + if ( rb_obj_is_kind_of( i, rb_cRange ) == Qfalse ) { + rb_raise( rb_eTypeError, "not a valid index or range" ); + } + + static ID id_end = rb_intern("end"); + static ID id_start = rb_intern("begin"); + static ID id_noend = rb_intern("exclude_end?"); + + VALUE start = rb_funcall( i, id_start, 0 ); + VALUE end = rb_funcall( i, id_end, 0 ); + bool noend = ( rb_funcall( i, id_noend, 0 ) == Qtrue ); + + int len = self->size(); + + int s = NUM2INT( start ); + if ( s < 0 ) { + s = len + s; + if ( s < 0 ) + return Qnil; + } else if ( s > len ) + return Qnil; + + int e = NUM2INT( end ); + if ( e < 0 ) e = len + e; + if ( noend ) e -= 1; + if ( e < 0 ) e = -1; + if ( e >= len ) e = len - 1; + if ( s == len ) e = len - 1; + + return swig::from< std::vector< std::string,std::allocator< std::string > >* >( swig::getslice(self, s, e+1) ); + } +SWIGINTERN VALUE std_vector_Sl_std_string_Sg____setitem____SWIG_0(std::vector< std::string > *self,std::vector< std::string >::difference_type i,std::vector< std::string >::value_type const &x){ + if ( i >= static_cast<std::vector< std::string,std::allocator< std::string > >::difference_type>( self->size()) ) + swig::resize( self, i+1, x ); + else + *(swig::getpos(self, i)) = x; + + return swig::from< std::vector< std::string,std::allocator< std::string > >::value_type >( x ); + } +SWIGINTERN VALUE std_vector_Sl_std_string_Sg____setitem____SWIG_1(std::vector< std::string > *self,std::vector< std::string >::difference_type i,std::vector< std::string >::difference_type length,std::vector< std::string,std::allocator< std::string > > const &v){ + + if ( length < 0 ) + return Qnil; + std::size_t len = self->size(); + if ( i < 0 ) { + if ( i + static_cast<std::vector< std::string,std::allocator< std::string > >::difference_type>(len) < 0 ) + return Qnil; + else + i = len + i; + } + std::vector< std::string,std::allocator< std::string > >::difference_type j = length + i; + if ( j > static_cast<std::vector< std::string,std::allocator< std::string > >::difference_type>(len) ) { + swig::resize( self, j, *(v.begin()) ); + } + + VALUE r = Qnil; + swig::setslice(self, i, j, v); + r = swig::from< const std::vector< std::string,std::allocator< std::string > >* >( &v ); + return r; + } +SWIGINTERN std::vector< std::string,std::allocator< std::string > > *std_vector_Sl_std_string_Sg__reject_bang(std::vector< std::string > *self){ + if ( !rb_block_given_p() ) + rb_raise( rb_eArgError, "no block given" ); + + self->erase( std::remove_if( self->begin(), self->end(), + swig::yield< std::vector< std::string,std::allocator< std::string > >::value_type >() ), self->end() ); + return self; + } +SWIGINTERN VALUE std_vector_Sl_std_string_Sg__pop(std::vector< std::string > *self){ + if (self->empty()) return Qnil; + std::vector< std::string,std::allocator< std::string > >::value_type x = self->back(); + self->pop_back(); + return swig::from< std::vector< std::string,std::allocator< std::string > >::value_type >( x ); + } +SWIGINTERN std::vector< std::string >::value_type const std_vector_Sl_std_string_Sg__push(std::vector< std::string > *self,std::vector< std::string >::value_type const &e){ + self->push_back( e ); + return e; + } +SWIGINTERN std::vector< std::string,std::allocator< std::string > > *std_vector_Sl_std_string_Sg__reject(std::vector< std::string > *self){ + if ( !rb_block_given_p() ) + rb_raise( rb_eArgError, "no block given" ); + + std::vector< std::string,std::allocator< std::string > >* r = new std::vector< std::string,std::allocator< std::string > >(); + std::remove_copy_if( self->begin(), self->end(), + std::back_inserter(*r), + swig::yield< std::vector< std::string,std::allocator< std::string > >::value_type >() ); + return r; + } +SWIGINTERN VALUE std_vector_Sl_std_string_Sg__shift(std::vector< std::string > *self){ + if (self->empty()) return Qnil; + std::vector< std::string,std::allocator< std::string > >::value_type x = self->front(); + self->erase( self->begin() ); + return swig::from< std::vector< std::string,std::allocator< std::string > >::value_type >( x ); + } +SWIGINTERN std::vector< std::string,std::allocator< std::string > > *std_vector_Sl_std_string_Sg__insert__SWIG_0(std::vector< std::string > *self,std::vector< std::string >::difference_type pos,int argc,VALUE *argv,...){ + std::size_t len = self->size(); + std::size_t i = swig::check_index( pos, len, true ); + std::vector< std::string,std::allocator< std::string > >::iterator start; + + VALUE elem = argv[0]; + int idx = 0; + try { + std::vector< std::string,std::allocator< std::string > >::value_type val = swig::as<std::vector< std::string,std::allocator< std::string > >::value_type>( elem ); + if ( i >= len ) { + self->resize(i-1, val); + return self; + } + start = self->begin(); + std::advance( start, i ); + self->insert( start++, val ); + + for ( ++idx; idx < argc; ++idx ) + { + elem = argv[idx]; + val = swig::as<std::vector< std::string,std::allocator< std::string > >::value_type>( elem ); + self->insert( start++, val ); + } + + } + catch(const std::invalid_argument &) + { + rb_raise( rb_eArgError, "%s", + Ruby_Format_TypeError( "", + swig::type_name<std::vector< std::string,std::allocator< std::string > >::value_type>(), + __FUNCTION__, idx+2, elem )); + } + + + return self; + } +SWIGINTERN std::vector< std::string,std::allocator< std::string > > *std_vector_Sl_std_string_Sg__unshift(std::vector< std::string > *self,int argc,VALUE *argv,...){ + for ( int idx = argc-1; idx >= 0; --idx ) + { + std::vector< std::string,std::allocator< std::string > >::iterator start = self->begin(); + VALUE elem = argv[idx]; + try { + std::vector< std::string,std::allocator< std::string > >::value_type val = swig::as<std::vector< std::string,std::allocator< std::string > >::value_type>( elem ); + self->insert( start, val ); + } + catch(const std::invalid_argument &) + { + rb_raise( rb_eArgError, "%s", + Ruby_Format_TypeError( "", + swig::type_name<std::vector< std::string,std::allocator< std::string > >::value_type>(), + __FUNCTION__, idx+2, elem )); + } + } + + return self; + } +SWIGINTERN std::vector< std::string >::iterator std_vector_Sl_std_string_Sg__erase__SWIG_0(std::vector< std::string > *self,std::vector< std::string >::iterator pos){ return self->erase(pos); } +SWIGINTERN std::vector< std::string >::iterator std_vector_Sl_std_string_Sg__erase__SWIG_1(std::vector< std::string > *self,std::vector< std::string >::iterator first,std::vector< std::string >::iterator last){ return self->erase(first, last); } +SWIGINTERN std::vector< std::string >::iterator std_vector_Sl_std_string_Sg__insert__SWIG_1(std::vector< std::string > *self,std::vector< std::string >::iterator pos,std::vector< std::string >::value_type const &x){ return self->insert(pos, x); } +SWIGINTERN void std_vector_Sl_std_string_Sg__insert__SWIG_2(std::vector< std::string > *self,std::vector< std::string >::iterator pos,std::vector< std::string >::size_type n,std::vector< std::string >::value_type const &x){ self->insert(pos, n, x); } +SWIGINTERN std::vector< std::string,std::allocator< std::string > > *std_vector_Sl_std_string_Sg__map_bang(std::vector< std::string > *self){ + + if ( !rb_block_given_p() ) + rb_raise( rb_eArgError, "No block given" ); + + VALUE r = Qnil; + std::vector< std::string >::iterator i = self->begin(); + std::vector< std::string >::iterator e = self->end(); + + try { + for ( ; i != e; ++i ) + { + r = swig::from< std::string >( *i ); + r = rb_yield( r ); + *i = swig::as< std::string >( r ); + } + } + catch (const std::invalid_argument&) + { + rb_raise(rb_eTypeError, + "Yield block did not return a valid element for " "std::vector"); + } + + return self; + } +SWIGINTERN VALUE std_vector_Sl_std_string_Sg____delete__(std::vector< std::string > *self,std::string const &val){ + VALUE r = Qnil; + std::vector<std::string >::iterator e = self->end(); + std::vector<std::string >::iterator i = std::remove( self->begin(), e, val ); + // remove dangling elements now + self->erase( i, e ); + + if ( i != e ) + r = swig::from< std::string >( val ); + else if ( rb_block_given_p() ) + r = rb_yield(Qnil); + return r; + } + + namespace swig { + template <> struct traits< CdiVariable > { + typedef pointer_category category; + static const char* type_name() { return"CdiVariable"; } + }; + } + + + namespace swig { + template <> struct traits<std::vector< CdiVariable, std::allocator< CdiVariable > > > { + typedef pointer_category category; + static const char* type_name() { + return "std::vector<" "CdiVariable" "," "std::allocator< CdiVariable >" " >"; + } + }; + } + +SWIGINTERN std::vector< CdiVariable,std::allocator< CdiVariable > > *std_vector_Sl_CdiVariable_Sg__dup(std::vector< CdiVariable > *self){ + return new std::vector< CdiVariable,std::allocator< CdiVariable > >(*self); + } +SWIGINTERN VALUE std_vector_Sl_CdiVariable_Sg__inspect(std::vector< CdiVariable > *self){ + std::vector< CdiVariable,std::allocator< CdiVariable > >::const_iterator i = self->begin(); + std::vector< CdiVariable,std::allocator< CdiVariable > >::const_iterator e = self->end(); + const char *type_name = swig::type_name< std::vector< CdiVariable,std::allocator< CdiVariable > > >(); + VALUE str = rb_str_new2(type_name); + str = rb_str_cat2( str, " [" ); + bool comma = false; + VALUE tmp; + for ( ; i != e; ++i, comma = true ) + { + if (comma) str = rb_str_cat2( str, "," ); + tmp = swig::from< std::vector< CdiVariable,std::allocator< CdiVariable > >::value_type >( *i ); + tmp = rb_inspect( tmp ); + str = rb_str_buf_append( str, tmp ); + } + str = rb_str_cat2( str, "]" ); + return str; + } +SWIGINTERN VALUE std_vector_Sl_CdiVariable_Sg__to_a(std::vector< CdiVariable > *self){ + std::vector< CdiVariable,std::allocator< CdiVariable > >::const_iterator i = self->begin(); + std::vector< CdiVariable,std::allocator< CdiVariable > >::const_iterator e = self->end(); + VALUE ary = rb_ary_new2( std::distance( i, e ) ); + VALUE tmp; + for ( ; i != e; ++i ) + { + tmp = swig::from< std::vector< CdiVariable,std::allocator< CdiVariable > >::value_type >( *i ); + rb_ary_push( ary, tmp ); + } + return ary; + } +SWIGINTERN VALUE std_vector_Sl_CdiVariable_Sg__to_s(std::vector< CdiVariable > *self){ + std::vector< CdiVariable,std::allocator< CdiVariable > >::iterator i = self->begin(); + std::vector< CdiVariable,std::allocator< CdiVariable > >::iterator e = self->end(); + VALUE str = rb_str_new2( "" ); + VALUE tmp; + for ( ; i != e; ++i ) + { + tmp = swig::from< std::vector< CdiVariable,std::allocator< CdiVariable > >::value_type >( *i ); + tmp = rb_obj_as_string( tmp ); + str = rb_str_buf_append( str, tmp ); + } + return str; + } +SWIGINTERN VALUE std_vector_Sl_CdiVariable_Sg__slice(std::vector< CdiVariable > *self,std::vector< CdiVariable >::difference_type i,std::vector< CdiVariable >::difference_type length){ + if ( length < 0 ) + return Qnil; + std::size_t len = self->size(); + if ( i < 0 ) { + if ( i + static_cast<std::vector< CdiVariable,std::allocator< CdiVariable > >::difference_type>(len) < 0 ) + return Qnil; + else + i = len + i; + } + std::vector< CdiVariable,std::allocator< CdiVariable > >::difference_type j = length + i; + if ( j > static_cast<std::vector< CdiVariable,std::allocator< CdiVariable > >::difference_type>(len) ) + j = len; + + VALUE r = Qnil; + try { + r = swig::from< const std::vector< CdiVariable,std::allocator< CdiVariable > >* >( swig::getslice(self, i, j) ); + } + catch( const std::out_of_range& ) { + } + return r; + } +SWIGINTERN std::vector< CdiVariable,std::allocator< CdiVariable > > *std_vector_Sl_CdiVariable_Sg__each(std::vector< CdiVariable > *self){ + if ( !rb_block_given_p() ) + rb_raise( rb_eArgError, "no block given"); + + VALUE r; + std::vector< CdiVariable,std::allocator< CdiVariable > >::const_iterator i = self->begin(); + std::vector< CdiVariable,std::allocator< CdiVariable > >::const_iterator e = self->end(); + for ( ; i != e; ++i ) + { + r = swig::from< std::vector< CdiVariable,std::allocator< CdiVariable > >::value_type >(*i); + rb_yield(r); + } + + return self; + } +SWIGINTERN VALUE std_vector_Sl_CdiVariable_Sg____delete2__(std::vector< CdiVariable > *self,std::vector< CdiVariable >::value_type const &i){ + VALUE r = Qnil; + return r; + } +SWIGINTERN std::vector< CdiVariable,std::allocator< CdiVariable > > *std_vector_Sl_CdiVariable_Sg__select(std::vector< CdiVariable > *self){ + if ( !rb_block_given_p() ) + rb_raise( rb_eArgError, "no block given" ); + + std::vector< CdiVariable,std::allocator< CdiVariable > >* r = new std::vector< CdiVariable,std::allocator< CdiVariable > >(); + std::vector< CdiVariable,std::allocator< CdiVariable > >::const_iterator i = self->begin(); + std::vector< CdiVariable,std::allocator< CdiVariable > >::const_iterator e = self->end(); + for ( ; i != e; ++i ) + { + VALUE v = swig::from< std::vector< CdiVariable,std::allocator< CdiVariable > >::value_type >(*i); + if ( RTEST( rb_yield(v) ) ) + self->insert( r->end(), *i); + } + + return r; + } +SWIGINTERN VALUE std_vector_Sl_CdiVariable_Sg__delete_at(std::vector< CdiVariable > *self,std::vector< CdiVariable >::difference_type i){ + VALUE r = Qnil; + try { + std::vector< CdiVariable,std::allocator< CdiVariable > >::iterator at = swig::getpos(self, i); + r = swig::from< std::vector< CdiVariable,std::allocator< CdiVariable > >::value_type >( *(at) ); + self->erase(at); + } + catch (const std::out_of_range&) { + } + return r; + } +SWIGINTERN VALUE std_vector_Sl_CdiVariable_Sg__at(std::vector< CdiVariable > const *self,std::vector< CdiVariable >::difference_type i){ + VALUE r = Qnil; + try { + r = swig::from< std::vector< CdiVariable,std::allocator< CdiVariable > >::value_type >( *(swig::cgetpos(self, i)) ); + } + catch( const std::out_of_range& ) { + } + return r; + } +SWIGINTERN VALUE std_vector_Sl_CdiVariable_Sg____getitem____SWIG_0(std::vector< CdiVariable > const *self,std::vector< CdiVariable >::difference_type i,std::vector< CdiVariable >::difference_type length){ + if ( length < 0 ) + return Qnil; + std::size_t len = self->size(); + if ( i < 0 ) { + if ( i + static_cast<std::vector< CdiVariable,std::allocator< CdiVariable > >::difference_type>(len) < 0 ) + return Qnil; + else + i = len + i; + } + std::vector< CdiVariable,std::allocator< CdiVariable > >::difference_type j = length + i; + if ( j > static_cast<std::vector< CdiVariable,std::allocator< CdiVariable > >::difference_type>(len) ) + j = len; + + VALUE r = Qnil; + try { + r = swig::from< const std::vector< CdiVariable,std::allocator< CdiVariable > >* >( swig::getslice(self, i, j) ); + } + catch( const std::out_of_range& ) { + } + return r; + } +SWIGINTERN VALUE std_vector_Sl_CdiVariable_Sg____getitem____SWIG_1(std::vector< CdiVariable > const *self,std::vector< CdiVariable >::difference_type i){ + VALUE r = Qnil; + try { + r = swig::from< std::vector< CdiVariable,std::allocator< CdiVariable > >::value_type >( *(swig::cgetpos(self, i)) ); + } + catch( const std::out_of_range& ) { + } + return r; + } +SWIGINTERN VALUE std_vector_Sl_CdiVariable_Sg____getitem____SWIG_2(std::vector< CdiVariable > const *self,VALUE i){ + if ( rb_obj_is_kind_of( i, rb_cRange ) == Qfalse ) { + rb_raise( rb_eTypeError, "not a valid index or range" ); + } + + static ID id_end = rb_intern("end"); + static ID id_start = rb_intern("begin"); + static ID id_noend = rb_intern("exclude_end?"); + + VALUE start = rb_funcall( i, id_start, 0 ); + VALUE end = rb_funcall( i, id_end, 0 ); + bool noend = ( rb_funcall( i, id_noend, 0 ) == Qtrue ); + + int len = self->size(); + + int s = NUM2INT( start ); + if ( s < 0 ) { + s = len + s; + if ( s < 0 ) + return Qnil; + } else if ( s > len ) + return Qnil; + + int e = NUM2INT( end ); + if ( e < 0 ) e = len + e; + if ( noend ) e -= 1; + if ( e < 0 ) e = -1; + if ( e >= len ) e = len - 1; + if ( s == len ) e = len - 1; + + return swig::from< std::vector< CdiVariable,std::allocator< CdiVariable > >* >( swig::getslice(self, s, e+1) ); + } +SWIGINTERN VALUE std_vector_Sl_CdiVariable_Sg____setitem____SWIG_0(std::vector< CdiVariable > *self,std::vector< CdiVariable >::difference_type i,std::vector< CdiVariable >::value_type const &x){ + if ( i >= static_cast<std::vector< CdiVariable,std::allocator< CdiVariable > >::difference_type>( self->size()) ) + swig::resize( self, i+1, x ); + else + *(swig::getpos(self, i)) = x; + + return swig::from< std::vector< CdiVariable,std::allocator< CdiVariable > >::value_type >( x ); + } +SWIGINTERN VALUE std_vector_Sl_CdiVariable_Sg____setitem____SWIG_1(std::vector< CdiVariable > *self,std::vector< CdiVariable >::difference_type i,std::vector< CdiVariable >::difference_type length,std::vector< CdiVariable,std::allocator< CdiVariable > > const &v){ + + if ( length < 0 ) + return Qnil; + std::size_t len = self->size(); + if ( i < 0 ) { + if ( i + static_cast<std::vector< CdiVariable,std::allocator< CdiVariable > >::difference_type>(len) < 0 ) + return Qnil; + else + i = len + i; + } + std::vector< CdiVariable,std::allocator< CdiVariable > >::difference_type j = length + i; + if ( j > static_cast<std::vector< CdiVariable,std::allocator< CdiVariable > >::difference_type>(len) ) { + swig::resize( self, j, *(v.begin()) ); + } + + VALUE r = Qnil; + swig::setslice(self, i, j, v); + r = swig::from< const std::vector< CdiVariable,std::allocator< CdiVariable > >* >( &v ); + return r; + } +SWIGINTERN std::vector< CdiVariable,std::allocator< CdiVariable > > *std_vector_Sl_CdiVariable_Sg__reject_bang(std::vector< CdiVariable > *self){ + if ( !rb_block_given_p() ) + rb_raise( rb_eArgError, "no block given" ); + + self->erase( std::remove_if( self->begin(), self->end(), + swig::yield< std::vector< CdiVariable,std::allocator< CdiVariable > >::value_type >() ), self->end() ); + return self; + } +SWIGINTERN VALUE std_vector_Sl_CdiVariable_Sg__pop(std::vector< CdiVariable > *self){ + if (self->empty()) return Qnil; + std::vector< CdiVariable,std::allocator< CdiVariable > >::value_type x = self->back(); + self->pop_back(); + return swig::from< std::vector< CdiVariable,std::allocator< CdiVariable > >::value_type >( x ); + } +SWIGINTERN std::vector< CdiVariable >::value_type const std_vector_Sl_CdiVariable_Sg__push(std::vector< CdiVariable > *self,std::vector< CdiVariable >::value_type const &e){ + self->push_back( e ); + return e; + } +SWIGINTERN std::vector< CdiVariable,std::allocator< CdiVariable > > *std_vector_Sl_CdiVariable_Sg__reject(std::vector< CdiVariable > *self){ + if ( !rb_block_given_p() ) + rb_raise( rb_eArgError, "no block given" ); + + std::vector< CdiVariable,std::allocator< CdiVariable > >* r = new std::vector< CdiVariable,std::allocator< CdiVariable > >(); + std::remove_copy_if( self->begin(), self->end(), + std::back_inserter(*r), + swig::yield< std::vector< CdiVariable,std::allocator< CdiVariable > >::value_type >() ); + return r; + } +SWIGINTERN VALUE std_vector_Sl_CdiVariable_Sg__shift(std::vector< CdiVariable > *self){ + if (self->empty()) return Qnil; + std::vector< CdiVariable,std::allocator< CdiVariable > >::value_type x = self->front(); + self->erase( self->begin() ); + return swig::from< std::vector< CdiVariable,std::allocator< CdiVariable > >::value_type >( x ); + } +SWIGINTERN std::vector< CdiVariable,std::allocator< CdiVariable > > *std_vector_Sl_CdiVariable_Sg__insert__SWIG_0(std::vector< CdiVariable > *self,std::vector< CdiVariable >::difference_type pos,int argc,VALUE *argv,...){ + std::size_t len = self->size(); + std::size_t i = swig::check_index( pos, len, true ); + std::vector< CdiVariable,std::allocator< CdiVariable > >::iterator start; + + VALUE elem = argv[0]; + int idx = 0; + try { + std::vector< CdiVariable,std::allocator< CdiVariable > >::value_type val = swig::as<std::vector< CdiVariable,std::allocator< CdiVariable > >::value_type>( elem ); + if ( i >= len ) { + self->resize(i-1, val); + return self; + } + start = self->begin(); + std::advance( start, i ); + self->insert( start++, val ); + + for ( ++idx; idx < argc; ++idx ) + { + elem = argv[idx]; + val = swig::as<std::vector< CdiVariable,std::allocator< CdiVariable > >::value_type>( elem ); + self->insert( start++, val ); + } + + } + catch(const std::invalid_argument &) + { + rb_raise( rb_eArgError, "%s", + Ruby_Format_TypeError( "", + swig::type_name<std::vector< CdiVariable,std::allocator< CdiVariable > >::value_type>(), + __FUNCTION__, idx+2, elem )); + } + + + return self; + } +SWIGINTERN std::vector< CdiVariable,std::allocator< CdiVariable > > *std_vector_Sl_CdiVariable_Sg__unshift(std::vector< CdiVariable > *self,int argc,VALUE *argv,...){ + for ( int idx = argc-1; idx >= 0; --idx ) + { + std::vector< CdiVariable,std::allocator< CdiVariable > >::iterator start = self->begin(); + VALUE elem = argv[idx]; + try { + std::vector< CdiVariable,std::allocator< CdiVariable > >::value_type val = swig::as<std::vector< CdiVariable,std::allocator< CdiVariable > >::value_type>( elem ); + self->insert( start, val ); + } + catch(const std::invalid_argument &) + { + rb_raise( rb_eArgError, "%s", + Ruby_Format_TypeError( "", + swig::type_name<std::vector< CdiVariable,std::allocator< CdiVariable > >::value_type>(), + __FUNCTION__, idx+2, elem )); + } + } + + return self; + } +SWIGINTERN std::vector< CdiVariable >::iterator std_vector_Sl_CdiVariable_Sg__erase__SWIG_0(std::vector< CdiVariable > *self,std::vector< CdiVariable >::iterator pos){ return self->erase(pos); } +SWIGINTERN std::vector< CdiVariable >::iterator std_vector_Sl_CdiVariable_Sg__erase__SWIG_1(std::vector< CdiVariable > *self,std::vector< CdiVariable >::iterator first,std::vector< CdiVariable >::iterator last){ return self->erase(first, last); } +SWIGINTERN std::vector< CdiVariable >::iterator std_vector_Sl_CdiVariable_Sg__insert__SWIG_1(std::vector< CdiVariable > *self,std::vector< CdiVariable >::iterator pos,std::vector< CdiVariable >::value_type const &x){ return self->insert(pos, x); } +SWIGINTERN void std_vector_Sl_CdiVariable_Sg__insert__SWIG_2(std::vector< CdiVariable > *self,std::vector< CdiVariable >::iterator pos,std::vector< CdiVariable >::size_type n,std::vector< CdiVariable >::value_type const &x){ self->insert(pos, n, x); } + + namespace swig { + + template <class T, class U > + struct traits_asval<std::pair<T,U> > { + typedef std::pair<T,U> value_type; + + static int get_pair(VALUE first, VALUE second, + std::pair<T,U> *val) + { + if (val) { + T *pfirst = &(val->first); + int res1 = swig::asval((VALUE)first, pfirst); + if (!SWIG_IsOK(res1)) return res1; + U *psecond = &(val->second); + int res2 = swig::asval((VALUE)second, psecond); + if (!SWIG_IsOK(res2)) return res2; + return res1 > res2 ? res1 : res2; + } else { + T *pfirst = 0; + int res1 = swig::asval((VALUE)first, pfirst); + if (!SWIG_IsOK(res1)) return res1; + U *psecond = 0; + int res2 = swig::asval((VALUE)second, psecond); + if (!SWIG_IsOK(res2)) return res2; + return res1 > res2 ? res1 : res2; + } + } + + static int asval(VALUE obj, std::pair<T,U> *val) { + int res = SWIG_ERROR; + if ( TYPE(obj) == T_ARRAY ) { + if (RARRAY_LEN(obj) == 2) { + VALUE first = rb_ary_entry(obj,0); + VALUE second = rb_ary_entry(obj,1); + res = get_pair(first, second, val); + } + } else { + value_type *p; + swig_type_info *descriptor = swig::type_info<value_type>(); + res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR; + if (SWIG_IsOK(res) && val) *val = *p; + } + return res; + } + }; + + template <class T, class U > + struct traits_asptr<std::pair<T,U> > { + typedef std::pair<T,U> value_type; + + static int get_pair(VALUE first, VALUE second, + std::pair<T,U> **val) + { + if (val) { + value_type *vp = (new std::pair<T,U>()); + T *pfirst = &(vp->first); + int res1 = swig::asval((VALUE)first, pfirst); + if (!SWIG_IsOK(res1)) { + delete vp; + return res1; + } + U *psecond = &(vp->second); + int res2 = swig::asval((VALUE)second, psecond); + if (!SWIG_IsOK(res2)) { + delete vp; + return res2; + } + *val = vp; + return SWIG_AddNewMask(res1 > res2 ? res1 : res2); + } else { + T *pfirst = 0; + int res1 = swig::asval((VALUE)first, pfirst); + if (!SWIG_IsOK(res1)) return res1; + U *psecond = 0; + int res2 = swig::asval((VALUE)second, psecond); + if (!SWIG_IsOK(res2)) return res2; + return res1 > res2 ? res1 : res2; + } + } + + static int asptr(VALUE obj, std::pair<T,U> **val) { + int res = SWIG_ERROR; + if ( TYPE(obj) == T_ARRAY ) { + if ( RARRAY_LEN(obj) == 2) { + VALUE first = rb_ary_entry(obj,0); + VALUE second = rb_ary_entry(obj,1); + res = get_pair(first, second, val); + } + } else { + value_type *p; + swig_type_info *descriptor = swig::type_info<value_type>(); + res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR; + if (SWIG_IsOK(res) && val) *val = p; + } + return res; + } + }; + + + + template <class T, class U > + struct traits_from<std::pair<T,U> > { + static VALUE _wrap_pair_second( VALUE self ) + { + std::pair< typename swig::noconst_traits<T >::noconst_type,U>* p = NULL; + swig::asptr( self, &p ); + return swig::from( p->second ); + } + + static VALUE _wrap_pair_second_eq( VALUE self, VALUE arg ) + { + std::pair< typename swig::noconst_traits<T >::noconst_type,U>* p = NULL; + swig::asptr( self, &p ); + return swig::from( p->second ); + } + + static VALUE from(const std::pair<T,U>& val) { + VALUE obj = rb_ary_new2(2); + rb_ary_push(obj, swig::from<typename swig::noconst_traits<T >::noconst_type>(val.first)); + rb_ary_push(obj, swig::from(val.second)); + rb_define_singleton_method(obj, "second", + VALUEFUNC(_wrap_pair_second), 0 ); + rb_define_singleton_method(obj, "second=", + VALUEFUNC(_wrap_pair_second_eq), 1 ); + rb_obj_freeze(obj); // treat as immutable tuple + return obj; + } + }; + + } + + + namespace swig { + template <> struct traits<std::pair< std::string, CdiVariable > > { + typedef pointer_category category; + static const char* type_name() { + return "std::pair<" "std::string" "," "CdiVariable" " >"; + } + }; + } + + + namespace swig { + template <class ValueType> + struct from_key_oper + { + typedef const ValueType& argument_type; + typedef VALUE result_type; + result_type operator()(argument_type v) const + { + return swig::from(v.first); + } + }; + + template <class ValueType> + struct from_value_oper + { + typedef const ValueType& argument_type; + typedef VALUE result_type; + result_type operator()(argument_type v) const + { + return swig::from(v.second); + } + }; + + template<class OutIterator, class FromOper, + class ValueType = typename OutIterator::value_type> + struct MapIterator_T : ConstIteratorClosed_T<OutIterator, ValueType, FromOper> + { + MapIterator_T(OutIterator curr, OutIterator first, OutIterator last, VALUE seq) + : ConstIteratorClosed_T<OutIterator,ValueType,FromOper>(curr, first, last, seq) + { + } + }; + + + template<class OutIterator, + class FromOper = from_key_oper<typename OutIterator::value_type> > + struct MapKeyIterator_T : MapIterator_T<OutIterator, FromOper> + { + MapKeyIterator_T(OutIterator curr, OutIterator first, OutIterator last, VALUE seq) + : MapIterator_T<OutIterator, FromOper>(curr, first, last, seq) + { + } + }; + + template<typename OutIter> + inline ConstIterator* + make_output_key_iterator(const OutIter& current, const OutIter& begin, + const OutIter& end, VALUE seq = 0) + { + return new MapKeyIterator_T<OutIter>(current, begin, end, seq); + } + + template<class OutIterator, + class FromOper = from_value_oper<typename OutIterator::value_type> > + struct MapValueIterator_T : MapIterator_T<OutIterator, FromOper> + { + MapValueIterator_T(OutIterator curr, OutIterator first, OutIterator last, VALUE seq) + : MapIterator_T<OutIterator, FromOper>(curr, first, last, seq) + { + } + }; + + + template<typename OutIter> + inline ConstIterator* + make_output_value_iterator(const OutIter& current, const OutIter& begin, + const OutIter& end, VALUE seq = 0) + { + return new MapValueIterator_T<OutIter>(current, begin, end, seq); + } + } + + + namespace swig { + template <class RubySeq, class K, class T > + inline void + assign(const RubySeq& rubyseq, std::map<K,T > *map) { + typedef typename std::map<K,T>::value_type value_type; + typename RubySeq::const_iterator it = rubyseq.begin(); + for (;it != rubyseq.end(); ++it) { + map->insert(value_type(it->first, it->second)); + } + } + + template <class K, class T> + struct traits_asptr<std::map<K,T> > { + typedef std::map<K,T> map_type; + static int asptr(VALUE obj, map_type **val) { + int res = SWIG_ERROR; + if ( TYPE(obj) == T_HASH ) { + static ID id_to_a = rb_intern("to_a"); + VALUE items = rb_funcall(obj, id_to_a, 0); + res = traits_asptr_stdseq<std::map<K,T>, std::pair<K, T> >::asptr(items, val); + } else { + map_type *p; + swig_type_info *descriptor = swig::type_info<map_type>(); + res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR; + if (SWIG_IsOK(res) && val) *val = p; + } + return res; + } + }; + + template <class K, class T > + struct traits_from<std::map<K,T> > { + typedef std::map<K,T> map_type; + typedef typename map_type::const_iterator const_iterator; + typedef typename map_type::size_type size_type; + + static VALUE from(const map_type& map) { + swig_type_info *desc = swig::type_info<map_type>(); + if (desc && desc->clientdata) { + return SWIG_NewPointerObj(new map_type(map), desc, SWIG_POINTER_OWN); + } else { + size_type size = map.size(); + int rubysize = (size <= (size_type) INT_MAX) ? (int) size : -1; + if (rubysize < 0) { + SWIG_RUBY_THREAD_BEGIN_BLOCK; + rb_raise( rb_eRuntimeError, "map size not valid in Ruby"); + SWIG_RUBY_THREAD_END_BLOCK; + return Qnil; + } + VALUE obj = rb_hash_new(); + for (const_iterator i= map.begin(); i!= map.end(); ++i) { + VALUE key = swig::from(i->first); + VALUE val = swig::from(i->second); + rb_hash_aset(obj, key, val); + } + return obj; + } + } + }; + } + + + namespace swig { + template <> struct traits<std::map< std::string, CdiVariable, std::less< std::string >, std::allocator< std::pair< std::string const,CdiVariable > > > > { + typedef pointer_category category; + static const char* type_name() { + return "std::map<" "std::string" "," "CdiVariable" "," "std::less< std::string >" "," "std::allocator< std::pair< std::string const,CdiVariable > >" " >"; + } + }; + } + +SWIGINTERN std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > > *std_map_Sl_std_string_Sc_CdiVariable_Sg__dup(std::map< std::string,CdiVariable > *self){ + return new std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >(*self); + } +SWIGINTERN VALUE std_map_Sl_std_string_Sc_CdiVariable_Sg____delete__(std::map< std::string,CdiVariable > *self,std::map< std::string,CdiVariable >::key_type const &key){ + std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::iterator i = self->find(key); + if (i != self->end()) { + self->erase(i); + return swig::from( key ); + } + else { + return Qnil; + } + } +SWIGINTERN bool std_map_Sl_std_string_Sc_CdiVariable_Sg__has_key(std::map< std::string,CdiVariable > const *self,std::map< std::string,CdiVariable >::key_type const &key){ + std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::const_iterator i = self->find(key); + return i != self->end(); + } +SWIGINTERN VALUE std_map_Sl_std_string_Sc_CdiVariable_Sg__keys(std::map< std::string,CdiVariable > *self){ + std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::size_type size = self->size(); + int rubysize = (size <= (std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::size_type) INT_MAX) ? (int) size : -1; + if (rubysize < 0) { + SWIG_RUBY_THREAD_BEGIN_BLOCK; + rb_raise(rb_eRuntimeError, "map size not valid in Ruby"); + SWIG_RUBY_THREAD_END_BLOCK; + return Qnil; + } + VALUE ary = rb_ary_new2(rubysize); + std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::const_iterator i = self->begin(); + std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::const_iterator e = self->end(); + for ( ; i != e; ++i ) { + rb_ary_push( ary, swig::from(i->first) ); + } + return ary; + } +SWIGINTERN std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > > *std_map_Sl_std_string_Sc_CdiVariable_Sg__each(std::map< std::string,CdiVariable > *self){ + if ( !rb_block_given_p() ) + rb_raise( rb_eArgError, "no block given"); + + VALUE k, v; + std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::iterator i = self->begin(); + std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::iterator e = self->end(); + for ( ; i != e; ++i ) + { + const std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::key_type& key = i->first; + const std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::mapped_type& val = i->second; + + k = swig::from<std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::key_type>(key); + v = swig::from<std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::mapped_type>(val); + rb_yield_values(2, k, v); + } + + return self; + } +SWIGINTERN std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > > *std_map_Sl_std_string_Sc_CdiVariable_Sg__select(std::map< std::string,CdiVariable > *self){ + if ( !rb_block_given_p() ) + rb_raise( rb_eArgError, "no block given" ); + + std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >* r = new std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >; + std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::iterator i = self->begin(); + std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::iterator e = self->end(); + for ( ; i != e; ++i ) + { + VALUE k = swig::from<std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::key_type>(i->first); + VALUE v = swig::from<std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::mapped_type>(i->second); + if ( RTEST( rb_yield_values(2, k, v) ) ) + self->insert(r->end(), *i); + } + + return r; + } +SWIGINTERN VALUE std_map_Sl_std_string_Sc_CdiVariable_Sg__values_at(std::map< std::string,CdiVariable > *self,int argc,VALUE *argv,...){ + + VALUE r = rb_ary_new(); + ID id = rb_intern("[]"); + swig_type_info* type = swig::type_info< std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > > >(); + VALUE me = SWIG_NewPointerObj( self, type, 0 ); + for ( int i = 0; i < argc; ++i ) + { + VALUE key = argv[i]; + VALUE tmp = rb_funcall( me, id, 1, key ); + rb_ary_push( r, tmp ); + } + + return r; + } +SWIGINTERN std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > > *std_map_Sl_std_string_Sc_CdiVariable_Sg__each_key(std::map< std::string,CdiVariable > *self){ + if ( !rb_block_given_p() ) + rb_raise( rb_eArgError, "no block given"); + + VALUE r; + std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::iterator i = self->begin(); + std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::iterator e = self->end(); + for ( ; i != e; ++i ) + { + r = swig::from( i->first ); + rb_yield(r); + } + + return self; + } +SWIGINTERN VALUE std_map_Sl_std_string_Sc_CdiVariable_Sg__values(std::map< std::string,CdiVariable > *self){ + std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::size_type size = self->size(); + int rubysize = (size <= (std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::size_type) INT_MAX) ? (int) size : -1; + if (rubysize < 0) { + SWIG_RUBY_THREAD_BEGIN_BLOCK; + rb_raise(rb_eRuntimeError, "map size not valid in Ruby"); + SWIG_RUBY_THREAD_END_BLOCK; + return Qnil; + } + VALUE ary = rb_ary_new2(rubysize); + std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::const_iterator i = self->begin(); + std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::const_iterator e = self->end(); + for ( ; i != e; ++i ) { + rb_ary_push( ary, swig::from(i->second) ); + } + return ary; + } +SWIGINTERN std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > > *std_map_Sl_std_string_Sc_CdiVariable_Sg__each_value(std::map< std::string,CdiVariable > *self){ + if ( !rb_block_given_p() ) + rb_raise( rb_eArgError, "no block given"); + + VALUE r; + std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::iterator i = self->begin(); + std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::iterator e = self->end(); + for ( ; i != e; ++i ) + { + r = swig::from( i->second ); + rb_yield(r); + } + + return self; + } +SWIGINTERN VALUE std_map_Sl_std_string_Sc_CdiVariable_Sg__entries(std::map< std::string,CdiVariable > *self){ + std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::size_type size = self->size(); + int rubysize = (size <= (std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::size_type) INT_MAX) ? (int) size : -1; + if (rubysize < 0) { + SWIG_RUBY_THREAD_BEGIN_BLOCK; + rb_raise(rb_eRuntimeError, "map size not valid in Ruby"); + SWIG_RUBY_THREAD_END_BLOCK; + return Qnil; + } + VALUE ary = rb_ary_new2(rubysize); + std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::const_iterator i = self->begin(); + std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::const_iterator e = self->end(); + for ( ; i != e; ++i ) { + rb_ary_push( ary, swig::from<std::pair<std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::key_type, + std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::mapped_type> >(*i) ); + } + return ary; + } +SWIGINTERN bool std_map_Sl_std_string_Sc_CdiVariable_Sg____contains__(std::map< std::string,CdiVariable > *self,std::map< std::string,CdiVariable >::key_type const &key){ + return self->find(key) != self->end(); + } +SWIGINTERN swig::ConstIterator *std_map_Sl_std_string_Sc_CdiVariable_Sg__key_iterator(std::map< std::string,CdiVariable > *self,VALUE *RUBY_SELF){ + return swig::make_output_key_iterator(self->begin(), self->begin(), + self->end(), *RUBY_SELF); + } +SWIGINTERN swig::ConstIterator *std_map_Sl_std_string_Sc_CdiVariable_Sg__value_iterator(std::map< std::string,CdiVariable > *self,VALUE *RUBY_SELF){ + return swig::make_output_value_iterator(self->begin(), self->begin(), + self->end(), *RUBY_SELF); + } +SWIGINTERN VALUE std_map_Sl_std_string_Sc_CdiVariable_Sg____getitem__(std::map< std::string,CdiVariable > const *self,std::map< std::string,CdiVariable >::key_type const &key){ + std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::const_iterator i = self->find(key); + if ( i != self->end() ) + return swig::from<std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::mapped_type>( i->second ); + else + return Qnil; + } +SWIGINTERN void std_map_Sl_std_string_Sc_CdiVariable_Sg____setitem__(std::map< std::string,CdiVariable > *self,std::map< std::string,CdiVariable >::key_type const &key,std::map< std::string,CdiVariable >::mapped_type const &x){ + (*self)[key] = x; + } +SWIGINTERN VALUE std_map_Sl_std_string_Sc_CdiVariable_Sg__inspect(std::map< std::string,CdiVariable > *self){ + std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::const_iterator i = self->begin(); + std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::const_iterator e = self->end(); + const char *type_name = swig::type_name< std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > > >(); + VALUE str = rb_str_new2( type_name ); + str = rb_str_cat2( str, " {" ); + bool comma = false; + VALUE tmp; + for ( ; i != e; ++i, comma = true ) + { + if (comma) str = rb_str_cat2( str, "," ); + tmp = swig::from< std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::key_type >( i->first ); + tmp = rb_inspect( tmp ); + str = rb_str_buf_append( str, tmp ); + str = rb_str_cat2( str, "=>" ); + tmp = swig::from< std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::mapped_type >( i->second ); + tmp = rb_inspect( tmp ); + str = rb_str_buf_append( str, tmp ); + } + str = rb_str_cat2( str, "}" ); + return str; + } +SWIGINTERN VALUE std_map_Sl_std_string_Sc_CdiVariable_Sg__to_a(std::map< std::string,CdiVariable > *self){ + std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::const_iterator i = self->begin(); + std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::const_iterator e = self->end(); + VALUE ary = rb_ary_new2( std::distance( i, e ) ); + VALUE tmp; + for ( ; i != e; ++i ) + { + // @todo: improve -- this should just be swig::from(*i) + tmp = swig::from< std::pair<std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::key_type, + std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::mapped_type> >( *i ); + rb_ary_push( ary, tmp ); + } + return ary; + } +SWIGINTERN VALUE std_map_Sl_std_string_Sc_CdiVariable_Sg__to_s(std::map< std::string,CdiVariable > *self){ + std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::iterator i = self->begin(); + std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::iterator e = self->end(); + VALUE str = rb_str_new2( "" ); + VALUE tmp; + for ( ; i != e; ++i ) + { + // @todo: improve -- this should just be swig::from(*i) + tmp = swig::from< std::pair<std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::key_type, + std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::mapped_type> >( *i ); + tmp = rb_obj_as_string( tmp ); + str = rb_str_buf_append( str, tmp ); + } + return str; + } +SWIGINTERN void std_map_Sl_std_string_Sc_CdiVariable_Sg__erase__SWIG_1(std::map< std::string,CdiVariable > *self,std::map< std::string,CdiVariable >::iterator position){ self->erase(position); } +SWIGINTERN void std_map_Sl_std_string_Sc_CdiVariable_Sg__erase__SWIG_2(std::map< std::string,CdiVariable > *self,std::map< std::string,CdiVariable >::iterator first,std::map< std::string,CdiVariable >::iterator last){ self->erase(first, last); } + + namespace swig { + template <> struct traits<std::pair< int, CdiVariable > > { + typedef pointer_category category; + static const char* type_name() { + return "std::pair<" "int" "," "CdiVariable" " >"; + } + }; + } + + + namespace swig { + template <> struct traits<std::map< int, CdiVariable, std::less< int >, std::allocator< std::pair< int const,CdiVariable > > > > { + typedef pointer_category category; + static const char* type_name() { + return "std::map<" "int" "," "CdiVariable" "," "std::less< int >" "," "std::allocator< std::pair< int const,CdiVariable > >" " >"; + } + }; + } + +SWIGINTERN std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > > *std_map_Sl_int_Sc_CdiVariable_Sg__dup(std::map< int,CdiVariable > *self){ + return new std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >(*self); + } +SWIGINTERN VALUE std_map_Sl_int_Sc_CdiVariable_Sg____delete__(std::map< int,CdiVariable > *self,std::map< int,CdiVariable >::key_type const &key){ + std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::iterator i = self->find(key); + if (i != self->end()) { + self->erase(i); + return swig::from( key ); + } + else { + return Qnil; + } + } +SWIGINTERN bool std_map_Sl_int_Sc_CdiVariable_Sg__has_key(std::map< int,CdiVariable > const *self,std::map< int,CdiVariable >::key_type const &key){ + std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::const_iterator i = self->find(key); + return i != self->end(); + } +SWIGINTERN VALUE std_map_Sl_int_Sc_CdiVariable_Sg__keys(std::map< int,CdiVariable > *self){ + std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::size_type size = self->size(); + int rubysize = (size <= (std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::size_type) INT_MAX) ? (int) size : -1; + if (rubysize < 0) { + SWIG_RUBY_THREAD_BEGIN_BLOCK; + rb_raise(rb_eRuntimeError, "map size not valid in Ruby"); + SWIG_RUBY_THREAD_END_BLOCK; + return Qnil; + } + VALUE ary = rb_ary_new2(rubysize); + std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::const_iterator i = self->begin(); + std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::const_iterator e = self->end(); + for ( ; i != e; ++i ) { + rb_ary_push( ary, swig::from(i->first) ); + } + return ary; + } +SWIGINTERN std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > > *std_map_Sl_int_Sc_CdiVariable_Sg__each(std::map< int,CdiVariable > *self){ + if ( !rb_block_given_p() ) + rb_raise( rb_eArgError, "no block given"); + + VALUE k, v; + std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::iterator i = self->begin(); + std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::iterator e = self->end(); + for ( ; i != e; ++i ) + { + const std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::key_type& key = i->first; + const std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::mapped_type& val = i->second; + + k = swig::from<std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::key_type>(key); + v = swig::from<std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::mapped_type>(val); + rb_yield_values(2, k, v); + } + + return self; + } +SWIGINTERN std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > > *std_map_Sl_int_Sc_CdiVariable_Sg__select(std::map< int,CdiVariable > *self){ + if ( !rb_block_given_p() ) + rb_raise( rb_eArgError, "no block given" ); + + std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >* r = new std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >; + std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::iterator i = self->begin(); + std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::iterator e = self->end(); + for ( ; i != e; ++i ) + { + VALUE k = swig::from<std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::key_type>(i->first); + VALUE v = swig::from<std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::mapped_type>(i->second); + if ( RTEST( rb_yield_values(2, k, v) ) ) + self->insert(r->end(), *i); + } + + return r; + } +SWIGINTERN VALUE std_map_Sl_int_Sc_CdiVariable_Sg__values_at(std::map< int,CdiVariable > *self,int argc,VALUE *argv,...){ + + VALUE r = rb_ary_new(); + ID id = rb_intern("[]"); + swig_type_info* type = swig::type_info< std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > > >(); + VALUE me = SWIG_NewPointerObj( self, type, 0 ); + for ( int i = 0; i < argc; ++i ) + { + VALUE key = argv[i]; + VALUE tmp = rb_funcall( me, id, 1, key ); + rb_ary_push( r, tmp ); + } + + return r; + } +SWIGINTERN std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > > *std_map_Sl_int_Sc_CdiVariable_Sg__each_key(std::map< int,CdiVariable > *self){ + if ( !rb_block_given_p() ) + rb_raise( rb_eArgError, "no block given"); + + VALUE r; + std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::iterator i = self->begin(); + std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::iterator e = self->end(); + for ( ; i != e; ++i ) + { + r = swig::from( i->first ); + rb_yield(r); + } + + return self; + } +SWIGINTERN VALUE std_map_Sl_int_Sc_CdiVariable_Sg__values(std::map< int,CdiVariable > *self){ + std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::size_type size = self->size(); + int rubysize = (size <= (std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::size_type) INT_MAX) ? (int) size : -1; + if (rubysize < 0) { + SWIG_RUBY_THREAD_BEGIN_BLOCK; + rb_raise(rb_eRuntimeError, "map size not valid in Ruby"); + SWIG_RUBY_THREAD_END_BLOCK; + return Qnil; + } + VALUE ary = rb_ary_new2(rubysize); + std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::const_iterator i = self->begin(); + std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::const_iterator e = self->end(); + for ( ; i != e; ++i ) { + rb_ary_push( ary, swig::from(i->second) ); + } + return ary; + } +SWIGINTERN std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > > *std_map_Sl_int_Sc_CdiVariable_Sg__each_value(std::map< int,CdiVariable > *self){ + if ( !rb_block_given_p() ) + rb_raise( rb_eArgError, "no block given"); + + VALUE r; + std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::iterator i = self->begin(); + std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::iterator e = self->end(); + for ( ; i != e; ++i ) + { + r = swig::from( i->second ); + rb_yield(r); + } + + return self; + } +SWIGINTERN VALUE std_map_Sl_int_Sc_CdiVariable_Sg__entries(std::map< int,CdiVariable > *self){ + std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::size_type size = self->size(); + int rubysize = (size <= (std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::size_type) INT_MAX) ? (int) size : -1; + if (rubysize < 0) { + SWIG_RUBY_THREAD_BEGIN_BLOCK; + rb_raise(rb_eRuntimeError, "map size not valid in Ruby"); + SWIG_RUBY_THREAD_END_BLOCK; + return Qnil; + } + VALUE ary = rb_ary_new2(rubysize); + std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::const_iterator i = self->begin(); + std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::const_iterator e = self->end(); + for ( ; i != e; ++i ) { + rb_ary_push( ary, swig::from<std::pair<std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::key_type, + std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::mapped_type> >(*i) ); + } + return ary; + } +SWIGINTERN bool std_map_Sl_int_Sc_CdiVariable_Sg____contains__(std::map< int,CdiVariable > *self,std::map< int,CdiVariable >::key_type const &key){ + return self->find(key) != self->end(); + } +SWIGINTERN swig::ConstIterator *std_map_Sl_int_Sc_CdiVariable_Sg__key_iterator(std::map< int,CdiVariable > *self,VALUE *RUBY_SELF){ + return swig::make_output_key_iterator(self->begin(), self->begin(), + self->end(), *RUBY_SELF); + } +SWIGINTERN swig::ConstIterator *std_map_Sl_int_Sc_CdiVariable_Sg__value_iterator(std::map< int,CdiVariable > *self,VALUE *RUBY_SELF){ + return swig::make_output_value_iterator(self->begin(), self->begin(), + self->end(), *RUBY_SELF); + } +SWIGINTERN VALUE std_map_Sl_int_Sc_CdiVariable_Sg____getitem__(std::map< int,CdiVariable > const *self,std::map< int,CdiVariable >::key_type const &key){ + std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::const_iterator i = self->find(key); + if ( i != self->end() ) + return swig::from<std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::mapped_type>( i->second ); + else + return Qnil; + } +SWIGINTERN void std_map_Sl_int_Sc_CdiVariable_Sg____setitem__(std::map< int,CdiVariable > *self,std::map< int,CdiVariable >::key_type const &key,std::map< int,CdiVariable >::mapped_type const &x){ + (*self)[key] = x; + } +SWIGINTERN VALUE std_map_Sl_int_Sc_CdiVariable_Sg__inspect(std::map< int,CdiVariable > *self){ + std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::const_iterator i = self->begin(); + std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::const_iterator e = self->end(); + const char *type_name = swig::type_name< std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > > >(); + VALUE str = rb_str_new2( type_name ); + str = rb_str_cat2( str, " {" ); + bool comma = false; + VALUE tmp; + for ( ; i != e; ++i, comma = true ) + { + if (comma) str = rb_str_cat2( str, "," ); + tmp = swig::from< std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::key_type >( i->first ); + tmp = rb_inspect( tmp ); + str = rb_str_buf_append( str, tmp ); + str = rb_str_cat2( str, "=>" ); + tmp = swig::from< std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::mapped_type >( i->second ); + tmp = rb_inspect( tmp ); + str = rb_str_buf_append( str, tmp ); + } + str = rb_str_cat2( str, "}" ); + return str; + } +SWIGINTERN VALUE std_map_Sl_int_Sc_CdiVariable_Sg__to_a(std::map< int,CdiVariable > *self){ + std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::const_iterator i = self->begin(); + std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::const_iterator e = self->end(); + VALUE ary = rb_ary_new2( std::distance( i, e ) ); + VALUE tmp; + for ( ; i != e; ++i ) + { + // @todo: improve -- this should just be swig::from(*i) + tmp = swig::from< std::pair<std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::key_type, + std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::mapped_type> >( *i ); + rb_ary_push( ary, tmp ); + } + return ary; + } +SWIGINTERN VALUE std_map_Sl_int_Sc_CdiVariable_Sg__to_s(std::map< int,CdiVariable > *self){ + std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::iterator i = self->begin(); + std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::iterator e = self->end(); + VALUE str = rb_str_new2( "" ); + VALUE tmp; + for ( ; i != e; ++i ) + { + // @todo: improve -- this should just be swig::from(*i) + tmp = swig::from< std::pair<std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::key_type, + std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::mapped_type> >( *i ); + tmp = rb_obj_as_string( tmp ); + str = rb_str_buf_append( str, tmp ); + } + return str; + } +SWIGINTERN void std_map_Sl_int_Sc_CdiVariable_Sg__erase__SWIG_1(std::map< int,CdiVariable > *self,std::map< int,CdiVariable >::iterator position){ self->erase(position); } +SWIGINTERN void std_map_Sl_int_Sc_CdiVariable_Sg__erase__SWIG_2(std::map< int,CdiVariable > *self,std::map< int,CdiVariable >::iterator first,std::map< int,CdiVariable >::iterator last){ self->erase(first, last); } + + namespace swig { + template <> struct traits< CdiTaxis > { + typedef pointer_category category; + static const char* type_name() { return"CdiTaxis"; } + }; + } + + + namespace swig { + template <> struct traits<std::pair< int, CdiTaxis > > { + typedef pointer_category category; + static const char* type_name() { + return "std::pair<" "int" "," "CdiTaxis" " >"; + } + }; + } + + + namespace swig { + template <> struct traits<std::map< int, CdiTaxis, std::less< int >, std::allocator< std::pair< int const,CdiTaxis > > > > { + typedef pointer_category category; + static const char* type_name() { + return "std::map<" "int" "," "CdiTaxis" "," "std::less< int >" "," "std::allocator< std::pair< int const,CdiTaxis > >" " >"; + } + }; + } + +SWIGINTERN std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > > *std_map_Sl_int_Sc_CdiTaxis_Sg__dup(std::map< int,CdiTaxis > *self){ + return new std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >(*self); + } +SWIGINTERN VALUE std_map_Sl_int_Sc_CdiTaxis_Sg____delete__(std::map< int,CdiTaxis > *self,std::map< int,CdiTaxis >::key_type const &key){ + std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::iterator i = self->find(key); + if (i != self->end()) { + self->erase(i); + return swig::from( key ); + } + else { + return Qnil; + } + } +SWIGINTERN bool std_map_Sl_int_Sc_CdiTaxis_Sg__has_key(std::map< int,CdiTaxis > const *self,std::map< int,CdiTaxis >::key_type const &key){ + std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::const_iterator i = self->find(key); + return i != self->end(); + } +SWIGINTERN VALUE std_map_Sl_int_Sc_CdiTaxis_Sg__keys(std::map< int,CdiTaxis > *self){ + std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::size_type size = self->size(); + int rubysize = (size <= (std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::size_type) INT_MAX) ? (int) size : -1; + if (rubysize < 0) { + SWIG_RUBY_THREAD_BEGIN_BLOCK; + rb_raise(rb_eRuntimeError, "map size not valid in Ruby"); + SWIG_RUBY_THREAD_END_BLOCK; + return Qnil; + } + VALUE ary = rb_ary_new2(rubysize); + std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::const_iterator i = self->begin(); + std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::const_iterator e = self->end(); + for ( ; i != e; ++i ) { + rb_ary_push( ary, swig::from(i->first) ); + } + return ary; + } +SWIGINTERN std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > > *std_map_Sl_int_Sc_CdiTaxis_Sg__each(std::map< int,CdiTaxis > *self){ + if ( !rb_block_given_p() ) + rb_raise( rb_eArgError, "no block given"); + + VALUE k, v; + std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::iterator i = self->begin(); + std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::iterator e = self->end(); + for ( ; i != e; ++i ) + { + const std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::key_type& key = i->first; + const std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::mapped_type& val = i->second; + + k = swig::from<std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::key_type>(key); + v = swig::from<std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::mapped_type>(val); + rb_yield_values(2, k, v); + } + + return self; + } +SWIGINTERN std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > > *std_map_Sl_int_Sc_CdiTaxis_Sg__select(std::map< int,CdiTaxis > *self){ + if ( !rb_block_given_p() ) + rb_raise( rb_eArgError, "no block given" ); + + std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >* r = new std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >; + std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::iterator i = self->begin(); + std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::iterator e = self->end(); + for ( ; i != e; ++i ) + { + VALUE k = swig::from<std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::key_type>(i->first); + VALUE v = swig::from<std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::mapped_type>(i->second); + if ( RTEST( rb_yield_values(2, k, v) ) ) + self->insert(r->end(), *i); + } + + return r; + } +SWIGINTERN VALUE std_map_Sl_int_Sc_CdiTaxis_Sg__values_at(std::map< int,CdiTaxis > *self,int argc,VALUE *argv,...){ + + VALUE r = rb_ary_new(); + ID id = rb_intern("[]"); + swig_type_info* type = swig::type_info< std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > > >(); + VALUE me = SWIG_NewPointerObj( self, type, 0 ); + for ( int i = 0; i < argc; ++i ) + { + VALUE key = argv[i]; + VALUE tmp = rb_funcall( me, id, 1, key ); + rb_ary_push( r, tmp ); + } + + return r; + } +SWIGINTERN std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > > *std_map_Sl_int_Sc_CdiTaxis_Sg__each_key(std::map< int,CdiTaxis > *self){ + if ( !rb_block_given_p() ) + rb_raise( rb_eArgError, "no block given"); + + VALUE r; + std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::iterator i = self->begin(); + std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::iterator e = self->end(); + for ( ; i != e; ++i ) + { + r = swig::from( i->first ); + rb_yield(r); + } + + return self; + } +SWIGINTERN VALUE std_map_Sl_int_Sc_CdiTaxis_Sg__values(std::map< int,CdiTaxis > *self){ + std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::size_type size = self->size(); + int rubysize = (size <= (std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::size_type) INT_MAX) ? (int) size : -1; + if (rubysize < 0) { + SWIG_RUBY_THREAD_BEGIN_BLOCK; + rb_raise(rb_eRuntimeError, "map size not valid in Ruby"); + SWIG_RUBY_THREAD_END_BLOCK; + return Qnil; + } + VALUE ary = rb_ary_new2(rubysize); + std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::const_iterator i = self->begin(); + std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::const_iterator e = self->end(); + for ( ; i != e; ++i ) { + rb_ary_push( ary, swig::from(i->second) ); + } + return ary; + } +SWIGINTERN std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > > *std_map_Sl_int_Sc_CdiTaxis_Sg__each_value(std::map< int,CdiTaxis > *self){ + if ( !rb_block_given_p() ) + rb_raise( rb_eArgError, "no block given"); + + VALUE r; + std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::iterator i = self->begin(); + std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::iterator e = self->end(); + for ( ; i != e; ++i ) + { + r = swig::from( i->second ); + rb_yield(r); + } + + return self; + } +SWIGINTERN VALUE std_map_Sl_int_Sc_CdiTaxis_Sg__entries(std::map< int,CdiTaxis > *self){ + std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::size_type size = self->size(); + int rubysize = (size <= (std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::size_type) INT_MAX) ? (int) size : -1; + if (rubysize < 0) { + SWIG_RUBY_THREAD_BEGIN_BLOCK; + rb_raise(rb_eRuntimeError, "map size not valid in Ruby"); + SWIG_RUBY_THREAD_END_BLOCK; + return Qnil; + } + VALUE ary = rb_ary_new2(rubysize); + std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::const_iterator i = self->begin(); + std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::const_iterator e = self->end(); + for ( ; i != e; ++i ) { + rb_ary_push( ary, swig::from<std::pair<std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::key_type, + std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::mapped_type> >(*i) ); + } + return ary; + } +SWIGINTERN bool std_map_Sl_int_Sc_CdiTaxis_Sg____contains__(std::map< int,CdiTaxis > *self,std::map< int,CdiTaxis >::key_type const &key){ + return self->find(key) != self->end(); + } +SWIGINTERN swig::ConstIterator *std_map_Sl_int_Sc_CdiTaxis_Sg__key_iterator(std::map< int,CdiTaxis > *self,VALUE *RUBY_SELF){ + return swig::make_output_key_iterator(self->begin(), self->begin(), + self->end(), *RUBY_SELF); + } +SWIGINTERN swig::ConstIterator *std_map_Sl_int_Sc_CdiTaxis_Sg__value_iterator(std::map< int,CdiTaxis > *self,VALUE *RUBY_SELF){ + return swig::make_output_value_iterator(self->begin(), self->begin(), + self->end(), *RUBY_SELF); + } +SWIGINTERN VALUE std_map_Sl_int_Sc_CdiTaxis_Sg____getitem__(std::map< int,CdiTaxis > const *self,std::map< int,CdiTaxis >::key_type const &key){ + std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::const_iterator i = self->find(key); + if ( i != self->end() ) + return swig::from<std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::mapped_type>( i->second ); + else + return Qnil; + } +SWIGINTERN void std_map_Sl_int_Sc_CdiTaxis_Sg____setitem__(std::map< int,CdiTaxis > *self,std::map< int,CdiTaxis >::key_type const &key,std::map< int,CdiTaxis >::mapped_type const &x){ + (*self)[key] = x; + } +SWIGINTERN VALUE std_map_Sl_int_Sc_CdiTaxis_Sg__inspect(std::map< int,CdiTaxis > *self){ + std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::const_iterator i = self->begin(); + std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::const_iterator e = self->end(); + const char *type_name = swig::type_name< std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > > >(); + VALUE str = rb_str_new2( type_name ); + str = rb_str_cat2( str, " {" ); + bool comma = false; + VALUE tmp; + for ( ; i != e; ++i, comma = true ) + { + if (comma) str = rb_str_cat2( str, "," ); + tmp = swig::from< std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::key_type >( i->first ); + tmp = rb_inspect( tmp ); + str = rb_str_buf_append( str, tmp ); + str = rb_str_cat2( str, "=>" ); + tmp = swig::from< std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::mapped_type >( i->second ); + tmp = rb_inspect( tmp ); + str = rb_str_buf_append( str, tmp ); + } + str = rb_str_cat2( str, "}" ); + return str; + } +SWIGINTERN VALUE std_map_Sl_int_Sc_CdiTaxis_Sg__to_a(std::map< int,CdiTaxis > *self){ + std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::const_iterator i = self->begin(); + std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::const_iterator e = self->end(); + VALUE ary = rb_ary_new2( std::distance( i, e ) ); + VALUE tmp; + for ( ; i != e; ++i ) + { + // @todo: improve -- this should just be swig::from(*i) + tmp = swig::from< std::pair<std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::key_type, + std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::mapped_type> >( *i ); + rb_ary_push( ary, tmp ); + } + return ary; + } +SWIGINTERN VALUE std_map_Sl_int_Sc_CdiTaxis_Sg__to_s(std::map< int,CdiTaxis > *self){ + std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::iterator i = self->begin(); + std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::iterator e = self->end(); + VALUE str = rb_str_new2( "" ); + VALUE tmp; + for ( ; i != e; ++i ) + { + // @todo: improve -- this should just be swig::from(*i) + tmp = swig::from< std::pair<std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::key_type, + std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::mapped_type> >( *i ); + tmp = rb_obj_as_string( tmp ); + str = rb_str_buf_append( str, tmp ); + } + return str; + } +SWIGINTERN void std_map_Sl_int_Sc_CdiTaxis_Sg__erase__SWIG_1(std::map< int,CdiTaxis > *self,std::map< int,CdiTaxis >::iterator position){ self->erase(position); } +SWIGINTERN void std_map_Sl_int_Sc_CdiTaxis_Sg__erase__SWIG_2(std::map< int,CdiTaxis > *self,std::map< int,CdiTaxis >::iterator first,std::map< int,CdiTaxis >::iterator last){ self->erase(first, last); } + + namespace swig { + template <> struct traits< CdiZaxis > { + typedef pointer_category category; + static const char* type_name() { return"CdiZaxis"; } + }; + } + + + namespace swig { + template <> struct traits<std::pair< int, CdiZaxis > > { + typedef pointer_category category; + static const char* type_name() { + return "std::pair<" "int" "," "CdiZaxis" " >"; + } + }; + } + + + namespace swig { + template <> struct traits<std::map< int, CdiZaxis, std::less< int >, std::allocator< std::pair< int const,CdiZaxis > > > > { + typedef pointer_category category; + static const char* type_name() { + return "std::map<" "int" "," "CdiZaxis" "," "std::less< int >" "," "std::allocator< std::pair< int const,CdiZaxis > >" " >"; + } + }; + } + +SWIGINTERN std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > > *std_map_Sl_int_Sc_CdiZaxis_Sg__dup(std::map< int,CdiZaxis > *self){ + return new std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >(*self); + } +SWIGINTERN VALUE std_map_Sl_int_Sc_CdiZaxis_Sg____delete__(std::map< int,CdiZaxis > *self,std::map< int,CdiZaxis >::key_type const &key){ + std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::iterator i = self->find(key); + if (i != self->end()) { + self->erase(i); + return swig::from( key ); + } + else { + return Qnil; + } + } +SWIGINTERN bool std_map_Sl_int_Sc_CdiZaxis_Sg__has_key(std::map< int,CdiZaxis > const *self,std::map< int,CdiZaxis >::key_type const &key){ + std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::const_iterator i = self->find(key); + return i != self->end(); + } +SWIGINTERN VALUE std_map_Sl_int_Sc_CdiZaxis_Sg__keys(std::map< int,CdiZaxis > *self){ + std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::size_type size = self->size(); + int rubysize = (size <= (std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::size_type) INT_MAX) ? (int) size : -1; + if (rubysize < 0) { + SWIG_RUBY_THREAD_BEGIN_BLOCK; + rb_raise(rb_eRuntimeError, "map size not valid in Ruby"); + SWIG_RUBY_THREAD_END_BLOCK; + return Qnil; + } + VALUE ary = rb_ary_new2(rubysize); + std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::const_iterator i = self->begin(); + std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::const_iterator e = self->end(); + for ( ; i != e; ++i ) { + rb_ary_push( ary, swig::from(i->first) ); + } + return ary; + } +SWIGINTERN std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > > *std_map_Sl_int_Sc_CdiZaxis_Sg__each(std::map< int,CdiZaxis > *self){ + if ( !rb_block_given_p() ) + rb_raise( rb_eArgError, "no block given"); + + VALUE k, v; + std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::iterator i = self->begin(); + std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::iterator e = self->end(); + for ( ; i != e; ++i ) + { + const std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::key_type& key = i->first; + const std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::mapped_type& val = i->second; + + k = swig::from<std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::key_type>(key); + v = swig::from<std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::mapped_type>(val); + rb_yield_values(2, k, v); + } + + return self; + } +SWIGINTERN std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > > *std_map_Sl_int_Sc_CdiZaxis_Sg__select(std::map< int,CdiZaxis > *self){ + if ( !rb_block_given_p() ) + rb_raise( rb_eArgError, "no block given" ); + + std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >* r = new std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >; + std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::iterator i = self->begin(); + std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::iterator e = self->end(); + for ( ; i != e; ++i ) + { + VALUE k = swig::from<std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::key_type>(i->first); + VALUE v = swig::from<std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::mapped_type>(i->second); + if ( RTEST( rb_yield_values(2, k, v) ) ) + self->insert(r->end(), *i); + } + + return r; + } +SWIGINTERN VALUE std_map_Sl_int_Sc_CdiZaxis_Sg__values_at(std::map< int,CdiZaxis > *self,int argc,VALUE *argv,...){ + + VALUE r = rb_ary_new(); + ID id = rb_intern("[]"); + swig_type_info* type = swig::type_info< std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > > >(); + VALUE me = SWIG_NewPointerObj( self, type, 0 ); + for ( int i = 0; i < argc; ++i ) + { + VALUE key = argv[i]; + VALUE tmp = rb_funcall( me, id, 1, key ); + rb_ary_push( r, tmp ); + } + + return r; + } +SWIGINTERN std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > > *std_map_Sl_int_Sc_CdiZaxis_Sg__each_key(std::map< int,CdiZaxis > *self){ + if ( !rb_block_given_p() ) + rb_raise( rb_eArgError, "no block given"); + + VALUE r; + std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::iterator i = self->begin(); + std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::iterator e = self->end(); + for ( ; i != e; ++i ) + { + r = swig::from( i->first ); + rb_yield(r); + } + + return self; + } +SWIGINTERN VALUE std_map_Sl_int_Sc_CdiZaxis_Sg__values(std::map< int,CdiZaxis > *self){ + std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::size_type size = self->size(); + int rubysize = (size <= (std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::size_type) INT_MAX) ? (int) size : -1; + if (rubysize < 0) { + SWIG_RUBY_THREAD_BEGIN_BLOCK; + rb_raise(rb_eRuntimeError, "map size not valid in Ruby"); + SWIG_RUBY_THREAD_END_BLOCK; + return Qnil; + } + VALUE ary = rb_ary_new2(rubysize); + std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::const_iterator i = self->begin(); + std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::const_iterator e = self->end(); + for ( ; i != e; ++i ) { + rb_ary_push( ary, swig::from(i->second) ); + } + return ary; + } +SWIGINTERN std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > > *std_map_Sl_int_Sc_CdiZaxis_Sg__each_value(std::map< int,CdiZaxis > *self){ + if ( !rb_block_given_p() ) + rb_raise( rb_eArgError, "no block given"); + + VALUE r; + std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::iterator i = self->begin(); + std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::iterator e = self->end(); + for ( ; i != e; ++i ) + { + r = swig::from( i->second ); + rb_yield(r); + } + + return self; + } +SWIGINTERN VALUE std_map_Sl_int_Sc_CdiZaxis_Sg__entries(std::map< int,CdiZaxis > *self){ + std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::size_type size = self->size(); + int rubysize = (size <= (std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::size_type) INT_MAX) ? (int) size : -1; + if (rubysize < 0) { + SWIG_RUBY_THREAD_BEGIN_BLOCK; + rb_raise(rb_eRuntimeError, "map size not valid in Ruby"); + SWIG_RUBY_THREAD_END_BLOCK; + return Qnil; + } + VALUE ary = rb_ary_new2(rubysize); + std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::const_iterator i = self->begin(); + std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::const_iterator e = self->end(); + for ( ; i != e; ++i ) { + rb_ary_push( ary, swig::from<std::pair<std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::key_type, + std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::mapped_type> >(*i) ); + } + return ary; + } +SWIGINTERN bool std_map_Sl_int_Sc_CdiZaxis_Sg____contains__(std::map< int,CdiZaxis > *self,std::map< int,CdiZaxis >::key_type const &key){ + return self->find(key) != self->end(); + } +SWIGINTERN swig::ConstIterator *std_map_Sl_int_Sc_CdiZaxis_Sg__key_iterator(std::map< int,CdiZaxis > *self,VALUE *RUBY_SELF){ + return swig::make_output_key_iterator(self->begin(), self->begin(), + self->end(), *RUBY_SELF); + } +SWIGINTERN swig::ConstIterator *std_map_Sl_int_Sc_CdiZaxis_Sg__value_iterator(std::map< int,CdiZaxis > *self,VALUE *RUBY_SELF){ + return swig::make_output_value_iterator(self->begin(), self->begin(), + self->end(), *RUBY_SELF); + } +SWIGINTERN VALUE std_map_Sl_int_Sc_CdiZaxis_Sg____getitem__(std::map< int,CdiZaxis > const *self,std::map< int,CdiZaxis >::key_type const &key){ + std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::const_iterator i = self->find(key); + if ( i != self->end() ) + return swig::from<std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::mapped_type>( i->second ); + else + return Qnil; + } +SWIGINTERN void std_map_Sl_int_Sc_CdiZaxis_Sg____setitem__(std::map< int,CdiZaxis > *self,std::map< int,CdiZaxis >::key_type const &key,std::map< int,CdiZaxis >::mapped_type const &x){ + (*self)[key] = x; + } +SWIGINTERN VALUE std_map_Sl_int_Sc_CdiZaxis_Sg__inspect(std::map< int,CdiZaxis > *self){ + std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::const_iterator i = self->begin(); + std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::const_iterator e = self->end(); + const char *type_name = swig::type_name< std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > > >(); + VALUE str = rb_str_new2( type_name ); + str = rb_str_cat2( str, " {" ); + bool comma = false; + VALUE tmp; + for ( ; i != e; ++i, comma = true ) + { + if (comma) str = rb_str_cat2( str, "," ); + tmp = swig::from< std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::key_type >( i->first ); + tmp = rb_inspect( tmp ); + str = rb_str_buf_append( str, tmp ); + str = rb_str_cat2( str, "=>" ); + tmp = swig::from< std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::mapped_type >( i->second ); + tmp = rb_inspect( tmp ); + str = rb_str_buf_append( str, tmp ); + } + str = rb_str_cat2( str, "}" ); + return str; + } +SWIGINTERN VALUE std_map_Sl_int_Sc_CdiZaxis_Sg__to_a(std::map< int,CdiZaxis > *self){ + std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::const_iterator i = self->begin(); + std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::const_iterator e = self->end(); + VALUE ary = rb_ary_new2( std::distance( i, e ) ); + VALUE tmp; + for ( ; i != e; ++i ) + { + // @todo: improve -- this should just be swig::from(*i) + tmp = swig::from< std::pair<std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::key_type, + std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::mapped_type> >( *i ); + rb_ary_push( ary, tmp ); + } + return ary; + } +SWIGINTERN VALUE std_map_Sl_int_Sc_CdiZaxis_Sg__to_s(std::map< int,CdiZaxis > *self){ + std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::iterator i = self->begin(); + std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::iterator e = self->end(); + VALUE str = rb_str_new2( "" ); + VALUE tmp; + for ( ; i != e; ++i ) + { + // @todo: improve -- this should just be swig::from(*i) + tmp = swig::from< std::pair<std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::key_type, + std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::mapped_type> >( *i ); + tmp = rb_obj_as_string( tmp ); + str = rb_str_buf_append( str, tmp ); + } + return str; + } +SWIGINTERN void std_map_Sl_int_Sc_CdiZaxis_Sg__erase__SWIG_1(std::map< int,CdiZaxis > *self,std::map< int,CdiZaxis >::iterator position){ self->erase(position); } +SWIGINTERN void std_map_Sl_int_Sc_CdiZaxis_Sg__erase__SWIG_2(std::map< int,CdiZaxis > *self,std::map< int,CdiZaxis >::iterator first,std::map< int,CdiZaxis >::iterator last){ self->erase(first, last); } + + namespace swig { + template <> struct traits< CdiGrid > { + typedef pointer_category category; + static const char* type_name() { return"CdiGrid"; } + }; + } + + + namespace swig { + template <> struct traits<std::pair< int, CdiGrid > > { + typedef pointer_category category; + static const char* type_name() { + return "std::pair<" "int" "," "CdiGrid" " >"; + } + }; + } + + + namespace swig { + template <> struct traits<std::map< int, CdiGrid, std::less< int >, std::allocator< std::pair< int const,CdiGrid > > > > { + typedef pointer_category category; + static const char* type_name() { + return "std::map<" "int" "," "CdiGrid" "," "std::less< int >" "," "std::allocator< std::pair< int const,CdiGrid > >" " >"; + } + }; + } + +SWIGINTERN std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > > *std_map_Sl_int_Sc_CdiGrid_Sg__dup(std::map< int,CdiGrid > *self){ + return new std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >(*self); + } +SWIGINTERN VALUE std_map_Sl_int_Sc_CdiGrid_Sg____delete__(std::map< int,CdiGrid > *self,std::map< int,CdiGrid >::key_type const &key){ + std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::iterator i = self->find(key); + if (i != self->end()) { + self->erase(i); + return swig::from( key ); + } + else { + return Qnil; + } + } +SWIGINTERN bool std_map_Sl_int_Sc_CdiGrid_Sg__has_key(std::map< int,CdiGrid > const *self,std::map< int,CdiGrid >::key_type const &key){ + std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::const_iterator i = self->find(key); + return i != self->end(); + } +SWIGINTERN VALUE std_map_Sl_int_Sc_CdiGrid_Sg__keys(std::map< int,CdiGrid > *self){ + std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::size_type size = self->size(); + int rubysize = (size <= (std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::size_type) INT_MAX) ? (int) size : -1; + if (rubysize < 0) { + SWIG_RUBY_THREAD_BEGIN_BLOCK; + rb_raise(rb_eRuntimeError, "map size not valid in Ruby"); + SWIG_RUBY_THREAD_END_BLOCK; + return Qnil; + } + VALUE ary = rb_ary_new2(rubysize); + std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::const_iterator i = self->begin(); + std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::const_iterator e = self->end(); + for ( ; i != e; ++i ) { + rb_ary_push( ary, swig::from(i->first) ); + } + return ary; + } +SWIGINTERN std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > > *std_map_Sl_int_Sc_CdiGrid_Sg__each(std::map< int,CdiGrid > *self){ + if ( !rb_block_given_p() ) + rb_raise( rb_eArgError, "no block given"); + + VALUE k, v; + std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::iterator i = self->begin(); + std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::iterator e = self->end(); + for ( ; i != e; ++i ) + { + const std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::key_type& key = i->first; + const std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::mapped_type& val = i->second; + + k = swig::from<std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::key_type>(key); + v = swig::from<std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::mapped_type>(val); + rb_yield_values(2, k, v); + } + + return self; + } +SWIGINTERN std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > > *std_map_Sl_int_Sc_CdiGrid_Sg__select(std::map< int,CdiGrid > *self){ + if ( !rb_block_given_p() ) + rb_raise( rb_eArgError, "no block given" ); + + std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >* r = new std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >; + std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::iterator i = self->begin(); + std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::iterator e = self->end(); + for ( ; i != e; ++i ) + { + VALUE k = swig::from<std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::key_type>(i->first); + VALUE v = swig::from<std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::mapped_type>(i->second); + if ( RTEST( rb_yield_values(2, k, v) ) ) + self->insert(r->end(), *i); + } + + return r; + } +SWIGINTERN VALUE std_map_Sl_int_Sc_CdiGrid_Sg__values_at(std::map< int,CdiGrid > *self,int argc,VALUE *argv,...){ + + VALUE r = rb_ary_new(); + ID id = rb_intern("[]"); + swig_type_info* type = swig::type_info< std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > > >(); + VALUE me = SWIG_NewPointerObj( self, type, 0 ); + for ( int i = 0; i < argc; ++i ) + { + VALUE key = argv[i]; + VALUE tmp = rb_funcall( me, id, 1, key ); + rb_ary_push( r, tmp ); + } + + return r; + } +SWIGINTERN std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > > *std_map_Sl_int_Sc_CdiGrid_Sg__each_key(std::map< int,CdiGrid > *self){ + if ( !rb_block_given_p() ) + rb_raise( rb_eArgError, "no block given"); + + VALUE r; + std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::iterator i = self->begin(); + std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::iterator e = self->end(); + for ( ; i != e; ++i ) + { + r = swig::from( i->first ); + rb_yield(r); + } + + return self; + } +SWIGINTERN VALUE std_map_Sl_int_Sc_CdiGrid_Sg__values(std::map< int,CdiGrid > *self){ + std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::size_type size = self->size(); + int rubysize = (size <= (std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::size_type) INT_MAX) ? (int) size : -1; + if (rubysize < 0) { + SWIG_RUBY_THREAD_BEGIN_BLOCK; + rb_raise(rb_eRuntimeError, "map size not valid in Ruby"); + SWIG_RUBY_THREAD_END_BLOCK; + return Qnil; + } + VALUE ary = rb_ary_new2(rubysize); + std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::const_iterator i = self->begin(); + std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::const_iterator e = self->end(); + for ( ; i != e; ++i ) { + rb_ary_push( ary, swig::from(i->second) ); + } + return ary; + } +SWIGINTERN std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > > *std_map_Sl_int_Sc_CdiGrid_Sg__each_value(std::map< int,CdiGrid > *self){ + if ( !rb_block_given_p() ) + rb_raise( rb_eArgError, "no block given"); + + VALUE r; + std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::iterator i = self->begin(); + std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::iterator e = self->end(); + for ( ; i != e; ++i ) + { + r = swig::from( i->second ); + rb_yield(r); + } + + return self; + } +SWIGINTERN VALUE std_map_Sl_int_Sc_CdiGrid_Sg__entries(std::map< int,CdiGrid > *self){ + std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::size_type size = self->size(); + int rubysize = (size <= (std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::size_type) INT_MAX) ? (int) size : -1; + if (rubysize < 0) { + SWIG_RUBY_THREAD_BEGIN_BLOCK; + rb_raise(rb_eRuntimeError, "map size not valid in Ruby"); + SWIG_RUBY_THREAD_END_BLOCK; + return Qnil; + } + VALUE ary = rb_ary_new2(rubysize); + std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::const_iterator i = self->begin(); + std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::const_iterator e = self->end(); + for ( ; i != e; ++i ) { + rb_ary_push( ary, swig::from<std::pair<std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::key_type, + std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::mapped_type> >(*i) ); + } + return ary; + } +SWIGINTERN bool std_map_Sl_int_Sc_CdiGrid_Sg____contains__(std::map< int,CdiGrid > *self,std::map< int,CdiGrid >::key_type const &key){ + return self->find(key) != self->end(); + } +SWIGINTERN swig::ConstIterator *std_map_Sl_int_Sc_CdiGrid_Sg__key_iterator(std::map< int,CdiGrid > *self,VALUE *RUBY_SELF){ + return swig::make_output_key_iterator(self->begin(), self->begin(), + self->end(), *RUBY_SELF); + } +SWIGINTERN swig::ConstIterator *std_map_Sl_int_Sc_CdiGrid_Sg__value_iterator(std::map< int,CdiGrid > *self,VALUE *RUBY_SELF){ + return swig::make_output_value_iterator(self->begin(), self->begin(), + self->end(), *RUBY_SELF); + } +SWIGINTERN VALUE std_map_Sl_int_Sc_CdiGrid_Sg____getitem__(std::map< int,CdiGrid > const *self,std::map< int,CdiGrid >::key_type const &key){ + std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::const_iterator i = self->find(key); + if ( i != self->end() ) + return swig::from<std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::mapped_type>( i->second ); + else + return Qnil; + } +SWIGINTERN void std_map_Sl_int_Sc_CdiGrid_Sg____setitem__(std::map< int,CdiGrid > *self,std::map< int,CdiGrid >::key_type const &key,std::map< int,CdiGrid >::mapped_type const &x){ + (*self)[key] = x; + } +SWIGINTERN VALUE std_map_Sl_int_Sc_CdiGrid_Sg__inspect(std::map< int,CdiGrid > *self){ + std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::const_iterator i = self->begin(); + std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::const_iterator e = self->end(); + const char *type_name = swig::type_name< std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > > >(); + VALUE str = rb_str_new2( type_name ); + str = rb_str_cat2( str, " {" ); + bool comma = false; + VALUE tmp; + for ( ; i != e; ++i, comma = true ) + { + if (comma) str = rb_str_cat2( str, "," ); + tmp = swig::from< std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::key_type >( i->first ); + tmp = rb_inspect( tmp ); + str = rb_str_buf_append( str, tmp ); + str = rb_str_cat2( str, "=>" ); + tmp = swig::from< std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::mapped_type >( i->second ); + tmp = rb_inspect( tmp ); + str = rb_str_buf_append( str, tmp ); + } + str = rb_str_cat2( str, "}" ); + return str; + } +SWIGINTERN VALUE std_map_Sl_int_Sc_CdiGrid_Sg__to_a(std::map< int,CdiGrid > *self){ + std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::const_iterator i = self->begin(); + std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::const_iterator e = self->end(); + VALUE ary = rb_ary_new2( std::distance( i, e ) ); + VALUE tmp; + for ( ; i != e; ++i ) + { + // @todo: improve -- this should just be swig::from(*i) + tmp = swig::from< std::pair<std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::key_type, + std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::mapped_type> >( *i ); + rb_ary_push( ary, tmp ); + } + return ary; + } +SWIGINTERN VALUE std_map_Sl_int_Sc_CdiGrid_Sg__to_s(std::map< int,CdiGrid > *self){ + std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::iterator i = self->begin(); + std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::iterator e = self->end(); + VALUE str = rb_str_new2( "" ); + VALUE tmp; + for ( ; i != e; ++i ) + { + // @todo: improve -- this should just be swig::from(*i) + tmp = swig::from< std::pair<std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::key_type, + std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::mapped_type> >( *i ); + tmp = rb_obj_as_string( tmp ); + str = rb_str_buf_append( str, tmp ); + } + return str; + } +SWIGINTERN void std_map_Sl_int_Sc_CdiGrid_Sg__erase__SWIG_1(std::map< int,CdiGrid > *self,std::map< int,CdiGrid >::iterator position){ self->erase(position); } +SWIGINTERN void std_map_Sl_int_Sc_CdiGrid_Sg__erase__SWIG_2(std::map< int,CdiGrid > *self,std::map< int,CdiGrid >::iterator first,std::map< int,CdiGrid >::iterator last){ self->erase(first, last); } + +SWIGINTERN int +SWIG_AsVal_bool (VALUE obj, bool *val) +{ + if (obj == Qtrue) { + if (val) *val = true; + return SWIG_OK; + } else if (obj == Qfalse) { + if (val) *val = false; + return SWIG_OK; + } else { + int res = 0; + if (SWIG_AsVal_int (obj, &res) == SWIG_OK) { + if (val) *val = res ? true : false; + return SWIG_OK; + } + } + return SWIG_TypeError; +} + + +SWIGINTERN int +SWIG_AsCharArray(VALUE obj, char *val, size_t size) +{ + char* cptr = 0; size_t csize = 0; int alloc = SWIG_OLDOBJ; + int res = SWIG_AsCharPtrAndSize(obj, &cptr, &csize, &alloc); + if (SWIG_IsOK(res)) { + /* special case of single char conversion when we don't need space for NUL */ + if (size == 1 && csize == 2 && cptr && !cptr[1]) --csize; + if (csize <= size) { + if (val) { + if (csize) memcpy(val, cptr, csize*sizeof(char)); + if (csize < size) memset(val + csize, 0, (size - csize)*sizeof(char)); + } + if (alloc == SWIG_NEWOBJ) { + delete[] cptr; + res = SWIG_DelNewMask(res); + } + return res; + } + if (alloc == SWIG_NEWOBJ) delete[] cptr; + } + return SWIG_TypeError; +} + + +SWIGINTERN size_t +SWIG_strnlen(const char* s, size_t maxlen) +{ + const char *p; + for (p = s; maxlen-- && *p; p++) + ; + return p - s; +} + + + + + +SWIGINTERNINLINE VALUE +SWIG_FromCharPtr(const char *cptr) +{ + return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0)); +} + +static swig_class SwigClassGC_VALUE; + +/* + Document-method: Cdi::GC_VALUE.inspect + + call-seq: + inspect -> VALUE + +Inspect class and its contents. +*/ +SWIGINTERN VALUE +_wrap_GC_VALUE_inspect(int argc, VALUE *argv, VALUE self) { + swig::GC_VALUE *arg1 = (swig::GC_VALUE *) 0 ; + swig::GC_VALUE r1 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + r1 = self; arg1 = &r1; + result = (VALUE)((swig::GC_VALUE const *)arg1)->inspect(); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::GC_VALUE.to_s + + call-seq: + to_s -> VALUE + +Convert class to a String representation. +*/ +SWIGINTERN VALUE +_wrap_GC_VALUE_to_s(int argc, VALUE *argv, VALUE self) { + swig::GC_VALUE *arg1 = (swig::GC_VALUE *) 0 ; + swig::GC_VALUE r1 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + r1 = self; arg1 = &r1; + result = (VALUE)((swig::GC_VALUE const *)arg1)->to_s(); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +static swig_class SwigClassConstIterator; + +SWIGINTERN void +free_swig_ConstIterator(void *self) { + swig::ConstIterator *arg1 = (swig::ConstIterator *)self; + delete arg1; +} + +SWIGINTERN VALUE +_wrap_ConstIterator_value(int argc, VALUE *argv, VALUE self) { + swig::ConstIterator *arg1 = (swig::ConstIterator *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__ConstIterator, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::ConstIterator const *","value", 1, self )); + } + arg1 = reinterpret_cast< swig::ConstIterator * >(argp1); + try { + result = (VALUE)((swig::ConstIterator const *)arg1)->value(); + } catch(swig::stop_iteration &_e) { + { + (void)_e; + SWIG_Ruby_ExceptionType(NULL, Qnil); + SWIG_fail; + } + } + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::ConstIterator.dup + + call-seq: + dup -> ConstIterator + +Create a duplicate of the class and unfreeze it if needed. +*/ +SWIGINTERN VALUE +_wrap_ConstIterator_dup(int argc, VALUE *argv, VALUE self) { + swig::ConstIterator *arg1 = (swig::ConstIterator *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + swig::ConstIterator *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__ConstIterator, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::ConstIterator const *","dup", 1, self )); + } + arg1 = reinterpret_cast< swig::ConstIterator * >(argp1); + result = (swig::ConstIterator *)((swig::ConstIterator const *)arg1)->dup(); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__ConstIterator, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::ConstIterator.inspect + + call-seq: + inspect -> VALUE + +Inspect class and its contents. +*/ +SWIGINTERN VALUE +_wrap_ConstIterator_inspect(int argc, VALUE *argv, VALUE self) { + swig::ConstIterator *arg1 = (swig::ConstIterator *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__ConstIterator, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::ConstIterator const *","inspect", 1, self )); + } + arg1 = reinterpret_cast< swig::ConstIterator * >(argp1); + result = (VALUE)((swig::ConstIterator const *)arg1)->inspect(); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::ConstIterator.to_s + + call-seq: + to_s -> VALUE + +Convert class to a String representation. +*/ +SWIGINTERN VALUE +_wrap_ConstIterator_to_s(int argc, VALUE *argv, VALUE self) { + swig::ConstIterator *arg1 = (swig::ConstIterator *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__ConstIterator, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::ConstIterator const *","to_s", 1, self )); + } + arg1 = reinterpret_cast< swig::ConstIterator * >(argp1); + result = (VALUE)((swig::ConstIterator const *)arg1)->to_s(); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_ConstIterator_next__SWIG_0(int argc, VALUE *argv, VALUE self) { + swig::ConstIterator *arg1 = (swig::ConstIterator *) 0 ; + size_t arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + size_t val2 ; + int ecode2 = 0 ; + swig::ConstIterator *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__ConstIterator, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::ConstIterator *","next", 1, self )); + } + arg1 = reinterpret_cast< swig::ConstIterator * >(argp1); + ecode2 = SWIG_AsVal_size_t(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "size_t","next", 2, argv[0] )); + } + arg2 = static_cast< size_t >(val2); + result = (swig::ConstIterator *)(arg1)->next(arg2); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__ConstIterator, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_ConstIterator_next__SWIG_1(int argc, VALUE *argv, VALUE self) { + swig::ConstIterator *arg1 = (swig::ConstIterator *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + swig::ConstIterator *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__ConstIterator, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::ConstIterator *","next", 1, self )); + } + arg1 = reinterpret_cast< swig::ConstIterator * >(argp1); + try { + result = (swig::ConstIterator *)(arg1)->next(); + } catch(swig::stop_iteration &_e) { + { + (void)_e; + SWIG_Ruby_ExceptionType(NULL, Qnil); + SWIG_fail; + } + } + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__ConstIterator, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE _wrap_ConstIterator_next(int nargs, VALUE *args, VALUE self) { + int argc; + VALUE argv[3]; + int ii; + + argc = nargs + 1; + argv[0] = self; + if (argc > 3) SWIG_fail; + for (ii = 1; (ii < argc); ++ii) { + argv[ii] = args[ii-1]; + } + if (argc == 1) { + int _v; + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__ConstIterator, 0); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_ConstIterator_next__SWIG_1(nargs, args, self); + } + } + if (argc == 2) { + int _v; + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__ConstIterator, 0); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_size_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_ConstIterator_next__SWIG_0(nargs, args, self); + } + } + } + +fail: + Ruby_Format_OverloadedError( argc, 3, "ConstIterator.next", + " swig::ConstIterator ConstIterator.next(size_t n)\n" + " swig::ConstIterator * ConstIterator.next()\n"); + + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_ConstIterator_previous__SWIG_0(int argc, VALUE *argv, VALUE self) { + swig::ConstIterator *arg1 = (swig::ConstIterator *) 0 ; + size_t arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + size_t val2 ; + int ecode2 = 0 ; + swig::ConstIterator *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__ConstIterator, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::ConstIterator *","previous", 1, self )); + } + arg1 = reinterpret_cast< swig::ConstIterator * >(argp1); + ecode2 = SWIG_AsVal_size_t(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "size_t","previous", 2, argv[0] )); + } + arg2 = static_cast< size_t >(val2); + result = (swig::ConstIterator *)(arg1)->previous(arg2); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__ConstIterator, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_ConstIterator_previous__SWIG_1(int argc, VALUE *argv, VALUE self) { + swig::ConstIterator *arg1 = (swig::ConstIterator *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + swig::ConstIterator *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__ConstIterator, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::ConstIterator *","previous", 1, self )); + } + arg1 = reinterpret_cast< swig::ConstIterator * >(argp1); + try { + result = (swig::ConstIterator *)(arg1)->previous(); + } catch(swig::stop_iteration &_e) { + { + (void)_e; + SWIG_Ruby_ExceptionType(NULL, Qnil); + SWIG_fail; + } + } + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__ConstIterator, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE _wrap_ConstIterator_previous(int nargs, VALUE *args, VALUE self) { + int argc; + VALUE argv[3]; + int ii; + + argc = nargs + 1; + argv[0] = self; + if (argc > 3) SWIG_fail; + for (ii = 1; (ii < argc); ++ii) { + argv[ii] = args[ii-1]; + } + if (argc == 1) { + int _v; + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__ConstIterator, 0); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_ConstIterator_previous__SWIG_1(nargs, args, self); + } + } + if (argc == 2) { + int _v; + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__ConstIterator, 0); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_size_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_ConstIterator_previous__SWIG_0(nargs, args, self); + } + } + } + +fail: + Ruby_Format_OverloadedError( argc, 3, "ConstIterator.previous", + " swig::ConstIterator ConstIterator.previous(size_t n)\n" + " swig::ConstIterator * ConstIterator.previous()\n"); + + return Qnil; +} + + +/* + Document-method: Cdi::ConstIterator.== + + call-seq: + ==(x) -> bool + +Equality comparison operator. +*/ +SWIGINTERN VALUE +_wrap_ConstIterator___eq__(int argc, VALUE *argv, VALUE self) { + swig::ConstIterator *arg1 = (swig::ConstIterator *) 0 ; + swig::ConstIterator *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 ; + int res2 = 0 ; + bool result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__ConstIterator, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::ConstIterator const *","operator ==", 1, self )); + } + arg1 = reinterpret_cast< swig::ConstIterator * >(argp1); + res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_swig__ConstIterator, 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "swig::ConstIterator const &","operator ==", 2, argv[0] )); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "swig::ConstIterator const &","operator ==", 2, argv[0])); + } + arg2 = reinterpret_cast< swig::ConstIterator * >(argp2); + result = (bool)((swig::ConstIterator const *)arg1)->operator ==((swig::ConstIterator const &)*arg2); + vresult = SWIG_From_bool(static_cast< bool >(result)); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::ConstIterator.+ + + call-seq: + +(n) -> ConstIterator + +Add operator. +*/ +SWIGINTERN VALUE +_wrap_ConstIterator___add__(int argc, VALUE *argv, VALUE self) { + swig::ConstIterator *arg1 = (swig::ConstIterator *) 0 ; + ptrdiff_t arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + swig::ConstIterator *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__ConstIterator, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::ConstIterator const *","operator +", 1, self )); + } + arg1 = reinterpret_cast< swig::ConstIterator * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "ptrdiff_t","operator +", 2, argv[0] )); + } + arg2 = static_cast< ptrdiff_t >(val2); + try { + result = (swig::ConstIterator *)((swig::ConstIterator const *)arg1)->operator +(arg2); + } catch(swig::stop_iteration &_e) { + { + (void)_e; + SWIG_Ruby_ExceptionType(NULL, Qnil); + SWIG_fail; + } + } + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__ConstIterator, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::ConstIterator.- + + call-seq: + -(n) -> ConstIterator + -(x) -> ptrdiff_t + +Substraction operator. +*/ +SWIGINTERN VALUE +_wrap_ConstIterator___sub____SWIG_0(int argc, VALUE *argv, VALUE self) { + swig::ConstIterator *arg1 = (swig::ConstIterator *) 0 ; + ptrdiff_t arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + swig::ConstIterator *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__ConstIterator, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::ConstIterator const *","operator -", 1, self )); + } + arg1 = reinterpret_cast< swig::ConstIterator * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "ptrdiff_t","operator -", 2, argv[0] )); + } + arg2 = static_cast< ptrdiff_t >(val2); + try { + result = (swig::ConstIterator *)((swig::ConstIterator const *)arg1)->operator -(arg2); + } catch(swig::stop_iteration &_e) { + { + (void)_e; + SWIG_Ruby_ExceptionType(NULL, Qnil); + SWIG_fail; + } + } + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__ConstIterator, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_ConstIterator___sub____SWIG_1(int argc, VALUE *argv, VALUE self) { + swig::ConstIterator *arg1 = (swig::ConstIterator *) 0 ; + swig::ConstIterator *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 ; + int res2 = 0 ; + ptrdiff_t result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__ConstIterator, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::ConstIterator const *","operator -", 1, self )); + } + arg1 = reinterpret_cast< swig::ConstIterator * >(argp1); + res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_swig__ConstIterator, 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "swig::ConstIterator const &","operator -", 2, argv[0] )); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "swig::ConstIterator const &","operator -", 2, argv[0])); + } + arg2 = reinterpret_cast< swig::ConstIterator * >(argp2); + result = ((swig::ConstIterator const *)arg1)->operator -((swig::ConstIterator const &)*arg2); + vresult = SWIG_From_ptrdiff_t(static_cast< ptrdiff_t >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE _wrap_ConstIterator___sub__(int nargs, VALUE *args, VALUE self) { + int argc; + VALUE argv[3]; + int ii; + + argc = nargs + 1; + argv[0] = self; + if (argc > 3) SWIG_fail; + for (ii = 1; (ii < argc); ++ii) { + argv[ii] = args[ii-1]; + } + if (argc == 2) { + int _v; + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__ConstIterator, 0); + _v = SWIG_CheckState(res); + if (_v) { + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_swig__ConstIterator, SWIG_POINTER_NO_NULL); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_ConstIterator___sub____SWIG_1(nargs, args, self); + } + } + } + if (argc == 2) { + int _v; + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__ConstIterator, 0); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_ConstIterator___sub____SWIG_0(nargs, args, self); + } + } + } + +fail: + Ruby_Format_OverloadedError( argc, 3, "ConstIterator.__sub__", + " swig::ConstIterator ConstIterator.__sub__(ptrdiff_t n)\n" + " ptrdiff_t ConstIterator.__sub__(swig::ConstIterator const &x)\n"); + + return Qnil; +} + + +static swig_class SwigClassIterator; + +SWIGINTERN VALUE +_wrap_Iterator_valuee___(int argc, VALUE *argv, VALUE self) { + swig::Iterator *arg1 = (swig::Iterator *) 0 ; + VALUE *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE temp2 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__Iterator, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::Iterator *","setValue", 1, self )); + } + arg1 = reinterpret_cast< swig::Iterator * >(argp1); + temp2 = static_cast< VALUE >(argv[0]); + arg2 = &temp2; + result = (VALUE)(arg1)->setValue((VALUE const &)*arg2); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::Iterator.dup + + call-seq: + dup -> Iterator + +Create a duplicate of the class and unfreeze it if needed. +*/ +SWIGINTERN VALUE +_wrap_Iterator_dup(int argc, VALUE *argv, VALUE self) { + swig::Iterator *arg1 = (swig::Iterator *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + swig::Iterator *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__Iterator, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::Iterator const *","dup", 1, self )); + } + arg1 = reinterpret_cast< swig::Iterator * >(argp1); + result = (swig::Iterator *)((swig::Iterator const *)arg1)->dup(); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__Iterator, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_Iterator_next__SWIG_0(int argc, VALUE *argv, VALUE self) { + swig::Iterator *arg1 = (swig::Iterator *) 0 ; + size_t arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + size_t val2 ; + int ecode2 = 0 ; + swig::Iterator *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__Iterator, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::Iterator *","next", 1, self )); + } + arg1 = reinterpret_cast< swig::Iterator * >(argp1); + ecode2 = SWIG_AsVal_size_t(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "size_t","next", 2, argv[0] )); + } + arg2 = static_cast< size_t >(val2); + result = (swig::Iterator *)(arg1)->next(arg2); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__Iterator, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_Iterator_next__SWIG_1(int argc, VALUE *argv, VALUE self) { + swig::Iterator *arg1 = (swig::Iterator *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + swig::Iterator *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__Iterator, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::Iterator *","next", 1, self )); + } + arg1 = reinterpret_cast< swig::Iterator * >(argp1); + try { + result = (swig::Iterator *)(arg1)->next(); + } catch(swig::stop_iteration &_e) { + { + (void)_e; + SWIG_Ruby_ExceptionType(NULL, Qnil); + SWIG_fail; + } + } + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__Iterator, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE _wrap_Iterator_next(int nargs, VALUE *args, VALUE self) { + int argc; + VALUE argv[3]; + int ii; + + argc = nargs + 1; + argv[0] = self; + if (argc > 3) SWIG_fail; + for (ii = 1; (ii < argc); ++ii) { + argv[ii] = args[ii-1]; + } + if (argc == 1) { + int _v; + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__Iterator, 0); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_Iterator_next__SWIG_1(nargs, args, self); + } + } + if (argc == 2) { + int _v; + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__Iterator, 0); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_size_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_Iterator_next__SWIG_0(nargs, args, self); + } + } + } + +fail: + Ruby_Format_OverloadedError( argc, 3, "Iterator.next", + " swig::Iterator Iterator.next(size_t n)\n" + " swig::Iterator * Iterator.next()\n"); + + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_Iterator_previous__SWIG_0(int argc, VALUE *argv, VALUE self) { + swig::Iterator *arg1 = (swig::Iterator *) 0 ; + size_t arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + size_t val2 ; + int ecode2 = 0 ; + swig::Iterator *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__Iterator, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::Iterator *","previous", 1, self )); + } + arg1 = reinterpret_cast< swig::Iterator * >(argp1); + ecode2 = SWIG_AsVal_size_t(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "size_t","previous", 2, argv[0] )); + } + arg2 = static_cast< size_t >(val2); + result = (swig::Iterator *)(arg1)->previous(arg2); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__Iterator, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_Iterator_previous__SWIG_1(int argc, VALUE *argv, VALUE self) { + swig::Iterator *arg1 = (swig::Iterator *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + swig::Iterator *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__Iterator, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::Iterator *","previous", 1, self )); + } + arg1 = reinterpret_cast< swig::Iterator * >(argp1); + try { + result = (swig::Iterator *)(arg1)->previous(); + } catch(swig::stop_iteration &_e) { + { + (void)_e; + SWIG_Ruby_ExceptionType(NULL, Qnil); + SWIG_fail; + } + } + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__Iterator, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE _wrap_Iterator_previous(int nargs, VALUE *args, VALUE self) { + int argc; + VALUE argv[3]; + int ii; + + argc = nargs + 1; + argv[0] = self; + if (argc > 3) SWIG_fail; + for (ii = 1; (ii < argc); ++ii) { + argv[ii] = args[ii-1]; + } + if (argc == 1) { + int _v; + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__Iterator, 0); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_Iterator_previous__SWIG_1(nargs, args, self); + } + } + if (argc == 2) { + int _v; + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__Iterator, 0); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_size_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_Iterator_previous__SWIG_0(nargs, args, self); + } + } + } + +fail: + Ruby_Format_OverloadedError( argc, 3, "Iterator.previous", + " swig::Iterator Iterator.previous(size_t n)\n" + " swig::Iterator * Iterator.previous()\n"); + + return Qnil; +} + + +/* + Document-method: Cdi::Iterator.inspect + + call-seq: + inspect -> VALUE + +Inspect class and its contents. +*/ +SWIGINTERN VALUE +_wrap_Iterator_inspect(int argc, VALUE *argv, VALUE self) { + swig::Iterator *arg1 = (swig::Iterator *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__Iterator, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::Iterator const *","inspect", 1, self )); + } + arg1 = reinterpret_cast< swig::Iterator * >(argp1); + result = (VALUE)((swig::Iterator const *)arg1)->inspect(); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::Iterator.to_s + + call-seq: + to_s -> VALUE + +Convert class to a String representation. +*/ +SWIGINTERN VALUE +_wrap_Iterator_to_s(int argc, VALUE *argv, VALUE self) { + swig::Iterator *arg1 = (swig::Iterator *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__Iterator, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::Iterator const *","to_s", 1, self )); + } + arg1 = reinterpret_cast< swig::Iterator * >(argp1); + result = (VALUE)((swig::Iterator const *)arg1)->to_s(); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::Iterator.== + + call-seq: + ==(x) -> bool + +Equality comparison operator. +*/ +SWIGINTERN VALUE +_wrap_Iterator___eq__(int argc, VALUE *argv, VALUE self) { + swig::Iterator *arg1 = (swig::Iterator *) 0 ; + swig::Iterator *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 ; + int res2 = 0 ; + bool result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__Iterator, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::Iterator const *","operator ==", 1, self )); + } + arg1 = reinterpret_cast< swig::Iterator * >(argp1); + res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_swig__Iterator, 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "swig::Iterator const &","operator ==", 2, argv[0] )); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "swig::Iterator const &","operator ==", 2, argv[0])); + } + arg2 = reinterpret_cast< swig::Iterator * >(argp2); + result = (bool)((swig::Iterator const *)arg1)->operator ==((swig::Iterator const &)*arg2); + vresult = SWIG_From_bool(static_cast< bool >(result)); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::Iterator.+ + + call-seq: + +(n) -> Iterator + +Add operator. +*/ +SWIGINTERN VALUE +_wrap_Iterator___add__(int argc, VALUE *argv, VALUE self) { + swig::Iterator *arg1 = (swig::Iterator *) 0 ; + ptrdiff_t arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + swig::Iterator *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__Iterator, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::Iterator const *","operator +", 1, self )); + } + arg1 = reinterpret_cast< swig::Iterator * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "ptrdiff_t","operator +", 2, argv[0] )); + } + arg2 = static_cast< ptrdiff_t >(val2); + try { + result = (swig::Iterator *)((swig::Iterator const *)arg1)->operator +(arg2); + } catch(swig::stop_iteration &_e) { + { + (void)_e; + SWIG_Ruby_ExceptionType(NULL, Qnil); + SWIG_fail; + } + } + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__Iterator, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::Iterator.- + + call-seq: + -(n) -> Iterator + -(x) -> ptrdiff_t + +Substraction operator. +*/ +SWIGINTERN VALUE +_wrap_Iterator___sub____SWIG_0(int argc, VALUE *argv, VALUE self) { + swig::Iterator *arg1 = (swig::Iterator *) 0 ; + ptrdiff_t arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + swig::Iterator *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__Iterator, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::Iterator const *","operator -", 1, self )); + } + arg1 = reinterpret_cast< swig::Iterator * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "ptrdiff_t","operator -", 2, argv[0] )); + } + arg2 = static_cast< ptrdiff_t >(val2); + try { + result = (swig::Iterator *)((swig::Iterator const *)arg1)->operator -(arg2); + } catch(swig::stop_iteration &_e) { + { + (void)_e; + SWIG_Ruby_ExceptionType(NULL, Qnil); + SWIG_fail; + } + } + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__Iterator, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_Iterator___sub____SWIG_1(int argc, VALUE *argv, VALUE self) { + swig::Iterator *arg1 = (swig::Iterator *) 0 ; + swig::Iterator *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 ; + int res2 = 0 ; + ptrdiff_t result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__Iterator, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::Iterator const *","operator -", 1, self )); + } + arg1 = reinterpret_cast< swig::Iterator * >(argp1); + res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_swig__Iterator, 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "swig::Iterator const &","operator -", 2, argv[0] )); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "swig::Iterator const &","operator -", 2, argv[0])); + } + arg2 = reinterpret_cast< swig::Iterator * >(argp2); + result = ((swig::Iterator const *)arg1)->operator -((swig::Iterator const &)*arg2); + vresult = SWIG_From_ptrdiff_t(static_cast< ptrdiff_t >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE _wrap_Iterator___sub__(int nargs, VALUE *args, VALUE self) { + int argc; + VALUE argv[3]; + int ii; + + argc = nargs + 1; + argv[0] = self; + if (argc > 3) SWIG_fail; + for (ii = 1; (ii < argc); ++ii) { + argv[ii] = args[ii-1]; + } + if (argc == 2) { + int _v; + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__Iterator, 0); + _v = SWIG_CheckState(res); + if (_v) { + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_swig__Iterator, SWIG_POINTER_NO_NULL); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_Iterator___sub____SWIG_1(nargs, args, self); + } + } + } + if (argc == 2) { + int _v; + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__Iterator, 0); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_Iterator___sub____SWIG_0(nargs, args, self); + } + } + } + +fail: + Ruby_Format_OverloadedError( argc, 3, "Iterator.__sub__", + " swig::Iterator Iterator.__sub__(ptrdiff_t n)\n" + " ptrdiff_t Iterator.__sub__(swig::Iterator const &x)\n"); + + return Qnil; +} + + +SWIGINTERN void +free_swig_Iterator(void *self) { + swig::Iterator *arg1 = (swig::Iterator *)self; + delete arg1; +} + +static swig_class SwigClassIntVector; + +/* + Document-method: Cdi::IntVector.dup + + call-seq: + dup -> IntVector + +Create a duplicate of the class and unfreeze it if needed. +*/ +SWIGINTERN VALUE +_wrap_IntVector_dup(int argc, VALUE *argv, VALUE self) { + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< int,std::allocator< int > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > *","dup", 1, self )); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + result = (std::vector< int,std::allocator< int > > *)std_vector_Sl_int_Sg__dup(arg1); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::IntVector.inspect + + call-seq: + inspect -> VALUE + +Inspect class and its contents. +*/ +SWIGINTERN VALUE +_wrap_IntVector_inspect(int argc, VALUE *argv, VALUE self) { + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > *","inspect", 1, self )); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + result = (VALUE)std_vector_Sl_int_Sg__inspect(arg1); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::IntVector.to_a + + call-seq: + to_a -> VALUE + +Convert IntVector to an Array. +*/ +SWIGINTERN VALUE +_wrap_IntVector_to_a(int argc, VALUE *argv, VALUE self) { + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > *","to_a", 1, self )); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + result = (VALUE)std_vector_Sl_int_Sg__to_a(arg1); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::IntVector.to_s + + call-seq: + to_s -> VALUE + +Convert class to a String representation. +*/ +SWIGINTERN VALUE +_wrap_IntVector_to_s(int argc, VALUE *argv, VALUE self) { + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > *","to_s", 1, self )); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + result = (VALUE)std_vector_Sl_int_Sg__to_s(arg1); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::IntVector.slice + + call-seq: + slice(i, length) -> VALUE + +Return a slice (portion of) the IntVector. +*/ +SWIGINTERN VALUE +_wrap_IntVector_slice(int argc, VALUE *argv, VALUE self) { + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + std::vector< int >::difference_type arg2 ; + std::vector< int >::difference_type arg3 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + ptrdiff_t val3 ; + int ecode3 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 2) || (argc > 2)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > *","slice", 1, self )); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< int >::difference_type","slice", 2, argv[0] )); + } + arg2 = static_cast< std::vector< int >::difference_type >(val2); + ecode3 = SWIG_AsVal_ptrdiff_t(argv[1], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "std::vector< int >::difference_type","slice", 3, argv[1] )); + } + arg3 = static_cast< std::vector< int >::difference_type >(val3); + try { + result = (VALUE)std_vector_Sl_int_Sg__slice(arg1,arg2,arg3); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::IntVector.each + + call-seq: + each -> IntVector + +Iterate thru each element in the IntVector. A block must be provided. +*/ +SWIGINTERN VALUE +_wrap_IntVector_each(int argc, VALUE *argv, VALUE self) { + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< int,std::allocator< int > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > *","each", 1, self )); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + result = (std::vector< int,std::allocator< int > > *)std_vector_Sl_int_Sg__each(arg1); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_IntVector___delete2__(int argc, VALUE *argv, VALUE self) { + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + std::vector< int >::value_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< int >::value_type temp2 ; + int val2 ; + int ecode2 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > *","__delete2__", 1, self )); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< int >::value_type","__delete2__", 2, argv[0] )); + } + temp2 = static_cast< std::vector< int >::value_type >(val2); + arg2 = &temp2; + result = (VALUE)std_vector_Sl_int_Sg____delete2__(arg1,(int const &)*arg2); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::IntVector.select + + call-seq: + select -> IntVector + +Iterate thru each element in the IntVector and select those that match a condition. A block must be provided. +*/ +SWIGINTERN VALUE +_wrap_IntVector_select(int argc, VALUE *argv, VALUE self) { + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< int,std::allocator< int > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > *","select", 1, self )); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + result = (std::vector< int,std::allocator< int > > *)std_vector_Sl_int_Sg__select(arg1); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::IntVector.delete_at + + call-seq: + delete_at(i) -> VALUE + +Delete an element at a certain index. +*/ +SWIGINTERN VALUE +_wrap_IntVector_delete_at(int argc, VALUE *argv, VALUE self) { + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + std::vector< int >::difference_type arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > *","delete_at", 1, self )); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< int >::difference_type","delete_at", 2, argv[0] )); + } + arg2 = static_cast< std::vector< int >::difference_type >(val2); + result = (VALUE)std_vector_Sl_int_Sg__delete_at(arg1,arg2); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::IntVector.at + + call-seq: + at(i) -> VALUE + +Return element at a certain index. +*/ +SWIGINTERN VALUE +_wrap_IntVector_at(int argc, VALUE *argv, VALUE self) { + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + std::vector< int >::difference_type arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > const *","at", 1, self )); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< int >::difference_type","at", 2, argv[0] )); + } + arg2 = static_cast< std::vector< int >::difference_type >(val2); + result = (VALUE)std_vector_Sl_int_Sg__at((std::vector< int > const *)arg1,arg2); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::IntVector.[] + + call-seq: + [](i, length) -> VALUE + [](i) -> VALUE + [](i) -> VALUE + +Element accessor/slicing. +*/ +SWIGINTERN VALUE +_wrap_IntVector___getitem____SWIG_0(int argc, VALUE *argv, VALUE self) { + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + std::vector< int >::difference_type arg2 ; + std::vector< int >::difference_type arg3 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + ptrdiff_t val3 ; + int ecode3 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 2) || (argc > 2)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > const *","__getitem__", 1, self )); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< int >::difference_type","__getitem__", 2, argv[0] )); + } + arg2 = static_cast< std::vector< int >::difference_type >(val2); + ecode3 = SWIG_AsVal_ptrdiff_t(argv[1], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "std::vector< int >::difference_type","__getitem__", 3, argv[1] )); + } + arg3 = static_cast< std::vector< int >::difference_type >(val3); + try { + result = (VALUE)std_vector_Sl_int_Sg____getitem____SWIG_0((std::vector< int > const *)arg1,arg2,arg3); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } + vresult = result; + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_IntVector___getitem____SWIG_1(int argc, VALUE *argv, VALUE self) { + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + std::vector< int >::difference_type arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > const *","__getitem__", 1, self )); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< int >::difference_type","__getitem__", 2, argv[0] )); + } + arg2 = static_cast< std::vector< int >::difference_type >(val2); + result = (VALUE)std_vector_Sl_int_Sg____getitem____SWIG_1((std::vector< int > const *)arg1,arg2); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_IntVector___getitem____SWIG_2(int argc, VALUE *argv, VALUE self) { + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + VALUE arg2 = (VALUE) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > const *","__getitem__", 1, self )); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + arg2 = argv[0]; + try { + result = (VALUE)std_vector_Sl_int_Sg____getitem____SWIG_2((std::vector< int > const *)arg1,arg2); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } + vresult = result; + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE _wrap_IntVector___getitem__(int nargs, VALUE *args, VALUE self) { + int argc; + VALUE argv[4]; + int ii; + + argc = nargs + 1; + argv[0] = self; + if (argc > 4) SWIG_fail; + for (ii = 1; (ii < argc); ++ii) { + argv[ii] = args[ii-1]; + } + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::vector< int,std::allocator< int > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_IntVector___getitem____SWIG_1(nargs, args, self); + } + } + } + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::vector< int,std::allocator< int > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + _v = (argv[1] != 0); + if (_v) { + return _wrap_IntVector___getitem____SWIG_2(nargs, args, self); + } + } + } + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::vector< int,std::allocator< int > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_IntVector___getitem____SWIG_0(nargs, args, self); + } + } + } + } + +fail: + Ruby_Format_OverloadedError( argc, 4, "__getitem__", + " VALUE __getitem__(std::vector< int >::difference_type i, std::vector< int >::difference_type length)\n" + " VALUE __getitem__(std::vector< int >::difference_type i)\n" + " VALUE __getitem__(VALUE i)\n"); + + return Qnil; +} + + +/* + Document-method: Cdi::IntVector.[]= + + call-seq: + []=(i, x) -> VALUE + []=(i, length, v) -> VALUE + +Element setter/slicing. +*/ +SWIGINTERN VALUE +_wrap_IntVector___setitem____SWIG_0(int argc, VALUE *argv, VALUE self) { + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + std::vector< int >::difference_type arg2 ; + std::vector< int >::value_type *arg3 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + std::vector< int >::value_type temp3 ; + int val3 ; + int ecode3 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 2) || (argc > 2)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > *","__setitem__", 1, self )); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< int >::difference_type","__setitem__", 2, argv[0] )); + } + arg2 = static_cast< std::vector< int >::difference_type >(val2); + ecode3 = SWIG_AsVal_int(argv[1], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "std::vector< int >::value_type","__setitem__", 3, argv[1] )); + } + temp3 = static_cast< std::vector< int >::value_type >(val3); + arg3 = &temp3; + try { + result = (VALUE)std_vector_Sl_int_Sg____setitem____SWIG_0(arg1,arg2,(int const &)*arg3); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } + vresult = result; + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_IntVector___setitem____SWIG_1(int argc, VALUE *argv, VALUE self) { + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + std::vector< int >::difference_type arg2 ; + std::vector< int >::difference_type arg3 ; + std::vector< int,std::allocator< int > > *arg4 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + ptrdiff_t val3 ; + int ecode3 = 0 ; + int res4 = SWIG_OLDOBJ ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 3) || (argc > 3)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > *","__setitem__", 1, self )); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< int >::difference_type","__setitem__", 2, argv[0] )); + } + arg2 = static_cast< std::vector< int >::difference_type >(val2); + ecode3 = SWIG_AsVal_ptrdiff_t(argv[1], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "std::vector< int >::difference_type","__setitem__", 3, argv[1] )); + } + arg3 = static_cast< std::vector< int >::difference_type >(val3); + { + std::vector< int,std::allocator< int > > *ptr = (std::vector< int,std::allocator< int > > *)0; + res4 = swig::asptr(argv[2], &ptr); + if (!SWIG_IsOK(res4)) { + SWIG_exception_fail(SWIG_ArgError(res4), Ruby_Format_TypeError( "", "std::vector< int,std::allocator< int > > const &","__setitem__", 4, argv[2] )); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::vector< int,std::allocator< int > > const &","__setitem__", 4, argv[2])); + } + arg4 = ptr; + } + try { + result = (VALUE)std_vector_Sl_int_Sg____setitem____SWIG_1(arg1,arg2,arg3,(std::vector< int,std::allocator< int > > const &)*arg4); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } + vresult = result; + if (SWIG_IsNewObj(res4)) delete arg4; + return vresult; +fail: + if (SWIG_IsNewObj(res4)) delete arg4; + return Qnil; +} + + +SWIGINTERN VALUE _wrap_IntVector___setitem__(int nargs, VALUE *args, VALUE self) { + int argc; + VALUE argv[5]; + int ii; + + argc = nargs + 1; + argv[0] = self; + if (argc > 5) SWIG_fail; + for (ii = 1; (ii < argc); ++ii) { + argv[ii] = args[ii-1]; + } + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::vector< int,std::allocator< int > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_IntVector___setitem____SWIG_0(nargs, args, self); + } + } + } + } + if (argc == 4) { + int _v; + int res = swig::asptr(argv[0], (std::vector< int,std::allocator< int > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + int res = swig::asptr(argv[3], (std::vector< int,std::allocator< int > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_IntVector___setitem____SWIG_1(nargs, args, self); + } + } + } + } + } + +fail: + Ruby_Format_OverloadedError( argc, 5, "__setitem__", + " VALUE __setitem__(std::vector< int >::difference_type i, std::vector< int >::value_type const &x)\n" + " VALUE __setitem__(std::vector< int >::difference_type i, std::vector< int >::difference_type length, std::vector< int,std::allocator< int > > const &v)\n"); + + return Qnil; +} + + +/* + Document-method: Cdi::IntVector.reject! + + call-seq: + reject! -> IntVector + +Iterate thru each element in the IntVector and reject those that fail a condition. A block must be provided. IntVector is modified in place. +*/ +SWIGINTERN VALUE +_wrap_IntVector_rejectN___(int argc, VALUE *argv, VALUE self) { + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< int,std::allocator< int > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > *","reject_bang", 1, self )); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + result = (std::vector< int,std::allocator< int > > *)std_vector_Sl_int_Sg__reject_bang(arg1); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::IntVector.pop + + call-seq: + pop -> VALUE + +Remove and return element at the end of the IntVector. +*/ +SWIGINTERN VALUE +_wrap_IntVector_pop(int argc, VALUE *argv, VALUE self) { + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > *","pop", 1, self )); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + result = (VALUE)std_vector_Sl_int_Sg__pop(arg1); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::IntVector.push + + call-seq: + push(e) -> std::vector< int >::value_type const + +Add an element at the end of the IntVector. +*/ +SWIGINTERN VALUE +_wrap_IntVector_push(int argc, VALUE *argv, VALUE self) { + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + std::vector< int >::value_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< int >::value_type temp2 ; + int val2 ; + int ecode2 = 0 ; + std::vector< int >::value_type result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > *","push", 1, self )); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< int >::value_type","push", 2, argv[0] )); + } + temp2 = static_cast< std::vector< int >::value_type >(val2); + arg2 = &temp2; + result = (std::vector< int >::value_type)std_vector_Sl_int_Sg__push(arg1,(int const &)*arg2); + vresult = SWIG_From_int(static_cast< int >(result)); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::IntVector.reject + + call-seq: + reject -> IntVector + +Iterate thru each element in the IntVector and reject those that fail a condition returning a new IntVector. A block must be provided. +*/ +SWIGINTERN VALUE +_wrap_IntVector_reject(int argc, VALUE *argv, VALUE self) { + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< int,std::allocator< int > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > *","reject", 1, self )); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + result = (std::vector< int,std::allocator< int > > *)std_vector_Sl_int_Sg__reject(arg1); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::IntVector.shift + + call-seq: + shift -> VALUE + +Remove and return element at the beginning of the IntVector. +*/ +SWIGINTERN VALUE +_wrap_IntVector_shift(int argc, VALUE *argv, VALUE self) { + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > *","shift", 1, self )); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + result = (VALUE)std_vector_Sl_int_Sg__shift(arg1); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::IntVector.insert + + call-seq: + insert(pos, argc) -> IntVector + insert(pos, x) -> std::vector< int >::iterator + insert(pos, n, x) + +Insert one or more new elements in the IntVector. +*/ +SWIGINTERN VALUE +_wrap_IntVector_insert__SWIG_0(int argc, VALUE *argv, VALUE self) { + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + std::vector< int >::difference_type arg2 ; + int arg3 ; + VALUE *arg4 = (VALUE *) 0 ; + void *arg5 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + std::vector< int,std::allocator< int > > *result = 0 ; + VALUE vresult = Qnil; + + if (argc < 2) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > *","insert", 1, self )); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< int >::difference_type","insert", 2, argv[0] )); + } + arg2 = static_cast< std::vector< int >::difference_type >(val2); + { + arg3 = argc - 1; + arg4 = argv + 1; + } + result = (std::vector< int,std::allocator< int > > *)std_vector_Sl_int_Sg__insert__SWIG_0(arg1,arg2,arg3,arg4,arg5); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::IntVector.unshift + + call-seq: + unshift(argc) -> IntVector + +Add one or more elements at the beginning of the IntVector. +*/ +SWIGINTERN VALUE +_wrap_IntVector_unshift(int argc, VALUE *argv, VALUE self) { + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + int arg2 ; + VALUE *arg3 = (VALUE *) 0 ; + void *arg4 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< int,std::allocator< int > > *result = 0 ; + VALUE vresult = Qnil; + + if (argc < 1) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > *","unshift", 1, self )); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + { + arg2 = argc; + arg3 = argv; + } + result = (std::vector< int,std::allocator< int > > *)std_vector_Sl_int_Sg__unshift(arg1,arg2,arg3,arg4); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_new_IntVector__SWIG_0(int argc, VALUE *argv, VALUE self) { + std::vector< int > *result = 0 ; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + result = (std::vector< int > *)new std::vector< int >(); + DATA_PTR(self) = result; + return self; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_new_IntVector__SWIG_1(int argc, VALUE *argv, VALUE self) { + std::vector< int > *arg1 = 0 ; + int res1 = SWIG_OLDOBJ ; + std::vector< int > *result = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + { + std::vector< int,std::allocator< int > > *ptr = (std::vector< int,std::allocator< int > > *)0; + res1 = swig::asptr(argv[0], &ptr); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > const &","vector<(int)>", 1, argv[0] )); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::vector< int > const &","vector<(int)>", 1, argv[0])); + } + arg1 = ptr; + } + result = (std::vector< int > *)new std::vector< int >((std::vector< int > const &)*arg1); + DATA_PTR(self) = result; + if (SWIG_IsNewObj(res1)) delete arg1; + return self; +fail: + if (SWIG_IsNewObj(res1)) delete arg1; + return Qnil; +} + + +/* + Document-method: Cdi::IntVector.empty? + + call-seq: + empty? -> bool + +Check if the IntVector is empty or not. +*/ +SWIGINTERN VALUE +_wrap_IntVector_emptyq___(int argc, VALUE *argv, VALUE self) { + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + bool result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > const *","empty", 1, self )); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + result = (bool)((std::vector< int > const *)arg1)->empty(); + vresult = SWIG_From_bool(static_cast< bool >(result)); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::IntVector.size + + call-seq: + size -> std::vector< int >::size_type + +Size or Length of the IntVector. +*/ +SWIGINTERN VALUE +_wrap_IntVector_size(int argc, VALUE *argv, VALUE self) { + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< int >::size_type result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > const *","size", 1, self )); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + result = ((std::vector< int > const *)arg1)->size(); + vresult = SWIG_From_size_t(static_cast< size_t >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_IntVector_swap(int argc, VALUE *argv, VALUE self) { + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + std::vector< int > *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > *","swap", 1, self )); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::vector< int > &","swap", 2, argv[0] )); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::vector< int > &","swap", 2, argv[0])); + } + arg2 = reinterpret_cast< std::vector< int > * >(argp2); + (arg1)->swap(*arg2); + return Qnil; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::IntVector.begin + + call-seq: + begin -> std::vector< int >::iterator + +Return an iterator to the beginning of the IntVector. +*/ +SWIGINTERN VALUE +_wrap_IntVector_begin(int argc, VALUE *argv, VALUE self) { + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< int >::iterator result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > *","begin", 1, self )); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + result = (arg1)->begin(); + vresult = SWIG_NewPointerObj(swig::make_nonconst_iterator(static_cast< const std::vector< int >::iterator & >(result), + self), + swig::Iterator::descriptor(),SWIG_POINTER_OWN); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::IntVector.end + + call-seq: + end -> std::vector< int >::iterator + +Return an iterator to past the end of the IntVector. +*/ +SWIGINTERN VALUE +_wrap_IntVector_end(int argc, VALUE *argv, VALUE self) { + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< int >::iterator result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > *","end", 1, self )); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + result = (arg1)->end(); + vresult = SWIG_NewPointerObj(swig::make_nonconst_iterator(static_cast< const std::vector< int >::iterator & >(result), + self), + swig::Iterator::descriptor(),SWIG_POINTER_OWN); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::IntVector.rbegin + + call-seq: + rbegin -> std::vector< int >::reverse_iterator + +Return a reverse iterator to the beginning (the end) of the IntVector. +*/ +SWIGINTERN VALUE +_wrap_IntVector_rbegin(int argc, VALUE *argv, VALUE self) { + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< int >::reverse_iterator result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > *","rbegin", 1, self )); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + result = (arg1)->rbegin(); + vresult = SWIG_NewPointerObj(swig::make_nonconst_iterator(static_cast< const std::vector< int >::reverse_iterator & >(result), + self), + swig::Iterator::descriptor(),SWIG_POINTER_OWN); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::IntVector.rend + + call-seq: + rend -> std::vector< int >::reverse_iterator + +Return a reverse iterator to past the end (past the beginning) of the IntVector. +*/ +SWIGINTERN VALUE +_wrap_IntVector_rend(int argc, VALUE *argv, VALUE self) { + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< int >::reverse_iterator result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > *","rend", 1, self )); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + result = (arg1)->rend(); + vresult = SWIG_NewPointerObj(swig::make_nonconst_iterator(static_cast< const std::vector< int >::reverse_iterator & >(result), + self), + swig::Iterator::descriptor(),SWIG_POINTER_OWN); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::IntVector.clear + + call-seq: + clear + +Clear IntVector contents. +*/ +SWIGINTERN VALUE +_wrap_IntVector_clear(int argc, VALUE *argv, VALUE self) { + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > *","clear", 1, self )); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + (arg1)->clear(); + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_IntVector_get_allocator(int argc, VALUE *argv, VALUE self) { + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + SwigValueWrapper< std::allocator< int > > result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > const *","get_allocator", 1, self )); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + result = ((std::vector< int > const *)arg1)->get_allocator(); + vresult = SWIG_NewPointerObj((new std::vector< int >::allocator_type(static_cast< const std::vector< int >::allocator_type& >(result))), SWIGTYPE_p_std__allocatorT_int_t, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_new_IntVector__SWIG_2(int argc, VALUE *argv, VALUE self) { + std::vector< int >::size_type arg1 ; + size_t val1 ; + int ecode1 = 0 ; + std::vector< int > *result = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + ecode1 = SWIG_AsVal_size_t(argv[0], &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "std::vector< int >::size_type","vector<(int)>", 1, argv[0] )); + } + arg1 = static_cast< std::vector< int >::size_type >(val1); + result = (std::vector< int > *)new std::vector< int >(arg1); + DATA_PTR(self) = result; + return self; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::IntVector.resize + + call-seq: + resize(new_size) + resize(new_size, x) + +Resize the size of the IntVector. +*/ +SWIGINTERN VALUE +_wrap_IntVector_resize__SWIG_0(int argc, VALUE *argv, VALUE self) { + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + std::vector< int >::size_type arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + size_t val2 ; + int ecode2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > *","resize", 1, self )); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + ecode2 = SWIG_AsVal_size_t(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< int >::size_type","resize", 2, argv[0] )); + } + arg2 = static_cast< std::vector< int >::size_type >(val2); + (arg1)->resize(arg2); + return Qnil; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::IntVector.erase + + call-seq: + erase(pos) -> std::vector< int >::iterator + erase(first, last) -> std::vector< int >::iterator + +Delete a portion of the IntVector. +*/ +SWIGINTERN VALUE +_wrap_IntVector_erase__SWIG_0(int argc, VALUE *argv, VALUE self) { + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + std::vector< int >::iterator arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + swig::Iterator *iter2 = 0 ; + int res2 ; + std::vector< int >::iterator result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > *","erase", 1, self )); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + res2 = SWIG_ConvertPtr(argv[0], SWIG_as_voidptrptr(&iter2), swig::Iterator::descriptor(), 0); + if (!SWIG_IsOK(res2) || !iter2) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), Ruby_Format_TypeError( "", "std::vector< int >::iterator","erase", 2, argv[0] )); + } else { + swig::Iterator_T<std::vector< int >::iterator > *iter_t = dynamic_cast<swig::Iterator_T<std::vector< int >::iterator > *>(iter2); + if (iter_t) { + arg2 = iter_t->get_current(); + } else { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), Ruby_Format_TypeError( "", "std::vector< int >::iterator","erase", 2, argv[0] )); + } + } + result = std_vector_Sl_int_Sg__erase__SWIG_0(arg1,arg2); + vresult = SWIG_NewPointerObj(swig::make_nonconst_iterator(static_cast< const std::vector< int >::iterator & >(result), + self), + swig::Iterator::descriptor(),SWIG_POINTER_OWN); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_IntVector_erase__SWIG_1(int argc, VALUE *argv, VALUE self) { + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + std::vector< int >::iterator arg2 ; + std::vector< int >::iterator arg3 ; + void *argp1 = 0 ; + int res1 = 0 ; + swig::Iterator *iter2 = 0 ; + int res2 ; + swig::Iterator *iter3 = 0 ; + int res3 ; + std::vector< int >::iterator result; + VALUE vresult = Qnil; + + if ((argc < 2) || (argc > 2)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > *","erase", 1, self )); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + res2 = SWIG_ConvertPtr(argv[0], SWIG_as_voidptrptr(&iter2), swig::Iterator::descriptor(), 0); + if (!SWIG_IsOK(res2) || !iter2) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), Ruby_Format_TypeError( "", "std::vector< int >::iterator","erase", 2, argv[0] )); + } else { + swig::Iterator_T<std::vector< int >::iterator > *iter_t = dynamic_cast<swig::Iterator_T<std::vector< int >::iterator > *>(iter2); + if (iter_t) { + arg2 = iter_t->get_current(); + } else { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), Ruby_Format_TypeError( "", "std::vector< int >::iterator","erase", 2, argv[0] )); + } + } + res3 = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter3), swig::Iterator::descriptor(), 0); + if (!SWIG_IsOK(res3) || !iter3) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), Ruby_Format_TypeError( "", "std::vector< int >::iterator","erase", 3, argv[1] )); + } else { + swig::Iterator_T<std::vector< int >::iterator > *iter_t = dynamic_cast<swig::Iterator_T<std::vector< int >::iterator > *>(iter3); + if (iter_t) { + arg3 = iter_t->get_current(); + } else { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), Ruby_Format_TypeError( "", "std::vector< int >::iterator","erase", 3, argv[1] )); + } + } + result = std_vector_Sl_int_Sg__erase__SWIG_1(arg1,arg2,arg3); + vresult = SWIG_NewPointerObj(swig::make_nonconst_iterator(static_cast< const std::vector< int >::iterator & >(result), + self), + swig::Iterator::descriptor(),SWIG_POINTER_OWN); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE _wrap_IntVector_erase(int nargs, VALUE *args, VALUE self) { + int argc; + VALUE argv[4]; + int ii; + + argc = nargs + 1; + argv[0] = self; + if (argc > 4) SWIG_fail; + for (ii = 1; (ii < argc); ++ii) { + argv[ii] = args[ii-1]; + } + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::vector< int,std::allocator< int > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + swig::ConstIterator *iter = 0; + int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::Iterator::descriptor(), 0); + _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::Iterator_T<std::vector< int >::iterator > *>(iter) != 0)); + if (_v) { + return _wrap_IntVector_erase__SWIG_0(nargs, args, self); + } + } + } + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::vector< int,std::allocator< int > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + swig::ConstIterator *iter = 0; + int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::Iterator::descriptor(), 0); + _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::Iterator_T<std::vector< int >::iterator > *>(iter) != 0)); + if (_v) { + swig::ConstIterator *iter = 0; + int res = SWIG_ConvertPtr(argv[2], SWIG_as_voidptrptr(&iter), swig::Iterator::descriptor(), 0); + _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::Iterator_T<std::vector< int >::iterator > *>(iter) != 0)); + if (_v) { + return _wrap_IntVector_erase__SWIG_1(nargs, args, self); + } + } + } + } + +fail: + Ruby_Format_OverloadedError( argc, 4, "erase", + " std::vector< int >::iterator erase(std::vector< int >::iterator pos)\n" + " std::vector< int >::iterator erase(std::vector< int >::iterator first, std::vector< int >::iterator last)\n"); + + return Qnil; +} + + +SWIGINTERN VALUE +#ifdef HAVE_RB_DEFINE_ALLOC_FUNC +_wrap_IntVector_allocate(VALUE self) +#else +_wrap_IntVector_allocate(int argc, VALUE *argv, VALUE self) +#endif +{ + VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t); +#ifndef HAVE_RB_DEFINE_ALLOC_FUNC + rb_obj_call_init(vresult, argc, argv); +#endif + return vresult; +} + + +SWIGINTERN VALUE +_wrap_new_IntVector__SWIG_3(int argc, VALUE *argv, VALUE self) { + std::vector< int >::size_type arg1 ; + std::vector< int >::value_type *arg2 = 0 ; + size_t val1 ; + int ecode1 = 0 ; + std::vector< int >::value_type temp2 ; + int val2 ; + int ecode2 = 0 ; + std::vector< int > *result = 0 ; + + if ((argc < 2) || (argc > 2)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; + } + ecode1 = SWIG_AsVal_size_t(argv[0], &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "std::vector< int >::size_type","vector<(int)>", 1, argv[0] )); + } + arg1 = static_cast< std::vector< int >::size_type >(val1); + ecode2 = SWIG_AsVal_int(argv[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< int >::value_type","vector<(int)>", 2, argv[1] )); + } + temp2 = static_cast< std::vector< int >::value_type >(val2); + arg2 = &temp2; + result = (std::vector< int > *)new std::vector< int >(arg1,(std::vector< int >::value_type const &)*arg2); + DATA_PTR(self) = result; + return self; +fail: + return Qnil; +} + + +SWIGINTERN VALUE _wrap_new_IntVector(int nargs, VALUE *args, VALUE self) { + int argc; + VALUE argv[2]; + int ii; + + argc = nargs; + if (argc > 2) SWIG_fail; + for (ii = 0; (ii < argc); ++ii) { + argv[ii] = args[ii]; + } + if (argc == 0) { + return _wrap_new_IntVector__SWIG_0(nargs, args, self); + } + if (argc == 1) { + int _v; + { + int res = SWIG_AsVal_size_t(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_new_IntVector__SWIG_2(nargs, args, self); + } + } + if (argc == 1) { + int _v; + int res = swig::asptr(argv[0], (std::vector< int,std::allocator< int > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_new_IntVector__SWIG_1(nargs, args, self); + } + } + if (argc == 2) { + int _v; + { + int res = SWIG_AsVal_size_t(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_new_IntVector__SWIG_3(nargs, args, self); + } + } + } + +fail: + Ruby_Format_OverloadedError( argc, 2, "IntVector.new", + " IntVector.new()\n" + " IntVector.new(std::vector< int > const &other)\n" + " IntVector.new(std::vector< int >::size_type size)\n" + " IntVector.new(std::vector< int >::size_type size, std::vector< int >::value_type const &value)\n"); + + return Qnil; +} + + +/* + Document-method: Cdi::IntVector.front + + call-seq: + front -> std::vector< int >::value_type const & + +Return the first element in IntVector. +*/ +SWIGINTERN VALUE +_wrap_IntVector_front(int argc, VALUE *argv, VALUE self) { + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< int >::value_type *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > const *","front", 1, self )); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + result = (std::vector< int >::value_type *) &((std::vector< int > const *)arg1)->front(); + vresult = SWIG_From_int(static_cast< int >(*result)); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::IntVector.back + + call-seq: + back -> std::vector< int >::value_type const & + +Return the last element in IntVector. +*/ +SWIGINTERN VALUE +_wrap_IntVector_back(int argc, VALUE *argv, VALUE self) { + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< int >::value_type *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > const *","back", 1, self )); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + result = (std::vector< int >::value_type *) &((std::vector< int > const *)arg1)->back(); + vresult = SWIG_From_int(static_cast< int >(*result)); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::IntVector.assign + + call-seq: + assign(n, x) + +Assign a new IntVector or portion of it. +*/ +SWIGINTERN VALUE +_wrap_IntVector_assign(int argc, VALUE *argv, VALUE self) { + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + std::vector< int >::size_type arg2 ; + std::vector< int >::value_type *arg3 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + size_t val2 ; + int ecode2 = 0 ; + std::vector< int >::value_type temp3 ; + int val3 ; + int ecode3 = 0 ; + + if ((argc < 2) || (argc > 2)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > *","assign", 1, self )); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + ecode2 = SWIG_AsVal_size_t(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< int >::size_type","assign", 2, argv[0] )); + } + arg2 = static_cast< std::vector< int >::size_type >(val2); + ecode3 = SWIG_AsVal_int(argv[1], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "std::vector< int >::value_type","assign", 3, argv[1] )); + } + temp3 = static_cast< std::vector< int >::value_type >(val3); + arg3 = &temp3; + (arg1)->assign(arg2,(std::vector< int >::value_type const &)*arg3); + return Qnil; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::IntVector.resize + + call-seq: + resize(new_size) + resize(new_size, x) + +Resize the size of the IntVector. +*/ +SWIGINTERN VALUE +_wrap_IntVector_resize__SWIG_1(int argc, VALUE *argv, VALUE self) { + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + std::vector< int >::size_type arg2 ; + std::vector< int >::value_type *arg3 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + size_t val2 ; + int ecode2 = 0 ; + std::vector< int >::value_type temp3 ; + int val3 ; + int ecode3 = 0 ; + + if ((argc < 2) || (argc > 2)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > *","resize", 1, self )); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + ecode2 = SWIG_AsVal_size_t(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< int >::size_type","resize", 2, argv[0] )); + } + arg2 = static_cast< std::vector< int >::size_type >(val2); + ecode3 = SWIG_AsVal_int(argv[1], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "std::vector< int >::value_type","resize", 3, argv[1] )); + } + temp3 = static_cast< std::vector< int >::value_type >(val3); + arg3 = &temp3; + (arg1)->resize(arg2,(std::vector< int >::value_type const &)*arg3); + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE _wrap_IntVector_resize(int nargs, VALUE *args, VALUE self) { + int argc; + VALUE argv[4]; + int ii; + + argc = nargs + 1; + argv[0] = self; + if (argc > 4) SWIG_fail; + for (ii = 1; (ii < argc); ++ii) { + argv[ii] = args[ii-1]; + } + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::vector< int,std::allocator< int > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_size_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_IntVector_resize__SWIG_0(nargs, args, self); + } + } + } + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::vector< int,std::allocator< int > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_size_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_IntVector_resize__SWIG_1(nargs, args, self); + } + } + } + } + +fail: + Ruby_Format_OverloadedError( argc, 4, "IntVector.resize", + " void IntVector.resize(std::vector< int >::size_type new_size)\n" + " void IntVector.resize(std::vector< int >::size_type new_size, std::vector< int >::value_type const &x)\n"); + + return Qnil; +} + + +/* + Document-method: Cdi::IntVector.insert + + call-seq: + insert(pos, argc) -> IntVector + insert(pos, x) -> std::vector< int >::iterator + insert(pos, n, x) + +Insert one or more new elements in the IntVector. +*/ +SWIGINTERN VALUE +_wrap_IntVector_insert__SWIG_1(int argc, VALUE *argv, VALUE self) { + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + std::vector< int >::iterator arg2 ; + std::vector< int >::value_type *arg3 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + swig::Iterator *iter2 = 0 ; + int res2 ; + std::vector< int >::value_type temp3 ; + int val3 ; + int ecode3 = 0 ; + std::vector< int >::iterator result; + VALUE vresult = Qnil; + + if ((argc < 2) || (argc > 2)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > *","insert", 1, self )); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + res2 = SWIG_ConvertPtr(argv[0], SWIG_as_voidptrptr(&iter2), swig::Iterator::descriptor(), 0); + if (!SWIG_IsOK(res2) || !iter2) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), Ruby_Format_TypeError( "", "std::vector< int >::iterator","insert", 2, argv[0] )); + } else { + swig::Iterator_T<std::vector< int >::iterator > *iter_t = dynamic_cast<swig::Iterator_T<std::vector< int >::iterator > *>(iter2); + if (iter_t) { + arg2 = iter_t->get_current(); + } else { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), Ruby_Format_TypeError( "", "std::vector< int >::iterator","insert", 2, argv[0] )); + } + } + ecode3 = SWIG_AsVal_int(argv[1], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "std::vector< int >::value_type","insert", 3, argv[1] )); + } + temp3 = static_cast< std::vector< int >::value_type >(val3); + arg3 = &temp3; + result = std_vector_Sl_int_Sg__insert__SWIG_1(arg1,arg2,(int const &)*arg3); + vresult = SWIG_NewPointerObj(swig::make_nonconst_iterator(static_cast< const std::vector< int >::iterator & >(result), + self), + swig::Iterator::descriptor(),SWIG_POINTER_OWN); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_IntVector_insert__SWIG_2(int argc, VALUE *argv, VALUE self) { + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + std::vector< int >::iterator arg2 ; + std::vector< int >::size_type arg3 ; + std::vector< int >::value_type *arg4 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + swig::Iterator *iter2 = 0 ; + int res2 ; + size_t val3 ; + int ecode3 = 0 ; + std::vector< int >::value_type temp4 ; + int val4 ; + int ecode4 = 0 ; + + if ((argc < 3) || (argc > 3)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > *","insert", 1, self )); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + res2 = SWIG_ConvertPtr(argv[0], SWIG_as_voidptrptr(&iter2), swig::Iterator::descriptor(), 0); + if (!SWIG_IsOK(res2) || !iter2) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), Ruby_Format_TypeError( "", "std::vector< int >::iterator","insert", 2, argv[0] )); + } else { + swig::Iterator_T<std::vector< int >::iterator > *iter_t = dynamic_cast<swig::Iterator_T<std::vector< int >::iterator > *>(iter2); + if (iter_t) { + arg2 = iter_t->get_current(); + } else { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), Ruby_Format_TypeError( "", "std::vector< int >::iterator","insert", 2, argv[0] )); + } + } + ecode3 = SWIG_AsVal_size_t(argv[1], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "std::vector< int >::size_type","insert", 3, argv[1] )); + } + arg3 = static_cast< std::vector< int >::size_type >(val3); + ecode4 = SWIG_AsVal_int(argv[2], &val4); + if (!SWIG_IsOK(ecode4)) { + SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "std::vector< int >::value_type","insert", 4, argv[2] )); + } + temp4 = static_cast< std::vector< int >::value_type >(val4); + arg4 = &temp4; + std_vector_Sl_int_Sg__insert__SWIG_2(arg1,arg2,arg3,(int const &)*arg4); + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE _wrap_IntVector_insert(int nargs, VALUE *args, VALUE self) { + int argc; + VALUE argv[5]; + int ii; + + argc = nargs + 1; + argv[0] = self; + if (argc > 5) SWIG_fail; + for (ii = 1; (ii < argc); ++ii) { + argv[ii] = args[ii-1]; + } + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::vector< int,std::allocator< int > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + swig::ConstIterator *iter = 0; + int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::Iterator::descriptor(), 0); + _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::Iterator_T<std::vector< int >::iterator > *>(iter) != 0)); + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_IntVector_insert__SWIG_1(nargs, args, self); + } + } + } + } + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::vector< int,std::allocator< int > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + if (argc <= 3) { + return _wrap_IntVector_insert__SWIG_0(nargs, args, self); + } + return _wrap_IntVector_insert__SWIG_0(nargs, args, self); + } + } + } + } + if (argc == 4) { + int _v; + int res = swig::asptr(argv[0], (std::vector< int,std::allocator< int > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + swig::ConstIterator *iter = 0; + int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::Iterator::descriptor(), 0); + _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::Iterator_T<std::vector< int >::iterator > *>(iter) != 0)); + if (_v) { + { + int res = SWIG_AsVal_size_t(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[3], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_IntVector_insert__SWIG_2(nargs, args, self); + } + } + } + } + } + +fail: + Ruby_Format_OverloadedError( argc, 5, "insert", + " std::vector< int,std::allocator< int > > insert(std::vector< int >::difference_type pos, int argc, VALUE *argv, ...)\n" + " std::vector< int >::iterator insert(std::vector< int >::iterator pos, std::vector< int >::value_type const &x)\n" + " void insert(std::vector< int >::iterator pos, std::vector< int >::size_type n, std::vector< int >::value_type const &x)\n"); + + return Qnil; +} + + +/* + Document-method: Cdi::IntVector.reserve + + call-seq: + reserve(n) + +Reserve memory in the IntVector for a number of elements. +*/ +SWIGINTERN VALUE +_wrap_IntVector_reserve(int argc, VALUE *argv, VALUE self) { + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + std::vector< int >::size_type arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + size_t val2 ; + int ecode2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > *","reserve", 1, self )); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + ecode2 = SWIG_AsVal_size_t(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< int >::size_type","reserve", 2, argv[0] )); + } + arg2 = static_cast< std::vector< int >::size_type >(val2); + (arg1)->reserve(arg2); + return Qnil; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::IntVector.capacity + + call-seq: + capacity -> std::vector< int >::size_type + +Reserved capacity of the IntVector. +*/ +SWIGINTERN VALUE +_wrap_IntVector_capacity(int argc, VALUE *argv, VALUE self) { + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< int >::size_type result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > const *","capacity", 1, self )); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + result = ((std::vector< int > const *)arg1)->capacity(); + vresult = SWIG_From_size_t(static_cast< size_t >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_IntVector_mapN___(int argc, VALUE *argv, VALUE self) { + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< int,std::allocator< int > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > *","map_bang", 1, self )); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + result = (std::vector< int,std::allocator< int > > *)std_vector_Sl_int_Sg__map_bang(arg1); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::IntVector.delete + + call-seq: + delete(val) -> VALUE + +Delete a matching element. +*/ +SWIGINTERN VALUE +_wrap_IntVector_delete(int argc, VALUE *argv, VALUE self) { + std::vector< int > *arg1 = (std::vector< int > *) 0 ; + int *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int temp2 ; + int val2 ; + int ecode2 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > *","__delete__", 1, self )); + } + arg1 = reinterpret_cast< std::vector< int > * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","__delete__", 2, argv[0] )); + } + temp2 = static_cast< int >(val2); + arg2 = &temp2; + result = (VALUE)std_vector_Sl_int_Sg____delete__(arg1,(int const &)*arg2); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN void +free_std_vector_Sl_int_Sg_(void *self) { + std::vector< int > *arg1 = (std::vector< int > *)self; + delete arg1; +} + +static swig_class SwigClassDoubleVector; + +/* + Document-method: Cdi::DoubleVector.dup + + call-seq: + dup -> DoubleVector + +Create a duplicate of the class and unfreeze it if needed. +*/ +SWIGINTERN VALUE +_wrap_DoubleVector_dup(int argc, VALUE *argv, VALUE self) { + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< double,std::allocator< double > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< double > *","dup", 1, self )); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + result = (std::vector< double,std::allocator< double > > *)std_vector_Sl_double_Sg__dup(arg1); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::DoubleVector.inspect + + call-seq: + inspect -> VALUE + +Inspect class and its contents. +*/ +SWIGINTERN VALUE +_wrap_DoubleVector_inspect(int argc, VALUE *argv, VALUE self) { + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< double > *","inspect", 1, self )); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + result = (VALUE)std_vector_Sl_double_Sg__inspect(arg1); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::DoubleVector.to_a + + call-seq: + to_a -> VALUE + +Convert DoubleVector to an Array. +*/ +SWIGINTERN VALUE +_wrap_DoubleVector_to_a(int argc, VALUE *argv, VALUE self) { + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< double > *","to_a", 1, self )); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + result = (VALUE)std_vector_Sl_double_Sg__to_a(arg1); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::DoubleVector.to_s + + call-seq: + to_s -> VALUE + +Convert class to a String representation. +*/ +SWIGINTERN VALUE +_wrap_DoubleVector_to_s(int argc, VALUE *argv, VALUE self) { + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< double > *","to_s", 1, self )); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + result = (VALUE)std_vector_Sl_double_Sg__to_s(arg1); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::DoubleVector.slice + + call-seq: + slice(i, length) -> VALUE + +Return a slice (portion of) the DoubleVector. +*/ +SWIGINTERN VALUE +_wrap_DoubleVector_slice(int argc, VALUE *argv, VALUE self) { + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + std::vector< double >::difference_type arg2 ; + std::vector< double >::difference_type arg3 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + ptrdiff_t val3 ; + int ecode3 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 2) || (argc > 2)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< double > *","slice", 1, self )); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< double >::difference_type","slice", 2, argv[0] )); + } + arg2 = static_cast< std::vector< double >::difference_type >(val2); + ecode3 = SWIG_AsVal_ptrdiff_t(argv[1], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "std::vector< double >::difference_type","slice", 3, argv[1] )); + } + arg3 = static_cast< std::vector< double >::difference_type >(val3); + try { + result = (VALUE)std_vector_Sl_double_Sg__slice(arg1,arg2,arg3); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::DoubleVector.each + + call-seq: + each -> DoubleVector + +Iterate thru each element in the DoubleVector. A block must be provided. +*/ +SWIGINTERN VALUE +_wrap_DoubleVector_each(int argc, VALUE *argv, VALUE self) { + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< double,std::allocator< double > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< double > *","each", 1, self )); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + result = (std::vector< double,std::allocator< double > > *)std_vector_Sl_double_Sg__each(arg1); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_DoubleVector___delete2__(int argc, VALUE *argv, VALUE self) { + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + std::vector< double >::value_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< double >::value_type temp2 ; + double val2 ; + int ecode2 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< double > *","__delete2__", 1, self )); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + ecode2 = SWIG_AsVal_double(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< double >::value_type","__delete2__", 2, argv[0] )); + } + temp2 = static_cast< std::vector< double >::value_type >(val2); + arg2 = &temp2; + result = (VALUE)std_vector_Sl_double_Sg____delete2__(arg1,(double const &)*arg2); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::DoubleVector.select + + call-seq: + select -> DoubleVector + +Iterate thru each element in the DoubleVector and select those that match a condition. A block must be provided. +*/ +SWIGINTERN VALUE +_wrap_DoubleVector_select(int argc, VALUE *argv, VALUE self) { + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< double,std::allocator< double > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< double > *","select", 1, self )); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + result = (std::vector< double,std::allocator< double > > *)std_vector_Sl_double_Sg__select(arg1); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::DoubleVector.delete_at + + call-seq: + delete_at(i) -> VALUE + +Delete an element at a certain index. +*/ +SWIGINTERN VALUE +_wrap_DoubleVector_delete_at(int argc, VALUE *argv, VALUE self) { + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + std::vector< double >::difference_type arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< double > *","delete_at", 1, self )); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< double >::difference_type","delete_at", 2, argv[0] )); + } + arg2 = static_cast< std::vector< double >::difference_type >(val2); + result = (VALUE)std_vector_Sl_double_Sg__delete_at(arg1,arg2); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::DoubleVector.at + + call-seq: + at(i) -> VALUE + +Return element at a certain index. +*/ +SWIGINTERN VALUE +_wrap_DoubleVector_at(int argc, VALUE *argv, VALUE self) { + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + std::vector< double >::difference_type arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< double > const *","at", 1, self )); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< double >::difference_type","at", 2, argv[0] )); + } + arg2 = static_cast< std::vector< double >::difference_type >(val2); + result = (VALUE)std_vector_Sl_double_Sg__at((std::vector< double > const *)arg1,arg2); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::DoubleVector.[] + + call-seq: + [](i, length) -> VALUE + [](i) -> VALUE + [](i) -> VALUE + +Element accessor/slicing. +*/ +SWIGINTERN VALUE +_wrap_DoubleVector___getitem____SWIG_0(int argc, VALUE *argv, VALUE self) { + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + std::vector< double >::difference_type arg2 ; + std::vector< double >::difference_type arg3 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + ptrdiff_t val3 ; + int ecode3 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 2) || (argc > 2)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< double > const *","__getitem__", 1, self )); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< double >::difference_type","__getitem__", 2, argv[0] )); + } + arg2 = static_cast< std::vector< double >::difference_type >(val2); + ecode3 = SWIG_AsVal_ptrdiff_t(argv[1], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "std::vector< double >::difference_type","__getitem__", 3, argv[1] )); + } + arg3 = static_cast< std::vector< double >::difference_type >(val3); + try { + result = (VALUE)std_vector_Sl_double_Sg____getitem____SWIG_0((std::vector< double > const *)arg1,arg2,arg3); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } + vresult = result; + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_DoubleVector___getitem____SWIG_1(int argc, VALUE *argv, VALUE self) { + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + std::vector< double >::difference_type arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< double > const *","__getitem__", 1, self )); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< double >::difference_type","__getitem__", 2, argv[0] )); + } + arg2 = static_cast< std::vector< double >::difference_type >(val2); + result = (VALUE)std_vector_Sl_double_Sg____getitem____SWIG_1((std::vector< double > const *)arg1,arg2); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_DoubleVector___getitem____SWIG_2(int argc, VALUE *argv, VALUE self) { + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + VALUE arg2 = (VALUE) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< double > const *","__getitem__", 1, self )); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + arg2 = argv[0]; + try { + result = (VALUE)std_vector_Sl_double_Sg____getitem____SWIG_2((std::vector< double > const *)arg1,arg2); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } + vresult = result; + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE _wrap_DoubleVector___getitem__(int nargs, VALUE *args, VALUE self) { + int argc; + VALUE argv[4]; + int ii; + + argc = nargs + 1; + argv[0] = self; + if (argc > 4) SWIG_fail; + for (ii = 1; (ii < argc); ++ii) { + argv[ii] = args[ii-1]; + } + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::vector< double,std::allocator< double > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_DoubleVector___getitem____SWIG_1(nargs, args, self); + } + } + } + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::vector< double,std::allocator< double > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + _v = (argv[1] != 0); + if (_v) { + return _wrap_DoubleVector___getitem____SWIG_2(nargs, args, self); + } + } + } + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::vector< double,std::allocator< double > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_DoubleVector___getitem____SWIG_0(nargs, args, self); + } + } + } + } + +fail: + Ruby_Format_OverloadedError( argc, 4, "__getitem__", + " VALUE __getitem__(std::vector< double >::difference_type i, std::vector< double >::difference_type length)\n" + " VALUE __getitem__(std::vector< double >::difference_type i)\n" + " VALUE __getitem__(VALUE i)\n"); + + return Qnil; +} + + +/* + Document-method: Cdi::DoubleVector.[]= + + call-seq: + []=(i, x) -> VALUE + []=(i, length, v) -> VALUE + +Element setter/slicing. +*/ +SWIGINTERN VALUE +_wrap_DoubleVector___setitem____SWIG_0(int argc, VALUE *argv, VALUE self) { + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + std::vector< double >::difference_type arg2 ; + std::vector< double >::value_type *arg3 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + std::vector< double >::value_type temp3 ; + double val3 ; + int ecode3 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 2) || (argc > 2)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< double > *","__setitem__", 1, self )); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< double >::difference_type","__setitem__", 2, argv[0] )); + } + arg2 = static_cast< std::vector< double >::difference_type >(val2); + ecode3 = SWIG_AsVal_double(argv[1], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "std::vector< double >::value_type","__setitem__", 3, argv[1] )); + } + temp3 = static_cast< std::vector< double >::value_type >(val3); + arg3 = &temp3; + try { + result = (VALUE)std_vector_Sl_double_Sg____setitem____SWIG_0(arg1,arg2,(double const &)*arg3); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } + vresult = result; + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_DoubleVector___setitem____SWIG_1(int argc, VALUE *argv, VALUE self) { + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + std::vector< double >::difference_type arg2 ; + std::vector< double >::difference_type arg3 ; + std::vector< double,std::allocator< double > > *arg4 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + ptrdiff_t val3 ; + int ecode3 = 0 ; + int res4 = SWIG_OLDOBJ ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 3) || (argc > 3)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< double > *","__setitem__", 1, self )); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< double >::difference_type","__setitem__", 2, argv[0] )); + } + arg2 = static_cast< std::vector< double >::difference_type >(val2); + ecode3 = SWIG_AsVal_ptrdiff_t(argv[1], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "std::vector< double >::difference_type","__setitem__", 3, argv[1] )); + } + arg3 = static_cast< std::vector< double >::difference_type >(val3); + { + std::vector< double,std::allocator< double > > *ptr = (std::vector< double,std::allocator< double > > *)0; + res4 = swig::asptr(argv[2], &ptr); + if (!SWIG_IsOK(res4)) { + SWIG_exception_fail(SWIG_ArgError(res4), Ruby_Format_TypeError( "", "std::vector< double,std::allocator< double > > const &","__setitem__", 4, argv[2] )); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::vector< double,std::allocator< double > > const &","__setitem__", 4, argv[2])); + } + arg4 = ptr; + } + try { + result = (VALUE)std_vector_Sl_double_Sg____setitem____SWIG_1(arg1,arg2,arg3,(std::vector< double,std::allocator< double > > const &)*arg4); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } + vresult = result; + if (SWIG_IsNewObj(res4)) delete arg4; + return vresult; +fail: + if (SWIG_IsNewObj(res4)) delete arg4; + return Qnil; +} + + +SWIGINTERN VALUE _wrap_DoubleVector___setitem__(int nargs, VALUE *args, VALUE self) { + int argc; + VALUE argv[5]; + int ii; + + argc = nargs + 1; + argv[0] = self; + if (argc > 5) SWIG_fail; + for (ii = 1; (ii < argc); ++ii) { + argv[ii] = args[ii-1]; + } + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::vector< double,std::allocator< double > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_double(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_DoubleVector___setitem____SWIG_0(nargs, args, self); + } + } + } + } + if (argc == 4) { + int _v; + int res = swig::asptr(argv[0], (std::vector< double,std::allocator< double > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + int res = swig::asptr(argv[3], (std::vector< double,std::allocator< double > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_DoubleVector___setitem____SWIG_1(nargs, args, self); + } + } + } + } + } + +fail: + Ruby_Format_OverloadedError( argc, 5, "__setitem__", + " VALUE __setitem__(std::vector< double >::difference_type i, std::vector< double >::value_type const &x)\n" + " VALUE __setitem__(std::vector< double >::difference_type i, std::vector< double >::difference_type length, std::vector< double,std::allocator< double > > const &v)\n"); + + return Qnil; +} + + +/* + Document-method: Cdi::DoubleVector.reject! + + call-seq: + reject! -> DoubleVector + +Iterate thru each element in the DoubleVector and reject those that fail a condition. A block must be provided. DoubleVector is modified in place. +*/ +SWIGINTERN VALUE +_wrap_DoubleVector_rejectN___(int argc, VALUE *argv, VALUE self) { + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< double,std::allocator< double > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< double > *","reject_bang", 1, self )); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + result = (std::vector< double,std::allocator< double > > *)std_vector_Sl_double_Sg__reject_bang(arg1); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::DoubleVector.pop + + call-seq: + pop -> VALUE + +Remove and return element at the end of the DoubleVector. +*/ +SWIGINTERN VALUE +_wrap_DoubleVector_pop(int argc, VALUE *argv, VALUE self) { + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< double > *","pop", 1, self )); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + result = (VALUE)std_vector_Sl_double_Sg__pop(arg1); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::DoubleVector.push + + call-seq: + push(e) -> std::vector< double >::value_type const + +Add an element at the end of the DoubleVector. +*/ +SWIGINTERN VALUE +_wrap_DoubleVector_push(int argc, VALUE *argv, VALUE self) { + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + std::vector< double >::value_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< double >::value_type temp2 ; + double val2 ; + int ecode2 = 0 ; + std::vector< double >::value_type result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< double > *","push", 1, self )); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + ecode2 = SWIG_AsVal_double(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< double >::value_type","push", 2, argv[0] )); + } + temp2 = static_cast< std::vector< double >::value_type >(val2); + arg2 = &temp2; + result = (std::vector< double >::value_type)std_vector_Sl_double_Sg__push(arg1,(double const &)*arg2); + vresult = SWIG_From_double(static_cast< double >(result)); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::DoubleVector.reject + + call-seq: + reject -> DoubleVector + +Iterate thru each element in the DoubleVector and reject those that fail a condition returning a new DoubleVector. A block must be provided. +*/ +SWIGINTERN VALUE +_wrap_DoubleVector_reject(int argc, VALUE *argv, VALUE self) { + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< double,std::allocator< double > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< double > *","reject", 1, self )); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + result = (std::vector< double,std::allocator< double > > *)std_vector_Sl_double_Sg__reject(arg1); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::DoubleVector.shift + + call-seq: + shift -> VALUE + +Remove and return element at the beginning of the DoubleVector. +*/ +SWIGINTERN VALUE +_wrap_DoubleVector_shift(int argc, VALUE *argv, VALUE self) { + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< double > *","shift", 1, self )); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + result = (VALUE)std_vector_Sl_double_Sg__shift(arg1); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::DoubleVector.insert + + call-seq: + insert(pos, argc) -> DoubleVector + insert(pos, x) -> std::vector< double >::iterator + insert(pos, n, x) + +Insert one or more new elements in the DoubleVector. +*/ +SWIGINTERN VALUE +_wrap_DoubleVector_insert__SWIG_0(int argc, VALUE *argv, VALUE self) { + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + std::vector< double >::difference_type arg2 ; + int arg3 ; + VALUE *arg4 = (VALUE *) 0 ; + void *arg5 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + std::vector< double,std::allocator< double > > *result = 0 ; + VALUE vresult = Qnil; + + if (argc < 2) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< double > *","insert", 1, self )); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< double >::difference_type","insert", 2, argv[0] )); + } + arg2 = static_cast< std::vector< double >::difference_type >(val2); + { + arg3 = argc - 1; + arg4 = argv + 1; + } + result = (std::vector< double,std::allocator< double > > *)std_vector_Sl_double_Sg__insert__SWIG_0(arg1,arg2,arg3,arg4,arg5); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::DoubleVector.unshift + + call-seq: + unshift(argc) -> DoubleVector + +Add one or more elements at the beginning of the DoubleVector. +*/ +SWIGINTERN VALUE +_wrap_DoubleVector_unshift(int argc, VALUE *argv, VALUE self) { + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + int arg2 ; + VALUE *arg3 = (VALUE *) 0 ; + void *arg4 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< double,std::allocator< double > > *result = 0 ; + VALUE vresult = Qnil; + + if (argc < 1) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< double > *","unshift", 1, self )); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + { + arg2 = argc; + arg3 = argv; + } + result = (std::vector< double,std::allocator< double > > *)std_vector_Sl_double_Sg__unshift(arg1,arg2,arg3,arg4); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_new_DoubleVector__SWIG_0(int argc, VALUE *argv, VALUE self) { + std::vector< double > *result = 0 ; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + result = (std::vector< double > *)new std::vector< double >(); + DATA_PTR(self) = result; + return self; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_new_DoubleVector__SWIG_1(int argc, VALUE *argv, VALUE self) { + std::vector< double > *arg1 = 0 ; + int res1 = SWIG_OLDOBJ ; + std::vector< double > *result = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + { + std::vector< double,std::allocator< double > > *ptr = (std::vector< double,std::allocator< double > > *)0; + res1 = swig::asptr(argv[0], &ptr); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< double > const &","vector<(double)>", 1, argv[0] )); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::vector< double > const &","vector<(double)>", 1, argv[0])); + } + arg1 = ptr; + } + result = (std::vector< double > *)new std::vector< double >((std::vector< double > const &)*arg1); + DATA_PTR(self) = result; + if (SWIG_IsNewObj(res1)) delete arg1; + return self; +fail: + if (SWIG_IsNewObj(res1)) delete arg1; + return Qnil; +} + + +/* + Document-method: Cdi::DoubleVector.empty? + + call-seq: + empty? -> bool + +Check if the DoubleVector is empty or not. +*/ +SWIGINTERN VALUE +_wrap_DoubleVector_emptyq___(int argc, VALUE *argv, VALUE self) { + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + bool result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< double > const *","empty", 1, self )); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + result = (bool)((std::vector< double > const *)arg1)->empty(); + vresult = SWIG_From_bool(static_cast< bool >(result)); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::DoubleVector.size + + call-seq: + size -> std::vector< double >::size_type + +Size or Length of the DoubleVector. +*/ +SWIGINTERN VALUE +_wrap_DoubleVector_size(int argc, VALUE *argv, VALUE self) { + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< double >::size_type result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< double > const *","size", 1, self )); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + result = ((std::vector< double > const *)arg1)->size(); + vresult = SWIG_From_size_t(static_cast< size_t >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_DoubleVector_swap(int argc, VALUE *argv, VALUE self) { + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + std::vector< double > *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< double > *","swap", 1, self )); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::vector< double > &","swap", 2, argv[0] )); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::vector< double > &","swap", 2, argv[0])); + } + arg2 = reinterpret_cast< std::vector< double > * >(argp2); + (arg1)->swap(*arg2); + return Qnil; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::DoubleVector.begin + + call-seq: + begin -> std::vector< double >::iterator + +Return an iterator to the beginning of the DoubleVector. +*/ +SWIGINTERN VALUE +_wrap_DoubleVector_begin(int argc, VALUE *argv, VALUE self) { + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< double >::iterator result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< double > *","begin", 1, self )); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + result = (arg1)->begin(); + vresult = SWIG_NewPointerObj(swig::make_nonconst_iterator(static_cast< const std::vector< double >::iterator & >(result), + self), + swig::Iterator::descriptor(),SWIG_POINTER_OWN); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::DoubleVector.end + + call-seq: + end -> std::vector< double >::iterator + +Return an iterator to past the end of the DoubleVector. +*/ +SWIGINTERN VALUE +_wrap_DoubleVector_end(int argc, VALUE *argv, VALUE self) { + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< double >::iterator result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< double > *","end", 1, self )); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + result = (arg1)->end(); + vresult = SWIG_NewPointerObj(swig::make_nonconst_iterator(static_cast< const std::vector< double >::iterator & >(result), + self), + swig::Iterator::descriptor(),SWIG_POINTER_OWN); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::DoubleVector.rbegin + + call-seq: + rbegin -> std::vector< double >::reverse_iterator + +Return a reverse iterator to the beginning (the end) of the DoubleVector. +*/ +SWIGINTERN VALUE +_wrap_DoubleVector_rbegin(int argc, VALUE *argv, VALUE self) { + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< double >::reverse_iterator result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< double > *","rbegin", 1, self )); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + result = (arg1)->rbegin(); + vresult = SWIG_NewPointerObj(swig::make_nonconst_iterator(static_cast< const std::vector< double >::reverse_iterator & >(result), + self), + swig::Iterator::descriptor(),SWIG_POINTER_OWN); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::DoubleVector.rend + + call-seq: + rend -> std::vector< double >::reverse_iterator + +Return a reverse iterator to past the end (past the beginning) of the DoubleVector. +*/ +SWIGINTERN VALUE +_wrap_DoubleVector_rend(int argc, VALUE *argv, VALUE self) { + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< double >::reverse_iterator result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< double > *","rend", 1, self )); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + result = (arg1)->rend(); + vresult = SWIG_NewPointerObj(swig::make_nonconst_iterator(static_cast< const std::vector< double >::reverse_iterator & >(result), + self), + swig::Iterator::descriptor(),SWIG_POINTER_OWN); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::DoubleVector.clear + + call-seq: + clear + +Clear DoubleVector contents. +*/ +SWIGINTERN VALUE +_wrap_DoubleVector_clear(int argc, VALUE *argv, VALUE self) { + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< double > *","clear", 1, self )); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + (arg1)->clear(); + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_DoubleVector_get_allocator(int argc, VALUE *argv, VALUE self) { + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + SwigValueWrapper< std::allocator< double > > result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< double > const *","get_allocator", 1, self )); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + result = ((std::vector< double > const *)arg1)->get_allocator(); + vresult = SWIG_NewPointerObj((new std::vector< double >::allocator_type(static_cast< const std::vector< double >::allocator_type& >(result))), SWIGTYPE_p_std__allocatorT_double_t, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_new_DoubleVector__SWIG_2(int argc, VALUE *argv, VALUE self) { + std::vector< double >::size_type arg1 ; + size_t val1 ; + int ecode1 = 0 ; + std::vector< double > *result = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + ecode1 = SWIG_AsVal_size_t(argv[0], &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "std::vector< double >::size_type","vector<(double)>", 1, argv[0] )); + } + arg1 = static_cast< std::vector< double >::size_type >(val1); + result = (std::vector< double > *)new std::vector< double >(arg1); + DATA_PTR(self) = result; + return self; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::DoubleVector.resize + + call-seq: + resize(new_size) + resize(new_size, x) + +Resize the size of the DoubleVector. +*/ +SWIGINTERN VALUE +_wrap_DoubleVector_resize__SWIG_0(int argc, VALUE *argv, VALUE self) { + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + std::vector< double >::size_type arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + size_t val2 ; + int ecode2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< double > *","resize", 1, self )); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + ecode2 = SWIG_AsVal_size_t(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< double >::size_type","resize", 2, argv[0] )); + } + arg2 = static_cast< std::vector< double >::size_type >(val2); + (arg1)->resize(arg2); + return Qnil; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::DoubleVector.erase + + call-seq: + erase(pos) -> std::vector< double >::iterator + erase(first, last) -> std::vector< double >::iterator + +Delete a portion of the DoubleVector. +*/ +SWIGINTERN VALUE +_wrap_DoubleVector_erase__SWIG_0(int argc, VALUE *argv, VALUE self) { + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + std::vector< double >::iterator arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + swig::Iterator *iter2 = 0 ; + int res2 ; + std::vector< double >::iterator result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< double > *","erase", 1, self )); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + res2 = SWIG_ConvertPtr(argv[0], SWIG_as_voidptrptr(&iter2), swig::Iterator::descriptor(), 0); + if (!SWIG_IsOK(res2) || !iter2) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), Ruby_Format_TypeError( "", "std::vector< double >::iterator","erase", 2, argv[0] )); + } else { + swig::Iterator_T<std::vector< double >::iterator > *iter_t = dynamic_cast<swig::Iterator_T<std::vector< double >::iterator > *>(iter2); + if (iter_t) { + arg2 = iter_t->get_current(); + } else { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), Ruby_Format_TypeError( "", "std::vector< double >::iterator","erase", 2, argv[0] )); + } + } + result = std_vector_Sl_double_Sg__erase__SWIG_0(arg1,arg2); + vresult = SWIG_NewPointerObj(swig::make_nonconst_iterator(static_cast< const std::vector< double >::iterator & >(result), + self), + swig::Iterator::descriptor(),SWIG_POINTER_OWN); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_DoubleVector_erase__SWIG_1(int argc, VALUE *argv, VALUE self) { + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + std::vector< double >::iterator arg2 ; + std::vector< double >::iterator arg3 ; + void *argp1 = 0 ; + int res1 = 0 ; + swig::Iterator *iter2 = 0 ; + int res2 ; + swig::Iterator *iter3 = 0 ; + int res3 ; + std::vector< double >::iterator result; + VALUE vresult = Qnil; + + if ((argc < 2) || (argc > 2)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< double > *","erase", 1, self )); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + res2 = SWIG_ConvertPtr(argv[0], SWIG_as_voidptrptr(&iter2), swig::Iterator::descriptor(), 0); + if (!SWIG_IsOK(res2) || !iter2) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), Ruby_Format_TypeError( "", "std::vector< double >::iterator","erase", 2, argv[0] )); + } else { + swig::Iterator_T<std::vector< double >::iterator > *iter_t = dynamic_cast<swig::Iterator_T<std::vector< double >::iterator > *>(iter2); + if (iter_t) { + arg2 = iter_t->get_current(); + } else { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), Ruby_Format_TypeError( "", "std::vector< double >::iterator","erase", 2, argv[0] )); + } + } + res3 = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter3), swig::Iterator::descriptor(), 0); + if (!SWIG_IsOK(res3) || !iter3) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), Ruby_Format_TypeError( "", "std::vector< double >::iterator","erase", 3, argv[1] )); + } else { + swig::Iterator_T<std::vector< double >::iterator > *iter_t = dynamic_cast<swig::Iterator_T<std::vector< double >::iterator > *>(iter3); + if (iter_t) { + arg3 = iter_t->get_current(); + } else { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), Ruby_Format_TypeError( "", "std::vector< double >::iterator","erase", 3, argv[1] )); + } + } + result = std_vector_Sl_double_Sg__erase__SWIG_1(arg1,arg2,arg3); + vresult = SWIG_NewPointerObj(swig::make_nonconst_iterator(static_cast< const std::vector< double >::iterator & >(result), + self), + swig::Iterator::descriptor(),SWIG_POINTER_OWN); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE _wrap_DoubleVector_erase(int nargs, VALUE *args, VALUE self) { + int argc; + VALUE argv[4]; + int ii; + + argc = nargs + 1; + argv[0] = self; + if (argc > 4) SWIG_fail; + for (ii = 1; (ii < argc); ++ii) { + argv[ii] = args[ii-1]; + } + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::vector< double,std::allocator< double > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + swig::ConstIterator *iter = 0; + int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::Iterator::descriptor(), 0); + _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::Iterator_T<std::vector< double >::iterator > *>(iter) != 0)); + if (_v) { + return _wrap_DoubleVector_erase__SWIG_0(nargs, args, self); + } + } + } + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::vector< double,std::allocator< double > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + swig::ConstIterator *iter = 0; + int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::Iterator::descriptor(), 0); + _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::Iterator_T<std::vector< double >::iterator > *>(iter) != 0)); + if (_v) { + swig::ConstIterator *iter = 0; + int res = SWIG_ConvertPtr(argv[2], SWIG_as_voidptrptr(&iter), swig::Iterator::descriptor(), 0); + _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::Iterator_T<std::vector< double >::iterator > *>(iter) != 0)); + if (_v) { + return _wrap_DoubleVector_erase__SWIG_1(nargs, args, self); + } + } + } + } + +fail: + Ruby_Format_OverloadedError( argc, 4, "erase", + " std::vector< double >::iterator erase(std::vector< double >::iterator pos)\n" + " std::vector< double >::iterator erase(std::vector< double >::iterator first, std::vector< double >::iterator last)\n"); + + return Qnil; +} + + +SWIGINTERN VALUE +#ifdef HAVE_RB_DEFINE_ALLOC_FUNC +_wrap_DoubleVector_allocate(VALUE self) +#else +_wrap_DoubleVector_allocate(int argc, VALUE *argv, VALUE self) +#endif +{ + VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t); +#ifndef HAVE_RB_DEFINE_ALLOC_FUNC + rb_obj_call_init(vresult, argc, argv); +#endif + return vresult; +} + + +SWIGINTERN VALUE +_wrap_new_DoubleVector__SWIG_3(int argc, VALUE *argv, VALUE self) { + std::vector< double >::size_type arg1 ; + std::vector< double >::value_type *arg2 = 0 ; + size_t val1 ; + int ecode1 = 0 ; + std::vector< double >::value_type temp2 ; + double val2 ; + int ecode2 = 0 ; + std::vector< double > *result = 0 ; + + if ((argc < 2) || (argc > 2)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; + } + ecode1 = SWIG_AsVal_size_t(argv[0], &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "std::vector< double >::size_type","vector<(double)>", 1, argv[0] )); + } + arg1 = static_cast< std::vector< double >::size_type >(val1); + ecode2 = SWIG_AsVal_double(argv[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< double >::value_type","vector<(double)>", 2, argv[1] )); + } + temp2 = static_cast< std::vector< double >::value_type >(val2); + arg2 = &temp2; + result = (std::vector< double > *)new std::vector< double >(arg1,(std::vector< double >::value_type const &)*arg2); + DATA_PTR(self) = result; + return self; +fail: + return Qnil; +} + + +SWIGINTERN VALUE _wrap_new_DoubleVector(int nargs, VALUE *args, VALUE self) { + int argc; + VALUE argv[2]; + int ii; + + argc = nargs; + if (argc > 2) SWIG_fail; + for (ii = 0; (ii < argc); ++ii) { + argv[ii] = args[ii]; + } + if (argc == 0) { + return _wrap_new_DoubleVector__SWIG_0(nargs, args, self); + } + if (argc == 1) { + int _v; + { + int res = SWIG_AsVal_size_t(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_new_DoubleVector__SWIG_2(nargs, args, self); + } + } + if (argc == 1) { + int _v; + int res = swig::asptr(argv[0], (std::vector< double,std::allocator< double > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_new_DoubleVector__SWIG_1(nargs, args, self); + } + } + if (argc == 2) { + int _v; + { + int res = SWIG_AsVal_size_t(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_double(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_new_DoubleVector__SWIG_3(nargs, args, self); + } + } + } + +fail: + Ruby_Format_OverloadedError( argc, 2, "DoubleVector.new", + " DoubleVector.new()\n" + " DoubleVector.new(std::vector< double > const &other)\n" + " DoubleVector.new(std::vector< double >::size_type size)\n" + " DoubleVector.new(std::vector< double >::size_type size, std::vector< double >::value_type const &value)\n"); + + return Qnil; +} + + +/* + Document-method: Cdi::DoubleVector.front + + call-seq: + front -> std::vector< double >::value_type const & + +Return the first element in DoubleVector. +*/ +SWIGINTERN VALUE +_wrap_DoubleVector_front(int argc, VALUE *argv, VALUE self) { + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< double >::value_type *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< double > const *","front", 1, self )); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + result = (std::vector< double >::value_type *) &((std::vector< double > const *)arg1)->front(); + vresult = SWIG_From_double(static_cast< double >(*result)); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::DoubleVector.back + + call-seq: + back -> std::vector< double >::value_type const & + +Return the last element in DoubleVector. +*/ +SWIGINTERN VALUE +_wrap_DoubleVector_back(int argc, VALUE *argv, VALUE self) { + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< double >::value_type *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< double > const *","back", 1, self )); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + result = (std::vector< double >::value_type *) &((std::vector< double > const *)arg1)->back(); + vresult = SWIG_From_double(static_cast< double >(*result)); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::DoubleVector.assign + + call-seq: + assign(n, x) + +Assign a new DoubleVector or portion of it. +*/ +SWIGINTERN VALUE +_wrap_DoubleVector_assign(int argc, VALUE *argv, VALUE self) { + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + std::vector< double >::size_type arg2 ; + std::vector< double >::value_type *arg3 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + size_t val2 ; + int ecode2 = 0 ; + std::vector< double >::value_type temp3 ; + double val3 ; + int ecode3 = 0 ; + + if ((argc < 2) || (argc > 2)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< double > *","assign", 1, self )); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + ecode2 = SWIG_AsVal_size_t(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< double >::size_type","assign", 2, argv[0] )); + } + arg2 = static_cast< std::vector< double >::size_type >(val2); + ecode3 = SWIG_AsVal_double(argv[1], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "std::vector< double >::value_type","assign", 3, argv[1] )); + } + temp3 = static_cast< std::vector< double >::value_type >(val3); + arg3 = &temp3; + (arg1)->assign(arg2,(std::vector< double >::value_type const &)*arg3); + return Qnil; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::DoubleVector.resize + + call-seq: + resize(new_size) + resize(new_size, x) + +Resize the size of the DoubleVector. +*/ +SWIGINTERN VALUE +_wrap_DoubleVector_resize__SWIG_1(int argc, VALUE *argv, VALUE self) { + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + std::vector< double >::size_type arg2 ; + std::vector< double >::value_type *arg3 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + size_t val2 ; + int ecode2 = 0 ; + std::vector< double >::value_type temp3 ; + double val3 ; + int ecode3 = 0 ; + + if ((argc < 2) || (argc > 2)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< double > *","resize", 1, self )); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + ecode2 = SWIG_AsVal_size_t(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< double >::size_type","resize", 2, argv[0] )); + } + arg2 = static_cast< std::vector< double >::size_type >(val2); + ecode3 = SWIG_AsVal_double(argv[1], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "std::vector< double >::value_type","resize", 3, argv[1] )); + } + temp3 = static_cast< std::vector< double >::value_type >(val3); + arg3 = &temp3; + (arg1)->resize(arg2,(std::vector< double >::value_type const &)*arg3); + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE _wrap_DoubleVector_resize(int nargs, VALUE *args, VALUE self) { + int argc; + VALUE argv[4]; + int ii; + + argc = nargs + 1; + argv[0] = self; + if (argc > 4) SWIG_fail; + for (ii = 1; (ii < argc); ++ii) { + argv[ii] = args[ii-1]; + } + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::vector< double,std::allocator< double > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_size_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_DoubleVector_resize__SWIG_0(nargs, args, self); + } + } + } + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::vector< double,std::allocator< double > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_size_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_double(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_DoubleVector_resize__SWIG_1(nargs, args, self); + } + } + } + } + +fail: + Ruby_Format_OverloadedError( argc, 4, "DoubleVector.resize", + " void DoubleVector.resize(std::vector< double >::size_type new_size)\n" + " void DoubleVector.resize(std::vector< double >::size_type new_size, std::vector< double >::value_type const &x)\n"); + + return Qnil; +} + + +/* + Document-method: Cdi::DoubleVector.insert + + call-seq: + insert(pos, argc) -> DoubleVector + insert(pos, x) -> std::vector< double >::iterator + insert(pos, n, x) + +Insert one or more new elements in the DoubleVector. +*/ +SWIGINTERN VALUE +_wrap_DoubleVector_insert__SWIG_1(int argc, VALUE *argv, VALUE self) { + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + std::vector< double >::iterator arg2 ; + std::vector< double >::value_type *arg3 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + swig::Iterator *iter2 = 0 ; + int res2 ; + std::vector< double >::value_type temp3 ; + double val3 ; + int ecode3 = 0 ; + std::vector< double >::iterator result; + VALUE vresult = Qnil; + + if ((argc < 2) || (argc > 2)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< double > *","insert", 1, self )); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + res2 = SWIG_ConvertPtr(argv[0], SWIG_as_voidptrptr(&iter2), swig::Iterator::descriptor(), 0); + if (!SWIG_IsOK(res2) || !iter2) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), Ruby_Format_TypeError( "", "std::vector< double >::iterator","insert", 2, argv[0] )); + } else { + swig::Iterator_T<std::vector< double >::iterator > *iter_t = dynamic_cast<swig::Iterator_T<std::vector< double >::iterator > *>(iter2); + if (iter_t) { + arg2 = iter_t->get_current(); + } else { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), Ruby_Format_TypeError( "", "std::vector< double >::iterator","insert", 2, argv[0] )); + } + } + ecode3 = SWIG_AsVal_double(argv[1], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "std::vector< double >::value_type","insert", 3, argv[1] )); + } + temp3 = static_cast< std::vector< double >::value_type >(val3); + arg3 = &temp3; + result = std_vector_Sl_double_Sg__insert__SWIG_1(arg1,arg2,(double const &)*arg3); + vresult = SWIG_NewPointerObj(swig::make_nonconst_iterator(static_cast< const std::vector< double >::iterator & >(result), + self), + swig::Iterator::descriptor(),SWIG_POINTER_OWN); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_DoubleVector_insert__SWIG_2(int argc, VALUE *argv, VALUE self) { + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + std::vector< double >::iterator arg2 ; + std::vector< double >::size_type arg3 ; + std::vector< double >::value_type *arg4 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + swig::Iterator *iter2 = 0 ; + int res2 ; + size_t val3 ; + int ecode3 = 0 ; + std::vector< double >::value_type temp4 ; + double val4 ; + int ecode4 = 0 ; + + if ((argc < 3) || (argc > 3)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< double > *","insert", 1, self )); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + res2 = SWIG_ConvertPtr(argv[0], SWIG_as_voidptrptr(&iter2), swig::Iterator::descriptor(), 0); + if (!SWIG_IsOK(res2) || !iter2) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), Ruby_Format_TypeError( "", "std::vector< double >::iterator","insert", 2, argv[0] )); + } else { + swig::Iterator_T<std::vector< double >::iterator > *iter_t = dynamic_cast<swig::Iterator_T<std::vector< double >::iterator > *>(iter2); + if (iter_t) { + arg2 = iter_t->get_current(); + } else { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), Ruby_Format_TypeError( "", "std::vector< double >::iterator","insert", 2, argv[0] )); + } + } + ecode3 = SWIG_AsVal_size_t(argv[1], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "std::vector< double >::size_type","insert", 3, argv[1] )); + } + arg3 = static_cast< std::vector< double >::size_type >(val3); + ecode4 = SWIG_AsVal_double(argv[2], &val4); + if (!SWIG_IsOK(ecode4)) { + SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "std::vector< double >::value_type","insert", 4, argv[2] )); + } + temp4 = static_cast< std::vector< double >::value_type >(val4); + arg4 = &temp4; + std_vector_Sl_double_Sg__insert__SWIG_2(arg1,arg2,arg3,(double const &)*arg4); + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE _wrap_DoubleVector_insert(int nargs, VALUE *args, VALUE self) { + int argc; + VALUE argv[5]; + int ii; + + argc = nargs + 1; + argv[0] = self; + if (argc > 5) SWIG_fail; + for (ii = 1; (ii < argc); ++ii) { + argv[ii] = args[ii-1]; + } + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::vector< double,std::allocator< double > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + swig::ConstIterator *iter = 0; + int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::Iterator::descriptor(), 0); + _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::Iterator_T<std::vector< double >::iterator > *>(iter) != 0)); + if (_v) { + { + int res = SWIG_AsVal_double(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_DoubleVector_insert__SWIG_1(nargs, args, self); + } + } + } + } + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::vector< double,std::allocator< double > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + if (argc <= 3) { + return _wrap_DoubleVector_insert__SWIG_0(nargs, args, self); + } + return _wrap_DoubleVector_insert__SWIG_0(nargs, args, self); + } + } + } + } + if (argc == 4) { + int _v; + int res = swig::asptr(argv[0], (std::vector< double,std::allocator< double > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + swig::ConstIterator *iter = 0; + int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::Iterator::descriptor(), 0); + _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::Iterator_T<std::vector< double >::iterator > *>(iter) != 0)); + if (_v) { + { + int res = SWIG_AsVal_size_t(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_double(argv[3], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_DoubleVector_insert__SWIG_2(nargs, args, self); + } + } + } + } + } + +fail: + Ruby_Format_OverloadedError( argc, 5, "insert", + " std::vector< double,std::allocator< double > > insert(std::vector< double >::difference_type pos, int argc, VALUE *argv, ...)\n" + " std::vector< double >::iterator insert(std::vector< double >::iterator pos, std::vector< double >::value_type const &x)\n" + " void insert(std::vector< double >::iterator pos, std::vector< double >::size_type n, std::vector< double >::value_type const &x)\n"); + + return Qnil; +} + + +/* + Document-method: Cdi::DoubleVector.reserve + + call-seq: + reserve(n) + +Reserve memory in the DoubleVector for a number of elements. +*/ +SWIGINTERN VALUE +_wrap_DoubleVector_reserve(int argc, VALUE *argv, VALUE self) { + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + std::vector< double >::size_type arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + size_t val2 ; + int ecode2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< double > *","reserve", 1, self )); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + ecode2 = SWIG_AsVal_size_t(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< double >::size_type","reserve", 2, argv[0] )); + } + arg2 = static_cast< std::vector< double >::size_type >(val2); + (arg1)->reserve(arg2); + return Qnil; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::DoubleVector.capacity + + call-seq: + capacity -> std::vector< double >::size_type + +Reserved capacity of the DoubleVector. +*/ +SWIGINTERN VALUE +_wrap_DoubleVector_capacity(int argc, VALUE *argv, VALUE self) { + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< double >::size_type result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< double > const *","capacity", 1, self )); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + result = ((std::vector< double > const *)arg1)->capacity(); + vresult = SWIG_From_size_t(static_cast< size_t >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_DoubleVector_mapN___(int argc, VALUE *argv, VALUE self) { + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< double,std::allocator< double > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< double > *","map_bang", 1, self )); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + result = (std::vector< double,std::allocator< double > > *)std_vector_Sl_double_Sg__map_bang(arg1); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::DoubleVector.delete + + call-seq: + delete(val) -> VALUE + +Delete a matching element. +*/ +SWIGINTERN VALUE +_wrap_DoubleVector_delete(int argc, VALUE *argv, VALUE self) { + std::vector< double > *arg1 = (std::vector< double > *) 0 ; + double *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + double temp2 ; + double val2 ; + int ecode2 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< double > *","__delete__", 1, self )); + } + arg1 = reinterpret_cast< std::vector< double > * >(argp1); + ecode2 = SWIG_AsVal_double(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "double","__delete__", 2, argv[0] )); + } + temp2 = static_cast< double >(val2); + arg2 = &temp2; + result = (VALUE)std_vector_Sl_double_Sg____delete__(arg1,(double const &)*arg2); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN void +free_std_vector_Sl_double_Sg_(void *self) { + std::vector< double > *arg1 = (std::vector< double > *)self; + delete arg1; +} + +static swig_class SwigClassDoubleDoubleVector; + +/* + Document-method: Cdi::DoubleDoubleVector.dup + + call-seq: + dup -> DoubleDoubleVector + +Create a duplicate of the class and unfreeze it if needed. +*/ +SWIGINTERN VALUE +_wrap_DoubleDoubleVector_dup(int argc, VALUE *argv, VALUE self) { + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::vector< double > > *","dup", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + result = (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *)std_vector_Sl_std_vector_Sl_double_Sg__Sg__dup(arg1); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::DoubleDoubleVector.inspect + + call-seq: + inspect -> VALUE + +Inspect class and its contents. +*/ +SWIGINTERN VALUE +_wrap_DoubleDoubleVector_inspect(int argc, VALUE *argv, VALUE self) { + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::vector< double > > *","inspect", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + result = (VALUE)std_vector_Sl_std_vector_Sl_double_Sg__Sg__inspect(arg1); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::DoubleDoubleVector.to_a + + call-seq: + to_a -> VALUE + +Convert DoubleDoubleVector to an Array. +*/ +SWIGINTERN VALUE +_wrap_DoubleDoubleVector_to_a(int argc, VALUE *argv, VALUE self) { + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::vector< double > > *","to_a", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + result = (VALUE)std_vector_Sl_std_vector_Sl_double_Sg__Sg__to_a(arg1); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::DoubleDoubleVector.to_s + + call-seq: + to_s -> VALUE + +Convert class to a String representation. +*/ +SWIGINTERN VALUE +_wrap_DoubleDoubleVector_to_s(int argc, VALUE *argv, VALUE self) { + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::vector< double > > *","to_s", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + result = (VALUE)std_vector_Sl_std_vector_Sl_double_Sg__Sg__to_s(arg1); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::DoubleDoubleVector.slice + + call-seq: + slice(i, length) -> VALUE + +Return a slice (portion of) the DoubleDoubleVector. +*/ +SWIGINTERN VALUE +_wrap_DoubleDoubleVector_slice(int argc, VALUE *argv, VALUE self) { + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + std::vector< std::vector< double > >::difference_type arg2 ; + std::vector< std::vector< double > >::difference_type arg3 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + ptrdiff_t val3 ; + int ecode3 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 2) || (argc > 2)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::vector< double > > *","slice", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< std::vector< double > >::difference_type","slice", 2, argv[0] )); + } + arg2 = static_cast< std::vector< std::vector< double > >::difference_type >(val2); + ecode3 = SWIG_AsVal_ptrdiff_t(argv[1], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "std::vector< std::vector< double > >::difference_type","slice", 3, argv[1] )); + } + arg3 = static_cast< std::vector< std::vector< double > >::difference_type >(val3); + try { + result = (VALUE)std_vector_Sl_std_vector_Sl_double_Sg__Sg__slice(arg1,arg2,arg3); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::DoubleDoubleVector.each + + call-seq: + each -> DoubleDoubleVector + +Iterate thru each element in the DoubleDoubleVector. A block must be provided. +*/ +SWIGINTERN VALUE +_wrap_DoubleDoubleVector_each(int argc, VALUE *argv, VALUE self) { + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::vector< double > > *","each", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + result = (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *)std_vector_Sl_std_vector_Sl_double_Sg__Sg__each(arg1); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_DoubleDoubleVector___delete2__(int argc, VALUE *argv, VALUE self) { + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + std::vector< std::vector< double > >::value_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 = SWIG_OLDOBJ ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::vector< double > > *","__delete2__", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + { + std::vector< double,std::allocator< double > > *ptr = (std::vector< double,std::allocator< double > > *)0; + res2 = swig::asptr(argv[0], &ptr); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::vector< std::vector< double > >::value_type const &","__delete2__", 2, argv[0] )); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::vector< std::vector< double > >::value_type const &","__delete2__", 2, argv[0])); + } + arg2 = ptr; + } + result = (VALUE)std_vector_Sl_std_vector_Sl_double_Sg__Sg____delete2__(arg1,(std::vector< double,std::allocator< double > > const &)*arg2); + vresult = result; + if (SWIG_IsNewObj(res2)) delete arg2; + return vresult; +fail: + if (SWIG_IsNewObj(res2)) delete arg2; + return Qnil; +} + + +/* + Document-method: Cdi::DoubleDoubleVector.select + + call-seq: + select -> DoubleDoubleVector + +Iterate thru each element in the DoubleDoubleVector and select those that match a condition. A block must be provided. +*/ +SWIGINTERN VALUE +_wrap_DoubleDoubleVector_select(int argc, VALUE *argv, VALUE self) { + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::vector< double > > *","select", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + result = (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *)std_vector_Sl_std_vector_Sl_double_Sg__Sg__select(arg1); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::DoubleDoubleVector.delete_at + + call-seq: + delete_at(i) -> VALUE + +Delete an element at a certain index. +*/ +SWIGINTERN VALUE +_wrap_DoubleDoubleVector_delete_at(int argc, VALUE *argv, VALUE self) { + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + std::vector< std::vector< double > >::difference_type arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::vector< double > > *","delete_at", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< std::vector< double > >::difference_type","delete_at", 2, argv[0] )); + } + arg2 = static_cast< std::vector< std::vector< double > >::difference_type >(val2); + result = (VALUE)std_vector_Sl_std_vector_Sl_double_Sg__Sg__delete_at(arg1,arg2); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::DoubleDoubleVector.at + + call-seq: + at(i) -> VALUE + +Return element at a certain index. +*/ +SWIGINTERN VALUE +_wrap_DoubleDoubleVector_at(int argc, VALUE *argv, VALUE self) { + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + std::vector< std::vector< double > >::difference_type arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::vector< double > > const *","at", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< std::vector< double > >::difference_type","at", 2, argv[0] )); + } + arg2 = static_cast< std::vector< std::vector< double > >::difference_type >(val2); + result = (VALUE)std_vector_Sl_std_vector_Sl_double_Sg__Sg__at((std::vector< std::vector< double > > const *)arg1,arg2); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::DoubleDoubleVector.[] + + call-seq: + [](i, length) -> VALUE + [](i) -> VALUE + [](i) -> VALUE + +Element accessor/slicing. +*/ +SWIGINTERN VALUE +_wrap_DoubleDoubleVector___getitem____SWIG_0(int argc, VALUE *argv, VALUE self) { + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + std::vector< std::vector< double > >::difference_type arg2 ; + std::vector< std::vector< double > >::difference_type arg3 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + ptrdiff_t val3 ; + int ecode3 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 2) || (argc > 2)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::vector< double > > const *","__getitem__", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< std::vector< double > >::difference_type","__getitem__", 2, argv[0] )); + } + arg2 = static_cast< std::vector< std::vector< double > >::difference_type >(val2); + ecode3 = SWIG_AsVal_ptrdiff_t(argv[1], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "std::vector< std::vector< double > >::difference_type","__getitem__", 3, argv[1] )); + } + arg3 = static_cast< std::vector< std::vector< double > >::difference_type >(val3); + try { + result = (VALUE)std_vector_Sl_std_vector_Sl_double_Sg__Sg____getitem____SWIG_0((std::vector< std::vector< double > > const *)arg1,arg2,arg3); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } + vresult = result; + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_DoubleDoubleVector___getitem____SWIG_1(int argc, VALUE *argv, VALUE self) { + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + std::vector< std::vector< double > >::difference_type arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::vector< double > > const *","__getitem__", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< std::vector< double > >::difference_type","__getitem__", 2, argv[0] )); + } + arg2 = static_cast< std::vector< std::vector< double > >::difference_type >(val2); + result = (VALUE)std_vector_Sl_std_vector_Sl_double_Sg__Sg____getitem____SWIG_1((std::vector< std::vector< double > > const *)arg1,arg2); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_DoubleDoubleVector___getitem____SWIG_2(int argc, VALUE *argv, VALUE self) { + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + VALUE arg2 = (VALUE) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::vector< double > > const *","__getitem__", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + arg2 = argv[0]; + try { + result = (VALUE)std_vector_Sl_std_vector_Sl_double_Sg__Sg____getitem____SWIG_2((std::vector< std::vector< double > > const *)arg1,arg2); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } + vresult = result; + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE _wrap_DoubleDoubleVector___getitem__(int nargs, VALUE *args, VALUE self) { + int argc; + VALUE argv[4]; + int ii; + + argc = nargs + 1; + argv[0] = self; + if (argc > 4) SWIG_fail; + for (ii = 1; (ii < argc); ++ii) { + argv[ii] = args[ii-1]; + } + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_DoubleDoubleVector___getitem____SWIG_1(nargs, args, self); + } + } + } + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + _v = (argv[1] != 0); + if (_v) { + return _wrap_DoubleDoubleVector___getitem____SWIG_2(nargs, args, self); + } + } + } + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_DoubleDoubleVector___getitem____SWIG_0(nargs, args, self); + } + } + } + } + +fail: + Ruby_Format_OverloadedError( argc, 4, "__getitem__", + " VALUE __getitem__(std::vector< std::vector< double > >::difference_type i, std::vector< std::vector< double > >::difference_type length)\n" + " VALUE __getitem__(std::vector< std::vector< double > >::difference_type i)\n" + " VALUE __getitem__(VALUE i)\n"); + + return Qnil; +} + + +/* + Document-method: Cdi::DoubleDoubleVector.[]= + + call-seq: + []=(i, x) -> VALUE + []=(i, length, v) -> VALUE + +Element setter/slicing. +*/ +SWIGINTERN VALUE +_wrap_DoubleDoubleVector___setitem____SWIG_0(int argc, VALUE *argv, VALUE self) { + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + std::vector< std::vector< double > >::difference_type arg2 ; + std::vector< std::vector< double > >::value_type *arg3 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + int res3 = SWIG_OLDOBJ ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 2) || (argc > 2)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::vector< double > > *","__setitem__", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< std::vector< double > >::difference_type","__setitem__", 2, argv[0] )); + } + arg2 = static_cast< std::vector< std::vector< double > >::difference_type >(val2); + { + std::vector< double,std::allocator< double > > *ptr = (std::vector< double,std::allocator< double > > *)0; + res3 = swig::asptr(argv[1], &ptr); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "std::vector< std::vector< double > >::value_type const &","__setitem__", 3, argv[1] )); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::vector< std::vector< double > >::value_type const &","__setitem__", 3, argv[1])); + } + arg3 = ptr; + } + try { + result = (VALUE)std_vector_Sl_std_vector_Sl_double_Sg__Sg____setitem____SWIG_0(arg1,arg2,(std::vector< double,std::allocator< double > > const &)*arg3); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } + vresult = result; + if (SWIG_IsNewObj(res3)) delete arg3; + return vresult; +fail: + if (SWIG_IsNewObj(res3)) delete arg3; + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_DoubleDoubleVector___setitem____SWIG_1(int argc, VALUE *argv, VALUE self) { + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + std::vector< std::vector< double > >::difference_type arg2 ; + std::vector< std::vector< double > >::difference_type arg3 ; + std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *arg4 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + ptrdiff_t val3 ; + int ecode3 = 0 ; + int res4 = SWIG_OLDOBJ ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 3) || (argc > 3)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::vector< double > > *","__setitem__", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< std::vector< double > >::difference_type","__setitem__", 2, argv[0] )); + } + arg2 = static_cast< std::vector< std::vector< double > >::difference_type >(val2); + ecode3 = SWIG_AsVal_ptrdiff_t(argv[1], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "std::vector< std::vector< double > >::difference_type","__setitem__", 3, argv[1] )); + } + arg3 = static_cast< std::vector< std::vector< double > >::difference_type >(val3); + { + std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *ptr = (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *)0; + res4 = swig::asptr(argv[2], &ptr); + if (!SWIG_IsOK(res4)) { + SWIG_exception_fail(SWIG_ArgError(res4), Ruby_Format_TypeError( "", "std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > const &","__setitem__", 4, argv[2] )); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > const &","__setitem__", 4, argv[2])); + } + arg4 = ptr; + } + try { + result = (VALUE)std_vector_Sl_std_vector_Sl_double_Sg__Sg____setitem____SWIG_1(arg1,arg2,arg3,(std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > const &)*arg4); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } + vresult = result; + if (SWIG_IsNewObj(res4)) delete arg4; + return vresult; +fail: + if (SWIG_IsNewObj(res4)) delete arg4; + return Qnil; +} + + +SWIGINTERN VALUE _wrap_DoubleDoubleVector___setitem__(int nargs, VALUE *args, VALUE self) { + int argc; + VALUE argv[5]; + int ii; + + argc = nargs + 1; + argv[0] = self; + if (argc > 5) SWIG_fail; + for (ii = 1; (ii < argc); ++ii) { + argv[ii] = args[ii-1]; + } + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + int res = swig::asptr(argv[2], (std::vector< double,std::allocator< double > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_DoubleDoubleVector___setitem____SWIG_0(nargs, args, self); + } + } + } + } + if (argc == 4) { + int _v; + int res = swig::asptr(argv[0], (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + int res = swig::asptr(argv[3], (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_DoubleDoubleVector___setitem____SWIG_1(nargs, args, self); + } + } + } + } + } + +fail: + Ruby_Format_OverloadedError( argc, 5, "__setitem__", + " VALUE __setitem__(std::vector< std::vector< double > >::difference_type i, std::vector< std::vector< double > >::value_type const &x)\n" + " VALUE __setitem__(std::vector< std::vector< double > >::difference_type i, std::vector< std::vector< double > >::difference_type length, std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > const &v)\n"); + + return Qnil; +} + + +/* + Document-method: Cdi::DoubleDoubleVector.reject! + + call-seq: + reject! -> DoubleDoubleVector + +Iterate thru each element in the DoubleDoubleVector and reject those that fail a condition. A block must be provided. DoubleDoubleVector is modified in place. +*/ +SWIGINTERN VALUE +_wrap_DoubleDoubleVector_rejectN___(int argc, VALUE *argv, VALUE self) { + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::vector< double > > *","reject_bang", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + result = (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *)std_vector_Sl_std_vector_Sl_double_Sg__Sg__reject_bang(arg1); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::DoubleDoubleVector.pop + + call-seq: + pop -> VALUE + +Remove and return element at the end of the DoubleDoubleVector. +*/ +SWIGINTERN VALUE +_wrap_DoubleDoubleVector_pop(int argc, VALUE *argv, VALUE self) { + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::vector< double > > *","pop", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + result = (VALUE)std_vector_Sl_std_vector_Sl_double_Sg__Sg__pop(arg1); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::DoubleDoubleVector.push + + call-seq: + push(e) -> DoubleVector + +Add an element at the end of the DoubleDoubleVector. +*/ +SWIGINTERN VALUE +_wrap_DoubleDoubleVector_push(int argc, VALUE *argv, VALUE self) { + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + std::vector< std::vector< double > >::value_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 = SWIG_OLDOBJ ; + std::vector< std::vector< double > >::value_type result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::vector< double > > *","push", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + { + std::vector< double,std::allocator< double > > *ptr = (std::vector< double,std::allocator< double > > *)0; + res2 = swig::asptr(argv[0], &ptr); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::vector< std::vector< double > >::value_type const &","push", 2, argv[0] )); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::vector< std::vector< double > >::value_type const &","push", 2, argv[0])); + } + arg2 = ptr; + } + result = std_vector_Sl_std_vector_Sl_double_Sg__Sg__push(arg1,(std::vector< double,std::allocator< double > > const &)*arg2); + vresult = swig::from(static_cast< std::vector< double,std::allocator< double > > >(result)); + if (SWIG_IsNewObj(res2)) delete arg2; + return vresult; +fail: + if (SWIG_IsNewObj(res2)) delete arg2; + return Qnil; +} + + +/* + Document-method: Cdi::DoubleDoubleVector.reject + + call-seq: + reject -> DoubleDoubleVector + +Iterate thru each element in the DoubleDoubleVector and reject those that fail a condition returning a new DoubleDoubleVector. A block must be provided. +*/ +SWIGINTERN VALUE +_wrap_DoubleDoubleVector_reject(int argc, VALUE *argv, VALUE self) { + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::vector< double > > *","reject", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + result = (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *)std_vector_Sl_std_vector_Sl_double_Sg__Sg__reject(arg1); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::DoubleDoubleVector.shift + + call-seq: + shift -> VALUE + +Remove and return element at the beginning of the DoubleDoubleVector. +*/ +SWIGINTERN VALUE +_wrap_DoubleDoubleVector_shift(int argc, VALUE *argv, VALUE self) { + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::vector< double > > *","shift", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + result = (VALUE)std_vector_Sl_std_vector_Sl_double_Sg__Sg__shift(arg1); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::DoubleDoubleVector.insert + + call-seq: + insert(pos, argc) -> DoubleDoubleVector + insert(pos, x) -> std::vector< std::vector< double > >::iterator + insert(pos, n, x) + +Insert one or more new elements in the DoubleDoubleVector. +*/ +SWIGINTERN VALUE +_wrap_DoubleDoubleVector_insert__SWIG_0(int argc, VALUE *argv, VALUE self) { + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + std::vector< std::vector< double > >::difference_type arg2 ; + int arg3 ; + VALUE *arg4 = (VALUE *) 0 ; + void *arg5 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *result = 0 ; + VALUE vresult = Qnil; + + if (argc < 2) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::vector< double > > *","insert", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< std::vector< double > >::difference_type","insert", 2, argv[0] )); + } + arg2 = static_cast< std::vector< std::vector< double > >::difference_type >(val2); + { + arg3 = argc - 1; + arg4 = argv + 1; + } + result = (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *)std_vector_Sl_std_vector_Sl_double_Sg__Sg__insert__SWIG_0(arg1,arg2,arg3,arg4,arg5); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::DoubleDoubleVector.unshift + + call-seq: + unshift(argc) -> DoubleDoubleVector + +Add one or more elements at the beginning of the DoubleDoubleVector. +*/ +SWIGINTERN VALUE +_wrap_DoubleDoubleVector_unshift(int argc, VALUE *argv, VALUE self) { + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + int arg2 ; + VALUE *arg3 = (VALUE *) 0 ; + void *arg4 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *result = 0 ; + VALUE vresult = Qnil; + + if (argc < 1) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::vector< double > > *","unshift", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + { + arg2 = argc; + arg3 = argv; + } + result = (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *)std_vector_Sl_std_vector_Sl_double_Sg__Sg__unshift(arg1,arg2,arg3,arg4); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_new_DoubleDoubleVector__SWIG_0(int argc, VALUE *argv, VALUE self) { + std::vector< std::vector< double > > *result = 0 ; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + result = (std::vector< std::vector< double > > *)new std::vector< std::vector< double > >(); + DATA_PTR(self) = result; + return self; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_new_DoubleDoubleVector__SWIG_1(int argc, VALUE *argv, VALUE self) { + std::vector< std::vector< double,std::allocator< double > > > *arg1 = 0 ; + int res1 = SWIG_OLDOBJ ; + std::vector< std::vector< double > > *result = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + { + std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *ptr = (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *)0; + res1 = swig::asptr(argv[0], &ptr); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::vector< double,std::allocator< double > > > const &","vector<(std::vector<(double)>)>", 1, argv[0] )); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::vector< std::vector< double,std::allocator< double > > > const &","vector<(std::vector<(double)>)>", 1, argv[0])); + } + arg1 = ptr; + } + result = (std::vector< std::vector< double > > *)new std::vector< std::vector< double > >((std::vector< std::vector< double,std::allocator< double > > > const &)*arg1); + DATA_PTR(self) = result; + if (SWIG_IsNewObj(res1)) delete arg1; + return self; +fail: + if (SWIG_IsNewObj(res1)) delete arg1; + return Qnil; +} + + +/* + Document-method: Cdi::DoubleDoubleVector.empty? + + call-seq: + empty? -> bool + +Check if the DoubleDoubleVector is empty or not. +*/ +SWIGINTERN VALUE +_wrap_DoubleDoubleVector_emptyq___(int argc, VALUE *argv, VALUE self) { + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + bool result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::vector< double > > const *","empty", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + result = (bool)((std::vector< std::vector< double > > const *)arg1)->empty(); + vresult = SWIG_From_bool(static_cast< bool >(result)); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::DoubleDoubleVector.size + + call-seq: + size -> std::vector< std::vector< double > >::size_type + +Size or Length of the DoubleDoubleVector. +*/ +SWIGINTERN VALUE +_wrap_DoubleDoubleVector_size(int argc, VALUE *argv, VALUE self) { + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< std::vector< double > >::size_type result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::vector< double > > const *","size", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + result = ((std::vector< std::vector< double > > const *)arg1)->size(); + vresult = SWIG_From_size_t(static_cast< size_t >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_DoubleDoubleVector_swap(int argc, VALUE *argv, VALUE self) { + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + std::vector< std::vector< double,std::allocator< double > > > *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::vector< double > > *","swap", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::vector< std::vector< double,std::allocator< double > > > &","swap", 2, argv[0] )); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::vector< std::vector< double,std::allocator< double > > > &","swap", 2, argv[0])); + } + arg2 = reinterpret_cast< std::vector< std::vector< double,std::allocator< double > > > * >(argp2); + (arg1)->swap(*arg2); + return Qnil; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::DoubleDoubleVector.begin + + call-seq: + begin -> std::vector< std::vector< double > >::iterator + +Return an iterator to the beginning of the DoubleDoubleVector. +*/ +SWIGINTERN VALUE +_wrap_DoubleDoubleVector_begin(int argc, VALUE *argv, VALUE self) { + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< std::vector< double > >::iterator result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::vector< double > > *","begin", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + result = (arg1)->begin(); + vresult = SWIG_NewPointerObj(swig::make_nonconst_iterator(static_cast< const std::vector< std::vector< double > >::iterator & >(result), + self), + swig::Iterator::descriptor(),SWIG_POINTER_OWN); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::DoubleDoubleVector.end + + call-seq: + end -> std::vector< std::vector< double > >::iterator + +Return an iterator to past the end of the DoubleDoubleVector. +*/ +SWIGINTERN VALUE +_wrap_DoubleDoubleVector_end(int argc, VALUE *argv, VALUE self) { + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< std::vector< double > >::iterator result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::vector< double > > *","end", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + result = (arg1)->end(); + vresult = SWIG_NewPointerObj(swig::make_nonconst_iterator(static_cast< const std::vector< std::vector< double > >::iterator & >(result), + self), + swig::Iterator::descriptor(),SWIG_POINTER_OWN); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::DoubleDoubleVector.rbegin + + call-seq: + rbegin -> std::vector< std::vector< double > >::reverse_iterator + +Return a reverse iterator to the beginning (the end) of the DoubleDoubleVector. +*/ +SWIGINTERN VALUE +_wrap_DoubleDoubleVector_rbegin(int argc, VALUE *argv, VALUE self) { + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< std::vector< double > >::reverse_iterator result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::vector< double > > *","rbegin", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + result = (arg1)->rbegin(); + vresult = SWIG_NewPointerObj(swig::make_nonconst_iterator(static_cast< const std::vector< std::vector< double > >::reverse_iterator & >(result), + self), + swig::Iterator::descriptor(),SWIG_POINTER_OWN); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::DoubleDoubleVector.rend + + call-seq: + rend -> std::vector< std::vector< double > >::reverse_iterator + +Return a reverse iterator to past the end (past the beginning) of the DoubleDoubleVector. +*/ +SWIGINTERN VALUE +_wrap_DoubleDoubleVector_rend(int argc, VALUE *argv, VALUE self) { + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< std::vector< double > >::reverse_iterator result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::vector< double > > *","rend", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + result = (arg1)->rend(); + vresult = SWIG_NewPointerObj(swig::make_nonconst_iterator(static_cast< const std::vector< std::vector< double > >::reverse_iterator & >(result), + self), + swig::Iterator::descriptor(),SWIG_POINTER_OWN); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::DoubleDoubleVector.clear + + call-seq: + clear + +Clear DoubleDoubleVector contents. +*/ +SWIGINTERN VALUE +_wrap_DoubleDoubleVector_clear(int argc, VALUE *argv, VALUE self) { + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::vector< double > > *","clear", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + (arg1)->clear(); + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_DoubleDoubleVector_get_allocator(int argc, VALUE *argv, VALUE self) { + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + SwigValueWrapper< std::allocator< std::vector< double,std::allocator< double > > > > result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::vector< double > > const *","get_allocator", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + result = ((std::vector< std::vector< double > > const *)arg1)->get_allocator(); + vresult = SWIG_NewPointerObj((new std::vector< std::vector< double > >::allocator_type(static_cast< const std::vector< std::vector< double > >::allocator_type& >(result))), SWIGTYPE_p_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_new_DoubleDoubleVector__SWIG_2(int argc, VALUE *argv, VALUE self) { + std::vector< std::vector< double > >::size_type arg1 ; + size_t val1 ; + int ecode1 = 0 ; + std::vector< std::vector< double > > *result = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + ecode1 = SWIG_AsVal_size_t(argv[0], &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "std::vector< std::vector< double > >::size_type","vector<(std::vector<(double)>)>", 1, argv[0] )); + } + arg1 = static_cast< std::vector< std::vector< double > >::size_type >(val1); + result = (std::vector< std::vector< double > > *)new std::vector< std::vector< double > >(arg1); + DATA_PTR(self) = result; + return self; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::DoubleDoubleVector.resize + + call-seq: + resize(new_size) + resize(new_size, x) + +Resize the size of the DoubleDoubleVector. +*/ +SWIGINTERN VALUE +_wrap_DoubleDoubleVector_resize__SWIG_0(int argc, VALUE *argv, VALUE self) { + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + std::vector< std::vector< double > >::size_type arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + size_t val2 ; + int ecode2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::vector< double > > *","resize", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + ecode2 = SWIG_AsVal_size_t(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< std::vector< double > >::size_type","resize", 2, argv[0] )); + } + arg2 = static_cast< std::vector< std::vector< double > >::size_type >(val2); + (arg1)->resize(arg2); + return Qnil; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::DoubleDoubleVector.erase + + call-seq: + erase(pos) -> std::vector< std::vector< double > >::iterator + erase(first, last) -> std::vector< std::vector< double > >::iterator + +Delete a portion of the DoubleDoubleVector. +*/ +SWIGINTERN VALUE +_wrap_DoubleDoubleVector_erase__SWIG_0(int argc, VALUE *argv, VALUE self) { + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + std::vector< std::vector< double > >::iterator arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + swig::Iterator *iter2 = 0 ; + int res2 ; + std::vector< std::vector< double > >::iterator result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::vector< double > > *","erase", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + res2 = SWIG_ConvertPtr(argv[0], SWIG_as_voidptrptr(&iter2), swig::Iterator::descriptor(), 0); + if (!SWIG_IsOK(res2) || !iter2) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), Ruby_Format_TypeError( "", "std::vector< std::vector< double > >::iterator","erase", 2, argv[0] )); + } else { + swig::Iterator_T<std::vector< std::vector< double > >::iterator > *iter_t = dynamic_cast<swig::Iterator_T<std::vector< std::vector< double > >::iterator > *>(iter2); + if (iter_t) { + arg2 = iter_t->get_current(); + } else { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), Ruby_Format_TypeError( "", "std::vector< std::vector< double > >::iterator","erase", 2, argv[0] )); + } + } + result = std_vector_Sl_std_vector_Sl_double_Sg__Sg__erase__SWIG_0(arg1,arg2); + vresult = SWIG_NewPointerObj(swig::make_nonconst_iterator(static_cast< const std::vector< std::vector< double > >::iterator & >(result), + self), + swig::Iterator::descriptor(),SWIG_POINTER_OWN); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_DoubleDoubleVector_erase__SWIG_1(int argc, VALUE *argv, VALUE self) { + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + std::vector< std::vector< double > >::iterator arg2 ; + std::vector< std::vector< double > >::iterator arg3 ; + void *argp1 = 0 ; + int res1 = 0 ; + swig::Iterator *iter2 = 0 ; + int res2 ; + swig::Iterator *iter3 = 0 ; + int res3 ; + std::vector< std::vector< double > >::iterator result; + VALUE vresult = Qnil; + + if ((argc < 2) || (argc > 2)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::vector< double > > *","erase", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + res2 = SWIG_ConvertPtr(argv[0], SWIG_as_voidptrptr(&iter2), swig::Iterator::descriptor(), 0); + if (!SWIG_IsOK(res2) || !iter2) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), Ruby_Format_TypeError( "", "std::vector< std::vector< double > >::iterator","erase", 2, argv[0] )); + } else { + swig::Iterator_T<std::vector< std::vector< double > >::iterator > *iter_t = dynamic_cast<swig::Iterator_T<std::vector< std::vector< double > >::iterator > *>(iter2); + if (iter_t) { + arg2 = iter_t->get_current(); + } else { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), Ruby_Format_TypeError( "", "std::vector< std::vector< double > >::iterator","erase", 2, argv[0] )); + } + } + res3 = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter3), swig::Iterator::descriptor(), 0); + if (!SWIG_IsOK(res3) || !iter3) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), Ruby_Format_TypeError( "", "std::vector< std::vector< double > >::iterator","erase", 3, argv[1] )); + } else { + swig::Iterator_T<std::vector< std::vector< double > >::iterator > *iter_t = dynamic_cast<swig::Iterator_T<std::vector< std::vector< double > >::iterator > *>(iter3); + if (iter_t) { + arg3 = iter_t->get_current(); + } else { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), Ruby_Format_TypeError( "", "std::vector< std::vector< double > >::iterator","erase", 3, argv[1] )); + } + } + result = std_vector_Sl_std_vector_Sl_double_Sg__Sg__erase__SWIG_1(arg1,arg2,arg3); + vresult = SWIG_NewPointerObj(swig::make_nonconst_iterator(static_cast< const std::vector< std::vector< double > >::iterator & >(result), + self), + swig::Iterator::descriptor(),SWIG_POINTER_OWN); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE _wrap_DoubleDoubleVector_erase(int nargs, VALUE *args, VALUE self) { + int argc; + VALUE argv[4]; + int ii; + + argc = nargs + 1; + argv[0] = self; + if (argc > 4) SWIG_fail; + for (ii = 1; (ii < argc); ++ii) { + argv[ii] = args[ii-1]; + } + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + swig::ConstIterator *iter = 0; + int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::Iterator::descriptor(), 0); + _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::Iterator_T<std::vector< std::vector< double > >::iterator > *>(iter) != 0)); + if (_v) { + return _wrap_DoubleDoubleVector_erase__SWIG_0(nargs, args, self); + } + } + } + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + swig::ConstIterator *iter = 0; + int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::Iterator::descriptor(), 0); + _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::Iterator_T<std::vector< std::vector< double > >::iterator > *>(iter) != 0)); + if (_v) { + swig::ConstIterator *iter = 0; + int res = SWIG_ConvertPtr(argv[2], SWIG_as_voidptrptr(&iter), swig::Iterator::descriptor(), 0); + _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::Iterator_T<std::vector< std::vector< double > >::iterator > *>(iter) != 0)); + if (_v) { + return _wrap_DoubleDoubleVector_erase__SWIG_1(nargs, args, self); + } + } + } + } + +fail: + Ruby_Format_OverloadedError( argc, 4, "erase", + " std::vector< std::vector< double > >::iterator erase(std::vector< std::vector< double > >::iterator pos)\n" + " std::vector< std::vector< double > >::iterator erase(std::vector< std::vector< double > >::iterator first, std::vector< std::vector< double > >::iterator last)\n"); + + return Qnil; +} + + +SWIGINTERN VALUE +#ifdef HAVE_RB_DEFINE_ALLOC_FUNC +_wrap_DoubleDoubleVector_allocate(VALUE self) +#else +_wrap_DoubleDoubleVector_allocate(int argc, VALUE *argv, VALUE self) +#endif +{ + VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t); +#ifndef HAVE_RB_DEFINE_ALLOC_FUNC + rb_obj_call_init(vresult, argc, argv); +#endif + return vresult; +} + + +SWIGINTERN VALUE +_wrap_new_DoubleDoubleVector__SWIG_3(int argc, VALUE *argv, VALUE self) { + std::vector< std::vector< double > >::size_type arg1 ; + std::vector< std::vector< double > >::value_type *arg2 = 0 ; + size_t val1 ; + int ecode1 = 0 ; + int res2 = SWIG_OLDOBJ ; + std::vector< std::vector< double > > *result = 0 ; + + if ((argc < 2) || (argc > 2)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; + } + ecode1 = SWIG_AsVal_size_t(argv[0], &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "std::vector< std::vector< double > >::size_type","vector<(std::vector<(double)>)>", 1, argv[0] )); + } + arg1 = static_cast< std::vector< std::vector< double > >::size_type >(val1); + { + std::vector< double,std::allocator< double > > *ptr = (std::vector< double,std::allocator< double > > *)0; + res2 = swig::asptr(argv[1], &ptr); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::vector< std::vector< double > >::value_type const &","vector<(std::vector<(double)>)>", 2, argv[1] )); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::vector< std::vector< double > >::value_type const &","vector<(std::vector<(double)>)>", 2, argv[1])); + } + arg2 = ptr; + } + result = (std::vector< std::vector< double > > *)new std::vector< std::vector< double > >(arg1,(std::vector< std::vector< double > >::value_type const &)*arg2); + DATA_PTR(self) = result; + if (SWIG_IsNewObj(res2)) delete arg2; + return self; +fail: + if (SWIG_IsNewObj(res2)) delete arg2; + return Qnil; +} + + +SWIGINTERN VALUE _wrap_new_DoubleDoubleVector(int nargs, VALUE *args, VALUE self) { + int argc; + VALUE argv[2]; + int ii; + + argc = nargs; + if (argc > 2) SWIG_fail; + for (ii = 0; (ii < argc); ++ii) { + argv[ii] = args[ii]; + } + if (argc == 0) { + return _wrap_new_DoubleDoubleVector__SWIG_0(nargs, args, self); + } + if (argc == 1) { + int _v; + { + int res = SWIG_AsVal_size_t(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_new_DoubleDoubleVector__SWIG_2(nargs, args, self); + } + } + if (argc == 1) { + int _v; + int res = swig::asptr(argv[0], (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_new_DoubleDoubleVector__SWIG_1(nargs, args, self); + } + } + if (argc == 2) { + int _v; + { + int res = SWIG_AsVal_size_t(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + int res = swig::asptr(argv[1], (std::vector< double,std::allocator< double > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_new_DoubleDoubleVector__SWIG_3(nargs, args, self); + } + } + } + +fail: + Ruby_Format_OverloadedError( argc, 2, "DoubleDoubleVector.new", + " DoubleDoubleVector.new()\n" + " DoubleDoubleVector.new(std::vector< std::vector< double,std::allocator< double > > > const &other)\n" + " DoubleDoubleVector.new(std::vector< std::vector< double > >::size_type size)\n" + " DoubleDoubleVector.new(std::vector< std::vector< double > >::size_type size, std::vector< std::vector< double > >::value_type const &value)\n"); + + return Qnil; +} + + +/* + Document-method: Cdi::DoubleDoubleVector.front + + call-seq: + front -> DoubleVector + +Return the first element in DoubleDoubleVector. +*/ +SWIGINTERN VALUE +_wrap_DoubleDoubleVector_front(int argc, VALUE *argv, VALUE self) { + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< std::vector< double > >::value_type *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::vector< double > > const *","front", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + result = (std::vector< std::vector< double > >::value_type *) &((std::vector< std::vector< double > > const *)arg1)->front(); + vresult = swig::from(static_cast< std::vector< double,std::allocator< double > > >(*result)); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::DoubleDoubleVector.back + + call-seq: + back -> DoubleVector + +Return the last element in DoubleDoubleVector. +*/ +SWIGINTERN VALUE +_wrap_DoubleDoubleVector_back(int argc, VALUE *argv, VALUE self) { + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< std::vector< double > >::value_type *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::vector< double > > const *","back", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + result = (std::vector< std::vector< double > >::value_type *) &((std::vector< std::vector< double > > const *)arg1)->back(); + vresult = swig::from(static_cast< std::vector< double,std::allocator< double > > >(*result)); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::DoubleDoubleVector.assign + + call-seq: + assign(n, x) + +Assign a new DoubleDoubleVector or portion of it. +*/ +SWIGINTERN VALUE +_wrap_DoubleDoubleVector_assign(int argc, VALUE *argv, VALUE self) { + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + std::vector< std::vector< double > >::size_type arg2 ; + std::vector< std::vector< double > >::value_type *arg3 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + size_t val2 ; + int ecode2 = 0 ; + int res3 = SWIG_OLDOBJ ; + + if ((argc < 2) || (argc > 2)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::vector< double > > *","assign", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + ecode2 = SWIG_AsVal_size_t(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< std::vector< double > >::size_type","assign", 2, argv[0] )); + } + arg2 = static_cast< std::vector< std::vector< double > >::size_type >(val2); + { + std::vector< double,std::allocator< double > > *ptr = (std::vector< double,std::allocator< double > > *)0; + res3 = swig::asptr(argv[1], &ptr); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "std::vector< std::vector< double > >::value_type const &","assign", 3, argv[1] )); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::vector< std::vector< double > >::value_type const &","assign", 3, argv[1])); + } + arg3 = ptr; + } + (arg1)->assign(arg2,(std::vector< std::vector< double > >::value_type const &)*arg3); + if (SWIG_IsNewObj(res3)) delete arg3; + return Qnil; +fail: + if (SWIG_IsNewObj(res3)) delete arg3; + return Qnil; +} + + +/* + Document-method: Cdi::DoubleDoubleVector.resize + + call-seq: + resize(new_size) + resize(new_size, x) + +Resize the size of the DoubleDoubleVector. +*/ +SWIGINTERN VALUE +_wrap_DoubleDoubleVector_resize__SWIG_1(int argc, VALUE *argv, VALUE self) { + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + std::vector< std::vector< double > >::size_type arg2 ; + std::vector< std::vector< double > >::value_type *arg3 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + size_t val2 ; + int ecode2 = 0 ; + int res3 = SWIG_OLDOBJ ; + + if ((argc < 2) || (argc > 2)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::vector< double > > *","resize", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + ecode2 = SWIG_AsVal_size_t(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< std::vector< double > >::size_type","resize", 2, argv[0] )); + } + arg2 = static_cast< std::vector< std::vector< double > >::size_type >(val2); + { + std::vector< double,std::allocator< double > > *ptr = (std::vector< double,std::allocator< double > > *)0; + res3 = swig::asptr(argv[1], &ptr); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "std::vector< std::vector< double > >::value_type const &","resize", 3, argv[1] )); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::vector< std::vector< double > >::value_type const &","resize", 3, argv[1])); + } + arg3 = ptr; + } + (arg1)->resize(arg2,(std::vector< std::vector< double > >::value_type const &)*arg3); + if (SWIG_IsNewObj(res3)) delete arg3; + return Qnil; +fail: + if (SWIG_IsNewObj(res3)) delete arg3; + return Qnil; +} + + +SWIGINTERN VALUE _wrap_DoubleDoubleVector_resize(int nargs, VALUE *args, VALUE self) { + int argc; + VALUE argv[4]; + int ii; + + argc = nargs + 1; + argv[0] = self; + if (argc > 4) SWIG_fail; + for (ii = 1; (ii < argc); ++ii) { + argv[ii] = args[ii-1]; + } + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_size_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_DoubleDoubleVector_resize__SWIG_0(nargs, args, self); + } + } + } + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_size_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + int res = swig::asptr(argv[2], (std::vector< double,std::allocator< double > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_DoubleDoubleVector_resize__SWIG_1(nargs, args, self); + } + } + } + } + +fail: + Ruby_Format_OverloadedError( argc, 4, "DoubleDoubleVector.resize", + " void DoubleDoubleVector.resize(std::vector< std::vector< double > >::size_type new_size)\n" + " void DoubleDoubleVector.resize(std::vector< std::vector< double > >::size_type new_size, std::vector< std::vector< double > >::value_type const &x)\n"); + + return Qnil; +} + + +/* + Document-method: Cdi::DoubleDoubleVector.insert + + call-seq: + insert(pos, argc) -> DoubleDoubleVector + insert(pos, x) -> std::vector< std::vector< double > >::iterator + insert(pos, n, x) + +Insert one or more new elements in the DoubleDoubleVector. +*/ +SWIGINTERN VALUE +_wrap_DoubleDoubleVector_insert__SWIG_1(int argc, VALUE *argv, VALUE self) { + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + std::vector< std::vector< double > >::iterator arg2 ; + std::vector< std::vector< double > >::value_type *arg3 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + swig::Iterator *iter2 = 0 ; + int res2 ; + int res3 = SWIG_OLDOBJ ; + std::vector< std::vector< double > >::iterator result; + VALUE vresult = Qnil; + + if ((argc < 2) || (argc > 2)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::vector< double > > *","insert", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + res2 = SWIG_ConvertPtr(argv[0], SWIG_as_voidptrptr(&iter2), swig::Iterator::descriptor(), 0); + if (!SWIG_IsOK(res2) || !iter2) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), Ruby_Format_TypeError( "", "std::vector< std::vector< double > >::iterator","insert", 2, argv[0] )); + } else { + swig::Iterator_T<std::vector< std::vector< double > >::iterator > *iter_t = dynamic_cast<swig::Iterator_T<std::vector< std::vector< double > >::iterator > *>(iter2); + if (iter_t) { + arg2 = iter_t->get_current(); + } else { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), Ruby_Format_TypeError( "", "std::vector< std::vector< double > >::iterator","insert", 2, argv[0] )); + } + } + { + std::vector< double,std::allocator< double > > *ptr = (std::vector< double,std::allocator< double > > *)0; + res3 = swig::asptr(argv[1], &ptr); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "std::vector< std::vector< double > >::value_type const &","insert", 3, argv[1] )); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::vector< std::vector< double > >::value_type const &","insert", 3, argv[1])); + } + arg3 = ptr; + } + result = std_vector_Sl_std_vector_Sl_double_Sg__Sg__insert__SWIG_1(arg1,arg2,(std::vector< double,std::allocator< double > > const &)*arg3); + vresult = SWIG_NewPointerObj(swig::make_nonconst_iterator(static_cast< const std::vector< std::vector< double > >::iterator & >(result), + self), + swig::Iterator::descriptor(),SWIG_POINTER_OWN); + if (SWIG_IsNewObj(res3)) delete arg3; + return vresult; +fail: + if (SWIG_IsNewObj(res3)) delete arg3; + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_DoubleDoubleVector_insert__SWIG_2(int argc, VALUE *argv, VALUE self) { + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + std::vector< std::vector< double > >::iterator arg2 ; + std::vector< std::vector< double > >::size_type arg3 ; + std::vector< std::vector< double > >::value_type *arg4 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + swig::Iterator *iter2 = 0 ; + int res2 ; + size_t val3 ; + int ecode3 = 0 ; + int res4 = SWIG_OLDOBJ ; + + if ((argc < 3) || (argc > 3)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::vector< double > > *","insert", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + res2 = SWIG_ConvertPtr(argv[0], SWIG_as_voidptrptr(&iter2), swig::Iterator::descriptor(), 0); + if (!SWIG_IsOK(res2) || !iter2) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), Ruby_Format_TypeError( "", "std::vector< std::vector< double > >::iterator","insert", 2, argv[0] )); + } else { + swig::Iterator_T<std::vector< std::vector< double > >::iterator > *iter_t = dynamic_cast<swig::Iterator_T<std::vector< std::vector< double > >::iterator > *>(iter2); + if (iter_t) { + arg2 = iter_t->get_current(); + } else { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), Ruby_Format_TypeError( "", "std::vector< std::vector< double > >::iterator","insert", 2, argv[0] )); + } + } + ecode3 = SWIG_AsVal_size_t(argv[1], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "std::vector< std::vector< double > >::size_type","insert", 3, argv[1] )); + } + arg3 = static_cast< std::vector< std::vector< double > >::size_type >(val3); + { + std::vector< double,std::allocator< double > > *ptr = (std::vector< double,std::allocator< double > > *)0; + res4 = swig::asptr(argv[2], &ptr); + if (!SWIG_IsOK(res4)) { + SWIG_exception_fail(SWIG_ArgError(res4), Ruby_Format_TypeError( "", "std::vector< std::vector< double > >::value_type const &","insert", 4, argv[2] )); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::vector< std::vector< double > >::value_type const &","insert", 4, argv[2])); + } + arg4 = ptr; + } + std_vector_Sl_std_vector_Sl_double_Sg__Sg__insert__SWIG_2(arg1,arg2,arg3,(std::vector< double,std::allocator< double > > const &)*arg4); + if (SWIG_IsNewObj(res4)) delete arg4; + return Qnil; +fail: + if (SWIG_IsNewObj(res4)) delete arg4; + return Qnil; +} + + +SWIGINTERN VALUE _wrap_DoubleDoubleVector_insert(int nargs, VALUE *args, VALUE self) { + int argc; + VALUE argv[5]; + int ii; + + argc = nargs + 1; + argv[0] = self; + if (argc > 5) SWIG_fail; + for (ii = 1; (ii < argc); ++ii) { + argv[ii] = args[ii-1]; + } + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + swig::ConstIterator *iter = 0; + int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::Iterator::descriptor(), 0); + _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::Iterator_T<std::vector< std::vector< double > >::iterator > *>(iter) != 0)); + if (_v) { + int res = swig::asptr(argv[2], (std::vector< double,std::allocator< double > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_DoubleDoubleVector_insert__SWIG_1(nargs, args, self); + } + } + } + } + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + if (argc <= 3) { + return _wrap_DoubleDoubleVector_insert__SWIG_0(nargs, args, self); + } + return _wrap_DoubleDoubleVector_insert__SWIG_0(nargs, args, self); + } + } + } + } + if (argc == 4) { + int _v; + int res = swig::asptr(argv[0], (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + swig::ConstIterator *iter = 0; + int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::Iterator::descriptor(), 0); + _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::Iterator_T<std::vector< std::vector< double > >::iterator > *>(iter) != 0)); + if (_v) { + { + int res = SWIG_AsVal_size_t(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + int res = swig::asptr(argv[3], (std::vector< double,std::allocator< double > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_DoubleDoubleVector_insert__SWIG_2(nargs, args, self); + } + } + } + } + } + +fail: + Ruby_Format_OverloadedError( argc, 5, "insert", + " std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > insert(std::vector< std::vector< double > >::difference_type pos, int argc, VALUE *argv, ...)\n" + " std::vector< std::vector< double > >::iterator insert(std::vector< std::vector< double > >::iterator pos, std::vector< std::vector< double > >::value_type const &x)\n" + " void insert(std::vector< std::vector< double > >::iterator pos, std::vector< std::vector< double > >::size_type n, std::vector< std::vector< double > >::value_type const &x)\n"); + + return Qnil; +} + + +/* + Document-method: Cdi::DoubleDoubleVector.reserve + + call-seq: + reserve(n) + +Reserve memory in the DoubleDoubleVector for a number of elements. +*/ +SWIGINTERN VALUE +_wrap_DoubleDoubleVector_reserve(int argc, VALUE *argv, VALUE self) { + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + std::vector< std::vector< double > >::size_type arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + size_t val2 ; + int ecode2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::vector< double > > *","reserve", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + ecode2 = SWIG_AsVal_size_t(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< std::vector< double > >::size_type","reserve", 2, argv[0] )); + } + arg2 = static_cast< std::vector< std::vector< double > >::size_type >(val2); + (arg1)->reserve(arg2); + return Qnil; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::DoubleDoubleVector.capacity + + call-seq: + capacity -> std::vector< std::vector< double > >::size_type + +Reserved capacity of the DoubleDoubleVector. +*/ +SWIGINTERN VALUE +_wrap_DoubleDoubleVector_capacity(int argc, VALUE *argv, VALUE self) { + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< std::vector< double > >::size_type result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::vector< double > > const *","capacity", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + result = ((std::vector< std::vector< double > > const *)arg1)->capacity(); + vresult = SWIG_From_size_t(static_cast< size_t >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN void +free_std_vector_Sl_std_vector_Sl_double_Sg__Sg_(void *self) { + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *)self; + delete arg1; +} + +static swig_class SwigClassStringVector; + +/* + Document-method: Cdi::StringVector.dup + + call-seq: + dup -> StringVector + +Create a duplicate of the class and unfreeze it if needed. +*/ +SWIGINTERN VALUE +_wrap_StringVector_dup(int argc, VALUE *argv, VALUE self) { + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< std::string,std::allocator< std::string > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::string > *","dup", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + result = (std::vector< std::string,std::allocator< std::string > > *)std_vector_Sl_std_string_Sg__dup(arg1); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::StringVector.inspect + + call-seq: + inspect -> VALUE + +Inspect class and its contents. +*/ +SWIGINTERN VALUE +_wrap_StringVector_inspect(int argc, VALUE *argv, VALUE self) { + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::string > *","inspect", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + result = (VALUE)std_vector_Sl_std_string_Sg__inspect(arg1); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::StringVector.to_a + + call-seq: + to_a -> VALUE + +Convert StringVector to an Array. +*/ +SWIGINTERN VALUE +_wrap_StringVector_to_a(int argc, VALUE *argv, VALUE self) { + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::string > *","to_a", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + result = (VALUE)std_vector_Sl_std_string_Sg__to_a(arg1); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::StringVector.to_s + + call-seq: + to_s -> VALUE + +Convert class to a String representation. +*/ +SWIGINTERN VALUE +_wrap_StringVector_to_s(int argc, VALUE *argv, VALUE self) { + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::string > *","to_s", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + result = (VALUE)std_vector_Sl_std_string_Sg__to_s(arg1); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::StringVector.slice + + call-seq: + slice(i, length) -> VALUE + +Return a slice (portion of) the StringVector. +*/ +SWIGINTERN VALUE +_wrap_StringVector_slice(int argc, VALUE *argv, VALUE self) { + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + std::vector< std::string >::difference_type arg2 ; + std::vector< std::string >::difference_type arg3 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + ptrdiff_t val3 ; + int ecode3 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 2) || (argc > 2)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::string > *","slice", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< std::string >::difference_type","slice", 2, argv[0] )); + } + arg2 = static_cast< std::vector< std::string >::difference_type >(val2); + ecode3 = SWIG_AsVal_ptrdiff_t(argv[1], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "std::vector< std::string >::difference_type","slice", 3, argv[1] )); + } + arg3 = static_cast< std::vector< std::string >::difference_type >(val3); + try { + result = (VALUE)std_vector_Sl_std_string_Sg__slice(arg1,arg2,arg3); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::StringVector.each + + call-seq: + each -> StringVector + +Iterate thru each element in the StringVector. A block must be provided. +*/ +SWIGINTERN VALUE +_wrap_StringVector_each(int argc, VALUE *argv, VALUE self) { + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< std::string,std::allocator< std::string > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::string > *","each", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + result = (std::vector< std::string,std::allocator< std::string > > *)std_vector_Sl_std_string_Sg__each(arg1); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_StringVector___delete2__(int argc, VALUE *argv, VALUE self) { + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + std::vector< std::string >::value_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 = SWIG_OLDOBJ ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::string > *","__delete2__", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + { + std::string *ptr = (std::string *)0; + res2 = SWIG_AsPtr_std_string(argv[0], &ptr); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::vector< std::string >::value_type const &","__delete2__", 2, argv[0] )); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::vector< std::string >::value_type const &","__delete2__", 2, argv[0])); + } + arg2 = ptr; + } + result = (VALUE)std_vector_Sl_std_string_Sg____delete2__(arg1,(std::string const &)*arg2); + vresult = result; + if (SWIG_IsNewObj(res2)) delete arg2; + return vresult; +fail: + if (SWIG_IsNewObj(res2)) delete arg2; + return Qnil; +} + + +/* + Document-method: Cdi::StringVector.select + + call-seq: + select -> StringVector + +Iterate thru each element in the StringVector and select those that match a condition. A block must be provided. +*/ +SWIGINTERN VALUE +_wrap_StringVector_select(int argc, VALUE *argv, VALUE self) { + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< std::string,std::allocator< std::string > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::string > *","select", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + result = (std::vector< std::string,std::allocator< std::string > > *)std_vector_Sl_std_string_Sg__select(arg1); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::StringVector.delete_at + + call-seq: + delete_at(i) -> VALUE + +Delete an element at a certain index. +*/ +SWIGINTERN VALUE +_wrap_StringVector_delete_at(int argc, VALUE *argv, VALUE self) { + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + std::vector< std::string >::difference_type arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::string > *","delete_at", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< std::string >::difference_type","delete_at", 2, argv[0] )); + } + arg2 = static_cast< std::vector< std::string >::difference_type >(val2); + result = (VALUE)std_vector_Sl_std_string_Sg__delete_at(arg1,arg2); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::StringVector.at + + call-seq: + at(i) -> VALUE + +Return element at a certain index. +*/ +SWIGINTERN VALUE +_wrap_StringVector_at(int argc, VALUE *argv, VALUE self) { + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + std::vector< std::string >::difference_type arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::string > const *","at", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< std::string >::difference_type","at", 2, argv[0] )); + } + arg2 = static_cast< std::vector< std::string >::difference_type >(val2); + result = (VALUE)std_vector_Sl_std_string_Sg__at((std::vector< std::string > const *)arg1,arg2); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::StringVector.[] + + call-seq: + [](i, length) -> VALUE + [](i) -> VALUE + [](i) -> VALUE + +Element accessor/slicing. +*/ +SWIGINTERN VALUE +_wrap_StringVector___getitem____SWIG_0(int argc, VALUE *argv, VALUE self) { + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + std::vector< std::string >::difference_type arg2 ; + std::vector< std::string >::difference_type arg3 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + ptrdiff_t val3 ; + int ecode3 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 2) || (argc > 2)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::string > const *","__getitem__", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< std::string >::difference_type","__getitem__", 2, argv[0] )); + } + arg2 = static_cast< std::vector< std::string >::difference_type >(val2); + ecode3 = SWIG_AsVal_ptrdiff_t(argv[1], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "std::vector< std::string >::difference_type","__getitem__", 3, argv[1] )); + } + arg3 = static_cast< std::vector< std::string >::difference_type >(val3); + try { + result = (VALUE)std_vector_Sl_std_string_Sg____getitem____SWIG_0((std::vector< std::string > const *)arg1,arg2,arg3); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } + vresult = result; + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_StringVector___getitem____SWIG_1(int argc, VALUE *argv, VALUE self) { + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + std::vector< std::string >::difference_type arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::string > const *","__getitem__", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< std::string >::difference_type","__getitem__", 2, argv[0] )); + } + arg2 = static_cast< std::vector< std::string >::difference_type >(val2); + result = (VALUE)std_vector_Sl_std_string_Sg____getitem____SWIG_1((std::vector< std::string > const *)arg1,arg2); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_StringVector___getitem____SWIG_2(int argc, VALUE *argv, VALUE self) { + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + VALUE arg2 = (VALUE) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::string > const *","__getitem__", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + arg2 = argv[0]; + try { + result = (VALUE)std_vector_Sl_std_string_Sg____getitem____SWIG_2((std::vector< std::string > const *)arg1,arg2); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } + vresult = result; + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE _wrap_StringVector___getitem__(int nargs, VALUE *args, VALUE self) { + int argc; + VALUE argv[4]; + int ii; + + argc = nargs + 1; + argv[0] = self; + if (argc > 4) SWIG_fail; + for (ii = 1; (ii < argc); ++ii) { + argv[ii] = args[ii-1]; + } + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::vector< std::string,std::allocator< std::string > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_StringVector___getitem____SWIG_1(nargs, args, self); + } + } + } + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::vector< std::string,std::allocator< std::string > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + _v = (argv[1] != 0); + if (_v) { + return _wrap_StringVector___getitem____SWIG_2(nargs, args, self); + } + } + } + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::vector< std::string,std::allocator< std::string > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_StringVector___getitem____SWIG_0(nargs, args, self); + } + } + } + } + +fail: + Ruby_Format_OverloadedError( argc, 4, "__getitem__", + " VALUE __getitem__(std::vector< std::string >::difference_type i, std::vector< std::string >::difference_type length)\n" + " VALUE __getitem__(std::vector< std::string >::difference_type i)\n" + " VALUE __getitem__(VALUE i)\n"); + + return Qnil; +} + + +/* + Document-method: Cdi::StringVector.[]= + + call-seq: + []=(i, x) -> VALUE + []=(i, length, v) -> VALUE + +Element setter/slicing. +*/ +SWIGINTERN VALUE +_wrap_StringVector___setitem____SWIG_0(int argc, VALUE *argv, VALUE self) { + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + std::vector< std::string >::difference_type arg2 ; + std::vector< std::string >::value_type *arg3 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + int res3 = SWIG_OLDOBJ ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 2) || (argc > 2)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::string > *","__setitem__", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< std::string >::difference_type","__setitem__", 2, argv[0] )); + } + arg2 = static_cast< std::vector< std::string >::difference_type >(val2); + { + std::string *ptr = (std::string *)0; + res3 = SWIG_AsPtr_std_string(argv[1], &ptr); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "std::vector< std::string >::value_type const &","__setitem__", 3, argv[1] )); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::vector< std::string >::value_type const &","__setitem__", 3, argv[1])); + } + arg3 = ptr; + } + try { + result = (VALUE)std_vector_Sl_std_string_Sg____setitem____SWIG_0(arg1,arg2,(std::string const &)*arg3); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } + vresult = result; + if (SWIG_IsNewObj(res3)) delete arg3; + return vresult; +fail: + if (SWIG_IsNewObj(res3)) delete arg3; + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_StringVector___setitem____SWIG_1(int argc, VALUE *argv, VALUE self) { + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + std::vector< std::string >::difference_type arg2 ; + std::vector< std::string >::difference_type arg3 ; + std::vector< std::string,std::allocator< std::string > > *arg4 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + ptrdiff_t val3 ; + int ecode3 = 0 ; + int res4 = SWIG_OLDOBJ ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 3) || (argc > 3)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::string > *","__setitem__", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< std::string >::difference_type","__setitem__", 2, argv[0] )); + } + arg2 = static_cast< std::vector< std::string >::difference_type >(val2); + ecode3 = SWIG_AsVal_ptrdiff_t(argv[1], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "std::vector< std::string >::difference_type","__setitem__", 3, argv[1] )); + } + arg3 = static_cast< std::vector< std::string >::difference_type >(val3); + { + std::vector< std::string,std::allocator< std::string > > *ptr = (std::vector< std::string,std::allocator< std::string > > *)0; + res4 = swig::asptr(argv[2], &ptr); + if (!SWIG_IsOK(res4)) { + SWIG_exception_fail(SWIG_ArgError(res4), Ruby_Format_TypeError( "", "std::vector< std::string,std::allocator< std::string > > const &","__setitem__", 4, argv[2] )); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::vector< std::string,std::allocator< std::string > > const &","__setitem__", 4, argv[2])); + } + arg4 = ptr; + } + try { + result = (VALUE)std_vector_Sl_std_string_Sg____setitem____SWIG_1(arg1,arg2,arg3,(std::vector< std::string,std::allocator< std::string > > const &)*arg4); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } + vresult = result; + if (SWIG_IsNewObj(res4)) delete arg4; + return vresult; +fail: + if (SWIG_IsNewObj(res4)) delete arg4; + return Qnil; +} + + +SWIGINTERN VALUE _wrap_StringVector___setitem__(int nargs, VALUE *args, VALUE self) { + int argc; + VALUE argv[5]; + int ii; + + argc = nargs + 1; + argv[0] = self; + if (argc > 5) SWIG_fail; + for (ii = 1; (ii < argc); ++ii) { + argv[ii] = args[ii-1]; + } + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::vector< std::string,std::allocator< std::string > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + int res = SWIG_AsPtr_std_string(argv[2], (std::string**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_StringVector___setitem____SWIG_0(nargs, args, self); + } + } + } + } + if (argc == 4) { + int _v; + int res = swig::asptr(argv[0], (std::vector< std::string,std::allocator< std::string > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + int res = swig::asptr(argv[3], (std::vector< std::string,std::allocator< std::string > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_StringVector___setitem____SWIG_1(nargs, args, self); + } + } + } + } + } + +fail: + Ruby_Format_OverloadedError( argc, 5, "__setitem__", + " VALUE __setitem__(std::vector< std::string >::difference_type i, std::vector< std::string >::value_type const &x)\n" + " VALUE __setitem__(std::vector< std::string >::difference_type i, std::vector< std::string >::difference_type length, std::vector< std::string,std::allocator< std::string > > const &v)\n"); + + return Qnil; +} + + +/* + Document-method: Cdi::StringVector.reject! + + call-seq: + reject! -> StringVector + +Iterate thru each element in the StringVector and reject those that fail a condition. A block must be provided. StringVector is modified in place. +*/ +SWIGINTERN VALUE +_wrap_StringVector_rejectN___(int argc, VALUE *argv, VALUE self) { + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< std::string,std::allocator< std::string > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::string > *","reject_bang", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + result = (std::vector< std::string,std::allocator< std::string > > *)std_vector_Sl_std_string_Sg__reject_bang(arg1); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::StringVector.pop + + call-seq: + pop -> VALUE + +Remove and return element at the end of the StringVector. +*/ +SWIGINTERN VALUE +_wrap_StringVector_pop(int argc, VALUE *argv, VALUE self) { + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::string > *","pop", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + result = (VALUE)std_vector_Sl_std_string_Sg__pop(arg1); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::StringVector.push + + call-seq: + push(e) -> std::vector< std::string >::value_type const + +Add an element at the end of the StringVector. +*/ +SWIGINTERN VALUE +_wrap_StringVector_push(int argc, VALUE *argv, VALUE self) { + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + std::vector< std::string >::value_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 = SWIG_OLDOBJ ; + std::vector< std::string >::value_type result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::string > *","push", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + { + std::string *ptr = (std::string *)0; + res2 = SWIG_AsPtr_std_string(argv[0], &ptr); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::vector< std::string >::value_type const &","push", 2, argv[0] )); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::vector< std::string >::value_type const &","push", 2, argv[0])); + } + arg2 = ptr; + } + result = std_vector_Sl_std_string_Sg__push(arg1,(std::string const &)*arg2); + vresult = SWIG_From_std_string(static_cast< std::string >(result)); + if (SWIG_IsNewObj(res2)) delete arg2; + return vresult; +fail: + if (SWIG_IsNewObj(res2)) delete arg2; + return Qnil; +} + + +/* + Document-method: Cdi::StringVector.reject + + call-seq: + reject -> StringVector + +Iterate thru each element in the StringVector and reject those that fail a condition returning a new StringVector. A block must be provided. +*/ +SWIGINTERN VALUE +_wrap_StringVector_reject(int argc, VALUE *argv, VALUE self) { + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< std::string,std::allocator< std::string > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::string > *","reject", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + result = (std::vector< std::string,std::allocator< std::string > > *)std_vector_Sl_std_string_Sg__reject(arg1); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::StringVector.shift + + call-seq: + shift -> VALUE + +Remove and return element at the beginning of the StringVector. +*/ +SWIGINTERN VALUE +_wrap_StringVector_shift(int argc, VALUE *argv, VALUE self) { + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::string > *","shift", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + result = (VALUE)std_vector_Sl_std_string_Sg__shift(arg1); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::StringVector.insert + + call-seq: + insert(pos, argc) -> StringVector + insert(pos, x) -> std::vector< std::string >::iterator + insert(pos, n, x) + +Insert one or more new elements in the StringVector. +*/ +SWIGINTERN VALUE +_wrap_StringVector_insert__SWIG_0(int argc, VALUE *argv, VALUE self) { + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + std::vector< std::string >::difference_type arg2 ; + int arg3 ; + VALUE *arg4 = (VALUE *) 0 ; + void *arg5 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + std::vector< std::string,std::allocator< std::string > > *result = 0 ; + VALUE vresult = Qnil; + + if (argc < 2) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::string > *","insert", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< std::string >::difference_type","insert", 2, argv[0] )); + } + arg2 = static_cast< std::vector< std::string >::difference_type >(val2); + { + arg3 = argc - 1; + arg4 = argv + 1; + } + result = (std::vector< std::string,std::allocator< std::string > > *)std_vector_Sl_std_string_Sg__insert__SWIG_0(arg1,arg2,arg3,arg4,arg5); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::StringVector.unshift + + call-seq: + unshift(argc) -> StringVector + +Add one or more elements at the beginning of the StringVector. +*/ +SWIGINTERN VALUE +_wrap_StringVector_unshift(int argc, VALUE *argv, VALUE self) { + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + int arg2 ; + VALUE *arg3 = (VALUE *) 0 ; + void *arg4 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< std::string,std::allocator< std::string > > *result = 0 ; + VALUE vresult = Qnil; + + if (argc < 1) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::string > *","unshift", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + { + arg2 = argc; + arg3 = argv; + } + result = (std::vector< std::string,std::allocator< std::string > > *)std_vector_Sl_std_string_Sg__unshift(arg1,arg2,arg3,arg4); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_new_StringVector__SWIG_0(int argc, VALUE *argv, VALUE self) { + std::vector< std::string > *result = 0 ; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + result = (std::vector< std::string > *)new std::vector< std::string >(); + DATA_PTR(self) = result; + return self; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_new_StringVector__SWIG_1(int argc, VALUE *argv, VALUE self) { + std::vector< std::string > *arg1 = 0 ; + int res1 = SWIG_OLDOBJ ; + std::vector< std::string > *result = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + { + std::vector< std::string,std::allocator< std::string > > *ptr = (std::vector< std::string,std::allocator< std::string > > *)0; + res1 = swig::asptr(argv[0], &ptr); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::string > const &","vector<(std::string)>", 1, argv[0] )); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::vector< std::string > const &","vector<(std::string)>", 1, argv[0])); + } + arg1 = ptr; + } + result = (std::vector< std::string > *)new std::vector< std::string >((std::vector< std::string > const &)*arg1); + DATA_PTR(self) = result; + if (SWIG_IsNewObj(res1)) delete arg1; + return self; +fail: + if (SWIG_IsNewObj(res1)) delete arg1; + return Qnil; +} + + +/* + Document-method: Cdi::StringVector.empty? + + call-seq: + empty? -> bool + +Check if the StringVector is empty or not. +*/ +SWIGINTERN VALUE +_wrap_StringVector_emptyq___(int argc, VALUE *argv, VALUE self) { + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + bool result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::string > const *","empty", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + result = (bool)((std::vector< std::string > const *)arg1)->empty(); + vresult = SWIG_From_bool(static_cast< bool >(result)); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::StringVector.size + + call-seq: + size -> std::vector< std::string >::size_type + +Size or Length of the StringVector. +*/ +SWIGINTERN VALUE +_wrap_StringVector_size(int argc, VALUE *argv, VALUE self) { + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< std::string >::size_type result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::string > const *","size", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + result = ((std::vector< std::string > const *)arg1)->size(); + vresult = SWIG_From_size_t(static_cast< size_t >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_StringVector_swap(int argc, VALUE *argv, VALUE self) { + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + std::vector< std::string > *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::string > *","swap", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::vector< std::string > &","swap", 2, argv[0] )); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::vector< std::string > &","swap", 2, argv[0])); + } + arg2 = reinterpret_cast< std::vector< std::string > * >(argp2); + (arg1)->swap(*arg2); + return Qnil; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::StringVector.begin + + call-seq: + begin -> std::vector< std::string >::iterator + +Return an iterator to the beginning of the StringVector. +*/ +SWIGINTERN VALUE +_wrap_StringVector_begin(int argc, VALUE *argv, VALUE self) { + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< std::string >::iterator result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::string > *","begin", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + result = (arg1)->begin(); + vresult = SWIG_NewPointerObj(swig::make_nonconst_iterator(static_cast< const std::vector< std::string >::iterator & >(result), + self), + swig::Iterator::descriptor(),SWIG_POINTER_OWN); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::StringVector.end + + call-seq: + end -> std::vector< std::string >::iterator + +Return an iterator to past the end of the StringVector. +*/ +SWIGINTERN VALUE +_wrap_StringVector_end(int argc, VALUE *argv, VALUE self) { + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< std::string >::iterator result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::string > *","end", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + result = (arg1)->end(); + vresult = SWIG_NewPointerObj(swig::make_nonconst_iterator(static_cast< const std::vector< std::string >::iterator & >(result), + self), + swig::Iterator::descriptor(),SWIG_POINTER_OWN); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::StringVector.rbegin + + call-seq: + rbegin -> std::vector< std::string >::reverse_iterator + +Return a reverse iterator to the beginning (the end) of the StringVector. +*/ +SWIGINTERN VALUE +_wrap_StringVector_rbegin(int argc, VALUE *argv, VALUE self) { + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< std::string >::reverse_iterator result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::string > *","rbegin", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + result = (arg1)->rbegin(); + vresult = SWIG_NewPointerObj(swig::make_nonconst_iterator(static_cast< const std::vector< std::string >::reverse_iterator & >(result), + self), + swig::Iterator::descriptor(),SWIG_POINTER_OWN); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::StringVector.rend + + call-seq: + rend -> std::vector< std::string >::reverse_iterator + +Return a reverse iterator to past the end (past the beginning) of the StringVector. +*/ +SWIGINTERN VALUE +_wrap_StringVector_rend(int argc, VALUE *argv, VALUE self) { + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< std::string >::reverse_iterator result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::string > *","rend", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + result = (arg1)->rend(); + vresult = SWIG_NewPointerObj(swig::make_nonconst_iterator(static_cast< const std::vector< std::string >::reverse_iterator & >(result), + self), + swig::Iterator::descriptor(),SWIG_POINTER_OWN); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::StringVector.clear + + call-seq: + clear + +Clear StringVector contents. +*/ +SWIGINTERN VALUE +_wrap_StringVector_clear(int argc, VALUE *argv, VALUE self) { + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::string > *","clear", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + (arg1)->clear(); + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_StringVector_get_allocator(int argc, VALUE *argv, VALUE self) { + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + SwigValueWrapper< std::allocator< std::string > > result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::string > const *","get_allocator", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + result = ((std::vector< std::string > const *)arg1)->get_allocator(); + vresult = SWIG_NewPointerObj((new std::vector< std::string >::allocator_type(static_cast< const std::vector< std::string >::allocator_type& >(result))), SWIGTYPE_p_std__allocatorT_std__string_t, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_new_StringVector__SWIG_2(int argc, VALUE *argv, VALUE self) { + std::vector< std::string >::size_type arg1 ; + size_t val1 ; + int ecode1 = 0 ; + std::vector< std::string > *result = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + ecode1 = SWIG_AsVal_size_t(argv[0], &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "std::vector< std::string >::size_type","vector<(std::string)>", 1, argv[0] )); + } + arg1 = static_cast< std::vector< std::string >::size_type >(val1); + result = (std::vector< std::string > *)new std::vector< std::string >(arg1); + DATA_PTR(self) = result; + return self; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::StringVector.resize + + call-seq: + resize(new_size) + resize(new_size, x) + +Resize the size of the StringVector. +*/ +SWIGINTERN VALUE +_wrap_StringVector_resize__SWIG_0(int argc, VALUE *argv, VALUE self) { + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + std::vector< std::string >::size_type arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + size_t val2 ; + int ecode2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::string > *","resize", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + ecode2 = SWIG_AsVal_size_t(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< std::string >::size_type","resize", 2, argv[0] )); + } + arg2 = static_cast< std::vector< std::string >::size_type >(val2); + (arg1)->resize(arg2); + return Qnil; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::StringVector.erase + + call-seq: + erase(pos) -> std::vector< std::string >::iterator + erase(first, last) -> std::vector< std::string >::iterator + +Delete a portion of the StringVector. +*/ +SWIGINTERN VALUE +_wrap_StringVector_erase__SWIG_0(int argc, VALUE *argv, VALUE self) { + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + std::vector< std::string >::iterator arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + swig::Iterator *iter2 = 0 ; + int res2 ; + std::vector< std::string >::iterator result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::string > *","erase", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + res2 = SWIG_ConvertPtr(argv[0], SWIG_as_voidptrptr(&iter2), swig::Iterator::descriptor(), 0); + if (!SWIG_IsOK(res2) || !iter2) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), Ruby_Format_TypeError( "", "std::vector< std::string >::iterator","erase", 2, argv[0] )); + } else { + swig::Iterator_T<std::vector< std::string >::iterator > *iter_t = dynamic_cast<swig::Iterator_T<std::vector< std::string >::iterator > *>(iter2); + if (iter_t) { + arg2 = iter_t->get_current(); + } else { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), Ruby_Format_TypeError( "", "std::vector< std::string >::iterator","erase", 2, argv[0] )); + } + } + result = std_vector_Sl_std_string_Sg__erase__SWIG_0(arg1,arg2); + vresult = SWIG_NewPointerObj(swig::make_nonconst_iterator(static_cast< const std::vector< std::string >::iterator & >(result), + self), + swig::Iterator::descriptor(),SWIG_POINTER_OWN); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_StringVector_erase__SWIG_1(int argc, VALUE *argv, VALUE self) { + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + std::vector< std::string >::iterator arg2 ; + std::vector< std::string >::iterator arg3 ; + void *argp1 = 0 ; + int res1 = 0 ; + swig::Iterator *iter2 = 0 ; + int res2 ; + swig::Iterator *iter3 = 0 ; + int res3 ; + std::vector< std::string >::iterator result; + VALUE vresult = Qnil; + + if ((argc < 2) || (argc > 2)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::string > *","erase", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + res2 = SWIG_ConvertPtr(argv[0], SWIG_as_voidptrptr(&iter2), swig::Iterator::descriptor(), 0); + if (!SWIG_IsOK(res2) || !iter2) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), Ruby_Format_TypeError( "", "std::vector< std::string >::iterator","erase", 2, argv[0] )); + } else { + swig::Iterator_T<std::vector< std::string >::iterator > *iter_t = dynamic_cast<swig::Iterator_T<std::vector< std::string >::iterator > *>(iter2); + if (iter_t) { + arg2 = iter_t->get_current(); + } else { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), Ruby_Format_TypeError( "", "std::vector< std::string >::iterator","erase", 2, argv[0] )); + } + } + res3 = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter3), swig::Iterator::descriptor(), 0); + if (!SWIG_IsOK(res3) || !iter3) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), Ruby_Format_TypeError( "", "std::vector< std::string >::iterator","erase", 3, argv[1] )); + } else { + swig::Iterator_T<std::vector< std::string >::iterator > *iter_t = dynamic_cast<swig::Iterator_T<std::vector< std::string >::iterator > *>(iter3); + if (iter_t) { + arg3 = iter_t->get_current(); + } else { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), Ruby_Format_TypeError( "", "std::vector< std::string >::iterator","erase", 3, argv[1] )); + } + } + result = std_vector_Sl_std_string_Sg__erase__SWIG_1(arg1,arg2,arg3); + vresult = SWIG_NewPointerObj(swig::make_nonconst_iterator(static_cast< const std::vector< std::string >::iterator & >(result), + self), + swig::Iterator::descriptor(),SWIG_POINTER_OWN); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE _wrap_StringVector_erase(int nargs, VALUE *args, VALUE self) { + int argc; + VALUE argv[4]; + int ii; + + argc = nargs + 1; + argv[0] = self; + if (argc > 4) SWIG_fail; + for (ii = 1; (ii < argc); ++ii) { + argv[ii] = args[ii-1]; + } + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::vector< std::string,std::allocator< std::string > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + swig::ConstIterator *iter = 0; + int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::Iterator::descriptor(), 0); + _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::Iterator_T<std::vector< std::string >::iterator > *>(iter) != 0)); + if (_v) { + return _wrap_StringVector_erase__SWIG_0(nargs, args, self); + } + } + } + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::vector< std::string,std::allocator< std::string > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + swig::ConstIterator *iter = 0; + int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::Iterator::descriptor(), 0); + _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::Iterator_T<std::vector< std::string >::iterator > *>(iter) != 0)); + if (_v) { + swig::ConstIterator *iter = 0; + int res = SWIG_ConvertPtr(argv[2], SWIG_as_voidptrptr(&iter), swig::Iterator::descriptor(), 0); + _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::Iterator_T<std::vector< std::string >::iterator > *>(iter) != 0)); + if (_v) { + return _wrap_StringVector_erase__SWIG_1(nargs, args, self); + } + } + } + } + +fail: + Ruby_Format_OverloadedError( argc, 4, "erase", + " std::vector< std::string >::iterator erase(std::vector< std::string >::iterator pos)\n" + " std::vector< std::string >::iterator erase(std::vector< std::string >::iterator first, std::vector< std::string >::iterator last)\n"); + + return Qnil; +} + + +SWIGINTERN VALUE +#ifdef HAVE_RB_DEFINE_ALLOC_FUNC +_wrap_StringVector_allocate(VALUE self) +#else +_wrap_StringVector_allocate(int argc, VALUE *argv, VALUE self) +#endif +{ + VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t); +#ifndef HAVE_RB_DEFINE_ALLOC_FUNC + rb_obj_call_init(vresult, argc, argv); +#endif + return vresult; +} + + +SWIGINTERN VALUE +_wrap_new_StringVector__SWIG_3(int argc, VALUE *argv, VALUE self) { + std::vector< std::string >::size_type arg1 ; + std::vector< std::string >::value_type *arg2 = 0 ; + size_t val1 ; + int ecode1 = 0 ; + int res2 = SWIG_OLDOBJ ; + std::vector< std::string > *result = 0 ; + + if ((argc < 2) || (argc > 2)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; + } + ecode1 = SWIG_AsVal_size_t(argv[0], &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "std::vector< std::string >::size_type","vector<(std::string)>", 1, argv[0] )); + } + arg1 = static_cast< std::vector< std::string >::size_type >(val1); + { + std::string *ptr = (std::string *)0; + res2 = SWIG_AsPtr_std_string(argv[1], &ptr); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::vector< std::string >::value_type const &","vector<(std::string)>", 2, argv[1] )); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::vector< std::string >::value_type const &","vector<(std::string)>", 2, argv[1])); + } + arg2 = ptr; + } + result = (std::vector< std::string > *)new std::vector< std::string >(arg1,(std::vector< std::string >::value_type const &)*arg2); + DATA_PTR(self) = result; + if (SWIG_IsNewObj(res2)) delete arg2; + return self; +fail: + if (SWIG_IsNewObj(res2)) delete arg2; + return Qnil; +} + + +SWIGINTERN VALUE _wrap_new_StringVector(int nargs, VALUE *args, VALUE self) { + int argc; + VALUE argv[2]; + int ii; + + argc = nargs; + if (argc > 2) SWIG_fail; + for (ii = 0; (ii < argc); ++ii) { + argv[ii] = args[ii]; + } + if (argc == 0) { + return _wrap_new_StringVector__SWIG_0(nargs, args, self); + } + if (argc == 1) { + int _v; + { + int res = SWIG_AsVal_size_t(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_new_StringVector__SWIG_2(nargs, args, self); + } + } + if (argc == 1) { + int _v; + int res = swig::asptr(argv[0], (std::vector< std::string,std::allocator< std::string > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_new_StringVector__SWIG_1(nargs, args, self); + } + } + if (argc == 2) { + int _v; + { + int res = SWIG_AsVal_size_t(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_new_StringVector__SWIG_3(nargs, args, self); + } + } + } + +fail: + Ruby_Format_OverloadedError( argc, 2, "StringVector.new", + " StringVector.new()\n" + " StringVector.new(std::vector< std::string > const &other)\n" + " StringVector.new(std::vector< std::string >::size_type size)\n" + " StringVector.new(std::vector< std::string >::size_type size, std::vector< std::string >::value_type const &value)\n"); + + return Qnil; +} + + +/* + Document-method: Cdi::StringVector.front + + call-seq: + front -> std::vector< std::string >::value_type const & + +Return the first element in StringVector. +*/ +SWIGINTERN VALUE +_wrap_StringVector_front(int argc, VALUE *argv, VALUE self) { + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< std::string >::value_type *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::string > const *","front", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + result = (std::vector< std::string >::value_type *) &((std::vector< std::string > const *)arg1)->front(); + vresult = SWIG_From_std_string(static_cast< std::string >(*result)); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::StringVector.back + + call-seq: + back -> std::vector< std::string >::value_type const & + +Return the last element in StringVector. +*/ +SWIGINTERN VALUE +_wrap_StringVector_back(int argc, VALUE *argv, VALUE self) { + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< std::string >::value_type *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::string > const *","back", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + result = (std::vector< std::string >::value_type *) &((std::vector< std::string > const *)arg1)->back(); + vresult = SWIG_From_std_string(static_cast< std::string >(*result)); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::StringVector.assign + + call-seq: + assign(n, x) + +Assign a new StringVector or portion of it. +*/ +SWIGINTERN VALUE +_wrap_StringVector_assign(int argc, VALUE *argv, VALUE self) { + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + std::vector< std::string >::size_type arg2 ; + std::vector< std::string >::value_type *arg3 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + size_t val2 ; + int ecode2 = 0 ; + int res3 = SWIG_OLDOBJ ; + + if ((argc < 2) || (argc > 2)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::string > *","assign", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + ecode2 = SWIG_AsVal_size_t(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< std::string >::size_type","assign", 2, argv[0] )); + } + arg2 = static_cast< std::vector< std::string >::size_type >(val2); + { + std::string *ptr = (std::string *)0; + res3 = SWIG_AsPtr_std_string(argv[1], &ptr); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "std::vector< std::string >::value_type const &","assign", 3, argv[1] )); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::vector< std::string >::value_type const &","assign", 3, argv[1])); + } + arg3 = ptr; + } + (arg1)->assign(arg2,(std::vector< std::string >::value_type const &)*arg3); + if (SWIG_IsNewObj(res3)) delete arg3; + return Qnil; +fail: + if (SWIG_IsNewObj(res3)) delete arg3; + return Qnil; +} + + +/* + Document-method: Cdi::StringVector.resize + + call-seq: + resize(new_size) + resize(new_size, x) + +Resize the size of the StringVector. +*/ +SWIGINTERN VALUE +_wrap_StringVector_resize__SWIG_1(int argc, VALUE *argv, VALUE self) { + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + std::vector< std::string >::size_type arg2 ; + std::vector< std::string >::value_type *arg3 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + size_t val2 ; + int ecode2 = 0 ; + int res3 = SWIG_OLDOBJ ; + + if ((argc < 2) || (argc > 2)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::string > *","resize", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + ecode2 = SWIG_AsVal_size_t(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< std::string >::size_type","resize", 2, argv[0] )); + } + arg2 = static_cast< std::vector< std::string >::size_type >(val2); + { + std::string *ptr = (std::string *)0; + res3 = SWIG_AsPtr_std_string(argv[1], &ptr); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "std::vector< std::string >::value_type const &","resize", 3, argv[1] )); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::vector< std::string >::value_type const &","resize", 3, argv[1])); + } + arg3 = ptr; + } + (arg1)->resize(arg2,(std::vector< std::string >::value_type const &)*arg3); + if (SWIG_IsNewObj(res3)) delete arg3; + return Qnil; +fail: + if (SWIG_IsNewObj(res3)) delete arg3; + return Qnil; +} + + +SWIGINTERN VALUE _wrap_StringVector_resize(int nargs, VALUE *args, VALUE self) { + int argc; + VALUE argv[4]; + int ii; + + argc = nargs + 1; + argv[0] = self; + if (argc > 4) SWIG_fail; + for (ii = 1; (ii < argc); ++ii) { + argv[ii] = args[ii-1]; + } + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::vector< std::string,std::allocator< std::string > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_size_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_StringVector_resize__SWIG_0(nargs, args, self); + } + } + } + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::vector< std::string,std::allocator< std::string > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_size_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + int res = SWIG_AsPtr_std_string(argv[2], (std::string**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_StringVector_resize__SWIG_1(nargs, args, self); + } + } + } + } + +fail: + Ruby_Format_OverloadedError( argc, 4, "StringVector.resize", + " void StringVector.resize(std::vector< std::string >::size_type new_size)\n" + " void StringVector.resize(std::vector< std::string >::size_type new_size, std::vector< std::string >::value_type const &x)\n"); + + return Qnil; +} + + +/* + Document-method: Cdi::StringVector.insert + + call-seq: + insert(pos, argc) -> StringVector + insert(pos, x) -> std::vector< std::string >::iterator + insert(pos, n, x) + +Insert one or more new elements in the StringVector. +*/ +SWIGINTERN VALUE +_wrap_StringVector_insert__SWIG_1(int argc, VALUE *argv, VALUE self) { + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + std::vector< std::string >::iterator arg2 ; + std::vector< std::string >::value_type *arg3 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + swig::Iterator *iter2 = 0 ; + int res2 ; + int res3 = SWIG_OLDOBJ ; + std::vector< std::string >::iterator result; + VALUE vresult = Qnil; + + if ((argc < 2) || (argc > 2)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::string > *","insert", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + res2 = SWIG_ConvertPtr(argv[0], SWIG_as_voidptrptr(&iter2), swig::Iterator::descriptor(), 0); + if (!SWIG_IsOK(res2) || !iter2) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), Ruby_Format_TypeError( "", "std::vector< std::string >::iterator","insert", 2, argv[0] )); + } else { + swig::Iterator_T<std::vector< std::string >::iterator > *iter_t = dynamic_cast<swig::Iterator_T<std::vector< std::string >::iterator > *>(iter2); + if (iter_t) { + arg2 = iter_t->get_current(); + } else { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), Ruby_Format_TypeError( "", "std::vector< std::string >::iterator","insert", 2, argv[0] )); + } + } + { + std::string *ptr = (std::string *)0; + res3 = SWIG_AsPtr_std_string(argv[1], &ptr); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "std::vector< std::string >::value_type const &","insert", 3, argv[1] )); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::vector< std::string >::value_type const &","insert", 3, argv[1])); + } + arg3 = ptr; + } + result = std_vector_Sl_std_string_Sg__insert__SWIG_1(arg1,arg2,(std::string const &)*arg3); + vresult = SWIG_NewPointerObj(swig::make_nonconst_iterator(static_cast< const std::vector< std::string >::iterator & >(result), + self), + swig::Iterator::descriptor(),SWIG_POINTER_OWN); + if (SWIG_IsNewObj(res3)) delete arg3; + return vresult; +fail: + if (SWIG_IsNewObj(res3)) delete arg3; + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_StringVector_insert__SWIG_2(int argc, VALUE *argv, VALUE self) { + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + std::vector< std::string >::iterator arg2 ; + std::vector< std::string >::size_type arg3 ; + std::vector< std::string >::value_type *arg4 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + swig::Iterator *iter2 = 0 ; + int res2 ; + size_t val3 ; + int ecode3 = 0 ; + int res4 = SWIG_OLDOBJ ; + + if ((argc < 3) || (argc > 3)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::string > *","insert", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + res2 = SWIG_ConvertPtr(argv[0], SWIG_as_voidptrptr(&iter2), swig::Iterator::descriptor(), 0); + if (!SWIG_IsOK(res2) || !iter2) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), Ruby_Format_TypeError( "", "std::vector< std::string >::iterator","insert", 2, argv[0] )); + } else { + swig::Iterator_T<std::vector< std::string >::iterator > *iter_t = dynamic_cast<swig::Iterator_T<std::vector< std::string >::iterator > *>(iter2); + if (iter_t) { + arg2 = iter_t->get_current(); + } else { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), Ruby_Format_TypeError( "", "std::vector< std::string >::iterator","insert", 2, argv[0] )); + } + } + ecode3 = SWIG_AsVal_size_t(argv[1], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "std::vector< std::string >::size_type","insert", 3, argv[1] )); + } + arg3 = static_cast< std::vector< std::string >::size_type >(val3); + { + std::string *ptr = (std::string *)0; + res4 = SWIG_AsPtr_std_string(argv[2], &ptr); + if (!SWIG_IsOK(res4)) { + SWIG_exception_fail(SWIG_ArgError(res4), Ruby_Format_TypeError( "", "std::vector< std::string >::value_type const &","insert", 4, argv[2] )); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::vector< std::string >::value_type const &","insert", 4, argv[2])); + } + arg4 = ptr; + } + std_vector_Sl_std_string_Sg__insert__SWIG_2(arg1,arg2,arg3,(std::string const &)*arg4); + if (SWIG_IsNewObj(res4)) delete arg4; + return Qnil; +fail: + if (SWIG_IsNewObj(res4)) delete arg4; + return Qnil; +} + + +SWIGINTERN VALUE _wrap_StringVector_insert(int nargs, VALUE *args, VALUE self) { + int argc; + VALUE argv[5]; + int ii; + + argc = nargs + 1; + argv[0] = self; + if (argc > 5) SWIG_fail; + for (ii = 1; (ii < argc); ++ii) { + argv[ii] = args[ii-1]; + } + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::vector< std::string,std::allocator< std::string > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + swig::ConstIterator *iter = 0; + int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::Iterator::descriptor(), 0); + _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::Iterator_T<std::vector< std::string >::iterator > *>(iter) != 0)); + if (_v) { + int res = SWIG_AsPtr_std_string(argv[2], (std::string**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_StringVector_insert__SWIG_1(nargs, args, self); + } + } + } + } + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::vector< std::string,std::allocator< std::string > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + if (argc <= 3) { + return _wrap_StringVector_insert__SWIG_0(nargs, args, self); + } + return _wrap_StringVector_insert__SWIG_0(nargs, args, self); + } + } + } + } + if (argc == 4) { + int _v; + int res = swig::asptr(argv[0], (std::vector< std::string,std::allocator< std::string > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + swig::ConstIterator *iter = 0; + int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::Iterator::descriptor(), 0); + _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::Iterator_T<std::vector< std::string >::iterator > *>(iter) != 0)); + if (_v) { + { + int res = SWIG_AsVal_size_t(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + int res = SWIG_AsPtr_std_string(argv[3], (std::string**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_StringVector_insert__SWIG_2(nargs, args, self); + } + } + } + } + } + +fail: + Ruby_Format_OverloadedError( argc, 5, "insert", + " std::vector< std::string,std::allocator< std::string > > insert(std::vector< std::string >::difference_type pos, int argc, VALUE *argv, ...)\n" + " std::vector< std::string >::iterator insert(std::vector< std::string >::iterator pos, std::vector< std::string >::value_type const &x)\n" + " void insert(std::vector< std::string >::iterator pos, std::vector< std::string >::size_type n, std::vector< std::string >::value_type const &x)\n"); + + return Qnil; +} + + +/* + Document-method: Cdi::StringVector.reserve + + call-seq: + reserve(n) + +Reserve memory in the StringVector for a number of elements. +*/ +SWIGINTERN VALUE +_wrap_StringVector_reserve(int argc, VALUE *argv, VALUE self) { + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + std::vector< std::string >::size_type arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + size_t val2 ; + int ecode2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::string > *","reserve", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + ecode2 = SWIG_AsVal_size_t(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< std::string >::size_type","reserve", 2, argv[0] )); + } + arg2 = static_cast< std::vector< std::string >::size_type >(val2); + (arg1)->reserve(arg2); + return Qnil; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::StringVector.capacity + + call-seq: + capacity -> std::vector< std::string >::size_type + +Reserved capacity of the StringVector. +*/ +SWIGINTERN VALUE +_wrap_StringVector_capacity(int argc, VALUE *argv, VALUE self) { + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< std::string >::size_type result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::string > const *","capacity", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + result = ((std::vector< std::string > const *)arg1)->capacity(); + vresult = SWIG_From_size_t(static_cast< size_t >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_StringVector_mapN___(int argc, VALUE *argv, VALUE self) { + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< std::string,std::allocator< std::string > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::string > *","map_bang", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + result = (std::vector< std::string,std::allocator< std::string > > *)std_vector_Sl_std_string_Sg__map_bang(arg1); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::StringVector.delete + + call-seq: + delete(val) -> VALUE + +Delete a matching element. +*/ +SWIGINTERN VALUE +_wrap_StringVector_delete(int argc, VALUE *argv, VALUE self) { + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + std::string *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 = SWIG_OLDOBJ ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< std::string > *","__delete__", 1, self )); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + { + std::string *ptr = (std::string *)0; + res2 = SWIG_AsPtr_std_string(argv[0], &ptr); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","__delete__", 2, argv[0] )); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","__delete__", 2, argv[0])); + } + arg2 = ptr; + } + result = (VALUE)std_vector_Sl_std_string_Sg____delete__(arg1,(std::string const &)*arg2); + vresult = result; + if (SWIG_IsNewObj(res2)) delete arg2; + return vresult; +fail: + if (SWIG_IsNewObj(res2)) delete arg2; + return Qnil; +} + + +SWIGINTERN void +free_std_vector_Sl_std_string_Sg_(void *self) { + std::vector< std::string > *arg1 = (std::vector< std::string > *)self; + delete arg1; +} + +static swig_class SwigClassVarsVector; + +/* + Document-method: Cdi::VarsVector.dup + + call-seq: + dup -> VarsVector + +Create a duplicate of the class and unfreeze it if needed. +*/ +SWIGINTERN VALUE +_wrap_VarsVector_dup(int argc, VALUE *argv, VALUE self) { + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< CdiVariable,std::allocator< CdiVariable > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< CdiVariable > *","dup", 1, self )); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + result = (std::vector< CdiVariable,std::allocator< CdiVariable > > *)std_vector_Sl_CdiVariable_Sg__dup(arg1); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::VarsVector.inspect + + call-seq: + inspect -> VALUE + +Inspect class and its contents. +*/ +SWIGINTERN VALUE +_wrap_VarsVector_inspect(int argc, VALUE *argv, VALUE self) { + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< CdiVariable > *","inspect", 1, self )); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + result = (VALUE)std_vector_Sl_CdiVariable_Sg__inspect(arg1); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::VarsVector.to_a + + call-seq: + to_a -> VALUE + +Convert VarsVector to an Array. +*/ +SWIGINTERN VALUE +_wrap_VarsVector_to_a(int argc, VALUE *argv, VALUE self) { + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< CdiVariable > *","to_a", 1, self )); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + result = (VALUE)std_vector_Sl_CdiVariable_Sg__to_a(arg1); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::VarsVector.to_s + + call-seq: + to_s -> VALUE + +Convert class to a String representation. +*/ +SWIGINTERN VALUE +_wrap_VarsVector_to_s(int argc, VALUE *argv, VALUE self) { + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< CdiVariable > *","to_s", 1, self )); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + result = (VALUE)std_vector_Sl_CdiVariable_Sg__to_s(arg1); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::VarsVector.slice + + call-seq: + slice(i, length) -> VALUE + +Return a slice (portion of) the VarsVector. +*/ +SWIGINTERN VALUE +_wrap_VarsVector_slice(int argc, VALUE *argv, VALUE self) { + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + std::vector< CdiVariable >::difference_type arg2 ; + std::vector< CdiVariable >::difference_type arg3 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + ptrdiff_t val3 ; + int ecode3 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 2) || (argc > 2)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< CdiVariable > *","slice", 1, self )); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< CdiVariable >::difference_type","slice", 2, argv[0] )); + } + arg2 = static_cast< std::vector< CdiVariable >::difference_type >(val2); + ecode3 = SWIG_AsVal_ptrdiff_t(argv[1], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "std::vector< CdiVariable >::difference_type","slice", 3, argv[1] )); + } + arg3 = static_cast< std::vector< CdiVariable >::difference_type >(val3); + try { + result = (VALUE)std_vector_Sl_CdiVariable_Sg__slice(arg1,arg2,arg3); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::VarsVector.each + + call-seq: + each -> VarsVector + +Iterate thru each element in the VarsVector. A block must be provided. +*/ +SWIGINTERN VALUE +_wrap_VarsVector_each(int argc, VALUE *argv, VALUE self) { + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< CdiVariable,std::allocator< CdiVariable > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< CdiVariable > *","each", 1, self )); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + result = (std::vector< CdiVariable,std::allocator< CdiVariable > > *)std_vector_Sl_CdiVariable_Sg__each(arg1); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_VarsVector___delete2__(int argc, VALUE *argv, VALUE self) { + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + std::vector< CdiVariable >::value_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 ; + int res2 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< CdiVariable > *","__delete2__", 1, self )); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_CdiVariable, 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::vector< CdiVariable >::value_type const &","__delete2__", 2, argv[0] )); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::vector< CdiVariable >::value_type const &","__delete2__", 2, argv[0])); + } + arg2 = reinterpret_cast< std::vector< CdiVariable >::value_type * >(argp2); + result = (VALUE)std_vector_Sl_CdiVariable_Sg____delete2__(arg1,(CdiVariable const &)*arg2); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::VarsVector.select + + call-seq: + select -> VarsVector + +Iterate thru each element in the VarsVector and select those that match a condition. A block must be provided. +*/ +SWIGINTERN VALUE +_wrap_VarsVector_select(int argc, VALUE *argv, VALUE self) { + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< CdiVariable,std::allocator< CdiVariable > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< CdiVariable > *","select", 1, self )); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + result = (std::vector< CdiVariable,std::allocator< CdiVariable > > *)std_vector_Sl_CdiVariable_Sg__select(arg1); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::VarsVector.delete_at + + call-seq: + delete_at(i) -> VALUE + +Delete an element at a certain index. +*/ +SWIGINTERN VALUE +_wrap_VarsVector_delete_at(int argc, VALUE *argv, VALUE self) { + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + std::vector< CdiVariable >::difference_type arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< CdiVariable > *","delete_at", 1, self )); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< CdiVariable >::difference_type","delete_at", 2, argv[0] )); + } + arg2 = static_cast< std::vector< CdiVariable >::difference_type >(val2); + result = (VALUE)std_vector_Sl_CdiVariable_Sg__delete_at(arg1,arg2); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::VarsVector.at + + call-seq: + at(i) -> VALUE + +Return element at a certain index. +*/ +SWIGINTERN VALUE +_wrap_VarsVector_at(int argc, VALUE *argv, VALUE self) { + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + std::vector< CdiVariable >::difference_type arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< CdiVariable > const *","at", 1, self )); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< CdiVariable >::difference_type","at", 2, argv[0] )); + } + arg2 = static_cast< std::vector< CdiVariable >::difference_type >(val2); + result = (VALUE)std_vector_Sl_CdiVariable_Sg__at((std::vector< CdiVariable > const *)arg1,arg2); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::VarsVector.[] + + call-seq: + [](i, length) -> VALUE + [](i) -> VALUE + [](i) -> VALUE + +Element accessor/slicing. +*/ +SWIGINTERN VALUE +_wrap_VarsVector___getitem____SWIG_0(int argc, VALUE *argv, VALUE self) { + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + std::vector< CdiVariable >::difference_type arg2 ; + std::vector< CdiVariable >::difference_type arg3 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + ptrdiff_t val3 ; + int ecode3 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 2) || (argc > 2)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< CdiVariable > const *","__getitem__", 1, self )); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< CdiVariable >::difference_type","__getitem__", 2, argv[0] )); + } + arg2 = static_cast< std::vector< CdiVariable >::difference_type >(val2); + ecode3 = SWIG_AsVal_ptrdiff_t(argv[1], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "std::vector< CdiVariable >::difference_type","__getitem__", 3, argv[1] )); + } + arg3 = static_cast< std::vector< CdiVariable >::difference_type >(val3); + try { + result = (VALUE)std_vector_Sl_CdiVariable_Sg____getitem____SWIG_0((std::vector< CdiVariable > const *)arg1,arg2,arg3); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } + vresult = result; + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_VarsVector___getitem____SWIG_1(int argc, VALUE *argv, VALUE self) { + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + std::vector< CdiVariable >::difference_type arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< CdiVariable > const *","__getitem__", 1, self )); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< CdiVariable >::difference_type","__getitem__", 2, argv[0] )); + } + arg2 = static_cast< std::vector< CdiVariable >::difference_type >(val2); + result = (VALUE)std_vector_Sl_CdiVariable_Sg____getitem____SWIG_1((std::vector< CdiVariable > const *)arg1,arg2); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_VarsVector___getitem____SWIG_2(int argc, VALUE *argv, VALUE self) { + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + VALUE arg2 = (VALUE) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< CdiVariable > const *","__getitem__", 1, self )); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + arg2 = argv[0]; + try { + result = (VALUE)std_vector_Sl_CdiVariable_Sg____getitem____SWIG_2((std::vector< CdiVariable > const *)arg1,arg2); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } + vresult = result; + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE _wrap_VarsVector___getitem__(int nargs, VALUE *args, VALUE self) { + int argc; + VALUE argv[4]; + int ii; + + argc = nargs + 1; + argv[0] = self; + if (argc > 4) SWIG_fail; + for (ii = 1; (ii < argc); ++ii) { + argv[ii] = args[ii-1]; + } + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::vector< CdiVariable,std::allocator< CdiVariable > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_VarsVector___getitem____SWIG_1(nargs, args, self); + } + } + } + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::vector< CdiVariable,std::allocator< CdiVariable > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + _v = (argv[1] != 0); + if (_v) { + return _wrap_VarsVector___getitem____SWIG_2(nargs, args, self); + } + } + } + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::vector< CdiVariable,std::allocator< CdiVariable > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_VarsVector___getitem____SWIG_0(nargs, args, self); + } + } + } + } + +fail: + Ruby_Format_OverloadedError( argc, 4, "__getitem__", + " VALUE __getitem__(std::vector< CdiVariable >::difference_type i, std::vector< CdiVariable >::difference_type length)\n" + " VALUE __getitem__(std::vector< CdiVariable >::difference_type i)\n" + " VALUE __getitem__(VALUE i)\n"); + + return Qnil; +} + + +/* + Document-method: Cdi::VarsVector.[]= + + call-seq: + []=(i, x) -> VALUE + []=(i, length, v) -> VALUE + +Element setter/slicing. +*/ +SWIGINTERN VALUE +_wrap_VarsVector___setitem____SWIG_0(int argc, VALUE *argv, VALUE self) { + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + std::vector< CdiVariable >::difference_type arg2 ; + std::vector< CdiVariable >::value_type *arg3 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + void *argp3 ; + int res3 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 2) || (argc > 2)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< CdiVariable > *","__setitem__", 1, self )); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< CdiVariable >::difference_type","__setitem__", 2, argv[0] )); + } + arg2 = static_cast< std::vector< CdiVariable >::difference_type >(val2); + res3 = SWIG_ConvertPtr(argv[1], &argp3, SWIGTYPE_p_CdiVariable, 0 ); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "std::vector< CdiVariable >::value_type const &","__setitem__", 3, argv[1] )); + } + if (!argp3) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::vector< CdiVariable >::value_type const &","__setitem__", 3, argv[1])); + } + arg3 = reinterpret_cast< std::vector< CdiVariable >::value_type * >(argp3); + try { + result = (VALUE)std_vector_Sl_CdiVariable_Sg____setitem____SWIG_0(arg1,arg2,(CdiVariable const &)*arg3); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } + vresult = result; + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_VarsVector___setitem____SWIG_1(int argc, VALUE *argv, VALUE self) { + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + std::vector< CdiVariable >::difference_type arg2 ; + std::vector< CdiVariable >::difference_type arg3 ; + std::vector< CdiVariable,std::allocator< CdiVariable > > *arg4 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + ptrdiff_t val3 ; + int ecode3 = 0 ; + int res4 = SWIG_OLDOBJ ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 3) || (argc > 3)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< CdiVariable > *","__setitem__", 1, self )); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< CdiVariable >::difference_type","__setitem__", 2, argv[0] )); + } + arg2 = static_cast< std::vector< CdiVariable >::difference_type >(val2); + ecode3 = SWIG_AsVal_ptrdiff_t(argv[1], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "std::vector< CdiVariable >::difference_type","__setitem__", 3, argv[1] )); + } + arg3 = static_cast< std::vector< CdiVariable >::difference_type >(val3); + { + std::vector< CdiVariable,std::allocator< CdiVariable > > *ptr = (std::vector< CdiVariable,std::allocator< CdiVariable > > *)0; + res4 = swig::asptr(argv[2], &ptr); + if (!SWIG_IsOK(res4)) { + SWIG_exception_fail(SWIG_ArgError(res4), Ruby_Format_TypeError( "", "std::vector< CdiVariable,std::allocator< CdiVariable > > const &","__setitem__", 4, argv[2] )); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::vector< CdiVariable,std::allocator< CdiVariable > > const &","__setitem__", 4, argv[2])); + } + arg4 = ptr; + } + try { + result = (VALUE)std_vector_Sl_CdiVariable_Sg____setitem____SWIG_1(arg1,arg2,arg3,(std::vector< CdiVariable,std::allocator< CdiVariable > > const &)*arg4); + } catch(std::invalid_argument &_e) { + SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); + } + vresult = result; + if (SWIG_IsNewObj(res4)) delete arg4; + return vresult; +fail: + if (SWIG_IsNewObj(res4)) delete arg4; + return Qnil; +} + + +SWIGINTERN VALUE _wrap_VarsVector___setitem__(int nargs, VALUE *args, VALUE self) { + int argc; + VALUE argv[5]; + int ii; + + argc = nargs + 1; + argv[0] = self; + if (argc > 5) SWIG_fail; + for (ii = 1; (ii < argc); ++ii) { + argv[ii] = args[ii-1]; + } + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::vector< CdiVariable,std::allocator< CdiVariable > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_CdiVariable, SWIG_POINTER_NO_NULL); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_VarsVector___setitem____SWIG_0(nargs, args, self); + } + } + } + } + if (argc == 4) { + int _v; + int res = swig::asptr(argv[0], (std::vector< CdiVariable,std::allocator< CdiVariable > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + int res = swig::asptr(argv[3], (std::vector< CdiVariable,std::allocator< CdiVariable > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_VarsVector___setitem____SWIG_1(nargs, args, self); + } + } + } + } + } + +fail: + Ruby_Format_OverloadedError( argc, 5, "__setitem__", + " VALUE __setitem__(std::vector< CdiVariable >::difference_type i, std::vector< CdiVariable >::value_type const &x)\n" + " VALUE __setitem__(std::vector< CdiVariable >::difference_type i, std::vector< CdiVariable >::difference_type length, std::vector< CdiVariable,std::allocator< CdiVariable > > const &v)\n"); + + return Qnil; +} + + +/* + Document-method: Cdi::VarsVector.reject! + + call-seq: + reject! -> VarsVector + +Iterate thru each element in the VarsVector and reject those that fail a condition. A block must be provided. VarsVector is modified in place. +*/ +SWIGINTERN VALUE +_wrap_VarsVector_rejectN___(int argc, VALUE *argv, VALUE self) { + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< CdiVariable,std::allocator< CdiVariable > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< CdiVariable > *","reject_bang", 1, self )); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + result = (std::vector< CdiVariable,std::allocator< CdiVariable > > *)std_vector_Sl_CdiVariable_Sg__reject_bang(arg1); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::VarsVector.pop + + call-seq: + pop -> VALUE + +Remove and return element at the end of the VarsVector. +*/ +SWIGINTERN VALUE +_wrap_VarsVector_pop(int argc, VALUE *argv, VALUE self) { + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< CdiVariable > *","pop", 1, self )); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + result = (VALUE)std_vector_Sl_CdiVariable_Sg__pop(arg1); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::VarsVector.push + + call-seq: + push(e) -> CdiVariable + +Add an element at the end of the VarsVector. +*/ +SWIGINTERN VALUE +_wrap_VarsVector_push(int argc, VALUE *argv, VALUE self) { + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + std::vector< CdiVariable >::value_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 ; + int res2 = 0 ; + std::vector< CdiVariable >::value_type result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< CdiVariable > *","push", 1, self )); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_CdiVariable, 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::vector< CdiVariable >::value_type const &","push", 2, argv[0] )); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::vector< CdiVariable >::value_type const &","push", 2, argv[0])); + } + arg2 = reinterpret_cast< std::vector< CdiVariable >::value_type * >(argp2); + result = std_vector_Sl_CdiVariable_Sg__push(arg1,(CdiVariable const &)*arg2); + vresult = SWIG_NewPointerObj((new std::vector< CdiVariable >::value_type(static_cast< const std::vector< CdiVariable >::value_type& >(result))), SWIGTYPE_p_CdiVariable, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::VarsVector.reject + + call-seq: + reject -> VarsVector + +Iterate thru each element in the VarsVector and reject those that fail a condition returning a new VarsVector. A block must be provided. +*/ +SWIGINTERN VALUE +_wrap_VarsVector_reject(int argc, VALUE *argv, VALUE self) { + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< CdiVariable,std::allocator< CdiVariable > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< CdiVariable > *","reject", 1, self )); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + result = (std::vector< CdiVariable,std::allocator< CdiVariable > > *)std_vector_Sl_CdiVariable_Sg__reject(arg1); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::VarsVector.shift + + call-seq: + shift -> VALUE + +Remove and return element at the beginning of the VarsVector. +*/ +SWIGINTERN VALUE +_wrap_VarsVector_shift(int argc, VALUE *argv, VALUE self) { + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< CdiVariable > *","shift", 1, self )); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + result = (VALUE)std_vector_Sl_CdiVariable_Sg__shift(arg1); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::VarsVector.insert + + call-seq: + insert(pos, argc) -> VarsVector + insert(pos, x) -> std::vector< CdiVariable >::iterator + insert(pos, n, x) + +Insert one or more new elements in the VarsVector. +*/ +SWIGINTERN VALUE +_wrap_VarsVector_insert__SWIG_0(int argc, VALUE *argv, VALUE self) { + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + std::vector< CdiVariable >::difference_type arg2 ; + int arg3 ; + VALUE *arg4 = (VALUE *) 0 ; + void *arg5 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + ptrdiff_t val2 ; + int ecode2 = 0 ; + std::vector< CdiVariable,std::allocator< CdiVariable > > *result = 0 ; + VALUE vresult = Qnil; + + if (argc < 2) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< CdiVariable > *","insert", 1, self )); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + ecode2 = SWIG_AsVal_ptrdiff_t(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< CdiVariable >::difference_type","insert", 2, argv[0] )); + } + arg2 = static_cast< std::vector< CdiVariable >::difference_type >(val2); + { + arg3 = argc - 1; + arg4 = argv + 1; + } + result = (std::vector< CdiVariable,std::allocator< CdiVariable > > *)std_vector_Sl_CdiVariable_Sg__insert__SWIG_0(arg1,arg2,arg3,arg4,arg5); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::VarsVector.unshift + + call-seq: + unshift(argc) -> VarsVector + +Add one or more elements at the beginning of the VarsVector. +*/ +SWIGINTERN VALUE +_wrap_VarsVector_unshift(int argc, VALUE *argv, VALUE self) { + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + int arg2 ; + VALUE *arg3 = (VALUE *) 0 ; + void *arg4 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< CdiVariable,std::allocator< CdiVariable > > *result = 0 ; + VALUE vresult = Qnil; + + if (argc < 1) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< CdiVariable > *","unshift", 1, self )); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + { + arg2 = argc; + arg3 = argv; + } + result = (std::vector< CdiVariable,std::allocator< CdiVariable > > *)std_vector_Sl_CdiVariable_Sg__unshift(arg1,arg2,arg3,arg4); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_new_VarsVector__SWIG_0(int argc, VALUE *argv, VALUE self) { + std::vector< CdiVariable > *result = 0 ; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + result = (std::vector< CdiVariable > *)new std::vector< CdiVariable >(); + DATA_PTR(self) = result; + return self; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_new_VarsVector__SWIG_1(int argc, VALUE *argv, VALUE self) { + std::vector< CdiVariable > *arg1 = 0 ; + int res1 = SWIG_OLDOBJ ; + std::vector< CdiVariable > *result = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + { + std::vector< CdiVariable,std::allocator< CdiVariable > > *ptr = (std::vector< CdiVariable,std::allocator< CdiVariable > > *)0; + res1 = swig::asptr(argv[0], &ptr); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< CdiVariable > const &","vector<(CdiVariable)>", 1, argv[0] )); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::vector< CdiVariable > const &","vector<(CdiVariable)>", 1, argv[0])); + } + arg1 = ptr; + } + result = (std::vector< CdiVariable > *)new std::vector< CdiVariable >((std::vector< CdiVariable > const &)*arg1); + DATA_PTR(self) = result; + if (SWIG_IsNewObj(res1)) delete arg1; + return self; +fail: + if (SWIG_IsNewObj(res1)) delete arg1; + return Qnil; +} + + +/* + Document-method: Cdi::VarsVector.empty? + + call-seq: + empty? -> bool + +Check if the VarsVector is empty or not. +*/ +SWIGINTERN VALUE +_wrap_VarsVector_emptyq___(int argc, VALUE *argv, VALUE self) { + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + bool result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< CdiVariable > const *","empty", 1, self )); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + result = (bool)((std::vector< CdiVariable > const *)arg1)->empty(); + vresult = SWIG_From_bool(static_cast< bool >(result)); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::VarsVector.size + + call-seq: + size -> std::vector< CdiVariable >::size_type + +Size or Length of the VarsVector. +*/ +SWIGINTERN VALUE +_wrap_VarsVector_size(int argc, VALUE *argv, VALUE self) { + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< CdiVariable >::size_type result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< CdiVariable > const *","size", 1, self )); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + result = ((std::vector< CdiVariable > const *)arg1)->size(); + vresult = SWIG_From_size_t(static_cast< size_t >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_VarsVector_swap(int argc, VALUE *argv, VALUE self) { + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + std::vector< CdiVariable > *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< CdiVariable > *","swap", 1, self )); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::vector< CdiVariable > &","swap", 2, argv[0] )); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::vector< CdiVariable > &","swap", 2, argv[0])); + } + arg2 = reinterpret_cast< std::vector< CdiVariable > * >(argp2); + (arg1)->swap(*arg2); + return Qnil; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::VarsVector.begin + + call-seq: + begin -> std::vector< CdiVariable >::iterator + +Return an iterator to the beginning of the VarsVector. +*/ +SWIGINTERN VALUE +_wrap_VarsVector_begin(int argc, VALUE *argv, VALUE self) { + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< CdiVariable >::iterator result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< CdiVariable > *","begin", 1, self )); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + result = (arg1)->begin(); + vresult = SWIG_NewPointerObj(swig::make_nonconst_iterator(static_cast< const std::vector< CdiVariable >::iterator & >(result), + self), + swig::Iterator::descriptor(),SWIG_POINTER_OWN); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::VarsVector.end + + call-seq: + end -> std::vector< CdiVariable >::iterator + +Return an iterator to past the end of the VarsVector. +*/ +SWIGINTERN VALUE +_wrap_VarsVector_end(int argc, VALUE *argv, VALUE self) { + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< CdiVariable >::iterator result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< CdiVariable > *","end", 1, self )); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + result = (arg1)->end(); + vresult = SWIG_NewPointerObj(swig::make_nonconst_iterator(static_cast< const std::vector< CdiVariable >::iterator & >(result), + self), + swig::Iterator::descriptor(),SWIG_POINTER_OWN); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::VarsVector.rbegin + + call-seq: + rbegin -> std::vector< CdiVariable >::reverse_iterator + +Return a reverse iterator to the beginning (the end) of the VarsVector. +*/ +SWIGINTERN VALUE +_wrap_VarsVector_rbegin(int argc, VALUE *argv, VALUE self) { + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< CdiVariable >::reverse_iterator result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< CdiVariable > *","rbegin", 1, self )); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + result = (arg1)->rbegin(); + vresult = SWIG_NewPointerObj(swig::make_nonconst_iterator(static_cast< const std::vector< CdiVariable >::reverse_iterator & >(result), + self), + swig::Iterator::descriptor(),SWIG_POINTER_OWN); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::VarsVector.rend + + call-seq: + rend -> std::vector< CdiVariable >::reverse_iterator + +Return a reverse iterator to past the end (past the beginning) of the VarsVector. +*/ +SWIGINTERN VALUE +_wrap_VarsVector_rend(int argc, VALUE *argv, VALUE self) { + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< CdiVariable >::reverse_iterator result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< CdiVariable > *","rend", 1, self )); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + result = (arg1)->rend(); + vresult = SWIG_NewPointerObj(swig::make_nonconst_iterator(static_cast< const std::vector< CdiVariable >::reverse_iterator & >(result), + self), + swig::Iterator::descriptor(),SWIG_POINTER_OWN); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::VarsVector.clear + + call-seq: + clear + +Clear VarsVector contents. +*/ +SWIGINTERN VALUE +_wrap_VarsVector_clear(int argc, VALUE *argv, VALUE self) { + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< CdiVariable > *","clear", 1, self )); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + (arg1)->clear(); + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_VarsVector_get_allocator(int argc, VALUE *argv, VALUE self) { + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + SwigValueWrapper< std::allocator< CdiVariable > > result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< CdiVariable > const *","get_allocator", 1, self )); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + result = ((std::vector< CdiVariable > const *)arg1)->get_allocator(); + vresult = SWIG_NewPointerObj((new std::vector< CdiVariable >::allocator_type(static_cast< const std::vector< CdiVariable >::allocator_type& >(result))), SWIGTYPE_p_std__allocatorT_CdiVariable_t, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_new_VarsVector__SWIG_2(int argc, VALUE *argv, VALUE self) { + std::vector< CdiVariable >::size_type arg1 ; + size_t val1 ; + int ecode1 = 0 ; + std::vector< CdiVariable > *result = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + ecode1 = SWIG_AsVal_size_t(argv[0], &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "std::vector< CdiVariable >::size_type","vector<(CdiVariable)>", 1, argv[0] )); + } + arg1 = static_cast< std::vector< CdiVariable >::size_type >(val1); + result = (std::vector< CdiVariable > *)new std::vector< CdiVariable >(arg1); + DATA_PTR(self) = result; + return self; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::VarsVector.resize + + call-seq: + resize(new_size) + resize(new_size, x) + +Resize the size of the VarsVector. +*/ +SWIGINTERN VALUE +_wrap_VarsVector_resize__SWIG_0(int argc, VALUE *argv, VALUE self) { + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + std::vector< CdiVariable >::size_type arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + size_t val2 ; + int ecode2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< CdiVariable > *","resize", 1, self )); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + ecode2 = SWIG_AsVal_size_t(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< CdiVariable >::size_type","resize", 2, argv[0] )); + } + arg2 = static_cast< std::vector< CdiVariable >::size_type >(val2); + (arg1)->resize(arg2); + return Qnil; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::VarsVector.erase + + call-seq: + erase(pos) -> std::vector< CdiVariable >::iterator + erase(first, last) -> std::vector< CdiVariable >::iterator + +Delete a portion of the VarsVector. +*/ +SWIGINTERN VALUE +_wrap_VarsVector_erase__SWIG_0(int argc, VALUE *argv, VALUE self) { + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + std::vector< CdiVariable >::iterator arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + swig::Iterator *iter2 = 0 ; + int res2 ; + std::vector< CdiVariable >::iterator result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< CdiVariable > *","erase", 1, self )); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + res2 = SWIG_ConvertPtr(argv[0], SWIG_as_voidptrptr(&iter2), swig::Iterator::descriptor(), 0); + if (!SWIG_IsOK(res2) || !iter2) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), Ruby_Format_TypeError( "", "std::vector< CdiVariable >::iterator","erase", 2, argv[0] )); + } else { + swig::Iterator_T<std::vector< CdiVariable >::iterator > *iter_t = dynamic_cast<swig::Iterator_T<std::vector< CdiVariable >::iterator > *>(iter2); + if (iter_t) { + arg2 = iter_t->get_current(); + } else { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), Ruby_Format_TypeError( "", "std::vector< CdiVariable >::iterator","erase", 2, argv[0] )); + } + } + result = std_vector_Sl_CdiVariable_Sg__erase__SWIG_0(arg1,arg2); + vresult = SWIG_NewPointerObj(swig::make_nonconst_iterator(static_cast< const std::vector< CdiVariable >::iterator & >(result), + self), + swig::Iterator::descriptor(),SWIG_POINTER_OWN); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_VarsVector_erase__SWIG_1(int argc, VALUE *argv, VALUE self) { + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + std::vector< CdiVariable >::iterator arg2 ; + std::vector< CdiVariable >::iterator arg3 ; + void *argp1 = 0 ; + int res1 = 0 ; + swig::Iterator *iter2 = 0 ; + int res2 ; + swig::Iterator *iter3 = 0 ; + int res3 ; + std::vector< CdiVariable >::iterator result; + VALUE vresult = Qnil; + + if ((argc < 2) || (argc > 2)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< CdiVariable > *","erase", 1, self )); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + res2 = SWIG_ConvertPtr(argv[0], SWIG_as_voidptrptr(&iter2), swig::Iterator::descriptor(), 0); + if (!SWIG_IsOK(res2) || !iter2) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), Ruby_Format_TypeError( "", "std::vector< CdiVariable >::iterator","erase", 2, argv[0] )); + } else { + swig::Iterator_T<std::vector< CdiVariable >::iterator > *iter_t = dynamic_cast<swig::Iterator_T<std::vector< CdiVariable >::iterator > *>(iter2); + if (iter_t) { + arg2 = iter_t->get_current(); + } else { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), Ruby_Format_TypeError( "", "std::vector< CdiVariable >::iterator","erase", 2, argv[0] )); + } + } + res3 = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter3), swig::Iterator::descriptor(), 0); + if (!SWIG_IsOK(res3) || !iter3) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), Ruby_Format_TypeError( "", "std::vector< CdiVariable >::iterator","erase", 3, argv[1] )); + } else { + swig::Iterator_T<std::vector< CdiVariable >::iterator > *iter_t = dynamic_cast<swig::Iterator_T<std::vector< CdiVariable >::iterator > *>(iter3); + if (iter_t) { + arg3 = iter_t->get_current(); + } else { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), Ruby_Format_TypeError( "", "std::vector< CdiVariable >::iterator","erase", 3, argv[1] )); + } + } + result = std_vector_Sl_CdiVariable_Sg__erase__SWIG_1(arg1,arg2,arg3); + vresult = SWIG_NewPointerObj(swig::make_nonconst_iterator(static_cast< const std::vector< CdiVariable >::iterator & >(result), + self), + swig::Iterator::descriptor(),SWIG_POINTER_OWN); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE _wrap_VarsVector_erase(int nargs, VALUE *args, VALUE self) { + int argc; + VALUE argv[4]; + int ii; + + argc = nargs + 1; + argv[0] = self; + if (argc > 4) SWIG_fail; + for (ii = 1; (ii < argc); ++ii) { + argv[ii] = args[ii-1]; + } + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::vector< CdiVariable,std::allocator< CdiVariable > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + swig::ConstIterator *iter = 0; + int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::Iterator::descriptor(), 0); + _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::Iterator_T<std::vector< CdiVariable >::iterator > *>(iter) != 0)); + if (_v) { + return _wrap_VarsVector_erase__SWIG_0(nargs, args, self); + } + } + } + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::vector< CdiVariable,std::allocator< CdiVariable > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + swig::ConstIterator *iter = 0; + int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::Iterator::descriptor(), 0); + _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::Iterator_T<std::vector< CdiVariable >::iterator > *>(iter) != 0)); + if (_v) { + swig::ConstIterator *iter = 0; + int res = SWIG_ConvertPtr(argv[2], SWIG_as_voidptrptr(&iter), swig::Iterator::descriptor(), 0); + _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::Iterator_T<std::vector< CdiVariable >::iterator > *>(iter) != 0)); + if (_v) { + return _wrap_VarsVector_erase__SWIG_1(nargs, args, self); + } + } + } + } + +fail: + Ruby_Format_OverloadedError( argc, 4, "erase", + " std::vector< CdiVariable >::iterator erase(std::vector< CdiVariable >::iterator pos)\n" + " std::vector< CdiVariable >::iterator erase(std::vector< CdiVariable >::iterator first, std::vector< CdiVariable >::iterator last)\n"); + + return Qnil; +} + + +SWIGINTERN VALUE +#ifdef HAVE_RB_DEFINE_ALLOC_FUNC +_wrap_VarsVector_allocate(VALUE self) +#else +_wrap_VarsVector_allocate(int argc, VALUE *argv, VALUE self) +#endif +{ + VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t); +#ifndef HAVE_RB_DEFINE_ALLOC_FUNC + rb_obj_call_init(vresult, argc, argv); +#endif + return vresult; +} + + +SWIGINTERN VALUE +_wrap_new_VarsVector__SWIG_3(int argc, VALUE *argv, VALUE self) { + std::vector< CdiVariable >::size_type arg1 ; + std::vector< CdiVariable >::value_type *arg2 = 0 ; + size_t val1 ; + int ecode1 = 0 ; + void *argp2 ; + int res2 = 0 ; + std::vector< CdiVariable > *result = 0 ; + + if ((argc < 2) || (argc > 2)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; + } + ecode1 = SWIG_AsVal_size_t(argv[0], &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "std::vector< CdiVariable >::size_type","vector<(CdiVariable)>", 1, argv[0] )); + } + arg1 = static_cast< std::vector< CdiVariable >::size_type >(val1); + res2 = SWIG_ConvertPtr(argv[1], &argp2, SWIGTYPE_p_CdiVariable, 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::vector< CdiVariable >::value_type const &","vector<(CdiVariable)>", 2, argv[1] )); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::vector< CdiVariable >::value_type const &","vector<(CdiVariable)>", 2, argv[1])); + } + arg2 = reinterpret_cast< std::vector< CdiVariable >::value_type * >(argp2); + result = (std::vector< CdiVariable > *)new std::vector< CdiVariable >(arg1,(std::vector< CdiVariable >::value_type const &)*arg2); + DATA_PTR(self) = result; + return self; +fail: + return Qnil; +} + + +SWIGINTERN VALUE _wrap_new_VarsVector(int nargs, VALUE *args, VALUE self) { + int argc; + VALUE argv[2]; + int ii; + + argc = nargs; + if (argc > 2) SWIG_fail; + for (ii = 0; (ii < argc); ++ii) { + argv[ii] = args[ii]; + } + if (argc == 0) { + return _wrap_new_VarsVector__SWIG_0(nargs, args, self); + } + if (argc == 1) { + int _v; + { + int res = SWIG_AsVal_size_t(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_new_VarsVector__SWIG_2(nargs, args, self); + } + } + if (argc == 1) { + int _v; + int res = swig::asptr(argv[0], (std::vector< CdiVariable,std::allocator< CdiVariable > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_new_VarsVector__SWIG_1(nargs, args, self); + } + } + if (argc == 2) { + int _v; + { + int res = SWIG_AsVal_size_t(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_CdiVariable, SWIG_POINTER_NO_NULL); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_new_VarsVector__SWIG_3(nargs, args, self); + } + } + } + +fail: + Ruby_Format_OverloadedError( argc, 2, "VarsVector.new", + " VarsVector.new()\n" + " VarsVector.new(std::vector< CdiVariable > const &other)\n" + " VarsVector.new(std::vector< CdiVariable >::size_type size)\n" + " VarsVector.new(std::vector< CdiVariable >::size_type size, std::vector< CdiVariable >::value_type const &value)\n"); + + return Qnil; +} + + +/* + Document-method: Cdi::VarsVector.front + + call-seq: + front -> CdiVariable + +Return the first element in VarsVector. +*/ +SWIGINTERN VALUE +_wrap_VarsVector_front(int argc, VALUE *argv, VALUE self) { + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< CdiVariable >::value_type *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< CdiVariable > const *","front", 1, self )); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + result = (std::vector< CdiVariable >::value_type *) &((std::vector< CdiVariable > const *)arg1)->front(); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CdiVariable, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::VarsVector.back + + call-seq: + back -> CdiVariable + +Return the last element in VarsVector. +*/ +SWIGINTERN VALUE +_wrap_VarsVector_back(int argc, VALUE *argv, VALUE self) { + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< CdiVariable >::value_type *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< CdiVariable > const *","back", 1, self )); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + result = (std::vector< CdiVariable >::value_type *) &((std::vector< CdiVariable > const *)arg1)->back(); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CdiVariable, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::VarsVector.assign + + call-seq: + assign(n, x) + +Assign a new VarsVector or portion of it. +*/ +SWIGINTERN VALUE +_wrap_VarsVector_assign(int argc, VALUE *argv, VALUE self) { + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + std::vector< CdiVariable >::size_type arg2 ; + std::vector< CdiVariable >::value_type *arg3 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + size_t val2 ; + int ecode2 = 0 ; + void *argp3 ; + int res3 = 0 ; + + if ((argc < 2) || (argc > 2)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< CdiVariable > *","assign", 1, self )); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + ecode2 = SWIG_AsVal_size_t(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< CdiVariable >::size_type","assign", 2, argv[0] )); + } + arg2 = static_cast< std::vector< CdiVariable >::size_type >(val2); + res3 = SWIG_ConvertPtr(argv[1], &argp3, SWIGTYPE_p_CdiVariable, 0 ); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "std::vector< CdiVariable >::value_type const &","assign", 3, argv[1] )); + } + if (!argp3) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::vector< CdiVariable >::value_type const &","assign", 3, argv[1])); + } + arg3 = reinterpret_cast< std::vector< CdiVariable >::value_type * >(argp3); + (arg1)->assign(arg2,(std::vector< CdiVariable >::value_type const &)*arg3); + return Qnil; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::VarsVector.resize + + call-seq: + resize(new_size) + resize(new_size, x) + +Resize the size of the VarsVector. +*/ +SWIGINTERN VALUE +_wrap_VarsVector_resize__SWIG_1(int argc, VALUE *argv, VALUE self) { + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + std::vector< CdiVariable >::size_type arg2 ; + std::vector< CdiVariable >::value_type *arg3 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + size_t val2 ; + int ecode2 = 0 ; + void *argp3 ; + int res3 = 0 ; + + if ((argc < 2) || (argc > 2)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< CdiVariable > *","resize", 1, self )); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + ecode2 = SWIG_AsVal_size_t(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< CdiVariable >::size_type","resize", 2, argv[0] )); + } + arg2 = static_cast< std::vector< CdiVariable >::size_type >(val2); + res3 = SWIG_ConvertPtr(argv[1], &argp3, SWIGTYPE_p_CdiVariable, 0 ); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "std::vector< CdiVariable >::value_type const &","resize", 3, argv[1] )); + } + if (!argp3) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::vector< CdiVariable >::value_type const &","resize", 3, argv[1])); + } + arg3 = reinterpret_cast< std::vector< CdiVariable >::value_type * >(argp3); + (arg1)->resize(arg2,(std::vector< CdiVariable >::value_type const &)*arg3); + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE _wrap_VarsVector_resize(int nargs, VALUE *args, VALUE self) { + int argc; + VALUE argv[4]; + int ii; + + argc = nargs + 1; + argv[0] = self; + if (argc > 4) SWIG_fail; + for (ii = 1; (ii < argc); ++ii) { + argv[ii] = args[ii-1]; + } + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::vector< CdiVariable,std::allocator< CdiVariable > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_size_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_VarsVector_resize__SWIG_0(nargs, args, self); + } + } + } + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::vector< CdiVariable,std::allocator< CdiVariable > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_size_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_CdiVariable, SWIG_POINTER_NO_NULL); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_VarsVector_resize__SWIG_1(nargs, args, self); + } + } + } + } + +fail: + Ruby_Format_OverloadedError( argc, 4, "VarsVector.resize", + " void VarsVector.resize(std::vector< CdiVariable >::size_type new_size)\n" + " void VarsVector.resize(std::vector< CdiVariable >::size_type new_size, std::vector< CdiVariable >::value_type const &x)\n"); + + return Qnil; +} + + +/* + Document-method: Cdi::VarsVector.insert + + call-seq: + insert(pos, argc) -> VarsVector + insert(pos, x) -> std::vector< CdiVariable >::iterator + insert(pos, n, x) + +Insert one or more new elements in the VarsVector. +*/ +SWIGINTERN VALUE +_wrap_VarsVector_insert__SWIG_1(int argc, VALUE *argv, VALUE self) { + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + std::vector< CdiVariable >::iterator arg2 ; + std::vector< CdiVariable >::value_type *arg3 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + swig::Iterator *iter2 = 0 ; + int res2 ; + void *argp3 ; + int res3 = 0 ; + std::vector< CdiVariable >::iterator result; + VALUE vresult = Qnil; + + if ((argc < 2) || (argc > 2)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< CdiVariable > *","insert", 1, self )); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + res2 = SWIG_ConvertPtr(argv[0], SWIG_as_voidptrptr(&iter2), swig::Iterator::descriptor(), 0); + if (!SWIG_IsOK(res2) || !iter2) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), Ruby_Format_TypeError( "", "std::vector< CdiVariable >::iterator","insert", 2, argv[0] )); + } else { + swig::Iterator_T<std::vector< CdiVariable >::iterator > *iter_t = dynamic_cast<swig::Iterator_T<std::vector< CdiVariable >::iterator > *>(iter2); + if (iter_t) { + arg2 = iter_t->get_current(); + } else { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), Ruby_Format_TypeError( "", "std::vector< CdiVariable >::iterator","insert", 2, argv[0] )); + } + } + res3 = SWIG_ConvertPtr(argv[1], &argp3, SWIGTYPE_p_CdiVariable, 0 ); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "std::vector< CdiVariable >::value_type const &","insert", 3, argv[1] )); + } + if (!argp3) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::vector< CdiVariable >::value_type const &","insert", 3, argv[1])); + } + arg3 = reinterpret_cast< std::vector< CdiVariable >::value_type * >(argp3); + result = std_vector_Sl_CdiVariable_Sg__insert__SWIG_1(arg1,arg2,(CdiVariable const &)*arg3); + vresult = SWIG_NewPointerObj(swig::make_nonconst_iterator(static_cast< const std::vector< CdiVariable >::iterator & >(result), + self), + swig::Iterator::descriptor(),SWIG_POINTER_OWN); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_VarsVector_insert__SWIG_2(int argc, VALUE *argv, VALUE self) { + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + std::vector< CdiVariable >::iterator arg2 ; + std::vector< CdiVariable >::size_type arg3 ; + std::vector< CdiVariable >::value_type *arg4 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + swig::Iterator *iter2 = 0 ; + int res2 ; + size_t val3 ; + int ecode3 = 0 ; + void *argp4 ; + int res4 = 0 ; + + if ((argc < 3) || (argc > 3)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< CdiVariable > *","insert", 1, self )); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + res2 = SWIG_ConvertPtr(argv[0], SWIG_as_voidptrptr(&iter2), swig::Iterator::descriptor(), 0); + if (!SWIG_IsOK(res2) || !iter2) { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), Ruby_Format_TypeError( "", "std::vector< CdiVariable >::iterator","insert", 2, argv[0] )); + } else { + swig::Iterator_T<std::vector< CdiVariable >::iterator > *iter_t = dynamic_cast<swig::Iterator_T<std::vector< CdiVariable >::iterator > *>(iter2); + if (iter_t) { + arg2 = iter_t->get_current(); + } else { + SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), Ruby_Format_TypeError( "", "std::vector< CdiVariable >::iterator","insert", 2, argv[0] )); + } + } + ecode3 = SWIG_AsVal_size_t(argv[1], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "std::vector< CdiVariable >::size_type","insert", 3, argv[1] )); + } + arg3 = static_cast< std::vector< CdiVariable >::size_type >(val3); + res4 = SWIG_ConvertPtr(argv[2], &argp4, SWIGTYPE_p_CdiVariable, 0 ); + if (!SWIG_IsOK(res4)) { + SWIG_exception_fail(SWIG_ArgError(res4), Ruby_Format_TypeError( "", "std::vector< CdiVariable >::value_type const &","insert", 4, argv[2] )); + } + if (!argp4) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::vector< CdiVariable >::value_type const &","insert", 4, argv[2])); + } + arg4 = reinterpret_cast< std::vector< CdiVariable >::value_type * >(argp4); + std_vector_Sl_CdiVariable_Sg__insert__SWIG_2(arg1,arg2,arg3,(CdiVariable const &)*arg4); + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE _wrap_VarsVector_insert(int nargs, VALUE *args, VALUE self) { + int argc; + VALUE argv[5]; + int ii; + + argc = nargs + 1; + argv[0] = self; + if (argc > 5) SWIG_fail; + for (ii = 1; (ii < argc); ++ii) { + argv[ii] = args[ii-1]; + } + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::vector< CdiVariable,std::allocator< CdiVariable > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + swig::ConstIterator *iter = 0; + int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::Iterator::descriptor(), 0); + _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::Iterator_T<std::vector< CdiVariable >::iterator > *>(iter) != 0)); + if (_v) { + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_CdiVariable, SWIG_POINTER_NO_NULL); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_VarsVector_insert__SWIG_1(nargs, args, self); + } + } + } + } + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::vector< CdiVariable,std::allocator< CdiVariable > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + if (argc <= 3) { + return _wrap_VarsVector_insert__SWIG_0(nargs, args, self); + } + return _wrap_VarsVector_insert__SWIG_0(nargs, args, self); + } + } + } + } + if (argc == 4) { + int _v; + int res = swig::asptr(argv[0], (std::vector< CdiVariable,std::allocator< CdiVariable > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + swig::ConstIterator *iter = 0; + int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::Iterator::descriptor(), 0); + _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::Iterator_T<std::vector< CdiVariable >::iterator > *>(iter) != 0)); + if (_v) { + { + int res = SWIG_AsVal_size_t(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[3], &vptr, SWIGTYPE_p_CdiVariable, SWIG_POINTER_NO_NULL); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_VarsVector_insert__SWIG_2(nargs, args, self); + } + } + } + } + } + +fail: + Ruby_Format_OverloadedError( argc, 5, "insert", + " std::vector< CdiVariable,std::allocator< CdiVariable > > insert(std::vector< CdiVariable >::difference_type pos, int argc, VALUE *argv, ...)\n" + " std::vector< CdiVariable >::iterator insert(std::vector< CdiVariable >::iterator pos, std::vector< CdiVariable >::value_type const &x)\n" + " void insert(std::vector< CdiVariable >::iterator pos, std::vector< CdiVariable >::size_type n, std::vector< CdiVariable >::value_type const &x)\n"); + + return Qnil; +} + + +/* + Document-method: Cdi::VarsVector.reserve + + call-seq: + reserve(n) + +Reserve memory in the VarsVector for a number of elements. +*/ +SWIGINTERN VALUE +_wrap_VarsVector_reserve(int argc, VALUE *argv, VALUE self) { + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + std::vector< CdiVariable >::size_type arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + size_t val2 ; + int ecode2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< CdiVariable > *","reserve", 1, self )); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + ecode2 = SWIG_AsVal_size_t(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< CdiVariable >::size_type","reserve", 2, argv[0] )); + } + arg2 = static_cast< std::vector< CdiVariable >::size_type >(val2); + (arg1)->reserve(arg2); + return Qnil; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::VarsVector.capacity + + call-seq: + capacity -> std::vector< CdiVariable >::size_type + +Reserved capacity of the VarsVector. +*/ +SWIGINTERN VALUE +_wrap_VarsVector_capacity(int argc, VALUE *argv, VALUE self) { + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< CdiVariable >::size_type result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< CdiVariable > const *","capacity", 1, self )); + } + arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); + result = ((std::vector< CdiVariable > const *)arg1)->capacity(); + vresult = SWIG_From_size_t(static_cast< size_t >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN void +free_std_vector_Sl_CdiVariable_Sg_(void *self) { + std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *)self; + delete arg1; +} + +static swig_class SwigClassVarsMap; + +SWIGINTERN VALUE +_wrap_new_VarsMap__SWIG_0(int argc, VALUE *argv, VALUE self) { + std::less< std::string > *arg1 = 0 ; + void *argp1 ; + int res1 = 0 ; + std::map< std::string,CdiVariable > *result = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(argv[0], &argp1, SWIGTYPE_p_std__lessT_std__string_t, 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::less< std::string > const &","map<(std::string,CdiVariable)>", 1, argv[0] )); + } + if (!argp1) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::less< std::string > const &","map<(std::string,CdiVariable)>", 1, argv[0])); + } + arg1 = reinterpret_cast< std::less< std::string > * >(argp1); + result = (std::map< std::string,CdiVariable > *)new std::map< std::string,CdiVariable >((std::less< std::string > const &)*arg1); + DATA_PTR(self) = result; + return self; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::VarsMap.dup + + call-seq: + dup -> VarsMap + +Create a duplicate of the class and unfreeze it if needed. +*/ +SWIGINTERN VALUE +_wrap_VarsMap_dup(int argc, VALUE *argv, VALUE self) { + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< std::string,CdiVariable > *","dup", 1, self )); + } + arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); + result = (std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > > *)std_map_Sl_std_string_Sc_CdiVariable_Sg__dup(arg1); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::VarsMap.delete + + call-seq: + delete(key) -> VALUE + +Delete a matching element. +*/ +SWIGINTERN VALUE +_wrap_VarsMap_delete(int argc, VALUE *argv, VALUE self) { + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; + std::map< std::string,CdiVariable >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 = SWIG_OLDOBJ ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< std::string,CdiVariable > *","__delete__", 1, self )); + } + arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); + { + std::string *ptr = (std::string *)0; + res2 = SWIG_AsPtr_std_string(argv[0], &ptr); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::map< std::string,CdiVariable >::key_type const &","__delete__", 2, argv[0] )); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::map< std::string,CdiVariable >::key_type const &","__delete__", 2, argv[0])); + } + arg2 = ptr; + } + result = (VALUE)std_map_Sl_std_string_Sc_CdiVariable_Sg____delete__(arg1,(std::string const &)*arg2); + vresult = result; + if (SWIG_IsNewObj(res2)) delete arg2; + return vresult; +fail: + if (SWIG_IsNewObj(res2)) delete arg2; + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_VarsMap_has_keyq___(int argc, VALUE *argv, VALUE self) { + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; + std::map< std::string,CdiVariable >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 = SWIG_OLDOBJ ; + bool result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< std::string,CdiVariable > const *","has_key", 1, self )); + } + arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); + { + std::string *ptr = (std::string *)0; + res2 = SWIG_AsPtr_std_string(argv[0], &ptr); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::map< std::string,CdiVariable >::key_type const &","has_key", 2, argv[0] )); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::map< std::string,CdiVariable >::key_type const &","has_key", 2, argv[0])); + } + arg2 = ptr; + } + result = (bool)std_map_Sl_std_string_Sc_CdiVariable_Sg__has_key((std::map< std::string,CdiVariable > const *)arg1,(std::string const &)*arg2); + vresult = SWIG_From_bool(static_cast< bool >(result)); + if (SWIG_IsNewObj(res2)) delete arg2; + return vresult; +fail: + if (SWIG_IsNewObj(res2)) delete arg2; + return Qnil; +} + + +/* + Document-method: Cdi::VarsMap.keys + + call-seq: + keys -> VALUE + +Return an Array of key elements. +*/ +SWIGINTERN VALUE +_wrap_VarsMap_keys(int argc, VALUE *argv, VALUE self) { + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< std::string,CdiVariable > *","keys", 1, self )); + } + arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); + result = (VALUE)std_map_Sl_std_string_Sc_CdiVariable_Sg__keys(arg1); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::VarsMap.each + + call-seq: + each -> VarsMap + +Iterate thru each element in the VarsMap. A block must be provided. +*/ +SWIGINTERN VALUE +_wrap_VarsMap_each(int argc, VALUE *argv, VALUE self) { + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< std::string,CdiVariable > *","each", 1, self )); + } + arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); + result = (std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > > *)std_map_Sl_std_string_Sc_CdiVariable_Sg__each(arg1); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::VarsMap.select + + call-seq: + select -> VarsMap + +Iterate thru each element in the VarsMap and select those that match a condition. A block must be provided. +*/ +SWIGINTERN VALUE +_wrap_VarsMap_select(int argc, VALUE *argv, VALUE self) { + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< std::string,CdiVariable > *","select", 1, self )); + } + arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); + result = (std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > > *)std_map_Sl_std_string_Sc_CdiVariable_Sg__select(arg1); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::VarsMap.values_at + + call-seq: + values_at(argc) -> VALUE + +Return an Array of value elements matching the conditions. +*/ +SWIGINTERN VALUE +_wrap_VarsMap_values_at(int argc, VALUE *argv, VALUE self) { + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; + int arg2 ; + VALUE *arg3 = (VALUE *) 0 ; + void *arg4 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if (argc < 1) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< std::string,CdiVariable > *","values_at", 1, self )); + } + arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); + { + arg2 = argc; + arg3 = argv; + } + result = (VALUE)std_map_Sl_std_string_Sc_CdiVariable_Sg__values_at(arg1,arg2,arg3,arg4); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::VarsMap.each_key + + call-seq: + each_key -> VarsMap + +Iterate thru each key element in the VarsMap. A block must be provided. +*/ +SWIGINTERN VALUE +_wrap_VarsMap_each_key(int argc, VALUE *argv, VALUE self) { + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< std::string,CdiVariable > *","each_key", 1, self )); + } + arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); + result = (std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > > *)std_map_Sl_std_string_Sc_CdiVariable_Sg__each_key(arg1); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::VarsMap.values + + call-seq: + values -> VALUE + +Return an Array of value elements. +*/ +SWIGINTERN VALUE +_wrap_VarsMap_values(int argc, VALUE *argv, VALUE self) { + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< std::string,CdiVariable > *","values", 1, self )); + } + arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); + result = (VALUE)std_map_Sl_std_string_Sc_CdiVariable_Sg__values(arg1); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::VarsMap.each_value + + call-seq: + each_value -> VarsMap + +Iterate thru each key element in the VarsMap. A block must be provided. +*/ +SWIGINTERN VALUE +_wrap_VarsMap_each_value(int argc, VALUE *argv, VALUE self) { + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< std::string,CdiVariable > *","each_value", 1, self )); + } + arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); + result = (std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > > *)std_map_Sl_std_string_Sc_CdiVariable_Sg__each_value(arg1); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_VarsMap_entries(int argc, VALUE *argv, VALUE self) { + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< std::string,CdiVariable > *","entries", 1, self )); + } + arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); + result = (VALUE)std_map_Sl_std_string_Sc_CdiVariable_Sg__entries(arg1); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_VarsMap_includeq___(int argc, VALUE *argv, VALUE self) { + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; + std::map< std::string,CdiVariable >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 = SWIG_OLDOBJ ; + bool result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< std::string,CdiVariable > *","__contains__", 1, self )); + } + arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); + { + std::string *ptr = (std::string *)0; + res2 = SWIG_AsPtr_std_string(argv[0], &ptr); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::map< std::string,CdiVariable >::key_type const &","__contains__", 2, argv[0] )); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::map< std::string,CdiVariable >::key_type const &","__contains__", 2, argv[0])); + } + arg2 = ptr; + } + result = (bool)std_map_Sl_std_string_Sc_CdiVariable_Sg____contains__(arg1,(std::string const &)*arg2); + vresult = SWIG_From_bool(static_cast< bool >(result)); + if (SWIG_IsNewObj(res2)) delete arg2; + return vresult; +fail: + if (SWIG_IsNewObj(res2)) delete arg2; + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_VarsMap_key_iterator(int argc, VALUE *argv, VALUE self) { + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; + VALUE *arg2 = (VALUE *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + swig::ConstIterator *result = 0 ; + VALUE vresult = Qnil; + + arg2 = &self; + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< std::string,CdiVariable > *","key_iterator", 1, self )); + } + arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); + result = (swig::ConstIterator *)std_map_Sl_std_string_Sc_CdiVariable_Sg__key_iterator(arg1,arg2); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__ConstIterator, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_VarsMap_value_iterator(int argc, VALUE *argv, VALUE self) { + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; + VALUE *arg2 = (VALUE *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + swig::ConstIterator *result = 0 ; + VALUE vresult = Qnil; + + arg2 = &self; + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< std::string,CdiVariable > *","value_iterator", 1, self )); + } + arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); + result = (swig::ConstIterator *)std_map_Sl_std_string_Sc_CdiVariable_Sg__value_iterator(arg1,arg2); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__ConstIterator, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::VarsMap.[] + + call-seq: + [](key) -> VALUE + +Element accessor/slicing. +*/ +SWIGINTERN VALUE +_wrap_VarsMap___getitem__(int argc, VALUE *argv, VALUE self) { + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; + std::map< std::string,CdiVariable >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 = SWIG_OLDOBJ ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< std::string,CdiVariable > const *","__getitem__", 1, self )); + } + arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); + { + std::string *ptr = (std::string *)0; + res2 = SWIG_AsPtr_std_string(argv[0], &ptr); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::map< std::string,CdiVariable >::key_type const &","__getitem__", 2, argv[0] )); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::map< std::string,CdiVariable >::key_type const &","__getitem__", 2, argv[0])); + } + arg2 = ptr; + } + result = (VALUE)std_map_Sl_std_string_Sc_CdiVariable_Sg____getitem__((std::map< std::string,CdiVariable > const *)arg1,(std::string const &)*arg2); + vresult = result; + if (SWIG_IsNewObj(res2)) delete arg2; + return vresult; +fail: + if (SWIG_IsNewObj(res2)) delete arg2; + return Qnil; +} + + +/* + Document-method: Cdi::VarsMap.[]= + + call-seq: + []=(key, x) + +Element setter/slicing. +*/ +SWIGINTERN VALUE +_wrap_VarsMap___setitem__(int argc, VALUE *argv, VALUE self) { + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; + std::map< std::string,CdiVariable >::key_type *arg2 = 0 ; + std::map< std::string,CdiVariable >::mapped_type *arg3 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 = SWIG_OLDOBJ ; + void *argp3 ; + int res3 = 0 ; + + if ((argc < 2) || (argc > 2)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< std::string,CdiVariable > *","__setitem__", 1, self )); + } + arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); + { + std::string *ptr = (std::string *)0; + res2 = SWIG_AsPtr_std_string(argv[0], &ptr); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::map< std::string,CdiVariable >::key_type const &","__setitem__", 2, argv[0] )); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::map< std::string,CdiVariable >::key_type const &","__setitem__", 2, argv[0])); + } + arg2 = ptr; + } + res3 = SWIG_ConvertPtr(argv[1], &argp3, SWIGTYPE_p_CdiVariable, 0 ); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "std::map< std::string,CdiVariable >::mapped_type const &","__setitem__", 3, argv[1] )); + } + if (!argp3) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::map< std::string,CdiVariable >::mapped_type const &","__setitem__", 3, argv[1])); + } + arg3 = reinterpret_cast< std::map< std::string,CdiVariable >::mapped_type * >(argp3); + try { + std_map_Sl_std_string_Sc_CdiVariable_Sg____setitem__(arg1,(std::string const &)*arg2,(CdiVariable const &)*arg3); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } + if (SWIG_IsNewObj(res2)) delete arg2; + return Qnil; +fail: + if (SWIG_IsNewObj(res2)) delete arg2; + return Qnil; +} + + +/* + Document-method: Cdi::VarsMap.inspect + + call-seq: + inspect -> VALUE + +Inspect class and its contents. +*/ +SWIGINTERN VALUE +_wrap_VarsMap_inspect(int argc, VALUE *argv, VALUE self) { + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< std::string,CdiVariable > *","inspect", 1, self )); + } + arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); + result = (VALUE)std_map_Sl_std_string_Sc_CdiVariable_Sg__inspect(arg1); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::VarsMap.to_a + + call-seq: + to_a -> VALUE + +Convert VarsMap to an Array. +*/ +SWIGINTERN VALUE +_wrap_VarsMap_to_a(int argc, VALUE *argv, VALUE self) { + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< std::string,CdiVariable > *","to_a", 1, self )); + } + arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); + result = (VALUE)std_map_Sl_std_string_Sc_CdiVariable_Sg__to_a(arg1); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::VarsMap.to_s + + call-seq: + to_s -> VALUE + +Convert class to a String representation. +*/ +SWIGINTERN VALUE +_wrap_VarsMap_to_s(int argc, VALUE *argv, VALUE self) { + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< std::string,CdiVariable > *","to_s", 1, self )); + } + arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); + result = (VALUE)std_map_Sl_std_string_Sc_CdiVariable_Sg__to_s(arg1); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_new_VarsMap__SWIG_1(int argc, VALUE *argv, VALUE self) { + std::map< std::string,CdiVariable > *result = 0 ; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + result = (std::map< std::string,CdiVariable > *)new std::map< std::string,CdiVariable >(); + DATA_PTR(self) = result; + return self; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +#ifdef HAVE_RB_DEFINE_ALLOC_FUNC +_wrap_VarsMap_allocate(VALUE self) +#else +_wrap_VarsMap_allocate(int argc, VALUE *argv, VALUE self) +#endif +{ + VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t); +#ifndef HAVE_RB_DEFINE_ALLOC_FUNC + rb_obj_call_init(vresult, argc, argv); +#endif + return vresult; +} + + +SWIGINTERN VALUE +_wrap_new_VarsMap__SWIG_2(int argc, VALUE *argv, VALUE self) { + std::map< std::string,CdiVariable > *arg1 = 0 ; + int res1 = SWIG_OLDOBJ ; + std::map< std::string,CdiVariable > *result = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + { + std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > > *ptr = (std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > > *)0; + res1 = swig::asptr(argv[0], &ptr); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< std::string,CdiVariable > const &","map<(std::string,CdiVariable)>", 1, argv[0] )); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::map< std::string,CdiVariable > const &","map<(std::string,CdiVariable)>", 1, argv[0])); + } + arg1 = ptr; + } + result = (std::map< std::string,CdiVariable > *)new std::map< std::string,CdiVariable >((std::map< std::string,CdiVariable > const &)*arg1); + DATA_PTR(self) = result; + if (SWIG_IsNewObj(res1)) delete arg1; + return self; +fail: + if (SWIG_IsNewObj(res1)) delete arg1; + return Qnil; +} + + +SWIGINTERN VALUE _wrap_new_VarsMap(int nargs, VALUE *args, VALUE self) { + int argc; + VALUE argv[1]; + int ii; + + argc = nargs; + if (argc > 1) SWIG_fail; + for (ii = 0; (ii < argc); ++ii) { + argv[ii] = args[ii]; + } + if (argc == 0) { + return _wrap_new_VarsMap__SWIG_1(nargs, args, self); + } + if (argc == 1) { + int _v; + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_std__lessT_std__string_t, SWIG_POINTER_NO_NULL); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_new_VarsMap__SWIG_0(nargs, args, self); + } + } + if (argc == 1) { + int _v; + int res = swig::asptr(argv[0], (std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_new_VarsMap__SWIG_2(nargs, args, self); + } + } + +fail: + Ruby_Format_OverloadedError( argc, 1, "VarsMap.new", + " VarsMap.new(std::less< std::string > const &other)\n" + " VarsMap.new()\n" + " VarsMap.new(std::map< std::string,CdiVariable > const &other)\n"); + + return Qnil; +} + + +/* + Document-method: Cdi::VarsMap.empty? + + call-seq: + empty? -> bool + +Check if the VarsMap is empty or not. +*/ +SWIGINTERN VALUE +_wrap_VarsMap_emptyq___(int argc, VALUE *argv, VALUE self) { + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + bool result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< std::string,CdiVariable > const *","empty", 1, self )); + } + arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); + result = (bool)((std::map< std::string,CdiVariable > const *)arg1)->empty(); + vresult = SWIG_From_bool(static_cast< bool >(result)); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::VarsMap.size + + call-seq: + size -> std::map< std::string,CdiVariable >::size_type + +Size or Length of the VarsMap. +*/ +SWIGINTERN VALUE +_wrap_VarsMap_size(int argc, VALUE *argv, VALUE self) { + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< std::string,CdiVariable >::size_type result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< std::string,CdiVariable > const *","size", 1, self )); + } + arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); + result = ((std::map< std::string,CdiVariable > const *)arg1)->size(); + vresult = SWIG_From_size_t(static_cast< size_t >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_VarsMap_swap(int argc, VALUE *argv, VALUE self) { + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; + std::map< std::string,CdiVariable > *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< std::string,CdiVariable > *","swap", 1, self )); + } + arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); + res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::map< std::string,CdiVariable > &","swap", 2, argv[0] )); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::map< std::string,CdiVariable > &","swap", 2, argv[0])); + } + arg2 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp2); + (arg1)->swap(*arg2); + return Qnil; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::VarsMap.begin + + call-seq: + begin -> std::map< std::string,CdiVariable >::iterator + +Return an iterator to the beginning of the VarsMap. +*/ +SWIGINTERN VALUE +_wrap_VarsMap_begin(int argc, VALUE *argv, VALUE self) { + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< std::string,CdiVariable >::iterator result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< std::string,CdiVariable > *","begin", 1, self )); + } + arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); + result = (arg1)->begin(); + vresult = SWIG_NewPointerObj((new std::map< std::string,CdiVariable >::iterator(static_cast< const std::map< std::string,CdiVariable >::iterator& >(result))), SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t__iterator, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::VarsMap.end + + call-seq: + end -> std::map< std::string,CdiVariable >::iterator + +Return an iterator to past the end of the VarsMap. +*/ +SWIGINTERN VALUE +_wrap_VarsMap_end(int argc, VALUE *argv, VALUE self) { + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< std::string,CdiVariable >::iterator result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< std::string,CdiVariable > *","end", 1, self )); + } + arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); + result = (arg1)->end(); + vresult = SWIG_NewPointerObj((new std::map< std::string,CdiVariable >::iterator(static_cast< const std::map< std::string,CdiVariable >::iterator& >(result))), SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t__iterator, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::VarsMap.rbegin + + call-seq: + rbegin -> std::map< std::string,CdiVariable >::reverse_iterator + +Return a reverse iterator to the beginning (the end) of the VarsMap. +*/ +SWIGINTERN VALUE +_wrap_VarsMap_rbegin(int argc, VALUE *argv, VALUE self) { + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< std::string,CdiVariable >::reverse_iterator result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< std::string,CdiVariable > *","rbegin", 1, self )); + } + arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); + result = (arg1)->rbegin(); + vresult = SWIG_NewPointerObj((new std::map< std::string,CdiVariable >::reverse_iterator(static_cast< const std::map< std::string,CdiVariable >::reverse_iterator& >(result))), SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t__reverse_iterator, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::VarsMap.rend + + call-seq: + rend -> std::map< std::string,CdiVariable >::reverse_iterator + +Return a reverse iterator to past the end (past the beginning) of the VarsMap. +*/ +SWIGINTERN VALUE +_wrap_VarsMap_rend(int argc, VALUE *argv, VALUE self) { + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< std::string,CdiVariable >::reverse_iterator result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< std::string,CdiVariable > *","rend", 1, self )); + } + arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); + result = (arg1)->rend(); + vresult = SWIG_NewPointerObj((new std::map< std::string,CdiVariable >::reverse_iterator(static_cast< const std::map< std::string,CdiVariable >::reverse_iterator& >(result))), SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t__reverse_iterator, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::VarsMap.clear + + call-seq: + clear + +Clear VarsMap contents. +*/ +SWIGINTERN VALUE +_wrap_VarsMap_clear(int argc, VALUE *argv, VALUE self) { + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< std::string,CdiVariable > *","clear", 1, self )); + } + arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); + (arg1)->clear(); + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_VarsMap_get_allocator(int argc, VALUE *argv, VALUE self) { + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + SwigValueWrapper< std::allocator< std::pair< std::string const,CdiVariable > > > result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< std::string,CdiVariable > const *","get_allocator", 1, self )); + } + arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); + result = ((std::map< std::string,CdiVariable > const *)arg1)->get_allocator(); + vresult = SWIG_NewPointerObj((new std::map< std::string,CdiVariable >::allocator_type(static_cast< const std::map< std::string,CdiVariable >::allocator_type& >(result))), SWIGTYPE_p_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::VarsMap.erase + + call-seq: + erase(x) -> std::map< std::string,CdiVariable >::size_type + erase(position) + erase(first, last) + +Delete a portion of the VarsMap. +*/ +SWIGINTERN VALUE +_wrap_VarsMap_erase__SWIG_0(int argc, VALUE *argv, VALUE self) { + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; + std::map< std::string,CdiVariable >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 = SWIG_OLDOBJ ; + std::map< std::string,CdiVariable >::size_type result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< std::string,CdiVariable > *","erase", 1, self )); + } + arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); + { + std::string *ptr = (std::string *)0; + res2 = SWIG_AsPtr_std_string(argv[0], &ptr); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::map< std::string,CdiVariable >::key_type const &","erase", 2, argv[0] )); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::map< std::string,CdiVariable >::key_type const &","erase", 2, argv[0])); + } + arg2 = ptr; + } + result = (arg1)->erase((std::map< std::string,CdiVariable >::key_type const &)*arg2); + vresult = SWIG_From_size_t(static_cast< size_t >(result)); + if (SWIG_IsNewObj(res2)) delete arg2; + return vresult; +fail: + if (SWIG_IsNewObj(res2)) delete arg2; + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_VarsMap_count(int argc, VALUE *argv, VALUE self) { + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; + std::map< std::string,CdiVariable >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 = SWIG_OLDOBJ ; + std::map< std::string,CdiVariable >::size_type result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< std::string,CdiVariable > const *","count", 1, self )); + } + arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); + { + std::string *ptr = (std::string *)0; + res2 = SWIG_AsPtr_std_string(argv[0], &ptr); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::map< std::string,CdiVariable >::key_type const &","count", 2, argv[0] )); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::map< std::string,CdiVariable >::key_type const &","count", 2, argv[0])); + } + arg2 = ptr; + } + result = ((std::map< std::string,CdiVariable > const *)arg1)->count((std::map< std::string,CdiVariable >::key_type const &)*arg2); + vresult = SWIG_From_size_t(static_cast< size_t >(result)); + if (SWIG_IsNewObj(res2)) delete arg2; + return vresult; +fail: + if (SWIG_IsNewObj(res2)) delete arg2; + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_VarsMap_erase__SWIG_1(int argc, VALUE *argv, VALUE self) { + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; + std::map< std::string,CdiVariable >::iterator arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 ; + int res2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< std::string,CdiVariable > *","erase", 1, self )); + } + arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); + { + res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t__iterator, 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::map< std::string,CdiVariable >::iterator","erase", 2, argv[0] )); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::map< std::string,CdiVariable >::iterator","erase", 2, argv[0])); + } else { + arg2 = *(reinterpret_cast< std::map< std::string,CdiVariable >::iterator * >(argp2)); + } + } + std_map_Sl_std_string_Sc_CdiVariable_Sg__erase__SWIG_1(arg1,arg2); + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_VarsMap_erase__SWIG_2(int argc, VALUE *argv, VALUE self) { + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; + std::map< std::string,CdiVariable >::iterator arg2 ; + std::map< std::string,CdiVariable >::iterator arg3 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 ; + int res2 = 0 ; + void *argp3 ; + int res3 = 0 ; + + if ((argc < 2) || (argc > 2)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< std::string,CdiVariable > *","erase", 1, self )); + } + arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); + { + res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t__iterator, 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::map< std::string,CdiVariable >::iterator","erase", 2, argv[0] )); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::map< std::string,CdiVariable >::iterator","erase", 2, argv[0])); + } else { + arg2 = *(reinterpret_cast< std::map< std::string,CdiVariable >::iterator * >(argp2)); + } + } + { + res3 = SWIG_ConvertPtr(argv[1], &argp3, SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t__iterator, 0 ); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "std::map< std::string,CdiVariable >::iterator","erase", 3, argv[1] )); + } + if (!argp3) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::map< std::string,CdiVariable >::iterator","erase", 3, argv[1])); + } else { + arg3 = *(reinterpret_cast< std::map< std::string,CdiVariable >::iterator * >(argp3)); + } + } + std_map_Sl_std_string_Sc_CdiVariable_Sg__erase__SWIG_2(arg1,arg2,arg3); + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE _wrap_VarsMap_erase(int nargs, VALUE *args, VALUE self) { + int argc; + VALUE argv[4]; + int ii; + + argc = nargs + 1; + argv[0] = self; + if (argc > 4) SWIG_fail; + for (ii = 1; (ii < argc); ++ii) { + argv[ii] = args[ii-1]; + } + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t__iterator, SWIG_POINTER_NO_NULL); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_VarsMap_erase__SWIG_1(nargs, args, self); + } + } + } + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_VarsMap_erase__SWIG_0(nargs, args, self); + } + } + } + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t__iterator, SWIG_POINTER_NO_NULL); + _v = SWIG_CheckState(res); + if (_v) { + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t__iterator, SWIG_POINTER_NO_NULL); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_VarsMap_erase__SWIG_2(nargs, args, self); + } + } + } + } + +fail: + Ruby_Format_OverloadedError( argc, 4, "VarsMap.erase", + " std::map< std::string,CdiVariable >::size_type VarsMap.erase(std::map< std::string,CdiVariable >::key_type const &x)\n" + " void VarsMap.erase(std::map< std::string,CdiVariable >::iterator position)\n" + " void VarsMap.erase(std::map< std::string,CdiVariable >::iterator first, std::map< std::string,CdiVariable >::iterator last)\n"); + + return Qnil; +} + + +/* + Document-method: Cdi::VarsMap.find + + call-seq: + find(x) -> std::map< std::string,CdiVariable >::iterator + +Find an element in the class. +*/ +SWIGINTERN VALUE +_wrap_VarsMap_find(int argc, VALUE *argv, VALUE self) { + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; + std::map< std::string,CdiVariable >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 = SWIG_OLDOBJ ; + std::map< std::string,CdiVariable >::iterator result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< std::string,CdiVariable > *","find", 1, self )); + } + arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); + { + std::string *ptr = (std::string *)0; + res2 = SWIG_AsPtr_std_string(argv[0], &ptr); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::map< std::string,CdiVariable >::key_type const &","find", 2, argv[0] )); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::map< std::string,CdiVariable >::key_type const &","find", 2, argv[0])); + } + arg2 = ptr; + } + result = (arg1)->find((std::map< std::string,CdiVariable >::key_type const &)*arg2); + vresult = SWIG_NewPointerObj((new std::map< std::string,CdiVariable >::iterator(static_cast< const std::map< std::string,CdiVariable >::iterator& >(result))), SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t__iterator, SWIG_POINTER_OWN | 0 ); + if (SWIG_IsNewObj(res2)) delete arg2; + return vresult; +fail: + if (SWIG_IsNewObj(res2)) delete arg2; + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_VarsMap_lower_bound(int argc, VALUE *argv, VALUE self) { + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; + std::map< std::string,CdiVariable >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 = SWIG_OLDOBJ ; + std::map< std::string,CdiVariable >::iterator result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< std::string,CdiVariable > *","lower_bound", 1, self )); + } + arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); + { + std::string *ptr = (std::string *)0; + res2 = SWIG_AsPtr_std_string(argv[0], &ptr); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::map< std::string,CdiVariable >::key_type const &","lower_bound", 2, argv[0] )); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::map< std::string,CdiVariable >::key_type const &","lower_bound", 2, argv[0])); + } + arg2 = ptr; + } + result = (arg1)->lower_bound((std::map< std::string,CdiVariable >::key_type const &)*arg2); + vresult = SWIG_NewPointerObj((new std::map< std::string,CdiVariable >::iterator(static_cast< const std::map< std::string,CdiVariable >::iterator& >(result))), SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t__iterator, SWIG_POINTER_OWN | 0 ); + if (SWIG_IsNewObj(res2)) delete arg2; + return vresult; +fail: + if (SWIG_IsNewObj(res2)) delete arg2; + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_VarsMap_upper_bound(int argc, VALUE *argv, VALUE self) { + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; + std::map< std::string,CdiVariable >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 = SWIG_OLDOBJ ; + std::map< std::string,CdiVariable >::iterator result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< std::string,CdiVariable > *","upper_bound", 1, self )); + } + arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); + { + std::string *ptr = (std::string *)0; + res2 = SWIG_AsPtr_std_string(argv[0], &ptr); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::map< std::string,CdiVariable >::key_type const &","upper_bound", 2, argv[0] )); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::map< std::string,CdiVariable >::key_type const &","upper_bound", 2, argv[0])); + } + arg2 = ptr; + } + result = (arg1)->upper_bound((std::map< std::string,CdiVariable >::key_type const &)*arg2); + vresult = SWIG_NewPointerObj((new std::map< std::string,CdiVariable >::iterator(static_cast< const std::map< std::string,CdiVariable >::iterator& >(result))), SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t__iterator, SWIG_POINTER_OWN | 0 ); + if (SWIG_IsNewObj(res2)) delete arg2; + return vresult; +fail: + if (SWIG_IsNewObj(res2)) delete arg2; + return Qnil; +} + + +SWIGINTERN void +free_std_map_Sl_std_string_Sc_CdiVariable_Sg_(void *self) { + std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *)self; + delete arg1; +} + +static swig_class SwigClassVarsByCode; + +SWIGINTERN VALUE +_wrap_new_VarsByCode__SWIG_0(int argc, VALUE *argv, VALUE self) { + std::less< int > *arg1 = 0 ; + void *argp1 ; + int res1 = 0 ; + std::map< int,CdiVariable > *result = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(argv[0], &argp1, SWIGTYPE_p_std__lessT_int_t, 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::less< int > const &","map<(int,CdiVariable)>", 1, argv[0] )); + } + if (!argp1) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::less< int > const &","map<(int,CdiVariable)>", 1, argv[0])); + } + arg1 = reinterpret_cast< std::less< int > * >(argp1); + result = (std::map< int,CdiVariable > *)new std::map< int,CdiVariable >((std::less< int > const &)*arg1); + DATA_PTR(self) = result; + return self; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::VarsByCode.dup + + call-seq: + dup -> VarsByCode + +Create a duplicate of the class and unfreeze it if needed. +*/ +SWIGINTERN VALUE +_wrap_VarsByCode_dup(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiVariable > *","dup", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); + result = (std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > > *)std_map_Sl_int_Sc_CdiVariable_Sg__dup(arg1); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::VarsByCode.delete + + call-seq: + delete(key) -> VALUE + +Delete a matching element. +*/ +SWIGINTERN VALUE +_wrap_VarsByCode_delete(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; + std::map< int,CdiVariable >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiVariable >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiVariable > *","__delete__", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::map< int,CdiVariable >::key_type","__delete__", 2, argv[0] )); + } + temp2 = static_cast< std::map< int,CdiVariable >::key_type >(val2); + arg2 = &temp2; + result = (VALUE)std_map_Sl_int_Sc_CdiVariable_Sg____delete__(arg1,(int const &)*arg2); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_VarsByCode_has_keyq___(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; + std::map< int,CdiVariable >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiVariable >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + bool result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiVariable > const *","has_key", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::map< int,CdiVariable >::key_type","has_key", 2, argv[0] )); + } + temp2 = static_cast< std::map< int,CdiVariable >::key_type >(val2); + arg2 = &temp2; + result = (bool)std_map_Sl_int_Sc_CdiVariable_Sg__has_key((std::map< int,CdiVariable > const *)arg1,(int const &)*arg2); + vresult = SWIG_From_bool(static_cast< bool >(result)); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::VarsByCode.keys + + call-seq: + keys -> VALUE + +Return an Array of key elements. +*/ +SWIGINTERN VALUE +_wrap_VarsByCode_keys(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiVariable > *","keys", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); + result = (VALUE)std_map_Sl_int_Sc_CdiVariable_Sg__keys(arg1); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::VarsByCode.each + + call-seq: + each -> VarsByCode + +Iterate thru each element in the VarsByCode. A block must be provided. +*/ +SWIGINTERN VALUE +_wrap_VarsByCode_each(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiVariable > *","each", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); + result = (std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > > *)std_map_Sl_int_Sc_CdiVariable_Sg__each(arg1); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::VarsByCode.select + + call-seq: + select -> VarsByCode + +Iterate thru each element in the VarsByCode and select those that match a condition. A block must be provided. +*/ +SWIGINTERN VALUE +_wrap_VarsByCode_select(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiVariable > *","select", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); + result = (std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > > *)std_map_Sl_int_Sc_CdiVariable_Sg__select(arg1); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::VarsByCode.values_at + + call-seq: + values_at(argc) -> VALUE + +Return an Array of value elements matching the conditions. +*/ +SWIGINTERN VALUE +_wrap_VarsByCode_values_at(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; + int arg2 ; + VALUE *arg3 = (VALUE *) 0 ; + void *arg4 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if (argc < 1) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiVariable > *","values_at", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); + { + arg2 = argc; + arg3 = argv; + } + result = (VALUE)std_map_Sl_int_Sc_CdiVariable_Sg__values_at(arg1,arg2,arg3,arg4); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::VarsByCode.each_key + + call-seq: + each_key -> VarsByCode + +Iterate thru each key element in the VarsByCode. A block must be provided. +*/ +SWIGINTERN VALUE +_wrap_VarsByCode_each_key(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiVariable > *","each_key", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); + result = (std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > > *)std_map_Sl_int_Sc_CdiVariable_Sg__each_key(arg1); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::VarsByCode.values + + call-seq: + values -> VALUE + +Return an Array of value elements. +*/ +SWIGINTERN VALUE +_wrap_VarsByCode_values(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiVariable > *","values", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); + result = (VALUE)std_map_Sl_int_Sc_CdiVariable_Sg__values(arg1); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::VarsByCode.each_value + + call-seq: + each_value -> VarsByCode + +Iterate thru each key element in the VarsByCode. A block must be provided. +*/ +SWIGINTERN VALUE +_wrap_VarsByCode_each_value(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiVariable > *","each_value", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); + result = (std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > > *)std_map_Sl_int_Sc_CdiVariable_Sg__each_value(arg1); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_VarsByCode_entries(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiVariable > *","entries", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); + result = (VALUE)std_map_Sl_int_Sc_CdiVariable_Sg__entries(arg1); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_VarsByCode_includeq___(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; + std::map< int,CdiVariable >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiVariable >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + bool result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiVariable > *","__contains__", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::map< int,CdiVariable >::key_type","__contains__", 2, argv[0] )); + } + temp2 = static_cast< std::map< int,CdiVariable >::key_type >(val2); + arg2 = &temp2; + result = (bool)std_map_Sl_int_Sc_CdiVariable_Sg____contains__(arg1,(int const &)*arg2); + vresult = SWIG_From_bool(static_cast< bool >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_VarsByCode_key_iterator(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; + VALUE *arg2 = (VALUE *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + swig::ConstIterator *result = 0 ; + VALUE vresult = Qnil; + + arg2 = &self; + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiVariable > *","key_iterator", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); + result = (swig::ConstIterator *)std_map_Sl_int_Sc_CdiVariable_Sg__key_iterator(arg1,arg2); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__ConstIterator, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_VarsByCode_value_iterator(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; + VALUE *arg2 = (VALUE *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + swig::ConstIterator *result = 0 ; + VALUE vresult = Qnil; + + arg2 = &self; + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiVariable > *","value_iterator", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); + result = (swig::ConstIterator *)std_map_Sl_int_Sc_CdiVariable_Sg__value_iterator(arg1,arg2); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__ConstIterator, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::VarsByCode.[] + + call-seq: + [](key) -> VALUE + +Element accessor/slicing. +*/ +SWIGINTERN VALUE +_wrap_VarsByCode___getitem__(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; + std::map< int,CdiVariable >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiVariable >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiVariable > const *","__getitem__", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::map< int,CdiVariable >::key_type","__getitem__", 2, argv[0] )); + } + temp2 = static_cast< std::map< int,CdiVariable >::key_type >(val2); + arg2 = &temp2; + result = (VALUE)std_map_Sl_int_Sc_CdiVariable_Sg____getitem__((std::map< int,CdiVariable > const *)arg1,(int const &)*arg2); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::VarsByCode.[]= + + call-seq: + []=(key, x) + +Element setter/slicing. +*/ +SWIGINTERN VALUE +_wrap_VarsByCode___setitem__(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; + std::map< int,CdiVariable >::key_type *arg2 = 0 ; + std::map< int,CdiVariable >::mapped_type *arg3 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiVariable >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + void *argp3 ; + int res3 = 0 ; + + if ((argc < 2) || (argc > 2)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiVariable > *","__setitem__", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::map< int,CdiVariable >::key_type","__setitem__", 2, argv[0] )); + } + temp2 = static_cast< std::map< int,CdiVariable >::key_type >(val2); + arg2 = &temp2; + res3 = SWIG_ConvertPtr(argv[1], &argp3, SWIGTYPE_p_CdiVariable, 0 ); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "std::map< int,CdiVariable >::mapped_type const &","__setitem__", 3, argv[1] )); + } + if (!argp3) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::map< int,CdiVariable >::mapped_type const &","__setitem__", 3, argv[1])); + } + arg3 = reinterpret_cast< std::map< int,CdiVariable >::mapped_type * >(argp3); + try { + std_map_Sl_int_Sc_CdiVariable_Sg____setitem__(arg1,(int const &)*arg2,(CdiVariable const &)*arg3); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } + return Qnil; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::VarsByCode.inspect + + call-seq: + inspect -> VALUE + +Inspect class and its contents. +*/ +SWIGINTERN VALUE +_wrap_VarsByCode_inspect(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiVariable > *","inspect", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); + result = (VALUE)std_map_Sl_int_Sc_CdiVariable_Sg__inspect(arg1); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::VarsByCode.to_a + + call-seq: + to_a -> VALUE + +Convert VarsByCode to an Array. +*/ +SWIGINTERN VALUE +_wrap_VarsByCode_to_a(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiVariable > *","to_a", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); + result = (VALUE)std_map_Sl_int_Sc_CdiVariable_Sg__to_a(arg1); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::VarsByCode.to_s + + call-seq: + to_s -> VALUE + +Convert class to a String representation. +*/ +SWIGINTERN VALUE +_wrap_VarsByCode_to_s(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiVariable > *","to_s", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); + result = (VALUE)std_map_Sl_int_Sc_CdiVariable_Sg__to_s(arg1); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_new_VarsByCode__SWIG_1(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiVariable > *result = 0 ; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + result = (std::map< int,CdiVariable > *)new std::map< int,CdiVariable >(); + DATA_PTR(self) = result; + return self; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +#ifdef HAVE_RB_DEFINE_ALLOC_FUNC +_wrap_VarsByCode_allocate(VALUE self) +#else +_wrap_VarsByCode_allocate(int argc, VALUE *argv, VALUE self) +#endif +{ + VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t); +#ifndef HAVE_RB_DEFINE_ALLOC_FUNC + rb_obj_call_init(vresult, argc, argv); +#endif + return vresult; +} + + +SWIGINTERN VALUE +_wrap_new_VarsByCode__SWIG_2(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiVariable > *arg1 = 0 ; + int res1 = SWIG_OLDOBJ ; + std::map< int,CdiVariable > *result = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + { + std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > > *ptr = (std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > > *)0; + res1 = swig::asptr(argv[0], &ptr); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiVariable > const &","map<(int,CdiVariable)>", 1, argv[0] )); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::map< int,CdiVariable > const &","map<(int,CdiVariable)>", 1, argv[0])); + } + arg1 = ptr; + } + result = (std::map< int,CdiVariable > *)new std::map< int,CdiVariable >((std::map< int,CdiVariable > const &)*arg1); + DATA_PTR(self) = result; + if (SWIG_IsNewObj(res1)) delete arg1; + return self; +fail: + if (SWIG_IsNewObj(res1)) delete arg1; + return Qnil; +} + + +SWIGINTERN VALUE _wrap_new_VarsByCode(int nargs, VALUE *args, VALUE self) { + int argc; + VALUE argv[1]; + int ii; + + argc = nargs; + if (argc > 1) SWIG_fail; + for (ii = 0; (ii < argc); ++ii) { + argv[ii] = args[ii]; + } + if (argc == 0) { + return _wrap_new_VarsByCode__SWIG_1(nargs, args, self); + } + if (argc == 1) { + int _v; + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_std__lessT_int_t, SWIG_POINTER_NO_NULL); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_new_VarsByCode__SWIG_0(nargs, args, self); + } + } + if (argc == 1) { + int _v; + int res = swig::asptr(argv[0], (std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_new_VarsByCode__SWIG_2(nargs, args, self); + } + } + +fail: + Ruby_Format_OverloadedError( argc, 1, "VarsByCode.new", + " VarsByCode.new(std::less< int > const &other)\n" + " VarsByCode.new()\n" + " VarsByCode.new(std::map< int,CdiVariable > const &other)\n"); + + return Qnil; +} + + +/* + Document-method: Cdi::VarsByCode.empty? + + call-seq: + empty? -> bool + +Check if the VarsByCode is empty or not. +*/ +SWIGINTERN VALUE +_wrap_VarsByCode_emptyq___(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + bool result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiVariable > const *","empty", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); + result = (bool)((std::map< int,CdiVariable > const *)arg1)->empty(); + vresult = SWIG_From_bool(static_cast< bool >(result)); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::VarsByCode.size + + call-seq: + size -> std::map< int,CdiVariable >::size_type + +Size or Length of the VarsByCode. +*/ +SWIGINTERN VALUE +_wrap_VarsByCode_size(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiVariable >::size_type result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiVariable > const *","size", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); + result = ((std::map< int,CdiVariable > const *)arg1)->size(); + vresult = SWIG_From_size_t(static_cast< size_t >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_VarsByCode_swap(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; + std::map< int,CdiVariable > *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiVariable > *","swap", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); + res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::map< int,CdiVariable > &","swap", 2, argv[0] )); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::map< int,CdiVariable > &","swap", 2, argv[0])); + } + arg2 = reinterpret_cast< std::map< int,CdiVariable > * >(argp2); + (arg1)->swap(*arg2); + return Qnil; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::VarsByCode.begin + + call-seq: + begin -> std::map< int,CdiVariable >::iterator + +Return an iterator to the beginning of the VarsByCode. +*/ +SWIGINTERN VALUE +_wrap_VarsByCode_begin(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiVariable >::iterator result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiVariable > *","begin", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); + result = (arg1)->begin(); + vresult = SWIG_NewPointerObj((new std::map< int,CdiVariable >::iterator(static_cast< const std::map< int,CdiVariable >::iterator& >(result))), SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t__iterator, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::VarsByCode.end + + call-seq: + end -> std::map< int,CdiVariable >::iterator + +Return an iterator to past the end of the VarsByCode. +*/ +SWIGINTERN VALUE +_wrap_VarsByCode_end(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiVariable >::iterator result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiVariable > *","end", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); + result = (arg1)->end(); + vresult = SWIG_NewPointerObj((new std::map< int,CdiVariable >::iterator(static_cast< const std::map< int,CdiVariable >::iterator& >(result))), SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t__iterator, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::VarsByCode.rbegin + + call-seq: + rbegin -> std::map< int,CdiVariable >::reverse_iterator + +Return a reverse iterator to the beginning (the end) of the VarsByCode. +*/ +SWIGINTERN VALUE +_wrap_VarsByCode_rbegin(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiVariable >::reverse_iterator result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiVariable > *","rbegin", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); + result = (arg1)->rbegin(); + vresult = SWIG_NewPointerObj((new std::map< int,CdiVariable >::reverse_iterator(static_cast< const std::map< int,CdiVariable >::reverse_iterator& >(result))), SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t__reverse_iterator, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::VarsByCode.rend + + call-seq: + rend -> std::map< int,CdiVariable >::reverse_iterator + +Return a reverse iterator to past the end (past the beginning) of the VarsByCode. +*/ +SWIGINTERN VALUE +_wrap_VarsByCode_rend(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiVariable >::reverse_iterator result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiVariable > *","rend", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); + result = (arg1)->rend(); + vresult = SWIG_NewPointerObj((new std::map< int,CdiVariable >::reverse_iterator(static_cast< const std::map< int,CdiVariable >::reverse_iterator& >(result))), SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t__reverse_iterator, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::VarsByCode.clear + + call-seq: + clear + +Clear VarsByCode contents. +*/ +SWIGINTERN VALUE +_wrap_VarsByCode_clear(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiVariable > *","clear", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); + (arg1)->clear(); + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_VarsByCode_get_allocator(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + SwigValueWrapper< std::allocator< std::pair< int const,CdiVariable > > > result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiVariable > const *","get_allocator", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); + result = ((std::map< int,CdiVariable > const *)arg1)->get_allocator(); + vresult = SWIG_NewPointerObj((new std::map< int,CdiVariable >::allocator_type(static_cast< const std::map< int,CdiVariable >::allocator_type& >(result))), SWIGTYPE_p_std__allocatorT_std__pairT_int_const_CdiVariable_t_t, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::VarsByCode.erase + + call-seq: + erase(x) -> std::map< int,CdiVariable >::size_type + erase(position) + erase(first, last) + +Delete a portion of the VarsByCode. +*/ +SWIGINTERN VALUE +_wrap_VarsByCode_erase__SWIG_0(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; + std::map< int,CdiVariable >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiVariable >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + std::map< int,CdiVariable >::size_type result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiVariable > *","erase", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::map< int,CdiVariable >::key_type","erase", 2, argv[0] )); + } + temp2 = static_cast< std::map< int,CdiVariable >::key_type >(val2); + arg2 = &temp2; + result = (arg1)->erase((std::map< int,CdiVariable >::key_type const &)*arg2); + vresult = SWIG_From_size_t(static_cast< size_t >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_VarsByCode_count(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; + std::map< int,CdiVariable >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiVariable >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + std::map< int,CdiVariable >::size_type result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiVariable > const *","count", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::map< int,CdiVariable >::key_type","count", 2, argv[0] )); + } + temp2 = static_cast< std::map< int,CdiVariable >::key_type >(val2); + arg2 = &temp2; + result = ((std::map< int,CdiVariable > const *)arg1)->count((std::map< int,CdiVariable >::key_type const &)*arg2); + vresult = SWIG_From_size_t(static_cast< size_t >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_VarsByCode_erase__SWIG_1(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; + std::map< int,CdiVariable >::iterator arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 ; + int res2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiVariable > *","erase", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); + { + res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t__iterator, 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::map< int,CdiVariable >::iterator","erase", 2, argv[0] )); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::map< int,CdiVariable >::iterator","erase", 2, argv[0])); + } else { + arg2 = *(reinterpret_cast< std::map< int,CdiVariable >::iterator * >(argp2)); + } + } + std_map_Sl_int_Sc_CdiVariable_Sg__erase__SWIG_1(arg1,arg2); + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_VarsByCode_erase__SWIG_2(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; + std::map< int,CdiVariable >::iterator arg2 ; + std::map< int,CdiVariable >::iterator arg3 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 ; + int res2 = 0 ; + void *argp3 ; + int res3 = 0 ; + + if ((argc < 2) || (argc > 2)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiVariable > *","erase", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); + { + res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t__iterator, 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::map< int,CdiVariable >::iterator","erase", 2, argv[0] )); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::map< int,CdiVariable >::iterator","erase", 2, argv[0])); + } else { + arg2 = *(reinterpret_cast< std::map< int,CdiVariable >::iterator * >(argp2)); + } + } + { + res3 = SWIG_ConvertPtr(argv[1], &argp3, SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t__iterator, 0 ); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "std::map< int,CdiVariable >::iterator","erase", 3, argv[1] )); + } + if (!argp3) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::map< int,CdiVariable >::iterator","erase", 3, argv[1])); + } else { + arg3 = *(reinterpret_cast< std::map< int,CdiVariable >::iterator * >(argp3)); + } + } + std_map_Sl_int_Sc_CdiVariable_Sg__erase__SWIG_2(arg1,arg2,arg3); + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE _wrap_VarsByCode_erase(int nargs, VALUE *args, VALUE self) { + int argc; + VALUE argv[4]; + int ii; + + argc = nargs + 1; + argv[0] = self; + if (argc > 4) SWIG_fail; + for (ii = 1; (ii < argc); ++ii) { + argv[ii] = args[ii-1]; + } + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t__iterator, SWIG_POINTER_NO_NULL); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_VarsByCode_erase__SWIG_1(nargs, args, self); + } + } + } + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_VarsByCode_erase__SWIG_0(nargs, args, self); + } + } + } + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t__iterator, SWIG_POINTER_NO_NULL); + _v = SWIG_CheckState(res); + if (_v) { + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t__iterator, SWIG_POINTER_NO_NULL); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_VarsByCode_erase__SWIG_2(nargs, args, self); + } + } + } + } + +fail: + Ruby_Format_OverloadedError( argc, 4, "VarsByCode.erase", + " std::map< int,CdiVariable >::size_type VarsByCode.erase(std::map< int,CdiVariable >::key_type const &x)\n" + " void VarsByCode.erase(std::map< int,CdiVariable >::iterator position)\n" + " void VarsByCode.erase(std::map< int,CdiVariable >::iterator first, std::map< int,CdiVariable >::iterator last)\n"); + + return Qnil; +} + + +/* + Document-method: Cdi::VarsByCode.find + + call-seq: + find(x) -> std::map< int,CdiVariable >::iterator + +Find an element in the class. +*/ +SWIGINTERN VALUE +_wrap_VarsByCode_find(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; + std::map< int,CdiVariable >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiVariable >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + std::map< int,CdiVariable >::iterator result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiVariable > *","find", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::map< int,CdiVariable >::key_type","find", 2, argv[0] )); + } + temp2 = static_cast< std::map< int,CdiVariable >::key_type >(val2); + arg2 = &temp2; + result = (arg1)->find((std::map< int,CdiVariable >::key_type const &)*arg2); + vresult = SWIG_NewPointerObj((new std::map< int,CdiVariable >::iterator(static_cast< const std::map< int,CdiVariable >::iterator& >(result))), SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t__iterator, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_VarsByCode_lower_bound(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; + std::map< int,CdiVariable >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiVariable >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + std::map< int,CdiVariable >::iterator result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiVariable > *","lower_bound", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::map< int,CdiVariable >::key_type","lower_bound", 2, argv[0] )); + } + temp2 = static_cast< std::map< int,CdiVariable >::key_type >(val2); + arg2 = &temp2; + result = (arg1)->lower_bound((std::map< int,CdiVariable >::key_type const &)*arg2); + vresult = SWIG_NewPointerObj((new std::map< int,CdiVariable >::iterator(static_cast< const std::map< int,CdiVariable >::iterator& >(result))), SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t__iterator, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_VarsByCode_upper_bound(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; + std::map< int,CdiVariable >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiVariable >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + std::map< int,CdiVariable >::iterator result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiVariable > *","upper_bound", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::map< int,CdiVariable >::key_type","upper_bound", 2, argv[0] )); + } + temp2 = static_cast< std::map< int,CdiVariable >::key_type >(val2); + arg2 = &temp2; + result = (arg1)->upper_bound((std::map< int,CdiVariable >::key_type const &)*arg2); + vresult = SWIG_NewPointerObj((new std::map< int,CdiVariable >::iterator(static_cast< const std::map< int,CdiVariable >::iterator& >(result))), SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t__iterator, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN void +free_std_map_Sl_int_Sc_CdiVariable_Sg_(void *self) { + std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *)self; + delete arg1; +} + +static swig_class SwigClassTaxesMap; + +SWIGINTERN VALUE +_wrap_new_TaxesMap__SWIG_0(int argc, VALUE *argv, VALUE self) { + std::less< int > *arg1 = 0 ; + void *argp1 ; + int res1 = 0 ; + std::map< int,CdiTaxis > *result = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(argv[0], &argp1, SWIGTYPE_p_std__lessT_int_t, 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::less< int > const &","map<(int,CdiTaxis)>", 1, argv[0] )); + } + if (!argp1) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::less< int > const &","map<(int,CdiTaxis)>", 1, argv[0])); + } + arg1 = reinterpret_cast< std::less< int > * >(argp1); + result = (std::map< int,CdiTaxis > *)new std::map< int,CdiTaxis >((std::less< int > const &)*arg1); + DATA_PTR(self) = result; + return self; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::TaxesMap.dup + + call-seq: + dup -> TaxesMap + +Create a duplicate of the class and unfreeze it if needed. +*/ +SWIGINTERN VALUE +_wrap_TaxesMap_dup(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiTaxis > *","dup", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); + result = (std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > > *)std_map_Sl_int_Sc_CdiTaxis_Sg__dup(arg1); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::TaxesMap.delete + + call-seq: + delete(key) -> VALUE + +Delete a matching element. +*/ +SWIGINTERN VALUE +_wrap_TaxesMap_delete(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; + std::map< int,CdiTaxis >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiTaxis >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiTaxis > *","__delete__", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::map< int,CdiTaxis >::key_type","__delete__", 2, argv[0] )); + } + temp2 = static_cast< std::map< int,CdiTaxis >::key_type >(val2); + arg2 = &temp2; + result = (VALUE)std_map_Sl_int_Sc_CdiTaxis_Sg____delete__(arg1,(int const &)*arg2); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_TaxesMap_has_keyq___(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; + std::map< int,CdiTaxis >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiTaxis >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + bool result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiTaxis > const *","has_key", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::map< int,CdiTaxis >::key_type","has_key", 2, argv[0] )); + } + temp2 = static_cast< std::map< int,CdiTaxis >::key_type >(val2); + arg2 = &temp2; + result = (bool)std_map_Sl_int_Sc_CdiTaxis_Sg__has_key((std::map< int,CdiTaxis > const *)arg1,(int const &)*arg2); + vresult = SWIG_From_bool(static_cast< bool >(result)); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::TaxesMap.keys + + call-seq: + keys -> VALUE + +Return an Array of key elements. +*/ +SWIGINTERN VALUE +_wrap_TaxesMap_keys(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiTaxis > *","keys", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); + result = (VALUE)std_map_Sl_int_Sc_CdiTaxis_Sg__keys(arg1); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::TaxesMap.each + + call-seq: + each -> TaxesMap + +Iterate thru each element in the TaxesMap. A block must be provided. +*/ +SWIGINTERN VALUE +_wrap_TaxesMap_each(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiTaxis > *","each", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); + result = (std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > > *)std_map_Sl_int_Sc_CdiTaxis_Sg__each(arg1); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::TaxesMap.select + + call-seq: + select -> TaxesMap + +Iterate thru each element in the TaxesMap and select those that match a condition. A block must be provided. +*/ +SWIGINTERN VALUE +_wrap_TaxesMap_select(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiTaxis > *","select", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); + result = (std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > > *)std_map_Sl_int_Sc_CdiTaxis_Sg__select(arg1); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::TaxesMap.values_at + + call-seq: + values_at(argc) -> VALUE + +Return an Array of value elements matching the conditions. +*/ +SWIGINTERN VALUE +_wrap_TaxesMap_values_at(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; + int arg2 ; + VALUE *arg3 = (VALUE *) 0 ; + void *arg4 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if (argc < 1) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiTaxis > *","values_at", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); + { + arg2 = argc; + arg3 = argv; + } + result = (VALUE)std_map_Sl_int_Sc_CdiTaxis_Sg__values_at(arg1,arg2,arg3,arg4); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::TaxesMap.each_key + + call-seq: + each_key -> TaxesMap + +Iterate thru each key element in the TaxesMap. A block must be provided. +*/ +SWIGINTERN VALUE +_wrap_TaxesMap_each_key(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiTaxis > *","each_key", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); + result = (std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > > *)std_map_Sl_int_Sc_CdiTaxis_Sg__each_key(arg1); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::TaxesMap.values + + call-seq: + values -> VALUE + +Return an Array of value elements. +*/ +SWIGINTERN VALUE +_wrap_TaxesMap_values(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiTaxis > *","values", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); + result = (VALUE)std_map_Sl_int_Sc_CdiTaxis_Sg__values(arg1); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::TaxesMap.each_value + + call-seq: + each_value -> TaxesMap + +Iterate thru each key element in the TaxesMap. A block must be provided. +*/ +SWIGINTERN VALUE +_wrap_TaxesMap_each_value(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiTaxis > *","each_value", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); + result = (std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > > *)std_map_Sl_int_Sc_CdiTaxis_Sg__each_value(arg1); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_TaxesMap_entries(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiTaxis > *","entries", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); + result = (VALUE)std_map_Sl_int_Sc_CdiTaxis_Sg__entries(arg1); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_TaxesMap_includeq___(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; + std::map< int,CdiTaxis >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiTaxis >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + bool result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiTaxis > *","__contains__", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::map< int,CdiTaxis >::key_type","__contains__", 2, argv[0] )); + } + temp2 = static_cast< std::map< int,CdiTaxis >::key_type >(val2); + arg2 = &temp2; + result = (bool)std_map_Sl_int_Sc_CdiTaxis_Sg____contains__(arg1,(int const &)*arg2); + vresult = SWIG_From_bool(static_cast< bool >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_TaxesMap_key_iterator(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; + VALUE *arg2 = (VALUE *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + swig::ConstIterator *result = 0 ; + VALUE vresult = Qnil; + + arg2 = &self; + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiTaxis > *","key_iterator", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); + result = (swig::ConstIterator *)std_map_Sl_int_Sc_CdiTaxis_Sg__key_iterator(arg1,arg2); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__ConstIterator, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_TaxesMap_value_iterator(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; + VALUE *arg2 = (VALUE *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + swig::ConstIterator *result = 0 ; + VALUE vresult = Qnil; + + arg2 = &self; + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiTaxis > *","value_iterator", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); + result = (swig::ConstIterator *)std_map_Sl_int_Sc_CdiTaxis_Sg__value_iterator(arg1,arg2); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__ConstIterator, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::TaxesMap.[] + + call-seq: + [](key) -> VALUE + +Element accessor/slicing. +*/ +SWIGINTERN VALUE +_wrap_TaxesMap___getitem__(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; + std::map< int,CdiTaxis >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiTaxis >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiTaxis > const *","__getitem__", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::map< int,CdiTaxis >::key_type","__getitem__", 2, argv[0] )); + } + temp2 = static_cast< std::map< int,CdiTaxis >::key_type >(val2); + arg2 = &temp2; + result = (VALUE)std_map_Sl_int_Sc_CdiTaxis_Sg____getitem__((std::map< int,CdiTaxis > const *)arg1,(int const &)*arg2); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::TaxesMap.[]= + + call-seq: + []=(key, x) + +Element setter/slicing. +*/ +SWIGINTERN VALUE +_wrap_TaxesMap___setitem__(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; + std::map< int,CdiTaxis >::key_type *arg2 = 0 ; + std::map< int,CdiTaxis >::mapped_type *arg3 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiTaxis >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + void *argp3 ; + int res3 = 0 ; + + if ((argc < 2) || (argc > 2)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiTaxis > *","__setitem__", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::map< int,CdiTaxis >::key_type","__setitem__", 2, argv[0] )); + } + temp2 = static_cast< std::map< int,CdiTaxis >::key_type >(val2); + arg2 = &temp2; + res3 = SWIG_ConvertPtr(argv[1], &argp3, SWIGTYPE_p_CdiTaxis, 0 ); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "std::map< int,CdiTaxis >::mapped_type const &","__setitem__", 3, argv[1] )); + } + if (!argp3) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::map< int,CdiTaxis >::mapped_type const &","__setitem__", 3, argv[1])); + } + arg3 = reinterpret_cast< std::map< int,CdiTaxis >::mapped_type * >(argp3); + try { + std_map_Sl_int_Sc_CdiTaxis_Sg____setitem__(arg1,(int const &)*arg2,(CdiTaxis const &)*arg3); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } + return Qnil; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::TaxesMap.inspect + + call-seq: + inspect -> VALUE + +Inspect class and its contents. +*/ +SWIGINTERN VALUE +_wrap_TaxesMap_inspect(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiTaxis > *","inspect", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); + result = (VALUE)std_map_Sl_int_Sc_CdiTaxis_Sg__inspect(arg1); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::TaxesMap.to_a + + call-seq: + to_a -> VALUE + +Convert TaxesMap to an Array. +*/ +SWIGINTERN VALUE +_wrap_TaxesMap_to_a(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiTaxis > *","to_a", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); + result = (VALUE)std_map_Sl_int_Sc_CdiTaxis_Sg__to_a(arg1); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::TaxesMap.to_s + + call-seq: + to_s -> VALUE + +Convert class to a String representation. +*/ +SWIGINTERN VALUE +_wrap_TaxesMap_to_s(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiTaxis > *","to_s", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); + result = (VALUE)std_map_Sl_int_Sc_CdiTaxis_Sg__to_s(arg1); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_new_TaxesMap__SWIG_1(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiTaxis > *result = 0 ; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + result = (std::map< int,CdiTaxis > *)new std::map< int,CdiTaxis >(); + DATA_PTR(self) = result; + return self; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +#ifdef HAVE_RB_DEFINE_ALLOC_FUNC +_wrap_TaxesMap_allocate(VALUE self) +#else +_wrap_TaxesMap_allocate(int argc, VALUE *argv, VALUE self) +#endif +{ + VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t); +#ifndef HAVE_RB_DEFINE_ALLOC_FUNC + rb_obj_call_init(vresult, argc, argv); +#endif + return vresult; +} + + +SWIGINTERN VALUE +_wrap_new_TaxesMap__SWIG_2(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiTaxis > *arg1 = 0 ; + int res1 = SWIG_OLDOBJ ; + std::map< int,CdiTaxis > *result = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + { + std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > > *ptr = (std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > > *)0; + res1 = swig::asptr(argv[0], &ptr); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiTaxis > const &","map<(int,CdiTaxis)>", 1, argv[0] )); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::map< int,CdiTaxis > const &","map<(int,CdiTaxis)>", 1, argv[0])); + } + arg1 = ptr; + } + result = (std::map< int,CdiTaxis > *)new std::map< int,CdiTaxis >((std::map< int,CdiTaxis > const &)*arg1); + DATA_PTR(self) = result; + if (SWIG_IsNewObj(res1)) delete arg1; + return self; +fail: + if (SWIG_IsNewObj(res1)) delete arg1; + return Qnil; +} + + +SWIGINTERN VALUE _wrap_new_TaxesMap(int nargs, VALUE *args, VALUE self) { + int argc; + VALUE argv[1]; + int ii; + + argc = nargs; + if (argc > 1) SWIG_fail; + for (ii = 0; (ii < argc); ++ii) { + argv[ii] = args[ii]; + } + if (argc == 0) { + return _wrap_new_TaxesMap__SWIG_1(nargs, args, self); + } + if (argc == 1) { + int _v; + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_std__lessT_int_t, SWIG_POINTER_NO_NULL); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_new_TaxesMap__SWIG_0(nargs, args, self); + } + } + if (argc == 1) { + int _v; + int res = swig::asptr(argv[0], (std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_new_TaxesMap__SWIG_2(nargs, args, self); + } + } + +fail: + Ruby_Format_OverloadedError( argc, 1, "TaxesMap.new", + " TaxesMap.new(std::less< int > const &other)\n" + " TaxesMap.new()\n" + " TaxesMap.new(std::map< int,CdiTaxis > const &other)\n"); + + return Qnil; +} + + +/* + Document-method: Cdi::TaxesMap.empty? + + call-seq: + empty? -> bool + +Check if the TaxesMap is empty or not. +*/ +SWIGINTERN VALUE +_wrap_TaxesMap_emptyq___(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + bool result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiTaxis > const *","empty", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); + result = (bool)((std::map< int,CdiTaxis > const *)arg1)->empty(); + vresult = SWIG_From_bool(static_cast< bool >(result)); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::TaxesMap.size + + call-seq: + size -> std::map< int,CdiTaxis >::size_type + +Size or Length of the TaxesMap. +*/ +SWIGINTERN VALUE +_wrap_TaxesMap_size(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiTaxis >::size_type result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiTaxis > const *","size", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); + result = ((std::map< int,CdiTaxis > const *)arg1)->size(); + vresult = SWIG_From_size_t(static_cast< size_t >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_TaxesMap_swap(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; + std::map< int,CdiTaxis > *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiTaxis > *","swap", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); + res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::map< int,CdiTaxis > &","swap", 2, argv[0] )); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::map< int,CdiTaxis > &","swap", 2, argv[0])); + } + arg2 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp2); + (arg1)->swap(*arg2); + return Qnil; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::TaxesMap.begin + + call-seq: + begin -> std::map< int,CdiTaxis >::iterator + +Return an iterator to the beginning of the TaxesMap. +*/ +SWIGINTERN VALUE +_wrap_TaxesMap_begin(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiTaxis >::iterator result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiTaxis > *","begin", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); + result = (arg1)->begin(); + vresult = SWIG_NewPointerObj((new std::map< int,CdiTaxis >::iterator(static_cast< const std::map< int,CdiTaxis >::iterator& >(result))), SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t__iterator, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::TaxesMap.end + + call-seq: + end -> std::map< int,CdiTaxis >::iterator + +Return an iterator to past the end of the TaxesMap. +*/ +SWIGINTERN VALUE +_wrap_TaxesMap_end(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiTaxis >::iterator result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiTaxis > *","end", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); + result = (arg1)->end(); + vresult = SWIG_NewPointerObj((new std::map< int,CdiTaxis >::iterator(static_cast< const std::map< int,CdiTaxis >::iterator& >(result))), SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t__iterator, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::TaxesMap.rbegin + + call-seq: + rbegin -> std::map< int,CdiTaxis >::reverse_iterator + +Return a reverse iterator to the beginning (the end) of the TaxesMap. +*/ +SWIGINTERN VALUE +_wrap_TaxesMap_rbegin(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiTaxis >::reverse_iterator result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiTaxis > *","rbegin", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); + result = (arg1)->rbegin(); + vresult = SWIG_NewPointerObj((new std::map< int,CdiTaxis >::reverse_iterator(static_cast< const std::map< int,CdiTaxis >::reverse_iterator& >(result))), SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t__reverse_iterator, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::TaxesMap.rend + + call-seq: + rend -> std::map< int,CdiTaxis >::reverse_iterator + +Return a reverse iterator to past the end (past the beginning) of the TaxesMap. +*/ +SWIGINTERN VALUE +_wrap_TaxesMap_rend(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiTaxis >::reverse_iterator result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiTaxis > *","rend", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); + result = (arg1)->rend(); + vresult = SWIG_NewPointerObj((new std::map< int,CdiTaxis >::reverse_iterator(static_cast< const std::map< int,CdiTaxis >::reverse_iterator& >(result))), SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t__reverse_iterator, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::TaxesMap.clear + + call-seq: + clear + +Clear TaxesMap contents. +*/ +SWIGINTERN VALUE +_wrap_TaxesMap_clear(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiTaxis > *","clear", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); + (arg1)->clear(); + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_TaxesMap_get_allocator(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + SwigValueWrapper< std::allocator< std::pair< int const,CdiTaxis > > > result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiTaxis > const *","get_allocator", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); + result = ((std::map< int,CdiTaxis > const *)arg1)->get_allocator(); + vresult = SWIG_NewPointerObj((new std::map< int,CdiTaxis >::allocator_type(static_cast< const std::map< int,CdiTaxis >::allocator_type& >(result))), SWIGTYPE_p_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::TaxesMap.erase + + call-seq: + erase(x) -> std::map< int,CdiTaxis >::size_type + erase(position) + erase(first, last) + +Delete a portion of the TaxesMap. +*/ +SWIGINTERN VALUE +_wrap_TaxesMap_erase__SWIG_0(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; + std::map< int,CdiTaxis >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiTaxis >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + std::map< int,CdiTaxis >::size_type result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiTaxis > *","erase", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::map< int,CdiTaxis >::key_type","erase", 2, argv[0] )); + } + temp2 = static_cast< std::map< int,CdiTaxis >::key_type >(val2); + arg2 = &temp2; + result = (arg1)->erase((std::map< int,CdiTaxis >::key_type const &)*arg2); + vresult = SWIG_From_size_t(static_cast< size_t >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_TaxesMap_count(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; + std::map< int,CdiTaxis >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiTaxis >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + std::map< int,CdiTaxis >::size_type result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiTaxis > const *","count", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::map< int,CdiTaxis >::key_type","count", 2, argv[0] )); + } + temp2 = static_cast< std::map< int,CdiTaxis >::key_type >(val2); + arg2 = &temp2; + result = ((std::map< int,CdiTaxis > const *)arg1)->count((std::map< int,CdiTaxis >::key_type const &)*arg2); + vresult = SWIG_From_size_t(static_cast< size_t >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_TaxesMap_erase__SWIG_1(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; + std::map< int,CdiTaxis >::iterator arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 ; + int res2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiTaxis > *","erase", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); + { + res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t__iterator, 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::map< int,CdiTaxis >::iterator","erase", 2, argv[0] )); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::map< int,CdiTaxis >::iterator","erase", 2, argv[0])); + } else { + arg2 = *(reinterpret_cast< std::map< int,CdiTaxis >::iterator * >(argp2)); + } + } + std_map_Sl_int_Sc_CdiTaxis_Sg__erase__SWIG_1(arg1,arg2); + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_TaxesMap_erase__SWIG_2(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; + std::map< int,CdiTaxis >::iterator arg2 ; + std::map< int,CdiTaxis >::iterator arg3 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 ; + int res2 = 0 ; + void *argp3 ; + int res3 = 0 ; + + if ((argc < 2) || (argc > 2)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiTaxis > *","erase", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); + { + res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t__iterator, 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::map< int,CdiTaxis >::iterator","erase", 2, argv[0] )); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::map< int,CdiTaxis >::iterator","erase", 2, argv[0])); + } else { + arg2 = *(reinterpret_cast< std::map< int,CdiTaxis >::iterator * >(argp2)); + } + } + { + res3 = SWIG_ConvertPtr(argv[1], &argp3, SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t__iterator, 0 ); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "std::map< int,CdiTaxis >::iterator","erase", 3, argv[1] )); + } + if (!argp3) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::map< int,CdiTaxis >::iterator","erase", 3, argv[1])); + } else { + arg3 = *(reinterpret_cast< std::map< int,CdiTaxis >::iterator * >(argp3)); + } + } + std_map_Sl_int_Sc_CdiTaxis_Sg__erase__SWIG_2(arg1,arg2,arg3); + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE _wrap_TaxesMap_erase(int nargs, VALUE *args, VALUE self) { + int argc; + VALUE argv[4]; + int ii; + + argc = nargs + 1; + argv[0] = self; + if (argc > 4) SWIG_fail; + for (ii = 1; (ii < argc); ++ii) { + argv[ii] = args[ii-1]; + } + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t__iterator, SWIG_POINTER_NO_NULL); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_TaxesMap_erase__SWIG_1(nargs, args, self); + } + } + } + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_TaxesMap_erase__SWIG_0(nargs, args, self); + } + } + } + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t__iterator, SWIG_POINTER_NO_NULL); + _v = SWIG_CheckState(res); + if (_v) { + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t__iterator, SWIG_POINTER_NO_NULL); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_TaxesMap_erase__SWIG_2(nargs, args, self); + } + } + } + } + +fail: + Ruby_Format_OverloadedError( argc, 4, "TaxesMap.erase", + " std::map< int,CdiTaxis >::size_type TaxesMap.erase(std::map< int,CdiTaxis >::key_type const &x)\n" + " void TaxesMap.erase(std::map< int,CdiTaxis >::iterator position)\n" + " void TaxesMap.erase(std::map< int,CdiTaxis >::iterator first, std::map< int,CdiTaxis >::iterator last)\n"); + + return Qnil; +} + + +/* + Document-method: Cdi::TaxesMap.find + + call-seq: + find(x) -> std::map< int,CdiTaxis >::iterator + +Find an element in the class. +*/ +SWIGINTERN VALUE +_wrap_TaxesMap_find(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; + std::map< int,CdiTaxis >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiTaxis >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + std::map< int,CdiTaxis >::iterator result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiTaxis > *","find", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::map< int,CdiTaxis >::key_type","find", 2, argv[0] )); + } + temp2 = static_cast< std::map< int,CdiTaxis >::key_type >(val2); + arg2 = &temp2; + result = (arg1)->find((std::map< int,CdiTaxis >::key_type const &)*arg2); + vresult = SWIG_NewPointerObj((new std::map< int,CdiTaxis >::iterator(static_cast< const std::map< int,CdiTaxis >::iterator& >(result))), SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t__iterator, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_TaxesMap_lower_bound(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; + std::map< int,CdiTaxis >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiTaxis >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + std::map< int,CdiTaxis >::iterator result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiTaxis > *","lower_bound", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::map< int,CdiTaxis >::key_type","lower_bound", 2, argv[0] )); + } + temp2 = static_cast< std::map< int,CdiTaxis >::key_type >(val2); + arg2 = &temp2; + result = (arg1)->lower_bound((std::map< int,CdiTaxis >::key_type const &)*arg2); + vresult = SWIG_NewPointerObj((new std::map< int,CdiTaxis >::iterator(static_cast< const std::map< int,CdiTaxis >::iterator& >(result))), SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t__iterator, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_TaxesMap_upper_bound(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; + std::map< int,CdiTaxis >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiTaxis >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + std::map< int,CdiTaxis >::iterator result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiTaxis > *","upper_bound", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::map< int,CdiTaxis >::key_type","upper_bound", 2, argv[0] )); + } + temp2 = static_cast< std::map< int,CdiTaxis >::key_type >(val2); + arg2 = &temp2; + result = (arg1)->upper_bound((std::map< int,CdiTaxis >::key_type const &)*arg2); + vresult = SWIG_NewPointerObj((new std::map< int,CdiTaxis >::iterator(static_cast< const std::map< int,CdiTaxis >::iterator& >(result))), SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t__iterator, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN void +free_std_map_Sl_int_Sc_CdiTaxis_Sg_(void *self) { + std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *)self; + delete arg1; +} + +static swig_class SwigClassZaxesMap; + +SWIGINTERN VALUE +_wrap_new_ZaxesMap__SWIG_0(int argc, VALUE *argv, VALUE self) { + std::less< int > *arg1 = 0 ; + void *argp1 ; + int res1 = 0 ; + std::map< int,CdiZaxis > *result = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(argv[0], &argp1, SWIGTYPE_p_std__lessT_int_t, 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::less< int > const &","map<(int,CdiZaxis)>", 1, argv[0] )); + } + if (!argp1) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::less< int > const &","map<(int,CdiZaxis)>", 1, argv[0])); + } + arg1 = reinterpret_cast< std::less< int > * >(argp1); + result = (std::map< int,CdiZaxis > *)new std::map< int,CdiZaxis >((std::less< int > const &)*arg1); + DATA_PTR(self) = result; + return self; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::ZaxesMap.dup + + call-seq: + dup -> ZaxesMap + +Create a duplicate of the class and unfreeze it if needed. +*/ +SWIGINTERN VALUE +_wrap_ZaxesMap_dup(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiZaxis > *","dup", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); + result = (std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > > *)std_map_Sl_int_Sc_CdiZaxis_Sg__dup(arg1); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::ZaxesMap.delete + + call-seq: + delete(key) -> VALUE + +Delete a matching element. +*/ +SWIGINTERN VALUE +_wrap_ZaxesMap_delete(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; + std::map< int,CdiZaxis >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiZaxis >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiZaxis > *","__delete__", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::map< int,CdiZaxis >::key_type","__delete__", 2, argv[0] )); + } + temp2 = static_cast< std::map< int,CdiZaxis >::key_type >(val2); + arg2 = &temp2; + result = (VALUE)std_map_Sl_int_Sc_CdiZaxis_Sg____delete__(arg1,(int const &)*arg2); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_ZaxesMap_has_keyq___(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; + std::map< int,CdiZaxis >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiZaxis >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + bool result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiZaxis > const *","has_key", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::map< int,CdiZaxis >::key_type","has_key", 2, argv[0] )); + } + temp2 = static_cast< std::map< int,CdiZaxis >::key_type >(val2); + arg2 = &temp2; + result = (bool)std_map_Sl_int_Sc_CdiZaxis_Sg__has_key((std::map< int,CdiZaxis > const *)arg1,(int const &)*arg2); + vresult = SWIG_From_bool(static_cast< bool >(result)); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::ZaxesMap.keys + + call-seq: + keys -> VALUE + +Return an Array of key elements. +*/ +SWIGINTERN VALUE +_wrap_ZaxesMap_keys(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiZaxis > *","keys", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); + result = (VALUE)std_map_Sl_int_Sc_CdiZaxis_Sg__keys(arg1); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::ZaxesMap.each + + call-seq: + each -> ZaxesMap + +Iterate thru each element in the ZaxesMap. A block must be provided. +*/ +SWIGINTERN VALUE +_wrap_ZaxesMap_each(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiZaxis > *","each", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); + result = (std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > > *)std_map_Sl_int_Sc_CdiZaxis_Sg__each(arg1); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::ZaxesMap.select + + call-seq: + select -> ZaxesMap + +Iterate thru each element in the ZaxesMap and select those that match a condition. A block must be provided. +*/ +SWIGINTERN VALUE +_wrap_ZaxesMap_select(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiZaxis > *","select", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); + result = (std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > > *)std_map_Sl_int_Sc_CdiZaxis_Sg__select(arg1); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::ZaxesMap.values_at + + call-seq: + values_at(argc) -> VALUE + +Return an Array of value elements matching the conditions. +*/ +SWIGINTERN VALUE +_wrap_ZaxesMap_values_at(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; + int arg2 ; + VALUE *arg3 = (VALUE *) 0 ; + void *arg4 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if (argc < 1) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiZaxis > *","values_at", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); + { + arg2 = argc; + arg3 = argv; + } + result = (VALUE)std_map_Sl_int_Sc_CdiZaxis_Sg__values_at(arg1,arg2,arg3,arg4); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::ZaxesMap.each_key + + call-seq: + each_key -> ZaxesMap + +Iterate thru each key element in the ZaxesMap. A block must be provided. +*/ +SWIGINTERN VALUE +_wrap_ZaxesMap_each_key(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiZaxis > *","each_key", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); + result = (std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > > *)std_map_Sl_int_Sc_CdiZaxis_Sg__each_key(arg1); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::ZaxesMap.values + + call-seq: + values -> VALUE + +Return an Array of value elements. +*/ +SWIGINTERN VALUE +_wrap_ZaxesMap_values(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiZaxis > *","values", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); + result = (VALUE)std_map_Sl_int_Sc_CdiZaxis_Sg__values(arg1); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::ZaxesMap.each_value + + call-seq: + each_value -> ZaxesMap + +Iterate thru each key element in the ZaxesMap. A block must be provided. +*/ +SWIGINTERN VALUE +_wrap_ZaxesMap_each_value(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiZaxis > *","each_value", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); + result = (std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > > *)std_map_Sl_int_Sc_CdiZaxis_Sg__each_value(arg1); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_ZaxesMap_entries(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiZaxis > *","entries", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); + result = (VALUE)std_map_Sl_int_Sc_CdiZaxis_Sg__entries(arg1); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_ZaxesMap_includeq___(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; + std::map< int,CdiZaxis >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiZaxis >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + bool result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiZaxis > *","__contains__", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::map< int,CdiZaxis >::key_type","__contains__", 2, argv[0] )); + } + temp2 = static_cast< std::map< int,CdiZaxis >::key_type >(val2); + arg2 = &temp2; + result = (bool)std_map_Sl_int_Sc_CdiZaxis_Sg____contains__(arg1,(int const &)*arg2); + vresult = SWIG_From_bool(static_cast< bool >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_ZaxesMap_key_iterator(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; + VALUE *arg2 = (VALUE *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + swig::ConstIterator *result = 0 ; + VALUE vresult = Qnil; + + arg2 = &self; + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiZaxis > *","key_iterator", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); + result = (swig::ConstIterator *)std_map_Sl_int_Sc_CdiZaxis_Sg__key_iterator(arg1,arg2); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__ConstIterator, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_ZaxesMap_value_iterator(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; + VALUE *arg2 = (VALUE *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + swig::ConstIterator *result = 0 ; + VALUE vresult = Qnil; + + arg2 = &self; + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiZaxis > *","value_iterator", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); + result = (swig::ConstIterator *)std_map_Sl_int_Sc_CdiZaxis_Sg__value_iterator(arg1,arg2); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__ConstIterator, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::ZaxesMap.[] + + call-seq: + [](key) -> VALUE + +Element accessor/slicing. +*/ +SWIGINTERN VALUE +_wrap_ZaxesMap___getitem__(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; + std::map< int,CdiZaxis >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiZaxis >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiZaxis > const *","__getitem__", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::map< int,CdiZaxis >::key_type","__getitem__", 2, argv[0] )); + } + temp2 = static_cast< std::map< int,CdiZaxis >::key_type >(val2); + arg2 = &temp2; + result = (VALUE)std_map_Sl_int_Sc_CdiZaxis_Sg____getitem__((std::map< int,CdiZaxis > const *)arg1,(int const &)*arg2); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::ZaxesMap.[]= + + call-seq: + []=(key, x) + +Element setter/slicing. +*/ +SWIGINTERN VALUE +_wrap_ZaxesMap___setitem__(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; + std::map< int,CdiZaxis >::key_type *arg2 = 0 ; + std::map< int,CdiZaxis >::mapped_type *arg3 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiZaxis >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + void *argp3 ; + int res3 = 0 ; + + if ((argc < 2) || (argc > 2)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiZaxis > *","__setitem__", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::map< int,CdiZaxis >::key_type","__setitem__", 2, argv[0] )); + } + temp2 = static_cast< std::map< int,CdiZaxis >::key_type >(val2); + arg2 = &temp2; + res3 = SWIG_ConvertPtr(argv[1], &argp3, SWIGTYPE_p_CdiZaxis, 0 ); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "std::map< int,CdiZaxis >::mapped_type const &","__setitem__", 3, argv[1] )); + } + if (!argp3) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::map< int,CdiZaxis >::mapped_type const &","__setitem__", 3, argv[1])); + } + arg3 = reinterpret_cast< std::map< int,CdiZaxis >::mapped_type * >(argp3); + try { + std_map_Sl_int_Sc_CdiZaxis_Sg____setitem__(arg1,(int const &)*arg2,(CdiZaxis const &)*arg3); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } + return Qnil; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::ZaxesMap.inspect + + call-seq: + inspect -> VALUE + +Inspect class and its contents. +*/ +SWIGINTERN VALUE +_wrap_ZaxesMap_inspect(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiZaxis > *","inspect", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); + result = (VALUE)std_map_Sl_int_Sc_CdiZaxis_Sg__inspect(arg1); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::ZaxesMap.to_a + + call-seq: + to_a -> VALUE + +Convert ZaxesMap to an Array. +*/ +SWIGINTERN VALUE +_wrap_ZaxesMap_to_a(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiZaxis > *","to_a", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); + result = (VALUE)std_map_Sl_int_Sc_CdiZaxis_Sg__to_a(arg1); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::ZaxesMap.to_s + + call-seq: + to_s -> VALUE + +Convert class to a String representation. +*/ +SWIGINTERN VALUE +_wrap_ZaxesMap_to_s(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiZaxis > *","to_s", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); + result = (VALUE)std_map_Sl_int_Sc_CdiZaxis_Sg__to_s(arg1); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_new_ZaxesMap__SWIG_1(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiZaxis > *result = 0 ; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + result = (std::map< int,CdiZaxis > *)new std::map< int,CdiZaxis >(); + DATA_PTR(self) = result; + return self; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +#ifdef HAVE_RB_DEFINE_ALLOC_FUNC +_wrap_ZaxesMap_allocate(VALUE self) +#else +_wrap_ZaxesMap_allocate(int argc, VALUE *argv, VALUE self) +#endif +{ + VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t); +#ifndef HAVE_RB_DEFINE_ALLOC_FUNC + rb_obj_call_init(vresult, argc, argv); +#endif + return vresult; +} + + +SWIGINTERN VALUE +_wrap_new_ZaxesMap__SWIG_2(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiZaxis > *arg1 = 0 ; + int res1 = SWIG_OLDOBJ ; + std::map< int,CdiZaxis > *result = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + { + std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > > *ptr = (std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > > *)0; + res1 = swig::asptr(argv[0], &ptr); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiZaxis > const &","map<(int,CdiZaxis)>", 1, argv[0] )); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::map< int,CdiZaxis > const &","map<(int,CdiZaxis)>", 1, argv[0])); + } + arg1 = ptr; + } + result = (std::map< int,CdiZaxis > *)new std::map< int,CdiZaxis >((std::map< int,CdiZaxis > const &)*arg1); + DATA_PTR(self) = result; + if (SWIG_IsNewObj(res1)) delete arg1; + return self; +fail: + if (SWIG_IsNewObj(res1)) delete arg1; + return Qnil; +} + + +SWIGINTERN VALUE _wrap_new_ZaxesMap(int nargs, VALUE *args, VALUE self) { + int argc; + VALUE argv[1]; + int ii; + + argc = nargs; + if (argc > 1) SWIG_fail; + for (ii = 0; (ii < argc); ++ii) { + argv[ii] = args[ii]; + } + if (argc == 0) { + return _wrap_new_ZaxesMap__SWIG_1(nargs, args, self); + } + if (argc == 1) { + int _v; + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_std__lessT_int_t, SWIG_POINTER_NO_NULL); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_new_ZaxesMap__SWIG_0(nargs, args, self); + } + } + if (argc == 1) { + int _v; + int res = swig::asptr(argv[0], (std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_new_ZaxesMap__SWIG_2(nargs, args, self); + } + } + +fail: + Ruby_Format_OverloadedError( argc, 1, "ZaxesMap.new", + " ZaxesMap.new(std::less< int > const &other)\n" + " ZaxesMap.new()\n" + " ZaxesMap.new(std::map< int,CdiZaxis > const &other)\n"); + + return Qnil; +} + + +/* + Document-method: Cdi::ZaxesMap.empty? + + call-seq: + empty? -> bool + +Check if the ZaxesMap is empty or not. +*/ +SWIGINTERN VALUE +_wrap_ZaxesMap_emptyq___(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + bool result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiZaxis > const *","empty", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); + result = (bool)((std::map< int,CdiZaxis > const *)arg1)->empty(); + vresult = SWIG_From_bool(static_cast< bool >(result)); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::ZaxesMap.size + + call-seq: + size -> std::map< int,CdiZaxis >::size_type + +Size or Length of the ZaxesMap. +*/ +SWIGINTERN VALUE +_wrap_ZaxesMap_size(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiZaxis >::size_type result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiZaxis > const *","size", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); + result = ((std::map< int,CdiZaxis > const *)arg1)->size(); + vresult = SWIG_From_size_t(static_cast< size_t >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_ZaxesMap_swap(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; + std::map< int,CdiZaxis > *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiZaxis > *","swap", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); + res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::map< int,CdiZaxis > &","swap", 2, argv[0] )); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::map< int,CdiZaxis > &","swap", 2, argv[0])); + } + arg2 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp2); + (arg1)->swap(*arg2); + return Qnil; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::ZaxesMap.begin + + call-seq: + begin -> std::map< int,CdiZaxis >::iterator + +Return an iterator to the beginning of the ZaxesMap. +*/ +SWIGINTERN VALUE +_wrap_ZaxesMap_begin(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiZaxis >::iterator result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiZaxis > *","begin", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); + result = (arg1)->begin(); + vresult = SWIG_NewPointerObj((new std::map< int,CdiZaxis >::iterator(static_cast< const std::map< int,CdiZaxis >::iterator& >(result))), SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t__iterator, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::ZaxesMap.end + + call-seq: + end -> std::map< int,CdiZaxis >::iterator + +Return an iterator to past the end of the ZaxesMap. +*/ +SWIGINTERN VALUE +_wrap_ZaxesMap_end(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiZaxis >::iterator result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiZaxis > *","end", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); + result = (arg1)->end(); + vresult = SWIG_NewPointerObj((new std::map< int,CdiZaxis >::iterator(static_cast< const std::map< int,CdiZaxis >::iterator& >(result))), SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t__iterator, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::ZaxesMap.rbegin + + call-seq: + rbegin -> std::map< int,CdiZaxis >::reverse_iterator + +Return a reverse iterator to the beginning (the end) of the ZaxesMap. +*/ +SWIGINTERN VALUE +_wrap_ZaxesMap_rbegin(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiZaxis >::reverse_iterator result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiZaxis > *","rbegin", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); + result = (arg1)->rbegin(); + vresult = SWIG_NewPointerObj((new std::map< int,CdiZaxis >::reverse_iterator(static_cast< const std::map< int,CdiZaxis >::reverse_iterator& >(result))), SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t__reverse_iterator, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::ZaxesMap.rend + + call-seq: + rend -> std::map< int,CdiZaxis >::reverse_iterator + +Return a reverse iterator to past the end (past the beginning) of the ZaxesMap. +*/ +SWIGINTERN VALUE +_wrap_ZaxesMap_rend(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiZaxis >::reverse_iterator result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiZaxis > *","rend", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); + result = (arg1)->rend(); + vresult = SWIG_NewPointerObj((new std::map< int,CdiZaxis >::reverse_iterator(static_cast< const std::map< int,CdiZaxis >::reverse_iterator& >(result))), SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t__reverse_iterator, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::ZaxesMap.clear + + call-seq: + clear + +Clear ZaxesMap contents. +*/ +SWIGINTERN VALUE +_wrap_ZaxesMap_clear(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiZaxis > *","clear", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); + (arg1)->clear(); + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_ZaxesMap_get_allocator(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + SwigValueWrapper< std::allocator< std::pair< int const,CdiZaxis > > > result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiZaxis > const *","get_allocator", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); + result = ((std::map< int,CdiZaxis > const *)arg1)->get_allocator(); + vresult = SWIG_NewPointerObj((new std::map< int,CdiZaxis >::allocator_type(static_cast< const std::map< int,CdiZaxis >::allocator_type& >(result))), SWIGTYPE_p_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::ZaxesMap.erase + + call-seq: + erase(x) -> std::map< int,CdiZaxis >::size_type + erase(position) + erase(first, last) + +Delete a portion of the ZaxesMap. +*/ +SWIGINTERN VALUE +_wrap_ZaxesMap_erase__SWIG_0(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; + std::map< int,CdiZaxis >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiZaxis >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + std::map< int,CdiZaxis >::size_type result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiZaxis > *","erase", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::map< int,CdiZaxis >::key_type","erase", 2, argv[0] )); + } + temp2 = static_cast< std::map< int,CdiZaxis >::key_type >(val2); + arg2 = &temp2; + result = (arg1)->erase((std::map< int,CdiZaxis >::key_type const &)*arg2); + vresult = SWIG_From_size_t(static_cast< size_t >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_ZaxesMap_count(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; + std::map< int,CdiZaxis >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiZaxis >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + std::map< int,CdiZaxis >::size_type result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiZaxis > const *","count", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::map< int,CdiZaxis >::key_type","count", 2, argv[0] )); + } + temp2 = static_cast< std::map< int,CdiZaxis >::key_type >(val2); + arg2 = &temp2; + result = ((std::map< int,CdiZaxis > const *)arg1)->count((std::map< int,CdiZaxis >::key_type const &)*arg2); + vresult = SWIG_From_size_t(static_cast< size_t >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_ZaxesMap_erase__SWIG_1(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; + std::map< int,CdiZaxis >::iterator arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 ; + int res2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiZaxis > *","erase", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); + { + res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t__iterator, 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::map< int,CdiZaxis >::iterator","erase", 2, argv[0] )); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::map< int,CdiZaxis >::iterator","erase", 2, argv[0])); + } else { + arg2 = *(reinterpret_cast< std::map< int,CdiZaxis >::iterator * >(argp2)); + } + } + std_map_Sl_int_Sc_CdiZaxis_Sg__erase__SWIG_1(arg1,arg2); + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_ZaxesMap_erase__SWIG_2(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; + std::map< int,CdiZaxis >::iterator arg2 ; + std::map< int,CdiZaxis >::iterator arg3 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 ; + int res2 = 0 ; + void *argp3 ; + int res3 = 0 ; + + if ((argc < 2) || (argc > 2)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiZaxis > *","erase", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); + { + res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t__iterator, 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::map< int,CdiZaxis >::iterator","erase", 2, argv[0] )); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::map< int,CdiZaxis >::iterator","erase", 2, argv[0])); + } else { + arg2 = *(reinterpret_cast< std::map< int,CdiZaxis >::iterator * >(argp2)); + } + } + { + res3 = SWIG_ConvertPtr(argv[1], &argp3, SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t__iterator, 0 ); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "std::map< int,CdiZaxis >::iterator","erase", 3, argv[1] )); + } + if (!argp3) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::map< int,CdiZaxis >::iterator","erase", 3, argv[1])); + } else { + arg3 = *(reinterpret_cast< std::map< int,CdiZaxis >::iterator * >(argp3)); + } + } + std_map_Sl_int_Sc_CdiZaxis_Sg__erase__SWIG_2(arg1,arg2,arg3); + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE _wrap_ZaxesMap_erase(int nargs, VALUE *args, VALUE self) { + int argc; + VALUE argv[4]; + int ii; + + argc = nargs + 1; + argv[0] = self; + if (argc > 4) SWIG_fail; + for (ii = 1; (ii < argc); ++ii) { + argv[ii] = args[ii-1]; + } + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t__iterator, SWIG_POINTER_NO_NULL); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_ZaxesMap_erase__SWIG_1(nargs, args, self); + } + } + } + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_ZaxesMap_erase__SWIG_0(nargs, args, self); + } + } + } + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t__iterator, SWIG_POINTER_NO_NULL); + _v = SWIG_CheckState(res); + if (_v) { + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t__iterator, SWIG_POINTER_NO_NULL); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_ZaxesMap_erase__SWIG_2(nargs, args, self); + } + } + } + } + +fail: + Ruby_Format_OverloadedError( argc, 4, "ZaxesMap.erase", + " std::map< int,CdiZaxis >::size_type ZaxesMap.erase(std::map< int,CdiZaxis >::key_type const &x)\n" + " void ZaxesMap.erase(std::map< int,CdiZaxis >::iterator position)\n" + " void ZaxesMap.erase(std::map< int,CdiZaxis >::iterator first, std::map< int,CdiZaxis >::iterator last)\n"); + + return Qnil; +} + + +/* + Document-method: Cdi::ZaxesMap.find + + call-seq: + find(x) -> std::map< int,CdiZaxis >::iterator + +Find an element in the class. +*/ +SWIGINTERN VALUE +_wrap_ZaxesMap_find(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; + std::map< int,CdiZaxis >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiZaxis >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + std::map< int,CdiZaxis >::iterator result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiZaxis > *","find", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::map< int,CdiZaxis >::key_type","find", 2, argv[0] )); + } + temp2 = static_cast< std::map< int,CdiZaxis >::key_type >(val2); + arg2 = &temp2; + result = (arg1)->find((std::map< int,CdiZaxis >::key_type const &)*arg2); + vresult = SWIG_NewPointerObj((new std::map< int,CdiZaxis >::iterator(static_cast< const std::map< int,CdiZaxis >::iterator& >(result))), SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t__iterator, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_ZaxesMap_lower_bound(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; + std::map< int,CdiZaxis >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiZaxis >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + std::map< int,CdiZaxis >::iterator result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiZaxis > *","lower_bound", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::map< int,CdiZaxis >::key_type","lower_bound", 2, argv[0] )); + } + temp2 = static_cast< std::map< int,CdiZaxis >::key_type >(val2); + arg2 = &temp2; + result = (arg1)->lower_bound((std::map< int,CdiZaxis >::key_type const &)*arg2); + vresult = SWIG_NewPointerObj((new std::map< int,CdiZaxis >::iterator(static_cast< const std::map< int,CdiZaxis >::iterator& >(result))), SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t__iterator, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_ZaxesMap_upper_bound(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; + std::map< int,CdiZaxis >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiZaxis >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + std::map< int,CdiZaxis >::iterator result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiZaxis > *","upper_bound", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::map< int,CdiZaxis >::key_type","upper_bound", 2, argv[0] )); + } + temp2 = static_cast< std::map< int,CdiZaxis >::key_type >(val2); + arg2 = &temp2; + result = (arg1)->upper_bound((std::map< int,CdiZaxis >::key_type const &)*arg2); + vresult = SWIG_NewPointerObj((new std::map< int,CdiZaxis >::iterator(static_cast< const std::map< int,CdiZaxis >::iterator& >(result))), SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t__iterator, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN void +free_std_map_Sl_int_Sc_CdiZaxis_Sg_(void *self) { + std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *)self; + delete arg1; +} + +static swig_class SwigClassGridsMap; + +SWIGINTERN VALUE +_wrap_new_GridsMap__SWIG_0(int argc, VALUE *argv, VALUE self) { + std::less< int > *arg1 = 0 ; + void *argp1 ; + int res1 = 0 ; + std::map< int,CdiGrid > *result = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(argv[0], &argp1, SWIGTYPE_p_std__lessT_int_t, 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::less< int > const &","map<(int,CdiGrid)>", 1, argv[0] )); + } + if (!argp1) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::less< int > const &","map<(int,CdiGrid)>", 1, argv[0])); + } + arg1 = reinterpret_cast< std::less< int > * >(argp1); + result = (std::map< int,CdiGrid > *)new std::map< int,CdiGrid >((std::less< int > const &)*arg1); + DATA_PTR(self) = result; + return self; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::GridsMap.dup + + call-seq: + dup -> GridsMap + +Create a duplicate of the class and unfreeze it if needed. +*/ +SWIGINTERN VALUE +_wrap_GridsMap_dup(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiGrid > *","dup", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); + result = (std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > > *)std_map_Sl_int_Sc_CdiGrid_Sg__dup(arg1); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::GridsMap.delete + + call-seq: + delete(key) -> VALUE + +Delete a matching element. +*/ +SWIGINTERN VALUE +_wrap_GridsMap_delete(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; + std::map< int,CdiGrid >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiGrid >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiGrid > *","__delete__", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::map< int,CdiGrid >::key_type","__delete__", 2, argv[0] )); + } + temp2 = static_cast< std::map< int,CdiGrid >::key_type >(val2); + arg2 = &temp2; + result = (VALUE)std_map_Sl_int_Sc_CdiGrid_Sg____delete__(arg1,(int const &)*arg2); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_GridsMap_has_keyq___(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; + std::map< int,CdiGrid >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiGrid >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + bool result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiGrid > const *","has_key", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::map< int,CdiGrid >::key_type","has_key", 2, argv[0] )); + } + temp2 = static_cast< std::map< int,CdiGrid >::key_type >(val2); + arg2 = &temp2; + result = (bool)std_map_Sl_int_Sc_CdiGrid_Sg__has_key((std::map< int,CdiGrid > const *)arg1,(int const &)*arg2); + vresult = SWIG_From_bool(static_cast< bool >(result)); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::GridsMap.keys + + call-seq: + keys -> VALUE + +Return an Array of key elements. +*/ +SWIGINTERN VALUE +_wrap_GridsMap_keys(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiGrid > *","keys", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); + result = (VALUE)std_map_Sl_int_Sc_CdiGrid_Sg__keys(arg1); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::GridsMap.each + + call-seq: + each -> GridsMap + +Iterate thru each element in the GridsMap. A block must be provided. +*/ +SWIGINTERN VALUE +_wrap_GridsMap_each(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiGrid > *","each", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); + result = (std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > > *)std_map_Sl_int_Sc_CdiGrid_Sg__each(arg1); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::GridsMap.select + + call-seq: + select -> GridsMap + +Iterate thru each element in the GridsMap and select those that match a condition. A block must be provided. +*/ +SWIGINTERN VALUE +_wrap_GridsMap_select(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiGrid > *","select", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); + result = (std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > > *)std_map_Sl_int_Sc_CdiGrid_Sg__select(arg1); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::GridsMap.values_at + + call-seq: + values_at(argc) -> VALUE + +Return an Array of value elements matching the conditions. +*/ +SWIGINTERN VALUE +_wrap_GridsMap_values_at(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; + int arg2 ; + VALUE *arg3 = (VALUE *) 0 ; + void *arg4 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if (argc < 1) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiGrid > *","values_at", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); + { + arg2 = argc; + arg3 = argv; + } + result = (VALUE)std_map_Sl_int_Sc_CdiGrid_Sg__values_at(arg1,arg2,arg3,arg4); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::GridsMap.each_key + + call-seq: + each_key -> GridsMap + +Iterate thru each key element in the GridsMap. A block must be provided. +*/ +SWIGINTERN VALUE +_wrap_GridsMap_each_key(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiGrid > *","each_key", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); + result = (std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > > *)std_map_Sl_int_Sc_CdiGrid_Sg__each_key(arg1); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::GridsMap.values + + call-seq: + values -> VALUE + +Return an Array of value elements. +*/ +SWIGINTERN VALUE +_wrap_GridsMap_values(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiGrid > *","values", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); + result = (VALUE)std_map_Sl_int_Sc_CdiGrid_Sg__values(arg1); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::GridsMap.each_value + + call-seq: + each_value -> GridsMap + +Iterate thru each key element in the GridsMap. A block must be provided. +*/ +SWIGINTERN VALUE +_wrap_GridsMap_each_value(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiGrid > *","each_value", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); + result = (std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > > *)std_map_Sl_int_Sc_CdiGrid_Sg__each_value(arg1); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_GridsMap_entries(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiGrid > *","entries", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); + result = (VALUE)std_map_Sl_int_Sc_CdiGrid_Sg__entries(arg1); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_GridsMap_includeq___(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; + std::map< int,CdiGrid >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiGrid >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + bool result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiGrid > *","__contains__", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::map< int,CdiGrid >::key_type","__contains__", 2, argv[0] )); + } + temp2 = static_cast< std::map< int,CdiGrid >::key_type >(val2); + arg2 = &temp2; + result = (bool)std_map_Sl_int_Sc_CdiGrid_Sg____contains__(arg1,(int const &)*arg2); + vresult = SWIG_From_bool(static_cast< bool >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_GridsMap_key_iterator(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; + VALUE *arg2 = (VALUE *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + swig::ConstIterator *result = 0 ; + VALUE vresult = Qnil; + + arg2 = &self; + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiGrid > *","key_iterator", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); + result = (swig::ConstIterator *)std_map_Sl_int_Sc_CdiGrid_Sg__key_iterator(arg1,arg2); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__ConstIterator, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_GridsMap_value_iterator(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; + VALUE *arg2 = (VALUE *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + swig::ConstIterator *result = 0 ; + VALUE vresult = Qnil; + + arg2 = &self; + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiGrid > *","value_iterator", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); + result = (swig::ConstIterator *)std_map_Sl_int_Sc_CdiGrid_Sg__value_iterator(arg1,arg2); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__ConstIterator, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::GridsMap.[] + + call-seq: + [](key) -> VALUE + +Element accessor/slicing. +*/ +SWIGINTERN VALUE +_wrap_GridsMap___getitem__(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; + std::map< int,CdiGrid >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiGrid >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiGrid > const *","__getitem__", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::map< int,CdiGrid >::key_type","__getitem__", 2, argv[0] )); + } + temp2 = static_cast< std::map< int,CdiGrid >::key_type >(val2); + arg2 = &temp2; + result = (VALUE)std_map_Sl_int_Sc_CdiGrid_Sg____getitem__((std::map< int,CdiGrid > const *)arg1,(int const &)*arg2); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::GridsMap.[]= + + call-seq: + []=(key, x) + +Element setter/slicing. +*/ +SWIGINTERN VALUE +_wrap_GridsMap___setitem__(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; + std::map< int,CdiGrid >::key_type *arg2 = 0 ; + std::map< int,CdiGrid >::mapped_type *arg3 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiGrid >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + void *argp3 ; + int res3 = 0 ; + + if ((argc < 2) || (argc > 2)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiGrid > *","__setitem__", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::map< int,CdiGrid >::key_type","__setitem__", 2, argv[0] )); + } + temp2 = static_cast< std::map< int,CdiGrid >::key_type >(val2); + arg2 = &temp2; + res3 = SWIG_ConvertPtr(argv[1], &argp3, SWIGTYPE_p_CdiGrid, 0 ); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "std::map< int,CdiGrid >::mapped_type const &","__setitem__", 3, argv[1] )); + } + if (!argp3) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::map< int,CdiGrid >::mapped_type const &","__setitem__", 3, argv[1])); + } + arg3 = reinterpret_cast< std::map< int,CdiGrid >::mapped_type * >(argp3); + try { + std_map_Sl_int_Sc_CdiGrid_Sg____setitem__(arg1,(int const &)*arg2,(CdiGrid const &)*arg3); + } catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } + return Qnil; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::GridsMap.inspect + + call-seq: + inspect -> VALUE + +Inspect class and its contents. +*/ +SWIGINTERN VALUE +_wrap_GridsMap_inspect(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiGrid > *","inspect", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); + result = (VALUE)std_map_Sl_int_Sc_CdiGrid_Sg__inspect(arg1); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::GridsMap.to_a + + call-seq: + to_a -> VALUE + +Convert GridsMap to an Array. +*/ +SWIGINTERN VALUE +_wrap_GridsMap_to_a(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiGrid > *","to_a", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); + result = (VALUE)std_map_Sl_int_Sc_CdiGrid_Sg__to_a(arg1); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::GridsMap.to_s + + call-seq: + to_s -> VALUE + +Convert class to a String representation. +*/ +SWIGINTERN VALUE +_wrap_GridsMap_to_s(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + VALUE result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiGrid > *","to_s", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); + result = (VALUE)std_map_Sl_int_Sc_CdiGrid_Sg__to_s(arg1); + vresult = result; + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_new_GridsMap__SWIG_1(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiGrid > *result = 0 ; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + result = (std::map< int,CdiGrid > *)new std::map< int,CdiGrid >(); + DATA_PTR(self) = result; + return self; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +#ifdef HAVE_RB_DEFINE_ALLOC_FUNC +_wrap_GridsMap_allocate(VALUE self) +#else +_wrap_GridsMap_allocate(int argc, VALUE *argv, VALUE self) +#endif +{ + VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t); +#ifndef HAVE_RB_DEFINE_ALLOC_FUNC + rb_obj_call_init(vresult, argc, argv); +#endif + return vresult; +} + + +SWIGINTERN VALUE +_wrap_new_GridsMap__SWIG_2(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiGrid > *arg1 = 0 ; + int res1 = SWIG_OLDOBJ ; + std::map< int,CdiGrid > *result = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + { + std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > > *ptr = (std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > > *)0; + res1 = swig::asptr(argv[0], &ptr); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiGrid > const &","map<(int,CdiGrid)>", 1, argv[0] )); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::map< int,CdiGrid > const &","map<(int,CdiGrid)>", 1, argv[0])); + } + arg1 = ptr; + } + result = (std::map< int,CdiGrid > *)new std::map< int,CdiGrid >((std::map< int,CdiGrid > const &)*arg1); + DATA_PTR(self) = result; + if (SWIG_IsNewObj(res1)) delete arg1; + return self; +fail: + if (SWIG_IsNewObj(res1)) delete arg1; + return Qnil; +} + + +SWIGINTERN VALUE _wrap_new_GridsMap(int nargs, VALUE *args, VALUE self) { + int argc; + VALUE argv[1]; + int ii; + + argc = nargs; + if (argc > 1) SWIG_fail; + for (ii = 0; (ii < argc); ++ii) { + argv[ii] = args[ii]; + } + if (argc == 0) { + return _wrap_new_GridsMap__SWIG_1(nargs, args, self); + } + if (argc == 1) { + int _v; + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_std__lessT_int_t, SWIG_POINTER_NO_NULL); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_new_GridsMap__SWIG_0(nargs, args, self); + } + } + if (argc == 1) { + int _v; + int res = swig::asptr(argv[0], (std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_new_GridsMap__SWIG_2(nargs, args, self); + } + } + +fail: + Ruby_Format_OverloadedError( argc, 1, "GridsMap.new", + " GridsMap.new(std::less< int > const &other)\n" + " GridsMap.new()\n" + " GridsMap.new(std::map< int,CdiGrid > const &other)\n"); + + return Qnil; +} + + +/* + Document-method: Cdi::GridsMap.empty? + + call-seq: + empty? -> bool + +Check if the GridsMap is empty or not. +*/ +SWIGINTERN VALUE +_wrap_GridsMap_emptyq___(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + bool result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiGrid > const *","empty", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); + result = (bool)((std::map< int,CdiGrid > const *)arg1)->empty(); + vresult = SWIG_From_bool(static_cast< bool >(result)); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::GridsMap.size + + call-seq: + size -> std::map< int,CdiGrid >::size_type + +Size or Length of the GridsMap. +*/ +SWIGINTERN VALUE +_wrap_GridsMap_size(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiGrid >::size_type result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiGrid > const *","size", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); + result = ((std::map< int,CdiGrid > const *)arg1)->size(); + vresult = SWIG_From_size_t(static_cast< size_t >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_GridsMap_swap(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; + std::map< int,CdiGrid > *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiGrid > *","swap", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); + res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::map< int,CdiGrid > &","swap", 2, argv[0] )); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::map< int,CdiGrid > &","swap", 2, argv[0])); + } + arg2 = reinterpret_cast< std::map< int,CdiGrid > * >(argp2); + (arg1)->swap(*arg2); + return Qnil; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::GridsMap.begin + + call-seq: + begin -> std::map< int,CdiGrid >::iterator + +Return an iterator to the beginning of the GridsMap. +*/ +SWIGINTERN VALUE +_wrap_GridsMap_begin(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiGrid >::iterator result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiGrid > *","begin", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); + result = (arg1)->begin(); + vresult = SWIG_NewPointerObj((new std::map< int,CdiGrid >::iterator(static_cast< const std::map< int,CdiGrid >::iterator& >(result))), SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t__iterator, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::GridsMap.end + + call-seq: + end -> std::map< int,CdiGrid >::iterator + +Return an iterator to past the end of the GridsMap. +*/ +SWIGINTERN VALUE +_wrap_GridsMap_end(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiGrid >::iterator result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiGrid > *","end", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); + result = (arg1)->end(); + vresult = SWIG_NewPointerObj((new std::map< int,CdiGrid >::iterator(static_cast< const std::map< int,CdiGrid >::iterator& >(result))), SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t__iterator, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::GridsMap.rbegin + + call-seq: + rbegin -> std::map< int,CdiGrid >::reverse_iterator + +Return a reverse iterator to the beginning (the end) of the GridsMap. +*/ +SWIGINTERN VALUE +_wrap_GridsMap_rbegin(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiGrid >::reverse_iterator result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiGrid > *","rbegin", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); + result = (arg1)->rbegin(); + vresult = SWIG_NewPointerObj((new std::map< int,CdiGrid >::reverse_iterator(static_cast< const std::map< int,CdiGrid >::reverse_iterator& >(result))), SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t__reverse_iterator, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::GridsMap.rend + + call-seq: + rend -> std::map< int,CdiGrid >::reverse_iterator + +Return a reverse iterator to past the end (past the beginning) of the GridsMap. +*/ +SWIGINTERN VALUE +_wrap_GridsMap_rend(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiGrid >::reverse_iterator result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiGrid > *","rend", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); + result = (arg1)->rend(); + vresult = SWIG_NewPointerObj((new std::map< int,CdiGrid >::reverse_iterator(static_cast< const std::map< int,CdiGrid >::reverse_iterator& >(result))), SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t__reverse_iterator, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::GridsMap.clear + + call-seq: + clear + +Clear GridsMap contents. +*/ +SWIGINTERN VALUE +_wrap_GridsMap_clear(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiGrid > *","clear", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); + (arg1)->clear(); + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_GridsMap_get_allocator(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + SwigValueWrapper< std::allocator< std::pair< int const,CdiGrid > > > result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiGrid > const *","get_allocator", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); + result = ((std::map< int,CdiGrid > const *)arg1)->get_allocator(); + vresult = SWIG_NewPointerObj((new std::map< int,CdiGrid >::allocator_type(static_cast< const std::map< int,CdiGrid >::allocator_type& >(result))), SWIGTYPE_p_std__allocatorT_std__pairT_int_const_CdiGrid_t_t, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::GridsMap.erase + + call-seq: + erase(x) -> std::map< int,CdiGrid >::size_type + erase(position) + erase(first, last) + +Delete a portion of the GridsMap. +*/ +SWIGINTERN VALUE +_wrap_GridsMap_erase__SWIG_0(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; + std::map< int,CdiGrid >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiGrid >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + std::map< int,CdiGrid >::size_type result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiGrid > *","erase", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::map< int,CdiGrid >::key_type","erase", 2, argv[0] )); + } + temp2 = static_cast< std::map< int,CdiGrid >::key_type >(val2); + arg2 = &temp2; + result = (arg1)->erase((std::map< int,CdiGrid >::key_type const &)*arg2); + vresult = SWIG_From_size_t(static_cast< size_t >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_GridsMap_count(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; + std::map< int,CdiGrid >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiGrid >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + std::map< int,CdiGrid >::size_type result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiGrid > const *","count", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::map< int,CdiGrid >::key_type","count", 2, argv[0] )); + } + temp2 = static_cast< std::map< int,CdiGrid >::key_type >(val2); + arg2 = &temp2; + result = ((std::map< int,CdiGrid > const *)arg1)->count((std::map< int,CdiGrid >::key_type const &)*arg2); + vresult = SWIG_From_size_t(static_cast< size_t >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_GridsMap_erase__SWIG_1(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; + std::map< int,CdiGrid >::iterator arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 ; + int res2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiGrid > *","erase", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); + { + res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t__iterator, 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::map< int,CdiGrid >::iterator","erase", 2, argv[0] )); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::map< int,CdiGrid >::iterator","erase", 2, argv[0])); + } else { + arg2 = *(reinterpret_cast< std::map< int,CdiGrid >::iterator * >(argp2)); + } + } + std_map_Sl_int_Sc_CdiGrid_Sg__erase__SWIG_1(arg1,arg2); + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_GridsMap_erase__SWIG_2(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; + std::map< int,CdiGrid >::iterator arg2 ; + std::map< int,CdiGrid >::iterator arg3 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 ; + int res2 = 0 ; + void *argp3 ; + int res3 = 0 ; + + if ((argc < 2) || (argc > 2)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiGrid > *","erase", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); + { + res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t__iterator, 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::map< int,CdiGrid >::iterator","erase", 2, argv[0] )); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::map< int,CdiGrid >::iterator","erase", 2, argv[0])); + } else { + arg2 = *(reinterpret_cast< std::map< int,CdiGrid >::iterator * >(argp2)); + } + } + { + res3 = SWIG_ConvertPtr(argv[1], &argp3, SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t__iterator, 0 ); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "std::map< int,CdiGrid >::iterator","erase", 3, argv[1] )); + } + if (!argp3) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::map< int,CdiGrid >::iterator","erase", 3, argv[1])); + } else { + arg3 = *(reinterpret_cast< std::map< int,CdiGrid >::iterator * >(argp3)); + } + } + std_map_Sl_int_Sc_CdiGrid_Sg__erase__SWIG_2(arg1,arg2,arg3); + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE _wrap_GridsMap_erase(int nargs, VALUE *args, VALUE self) { + int argc; + VALUE argv[4]; + int ii; + + argc = nargs + 1; + argv[0] = self; + if (argc > 4) SWIG_fail; + for (ii = 1; (ii < argc); ++ii) { + argv[ii] = args[ii-1]; + } + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t__iterator, SWIG_POINTER_NO_NULL); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_GridsMap_erase__SWIG_1(nargs, args, self); + } + } + } + if (argc == 2) { + int _v; + int res = swig::asptr(argv[0], (std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_GridsMap_erase__SWIG_0(nargs, args, self); + } + } + } + if (argc == 3) { + int _v; + int res = swig::asptr(argv[0], (std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t__iterator, SWIG_POINTER_NO_NULL); + _v = SWIG_CheckState(res); + if (_v) { + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t__iterator, SWIG_POINTER_NO_NULL); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_GridsMap_erase__SWIG_2(nargs, args, self); + } + } + } + } + +fail: + Ruby_Format_OverloadedError( argc, 4, "GridsMap.erase", + " std::map< int,CdiGrid >::size_type GridsMap.erase(std::map< int,CdiGrid >::key_type const &x)\n" + " void GridsMap.erase(std::map< int,CdiGrid >::iterator position)\n" + " void GridsMap.erase(std::map< int,CdiGrid >::iterator first, std::map< int,CdiGrid >::iterator last)\n"); + + return Qnil; +} + + +/* + Document-method: Cdi::GridsMap.find + + call-seq: + find(x) -> std::map< int,CdiGrid >::iterator + +Find an element in the class. +*/ +SWIGINTERN VALUE +_wrap_GridsMap_find(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; + std::map< int,CdiGrid >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiGrid >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + std::map< int,CdiGrid >::iterator result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiGrid > *","find", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::map< int,CdiGrid >::key_type","find", 2, argv[0] )); + } + temp2 = static_cast< std::map< int,CdiGrid >::key_type >(val2); + arg2 = &temp2; + result = (arg1)->find((std::map< int,CdiGrid >::key_type const &)*arg2); + vresult = SWIG_NewPointerObj((new std::map< int,CdiGrid >::iterator(static_cast< const std::map< int,CdiGrid >::iterator& >(result))), SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t__iterator, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_GridsMap_lower_bound(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; + std::map< int,CdiGrid >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiGrid >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + std::map< int,CdiGrid >::iterator result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiGrid > *","lower_bound", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::map< int,CdiGrid >::key_type","lower_bound", 2, argv[0] )); + } + temp2 = static_cast< std::map< int,CdiGrid >::key_type >(val2); + arg2 = &temp2; + result = (arg1)->lower_bound((std::map< int,CdiGrid >::key_type const &)*arg2); + vresult = SWIG_NewPointerObj((new std::map< int,CdiGrid >::iterator(static_cast< const std::map< int,CdiGrid >::iterator& >(result))), SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t__iterator, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_GridsMap_upper_bound(int argc, VALUE *argv, VALUE self) { + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; + std::map< int,CdiGrid >::key_type *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiGrid >::key_type temp2 ; + int val2 ; + int ecode2 = 0 ; + std::map< int,CdiGrid >::iterator result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::map< int,CdiGrid > *","upper_bound", 1, self )); + } + arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::map< int,CdiGrid >::key_type","upper_bound", 2, argv[0] )); + } + temp2 = static_cast< std::map< int,CdiGrid >::key_type >(val2); + arg2 = &temp2; + result = (arg1)->upper_bound((std::map< int,CdiGrid >::key_type const &)*arg2); + vresult = SWIG_NewPointerObj((new std::map< int,CdiGrid >::iterator(static_cast< const std::map< int,CdiGrid >::iterator& >(result))), SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t__iterator, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN void +free_std_map_Sl_int_Sc_CdiGrid_Sg_(void *self) { + std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *)self; + delete arg1; +} + +static swig_class SwigClassCdiGrid; + +SWIGINTERN VALUE +_wrap_new_CdiGrid__SWIG_0(int argc, VALUE *argv, VALUE self) { + CdiGrid *result = 0 ; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + result = (CdiGrid *)new CdiGrid(); + DATA_PTR(self) = result; + return self; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +#ifdef HAVE_RB_DEFINE_ALLOC_FUNC +_wrap_CdiGrid_allocate(VALUE self) +#else +_wrap_CdiGrid_allocate(int argc, VALUE *argv, VALUE self) +#endif +{ + VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_CdiGrid); +#ifndef HAVE_RB_DEFINE_ALLOC_FUNC + rb_obj_call_init(vresult, argc, argv); +#endif + return vresult; +} + + +SWIGINTERN VALUE +_wrap_new_CdiGrid__SWIG_1(int argc, VALUE *argv, VALUE self) { + int arg1 ; + int val1 ; + int ecode1 = 0 ; + CdiGrid *result = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + ecode1 = SWIG_AsVal_int(argv[0], &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "int","CdiGrid", 1, argv[0] )); + } + arg1 = static_cast< int >(val1); + result = (CdiGrid *)new CdiGrid(arg1); + DATA_PTR(self) = result; + return self; +fail: + return Qnil; +} + + +SWIGINTERN VALUE _wrap_new_CdiGrid(int nargs, VALUE *args, VALUE self) { + int argc; + VALUE argv[1]; + int ii; + + argc = nargs; + if (argc > 1) SWIG_fail; + for (ii = 0; (ii < argc); ++ii) { + argv[ii] = args[ii]; + } + if (argc == 0) { + return _wrap_new_CdiGrid__SWIG_0(nargs, args, self); + } + if (argc == 1) { + int _v; + { + int res = SWIG_AsVal_int(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_new_CdiGrid__SWIG_1(nargs, args, self); + } + } + +fail: + Ruby_Format_OverloadedError( argc, 1, "CdiGrid.new", + " CdiGrid.new()\n" + " CdiGrid.new(int gridid)\n"); + + return Qnil; +} + + +SWIGINTERN void +free_CdiGrid(void *self) { + CdiGrid *arg1 = (CdiGrid *)self; + delete arg1; +} + +SWIGINTERN VALUE +_wrap_CdiGrid_gridID_set(int argc, VALUE *argv, VALUE self) { + CdiGrid *arg1 = (CdiGrid *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiGrid *","gridID", 1, self )); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","gridID", 2, argv[0] )); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->gridID = arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiGrid_gridID_get(int argc, VALUE *argv, VALUE self) { + CdiGrid *arg1 = (CdiGrid *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiGrid *","gridID", 1, self )); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + result = (int) ((arg1)->gridID); + vresult = SWIG_From_int(static_cast< int >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiGrid_type_set(int argc, VALUE *argv, VALUE self) { + CdiGrid *arg1 = (CdiGrid *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiGrid *","type", 1, self )); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","type", 2, argv[0] )); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->type = arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiGrid_type_get(int argc, VALUE *argv, VALUE self) { + CdiGrid *arg1 = (CdiGrid *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiGrid *","type", 1, self )); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + result = (int) ((arg1)->type); + vresult = SWIG_From_int(static_cast< int >(result)); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::CdiGrid.size + + call-seq: + size -> int + +Size or Length of the CdiGrid. +*/ +/* + Document-method: Cdi::CdiGrid.size= + + call-seq: + size=(x) -> int + +Size or Length of the CdiGrid. +*/ +SWIGINTERN VALUE +_wrap_CdiGrid_size_set(int argc, VALUE *argv, VALUE self) { + CdiGrid *arg1 = (CdiGrid *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiGrid *","size", 1, self )); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","size", 2, argv[0] )); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->size = arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiGrid_size_get(int argc, VALUE *argv, VALUE self) { + CdiGrid *arg1 = (CdiGrid *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiGrid *","size", 1, self )); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + result = (int) ((arg1)->size); + vresult = SWIG_From_int(static_cast< int >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiGrid_xsize_set(int argc, VALUE *argv, VALUE self) { + CdiGrid *arg1 = (CdiGrid *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiGrid *","xsize", 1, self )); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","xsize", 2, argv[0] )); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->xsize = arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiGrid_xsize_get(int argc, VALUE *argv, VALUE self) { + CdiGrid *arg1 = (CdiGrid *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiGrid *","xsize", 1, self )); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + result = (int) ((arg1)->xsize); + vresult = SWIG_From_int(static_cast< int >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiGrid_ysize_set(int argc, VALUE *argv, VALUE self) { + CdiGrid *arg1 = (CdiGrid *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiGrid *","ysize", 1, self )); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","ysize", 2, argv[0] )); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->ysize = arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiGrid_ysize_get(int argc, VALUE *argv, VALUE self) { + CdiGrid *arg1 = (CdiGrid *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiGrid *","ysize", 1, self )); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + result = (int) ((arg1)->ysize); + vresult = SWIG_From_int(static_cast< int >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiGrid_prec_set(int argc, VALUE *argv, VALUE self) { + CdiGrid *arg1 = (CdiGrid *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiGrid *","prec", 1, self )); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","prec", 2, argv[0] )); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->prec = arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiGrid_prec_get(int argc, VALUE *argv, VALUE self) { + CdiGrid *arg1 = (CdiGrid *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiGrid *","prec", 1, self )); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + result = (int) ((arg1)->prec); + vresult = SWIG_From_int(static_cast< int >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiGrid_ncorner_set(int argc, VALUE *argv, VALUE self) { + CdiGrid *arg1 = (CdiGrid *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiGrid *","ncorner", 1, self )); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","ncorner", 2, argv[0] )); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->ncorner = arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiGrid_ncorner_get(int argc, VALUE *argv, VALUE self) { + CdiGrid *arg1 = (CdiGrid *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiGrid *","ncorner", 1, self )); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + result = (int) ((arg1)->ncorner); + vresult = SWIG_From_int(static_cast< int >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiGrid_hasXValues_set(int argc, VALUE *argv, VALUE self) { + CdiGrid *arg1 = (CdiGrid *) 0 ; + bool arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + bool val2 ; + int ecode2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiGrid *","hasXValues", 1, self )); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + ecode2 = SWIG_AsVal_bool(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "bool","hasXValues", 2, argv[0] )); + } + arg2 = static_cast< bool >(val2); + if (arg1) (arg1)->hasXValues = arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiGrid_hasXValues_get(int argc, VALUE *argv, VALUE self) { + CdiGrid *arg1 = (CdiGrid *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + bool result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiGrid *","hasXValues", 1, self )); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + result = (bool) ((arg1)->hasXValues); + vresult = SWIG_From_bool(static_cast< bool >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiGrid_hasYValues_set(int argc, VALUE *argv, VALUE self) { + CdiGrid *arg1 = (CdiGrid *) 0 ; + bool arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + bool val2 ; + int ecode2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiGrid *","hasYValues", 1, self )); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + ecode2 = SWIG_AsVal_bool(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "bool","hasYValues", 2, argv[0] )); + } + arg2 = static_cast< bool >(val2); + if (arg1) (arg1)->hasYValues = arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiGrid_hasYValues_get(int argc, VALUE *argv, VALUE self) { + CdiGrid *arg1 = (CdiGrid *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + bool result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiGrid *","hasYValues", 1, self )); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + result = (bool) ((arg1)->hasYValues); + vresult = SWIG_From_bool(static_cast< bool >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiGrid_hasBounds_set(int argc, VALUE *argv, VALUE self) { + CdiGrid *arg1 = (CdiGrid *) 0 ; + bool arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + bool val2 ; + int ecode2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiGrid *","hasBounds", 1, self )); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + ecode2 = SWIG_AsVal_bool(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "bool","hasBounds", 2, argv[0] )); + } + arg2 = static_cast< bool >(val2); + if (arg1) (arg1)->hasBounds = arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiGrid_hasBounds_get(int argc, VALUE *argv, VALUE self) { + CdiGrid *arg1 = (CdiGrid *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + bool result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiGrid *","hasBounds", 1, self )); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + result = (bool) ((arg1)->hasBounds); + vresult = SWIG_From_bool(static_cast< bool >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiGrid_xvalues_set(int argc, VALUE *argv, VALUE self) { + CdiGrid *arg1 = (CdiGrid *) 0 ; + std::vector< double,std::allocator< double > > *arg2 = (std::vector< double,std::allocator< double > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiGrid *","xvalues", 1, self )); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::vector< double,std::allocator< double > > *","xvalues", 2, argv[0] )); + } + arg2 = reinterpret_cast< std::vector< double,std::allocator< double > > * >(argp2); + if (arg1) (arg1)->xvalues = *arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiGrid_xvalues_get(int argc, VALUE *argv, VALUE self) { + CdiGrid *arg1 = (CdiGrid *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< double,std::allocator< double > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiGrid *","xvalues", 1, self )); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + result = (std::vector< double,std::allocator< double > > *)& ((arg1)->xvalues); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiGrid_yvalues_set(int argc, VALUE *argv, VALUE self) { + CdiGrid *arg1 = (CdiGrid *) 0 ; + std::vector< double,std::allocator< double > > *arg2 = (std::vector< double,std::allocator< double > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiGrid *","yvalues", 1, self )); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::vector< double,std::allocator< double > > *","yvalues", 2, argv[0] )); + } + arg2 = reinterpret_cast< std::vector< double,std::allocator< double > > * >(argp2); + if (arg1) (arg1)->yvalues = *arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiGrid_yvalues_get(int argc, VALUE *argv, VALUE self) { + CdiGrid *arg1 = (CdiGrid *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< double,std::allocator< double > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiGrid *","yvalues", 1, self )); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + result = (std::vector< double,std::allocator< double > > *)& ((arg1)->yvalues); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiGrid_xbounds_set(int argc, VALUE *argv, VALUE self) { + CdiGrid *arg1 = (CdiGrid *) 0 ; + std::vector< double,std::allocator< double > > *arg2 = (std::vector< double,std::allocator< double > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiGrid *","xbounds", 1, self )); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::vector< double,std::allocator< double > > *","xbounds", 2, argv[0] )); + } + arg2 = reinterpret_cast< std::vector< double,std::allocator< double > > * >(argp2); + if (arg1) (arg1)->xbounds = *arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiGrid_xbounds_get(int argc, VALUE *argv, VALUE self) { + CdiGrid *arg1 = (CdiGrid *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< double,std::allocator< double > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiGrid *","xbounds", 1, self )); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + result = (std::vector< double,std::allocator< double > > *)& ((arg1)->xbounds); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiGrid_ybounds_set(int argc, VALUE *argv, VALUE self) { + CdiGrid *arg1 = (CdiGrid *) 0 ; + std::vector< double,std::allocator< double > > *arg2 = (std::vector< double,std::allocator< double > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiGrid *","ybounds", 1, self )); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::vector< double,std::allocator< double > > *","ybounds", 2, argv[0] )); + } + arg2 = reinterpret_cast< std::vector< double,std::allocator< double > > * >(argp2); + if (arg1) (arg1)->ybounds = *arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiGrid_ybounds_get(int argc, VALUE *argv, VALUE self) { + CdiGrid *arg1 = (CdiGrid *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< double,std::allocator< double > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiGrid *","ybounds", 1, self )); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + result = (std::vector< double,std::allocator< double > > *)& ((arg1)->ybounds); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiGrid_xname_set(int argc, VALUE *argv, VALUE self) { + CdiGrid *arg1 = (CdiGrid *) 0 ; + std::string *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 = SWIG_OLDOBJ ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiGrid *","xname", 1, self )); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + { + std::string *ptr = (std::string *)0; + res2 = SWIG_AsPtr_std_string(argv[0], &ptr); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","xname", 2, argv[0] )); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","xname", 2, argv[0])); + } + arg2 = ptr; + } + if (arg1) (arg1)->xname = *arg2; + if (SWIG_IsNewObj(res2)) delete arg2; + return Qnil; +fail: + if (SWIG_IsNewObj(res2)) delete arg2; + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiGrid_xname_get(int argc, VALUE *argv, VALUE self) { + CdiGrid *arg1 = (CdiGrid *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::string *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiGrid *","xname", 1, self )); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + result = (std::string *) & ((arg1)->xname); + vresult = SWIG_From_std_string(static_cast< std::string >(*result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiGrid_xlongname_set(int argc, VALUE *argv, VALUE self) { + CdiGrid *arg1 = (CdiGrid *) 0 ; + std::string *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 = SWIG_OLDOBJ ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiGrid *","xlongname", 1, self )); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + { + std::string *ptr = (std::string *)0; + res2 = SWIG_AsPtr_std_string(argv[0], &ptr); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","xlongname", 2, argv[0] )); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","xlongname", 2, argv[0])); + } + arg2 = ptr; + } + if (arg1) (arg1)->xlongname = *arg2; + if (SWIG_IsNewObj(res2)) delete arg2; + return Qnil; +fail: + if (SWIG_IsNewObj(res2)) delete arg2; + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiGrid_xlongname_get(int argc, VALUE *argv, VALUE self) { + CdiGrid *arg1 = (CdiGrid *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::string *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiGrid *","xlongname", 1, self )); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + result = (std::string *) & ((arg1)->xlongname); + vresult = SWIG_From_std_string(static_cast< std::string >(*result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiGrid_xstdname_set(int argc, VALUE *argv, VALUE self) { + CdiGrid *arg1 = (CdiGrid *) 0 ; + std::string *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 = SWIG_OLDOBJ ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiGrid *","xstdname", 1, self )); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + { + std::string *ptr = (std::string *)0; + res2 = SWIG_AsPtr_std_string(argv[0], &ptr); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","xstdname", 2, argv[0] )); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","xstdname", 2, argv[0])); + } + arg2 = ptr; + } + if (arg1) (arg1)->xstdname = *arg2; + if (SWIG_IsNewObj(res2)) delete arg2; + return Qnil; +fail: + if (SWIG_IsNewObj(res2)) delete arg2; + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiGrid_xstdname_get(int argc, VALUE *argv, VALUE self) { + CdiGrid *arg1 = (CdiGrid *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::string *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiGrid *","xstdname", 1, self )); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + result = (std::string *) & ((arg1)->xstdname); + vresult = SWIG_From_std_string(static_cast< std::string >(*result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiGrid_xunits_set(int argc, VALUE *argv, VALUE self) { + CdiGrid *arg1 = (CdiGrid *) 0 ; + std::string *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 = SWIG_OLDOBJ ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiGrid *","xunits", 1, self )); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + { + std::string *ptr = (std::string *)0; + res2 = SWIG_AsPtr_std_string(argv[0], &ptr); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","xunits", 2, argv[0] )); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","xunits", 2, argv[0])); + } + arg2 = ptr; + } + if (arg1) (arg1)->xunits = *arg2; + if (SWIG_IsNewObj(res2)) delete arg2; + return Qnil; +fail: + if (SWIG_IsNewObj(res2)) delete arg2; + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiGrid_xunits_get(int argc, VALUE *argv, VALUE self) { + CdiGrid *arg1 = (CdiGrid *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::string *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiGrid *","xunits", 1, self )); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + result = (std::string *) & ((arg1)->xunits); + vresult = SWIG_From_std_string(static_cast< std::string >(*result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiGrid_yname_set(int argc, VALUE *argv, VALUE self) { + CdiGrid *arg1 = (CdiGrid *) 0 ; + std::string *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 = SWIG_OLDOBJ ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiGrid *","yname", 1, self )); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + { + std::string *ptr = (std::string *)0; + res2 = SWIG_AsPtr_std_string(argv[0], &ptr); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","yname", 2, argv[0] )); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","yname", 2, argv[0])); + } + arg2 = ptr; + } + if (arg1) (arg1)->yname = *arg2; + if (SWIG_IsNewObj(res2)) delete arg2; + return Qnil; +fail: + if (SWIG_IsNewObj(res2)) delete arg2; + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiGrid_yname_get(int argc, VALUE *argv, VALUE self) { + CdiGrid *arg1 = (CdiGrid *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::string *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiGrid *","yname", 1, self )); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + result = (std::string *) & ((arg1)->yname); + vresult = SWIG_From_std_string(static_cast< std::string >(*result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiGrid_ylongname_set(int argc, VALUE *argv, VALUE self) { + CdiGrid *arg1 = (CdiGrid *) 0 ; + std::string *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 = SWIG_OLDOBJ ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiGrid *","ylongname", 1, self )); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + { + std::string *ptr = (std::string *)0; + res2 = SWIG_AsPtr_std_string(argv[0], &ptr); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","ylongname", 2, argv[0] )); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","ylongname", 2, argv[0])); + } + arg2 = ptr; + } + if (arg1) (arg1)->ylongname = *arg2; + if (SWIG_IsNewObj(res2)) delete arg2; + return Qnil; +fail: + if (SWIG_IsNewObj(res2)) delete arg2; + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiGrid_ylongname_get(int argc, VALUE *argv, VALUE self) { + CdiGrid *arg1 = (CdiGrid *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::string *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiGrid *","ylongname", 1, self )); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + result = (std::string *) & ((arg1)->ylongname); + vresult = SWIG_From_std_string(static_cast< std::string >(*result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiGrid_ystdname_set(int argc, VALUE *argv, VALUE self) { + CdiGrid *arg1 = (CdiGrid *) 0 ; + std::string *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 = SWIG_OLDOBJ ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiGrid *","ystdname", 1, self )); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + { + std::string *ptr = (std::string *)0; + res2 = SWIG_AsPtr_std_string(argv[0], &ptr); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","ystdname", 2, argv[0] )); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","ystdname", 2, argv[0])); + } + arg2 = ptr; + } + if (arg1) (arg1)->ystdname = *arg2; + if (SWIG_IsNewObj(res2)) delete arg2; + return Qnil; +fail: + if (SWIG_IsNewObj(res2)) delete arg2; + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiGrid_ystdname_get(int argc, VALUE *argv, VALUE self) { + CdiGrid *arg1 = (CdiGrid *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::string *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiGrid *","ystdname", 1, self )); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + result = (std::string *) & ((arg1)->ystdname); + vresult = SWIG_From_std_string(static_cast< std::string >(*result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiGrid_yunits_set(int argc, VALUE *argv, VALUE self) { + CdiGrid *arg1 = (CdiGrid *) 0 ; + std::string *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 = SWIG_OLDOBJ ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiGrid *","yunits", 1, self )); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + { + std::string *ptr = (std::string *)0; + res2 = SWIG_AsPtr_std_string(argv[0], &ptr); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","yunits", 2, argv[0] )); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","yunits", 2, argv[0])); + } + arg2 = ptr; + } + if (arg1) (arg1)->yunits = *arg2; + if (SWIG_IsNewObj(res2)) delete arg2; + return Qnil; +fail: + if (SWIG_IsNewObj(res2)) delete arg2; + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiGrid_yunits_get(int argc, VALUE *argv, VALUE self) { + CdiGrid *arg1 = (CdiGrid *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::string *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiGrid *","yunits", 1, self )); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + result = (std::string *) & ((arg1)->yunits); + vresult = SWIG_From_std_string(static_cast< std::string >(*result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiGrid_name_set(int argc, VALUE *argv, VALUE self) { + CdiGrid *arg1 = (CdiGrid *) 0 ; + std::string *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 = SWIG_OLDOBJ ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiGrid *","name", 1, self )); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + { + std::string *ptr = (std::string *)0; + res2 = SWIG_AsPtr_std_string(argv[0], &ptr); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","name", 2, argv[0] )); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","name", 2, argv[0])); + } + arg2 = ptr; + } + if (arg1) (arg1)->name = *arg2; + if (SWIG_IsNewObj(res2)) delete arg2; + return Qnil; +fail: + if (SWIG_IsNewObj(res2)) delete arg2; + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiGrid_name_get(int argc, VALUE *argv, VALUE self) { + CdiGrid *arg1 = (CdiGrid *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::string *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiGrid *","name", 1, self )); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + result = (std::string *) & ((arg1)->name); + vresult = SWIG_From_std_string(static_cast< std::string >(*result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiGrid_getValues(int argc, VALUE *argv, VALUE self) { + CdiGrid *arg1 = (CdiGrid *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiGrid *","getValues", 1, self )); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + (arg1)->getValues(); + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiGrid_getBounds(int argc, VALUE *argv, VALUE self) { + CdiGrid *arg1 = (CdiGrid *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiGrid *","getBounds", 1, self )); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + (arg1)->getBounds(); + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiGrid_getValuesAsPointer(int argc, VALUE *argv, VALUE self) { + CdiGrid *arg1 = (CdiGrid *) 0 ; + double *arg2 = (double *) 0 ; + double *arg3 = (double *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + void *argp3 = 0 ; + int res3 = 0 ; + + if ((argc < 2) || (argc > 2)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiGrid *","getValuesAsPointer", 1, self )); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_double, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "double *","getValuesAsPointer", 2, argv[0] )); + } + arg2 = reinterpret_cast< double * >(argp2); + res3 = SWIG_ConvertPtr(argv[1], &argp3,SWIGTYPE_p_double, 0 | 0 ); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "double *","getValuesAsPointer", 3, argv[1] )); + } + arg3 = reinterpret_cast< double * >(argp3); + (arg1)->getValuesAsPointer(arg2,arg3); + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiGrid_getBoundsAsPointer(int argc, VALUE *argv, VALUE self) { + CdiGrid *arg1 = (CdiGrid *) 0 ; + double *arg2 = (double *) 0 ; + double *arg3 = (double *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + void *argp3 = 0 ; + int res3 = 0 ; + + if ((argc < 2) || (argc > 2)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiGrid *","getBoundsAsPointer", 1, self )); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_double, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "double *","getBoundsAsPointer", 2, argv[0] )); + } + arg2 = reinterpret_cast< double * >(argp2); + res3 = SWIG_ConvertPtr(argv[1], &argp3,SWIGTYPE_p_double, 0 | 0 ); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "double *","getBoundsAsPointer", 3, argv[1] )); + } + arg3 = reinterpret_cast< double * >(argp3); + (arg1)->getBoundsAsPointer(arg2,arg3); + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiGrid_getFloatVals(int argc, VALUE *argv, VALUE self) { + CdiGrid *arg1 = (CdiGrid *) 0 ; + float *arg2 = (float *) 0 ; + float *arg3 = (float *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + void *argp3 = 0 ; + int res3 = 0 ; + + if ((argc < 2) || (argc > 2)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiGrid *","getFloatVals", 1, self )); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_float, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "float *","getFloatVals", 2, argv[0] )); + } + arg2 = reinterpret_cast< float * >(argp2); + res3 = SWIG_ConvertPtr(argv[1], &argp3,SWIGTYPE_p_float, 0 | 0 ); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "float *","getFloatVals", 3, argv[1] )); + } + arg3 = reinterpret_cast< float * >(argp3); + (arg1)->getFloatVals(arg2,arg3); + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiGrid_getFloatBounds(int argc, VALUE *argv, VALUE self) { + CdiGrid *arg1 = (CdiGrid *) 0 ; + float *arg2 = (float *) 0 ; + float *arg3 = (float *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + void *argp3 = 0 ; + int res3 = 0 ; + + if ((argc < 2) || (argc > 2)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiGrid *","getFloatBounds", 1, self )); + } + arg1 = reinterpret_cast< CdiGrid * >(argp1); + res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_float, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "float *","getFloatBounds", 2, argv[0] )); + } + arg2 = reinterpret_cast< float * >(argp2); + res3 = SWIG_ConvertPtr(argv[1], &argp3,SWIGTYPE_p_float, 0 | 0 ); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "float *","getFloatBounds", 3, argv[1] )); + } + arg3 = reinterpret_cast< float * >(argp3); + (arg1)->getFloatBounds(arg2,arg3); + return Qnil; +fail: + return Qnil; +} + + +static swig_class SwigClassCdiTaxis; + +SWIGINTERN VALUE +_wrap_new_CdiTaxis__SWIG_0(int argc, VALUE *argv, VALUE self) { + CdiTaxis *result = 0 ; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + result = (CdiTaxis *)new CdiTaxis(); + DATA_PTR(self) = result; + return self; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +#ifdef HAVE_RB_DEFINE_ALLOC_FUNC +_wrap_CdiTaxis_allocate(VALUE self) +#else +_wrap_CdiTaxis_allocate(int argc, VALUE *argv, VALUE self) +#endif +{ + VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_CdiTaxis); +#ifndef HAVE_RB_DEFINE_ALLOC_FUNC + rb_obj_call_init(vresult, argc, argv); +#endif + return vresult; +} + + +SWIGINTERN VALUE +_wrap_new_CdiTaxis__SWIG_1(int argc, VALUE *argv, VALUE self) { + int arg1 ; + int val1 ; + int ecode1 = 0 ; + CdiTaxis *result = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + ecode1 = SWIG_AsVal_int(argv[0], &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "int","CdiTaxis", 1, argv[0] )); + } + arg1 = static_cast< int >(val1); + result = (CdiTaxis *)new CdiTaxis(arg1); + DATA_PTR(self) = result; + return self; +fail: + return Qnil; +} + + +SWIGINTERN VALUE _wrap_new_CdiTaxis(int nargs, VALUE *args, VALUE self) { + int argc; + VALUE argv[1]; + int ii; + + argc = nargs; + if (argc > 1) SWIG_fail; + for (ii = 0; (ii < argc); ++ii) { + argv[ii] = args[ii]; + } + if (argc == 0) { + return _wrap_new_CdiTaxis__SWIG_0(nargs, args, self); + } + if (argc == 1) { + int _v; + { + int res = SWIG_AsVal_int(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_new_CdiTaxis__SWIG_1(nargs, args, self); + } + } + +fail: + Ruby_Format_OverloadedError( argc, 1, "CdiTaxis.new", + " CdiTaxis.new()\n" + " CdiTaxis.new(int vlistID)\n"); + + return Qnil; +} + + +SWIGINTERN void +free_CdiTaxis(void *self) { + CdiTaxis *arg1 = (CdiTaxis *)self; + delete arg1; +} + +SWIGINTERN VALUE +_wrap_CdiTaxis_taxisID_set(int argc, VALUE *argv, VALUE self) { + CdiTaxis *arg1 = (CdiTaxis *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiTaxis *","taxisID", 1, self )); + } + arg1 = reinterpret_cast< CdiTaxis * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","taxisID", 2, argv[0] )); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->taxisID = arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiTaxis_taxisID_get(int argc, VALUE *argv, VALUE self) { + CdiTaxis *arg1 = (CdiTaxis *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiTaxis *","taxisID", 1, self )); + } + arg1 = reinterpret_cast< CdiTaxis * >(argp1); + result = (int) ((arg1)->taxisID); + vresult = SWIG_From_int(static_cast< int >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiTaxis_ntsteps_set(int argc, VALUE *argv, VALUE self) { + CdiTaxis *arg1 = (CdiTaxis *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiTaxis *","ntsteps", 1, self )); + } + arg1 = reinterpret_cast< CdiTaxis * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","ntsteps", 2, argv[0] )); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->ntsteps = arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiTaxis_ntsteps_get(int argc, VALUE *argv, VALUE self) { + CdiTaxis *arg1 = (CdiTaxis *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiTaxis *","ntsteps", 1, self )); + } + arg1 = reinterpret_cast< CdiTaxis * >(argp1); + result = (int) ((arg1)->ntsteps); + vresult = SWIG_From_int(static_cast< int >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiTaxis_unit_set(int argc, VALUE *argv, VALUE self) { + CdiTaxis *arg1 = (CdiTaxis *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiTaxis *","unit", 1, self )); + } + arg1 = reinterpret_cast< CdiTaxis * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","unit", 2, argv[0] )); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->unit = arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiTaxis_unit_get(int argc, VALUE *argv, VALUE self) { + CdiTaxis *arg1 = (CdiTaxis *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiTaxis *","unit", 1, self )); + } + arg1 = reinterpret_cast< CdiTaxis * >(argp1); + result = (int) ((arg1)->unit); + vresult = SWIG_From_int(static_cast< int >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiTaxis_rdate_set(int argc, VALUE *argv, VALUE self) { + CdiTaxis *arg1 = (CdiTaxis *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiTaxis *","rdate", 1, self )); + } + arg1 = reinterpret_cast< CdiTaxis * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","rdate", 2, argv[0] )); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->rdate = arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiTaxis_rdate_get(int argc, VALUE *argv, VALUE self) { + CdiTaxis *arg1 = (CdiTaxis *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiTaxis *","rdate", 1, self )); + } + arg1 = reinterpret_cast< CdiTaxis * >(argp1); + result = (int) ((arg1)->rdate); + vresult = SWIG_From_int(static_cast< int >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiTaxis_rtime_set(int argc, VALUE *argv, VALUE self) { + CdiTaxis *arg1 = (CdiTaxis *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiTaxis *","rtime", 1, self )); + } + arg1 = reinterpret_cast< CdiTaxis * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","rtime", 2, argv[0] )); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->rtime = arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiTaxis_rtime_get(int argc, VALUE *argv, VALUE self) { + CdiTaxis *arg1 = (CdiTaxis *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiTaxis *","rtime", 1, self )); + } + arg1 = reinterpret_cast< CdiTaxis * >(argp1); + result = (int) ((arg1)->rtime); + vresult = SWIG_From_int(static_cast< int >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiTaxis_vdate_set(int argc, VALUE *argv, VALUE self) { + CdiTaxis *arg1 = (CdiTaxis *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiTaxis *","vdate", 1, self )); + } + arg1 = reinterpret_cast< CdiTaxis * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","vdate", 2, argv[0] )); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->vdate = arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiTaxis_vdate_get(int argc, VALUE *argv, VALUE self) { + CdiTaxis *arg1 = (CdiTaxis *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiTaxis *","vdate", 1, self )); + } + arg1 = reinterpret_cast< CdiTaxis * >(argp1); + result = (int) ((arg1)->vdate); + vresult = SWIG_From_int(static_cast< int >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiTaxis_vtime_set(int argc, VALUE *argv, VALUE self) { + CdiTaxis *arg1 = (CdiTaxis *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiTaxis *","vtime", 1, self )); + } + arg1 = reinterpret_cast< CdiTaxis * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","vtime", 2, argv[0] )); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->vtime = arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiTaxis_vtime_get(int argc, VALUE *argv, VALUE self) { + CdiTaxis *arg1 = (CdiTaxis *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiTaxis *","vtime", 1, self )); + } + arg1 = reinterpret_cast< CdiTaxis * >(argp1); + result = (int) ((arg1)->vtime); + vresult = SWIG_From_int(static_cast< int >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiTaxis_type_set(int argc, VALUE *argv, VALUE self) { + CdiTaxis *arg1 = (CdiTaxis *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiTaxis *","type", 1, self )); + } + arg1 = reinterpret_cast< CdiTaxis * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","type", 2, argv[0] )); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->type = arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiTaxis_type_get(int argc, VALUE *argv, VALUE self) { + CdiTaxis *arg1 = (CdiTaxis *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiTaxis *","type", 1, self )); + } + arg1 = reinterpret_cast< CdiTaxis * >(argp1); + result = (int) ((arg1)->type); + vresult = SWIG_From_int(static_cast< int >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiTaxis_calendar_set(int argc, VALUE *argv, VALUE self) { + CdiTaxis *arg1 = (CdiTaxis *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiTaxis *","calendar", 1, self )); + } + arg1 = reinterpret_cast< CdiTaxis * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","calendar", 2, argv[0] )); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->calendar = arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiTaxis_calendar_get(int argc, VALUE *argv, VALUE self) { + CdiTaxis *arg1 = (CdiTaxis *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiTaxis *","calendar", 1, self )); + } + arg1 = reinterpret_cast< CdiTaxis * >(argp1); + result = (int) ((arg1)->calendar); + vresult = SWIG_From_int(static_cast< int >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiTaxis_hasBounds_set(int argc, VALUE *argv, VALUE self) { + CdiTaxis *arg1 = (CdiTaxis *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiTaxis *","hasBounds", 1, self )); + } + arg1 = reinterpret_cast< CdiTaxis * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","hasBounds", 2, argv[0] )); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->hasBounds = arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiTaxis_hasBounds_get(int argc, VALUE *argv, VALUE self) { + CdiTaxis *arg1 = (CdiTaxis *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiTaxis *","hasBounds", 1, self )); + } + arg1 = reinterpret_cast< CdiTaxis * >(argp1); + result = (int) ((arg1)->hasBounds); + vresult = SWIG_From_int(static_cast< int >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiTaxis_name_set(int argc, VALUE *argv, VALUE self) { + CdiTaxis *arg1 = (CdiTaxis *) 0 ; + char *arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + char temp2[CDI_MAX_NAME] ; + int res2 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiTaxis *","name", 1, self )); + } + arg1 = reinterpret_cast< CdiTaxis * >(argp1); + res2 = SWIG_AsCharArray(argv[0], temp2, CDI_MAX_NAME); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char [CDI_MAX_NAME]","name", 2, argv[0] )); + } + arg2 = reinterpret_cast< char * >(temp2); + if (arg2) memcpy(arg1->name,arg2,CDI_MAX_NAME*sizeof(char)); + else memset(arg1->name,0,CDI_MAX_NAME*sizeof(char)); + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiTaxis_name_get(int argc, VALUE *argv, VALUE self) { + CdiTaxis *arg1 = (CdiTaxis *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + char *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiTaxis *","name", 1, self )); + } + arg1 = reinterpret_cast< CdiTaxis * >(argp1); + result = (char *)(char *) ((arg1)->name); + { + size_t size = SWIG_strnlen(result, CDI_MAX_NAME); + + + + vresult = SWIG_FromCharPtrAndSize(result, size); + } + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiTaxis_unitname_set(int argc, VALUE *argv, VALUE self) { + CdiTaxis *arg1 = (CdiTaxis *) 0 ; + char *arg2 = (char *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiTaxis *","unitname", 1, self )); + } + arg1 = reinterpret_cast< CdiTaxis * >(argp1); + res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","unitname", 2, argv[0] )); + } + arg2 = reinterpret_cast< char * >(buf2); + if (arg2) { + size_t size = strlen(reinterpret_cast< const char * >(reinterpret_cast< const char * >(arg2))) + 1; + arg1->unitname = (char const *)reinterpret_cast< char* >(memcpy(new char[size], arg2, sizeof(char)*(size))); + } else { + arg1->unitname = 0; + } + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return Qnil; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiTaxis_unitname_get(int argc, VALUE *argv, VALUE self) { + CdiTaxis *arg1 = (CdiTaxis *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + char *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiTaxis *","unitname", 1, self )); + } + arg1 = reinterpret_cast< CdiTaxis * >(argp1); + result = (char *) ((arg1)->unitname); + vresult = SWIG_FromCharPtr((const char *)result); + return vresult; +fail: + return Qnil; +} + + +static swig_class SwigClassCdiZaxis; + +SWIGINTERN VALUE +_wrap_new_CdiZaxis__SWIG_0(int argc, VALUE *argv, VALUE self) { + CdiZaxis *result = 0 ; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + result = (CdiZaxis *)new CdiZaxis(); + DATA_PTR(self) = result; + return self; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +#ifdef HAVE_RB_DEFINE_ALLOC_FUNC +_wrap_CdiZaxis_allocate(VALUE self) +#else +_wrap_CdiZaxis_allocate(int argc, VALUE *argv, VALUE self) +#endif +{ + VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_CdiZaxis); +#ifndef HAVE_RB_DEFINE_ALLOC_FUNC + rb_obj_call_init(vresult, argc, argv); +#endif + return vresult; +} + + +SWIGINTERN VALUE +_wrap_new_CdiZaxis__SWIG_1(int argc, VALUE *argv, VALUE self) { + int arg1 ; + int val1 ; + int ecode1 = 0 ; + CdiZaxis *result = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + ecode1 = SWIG_AsVal_int(argv[0], &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "int","CdiZaxis", 1, argv[0] )); + } + arg1 = static_cast< int >(val1); + result = (CdiZaxis *)new CdiZaxis(arg1); + DATA_PTR(self) = result; + return self; +fail: + return Qnil; +} + + +SWIGINTERN VALUE _wrap_new_CdiZaxis(int nargs, VALUE *args, VALUE self) { + int argc; + VALUE argv[1]; + int ii; + + argc = nargs; + if (argc > 1) SWIG_fail; + for (ii = 0; (ii < argc); ++ii) { + argv[ii] = args[ii]; + } + if (argc == 0) { + return _wrap_new_CdiZaxis__SWIG_0(nargs, args, self); + } + if (argc == 1) { + int _v; + { + int res = SWIG_AsVal_int(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_new_CdiZaxis__SWIG_1(nargs, args, self); + } + } + +fail: + Ruby_Format_OverloadedError( argc, 1, "CdiZaxis.new", + " CdiZaxis.new()\n" + " CdiZaxis.new(int zaxisid)\n"); + + return Qnil; +} + + +SWIGINTERN void +free_CdiZaxis(void *self) { + CdiZaxis *arg1 = (CdiZaxis *)self; + delete arg1; +} + +SWIGINTERN VALUE +_wrap_CdiZaxis_zaxisID_set(int argc, VALUE *argv, VALUE self) { + CdiZaxis *arg1 = (CdiZaxis *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiZaxis *","zaxisID", 1, self )); + } + arg1 = reinterpret_cast< CdiZaxis * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","zaxisID", 2, argv[0] )); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->zaxisID = arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiZaxis_zaxisID_get(int argc, VALUE *argv, VALUE self) { + CdiZaxis *arg1 = (CdiZaxis *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiZaxis *","zaxisID", 1, self )); + } + arg1 = reinterpret_cast< CdiZaxis * >(argp1); + result = (int) ((arg1)->zaxisID); + vresult = SWIG_From_int(static_cast< int >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiZaxis_type_set(int argc, VALUE *argv, VALUE self) { + CdiZaxis *arg1 = (CdiZaxis *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiZaxis *","type", 1, self )); + } + arg1 = reinterpret_cast< CdiZaxis * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","type", 2, argv[0] )); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->type = arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiZaxis_type_get(int argc, VALUE *argv, VALUE self) { + CdiZaxis *arg1 = (CdiZaxis *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiZaxis *","type", 1, self )); + } + arg1 = reinterpret_cast< CdiZaxis * >(argp1); + result = (int) ((arg1)->type); + vresult = SWIG_From_int(static_cast< int >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiZaxis_ltype_set(int argc, VALUE *argv, VALUE self) { + CdiZaxis *arg1 = (CdiZaxis *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiZaxis *","ltype", 1, self )); + } + arg1 = reinterpret_cast< CdiZaxis * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","ltype", 2, argv[0] )); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->ltype = arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiZaxis_ltype_get(int argc, VALUE *argv, VALUE self) { + CdiZaxis *arg1 = (CdiZaxis *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiZaxis *","ltype", 1, self )); + } + arg1 = reinterpret_cast< CdiZaxis * >(argp1); + result = (int) ((arg1)->ltype); + vresult = SWIG_From_int(static_cast< int >(result)); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::CdiZaxis.size + + call-seq: + size -> int + +Size or Length of the CdiZaxis. +*/ +/* + Document-method: Cdi::CdiZaxis.size= + + call-seq: + size=(x) -> int + +Size or Length of the CdiZaxis. +*/ +SWIGINTERN VALUE +_wrap_CdiZaxis_size_set(int argc, VALUE *argv, VALUE self) { + CdiZaxis *arg1 = (CdiZaxis *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiZaxis *","size", 1, self )); + } + arg1 = reinterpret_cast< CdiZaxis * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","size", 2, argv[0] )); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->size = arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiZaxis_size_get(int argc, VALUE *argv, VALUE self) { + CdiZaxis *arg1 = (CdiZaxis *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiZaxis *","size", 1, self )); + } + arg1 = reinterpret_cast< CdiZaxis * >(argp1); + result = (int) ((arg1)->size); + vresult = SWIG_From_int(static_cast< int >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiZaxis_prec_set(int argc, VALUE *argv, VALUE self) { + CdiZaxis *arg1 = (CdiZaxis *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiZaxis *","prec", 1, self )); + } + arg1 = reinterpret_cast< CdiZaxis * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","prec", 2, argv[0] )); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->prec = arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiZaxis_prec_get(int argc, VALUE *argv, VALUE self) { + CdiZaxis *arg1 = (CdiZaxis *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiZaxis *","prec", 1, self )); + } + arg1 = reinterpret_cast< CdiZaxis * >(argp1); + result = (int) ((arg1)->prec); + vresult = SWIG_From_int(static_cast< int >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiZaxis_plevels_set(int argc, VALUE *argv, VALUE self) { + CdiZaxis *arg1 = (CdiZaxis *) 0 ; + double *arg2 = (double *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiZaxis *","plevels", 1, self )); + } + arg1 = reinterpret_cast< CdiZaxis * >(argp1); + res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_double, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "double *","plevels", 2, argv[0] )); + } + arg2 = reinterpret_cast< double * >(argp2); + if (arg1) (arg1)->plevels = arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiZaxis_plevels_get(int argc, VALUE *argv, VALUE self) { + CdiZaxis *arg1 = (CdiZaxis *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + double *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiZaxis *","plevels", 1, self )); + } + arg1 = reinterpret_cast< CdiZaxis * >(argp1); + result = (double *) ((arg1)->plevels); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_double, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiZaxis_plbounds_set(int argc, VALUE *argv, VALUE self) { + CdiZaxis *arg1 = (CdiZaxis *) 0 ; + double *arg2 = (double *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiZaxis *","plbounds", 1, self )); + } + arg1 = reinterpret_cast< CdiZaxis * >(argp1); + res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_double, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "double *","plbounds", 2, argv[0] )); + } + arg2 = reinterpret_cast< double * >(argp2); + if (arg1) (arg1)->plbounds = arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiZaxis_plbounds_get(int argc, VALUE *argv, VALUE self) { + CdiZaxis *arg1 = (CdiZaxis *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + double *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiZaxis *","plbounds", 1, self )); + } + arg1 = reinterpret_cast< CdiZaxis * >(argp1); + result = (double *) ((arg1)->plbounds); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_double, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiZaxis_pubounds_set(int argc, VALUE *argv, VALUE self) { + CdiZaxis *arg1 = (CdiZaxis *) 0 ; + double *arg2 = (double *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiZaxis *","pubounds", 1, self )); + } + arg1 = reinterpret_cast< CdiZaxis * >(argp1); + res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_double, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "double *","pubounds", 2, argv[0] )); + } + arg2 = reinterpret_cast< double * >(argp2); + if (arg1) (arg1)->pubounds = arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiZaxis_pubounds_get(int argc, VALUE *argv, VALUE self) { + CdiZaxis *arg1 = (CdiZaxis *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + double *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiZaxis *","pubounds", 1, self )); + } + arg1 = reinterpret_cast< CdiZaxis * >(argp1); + result = (double *) ((arg1)->pubounds); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_double, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiZaxis_pweights_set(int argc, VALUE *argv, VALUE self) { + CdiZaxis *arg1 = (CdiZaxis *) 0 ; + double *arg2 = (double *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiZaxis *","pweights", 1, self )); + } + arg1 = reinterpret_cast< CdiZaxis * >(argp1); + res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_double, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "double *","pweights", 2, argv[0] )); + } + arg2 = reinterpret_cast< double * >(argp2); + if (arg1) (arg1)->pweights = arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiZaxis_pweights_get(int argc, VALUE *argv, VALUE self) { + CdiZaxis *arg1 = (CdiZaxis *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + double *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiZaxis *","pweights", 1, self )); + } + arg1 = reinterpret_cast< CdiZaxis * >(argp1); + result = (double *) ((arg1)->pweights); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_double, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiZaxis_levels_set(int argc, VALUE *argv, VALUE self) { + CdiZaxis *arg1 = (CdiZaxis *) 0 ; + std::vector< double,std::allocator< double > > *arg2 = (std::vector< double,std::allocator< double > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiZaxis *","levels", 1, self )); + } + arg1 = reinterpret_cast< CdiZaxis * >(argp1); + res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::vector< double,std::allocator< double > > *","levels", 2, argv[0] )); + } + arg2 = reinterpret_cast< std::vector< double,std::allocator< double > > * >(argp2); + if (arg1) (arg1)->levels = *arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiZaxis_levels_get(int argc, VALUE *argv, VALUE self) { + CdiZaxis *arg1 = (CdiZaxis *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< double,std::allocator< double > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiZaxis *","levels", 1, self )); + } + arg1 = reinterpret_cast< CdiZaxis * >(argp1); + result = (std::vector< double,std::allocator< double > > *)& ((arg1)->levels); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiZaxis_lbounds_set(int argc, VALUE *argv, VALUE self) { + CdiZaxis *arg1 = (CdiZaxis *) 0 ; + std::vector< double,std::allocator< double > > *arg2 = (std::vector< double,std::allocator< double > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiZaxis *","lbounds", 1, self )); + } + arg1 = reinterpret_cast< CdiZaxis * >(argp1); + res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::vector< double,std::allocator< double > > *","lbounds", 2, argv[0] )); + } + arg2 = reinterpret_cast< std::vector< double,std::allocator< double > > * >(argp2); + if (arg1) (arg1)->lbounds = *arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiZaxis_lbounds_get(int argc, VALUE *argv, VALUE self) { + CdiZaxis *arg1 = (CdiZaxis *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< double,std::allocator< double > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiZaxis *","lbounds", 1, self )); + } + arg1 = reinterpret_cast< CdiZaxis * >(argp1); + result = (std::vector< double,std::allocator< double > > *)& ((arg1)->lbounds); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiZaxis_ubounds_set(int argc, VALUE *argv, VALUE self) { + CdiZaxis *arg1 = (CdiZaxis *) 0 ; + std::vector< double,std::allocator< double > > *arg2 = (std::vector< double,std::allocator< double > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiZaxis *","ubounds", 1, self )); + } + arg1 = reinterpret_cast< CdiZaxis * >(argp1); + res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::vector< double,std::allocator< double > > *","ubounds", 2, argv[0] )); + } + arg2 = reinterpret_cast< std::vector< double,std::allocator< double > > * >(argp2); + if (arg1) (arg1)->ubounds = *arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiZaxis_ubounds_get(int argc, VALUE *argv, VALUE self) { + CdiZaxis *arg1 = (CdiZaxis *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< double,std::allocator< double > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiZaxis *","ubounds", 1, self )); + } + arg1 = reinterpret_cast< CdiZaxis * >(argp1); + result = (std::vector< double,std::allocator< double > > *)& ((arg1)->ubounds); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiZaxis_weights_set(int argc, VALUE *argv, VALUE self) { + CdiZaxis *arg1 = (CdiZaxis *) 0 ; + std::vector< double,std::allocator< double > > *arg2 = (std::vector< double,std::allocator< double > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiZaxis *","weights", 1, self )); + } + arg1 = reinterpret_cast< CdiZaxis * >(argp1); + res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::vector< double,std::allocator< double > > *","weights", 2, argv[0] )); + } + arg2 = reinterpret_cast< std::vector< double,std::allocator< double > > * >(argp2); + if (arg1) (arg1)->weights = *arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiZaxis_weights_get(int argc, VALUE *argv, VALUE self) { + CdiZaxis *arg1 = (CdiZaxis *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< double,std::allocator< double > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiZaxis *","weights", 1, self )); + } + arg1 = reinterpret_cast< CdiZaxis * >(argp1); + result = (std::vector< double,std::allocator< double > > *)& ((arg1)->weights); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiZaxis_name_set(int argc, VALUE *argv, VALUE self) { + CdiZaxis *arg1 = (CdiZaxis *) 0 ; + std::string *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 = SWIG_OLDOBJ ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiZaxis *","name", 1, self )); + } + arg1 = reinterpret_cast< CdiZaxis * >(argp1); + { + std::string *ptr = (std::string *)0; + res2 = SWIG_AsPtr_std_string(argv[0], &ptr); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","name", 2, argv[0] )); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","name", 2, argv[0])); + } + arg2 = ptr; + } + if (arg1) (arg1)->name = *arg2; + if (SWIG_IsNewObj(res2)) delete arg2; + return Qnil; +fail: + if (SWIG_IsNewObj(res2)) delete arg2; + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiZaxis_name_get(int argc, VALUE *argv, VALUE self) { + CdiZaxis *arg1 = (CdiZaxis *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::string *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiZaxis *","name", 1, self )); + } + arg1 = reinterpret_cast< CdiZaxis * >(argp1); + result = (std::string *) & ((arg1)->name); + vresult = SWIG_From_std_string(static_cast< std::string >(*result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiZaxis_longname_set(int argc, VALUE *argv, VALUE self) { + CdiZaxis *arg1 = (CdiZaxis *) 0 ; + std::string *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 = SWIG_OLDOBJ ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiZaxis *","longname", 1, self )); + } + arg1 = reinterpret_cast< CdiZaxis * >(argp1); + { + std::string *ptr = (std::string *)0; + res2 = SWIG_AsPtr_std_string(argv[0], &ptr); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","longname", 2, argv[0] )); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","longname", 2, argv[0])); + } + arg2 = ptr; + } + if (arg1) (arg1)->longname = *arg2; + if (SWIG_IsNewObj(res2)) delete arg2; + return Qnil; +fail: + if (SWIG_IsNewObj(res2)) delete arg2; + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiZaxis_longname_get(int argc, VALUE *argv, VALUE self) { + CdiZaxis *arg1 = (CdiZaxis *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::string *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiZaxis *","longname", 1, self )); + } + arg1 = reinterpret_cast< CdiZaxis * >(argp1); + result = (std::string *) & ((arg1)->longname); + vresult = SWIG_From_std_string(static_cast< std::string >(*result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiZaxis_units_set(int argc, VALUE *argv, VALUE self) { + CdiZaxis *arg1 = (CdiZaxis *) 0 ; + std::string *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 = SWIG_OLDOBJ ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiZaxis *","units", 1, self )); + } + arg1 = reinterpret_cast< CdiZaxis * >(argp1); + { + std::string *ptr = (std::string *)0; + res2 = SWIG_AsPtr_std_string(argv[0], &ptr); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","units", 2, argv[0] )); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","units", 2, argv[0])); + } + arg2 = ptr; + } + if (arg1) (arg1)->units = *arg2; + if (SWIG_IsNewObj(res2)) delete arg2; + return Qnil; +fail: + if (SWIG_IsNewObj(res2)) delete arg2; + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiZaxis_units_get(int argc, VALUE *argv, VALUE self) { + CdiZaxis *arg1 = (CdiZaxis *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::string *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiZaxis *","units", 1, self )); + } + arg1 = reinterpret_cast< CdiZaxis * >(argp1); + result = (std::string *) & ((arg1)->units); + vresult = SWIG_From_std_string(static_cast< std::string >(*result)); + return vresult; +fail: + return Qnil; +} + + +static swig_class SwigClassCdiVariable; + +SWIGINTERN VALUE +_wrap_new_CdiVariable__SWIG_0(int argc, VALUE *argv, VALUE self) { + CdiVariable *result = 0 ; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + result = (CdiVariable *)new CdiVariable(); + DATA_PTR(self) = result; + return self; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +#ifdef HAVE_RB_DEFINE_ALLOC_FUNC +_wrap_CdiVariable_allocate(VALUE self) +#else +_wrap_CdiVariable_allocate(int argc, VALUE *argv, VALUE self) +#endif +{ + VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_CdiVariable); +#ifndef HAVE_RB_DEFINE_ALLOC_FUNC + rb_obj_call_init(vresult, argc, argv); +#endif + return vresult; +} + + +SWIGINTERN VALUE +_wrap_new_CdiVariable__SWIG_1(int argc, VALUE *argv, VALUE self) { + int arg1 ; + int arg2 ; + int arg3 ; + int val1 ; + int ecode1 = 0 ; + int val2 ; + int ecode2 = 0 ; + int val3 ; + int ecode3 = 0 ; + CdiVariable *result = 0 ; + + if ((argc < 3) || (argc > 3)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail; + } + ecode1 = SWIG_AsVal_int(argv[0], &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "int","CdiVariable", 1, argv[0] )); + } + arg1 = static_cast< int >(val1); + ecode2 = SWIG_AsVal_int(argv[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","CdiVariable", 2, argv[1] )); + } + arg2 = static_cast< int >(val2); + ecode3 = SWIG_AsVal_int(argv[2], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "int","CdiVariable", 3, argv[2] )); + } + arg3 = static_cast< int >(val3); + result = (CdiVariable *)new CdiVariable(arg1,arg2,arg3); + DATA_PTR(self) = result; + return self; +fail: + return Qnil; +} + + +SWIGINTERN VALUE _wrap_new_CdiVariable(int nargs, VALUE *args, VALUE self) { + int argc; + VALUE argv[3]; + int ii; + + argc = nargs; + if (argc > 3) SWIG_fail; + for (ii = 0; (ii < argc); ++ii) { + argv[ii] = args[ii]; + } + if (argc == 0) { + return _wrap_new_CdiVariable__SWIG_0(nargs, args, self); + } + if (argc == 3) { + int _v; + { + int res = SWIG_AsVal_int(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_new_CdiVariable__SWIG_1(nargs, args, self); + } + } + } + } + +fail: + Ruby_Format_OverloadedError( argc, 3, "CdiVariable.new", + " CdiVariable.new()\n" + " CdiVariable.new(int streamid, int vlistid, int varid)\n"); + + return Qnil; +} + + +SWIGINTERN void +free_CdiVariable(void *self) { + CdiVariable *arg1 = (CdiVariable *)self; + delete arg1; +} + +SWIGINTERN VALUE +_wrap_CdiVariable_varID_set(int argc, VALUE *argv, VALUE self) { + CdiVariable *arg1 = (CdiVariable *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiVariable *","varID", 1, self )); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","varID", 2, argv[0] )); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->varID = arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiVariable_varID_get(int argc, VALUE *argv, VALUE self) { + CdiVariable *arg1 = (CdiVariable *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiVariable *","varID", 1, self )); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + result = (int) ((arg1)->varID); + vresult = SWIG_From_int(static_cast< int >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiVariable_zaxisID_set(int argc, VALUE *argv, VALUE self) { + CdiVariable *arg1 = (CdiVariable *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiVariable *","zaxisID", 1, self )); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","zaxisID", 2, argv[0] )); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->zaxisID = arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiVariable_zaxisID_get(int argc, VALUE *argv, VALUE self) { + CdiVariable *arg1 = (CdiVariable *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiVariable *","zaxisID", 1, self )); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + result = (int) ((arg1)->zaxisID); + vresult = SWIG_From_int(static_cast< int >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiVariable_gridID_set(int argc, VALUE *argv, VALUE self) { + CdiVariable *arg1 = (CdiVariable *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiVariable *","gridID", 1, self )); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","gridID", 2, argv[0] )); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->gridID = arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiVariable_gridID_get(int argc, VALUE *argv, VALUE self) { + CdiVariable *arg1 = (CdiVariable *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiVariable *","gridID", 1, self )); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + result = (int) ((arg1)->gridID); + vresult = SWIG_From_int(static_cast< int >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiVariable_taxisID_set(int argc, VALUE *argv, VALUE self) { + CdiVariable *arg1 = (CdiVariable *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiVariable *","taxisID", 1, self )); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","taxisID", 2, argv[0] )); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->taxisID = arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiVariable_taxisID_get(int argc, VALUE *argv, VALUE self) { + CdiVariable *arg1 = (CdiVariable *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiVariable *","taxisID", 1, self )); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + result = (int) ((arg1)->taxisID); + vresult = SWIG_From_int(static_cast< int >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiVariable_timeID_set(int argc, VALUE *argv, VALUE self) { + CdiVariable *arg1 = (CdiVariable *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiVariable *","timeID", 1, self )); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","timeID", 2, argv[0] )); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->timeID = arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiVariable_timeID_get(int argc, VALUE *argv, VALUE self) { + CdiVariable *arg1 = (CdiVariable *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiVariable *","timeID", 1, self )); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + result = (int) ((arg1)->timeID); + vresult = SWIG_From_int(static_cast< int >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiVariable_vlistID_set(int argc, VALUE *argv, VALUE self) { + CdiVariable *arg1 = (CdiVariable *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiVariable *","vlistID", 1, self )); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","vlistID", 2, argv[0] )); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->vlistID = arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiVariable_vlistID_get(int argc, VALUE *argv, VALUE self) { + CdiVariable *arg1 = (CdiVariable *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiVariable *","vlistID", 1, self )); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + result = (int) ((arg1)->vlistID); + vresult = SWIG_From_int(static_cast< int >(result)); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::CdiVariable.size + + call-seq: + size -> int + +Size or Length of the CdiVariable. +*/ +/* + Document-method: Cdi::CdiVariable.size= + + call-seq: + size=(x) -> int + +Size or Length of the CdiVariable. +*/ +SWIGINTERN VALUE +_wrap_CdiVariable_size_set(int argc, VALUE *argv, VALUE self) { + CdiVariable *arg1 = (CdiVariable *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiVariable *","size", 1, self )); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","size", 2, argv[0] )); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->size = arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiVariable_size_get(int argc, VALUE *argv, VALUE self) { + CdiVariable *arg1 = (CdiVariable *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiVariable *","size", 1, self )); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + result = (int) ((arg1)->size); + vresult = SWIG_From_int(static_cast< int >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiVariable_code_set(int argc, VALUE *argv, VALUE self) { + CdiVariable *arg1 = (CdiVariable *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiVariable *","code", 1, self )); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","code", 2, argv[0] )); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->code = arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiVariable_code_get(int argc, VALUE *argv, VALUE self) { + CdiVariable *arg1 = (CdiVariable *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiVariable *","code", 1, self )); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + result = (int) ((arg1)->code); + vresult = SWIG_From_int(static_cast< int >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiVariable_datatype_set(int argc, VALUE *argv, VALUE self) { + CdiVariable *arg1 = (CdiVariable *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiVariable *","datatype", 1, self )); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","datatype", 2, argv[0] )); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->datatype = arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiVariable_datatype_get(int argc, VALUE *argv, VALUE self) { + CdiVariable *arg1 = (CdiVariable *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiVariable *","datatype", 1, self )); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + result = (int) ((arg1)->datatype); + vresult = SWIG_From_int(static_cast< int >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiVariable_streamID_set(int argc, VALUE *argv, VALUE self) { + CdiVariable *arg1 = (CdiVariable *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiVariable *","streamID", 1, self )); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","streamID", 2, argv[0] )); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->streamID = arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiVariable_streamID_get(int argc, VALUE *argv, VALUE self) { + CdiVariable *arg1 = (CdiVariable *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiVariable *","streamID", 1, self )); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + result = (int) ((arg1)->streamID); + vresult = SWIG_From_int(static_cast< int >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiVariable_name_set(int argc, VALUE *argv, VALUE self) { + CdiVariable *arg1 = (CdiVariable *) 0 ; + std::string *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 = SWIG_OLDOBJ ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiVariable *","name", 1, self )); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + { + std::string *ptr = (std::string *)0; + res2 = SWIG_AsPtr_std_string(argv[0], &ptr); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","name", 2, argv[0] )); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","name", 2, argv[0])); + } + arg2 = ptr; + } + if (arg1) (arg1)->name = *arg2; + if (SWIG_IsNewObj(res2)) delete arg2; + return Qnil; +fail: + if (SWIG_IsNewObj(res2)) delete arg2; + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiVariable_name_get(int argc, VALUE *argv, VALUE self) { + CdiVariable *arg1 = (CdiVariable *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::string *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiVariable *","name", 1, self )); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + result = (std::string *) & ((arg1)->name); + vresult = SWIG_From_std_string(static_cast< std::string >(*result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiVariable_longname_set(int argc, VALUE *argv, VALUE self) { + CdiVariable *arg1 = (CdiVariable *) 0 ; + std::string *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 = SWIG_OLDOBJ ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiVariable *","longname", 1, self )); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + { + std::string *ptr = (std::string *)0; + res2 = SWIG_AsPtr_std_string(argv[0], &ptr); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","longname", 2, argv[0] )); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","longname", 2, argv[0])); + } + arg2 = ptr; + } + if (arg1) (arg1)->longname = *arg2; + if (SWIG_IsNewObj(res2)) delete arg2; + return Qnil; +fail: + if (SWIG_IsNewObj(res2)) delete arg2; + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiVariable_longname_get(int argc, VALUE *argv, VALUE self) { + CdiVariable *arg1 = (CdiVariable *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::string *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiVariable *","longname", 1, self )); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + result = (std::string *) & ((arg1)->longname); + vresult = SWIG_From_std_string(static_cast< std::string >(*result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiVariable_units_set(int argc, VALUE *argv, VALUE self) { + CdiVariable *arg1 = (CdiVariable *) 0 ; + std::string *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 = SWIG_OLDOBJ ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiVariable *","units", 1, self )); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + { + std::string *ptr = (std::string *)0; + res2 = SWIG_AsPtr_std_string(argv[0], &ptr); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","units", 2, argv[0] )); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","units", 2, argv[0])); + } + arg2 = ptr; + } + if (arg1) (arg1)->units = *arg2; + if (SWIG_IsNewObj(res2)) delete arg2; + return Qnil; +fail: + if (SWIG_IsNewObj(res2)) delete arg2; + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiVariable_units_get(int argc, VALUE *argv, VALUE self) { + CdiVariable *arg1 = (CdiVariable *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::string *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiVariable *","units", 1, self )); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + result = (std::string *) & ((arg1)->units); + vresult = SWIG_From_std_string(static_cast< std::string >(*result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiVariable_stdname_set(int argc, VALUE *argv, VALUE self) { + CdiVariable *arg1 = (CdiVariable *) 0 ; + std::string *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 = SWIG_OLDOBJ ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiVariable *","stdname", 1, self )); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + { + std::string *ptr = (std::string *)0; + res2 = SWIG_AsPtr_std_string(argv[0], &ptr); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","stdname", 2, argv[0] )); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","stdname", 2, argv[0])); + } + arg2 = ptr; + } + if (arg1) (arg1)->stdname = *arg2; + if (SWIG_IsNewObj(res2)) delete arg2; + return Qnil; +fail: + if (SWIG_IsNewObj(res2)) delete arg2; + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiVariable_stdname_get(int argc, VALUE *argv, VALUE self) { + CdiVariable *arg1 = (CdiVariable *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::string *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiVariable *","stdname", 1, self )); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + result = (std::string *) & ((arg1)->stdname); + vresult = SWIG_From_std_string(static_cast< std::string >(*result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiVariable_missval_set(int argc, VALUE *argv, VALUE self) { + CdiVariable *arg1 = (CdiVariable *) 0 ; + double arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + double val2 ; + int ecode2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiVariable *","missval", 1, self )); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + ecode2 = SWIG_AsVal_double(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "double","missval", 2, argv[0] )); + } + arg2 = static_cast< double >(val2); + if (arg1) (arg1)->missval = arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiVariable_missval_get(int argc, VALUE *argv, VALUE self) { + CdiVariable *arg1 = (CdiVariable *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + double result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiVariable *","missval", 1, self )); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + result = (double) ((arg1)->missval); + vresult = SWIG_From_double(static_cast< double >(result)); + return vresult; +fail: + return Qnil; +} + + +/* + Document-method: Cdi::CdiVariable.values + + call-seq: + values -> DoubleVector + +Return an Array of value elements. +*/ +/* + Document-method: Cdi::CdiVariable.values= + + call-seq: + values=(x) -> DoubleVector + +Return an Array of value elements. +*/ +SWIGINTERN VALUE +_wrap_CdiVariable_values_set(int argc, VALUE *argv, VALUE self) { + CdiVariable *arg1 = (CdiVariable *) 0 ; + std::vector< double,std::allocator< double > > *arg2 = (std::vector< double,std::allocator< double > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiVariable *","values", 1, self )); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::vector< double,std::allocator< double > > *","values", 2, argv[0] )); + } + arg2 = reinterpret_cast< std::vector< double,std::allocator< double > > * >(argp2); + if (arg1) (arg1)->values = *arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiVariable_values_get(int argc, VALUE *argv, VALUE self) { + CdiVariable *arg1 = (CdiVariable *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< double,std::allocator< double > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiVariable *","values", 1, self )); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + result = (std::vector< double,std::allocator< double > > *)& ((arg1)->values); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiVariable_valuesWithLevel_set(int argc, VALUE *argv, VALUE self) { + CdiVariable *arg1 = (CdiVariable *) 0 ; + std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *arg2 = (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiVariable *","valuesWithLevel", 1, self )); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *","valuesWithLevel", 2, argv[0] )); + } + arg2 = reinterpret_cast< std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > * >(argp2); + if (arg1) (arg1)->valuesWithLevel = *arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiVariable_valuesWithLevel_get(int argc, VALUE *argv, VALUE self) { + CdiVariable *arg1 = (CdiVariable *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiVariable *","valuesWithLevel", 1, self )); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + result = (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *)& ((arg1)->valuesWithLevel); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiVariable_grid_set(int argc, VALUE *argv, VALUE self) { + CdiVariable *arg1 = (CdiVariable *) 0 ; + CdiGrid *arg2 = (CdiGrid *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiVariable *","grid", 1, self )); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_CdiGrid, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "CdiGrid *","grid", 2, argv[0] )); + } + arg2 = reinterpret_cast< CdiGrid * >(argp2); + if (arg1) (arg1)->grid = *arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiVariable_grid_get(int argc, VALUE *argv, VALUE self) { + CdiVariable *arg1 = (CdiVariable *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + CdiGrid *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiVariable *","grid", 1, self )); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + result = (CdiGrid *)& ((arg1)->grid); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CdiGrid, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiVariable_zaxis_set(int argc, VALUE *argv, VALUE self) { + CdiVariable *arg1 = (CdiVariable *) 0 ; + CdiZaxis *arg2 = (CdiZaxis *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiVariable *","zaxis", 1, self )); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_CdiZaxis, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "CdiZaxis *","zaxis", 2, argv[0] )); + } + arg2 = reinterpret_cast< CdiZaxis * >(argp2); + if (arg1) (arg1)->zaxis = *arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiVariable_zaxis_get(int argc, VALUE *argv, VALUE self) { + CdiVariable *arg1 = (CdiVariable *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + CdiZaxis *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiVariable *","zaxis", 1, self )); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + result = (CdiZaxis *)& ((arg1)->zaxis); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CdiZaxis, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiVariable_taxis_set(int argc, VALUE *argv, VALUE self) { + CdiVariable *arg1 = (CdiVariable *) 0 ; + CdiTaxis *arg2 = (CdiTaxis *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiVariable *","taxis", 1, self )); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_CdiTaxis, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "CdiTaxis *","taxis", 2, argv[0] )); + } + arg2 = reinterpret_cast< CdiTaxis * >(argp2); + if (arg1) (arg1)->taxis = *arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiVariable_taxis_get(int argc, VALUE *argv, VALUE self) { + CdiVariable *arg1 = (CdiVariable *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + CdiTaxis *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiVariable *","taxis", 1, self )); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + result = (CdiTaxis *)& ((arg1)->taxis); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CdiTaxis, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiVariable_sinfo(int argc, VALUE *argv, VALUE self) { + CdiVariable *arg1 = (CdiVariable *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiVariable *","sinfo", 1, self )); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + (arg1)->sinfo(); + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiVariable_getValues(int argc, VALUE *argv, VALUE self) { + CdiVariable *arg1 = (CdiVariable *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiVariable *","getValues", 1, self )); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + (arg1)->getValues(); + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiVariable_getValuesWithLevel__SWIG_0(int argc, VALUE *argv, VALUE self) { + CdiVariable *arg1 = (CdiVariable *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiVariable *","getValuesWithLevel", 1, self )); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","getValuesWithLevel", 2, argv[0] )); + } + arg2 = static_cast< int >(val2); + (arg1)->getValuesWithLevel(arg2); + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiVariable_getValuesWithLevel__SWIG_1(int argc, VALUE *argv, VALUE self) { + CdiVariable *arg1 = (CdiVariable *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiVariable *","getValuesWithLevel", 1, self )); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + (arg1)->getValuesWithLevel(); + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE _wrap_CdiVariable_getValuesWithLevel(int nargs, VALUE *args, VALUE self) { + int argc; + VALUE argv[3]; + int ii; + + argc = nargs + 1; + argv[0] = self; + if (argc > 3) SWIG_fail; + for (ii = 1; (ii < argc); ++ii) { + argv[ii] = args[ii-1]; + } + if (argc == 1) { + int _v; + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CdiVariable, 0); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_CdiVariable_getValuesWithLevel__SWIG_1(nargs, args, self); + } + } + if (argc == 2) { + int _v; + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CdiVariable, 0); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_CdiVariable_getValuesWithLevel__SWIG_0(nargs, args, self); + } + } + } + +fail: + Ruby_Format_OverloadedError( argc, 3, "CdiVariable.getValuesWithLevel", + " void CdiVariable.getValuesWithLevel(int tsID)\n" + " void CdiVariable.getValuesWithLevel()\n"); + + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiVariable_getFValues(int argc, VALUE *argv, VALUE self) { + CdiVariable *arg1 = (CdiVariable *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + SwigValueWrapper< std::vector< float,std::allocator< float > > > result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiVariable *","getFValues", 1, self )); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + result = (arg1)->getFValues(); + vresult = SWIG_NewPointerObj((new std::vector< float,std::allocator< float > >(static_cast< const std::vector< float,std::allocator< float > >& >(result))), SWIGTYPE_p_std__vectorT_float_std__allocatorT_float_t_t, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiVariable_getFValuesWithLevel__SWIG_0(int argc, VALUE *argv, VALUE self) { + CdiVariable *arg1 = (CdiVariable *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + SwigValueWrapper< std::vector< std::vector< float,std::allocator< float > >,std::allocator< std::vector< float,std::allocator< float > > > > > result; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiVariable *","getFValuesWithLevel", 1, self )); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","getFValuesWithLevel", 2, argv[0] )); + } + arg2 = static_cast< int >(val2); + result = (arg1)->getFValuesWithLevel(arg2); + vresult = SWIG_NewPointerObj((new std::vector< std::vector< float,std::allocator< float > >,std::allocator< std::vector< float,std::allocator< float > > > >(static_cast< const std::vector< std::vector< float,std::allocator< float > >,std::allocator< std::vector< float,std::allocator< float > > > >& >(result))), SWIGTYPE_p_std__vectorT_std__vectorT_float_std__allocatorT_float_t_t_std__allocatorT_std__vectorT_float_std__allocatorT_float_t_t_t_t, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiVariable_getFValuesWithLevel__SWIG_1(int argc, VALUE *argv, VALUE self) { + CdiVariable *arg1 = (CdiVariable *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + SwigValueWrapper< std::vector< std::vector< float,std::allocator< float > >,std::allocator< std::vector< float,std::allocator< float > > > > > result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiVariable *","getFValuesWithLevel", 1, self )); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + result = (arg1)->getFValuesWithLevel(); + vresult = SWIG_NewPointerObj((new std::vector< std::vector< float,std::allocator< float > >,std::allocator< std::vector< float,std::allocator< float > > > >(static_cast< const std::vector< std::vector< float,std::allocator< float > >,std::allocator< std::vector< float,std::allocator< float > > > >& >(result))), SWIGTYPE_p_std__vectorT_std__vectorT_float_std__allocatorT_float_t_t_std__allocatorT_std__vectorT_float_std__allocatorT_float_t_t_t_t, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE _wrap_CdiVariable_getFValuesWithLevel(int nargs, VALUE *args, VALUE self) { + int argc; + VALUE argv[3]; + int ii; + + argc = nargs + 1; + argv[0] = self; + if (argc > 3) SWIG_fail; + for (ii = 1; (ii < argc); ++ii) { + argv[ii] = args[ii-1]; + } + if (argc == 1) { + int _v; + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CdiVariable, 0); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_CdiVariable_getFValuesWithLevel__SWIG_1(nargs, args, self); + } + } + if (argc == 2) { + int _v; + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CdiVariable, 0); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_CdiVariable_getFValuesWithLevel__SWIG_0(nargs, args, self); + } + } + } + +fail: + Ruby_Format_OverloadedError( argc, 3, "CdiVariable.getFValuesWithLevel", + " std::vector< std::vector< float,std::allocator< float > >,std::allocator< std::vector< float,std::allocator< float > > > > CdiVariable.getFValuesWithLevel(int tsID)\n" + " std::vector< std::vector< float,std::allocator< float > >,std::allocator< std::vector< float,std::allocator< float > > > > CdiVariable.getFValuesWithLevel()\n"); + + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiVariable_getValuesAsPointer(int argc, VALUE *argv, VALUE self) { + CdiVariable *arg1 = (CdiVariable *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + double *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiVariable *","getValuesAsPointer", 1, self )); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + result = (double *)(arg1)->getValuesAsPointer(); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_double, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiVariable_getValuesWithLevelAsPointer__SWIG_0(int argc, VALUE *argv, VALUE self) { + CdiVariable *arg1 = (CdiVariable *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + double **result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiVariable *","getValuesWithLevelAsPointer", 1, self )); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","getValuesWithLevelAsPointer", 2, argv[0] )); + } + arg2 = static_cast< int >(val2); + result = (double **)(arg1)->getValuesWithLevelAsPointer(arg2); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_p_double, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_CdiVariable_getValuesWithLevelAsPointer__SWIG_1(int argc, VALUE *argv, VALUE self) { + CdiVariable *arg1 = (CdiVariable *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + double **result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CdiVariable *","getValuesWithLevelAsPointer", 1, self )); + } + arg1 = reinterpret_cast< CdiVariable * >(argp1); + result = (double **)(arg1)->getValuesWithLevelAsPointer(); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_p_double, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE _wrap_CdiVariable_getValuesWithLevelAsPointer(int nargs, VALUE *args, VALUE self) { + int argc; + VALUE argv[3]; + int ii; + + argc = nargs + 1; + argv[0] = self; + if (argc > 3) SWIG_fail; + for (ii = 1; (ii < argc); ++ii) { + argv[ii] = args[ii-1]; + } + if (argc == 1) { + int _v; + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CdiVariable, 0); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_CdiVariable_getValuesWithLevelAsPointer__SWIG_1(nargs, args, self); + } + } + if (argc == 2) { + int _v; + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CdiVariable, 0); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_CdiVariable_getValuesWithLevelAsPointer__SWIG_0(nargs, args, self); + } + } + } + +fail: + Ruby_Format_OverloadedError( argc, 3, "CdiVariable.getValuesWithLevelAsPointer", + " double CdiVariable.getValuesWithLevelAsPointer(int tsID)\n" + " double ** CdiVariable.getValuesWithLevelAsPointer()\n"); + + return Qnil; +} + + +static swig_class SwigClassCdi; + +SWIGINTERN VALUE +#ifdef HAVE_RB_DEFINE_ALLOC_FUNC +_wrap_Cdi_allocate(VALUE self) +#else +_wrap_Cdi_allocate(int argc, VALUE *argv, VALUE self) +#endif +{ + VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_Cdi); +#ifndef HAVE_RB_DEFINE_ALLOC_FUNC + rb_obj_call_init(vresult, argc, argv); +#endif + return vresult; +} + + +SWIGINTERN VALUE +_wrap_new_Cdi(int argc, VALUE *argv, VALUE self) { + char *arg1 = (char *) 0 ; + int res1 ; + char *buf1 = 0 ; + int alloc1 = 0 ; + Cdi *result = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "char const *","Cdi", 1, argv[0] )); + } + arg1 = reinterpret_cast< char * >(buf1); + result = (Cdi *)new Cdi((char const *)arg1); + DATA_PTR(self) = result; + if (alloc1 == SWIG_NEWOBJ) delete[] buf1; + return self; +fail: + if (alloc1 == SWIG_NEWOBJ) delete[] buf1; + return Qnil; +} + + +SWIGINTERN void +free_Cdi(void *self) { + Cdi *arg1 = (Cdi *)self; + delete arg1; +} + +SWIGINTERN VALUE +_wrap_Cdi_streamID_set(int argc, VALUE *argv, VALUE self) { + Cdi *arg1 = (Cdi *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Cdi *","streamID", 1, self )); + } + arg1 = reinterpret_cast< Cdi * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","streamID", 2, argv[0] )); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->streamID = arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_Cdi_streamID_get(int argc, VALUE *argv, VALUE self) { + Cdi *arg1 = (Cdi *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Cdi *","streamID", 1, self )); + } + arg1 = reinterpret_cast< Cdi * >(argp1); + result = (int) ((arg1)->streamID); + vresult = SWIG_From_int(static_cast< int >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_Cdi_vlistID_set(int argc, VALUE *argv, VALUE self) { + Cdi *arg1 = (Cdi *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Cdi *","vlistID", 1, self )); + } + arg1 = reinterpret_cast< Cdi * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","vlistID", 2, argv[0] )); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->vlistID = arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_Cdi_vlistID_get(int argc, VALUE *argv, VALUE self) { + Cdi *arg1 = (Cdi *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Cdi *","vlistID", 1, self )); + } + arg1 = reinterpret_cast< Cdi * >(argp1); + result = (int) ((arg1)->vlistID); + vresult = SWIG_From_int(static_cast< int >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_Cdi_nvars_set(int argc, VALUE *argv, VALUE self) { + Cdi *arg1 = (Cdi *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Cdi *","nvars", 1, self )); + } + arg1 = reinterpret_cast< Cdi * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","nvars", 2, argv[0] )); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->nvars = arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_Cdi_nvars_get(int argc, VALUE *argv, VALUE self) { + Cdi *arg1 = (Cdi *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Cdi *","nvars", 1, self )); + } + arg1 = reinterpret_cast< Cdi * >(argp1); + result = (int) ((arg1)->nvars); + vresult = SWIG_From_int(static_cast< int >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_Cdi_nzaxes_set(int argc, VALUE *argv, VALUE self) { + Cdi *arg1 = (Cdi *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Cdi *","nzaxes", 1, self )); + } + arg1 = reinterpret_cast< Cdi * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","nzaxes", 2, argv[0] )); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->nzaxes = arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_Cdi_nzaxes_get(int argc, VALUE *argv, VALUE self) { + Cdi *arg1 = (Cdi *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Cdi *","nzaxes", 1, self )); + } + arg1 = reinterpret_cast< Cdi * >(argp1); + result = (int) ((arg1)->nzaxes); + vresult = SWIG_From_int(static_cast< int >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_Cdi_ngrids_set(int argc, VALUE *argv, VALUE self) { + Cdi *arg1 = (Cdi *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Cdi *","ngrids", 1, self )); + } + arg1 = reinterpret_cast< Cdi * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","ngrids", 2, argv[0] )); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->ngrids = arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_Cdi_ngrids_get(int argc, VALUE *argv, VALUE self) { + Cdi *arg1 = (Cdi *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Cdi *","ngrids", 1, self )); + } + arg1 = reinterpret_cast< Cdi * >(argp1); + result = (int) ((arg1)->ngrids); + vresult = SWIG_From_int(static_cast< int >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_Cdi_ntaxes_set(int argc, VALUE *argv, VALUE self) { + Cdi *arg1 = (Cdi *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Cdi *","ntaxes", 1, self )); + } + arg1 = reinterpret_cast< Cdi * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","ntaxes", 2, argv[0] )); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->ntaxes = arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_Cdi_ntaxes_get(int argc, VALUE *argv, VALUE self) { + Cdi *arg1 = (Cdi *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Cdi *","ntaxes", 1, self )); + } + arg1 = reinterpret_cast< Cdi * >(argp1); + result = (int) ((arg1)->ntaxes); + vresult = SWIG_From_int(static_cast< int >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_Cdi_taxisID_set(int argc, VALUE *argv, VALUE self) { + Cdi *arg1 = (Cdi *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Cdi *","taxisID", 1, self )); + } + arg1 = reinterpret_cast< Cdi * >(argp1); + ecode2 = SWIG_AsVal_int(argv[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","taxisID", 2, argv[0] )); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->taxisID = arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_Cdi_taxisID_get(int argc, VALUE *argv, VALUE self) { + Cdi *arg1 = (Cdi *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Cdi *","taxisID", 1, self )); + } + arg1 = reinterpret_cast< Cdi * >(argp1); + result = (int) ((arg1)->taxisID); + vresult = SWIG_From_int(static_cast< int >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_Cdi_varnames_set(int argc, VALUE *argv, VALUE self) { + Cdi *arg1 = (Cdi *) 0 ; + std::vector< std::string,std::allocator< std::string > > *arg2 = (std::vector< std::string,std::allocator< std::string > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Cdi *","varnames", 1, self )); + } + arg1 = reinterpret_cast< Cdi * >(argp1); + res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::vector< std::string,std::allocator< std::string > > *","varnames", 2, argv[0] )); + } + arg2 = reinterpret_cast< std::vector< std::string,std::allocator< std::string > > * >(argp2); + if (arg1) (arg1)->varnames = *arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_Cdi_varnames_get(int argc, VALUE *argv, VALUE self) { + Cdi *arg1 = (Cdi *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< std::string,std::allocator< std::string > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Cdi *","varnames", 1, self )); + } + arg1 = reinterpret_cast< Cdi * >(argp1); + result = (std::vector< std::string,std::allocator< std::string > > *)& ((arg1)->varnames); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_Cdi_codes_set(int argc, VALUE *argv, VALUE self) { + Cdi *arg1 = (Cdi *) 0 ; + std::vector< int,std::allocator< int > > *arg2 = (std::vector< int,std::allocator< int > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Cdi *","codes", 1, self )); + } + arg1 = reinterpret_cast< Cdi * >(argp1); + res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::vector< int,std::allocator< int > > *","codes", 2, argv[0] )); + } + arg2 = reinterpret_cast< std::vector< int,std::allocator< int > > * >(argp2); + if (arg1) (arg1)->codes = *arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_Cdi_codes_get(int argc, VALUE *argv, VALUE self) { + Cdi *arg1 = (Cdi *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< int,std::allocator< int > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Cdi *","codes", 1, self )); + } + arg1 = reinterpret_cast< Cdi * >(argp1); + result = (std::vector< int,std::allocator< int > > *)& ((arg1)->codes); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_Cdi_variables_set(int argc, VALUE *argv, VALUE self) { + Cdi *arg1 = (Cdi *) 0 ; + std::vector< CdiVariable,std::allocator< CdiVariable > > *arg2 = (std::vector< CdiVariable,std::allocator< CdiVariable > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Cdi *","variables", 1, self )); + } + arg1 = reinterpret_cast< Cdi * >(argp1); + res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::vector< CdiVariable,std::allocator< CdiVariable > > *","variables", 2, argv[0] )); + } + arg2 = reinterpret_cast< std::vector< CdiVariable,std::allocator< CdiVariable > > * >(argp2); + if (arg1) (arg1)->variables = *arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_Cdi_variables_get(int argc, VALUE *argv, VALUE self) { + Cdi *arg1 = (Cdi *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::vector< CdiVariable,std::allocator< CdiVariable > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Cdi *","variables", 1, self )); + } + arg1 = reinterpret_cast< Cdi * >(argp1); + result = (std::vector< CdiVariable,std::allocator< CdiVariable > > *)& ((arg1)->variables); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_Cdi_var_set(int argc, VALUE *argv, VALUE self) { + Cdi *arg1 = (Cdi *) 0 ; + std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > > *arg2 = (std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Cdi *","var", 1, self )); + } + arg1 = reinterpret_cast< Cdi * >(argp1); + res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > > *","var", 2, argv[0] )); + } + arg2 = reinterpret_cast< std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > > * >(argp2); + if (arg1) (arg1)->var = *arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_Cdi_var_get(int argc, VALUE *argv, VALUE self) { + Cdi *arg1 = (Cdi *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Cdi *","var", 1, self )); + } + arg1 = reinterpret_cast< Cdi * >(argp1); + result = (std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > > *)& ((arg1)->var); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_Cdi_varByCode_set(int argc, VALUE *argv, VALUE self) { + Cdi *arg1 = (Cdi *) 0 ; + std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > > *arg2 = (std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Cdi *","varByCode", 1, self )); + } + arg1 = reinterpret_cast< Cdi * >(argp1); + res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > > *","varByCode", 2, argv[0] )); + } + arg2 = reinterpret_cast< std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > > * >(argp2); + if (arg1) (arg1)->varByCode = *arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_Cdi_varByCode_get(int argc, VALUE *argv, VALUE self) { + Cdi *arg1 = (Cdi *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Cdi *","varByCode", 1, self )); + } + arg1 = reinterpret_cast< Cdi * >(argp1); + result = (std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > > *)& ((arg1)->varByCode); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_Cdi_taxes_set(int argc, VALUE *argv, VALUE self) { + Cdi *arg1 = (Cdi *) 0 ; + std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > > *arg2 = (std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Cdi *","taxes", 1, self )); + } + arg1 = reinterpret_cast< Cdi * >(argp1); + res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > > *","taxes", 2, argv[0] )); + } + arg2 = reinterpret_cast< std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > > * >(argp2); + if (arg1) (arg1)->taxes = *arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_Cdi_taxes_get(int argc, VALUE *argv, VALUE self) { + Cdi *arg1 = (Cdi *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Cdi *","taxes", 1, self )); + } + arg1 = reinterpret_cast< Cdi * >(argp1); + result = (std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > > *)& ((arg1)->taxes); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_Cdi_zaxes_set(int argc, VALUE *argv, VALUE self) { + Cdi *arg1 = (Cdi *) 0 ; + std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > > *arg2 = (std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Cdi *","zaxes", 1, self )); + } + arg1 = reinterpret_cast< Cdi * >(argp1); + res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > > *","zaxes", 2, argv[0] )); + } + arg2 = reinterpret_cast< std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > > * >(argp2); + if (arg1) (arg1)->zaxes = *arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_Cdi_zaxes_get(int argc, VALUE *argv, VALUE self) { + Cdi *arg1 = (Cdi *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Cdi *","zaxes", 1, self )); + } + arg1 = reinterpret_cast< Cdi * >(argp1); + result = (std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > > *)& ((arg1)->zaxes); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_Cdi_grids_set(int argc, VALUE *argv, VALUE self) { + Cdi *arg1 = (Cdi *) 0 ; + std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > > *arg2 = (std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Cdi *","grids", 1, self )); + } + arg1 = reinterpret_cast< Cdi * >(argp1); + res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > > *","grids", 2, argv[0] )); + } + arg2 = reinterpret_cast< std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > > * >(argp2); + if (arg1) (arg1)->grids = *arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_Cdi_grids_get(int argc, VALUE *argv, VALUE self) { + Cdi *arg1 = (Cdi *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > > *result = 0 ; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Cdi *","grids", 1, self )); + } + arg1 = reinterpret_cast< Cdi * >(argp1); + result = (std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > > *)& ((arg1)->grids); + vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_Cdi_griddes(int argc, VALUE *argv, VALUE self) { + Cdi *arg1 = (Cdi *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Cdi *","griddes", 1, self )); + } + arg1 = reinterpret_cast< Cdi * >(argp1); + (arg1)->griddes(); + return Qnil; +fail: + return Qnil; +} + + + +/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */ + +static void *_p_swig__IteratorTo_p_swig__ConstIterator(void *x, int *SWIGUNUSEDPARM(newmemory)) { + return (void *)((swig::ConstIterator *) ((swig::Iterator *) x)); +} +static swig_type_info _swigt__p_Cdi = {"_p_Cdi", "Cdi *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_CdiGrid = {"_p_CdiGrid", "std::map< int,CdiGrid >::mapped_type *|CdiGrid *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_CdiTaxis = {"_p_CdiTaxis", "std::map< int,CdiTaxis >::mapped_type *|CdiTaxis *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_CdiVariable = {"_p_CdiVariable", "std::map< std::string,CdiVariable >::mapped_type *|std::vector< CdiVariable >::value_type *|std::map< int,CdiVariable >::mapped_type *|CdiVariable *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_CdiZaxis = {"_p_CdiZaxis", "std::map< int,CdiZaxis >::mapped_type *|CdiZaxis *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_allocator_type = {"_p_allocator_type", "allocator_type *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_difference_type = {"_p_difference_type", "difference_type *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_double = {"_p_double", "double *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_float = {"_p_float", "float *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_key_type = {"_p_key_type", "key_type *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_mapped_type = {"_p_mapped_type", "mapped_type *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_p_double = {"_p_p_double", "double **", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_p_void = {"_p_p_void", "void **|VALUE *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_size_type = {"_p_size_type", "size_type *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_std__allocatorT_CdiVariable_t = {"_p_std__allocatorT_CdiVariable_t", "std::vector< CdiVariable >::allocator_type *|std::allocator< CdiVariable > *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_std__allocatorT_double_t = {"_p_std__allocatorT_double_t", "std::vector< double >::allocator_type *|std::allocator< double > *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_std__allocatorT_int_t = {"_p_std__allocatorT_int_t", "std::vector< int >::allocator_type *|std::allocator< int > *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_std__allocatorT_std__pairT_int_const_CdiGrid_t_t = {"_p_std__allocatorT_std__pairT_int_const_CdiGrid_t_t", "std::map< int,CdiGrid >::allocator_type *|std::allocator< std::pair< int const,CdiGrid > > *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t = {"_p_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t", "std::map< int,CdiTaxis >::allocator_type *|std::allocator< std::pair< int const,CdiTaxis > > *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_std__allocatorT_std__pairT_int_const_CdiVariable_t_t = {"_p_std__allocatorT_std__pairT_int_const_CdiVariable_t_t", "std::map< int,CdiVariable >::allocator_type *|std::allocator< std::pair< int const,CdiVariable > > *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t = {"_p_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t", "std::map< int,CdiZaxis >::allocator_type *|std::allocator< std::pair< int const,CdiZaxis > > *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t = {"_p_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t", "std::allocator< std::pair< std::string const,CdiVariable > > *|std::map< std::string,CdiVariable >::allocator_type *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_std__allocatorT_std__string_t = {"_p_std__allocatorT_std__string_t", "std::vector< std::string >::allocator_type *|std::allocator< std::string > *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t = {"_p_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t", "std::vector< std::vector< double > >::allocator_type *|std::allocator< std::vector< double,std::allocator< double > > > *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_std__lessT_int_t = {"_p_std__lessT_int_t", "std::less< int > *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_std__lessT_std__string_t = {"_p_std__lessT_std__string_t", "std::less< std::string > *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t = {"_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t", "std::map< int,CdiGrid > *|std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > > *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t__iterator = {"_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t__iterator", "std::map< int,CdiGrid >::iterator *|std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::iterator *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t__reverse_iterator = {"_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t__reverse_iterator", "std::map< int,CdiGrid >::reverse_iterator *|std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::reverse_iterator *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t = {"_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t", "std::map< int,CdiTaxis > *|std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > > *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t__iterator = {"_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t__iterator", "std::map< int,CdiTaxis >::iterator *|std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::iterator *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t__reverse_iterator = {"_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t__reverse_iterator", "std::map< int,CdiTaxis >::reverse_iterator *|std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::reverse_iterator *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t = {"_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t", "std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > > *|std::map< int,CdiVariable > *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t__iterator = {"_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t__iterator", "std::map< int,CdiVariable >::iterator *|std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::iterator *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t__reverse_iterator = {"_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t__reverse_iterator", "std::map< int,CdiVariable >::reverse_iterator *|std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::reverse_iterator *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t = {"_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t", "std::map< int,CdiZaxis > *|std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > > *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t__iterator = {"_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t__iterator", "std::map< int,CdiZaxis >::iterator *|std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::iterator *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t__reverse_iterator = {"_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t__reverse_iterator", "std::map< int,CdiZaxis >::reverse_iterator *|std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::reverse_iterator *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t = {"_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t", "std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > > *|std::map< std::string,CdiVariable > *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t__iterator = {"_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t__iterator", "std::map< std::string,CdiVariable >::iterator *|std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::iterator *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t__reverse_iterator = {"_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t__reverse_iterator", "std::map< std::string,CdiVariable >::reverse_iterator *|std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::reverse_iterator *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t = {"_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t", "std::vector< CdiVariable,std::allocator< CdiVariable > > *|std::vector< CdiVariable > *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_std__vectorT_double_std__allocatorT_double_t_t = {"_p_std__vectorT_double_std__allocatorT_double_t_t", "std::vector< double,std::allocator< double > > *|std::vector< double > *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_std__vectorT_float_std__allocatorT_float_t_t = {"_p_std__vectorT_float_std__allocatorT_float_t_t", "std::vector< float,std::allocator< float > > *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_std__vectorT_int_std__allocatorT_int_t_t = {"_p_std__vectorT_int_std__allocatorT_int_t_t", "std::vector< int,std::allocator< int > > *|std::vector< int > *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_std__vectorT_std__string_std__allocatorT_std__string_t_t = {"_p_std__vectorT_std__string_std__allocatorT_std__string_t_t", "std::vector< std::string,std::allocator< std::string > > *|std::vector< std::string > *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t = {"_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t", "std::vector< std::vector< double > > *|std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *|std::vector< std::vector< double,std::allocator< double > > > *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_std__vectorT_std__vectorT_float_std__allocatorT_float_t_t_std__allocatorT_std__vectorT_float_std__allocatorT_float_t_t_t_t = {"_p_std__vectorT_std__vectorT_float_std__allocatorT_float_t_t_std__allocatorT_std__vectorT_float_std__allocatorT_float_t_t_t_t", "std::vector< std::vector< float,std::allocator< float > >,std::allocator< std::vector< float,std::allocator< float > > > > *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_swig__ConstIterator = {"_p_swig__ConstIterator", "swig::ConstIterator *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_swig__GC_VALUE = {"_p_swig__GC_VALUE", "swig::GC_VALUE *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_swig__Iterator = {"_p_swig__Iterator", "swig::Iterator *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_value_type = {"_p_value_type", "value_type *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_void = {"_p_void", "VALUE|void *", 0, 0, (void*)0, 0}; + +static swig_type_info *swig_type_initial[] = { + &_swigt__p_Cdi, + &_swigt__p_CdiGrid, + &_swigt__p_CdiTaxis, + &_swigt__p_CdiVariable, + &_swigt__p_CdiZaxis, + &_swigt__p_allocator_type, + &_swigt__p_char, + &_swigt__p_difference_type, + &_swigt__p_double, + &_swigt__p_float, + &_swigt__p_key_type, + &_swigt__p_mapped_type, + &_swigt__p_p_double, + &_swigt__p_p_void, + &_swigt__p_size_type, + &_swigt__p_std__allocatorT_CdiVariable_t, + &_swigt__p_std__allocatorT_double_t, + &_swigt__p_std__allocatorT_int_t, + &_swigt__p_std__allocatorT_std__pairT_int_const_CdiGrid_t_t, + &_swigt__p_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t, + &_swigt__p_std__allocatorT_std__pairT_int_const_CdiVariable_t_t, + &_swigt__p_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t, + &_swigt__p_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t, + &_swigt__p_std__allocatorT_std__string_t, + &_swigt__p_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t, + &_swigt__p_std__lessT_int_t, + &_swigt__p_std__lessT_std__string_t, + &_swigt__p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, + &_swigt__p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t__iterator, + &_swigt__p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t__reverse_iterator, + &_swigt__p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, + &_swigt__p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t__iterator, + &_swigt__p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t__reverse_iterator, + &_swigt__p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, + &_swigt__p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t__iterator, + &_swigt__p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t__reverse_iterator, + &_swigt__p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, + &_swigt__p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t__iterator, + &_swigt__p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t__reverse_iterator, + &_swigt__p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, + &_swigt__p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t__iterator, + &_swigt__p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t__reverse_iterator, + &_swigt__p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, + &_swigt__p_std__vectorT_double_std__allocatorT_double_t_t, + &_swigt__p_std__vectorT_float_std__allocatorT_float_t_t, + &_swigt__p_std__vectorT_int_std__allocatorT_int_t_t, + &_swigt__p_std__vectorT_std__string_std__allocatorT_std__string_t_t, + &_swigt__p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, + &_swigt__p_std__vectorT_std__vectorT_float_std__allocatorT_float_t_t_std__allocatorT_std__vectorT_float_std__allocatorT_float_t_t_t_t, + &_swigt__p_swig__ConstIterator, + &_swigt__p_swig__GC_VALUE, + &_swigt__p_swig__Iterator, + &_swigt__p_value_type, + &_swigt__p_void, +}; + +static swig_cast_info _swigc__p_Cdi[] = { {&_swigt__p_Cdi, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_CdiGrid[] = { {&_swigt__p_CdiGrid, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_CdiTaxis[] = { {&_swigt__p_CdiTaxis, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_CdiVariable[] = { {&_swigt__p_CdiVariable, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_CdiZaxis[] = { {&_swigt__p_CdiZaxis, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_allocator_type[] = { {&_swigt__p_allocator_type, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_difference_type[] = { {&_swigt__p_difference_type, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_double[] = { {&_swigt__p_double, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_float[] = { {&_swigt__p_float, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_key_type[] = { {&_swigt__p_key_type, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_mapped_type[] = { {&_swigt__p_mapped_type, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_p_double[] = { {&_swigt__p_p_double, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_p_void[] = { {&_swigt__p_p_void, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_size_type[] = { {&_swigt__p_size_type, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_std__allocatorT_CdiVariable_t[] = { {&_swigt__p_std__allocatorT_CdiVariable_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_std__allocatorT_double_t[] = { {&_swigt__p_std__allocatorT_double_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_std__allocatorT_int_t[] = { {&_swigt__p_std__allocatorT_int_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_std__allocatorT_std__pairT_int_const_CdiGrid_t_t[] = { {&_swigt__p_std__allocatorT_std__pairT_int_const_CdiGrid_t_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t[] = { {&_swigt__p_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_std__allocatorT_std__pairT_int_const_CdiVariable_t_t[] = { {&_swigt__p_std__allocatorT_std__pairT_int_const_CdiVariable_t_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t[] = { {&_swigt__p_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t[] = { {&_swigt__p_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_std__allocatorT_std__string_t[] = { {&_swigt__p_std__allocatorT_std__string_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t[] = { {&_swigt__p_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_std__lessT_int_t[] = { {&_swigt__p_std__lessT_int_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_std__lessT_std__string_t[] = { {&_swigt__p_std__lessT_std__string_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t[] = { {&_swigt__p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t__iterator[] = { {&_swigt__p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t__iterator, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t__reverse_iterator[] = { {&_swigt__p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t__reverse_iterator, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t[] = { {&_swigt__p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t__iterator[] = { {&_swigt__p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t__iterator, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t__reverse_iterator[] = { {&_swigt__p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t__reverse_iterator, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t[] = { {&_swigt__p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t__iterator[] = { {&_swigt__p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t__iterator, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t__reverse_iterator[] = { {&_swigt__p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t__reverse_iterator, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t[] = { {&_swigt__p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t__iterator[] = { {&_swigt__p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t__iterator, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t__reverse_iterator[] = { {&_swigt__p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t__reverse_iterator, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t[] = { {&_swigt__p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t__iterator[] = { {&_swigt__p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t__iterator, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t__reverse_iterator[] = { {&_swigt__p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t__reverse_iterator, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t[] = { {&_swigt__p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_std__vectorT_double_std__allocatorT_double_t_t[] = { {&_swigt__p_std__vectorT_double_std__allocatorT_double_t_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_std__vectorT_float_std__allocatorT_float_t_t[] = { {&_swigt__p_std__vectorT_float_std__allocatorT_float_t_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_std__vectorT_int_std__allocatorT_int_t_t[] = { {&_swigt__p_std__vectorT_int_std__allocatorT_int_t_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_std__vectorT_std__string_std__allocatorT_std__string_t_t[] = { {&_swigt__p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t[] = { {&_swigt__p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_std__vectorT_std__vectorT_float_std__allocatorT_float_t_t_std__allocatorT_std__vectorT_float_std__allocatorT_float_t_t_t_t[] = { {&_swigt__p_std__vectorT_std__vectorT_float_std__allocatorT_float_t_t_std__allocatorT_std__vectorT_float_std__allocatorT_float_t_t_t_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_swig__ConstIterator[] = { {&_swigt__p_swig__ConstIterator, 0, 0, 0}, {&_swigt__p_swig__Iterator, _p_swig__IteratorTo_p_swig__ConstIterator, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_swig__GC_VALUE[] = { {&_swigt__p_swig__GC_VALUE, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_swig__Iterator[] = { {&_swigt__p_swig__Iterator, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_value_type[] = { {&_swigt__p_value_type, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_void[] = { {&_swigt__p_void, 0, 0, 0},{0, 0, 0, 0}}; + +static swig_cast_info *swig_cast_initial[] = { + _swigc__p_Cdi, + _swigc__p_CdiGrid, + _swigc__p_CdiTaxis, + _swigc__p_CdiVariable, + _swigc__p_CdiZaxis, + _swigc__p_allocator_type, + _swigc__p_char, + _swigc__p_difference_type, + _swigc__p_double, + _swigc__p_float, + _swigc__p_key_type, + _swigc__p_mapped_type, + _swigc__p_p_double, + _swigc__p_p_void, + _swigc__p_size_type, + _swigc__p_std__allocatorT_CdiVariable_t, + _swigc__p_std__allocatorT_double_t, + _swigc__p_std__allocatorT_int_t, + _swigc__p_std__allocatorT_std__pairT_int_const_CdiGrid_t_t, + _swigc__p_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t, + _swigc__p_std__allocatorT_std__pairT_int_const_CdiVariable_t_t, + _swigc__p_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t, + _swigc__p_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t, + _swigc__p_std__allocatorT_std__string_t, + _swigc__p_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t, + _swigc__p_std__lessT_int_t, + _swigc__p_std__lessT_std__string_t, + _swigc__p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, + _swigc__p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t__iterator, + _swigc__p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t__reverse_iterator, + _swigc__p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, + _swigc__p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t__iterator, + _swigc__p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t__reverse_iterator, + _swigc__p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, + _swigc__p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t__iterator, + _swigc__p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t__reverse_iterator, + _swigc__p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, + _swigc__p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t__iterator, + _swigc__p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t__reverse_iterator, + _swigc__p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, + _swigc__p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t__iterator, + _swigc__p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t__reverse_iterator, + _swigc__p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, + _swigc__p_std__vectorT_double_std__allocatorT_double_t_t, + _swigc__p_std__vectorT_float_std__allocatorT_float_t_t, + _swigc__p_std__vectorT_int_std__allocatorT_int_t_t, + _swigc__p_std__vectorT_std__string_std__allocatorT_std__string_t_t, + _swigc__p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, + _swigc__p_std__vectorT_std__vectorT_float_std__allocatorT_float_t_t_std__allocatorT_std__vectorT_float_std__allocatorT_float_t_t_t_t, + _swigc__p_swig__ConstIterator, + _swigc__p_swig__GC_VALUE, + _swigc__p_swig__Iterator, + _swigc__p_value_type, + _swigc__p_void, +}; + + +/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */ + +/* ----------------------------------------------------------------------------- + * Type initialization: + * This problem is tough by the requirement that no dynamic + * memory is used. Also, since swig_type_info structures store pointers to + * swig_cast_info structures and swig_cast_info structures store pointers back + * to swig_type_info structures, we need some lookup code at initialization. + * The idea is that swig generates all the structures that are needed. + * The runtime then collects these partially filled structures. + * The SWIG_InitializeModule function takes these initial arrays out of + * swig_module, and does all the lookup, filling in the swig_module.types + * array with the correct data and linking the correct swig_cast_info + * structures together. + * + * The generated swig_type_info structures are assigned statically to an initial + * array. We just loop through that array, and handle each type individually. + * First we lookup if this type has been already loaded, and if so, use the + * loaded structure instead of the generated one. Then we have to fill in the + * cast linked list. The cast data is initially stored in something like a + * two-dimensional array. Each row corresponds to a type (there are the same + * number of rows as there are in the swig_type_initial array). Each entry in + * a column is one of the swig_cast_info structures for that type. + * The cast_initial array is actually an array of arrays, because each row has + * a variable number of columns. So to actually build the cast linked list, + * we find the array of casts associated with the type, and loop through it + * adding the casts to the list. The one last trick we need to do is making + * sure the type pointer in the swig_cast_info struct is correct. + * + * First off, we lookup the cast->type name to see if it is already loaded. + * There are three cases to handle: + * 1) If the cast->type has already been loaded AND the type we are adding + * casting info to has not been loaded (it is in this module), THEN we + * replace the cast->type pointer with the type pointer that has already + * been loaded. + * 2) If BOTH types (the one we are adding casting info to, and the + * cast->type) are loaded, THEN the cast info has already been loaded by + * the previous module so we just ignore it. + * 3) Finally, if cast->type has not already been loaded, then we add that + * swig_cast_info to the linked list (because the cast->type) pointer will + * be correct. + * ----------------------------------------------------------------------------- */ + +#ifdef __cplusplus +extern "C" { +#if 0 +} /* c-mode */ +#endif +#endif + +#if 0 +#define SWIGRUNTIME_DEBUG +#endif + + +SWIGRUNTIME void +SWIG_InitializeModule(void *clientdata) { + size_t i; + swig_module_info *module_head, *iter; + int init; + + /* check to see if the circular list has been setup, if not, set it up */ + if (swig_module.next==0) { + /* Initialize the swig_module */ + swig_module.type_initial = swig_type_initial; + swig_module.cast_initial = swig_cast_initial; + swig_module.next = &swig_module; + init = 1; + } else { + init = 0; + } + + /* Try and load any already created modules */ + module_head = SWIG_GetModule(clientdata); + if (!module_head) { + /* This is the first module loaded for this interpreter */ + /* so set the swig module into the interpreter */ + SWIG_SetModule(clientdata, &swig_module); + } else { + /* the interpreter has loaded a SWIG module, but has it loaded this one? */ + iter=module_head; + do { + if (iter==&swig_module) { + /* Our module is already in the list, so there's nothing more to do. */ + return; + } + iter=iter->next; + } while (iter!= module_head); + + /* otherwise we must add our module into the list */ + swig_module.next = module_head->next; + module_head->next = &swig_module; + } + + /* When multiple interpreters are used, a module could have already been initialized in + a different interpreter, but not yet have a pointer in this interpreter. + In this case, we do not want to continue adding types... everything should be + set up already */ + if (init == 0) return; + + /* Now work on filling in swig_module.types */ +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: size %lu\n", (unsigned long)swig_module.size); +#endif + for (i = 0; i < swig_module.size; ++i) { + swig_type_info *type = 0; + swig_type_info *ret; + swig_cast_info *cast; + +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: type %lu %s\n", (unsigned long)i, swig_module.type_initial[i]->name); +#endif + + /* if there is another module already loaded */ + if (swig_module.next != &swig_module) { + type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name); + } + if (type) { + /* Overwrite clientdata field */ +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: found type %s\n", type->name); +#endif + if (swig_module.type_initial[i]->clientdata) { + type->clientdata = swig_module.type_initial[i]->clientdata; +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name); +#endif + } + } else { + type = swig_module.type_initial[i]; + } + + /* Insert casting types */ + cast = swig_module.cast_initial[i]; + while (cast->type) { + + /* Don't need to add information already in the list */ + ret = 0; +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: look cast %s\n", cast->type->name); +#endif + if (swig_module.next != &swig_module) { + ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name); +#ifdef SWIGRUNTIME_DEBUG + if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name); +#endif + } + if (ret) { + if (type == swig_module.type_initial[i]) { +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: skip old type %s\n", ret->name); +#endif + cast->type = ret; + ret = 0; + } else { + /* Check for casting already in the list */ + swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type); +#ifdef SWIGRUNTIME_DEBUG + if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name); +#endif + if (!ocast) ret = 0; + } + } + + if (!ret) { +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name); +#endif + if (type->cast) { + type->cast->prev = cast; + cast->next = type->cast; + } + type->cast = cast; + } + cast++; + } + /* Set entry in modules->types array equal to the type */ + swig_module.types[i] = type; + } + swig_module.types[i] = 0; + +#ifdef SWIGRUNTIME_DEBUG + printf("**** SWIG_InitializeModule: Cast List ******\n"); + for (i = 0; i < swig_module.size; ++i) { + int j = 0; + swig_cast_info *cast = swig_module.cast_initial[i]; + printf("SWIG_InitializeModule: type %lu %s\n", (unsigned long)i, swig_module.type_initial[i]->name); + while (cast->type) { + printf("SWIG_InitializeModule: cast type %s\n", cast->type->name); + cast++; + ++j; + } + printf("---- Total casts: %d\n",j); + } + printf("**** SWIG_InitializeModule: Cast List ******\n"); +#endif +} + +/* This function will propagate the clientdata field of type to +* any new swig_type_info structures that have been added into the list +* of equivalent types. It is like calling +* SWIG_TypeClientData(type, clientdata) a second time. +*/ +SWIGRUNTIME void +SWIG_PropagateClientData(void) { + size_t i; + swig_cast_info *equiv; + static int init_run = 0; + + if (init_run) return; + init_run = 1; + + for (i = 0; i < swig_module.size; i++) { + if (swig_module.types[i]->clientdata) { + equiv = swig_module.types[i]->cast; + while (equiv) { + if (!equiv->converter) { + if (equiv->type && !equiv->type->clientdata) + SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata); + } + equiv = equiv->next; + } + } + } +} + +#ifdef __cplusplus +#if 0 +{ /* c-mode */ +#endif +} +#endif + +/* + +*/ +#ifdef __cplusplus +extern "C" +#endif +SWIGEXPORT void Init_Cdi(void) { + size_t i; + + SWIG_InitRuntime(); + + SWIG_InitializeModule(0); + for (i = 0; i < swig_module.size; i++) { + SWIG_define_class(swig_module.types[i]); + } + + SWIG_RubyInitializeTrackings(); + + SwigClassGC_VALUE.klass = rb_define_class("GC_VALUE", rb_cObject); + SWIG_TypeClientData(SWIGTYPE_p_swig__GC_VALUE, (void *) &SwigClassGC_VALUE); + rb_undef_alloc_func(SwigClassGC_VALUE.klass); + rb_define_method(SwigClassGC_VALUE.klass, "inspect", VALUEFUNC(_wrap_GC_VALUE_inspect), -1); + rb_define_method(SwigClassGC_VALUE.klass, "to_s", VALUEFUNC(_wrap_GC_VALUE_to_s), -1); + SwigClassGC_VALUE.mark = 0; + SwigClassGC_VALUE.trackObjects = 0; + + swig::SwigGCReferences::initialize(); + + + SwigClassConstIterator.klass = rb_define_class("ConstIterator", rb_cObject); + SWIG_TypeClientData(SWIGTYPE_p_swig__ConstIterator, (void *) &SwigClassConstIterator); + rb_undef_alloc_func(SwigClassConstIterator.klass); + rb_define_method(SwigClassConstIterator.klass, "value", VALUEFUNC(_wrap_ConstIterator_value), -1); + rb_define_method(SwigClassConstIterator.klass, "dup", VALUEFUNC(_wrap_ConstIterator_dup), -1); + rb_define_method(SwigClassConstIterator.klass, "inspect", VALUEFUNC(_wrap_ConstIterator_inspect), -1); + rb_define_method(SwigClassConstIterator.klass, "to_s", VALUEFUNC(_wrap_ConstIterator_to_s), -1); + rb_define_method(SwigClassConstIterator.klass, "next", VALUEFUNC(_wrap_ConstIterator_next), -1); + rb_define_method(SwigClassConstIterator.klass, "previous", VALUEFUNC(_wrap_ConstIterator_previous), -1); + rb_define_method(SwigClassConstIterator.klass, "==", VALUEFUNC(_wrap_ConstIterator___eq__), -1); + rb_define_method(SwigClassConstIterator.klass, "+", VALUEFUNC(_wrap_ConstIterator___add__), -1); + rb_define_method(SwigClassConstIterator.klass, "-", VALUEFUNC(_wrap_ConstIterator___sub__), -1); + SwigClassConstIterator.mark = 0; + SwigClassConstIterator.destroy = (void (*)(void *)) free_swig_ConstIterator; + SwigClassConstIterator.trackObjects = 0; + + SwigClassIterator.klass = rb_define_class("Iterator", ((swig_class *) SWIGTYPE_p_swig__ConstIterator->clientdata)->klass); + SWIG_TypeClientData(SWIGTYPE_p_swig__Iterator, (void *) &SwigClassIterator); + rb_undef_alloc_func(SwigClassIterator.klass); + rb_define_method(SwigClassIterator.klass, "value=", VALUEFUNC(_wrap_Iterator_valuee___), -1); + rb_define_method(SwigClassIterator.klass, "dup", VALUEFUNC(_wrap_Iterator_dup), -1); + rb_define_method(SwigClassIterator.klass, "next", VALUEFUNC(_wrap_Iterator_next), -1); + rb_define_method(SwigClassIterator.klass, "previous", VALUEFUNC(_wrap_Iterator_previous), -1); + rb_define_method(SwigClassIterator.klass, "inspect", VALUEFUNC(_wrap_Iterator_inspect), -1); + rb_define_method(SwigClassIterator.klass, "to_s", VALUEFUNC(_wrap_Iterator_to_s), -1); + rb_define_method(SwigClassIterator.klass, "==", VALUEFUNC(_wrap_Iterator___eq__), -1); + rb_define_method(SwigClassIterator.klass, "+", VALUEFUNC(_wrap_Iterator___add__), -1); + rb_define_method(SwigClassIterator.klass, "-", VALUEFUNC(_wrap_Iterator___sub__), -1); + SwigClassIterator.mark = 0; + SwigClassIterator.destroy = (void (*)(void *)) free_swig_Iterator; + SwigClassIterator.trackObjects = 0; + + SwigClassIntVector.klass = rb_define_class("IntVector", rb_cObject); + SWIG_TypeClientData(SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, (void *) &SwigClassIntVector); + rb_include_module(SwigClassIntVector.klass, rb_eval_string("Enumerable")); + rb_define_alloc_func(SwigClassIntVector.klass, _wrap_IntVector_allocate); + rb_define_method(SwigClassIntVector.klass, "initialize", VALUEFUNC(_wrap_new_IntVector), -1); + rb_define_method(SwigClassIntVector.klass, "dup", VALUEFUNC(_wrap_IntVector_dup), -1); + rb_define_method(SwigClassIntVector.klass, "inspect", VALUEFUNC(_wrap_IntVector_inspect), -1); + rb_define_method(SwigClassIntVector.klass, "to_a", VALUEFUNC(_wrap_IntVector_to_a), -1); + rb_define_method(SwigClassIntVector.klass, "to_s", VALUEFUNC(_wrap_IntVector_to_s), -1); + rb_define_method(SwigClassIntVector.klass, "slice", VALUEFUNC(_wrap_IntVector_slice), -1); + rb_define_method(SwigClassIntVector.klass, "each", VALUEFUNC(_wrap_IntVector_each), -1); + rb_define_method(SwigClassIntVector.klass, "__delete2__", VALUEFUNC(_wrap_IntVector___delete2__), -1); + rb_define_method(SwigClassIntVector.klass, "select", VALUEFUNC(_wrap_IntVector_select), -1); + rb_define_method(SwigClassIntVector.klass, "delete_at", VALUEFUNC(_wrap_IntVector_delete_at), -1); + rb_define_method(SwigClassIntVector.klass, "at", VALUEFUNC(_wrap_IntVector_at), -1); + rb_define_method(SwigClassIntVector.klass, "[]", VALUEFUNC(_wrap_IntVector___getitem__), -1); + rb_define_method(SwigClassIntVector.klass, "[]=", VALUEFUNC(_wrap_IntVector___setitem__), -1); + rb_define_method(SwigClassIntVector.klass, "reject!", VALUEFUNC(_wrap_IntVector_rejectN___), -1); + rb_define_alias(SwigClassIntVector.klass, "delete_if", "reject!"); + rb_define_method(SwigClassIntVector.klass, "pop", VALUEFUNC(_wrap_IntVector_pop), -1); + rb_define_method(SwigClassIntVector.klass, "push", VALUEFUNC(_wrap_IntVector_push), -1); + rb_define_alias(SwigClassIntVector.klass, "<<", "push"); + rb_define_method(SwigClassIntVector.klass, "reject", VALUEFUNC(_wrap_IntVector_reject), -1); + rb_define_method(SwigClassIntVector.klass, "shift", VALUEFUNC(_wrap_IntVector_shift), -1); + rb_define_method(SwigClassIntVector.klass, "unshift", VALUEFUNC(_wrap_IntVector_unshift), -1); + rb_define_method(SwigClassIntVector.klass, "empty?", VALUEFUNC(_wrap_IntVector_emptyq___), -1); + rb_define_method(SwigClassIntVector.klass, "size", VALUEFUNC(_wrap_IntVector_size), -1); + rb_define_method(SwigClassIntVector.klass, "swap", VALUEFUNC(_wrap_IntVector_swap), -1); + rb_define_method(SwigClassIntVector.klass, "begin", VALUEFUNC(_wrap_IntVector_begin), -1); + rb_define_method(SwigClassIntVector.klass, "end", VALUEFUNC(_wrap_IntVector_end), -1); + rb_define_method(SwigClassIntVector.klass, "rbegin", VALUEFUNC(_wrap_IntVector_rbegin), -1); + rb_define_method(SwigClassIntVector.klass, "rend", VALUEFUNC(_wrap_IntVector_rend), -1); + rb_define_method(SwigClassIntVector.klass, "clear", VALUEFUNC(_wrap_IntVector_clear), -1); + rb_define_method(SwigClassIntVector.klass, "get_allocator", VALUEFUNC(_wrap_IntVector_get_allocator), -1); + rb_define_method(SwigClassIntVector.klass, "erase", VALUEFUNC(_wrap_IntVector_erase), -1); + rb_define_method(SwigClassIntVector.klass, "front", VALUEFUNC(_wrap_IntVector_front), -1); + rb_define_method(SwigClassIntVector.klass, "back", VALUEFUNC(_wrap_IntVector_back), -1); + rb_define_method(SwigClassIntVector.klass, "assign", VALUEFUNC(_wrap_IntVector_assign), -1); + rb_define_method(SwigClassIntVector.klass, "resize", VALUEFUNC(_wrap_IntVector_resize), -1); + rb_define_method(SwigClassIntVector.klass, "insert", VALUEFUNC(_wrap_IntVector_insert), -1); + rb_define_method(SwigClassIntVector.klass, "reserve", VALUEFUNC(_wrap_IntVector_reserve), -1); + rb_define_method(SwigClassIntVector.klass, "capacity", VALUEFUNC(_wrap_IntVector_capacity), -1); + rb_define_method(SwigClassIntVector.klass, "map!", VALUEFUNC(_wrap_IntVector_mapN___), -1); + rb_define_method(SwigClassIntVector.klass, "delete", VALUEFUNC(_wrap_IntVector_delete), -1); + SwigClassIntVector.mark = 0; + SwigClassIntVector.destroy = (void (*)(void *)) free_std_vector_Sl_int_Sg_; + SwigClassIntVector.trackObjects = 0; + + SwigClassDoubleVector.klass = rb_define_class("DoubleVector", rb_cObject); + SWIG_TypeClientData(SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, (void *) &SwigClassDoubleVector); + rb_include_module(SwigClassDoubleVector.klass, rb_eval_string("Enumerable")); + rb_define_alloc_func(SwigClassDoubleVector.klass, _wrap_DoubleVector_allocate); + rb_define_method(SwigClassDoubleVector.klass, "initialize", VALUEFUNC(_wrap_new_DoubleVector), -1); + rb_define_method(SwigClassDoubleVector.klass, "dup", VALUEFUNC(_wrap_DoubleVector_dup), -1); + rb_define_method(SwigClassDoubleVector.klass, "inspect", VALUEFUNC(_wrap_DoubleVector_inspect), -1); + rb_define_method(SwigClassDoubleVector.klass, "to_a", VALUEFUNC(_wrap_DoubleVector_to_a), -1); + rb_define_method(SwigClassDoubleVector.klass, "to_s", VALUEFUNC(_wrap_DoubleVector_to_s), -1); + rb_define_method(SwigClassDoubleVector.klass, "slice", VALUEFUNC(_wrap_DoubleVector_slice), -1); + rb_define_method(SwigClassDoubleVector.klass, "each", VALUEFUNC(_wrap_DoubleVector_each), -1); + rb_define_method(SwigClassDoubleVector.klass, "__delete2__", VALUEFUNC(_wrap_DoubleVector___delete2__), -1); + rb_define_method(SwigClassDoubleVector.klass, "select", VALUEFUNC(_wrap_DoubleVector_select), -1); + rb_define_method(SwigClassDoubleVector.klass, "delete_at", VALUEFUNC(_wrap_DoubleVector_delete_at), -1); + rb_define_method(SwigClassDoubleVector.klass, "at", VALUEFUNC(_wrap_DoubleVector_at), -1); + rb_define_method(SwigClassDoubleVector.klass, "[]", VALUEFUNC(_wrap_DoubleVector___getitem__), -1); + rb_define_method(SwigClassDoubleVector.klass, "[]=", VALUEFUNC(_wrap_DoubleVector___setitem__), -1); + rb_define_method(SwigClassDoubleVector.klass, "reject!", VALUEFUNC(_wrap_DoubleVector_rejectN___), -1); + rb_define_alias(SwigClassDoubleVector.klass, "delete_if", "reject!"); + rb_define_method(SwigClassDoubleVector.klass, "pop", VALUEFUNC(_wrap_DoubleVector_pop), -1); + rb_define_method(SwigClassDoubleVector.klass, "push", VALUEFUNC(_wrap_DoubleVector_push), -1); + rb_define_alias(SwigClassDoubleVector.klass, "<<", "push"); + rb_define_method(SwigClassDoubleVector.klass, "reject", VALUEFUNC(_wrap_DoubleVector_reject), -1); + rb_define_method(SwigClassDoubleVector.klass, "shift", VALUEFUNC(_wrap_DoubleVector_shift), -1); + rb_define_method(SwigClassDoubleVector.klass, "unshift", VALUEFUNC(_wrap_DoubleVector_unshift), -1); + rb_define_method(SwigClassDoubleVector.klass, "empty?", VALUEFUNC(_wrap_DoubleVector_emptyq___), -1); + rb_define_method(SwigClassDoubleVector.klass, "size", VALUEFUNC(_wrap_DoubleVector_size), -1); + rb_define_method(SwigClassDoubleVector.klass, "swap", VALUEFUNC(_wrap_DoubleVector_swap), -1); + rb_define_method(SwigClassDoubleVector.klass, "begin", VALUEFUNC(_wrap_DoubleVector_begin), -1); + rb_define_method(SwigClassDoubleVector.klass, "end", VALUEFUNC(_wrap_DoubleVector_end), -1); + rb_define_method(SwigClassDoubleVector.klass, "rbegin", VALUEFUNC(_wrap_DoubleVector_rbegin), -1); + rb_define_method(SwigClassDoubleVector.klass, "rend", VALUEFUNC(_wrap_DoubleVector_rend), -1); + rb_define_method(SwigClassDoubleVector.klass, "clear", VALUEFUNC(_wrap_DoubleVector_clear), -1); + rb_define_method(SwigClassDoubleVector.klass, "get_allocator", VALUEFUNC(_wrap_DoubleVector_get_allocator), -1); + rb_define_method(SwigClassDoubleVector.klass, "erase", VALUEFUNC(_wrap_DoubleVector_erase), -1); + rb_define_method(SwigClassDoubleVector.klass, "front", VALUEFUNC(_wrap_DoubleVector_front), -1); + rb_define_method(SwigClassDoubleVector.klass, "back", VALUEFUNC(_wrap_DoubleVector_back), -1); + rb_define_method(SwigClassDoubleVector.klass, "assign", VALUEFUNC(_wrap_DoubleVector_assign), -1); + rb_define_method(SwigClassDoubleVector.klass, "resize", VALUEFUNC(_wrap_DoubleVector_resize), -1); + rb_define_method(SwigClassDoubleVector.klass, "insert", VALUEFUNC(_wrap_DoubleVector_insert), -1); + rb_define_method(SwigClassDoubleVector.klass, "reserve", VALUEFUNC(_wrap_DoubleVector_reserve), -1); + rb_define_method(SwigClassDoubleVector.klass, "capacity", VALUEFUNC(_wrap_DoubleVector_capacity), -1); + rb_define_method(SwigClassDoubleVector.klass, "map!", VALUEFUNC(_wrap_DoubleVector_mapN___), -1); + rb_define_method(SwigClassDoubleVector.klass, "delete", VALUEFUNC(_wrap_DoubleVector_delete), -1); + SwigClassDoubleVector.mark = 0; + SwigClassDoubleVector.destroy = (void (*)(void *)) free_std_vector_Sl_double_Sg_; + SwigClassDoubleVector.trackObjects = 0; + + SwigClassDoubleDoubleVector.klass = rb_define_class("DoubleDoubleVector", rb_cObject); + SWIG_TypeClientData(SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, (void *) &SwigClassDoubleDoubleVector); + rb_include_module(SwigClassDoubleDoubleVector.klass, rb_eval_string("Enumerable")); + rb_define_alloc_func(SwigClassDoubleDoubleVector.klass, _wrap_DoubleDoubleVector_allocate); + rb_define_method(SwigClassDoubleDoubleVector.klass, "initialize", VALUEFUNC(_wrap_new_DoubleDoubleVector), -1); + rb_define_method(SwigClassDoubleDoubleVector.klass, "dup", VALUEFUNC(_wrap_DoubleDoubleVector_dup), -1); + rb_define_method(SwigClassDoubleDoubleVector.klass, "inspect", VALUEFUNC(_wrap_DoubleDoubleVector_inspect), -1); + rb_define_method(SwigClassDoubleDoubleVector.klass, "to_a", VALUEFUNC(_wrap_DoubleDoubleVector_to_a), -1); + rb_define_method(SwigClassDoubleDoubleVector.klass, "to_s", VALUEFUNC(_wrap_DoubleDoubleVector_to_s), -1); + rb_define_method(SwigClassDoubleDoubleVector.klass, "slice", VALUEFUNC(_wrap_DoubleDoubleVector_slice), -1); + rb_define_method(SwigClassDoubleDoubleVector.klass, "each", VALUEFUNC(_wrap_DoubleDoubleVector_each), -1); + rb_define_method(SwigClassDoubleDoubleVector.klass, "__delete2__", VALUEFUNC(_wrap_DoubleDoubleVector___delete2__), -1); + rb_define_method(SwigClassDoubleDoubleVector.klass, "select", VALUEFUNC(_wrap_DoubleDoubleVector_select), -1); + rb_define_method(SwigClassDoubleDoubleVector.klass, "delete_at", VALUEFUNC(_wrap_DoubleDoubleVector_delete_at), -1); + rb_define_method(SwigClassDoubleDoubleVector.klass, "at", VALUEFUNC(_wrap_DoubleDoubleVector_at), -1); + rb_define_method(SwigClassDoubleDoubleVector.klass, "[]", VALUEFUNC(_wrap_DoubleDoubleVector___getitem__), -1); + rb_define_method(SwigClassDoubleDoubleVector.klass, "[]=", VALUEFUNC(_wrap_DoubleDoubleVector___setitem__), -1); + rb_define_method(SwigClassDoubleDoubleVector.klass, "reject!", VALUEFUNC(_wrap_DoubleDoubleVector_rejectN___), -1); + rb_define_alias(SwigClassDoubleDoubleVector.klass, "delete_if", "reject!"); + rb_define_method(SwigClassDoubleDoubleVector.klass, "pop", VALUEFUNC(_wrap_DoubleDoubleVector_pop), -1); + rb_define_method(SwigClassDoubleDoubleVector.klass, "push", VALUEFUNC(_wrap_DoubleDoubleVector_push), -1); + rb_define_alias(SwigClassDoubleDoubleVector.klass, "<<", "push"); + rb_define_method(SwigClassDoubleDoubleVector.klass, "reject", VALUEFUNC(_wrap_DoubleDoubleVector_reject), -1); + rb_define_method(SwigClassDoubleDoubleVector.klass, "shift", VALUEFUNC(_wrap_DoubleDoubleVector_shift), -1); + rb_define_method(SwigClassDoubleDoubleVector.klass, "unshift", VALUEFUNC(_wrap_DoubleDoubleVector_unshift), -1); + rb_define_method(SwigClassDoubleDoubleVector.klass, "empty?", VALUEFUNC(_wrap_DoubleDoubleVector_emptyq___), -1); + rb_define_method(SwigClassDoubleDoubleVector.klass, "size", VALUEFUNC(_wrap_DoubleDoubleVector_size), -1); + rb_define_method(SwigClassDoubleDoubleVector.klass, "swap", VALUEFUNC(_wrap_DoubleDoubleVector_swap), -1); + rb_define_method(SwigClassDoubleDoubleVector.klass, "begin", VALUEFUNC(_wrap_DoubleDoubleVector_begin), -1); + rb_define_method(SwigClassDoubleDoubleVector.klass, "end", VALUEFUNC(_wrap_DoubleDoubleVector_end), -1); + rb_define_method(SwigClassDoubleDoubleVector.klass, "rbegin", VALUEFUNC(_wrap_DoubleDoubleVector_rbegin), -1); + rb_define_method(SwigClassDoubleDoubleVector.klass, "rend", VALUEFUNC(_wrap_DoubleDoubleVector_rend), -1); + rb_define_method(SwigClassDoubleDoubleVector.klass, "clear", VALUEFUNC(_wrap_DoubleDoubleVector_clear), -1); + rb_define_method(SwigClassDoubleDoubleVector.klass, "get_allocator", VALUEFUNC(_wrap_DoubleDoubleVector_get_allocator), -1); + rb_define_method(SwigClassDoubleDoubleVector.klass, "erase", VALUEFUNC(_wrap_DoubleDoubleVector_erase), -1); + rb_define_method(SwigClassDoubleDoubleVector.klass, "front", VALUEFUNC(_wrap_DoubleDoubleVector_front), -1); + rb_define_method(SwigClassDoubleDoubleVector.klass, "back", VALUEFUNC(_wrap_DoubleDoubleVector_back), -1); + rb_define_method(SwigClassDoubleDoubleVector.klass, "assign", VALUEFUNC(_wrap_DoubleDoubleVector_assign), -1); + rb_define_method(SwigClassDoubleDoubleVector.klass, "resize", VALUEFUNC(_wrap_DoubleDoubleVector_resize), -1); + rb_define_method(SwigClassDoubleDoubleVector.klass, "insert", VALUEFUNC(_wrap_DoubleDoubleVector_insert), -1); + rb_define_method(SwigClassDoubleDoubleVector.klass, "reserve", VALUEFUNC(_wrap_DoubleDoubleVector_reserve), -1); + rb_define_method(SwigClassDoubleDoubleVector.klass, "capacity", VALUEFUNC(_wrap_DoubleDoubleVector_capacity), -1); + SwigClassDoubleDoubleVector.mark = 0; + SwigClassDoubleDoubleVector.destroy = (void (*)(void *)) free_std_vector_Sl_std_vector_Sl_double_Sg__Sg_; + SwigClassDoubleDoubleVector.trackObjects = 0; + + SwigClassStringVector.klass = rb_define_class("StringVector", rb_cObject); + SWIG_TypeClientData(SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, (void *) &SwigClassStringVector); + rb_include_module(SwigClassStringVector.klass, rb_eval_string("Enumerable")); + rb_define_alloc_func(SwigClassStringVector.klass, _wrap_StringVector_allocate); + rb_define_method(SwigClassStringVector.klass, "initialize", VALUEFUNC(_wrap_new_StringVector), -1); + rb_define_method(SwigClassStringVector.klass, "dup", VALUEFUNC(_wrap_StringVector_dup), -1); + rb_define_method(SwigClassStringVector.klass, "inspect", VALUEFUNC(_wrap_StringVector_inspect), -1); + rb_define_method(SwigClassStringVector.klass, "to_a", VALUEFUNC(_wrap_StringVector_to_a), -1); + rb_define_method(SwigClassStringVector.klass, "to_s", VALUEFUNC(_wrap_StringVector_to_s), -1); + rb_define_method(SwigClassStringVector.klass, "slice", VALUEFUNC(_wrap_StringVector_slice), -1); + rb_define_method(SwigClassStringVector.klass, "each", VALUEFUNC(_wrap_StringVector_each), -1); + rb_define_method(SwigClassStringVector.klass, "__delete2__", VALUEFUNC(_wrap_StringVector___delete2__), -1); + rb_define_method(SwigClassStringVector.klass, "select", VALUEFUNC(_wrap_StringVector_select), -1); + rb_define_method(SwigClassStringVector.klass, "delete_at", VALUEFUNC(_wrap_StringVector_delete_at), -1); + rb_define_method(SwigClassStringVector.klass, "at", VALUEFUNC(_wrap_StringVector_at), -1); + rb_define_method(SwigClassStringVector.klass, "[]", VALUEFUNC(_wrap_StringVector___getitem__), -1); + rb_define_method(SwigClassStringVector.klass, "[]=", VALUEFUNC(_wrap_StringVector___setitem__), -1); + rb_define_method(SwigClassStringVector.klass, "reject!", VALUEFUNC(_wrap_StringVector_rejectN___), -1); + rb_define_alias(SwigClassStringVector.klass, "delete_if", "reject!"); + rb_define_method(SwigClassStringVector.klass, "pop", VALUEFUNC(_wrap_StringVector_pop), -1); + rb_define_method(SwigClassStringVector.klass, "push", VALUEFUNC(_wrap_StringVector_push), -1); + rb_define_alias(SwigClassStringVector.klass, "<<", "push"); + rb_define_method(SwigClassStringVector.klass, "reject", VALUEFUNC(_wrap_StringVector_reject), -1); + rb_define_method(SwigClassStringVector.klass, "shift", VALUEFUNC(_wrap_StringVector_shift), -1); + rb_define_method(SwigClassStringVector.klass, "unshift", VALUEFUNC(_wrap_StringVector_unshift), -1); + rb_define_method(SwigClassStringVector.klass, "empty?", VALUEFUNC(_wrap_StringVector_emptyq___), -1); + rb_define_method(SwigClassStringVector.klass, "size", VALUEFUNC(_wrap_StringVector_size), -1); + rb_define_method(SwigClassStringVector.klass, "swap", VALUEFUNC(_wrap_StringVector_swap), -1); + rb_define_method(SwigClassStringVector.klass, "begin", VALUEFUNC(_wrap_StringVector_begin), -1); + rb_define_method(SwigClassStringVector.klass, "end", VALUEFUNC(_wrap_StringVector_end), -1); + rb_define_method(SwigClassStringVector.klass, "rbegin", VALUEFUNC(_wrap_StringVector_rbegin), -1); + rb_define_method(SwigClassStringVector.klass, "rend", VALUEFUNC(_wrap_StringVector_rend), -1); + rb_define_method(SwigClassStringVector.klass, "clear", VALUEFUNC(_wrap_StringVector_clear), -1); + rb_define_method(SwigClassStringVector.klass, "get_allocator", VALUEFUNC(_wrap_StringVector_get_allocator), -1); + rb_define_method(SwigClassStringVector.klass, "erase", VALUEFUNC(_wrap_StringVector_erase), -1); + rb_define_method(SwigClassStringVector.klass, "front", VALUEFUNC(_wrap_StringVector_front), -1); + rb_define_method(SwigClassStringVector.klass, "back", VALUEFUNC(_wrap_StringVector_back), -1); + rb_define_method(SwigClassStringVector.klass, "assign", VALUEFUNC(_wrap_StringVector_assign), -1); + rb_define_method(SwigClassStringVector.klass, "resize", VALUEFUNC(_wrap_StringVector_resize), -1); + rb_define_method(SwigClassStringVector.klass, "insert", VALUEFUNC(_wrap_StringVector_insert), -1); + rb_define_method(SwigClassStringVector.klass, "reserve", VALUEFUNC(_wrap_StringVector_reserve), -1); + rb_define_method(SwigClassStringVector.klass, "capacity", VALUEFUNC(_wrap_StringVector_capacity), -1); + rb_define_method(SwigClassStringVector.klass, "map!", VALUEFUNC(_wrap_StringVector_mapN___), -1); + rb_define_method(SwigClassStringVector.klass, "delete", VALUEFUNC(_wrap_StringVector_delete), -1); + SwigClassStringVector.mark = 0; + SwigClassStringVector.destroy = (void (*)(void *)) free_std_vector_Sl_std_string_Sg_; + SwigClassStringVector.trackObjects = 0; + + SwigClassVarsVector.klass = rb_define_class("VarsVector", rb_cObject); + SWIG_TypeClientData(SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, (void *) &SwigClassVarsVector); + rb_include_module(SwigClassVarsVector.klass, rb_eval_string("Enumerable")); + rb_define_alloc_func(SwigClassVarsVector.klass, _wrap_VarsVector_allocate); + rb_define_method(SwigClassVarsVector.klass, "initialize", VALUEFUNC(_wrap_new_VarsVector), -1); + rb_define_method(SwigClassVarsVector.klass, "dup", VALUEFUNC(_wrap_VarsVector_dup), -1); + rb_define_method(SwigClassVarsVector.klass, "inspect", VALUEFUNC(_wrap_VarsVector_inspect), -1); + rb_define_method(SwigClassVarsVector.klass, "to_a", VALUEFUNC(_wrap_VarsVector_to_a), -1); + rb_define_method(SwigClassVarsVector.klass, "to_s", VALUEFUNC(_wrap_VarsVector_to_s), -1); + rb_define_method(SwigClassVarsVector.klass, "slice", VALUEFUNC(_wrap_VarsVector_slice), -1); + rb_define_method(SwigClassVarsVector.klass, "each", VALUEFUNC(_wrap_VarsVector_each), -1); + rb_define_method(SwigClassVarsVector.klass, "__delete2__", VALUEFUNC(_wrap_VarsVector___delete2__), -1); + rb_define_method(SwigClassVarsVector.klass, "select", VALUEFUNC(_wrap_VarsVector_select), -1); + rb_define_method(SwigClassVarsVector.klass, "delete_at", VALUEFUNC(_wrap_VarsVector_delete_at), -1); + rb_define_method(SwigClassVarsVector.klass, "at", VALUEFUNC(_wrap_VarsVector_at), -1); + rb_define_method(SwigClassVarsVector.klass, "[]", VALUEFUNC(_wrap_VarsVector___getitem__), -1); + rb_define_method(SwigClassVarsVector.klass, "[]=", VALUEFUNC(_wrap_VarsVector___setitem__), -1); + rb_define_method(SwigClassVarsVector.klass, "reject!", VALUEFUNC(_wrap_VarsVector_rejectN___), -1); + rb_define_alias(SwigClassVarsVector.klass, "delete_if", "reject!"); + rb_define_method(SwigClassVarsVector.klass, "pop", VALUEFUNC(_wrap_VarsVector_pop), -1); + rb_define_method(SwigClassVarsVector.klass, "push", VALUEFUNC(_wrap_VarsVector_push), -1); + rb_define_alias(SwigClassVarsVector.klass, "<<", "push"); + rb_define_method(SwigClassVarsVector.klass, "reject", VALUEFUNC(_wrap_VarsVector_reject), -1); + rb_define_method(SwigClassVarsVector.klass, "shift", VALUEFUNC(_wrap_VarsVector_shift), -1); + rb_define_method(SwigClassVarsVector.klass, "unshift", VALUEFUNC(_wrap_VarsVector_unshift), -1); + rb_define_method(SwigClassVarsVector.klass, "empty?", VALUEFUNC(_wrap_VarsVector_emptyq___), -1); + rb_define_method(SwigClassVarsVector.klass, "size", VALUEFUNC(_wrap_VarsVector_size), -1); + rb_define_method(SwigClassVarsVector.klass, "swap", VALUEFUNC(_wrap_VarsVector_swap), -1); + rb_define_method(SwigClassVarsVector.klass, "begin", VALUEFUNC(_wrap_VarsVector_begin), -1); + rb_define_method(SwigClassVarsVector.klass, "end", VALUEFUNC(_wrap_VarsVector_end), -1); + rb_define_method(SwigClassVarsVector.klass, "rbegin", VALUEFUNC(_wrap_VarsVector_rbegin), -1); + rb_define_method(SwigClassVarsVector.klass, "rend", VALUEFUNC(_wrap_VarsVector_rend), -1); + rb_define_method(SwigClassVarsVector.klass, "clear", VALUEFUNC(_wrap_VarsVector_clear), -1); + rb_define_method(SwigClassVarsVector.klass, "get_allocator", VALUEFUNC(_wrap_VarsVector_get_allocator), -1); + rb_define_method(SwigClassVarsVector.klass, "erase", VALUEFUNC(_wrap_VarsVector_erase), -1); + rb_define_method(SwigClassVarsVector.klass, "front", VALUEFUNC(_wrap_VarsVector_front), -1); + rb_define_method(SwigClassVarsVector.klass, "back", VALUEFUNC(_wrap_VarsVector_back), -1); + rb_define_method(SwigClassVarsVector.klass, "assign", VALUEFUNC(_wrap_VarsVector_assign), -1); + rb_define_method(SwigClassVarsVector.klass, "resize", VALUEFUNC(_wrap_VarsVector_resize), -1); + rb_define_method(SwigClassVarsVector.klass, "insert", VALUEFUNC(_wrap_VarsVector_insert), -1); + rb_define_method(SwigClassVarsVector.klass, "reserve", VALUEFUNC(_wrap_VarsVector_reserve), -1); + rb_define_method(SwigClassVarsVector.klass, "capacity", VALUEFUNC(_wrap_VarsVector_capacity), -1); + SwigClassVarsVector.mark = 0; + SwigClassVarsVector.destroy = (void (*)(void *)) free_std_vector_Sl_CdiVariable_Sg_; + SwigClassVarsVector.trackObjects = 0; + + SwigClassVarsMap.klass = rb_define_class("VarsMap", rb_cObject); + SWIG_TypeClientData(SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, (void *) &SwigClassVarsMap); + rb_include_module(SwigClassVarsMap.klass, rb_eval_string("Enumerable")); + rb_define_alloc_func(SwigClassVarsMap.klass, _wrap_VarsMap_allocate); + rb_define_method(SwigClassVarsMap.klass, "initialize", VALUEFUNC(_wrap_new_VarsMap), -1); + rb_define_method(SwigClassVarsMap.klass, "dup", VALUEFUNC(_wrap_VarsMap_dup), -1); + rb_define_method(SwigClassVarsMap.klass, "delete", VALUEFUNC(_wrap_VarsMap_delete), -1); + rb_define_method(SwigClassVarsMap.klass, "has_key?", VALUEFUNC(_wrap_VarsMap_has_keyq___), -1); + rb_define_method(SwigClassVarsMap.klass, "keys", VALUEFUNC(_wrap_VarsMap_keys), -1); + rb_define_method(SwigClassVarsMap.klass, "each", VALUEFUNC(_wrap_VarsMap_each), -1); + rb_define_method(SwigClassVarsMap.klass, "select", VALUEFUNC(_wrap_VarsMap_select), -1); + rb_define_method(SwigClassVarsMap.klass, "values_at", VALUEFUNC(_wrap_VarsMap_values_at), -1); + rb_define_method(SwigClassVarsMap.klass, "each_key", VALUEFUNC(_wrap_VarsMap_each_key), -1); + rb_define_method(SwigClassVarsMap.klass, "values", VALUEFUNC(_wrap_VarsMap_values), -1); + rb_define_method(SwigClassVarsMap.klass, "each_value", VALUEFUNC(_wrap_VarsMap_each_value), -1); + rb_define_method(SwigClassVarsMap.klass, "entries", VALUEFUNC(_wrap_VarsMap_entries), -1); + rb_define_method(SwigClassVarsMap.klass, "include?", VALUEFUNC(_wrap_VarsMap_includeq___), -1); + rb_define_method(SwigClassVarsMap.klass, "key_iterator", VALUEFUNC(_wrap_VarsMap_key_iterator), -1); + rb_define_method(SwigClassVarsMap.klass, "value_iterator", VALUEFUNC(_wrap_VarsMap_value_iterator), -1); + rb_define_method(SwigClassVarsMap.klass, "[]", VALUEFUNC(_wrap_VarsMap___getitem__), -1); + rb_define_method(SwigClassVarsMap.klass, "[]=", VALUEFUNC(_wrap_VarsMap___setitem__), -1); + rb_define_method(SwigClassVarsMap.klass, "inspect", VALUEFUNC(_wrap_VarsMap_inspect), -1); + rb_define_method(SwigClassVarsMap.klass, "to_a", VALUEFUNC(_wrap_VarsMap_to_a), -1); + rb_define_method(SwigClassVarsMap.klass, "to_s", VALUEFUNC(_wrap_VarsMap_to_s), -1); + rb_define_method(SwigClassVarsMap.klass, "empty?", VALUEFUNC(_wrap_VarsMap_emptyq___), -1); + rb_define_method(SwigClassVarsMap.klass, "size", VALUEFUNC(_wrap_VarsMap_size), -1); + rb_define_method(SwigClassVarsMap.klass, "swap", VALUEFUNC(_wrap_VarsMap_swap), -1); + rb_define_method(SwigClassVarsMap.klass, "begin", VALUEFUNC(_wrap_VarsMap_begin), -1); + rb_define_method(SwigClassVarsMap.klass, "end", VALUEFUNC(_wrap_VarsMap_end), -1); + rb_define_method(SwigClassVarsMap.klass, "rbegin", VALUEFUNC(_wrap_VarsMap_rbegin), -1); + rb_define_method(SwigClassVarsMap.klass, "rend", VALUEFUNC(_wrap_VarsMap_rend), -1); + rb_define_method(SwigClassVarsMap.klass, "clear", VALUEFUNC(_wrap_VarsMap_clear), -1); + rb_define_method(SwigClassVarsMap.klass, "get_allocator", VALUEFUNC(_wrap_VarsMap_get_allocator), -1); + rb_define_method(SwigClassVarsMap.klass, "count", VALUEFUNC(_wrap_VarsMap_count), -1); + rb_define_method(SwigClassVarsMap.klass, "erase", VALUEFUNC(_wrap_VarsMap_erase), -1); + rb_define_method(SwigClassVarsMap.klass, "find", VALUEFUNC(_wrap_VarsMap_find), -1); + rb_define_method(SwigClassVarsMap.klass, "lower_bound", VALUEFUNC(_wrap_VarsMap_lower_bound), -1); + rb_define_method(SwigClassVarsMap.klass, "upper_bound", VALUEFUNC(_wrap_VarsMap_upper_bound), -1); + SwigClassVarsMap.mark = 0; + SwigClassVarsMap.destroy = (void (*)(void *)) free_std_map_Sl_std_string_Sc_CdiVariable_Sg_; + SwigClassVarsMap.trackObjects = 0; + + SwigClassVarsByCode.klass = rb_define_class("VarsByCode", rb_cObject); + SWIG_TypeClientData(SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, (void *) &SwigClassVarsByCode); + rb_include_module(SwigClassVarsByCode.klass, rb_eval_string("Enumerable")); + rb_define_alloc_func(SwigClassVarsByCode.klass, _wrap_VarsByCode_allocate); + rb_define_method(SwigClassVarsByCode.klass, "initialize", VALUEFUNC(_wrap_new_VarsByCode), -1); + rb_define_method(SwigClassVarsByCode.klass, "dup", VALUEFUNC(_wrap_VarsByCode_dup), -1); + rb_define_method(SwigClassVarsByCode.klass, "delete", VALUEFUNC(_wrap_VarsByCode_delete), -1); + rb_define_method(SwigClassVarsByCode.klass, "has_key?", VALUEFUNC(_wrap_VarsByCode_has_keyq___), -1); + rb_define_method(SwigClassVarsByCode.klass, "keys", VALUEFUNC(_wrap_VarsByCode_keys), -1); + rb_define_method(SwigClassVarsByCode.klass, "each", VALUEFUNC(_wrap_VarsByCode_each), -1); + rb_define_method(SwigClassVarsByCode.klass, "select", VALUEFUNC(_wrap_VarsByCode_select), -1); + rb_define_method(SwigClassVarsByCode.klass, "values_at", VALUEFUNC(_wrap_VarsByCode_values_at), -1); + rb_define_method(SwigClassVarsByCode.klass, "each_key", VALUEFUNC(_wrap_VarsByCode_each_key), -1); + rb_define_method(SwigClassVarsByCode.klass, "values", VALUEFUNC(_wrap_VarsByCode_values), -1); + rb_define_method(SwigClassVarsByCode.klass, "each_value", VALUEFUNC(_wrap_VarsByCode_each_value), -1); + rb_define_method(SwigClassVarsByCode.klass, "entries", VALUEFUNC(_wrap_VarsByCode_entries), -1); + rb_define_method(SwigClassVarsByCode.klass, "include?", VALUEFUNC(_wrap_VarsByCode_includeq___), -1); + rb_define_method(SwigClassVarsByCode.klass, "key_iterator", VALUEFUNC(_wrap_VarsByCode_key_iterator), -1); + rb_define_method(SwigClassVarsByCode.klass, "value_iterator", VALUEFUNC(_wrap_VarsByCode_value_iterator), -1); + rb_define_method(SwigClassVarsByCode.klass, "[]", VALUEFUNC(_wrap_VarsByCode___getitem__), -1); + rb_define_method(SwigClassVarsByCode.klass, "[]=", VALUEFUNC(_wrap_VarsByCode___setitem__), -1); + rb_define_method(SwigClassVarsByCode.klass, "inspect", VALUEFUNC(_wrap_VarsByCode_inspect), -1); + rb_define_method(SwigClassVarsByCode.klass, "to_a", VALUEFUNC(_wrap_VarsByCode_to_a), -1); + rb_define_method(SwigClassVarsByCode.klass, "to_s", VALUEFUNC(_wrap_VarsByCode_to_s), -1); + rb_define_method(SwigClassVarsByCode.klass, "empty?", VALUEFUNC(_wrap_VarsByCode_emptyq___), -1); + rb_define_method(SwigClassVarsByCode.klass, "size", VALUEFUNC(_wrap_VarsByCode_size), -1); + rb_define_method(SwigClassVarsByCode.klass, "swap", VALUEFUNC(_wrap_VarsByCode_swap), -1); + rb_define_method(SwigClassVarsByCode.klass, "begin", VALUEFUNC(_wrap_VarsByCode_begin), -1); + rb_define_method(SwigClassVarsByCode.klass, "end", VALUEFUNC(_wrap_VarsByCode_end), -1); + rb_define_method(SwigClassVarsByCode.klass, "rbegin", VALUEFUNC(_wrap_VarsByCode_rbegin), -1); + rb_define_method(SwigClassVarsByCode.klass, "rend", VALUEFUNC(_wrap_VarsByCode_rend), -1); + rb_define_method(SwigClassVarsByCode.klass, "clear", VALUEFUNC(_wrap_VarsByCode_clear), -1); + rb_define_method(SwigClassVarsByCode.klass, "get_allocator", VALUEFUNC(_wrap_VarsByCode_get_allocator), -1); + rb_define_method(SwigClassVarsByCode.klass, "count", VALUEFUNC(_wrap_VarsByCode_count), -1); + rb_define_method(SwigClassVarsByCode.klass, "erase", VALUEFUNC(_wrap_VarsByCode_erase), -1); + rb_define_method(SwigClassVarsByCode.klass, "find", VALUEFUNC(_wrap_VarsByCode_find), -1); + rb_define_method(SwigClassVarsByCode.klass, "lower_bound", VALUEFUNC(_wrap_VarsByCode_lower_bound), -1); + rb_define_method(SwigClassVarsByCode.klass, "upper_bound", VALUEFUNC(_wrap_VarsByCode_upper_bound), -1); + SwigClassVarsByCode.mark = 0; + SwigClassVarsByCode.destroy = (void (*)(void *)) free_std_map_Sl_int_Sc_CdiVariable_Sg_; + SwigClassVarsByCode.trackObjects = 0; + + SwigClassTaxesMap.klass = rb_define_class("TaxesMap", rb_cObject); + SWIG_TypeClientData(SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, (void *) &SwigClassTaxesMap); + rb_include_module(SwigClassTaxesMap.klass, rb_eval_string("Enumerable")); + rb_define_alloc_func(SwigClassTaxesMap.klass, _wrap_TaxesMap_allocate); + rb_define_method(SwigClassTaxesMap.klass, "initialize", VALUEFUNC(_wrap_new_TaxesMap), -1); + rb_define_method(SwigClassTaxesMap.klass, "dup", VALUEFUNC(_wrap_TaxesMap_dup), -1); + rb_define_method(SwigClassTaxesMap.klass, "delete", VALUEFUNC(_wrap_TaxesMap_delete), -1); + rb_define_method(SwigClassTaxesMap.klass, "has_key?", VALUEFUNC(_wrap_TaxesMap_has_keyq___), -1); + rb_define_method(SwigClassTaxesMap.klass, "keys", VALUEFUNC(_wrap_TaxesMap_keys), -1); + rb_define_method(SwigClassTaxesMap.klass, "each", VALUEFUNC(_wrap_TaxesMap_each), -1); + rb_define_method(SwigClassTaxesMap.klass, "select", VALUEFUNC(_wrap_TaxesMap_select), -1); + rb_define_method(SwigClassTaxesMap.klass, "values_at", VALUEFUNC(_wrap_TaxesMap_values_at), -1); + rb_define_method(SwigClassTaxesMap.klass, "each_key", VALUEFUNC(_wrap_TaxesMap_each_key), -1); + rb_define_method(SwigClassTaxesMap.klass, "values", VALUEFUNC(_wrap_TaxesMap_values), -1); + rb_define_method(SwigClassTaxesMap.klass, "each_value", VALUEFUNC(_wrap_TaxesMap_each_value), -1); + rb_define_method(SwigClassTaxesMap.klass, "entries", VALUEFUNC(_wrap_TaxesMap_entries), -1); + rb_define_method(SwigClassTaxesMap.klass, "include?", VALUEFUNC(_wrap_TaxesMap_includeq___), -1); + rb_define_method(SwigClassTaxesMap.klass, "key_iterator", VALUEFUNC(_wrap_TaxesMap_key_iterator), -1); + rb_define_method(SwigClassTaxesMap.klass, "value_iterator", VALUEFUNC(_wrap_TaxesMap_value_iterator), -1); + rb_define_method(SwigClassTaxesMap.klass, "[]", VALUEFUNC(_wrap_TaxesMap___getitem__), -1); + rb_define_method(SwigClassTaxesMap.klass, "[]=", VALUEFUNC(_wrap_TaxesMap___setitem__), -1); + rb_define_method(SwigClassTaxesMap.klass, "inspect", VALUEFUNC(_wrap_TaxesMap_inspect), -1); + rb_define_method(SwigClassTaxesMap.klass, "to_a", VALUEFUNC(_wrap_TaxesMap_to_a), -1); + rb_define_method(SwigClassTaxesMap.klass, "to_s", VALUEFUNC(_wrap_TaxesMap_to_s), -1); + rb_define_method(SwigClassTaxesMap.klass, "empty?", VALUEFUNC(_wrap_TaxesMap_emptyq___), -1); + rb_define_method(SwigClassTaxesMap.klass, "size", VALUEFUNC(_wrap_TaxesMap_size), -1); + rb_define_method(SwigClassTaxesMap.klass, "swap", VALUEFUNC(_wrap_TaxesMap_swap), -1); + rb_define_method(SwigClassTaxesMap.klass, "begin", VALUEFUNC(_wrap_TaxesMap_begin), -1); + rb_define_method(SwigClassTaxesMap.klass, "end", VALUEFUNC(_wrap_TaxesMap_end), -1); + rb_define_method(SwigClassTaxesMap.klass, "rbegin", VALUEFUNC(_wrap_TaxesMap_rbegin), -1); + rb_define_method(SwigClassTaxesMap.klass, "rend", VALUEFUNC(_wrap_TaxesMap_rend), -1); + rb_define_method(SwigClassTaxesMap.klass, "clear", VALUEFUNC(_wrap_TaxesMap_clear), -1); + rb_define_method(SwigClassTaxesMap.klass, "get_allocator", VALUEFUNC(_wrap_TaxesMap_get_allocator), -1); + rb_define_method(SwigClassTaxesMap.klass, "count", VALUEFUNC(_wrap_TaxesMap_count), -1); + rb_define_method(SwigClassTaxesMap.klass, "erase", VALUEFUNC(_wrap_TaxesMap_erase), -1); + rb_define_method(SwigClassTaxesMap.klass, "find", VALUEFUNC(_wrap_TaxesMap_find), -1); + rb_define_method(SwigClassTaxesMap.klass, "lower_bound", VALUEFUNC(_wrap_TaxesMap_lower_bound), -1); + rb_define_method(SwigClassTaxesMap.klass, "upper_bound", VALUEFUNC(_wrap_TaxesMap_upper_bound), -1); + SwigClassTaxesMap.mark = 0; + SwigClassTaxesMap.destroy = (void (*)(void *)) free_std_map_Sl_int_Sc_CdiTaxis_Sg_; + SwigClassTaxesMap.trackObjects = 0; + + SwigClassZaxesMap.klass = rb_define_class("ZaxesMap", rb_cObject); + SWIG_TypeClientData(SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, (void *) &SwigClassZaxesMap); + rb_include_module(SwigClassZaxesMap.klass, rb_eval_string("Enumerable")); + rb_define_alloc_func(SwigClassZaxesMap.klass, _wrap_ZaxesMap_allocate); + rb_define_method(SwigClassZaxesMap.klass, "initialize", VALUEFUNC(_wrap_new_ZaxesMap), -1); + rb_define_method(SwigClassZaxesMap.klass, "dup", VALUEFUNC(_wrap_ZaxesMap_dup), -1); + rb_define_method(SwigClassZaxesMap.klass, "delete", VALUEFUNC(_wrap_ZaxesMap_delete), -1); + rb_define_method(SwigClassZaxesMap.klass, "has_key?", VALUEFUNC(_wrap_ZaxesMap_has_keyq___), -1); + rb_define_method(SwigClassZaxesMap.klass, "keys", VALUEFUNC(_wrap_ZaxesMap_keys), -1); + rb_define_method(SwigClassZaxesMap.klass, "each", VALUEFUNC(_wrap_ZaxesMap_each), -1); + rb_define_method(SwigClassZaxesMap.klass, "select", VALUEFUNC(_wrap_ZaxesMap_select), -1); + rb_define_method(SwigClassZaxesMap.klass, "values_at", VALUEFUNC(_wrap_ZaxesMap_values_at), -1); + rb_define_method(SwigClassZaxesMap.klass, "each_key", VALUEFUNC(_wrap_ZaxesMap_each_key), -1); + rb_define_method(SwigClassZaxesMap.klass, "values", VALUEFUNC(_wrap_ZaxesMap_values), -1); + rb_define_method(SwigClassZaxesMap.klass, "each_value", VALUEFUNC(_wrap_ZaxesMap_each_value), -1); + rb_define_method(SwigClassZaxesMap.klass, "entries", VALUEFUNC(_wrap_ZaxesMap_entries), -1); + rb_define_method(SwigClassZaxesMap.klass, "include?", VALUEFUNC(_wrap_ZaxesMap_includeq___), -1); + rb_define_method(SwigClassZaxesMap.klass, "key_iterator", VALUEFUNC(_wrap_ZaxesMap_key_iterator), -1); + rb_define_method(SwigClassZaxesMap.klass, "value_iterator", VALUEFUNC(_wrap_ZaxesMap_value_iterator), -1); + rb_define_method(SwigClassZaxesMap.klass, "[]", VALUEFUNC(_wrap_ZaxesMap___getitem__), -1); + rb_define_method(SwigClassZaxesMap.klass, "[]=", VALUEFUNC(_wrap_ZaxesMap___setitem__), -1); + rb_define_method(SwigClassZaxesMap.klass, "inspect", VALUEFUNC(_wrap_ZaxesMap_inspect), -1); + rb_define_method(SwigClassZaxesMap.klass, "to_a", VALUEFUNC(_wrap_ZaxesMap_to_a), -1); + rb_define_method(SwigClassZaxesMap.klass, "to_s", VALUEFUNC(_wrap_ZaxesMap_to_s), -1); + rb_define_method(SwigClassZaxesMap.klass, "empty?", VALUEFUNC(_wrap_ZaxesMap_emptyq___), -1); + rb_define_method(SwigClassZaxesMap.klass, "size", VALUEFUNC(_wrap_ZaxesMap_size), -1); + rb_define_method(SwigClassZaxesMap.klass, "swap", VALUEFUNC(_wrap_ZaxesMap_swap), -1); + rb_define_method(SwigClassZaxesMap.klass, "begin", VALUEFUNC(_wrap_ZaxesMap_begin), -1); + rb_define_method(SwigClassZaxesMap.klass, "end", VALUEFUNC(_wrap_ZaxesMap_end), -1); + rb_define_method(SwigClassZaxesMap.klass, "rbegin", VALUEFUNC(_wrap_ZaxesMap_rbegin), -1); + rb_define_method(SwigClassZaxesMap.klass, "rend", VALUEFUNC(_wrap_ZaxesMap_rend), -1); + rb_define_method(SwigClassZaxesMap.klass, "clear", VALUEFUNC(_wrap_ZaxesMap_clear), -1); + rb_define_method(SwigClassZaxesMap.klass, "get_allocator", VALUEFUNC(_wrap_ZaxesMap_get_allocator), -1); + rb_define_method(SwigClassZaxesMap.klass, "count", VALUEFUNC(_wrap_ZaxesMap_count), -1); + rb_define_method(SwigClassZaxesMap.klass, "erase", VALUEFUNC(_wrap_ZaxesMap_erase), -1); + rb_define_method(SwigClassZaxesMap.klass, "find", VALUEFUNC(_wrap_ZaxesMap_find), -1); + rb_define_method(SwigClassZaxesMap.klass, "lower_bound", VALUEFUNC(_wrap_ZaxesMap_lower_bound), -1); + rb_define_method(SwigClassZaxesMap.klass, "upper_bound", VALUEFUNC(_wrap_ZaxesMap_upper_bound), -1); + SwigClassZaxesMap.mark = 0; + SwigClassZaxesMap.destroy = (void (*)(void *)) free_std_map_Sl_int_Sc_CdiZaxis_Sg_; + SwigClassZaxesMap.trackObjects = 0; + + SwigClassGridsMap.klass = rb_define_class("GridsMap", rb_cObject); + SWIG_TypeClientData(SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, (void *) &SwigClassGridsMap); + rb_include_module(SwigClassGridsMap.klass, rb_eval_string("Enumerable")); + rb_define_alloc_func(SwigClassGridsMap.klass, _wrap_GridsMap_allocate); + rb_define_method(SwigClassGridsMap.klass, "initialize", VALUEFUNC(_wrap_new_GridsMap), -1); + rb_define_method(SwigClassGridsMap.klass, "dup", VALUEFUNC(_wrap_GridsMap_dup), -1); + rb_define_method(SwigClassGridsMap.klass, "delete", VALUEFUNC(_wrap_GridsMap_delete), -1); + rb_define_method(SwigClassGridsMap.klass, "has_key?", VALUEFUNC(_wrap_GridsMap_has_keyq___), -1); + rb_define_method(SwigClassGridsMap.klass, "keys", VALUEFUNC(_wrap_GridsMap_keys), -1); + rb_define_method(SwigClassGridsMap.klass, "each", VALUEFUNC(_wrap_GridsMap_each), -1); + rb_define_method(SwigClassGridsMap.klass, "select", VALUEFUNC(_wrap_GridsMap_select), -1); + rb_define_method(SwigClassGridsMap.klass, "values_at", VALUEFUNC(_wrap_GridsMap_values_at), -1); + rb_define_method(SwigClassGridsMap.klass, "each_key", VALUEFUNC(_wrap_GridsMap_each_key), -1); + rb_define_method(SwigClassGridsMap.klass, "values", VALUEFUNC(_wrap_GridsMap_values), -1); + rb_define_method(SwigClassGridsMap.klass, "each_value", VALUEFUNC(_wrap_GridsMap_each_value), -1); + rb_define_method(SwigClassGridsMap.klass, "entries", VALUEFUNC(_wrap_GridsMap_entries), -1); + rb_define_method(SwigClassGridsMap.klass, "include?", VALUEFUNC(_wrap_GridsMap_includeq___), -1); + rb_define_method(SwigClassGridsMap.klass, "key_iterator", VALUEFUNC(_wrap_GridsMap_key_iterator), -1); + rb_define_method(SwigClassGridsMap.klass, "value_iterator", VALUEFUNC(_wrap_GridsMap_value_iterator), -1); + rb_define_method(SwigClassGridsMap.klass, "[]", VALUEFUNC(_wrap_GridsMap___getitem__), -1); + rb_define_method(SwigClassGridsMap.klass, "[]=", VALUEFUNC(_wrap_GridsMap___setitem__), -1); + rb_define_method(SwigClassGridsMap.klass, "inspect", VALUEFUNC(_wrap_GridsMap_inspect), -1); + rb_define_method(SwigClassGridsMap.klass, "to_a", VALUEFUNC(_wrap_GridsMap_to_a), -1); + rb_define_method(SwigClassGridsMap.klass, "to_s", VALUEFUNC(_wrap_GridsMap_to_s), -1); + rb_define_method(SwigClassGridsMap.klass, "empty?", VALUEFUNC(_wrap_GridsMap_emptyq___), -1); + rb_define_method(SwigClassGridsMap.klass, "size", VALUEFUNC(_wrap_GridsMap_size), -1); + rb_define_method(SwigClassGridsMap.klass, "swap", VALUEFUNC(_wrap_GridsMap_swap), -1); + rb_define_method(SwigClassGridsMap.klass, "begin", VALUEFUNC(_wrap_GridsMap_begin), -1); + rb_define_method(SwigClassGridsMap.klass, "end", VALUEFUNC(_wrap_GridsMap_end), -1); + rb_define_method(SwigClassGridsMap.klass, "rbegin", VALUEFUNC(_wrap_GridsMap_rbegin), -1); + rb_define_method(SwigClassGridsMap.klass, "rend", VALUEFUNC(_wrap_GridsMap_rend), -1); + rb_define_method(SwigClassGridsMap.klass, "clear", VALUEFUNC(_wrap_GridsMap_clear), -1); + rb_define_method(SwigClassGridsMap.klass, "get_allocator", VALUEFUNC(_wrap_GridsMap_get_allocator), -1); + rb_define_method(SwigClassGridsMap.klass, "count", VALUEFUNC(_wrap_GridsMap_count), -1); + rb_define_method(SwigClassGridsMap.klass, "erase", VALUEFUNC(_wrap_GridsMap_erase), -1); + rb_define_method(SwigClassGridsMap.klass, "find", VALUEFUNC(_wrap_GridsMap_find), -1); + rb_define_method(SwigClassGridsMap.klass, "lower_bound", VALUEFUNC(_wrap_GridsMap_lower_bound), -1); + rb_define_method(SwigClassGridsMap.klass, "upper_bound", VALUEFUNC(_wrap_GridsMap_upper_bound), -1); + SwigClassGridsMap.mark = 0; + SwigClassGridsMap.destroy = (void (*)(void *)) free_std_map_Sl_int_Sc_CdiGrid_Sg_; + SwigClassGridsMap.trackObjects = 0; + + SwigClassCdiGrid.klass = rb_define_class("CdiGrid", rb_cObject); + SWIG_TypeClientData(SWIGTYPE_p_CdiGrid, (void *) &SwigClassCdiGrid); + rb_define_alloc_func(SwigClassCdiGrid.klass, _wrap_CdiGrid_allocate); + rb_define_method(SwigClassCdiGrid.klass, "initialize", VALUEFUNC(_wrap_new_CdiGrid), -1); + rb_define_method(SwigClassCdiGrid.klass, "gridID=", VALUEFUNC(_wrap_CdiGrid_gridID_set), -1); + rb_define_method(SwigClassCdiGrid.klass, "gridID", VALUEFUNC(_wrap_CdiGrid_gridID_get), -1); + rb_define_method(SwigClassCdiGrid.klass, "type=", VALUEFUNC(_wrap_CdiGrid_type_set), -1); + rb_define_method(SwigClassCdiGrid.klass, "type", VALUEFUNC(_wrap_CdiGrid_type_get), -1); + rb_define_method(SwigClassCdiGrid.klass, "size=", VALUEFUNC(_wrap_CdiGrid_size_set), -1); + rb_define_method(SwigClassCdiGrid.klass, "size", VALUEFUNC(_wrap_CdiGrid_size_get), -1); + rb_define_method(SwigClassCdiGrid.klass, "xsize=", VALUEFUNC(_wrap_CdiGrid_xsize_set), -1); + rb_define_method(SwigClassCdiGrid.klass, "xsize", VALUEFUNC(_wrap_CdiGrid_xsize_get), -1); + rb_define_method(SwigClassCdiGrid.klass, "ysize=", VALUEFUNC(_wrap_CdiGrid_ysize_set), -1); + rb_define_method(SwigClassCdiGrid.klass, "ysize", VALUEFUNC(_wrap_CdiGrid_ysize_get), -1); + rb_define_method(SwigClassCdiGrid.klass, "prec=", VALUEFUNC(_wrap_CdiGrid_prec_set), -1); + rb_define_method(SwigClassCdiGrid.klass, "prec", VALUEFUNC(_wrap_CdiGrid_prec_get), -1); + rb_define_method(SwigClassCdiGrid.klass, "ncorner=", VALUEFUNC(_wrap_CdiGrid_ncorner_set), -1); + rb_define_method(SwigClassCdiGrid.klass, "ncorner", VALUEFUNC(_wrap_CdiGrid_ncorner_get), -1); + rb_define_method(SwigClassCdiGrid.klass, "hasXValues=", VALUEFUNC(_wrap_CdiGrid_hasXValues_set), -1); + rb_define_method(SwigClassCdiGrid.klass, "hasXValues", VALUEFUNC(_wrap_CdiGrid_hasXValues_get), -1); + rb_define_method(SwigClassCdiGrid.klass, "hasYValues=", VALUEFUNC(_wrap_CdiGrid_hasYValues_set), -1); + rb_define_method(SwigClassCdiGrid.klass, "hasYValues", VALUEFUNC(_wrap_CdiGrid_hasYValues_get), -1); + rb_define_method(SwigClassCdiGrid.klass, "hasBounds=", VALUEFUNC(_wrap_CdiGrid_hasBounds_set), -1); + rb_define_method(SwigClassCdiGrid.klass, "hasBounds", VALUEFUNC(_wrap_CdiGrid_hasBounds_get), -1); + rb_define_method(SwigClassCdiGrid.klass, "xvalues=", VALUEFUNC(_wrap_CdiGrid_xvalues_set), -1); + rb_define_method(SwigClassCdiGrid.klass, "xvalues", VALUEFUNC(_wrap_CdiGrid_xvalues_get), -1); + rb_define_method(SwigClassCdiGrid.klass, "yvalues=", VALUEFUNC(_wrap_CdiGrid_yvalues_set), -1); + rb_define_method(SwigClassCdiGrid.klass, "yvalues", VALUEFUNC(_wrap_CdiGrid_yvalues_get), -1); + rb_define_method(SwigClassCdiGrid.klass, "xbounds=", VALUEFUNC(_wrap_CdiGrid_xbounds_set), -1); + rb_define_method(SwigClassCdiGrid.klass, "xbounds", VALUEFUNC(_wrap_CdiGrid_xbounds_get), -1); + rb_define_method(SwigClassCdiGrid.klass, "ybounds=", VALUEFUNC(_wrap_CdiGrid_ybounds_set), -1); + rb_define_method(SwigClassCdiGrid.klass, "ybounds", VALUEFUNC(_wrap_CdiGrid_ybounds_get), -1); + rb_define_method(SwigClassCdiGrid.klass, "xname=", VALUEFUNC(_wrap_CdiGrid_xname_set), -1); + rb_define_method(SwigClassCdiGrid.klass, "xname", VALUEFUNC(_wrap_CdiGrid_xname_get), -1); + rb_define_method(SwigClassCdiGrid.klass, "xlongname=", VALUEFUNC(_wrap_CdiGrid_xlongname_set), -1); + rb_define_method(SwigClassCdiGrid.klass, "xlongname", VALUEFUNC(_wrap_CdiGrid_xlongname_get), -1); + rb_define_method(SwigClassCdiGrid.klass, "xstdname=", VALUEFUNC(_wrap_CdiGrid_xstdname_set), -1); + rb_define_method(SwigClassCdiGrid.klass, "xstdname", VALUEFUNC(_wrap_CdiGrid_xstdname_get), -1); + rb_define_method(SwigClassCdiGrid.klass, "xunits=", VALUEFUNC(_wrap_CdiGrid_xunits_set), -1); + rb_define_method(SwigClassCdiGrid.klass, "xunits", VALUEFUNC(_wrap_CdiGrid_xunits_get), -1); + rb_define_method(SwigClassCdiGrid.klass, "yname=", VALUEFUNC(_wrap_CdiGrid_yname_set), -1); + rb_define_method(SwigClassCdiGrid.klass, "yname", VALUEFUNC(_wrap_CdiGrid_yname_get), -1); + rb_define_method(SwigClassCdiGrid.klass, "ylongname=", VALUEFUNC(_wrap_CdiGrid_ylongname_set), -1); + rb_define_method(SwigClassCdiGrid.klass, "ylongname", VALUEFUNC(_wrap_CdiGrid_ylongname_get), -1); + rb_define_method(SwigClassCdiGrid.klass, "ystdname=", VALUEFUNC(_wrap_CdiGrid_ystdname_set), -1); + rb_define_method(SwigClassCdiGrid.klass, "ystdname", VALUEFUNC(_wrap_CdiGrid_ystdname_get), -1); + rb_define_method(SwigClassCdiGrid.klass, "yunits=", VALUEFUNC(_wrap_CdiGrid_yunits_set), -1); + rb_define_method(SwigClassCdiGrid.klass, "yunits", VALUEFUNC(_wrap_CdiGrid_yunits_get), -1); + rb_define_method(SwigClassCdiGrid.klass, "name=", VALUEFUNC(_wrap_CdiGrid_name_set), -1); + rb_define_method(SwigClassCdiGrid.klass, "name", VALUEFUNC(_wrap_CdiGrid_name_get), -1); + rb_define_method(SwigClassCdiGrid.klass, "getValues", VALUEFUNC(_wrap_CdiGrid_getValues), -1); + rb_define_method(SwigClassCdiGrid.klass, "getBounds", VALUEFUNC(_wrap_CdiGrid_getBounds), -1); + rb_define_method(SwigClassCdiGrid.klass, "getValuesAsPointer", VALUEFUNC(_wrap_CdiGrid_getValuesAsPointer), -1); + rb_define_method(SwigClassCdiGrid.klass, "getBoundsAsPointer", VALUEFUNC(_wrap_CdiGrid_getBoundsAsPointer), -1); + rb_define_method(SwigClassCdiGrid.klass, "getFloatVals", VALUEFUNC(_wrap_CdiGrid_getFloatVals), -1); + rb_define_method(SwigClassCdiGrid.klass, "getFloatBounds", VALUEFUNC(_wrap_CdiGrid_getFloatBounds), -1); + SwigClassCdiGrid.mark = 0; + SwigClassCdiGrid.destroy = (void (*)(void *)) free_CdiGrid; + SwigClassCdiGrid.trackObjects = 0; + + SwigClassCdiTaxis.klass = rb_define_class("CdiTaxis", rb_cObject); + SWIG_TypeClientData(SWIGTYPE_p_CdiTaxis, (void *) &SwigClassCdiTaxis); + rb_define_alloc_func(SwigClassCdiTaxis.klass, _wrap_CdiTaxis_allocate); + rb_define_method(SwigClassCdiTaxis.klass, "initialize", VALUEFUNC(_wrap_new_CdiTaxis), -1); + rb_define_method(SwigClassCdiTaxis.klass, "taxisID=", VALUEFUNC(_wrap_CdiTaxis_taxisID_set), -1); + rb_define_method(SwigClassCdiTaxis.klass, "taxisID", VALUEFUNC(_wrap_CdiTaxis_taxisID_get), -1); + rb_define_method(SwigClassCdiTaxis.klass, "ntsteps=", VALUEFUNC(_wrap_CdiTaxis_ntsteps_set), -1); + rb_define_method(SwigClassCdiTaxis.klass, "ntsteps", VALUEFUNC(_wrap_CdiTaxis_ntsteps_get), -1); + rb_define_method(SwigClassCdiTaxis.klass, "unit=", VALUEFUNC(_wrap_CdiTaxis_unit_set), -1); + rb_define_method(SwigClassCdiTaxis.klass, "unit", VALUEFUNC(_wrap_CdiTaxis_unit_get), -1); + rb_define_method(SwigClassCdiTaxis.klass, "rdate=", VALUEFUNC(_wrap_CdiTaxis_rdate_set), -1); + rb_define_method(SwigClassCdiTaxis.klass, "rdate", VALUEFUNC(_wrap_CdiTaxis_rdate_get), -1); + rb_define_method(SwigClassCdiTaxis.klass, "rtime=", VALUEFUNC(_wrap_CdiTaxis_rtime_set), -1); + rb_define_method(SwigClassCdiTaxis.klass, "rtime", VALUEFUNC(_wrap_CdiTaxis_rtime_get), -1); + rb_define_method(SwigClassCdiTaxis.klass, "vdate=", VALUEFUNC(_wrap_CdiTaxis_vdate_set), -1); + rb_define_method(SwigClassCdiTaxis.klass, "vdate", VALUEFUNC(_wrap_CdiTaxis_vdate_get), -1); + rb_define_method(SwigClassCdiTaxis.klass, "vtime=", VALUEFUNC(_wrap_CdiTaxis_vtime_set), -1); + rb_define_method(SwigClassCdiTaxis.klass, "vtime", VALUEFUNC(_wrap_CdiTaxis_vtime_get), -1); + rb_define_method(SwigClassCdiTaxis.klass, "type=", VALUEFUNC(_wrap_CdiTaxis_type_set), -1); + rb_define_method(SwigClassCdiTaxis.klass, "type", VALUEFUNC(_wrap_CdiTaxis_type_get), -1); + rb_define_method(SwigClassCdiTaxis.klass, "calendar=", VALUEFUNC(_wrap_CdiTaxis_calendar_set), -1); + rb_define_method(SwigClassCdiTaxis.klass, "calendar", VALUEFUNC(_wrap_CdiTaxis_calendar_get), -1); + rb_define_method(SwigClassCdiTaxis.klass, "hasBounds=", VALUEFUNC(_wrap_CdiTaxis_hasBounds_set), -1); + rb_define_method(SwigClassCdiTaxis.klass, "hasBounds", VALUEFUNC(_wrap_CdiTaxis_hasBounds_get), -1); + rb_define_method(SwigClassCdiTaxis.klass, "name=", VALUEFUNC(_wrap_CdiTaxis_name_set), -1); + rb_define_method(SwigClassCdiTaxis.klass, "name", VALUEFUNC(_wrap_CdiTaxis_name_get), -1); + rb_define_method(SwigClassCdiTaxis.klass, "unitname=", VALUEFUNC(_wrap_CdiTaxis_unitname_set), -1); + rb_define_method(SwigClassCdiTaxis.klass, "unitname", VALUEFUNC(_wrap_CdiTaxis_unitname_get), -1); + SwigClassCdiTaxis.mark = 0; + SwigClassCdiTaxis.destroy = (void (*)(void *)) free_CdiTaxis; + SwigClassCdiTaxis.trackObjects = 0; + + SwigClassCdiZaxis.klass = rb_define_class("CdiZaxis", rb_cObject); + SWIG_TypeClientData(SWIGTYPE_p_CdiZaxis, (void *) &SwigClassCdiZaxis); + rb_define_alloc_func(SwigClassCdiZaxis.klass, _wrap_CdiZaxis_allocate); + rb_define_method(SwigClassCdiZaxis.klass, "initialize", VALUEFUNC(_wrap_new_CdiZaxis), -1); + rb_define_method(SwigClassCdiZaxis.klass, "zaxisID=", VALUEFUNC(_wrap_CdiZaxis_zaxisID_set), -1); + rb_define_method(SwigClassCdiZaxis.klass, "zaxisID", VALUEFUNC(_wrap_CdiZaxis_zaxisID_get), -1); + rb_define_method(SwigClassCdiZaxis.klass, "type=", VALUEFUNC(_wrap_CdiZaxis_type_set), -1); + rb_define_method(SwigClassCdiZaxis.klass, "type", VALUEFUNC(_wrap_CdiZaxis_type_get), -1); + rb_define_method(SwigClassCdiZaxis.klass, "ltype=", VALUEFUNC(_wrap_CdiZaxis_ltype_set), -1); + rb_define_method(SwigClassCdiZaxis.klass, "ltype", VALUEFUNC(_wrap_CdiZaxis_ltype_get), -1); + rb_define_method(SwigClassCdiZaxis.klass, "size=", VALUEFUNC(_wrap_CdiZaxis_size_set), -1); + rb_define_method(SwigClassCdiZaxis.klass, "size", VALUEFUNC(_wrap_CdiZaxis_size_get), -1); + rb_define_method(SwigClassCdiZaxis.klass, "prec=", VALUEFUNC(_wrap_CdiZaxis_prec_set), -1); + rb_define_method(SwigClassCdiZaxis.klass, "prec", VALUEFUNC(_wrap_CdiZaxis_prec_get), -1); + rb_define_method(SwigClassCdiZaxis.klass, "plevels=", VALUEFUNC(_wrap_CdiZaxis_plevels_set), -1); + rb_define_method(SwigClassCdiZaxis.klass, "plevels", VALUEFUNC(_wrap_CdiZaxis_plevels_get), -1); + rb_define_method(SwigClassCdiZaxis.klass, "plbounds=", VALUEFUNC(_wrap_CdiZaxis_plbounds_set), -1); + rb_define_method(SwigClassCdiZaxis.klass, "plbounds", VALUEFUNC(_wrap_CdiZaxis_plbounds_get), -1); + rb_define_method(SwigClassCdiZaxis.klass, "pubounds=", VALUEFUNC(_wrap_CdiZaxis_pubounds_set), -1); + rb_define_method(SwigClassCdiZaxis.klass, "pubounds", VALUEFUNC(_wrap_CdiZaxis_pubounds_get), -1); + rb_define_method(SwigClassCdiZaxis.klass, "pweights=", VALUEFUNC(_wrap_CdiZaxis_pweights_set), -1); + rb_define_method(SwigClassCdiZaxis.klass, "pweights", VALUEFUNC(_wrap_CdiZaxis_pweights_get), -1); + rb_define_method(SwigClassCdiZaxis.klass, "levels=", VALUEFUNC(_wrap_CdiZaxis_levels_set), -1); + rb_define_method(SwigClassCdiZaxis.klass, "levels", VALUEFUNC(_wrap_CdiZaxis_levels_get), -1); + rb_define_method(SwigClassCdiZaxis.klass, "lbounds=", VALUEFUNC(_wrap_CdiZaxis_lbounds_set), -1); + rb_define_method(SwigClassCdiZaxis.klass, "lbounds", VALUEFUNC(_wrap_CdiZaxis_lbounds_get), -1); + rb_define_method(SwigClassCdiZaxis.klass, "ubounds=", VALUEFUNC(_wrap_CdiZaxis_ubounds_set), -1); + rb_define_method(SwigClassCdiZaxis.klass, "ubounds", VALUEFUNC(_wrap_CdiZaxis_ubounds_get), -1); + rb_define_method(SwigClassCdiZaxis.klass, "weights=", VALUEFUNC(_wrap_CdiZaxis_weights_set), -1); + rb_define_method(SwigClassCdiZaxis.klass, "weights", VALUEFUNC(_wrap_CdiZaxis_weights_get), -1); + rb_define_method(SwigClassCdiZaxis.klass, "name=", VALUEFUNC(_wrap_CdiZaxis_name_set), -1); + rb_define_method(SwigClassCdiZaxis.klass, "name", VALUEFUNC(_wrap_CdiZaxis_name_get), -1); + rb_define_method(SwigClassCdiZaxis.klass, "longname=", VALUEFUNC(_wrap_CdiZaxis_longname_set), -1); + rb_define_method(SwigClassCdiZaxis.klass, "longname", VALUEFUNC(_wrap_CdiZaxis_longname_get), -1); + rb_define_method(SwigClassCdiZaxis.klass, "units=", VALUEFUNC(_wrap_CdiZaxis_units_set), -1); + rb_define_method(SwigClassCdiZaxis.klass, "units", VALUEFUNC(_wrap_CdiZaxis_units_get), -1); + SwigClassCdiZaxis.mark = 0; + SwigClassCdiZaxis.destroy = (void (*)(void *)) free_CdiZaxis; + SwigClassCdiZaxis.trackObjects = 0; + + SwigClassCdiVariable.klass = rb_define_class("CdiVariable", rb_cObject); + SWIG_TypeClientData(SWIGTYPE_p_CdiVariable, (void *) &SwigClassCdiVariable); + rb_define_alloc_func(SwigClassCdiVariable.klass, _wrap_CdiVariable_allocate); + rb_define_method(SwigClassCdiVariable.klass, "initialize", VALUEFUNC(_wrap_new_CdiVariable), -1); + rb_define_method(SwigClassCdiVariable.klass, "varID=", VALUEFUNC(_wrap_CdiVariable_varID_set), -1); + rb_define_method(SwigClassCdiVariable.klass, "varID", VALUEFUNC(_wrap_CdiVariable_varID_get), -1); + rb_define_method(SwigClassCdiVariable.klass, "zaxisID=", VALUEFUNC(_wrap_CdiVariable_zaxisID_set), -1); + rb_define_method(SwigClassCdiVariable.klass, "zaxisID", VALUEFUNC(_wrap_CdiVariable_zaxisID_get), -1); + rb_define_method(SwigClassCdiVariable.klass, "gridID=", VALUEFUNC(_wrap_CdiVariable_gridID_set), -1); + rb_define_method(SwigClassCdiVariable.klass, "gridID", VALUEFUNC(_wrap_CdiVariable_gridID_get), -1); + rb_define_method(SwigClassCdiVariable.klass, "taxisID=", VALUEFUNC(_wrap_CdiVariable_taxisID_set), -1); + rb_define_method(SwigClassCdiVariable.klass, "taxisID", VALUEFUNC(_wrap_CdiVariable_taxisID_get), -1); + rb_define_method(SwigClassCdiVariable.klass, "timeID=", VALUEFUNC(_wrap_CdiVariable_timeID_set), -1); + rb_define_method(SwigClassCdiVariable.klass, "timeID", VALUEFUNC(_wrap_CdiVariable_timeID_get), -1); + rb_define_method(SwigClassCdiVariable.klass, "vlistID=", VALUEFUNC(_wrap_CdiVariable_vlistID_set), -1); + rb_define_method(SwigClassCdiVariable.klass, "vlistID", VALUEFUNC(_wrap_CdiVariable_vlistID_get), -1); + rb_define_method(SwigClassCdiVariable.klass, "size=", VALUEFUNC(_wrap_CdiVariable_size_set), -1); + rb_define_method(SwigClassCdiVariable.klass, "size", VALUEFUNC(_wrap_CdiVariable_size_get), -1); + rb_define_method(SwigClassCdiVariable.klass, "code=", VALUEFUNC(_wrap_CdiVariable_code_set), -1); + rb_define_method(SwigClassCdiVariable.klass, "code", VALUEFUNC(_wrap_CdiVariable_code_get), -1); + rb_define_method(SwigClassCdiVariable.klass, "datatype=", VALUEFUNC(_wrap_CdiVariable_datatype_set), -1); + rb_define_method(SwigClassCdiVariable.klass, "datatype", VALUEFUNC(_wrap_CdiVariable_datatype_get), -1); + rb_define_method(SwigClassCdiVariable.klass, "streamID=", VALUEFUNC(_wrap_CdiVariable_streamID_set), -1); + rb_define_method(SwigClassCdiVariable.klass, "streamID", VALUEFUNC(_wrap_CdiVariable_streamID_get), -1); + rb_define_method(SwigClassCdiVariable.klass, "name=", VALUEFUNC(_wrap_CdiVariable_name_set), -1); + rb_define_method(SwigClassCdiVariable.klass, "name", VALUEFUNC(_wrap_CdiVariable_name_get), -1); + rb_define_method(SwigClassCdiVariable.klass, "longname=", VALUEFUNC(_wrap_CdiVariable_longname_set), -1); + rb_define_method(SwigClassCdiVariable.klass, "longname", VALUEFUNC(_wrap_CdiVariable_longname_get), -1); + rb_define_method(SwigClassCdiVariable.klass, "units=", VALUEFUNC(_wrap_CdiVariable_units_set), -1); + rb_define_method(SwigClassCdiVariable.klass, "units", VALUEFUNC(_wrap_CdiVariable_units_get), -1); + rb_define_method(SwigClassCdiVariable.klass, "stdname=", VALUEFUNC(_wrap_CdiVariable_stdname_set), -1); + rb_define_method(SwigClassCdiVariable.klass, "stdname", VALUEFUNC(_wrap_CdiVariable_stdname_get), -1); + rb_define_method(SwigClassCdiVariable.klass, "missval=", VALUEFUNC(_wrap_CdiVariable_missval_set), -1); + rb_define_method(SwigClassCdiVariable.klass, "missval", VALUEFUNC(_wrap_CdiVariable_missval_get), -1); + rb_define_method(SwigClassCdiVariable.klass, "values=", VALUEFUNC(_wrap_CdiVariable_values_set), -1); + rb_define_method(SwigClassCdiVariable.klass, "values", VALUEFUNC(_wrap_CdiVariable_values_get), -1); + rb_define_method(SwigClassCdiVariable.klass, "valuesWithLevel=", VALUEFUNC(_wrap_CdiVariable_valuesWithLevel_set), -1); + rb_define_method(SwigClassCdiVariable.klass, "valuesWithLevel", VALUEFUNC(_wrap_CdiVariable_valuesWithLevel_get), -1); + rb_define_method(SwigClassCdiVariable.klass, "grid=", VALUEFUNC(_wrap_CdiVariable_grid_set), -1); + rb_define_method(SwigClassCdiVariable.klass, "grid", VALUEFUNC(_wrap_CdiVariable_grid_get), -1); + rb_define_method(SwigClassCdiVariable.klass, "zaxis=", VALUEFUNC(_wrap_CdiVariable_zaxis_set), -1); + rb_define_method(SwigClassCdiVariable.klass, "zaxis", VALUEFUNC(_wrap_CdiVariable_zaxis_get), -1); + rb_define_method(SwigClassCdiVariable.klass, "taxis=", VALUEFUNC(_wrap_CdiVariable_taxis_set), -1); + rb_define_method(SwigClassCdiVariable.klass, "taxis", VALUEFUNC(_wrap_CdiVariable_taxis_get), -1); + rb_define_method(SwigClassCdiVariable.klass, "sinfo", VALUEFUNC(_wrap_CdiVariable_sinfo), -1); + rb_define_method(SwigClassCdiVariable.klass, "getValues", VALUEFUNC(_wrap_CdiVariable_getValues), -1); + rb_define_method(SwigClassCdiVariable.klass, "getValuesWithLevel", VALUEFUNC(_wrap_CdiVariable_getValuesWithLevel), -1); + rb_define_method(SwigClassCdiVariable.klass, "getFValues", VALUEFUNC(_wrap_CdiVariable_getFValues), -1); + rb_define_method(SwigClassCdiVariable.klass, "getFValuesWithLevel", VALUEFUNC(_wrap_CdiVariable_getFValuesWithLevel), -1); + rb_define_method(SwigClassCdiVariable.klass, "getValuesAsPointer", VALUEFUNC(_wrap_CdiVariable_getValuesAsPointer), -1); + rb_define_method(SwigClassCdiVariable.klass, "getValuesWithLevelAsPointer", VALUEFUNC(_wrap_CdiVariable_getValuesWithLevelAsPointer), -1); + SwigClassCdiVariable.mark = 0; + SwigClassCdiVariable.destroy = (void (*)(void *)) free_CdiVariable; + SwigClassCdiVariable.trackObjects = 0; + + SwigClassCdi.klass = rb_define_class("Cdi", rb_cObject); + SWIG_TypeClientData(SWIGTYPE_p_Cdi, (void *) &SwigClassCdi); + rb_define_alloc_func(SwigClassCdi.klass, _wrap_Cdi_allocate); + rb_define_method(SwigClassCdi.klass, "initialize", VALUEFUNC(_wrap_new_Cdi), -1); + rb_define_method(SwigClassCdi.klass, "streamID=", VALUEFUNC(_wrap_Cdi_streamID_set), -1); + rb_define_method(SwigClassCdi.klass, "streamID", VALUEFUNC(_wrap_Cdi_streamID_get), -1); + rb_define_method(SwigClassCdi.klass, "vlistID=", VALUEFUNC(_wrap_Cdi_vlistID_set), -1); + rb_define_method(SwigClassCdi.klass, "vlistID", VALUEFUNC(_wrap_Cdi_vlistID_get), -1); + rb_define_method(SwigClassCdi.klass, "nvars=", VALUEFUNC(_wrap_Cdi_nvars_set), -1); + rb_define_method(SwigClassCdi.klass, "nvars", VALUEFUNC(_wrap_Cdi_nvars_get), -1); + rb_define_method(SwigClassCdi.klass, "nzaxes=", VALUEFUNC(_wrap_Cdi_nzaxes_set), -1); + rb_define_method(SwigClassCdi.klass, "nzaxes", VALUEFUNC(_wrap_Cdi_nzaxes_get), -1); + rb_define_method(SwigClassCdi.klass, "ngrids=", VALUEFUNC(_wrap_Cdi_ngrids_set), -1); + rb_define_method(SwigClassCdi.klass, "ngrids", VALUEFUNC(_wrap_Cdi_ngrids_get), -1); + rb_define_method(SwigClassCdi.klass, "ntaxes=", VALUEFUNC(_wrap_Cdi_ntaxes_set), -1); + rb_define_method(SwigClassCdi.klass, "ntaxes", VALUEFUNC(_wrap_Cdi_ntaxes_get), -1); + rb_define_method(SwigClassCdi.klass, "taxisID=", VALUEFUNC(_wrap_Cdi_taxisID_set), -1); + rb_define_method(SwigClassCdi.klass, "taxisID", VALUEFUNC(_wrap_Cdi_taxisID_get), -1); + rb_define_method(SwigClassCdi.klass, "varnames=", VALUEFUNC(_wrap_Cdi_varnames_set), -1); + rb_define_method(SwigClassCdi.klass, "varnames", VALUEFUNC(_wrap_Cdi_varnames_get), -1); + rb_define_method(SwigClassCdi.klass, "codes=", VALUEFUNC(_wrap_Cdi_codes_set), -1); + rb_define_method(SwigClassCdi.klass, "codes", VALUEFUNC(_wrap_Cdi_codes_get), -1); + rb_define_method(SwigClassCdi.klass, "variables=", VALUEFUNC(_wrap_Cdi_variables_set), -1); + rb_define_method(SwigClassCdi.klass, "variables", VALUEFUNC(_wrap_Cdi_variables_get), -1); + rb_define_method(SwigClassCdi.klass, "var=", VALUEFUNC(_wrap_Cdi_var_set), -1); + rb_define_method(SwigClassCdi.klass, "var", VALUEFUNC(_wrap_Cdi_var_get), -1); + rb_define_method(SwigClassCdi.klass, "varByCode=", VALUEFUNC(_wrap_Cdi_varByCode_set), -1); + rb_define_method(SwigClassCdi.klass, "varByCode", VALUEFUNC(_wrap_Cdi_varByCode_get), -1); + rb_define_method(SwigClassCdi.klass, "taxes=", VALUEFUNC(_wrap_Cdi_taxes_set), -1); + rb_define_method(SwigClassCdi.klass, "taxes", VALUEFUNC(_wrap_Cdi_taxes_get), -1); + rb_define_method(SwigClassCdi.klass, "zaxes=", VALUEFUNC(_wrap_Cdi_zaxes_set), -1); + rb_define_method(SwigClassCdi.klass, "zaxes", VALUEFUNC(_wrap_Cdi_zaxes_get), -1); + rb_define_method(SwigClassCdi.klass, "grids=", VALUEFUNC(_wrap_Cdi_grids_set), -1); + rb_define_method(SwigClassCdi.klass, "grids", VALUEFUNC(_wrap_Cdi_grids_get), -1); + rb_define_method(SwigClassCdi.klass, "griddes", VALUEFUNC(_wrap_Cdi_griddes), -1); + SwigClassCdi.mark = 0; + SwigClassCdi.destroy = (void (*)(void *)) free_Cdi; + SwigClassCdi.trackObjects = 0; +} + diff --git a/m4/libtool.m4 b/m4/libtool.m4 new file mode 100644 index 0000000000000000000000000000000000000000..a3bc337b79ad3d2bd26f0c10644e55db74e70448 --- /dev/null +++ b/m4/libtool.m4 @@ -0,0 +1,8369 @@ +# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- +# +# Copyright (C) 1996-2001, 2003-2015 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) 2014 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 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 this program. If not, see <http://www.gnu.org/licenses/>. +]) + +# serial 58 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.62])dnl We use AC_PATH_PROGS_FEATURE_CHECK +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_PREPARE_CC_BASENAME +# ----------------------- +m4_defun([_LT_PREPARE_CC_BASENAME], [ +# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. +func_cc_basename () +{ + for cc_temp in @S|@*""; do + case $cc_temp in + compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; + distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; + \-*) ;; + *) break;; + esac + done + func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` +} +])# _LT_PREPARE_CC_BASENAME + + +# _LT_CC_BASENAME(CC) +# ------------------- +# It would be clearer to call AC_REQUIREs from _LT_PREPARE_CC_BASENAME, +# but that macro is also expanded into generated libtool script, which +# arranges for $SED and $ECHO to be set by different means. +m4_defun([_LT_CC_BASENAME], +[m4_require([_LT_PREPARE_CC_BASENAME])dnl +AC_REQUIRE([_LT_DECL_SED])dnl +AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl +func_cc_basename $1 +cc_basename=$func_cc_basename_result +]) + + +# _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 +m4_require([_LT_CMD_TRUNCATE])dnl + +_LT_CONFIG_LIBTOOL_INIT([ +# See if we are running on zsh, and set the options that 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 set != "${COLLECT_NAMES+set}"; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Global variables: +ofile=libtool +can_build_shared=yes + +# All known linkers require a '.a' archive for static linking (except MSVC, +# which needs '.lib'). +libext=a + +with_gnu_ld=$lt_cv_prog_gnu_ld + +old_CC=$CC +old_CFLAGS=$CFLAGS + +# Set sane defaults for various variables +test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC +test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS +test -z "$LD" && LD=ld +test -z "$ac_objext" && ac_objext=o + +_LT_CC_BASENAME([$compiler]) + +# Only perform the check for file, if the check method requires it +test -z "$MAGIC_CMD" && MAGIC_CMD=file +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + _LT_PATH_MAGIC + fi + ;; +esac + +# Use C for the default configuration in the libtool script +LT_SUPPORTED_TAG([CC]) +_LT_LANG_C_CONFIG +_LT_LANG_DEFAULT_CONFIG +_LT_CONFIG_COMMANDS +])# _LT_SETUP + + +# _LT_PREPARE_SED_QUOTE_VARS +# -------------------------- +# Define a few sed substitution that help us do robust quoting. +m4_defun([_LT_PREPARE_SED_QUOTE_VARS], +[# Backslashify metacharacters that are still active within +# double-quoted strings. +sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\([["`\\]]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to delay expansion of an escaped single quote. +delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' +]) + +# _LT_PROG_LTMAIN +# --------------- +# Note that this code is called both from 'configure', and 'config.status' +# now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, +# 'config.status' has no value for ac_aux_dir unless we are using Automake, +# so we pass a copy along to make sure it has a sensible value anyway. +m4_defun([_LT_PROG_LTMAIN], +[m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl +_LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) +ltmain=$ac_aux_dir/ltmain.sh +])# _LT_PROG_LTMAIN + + +## ------------------------------------- ## +## Accumulate code for creating libtool. ## +## ------------------------------------- ## + +# So that we can recreate a full libtool script including additional +# tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS +# in macros and then make a single call at the end using the 'libtool' +# label. + + +# _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS]) +# ---------------------------------------- +# Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later. +m4_define([_LT_CONFIG_LIBTOOL_INIT], +[m4_ifval([$1], + [m4_append([_LT_OUTPUT_LIBTOOL_INIT], + [$1 +])])]) + +# Initialize. +m4_define([_LT_OUTPUT_LIBTOOL_INIT]) + + +# _LT_CONFIG_LIBTOOL([COMMANDS]) +# ------------------------------ +# Register COMMANDS to be passed to AC_CONFIG_COMMANDS later. +m4_define([_LT_CONFIG_LIBTOOL], +[m4_ifval([$1], + [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS], + [$1 +])])]) + +# Initialize. +m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS]) + + +# _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS]) +# ----------------------------------------------------- +m4_defun([_LT_CONFIG_SAVE_COMMANDS], +[_LT_CONFIG_LIBTOOL([$1]) +_LT_CONFIG_LIBTOOL_INIT([$2]) +]) + + +# _LT_FORMAT_COMMENT([COMMENT]) +# ----------------------------- +# Add leading comment marks to the start of each line, and a trailing +# full-stop to the whole comment if one is not present already. +m4_define([_LT_FORMAT_COMMENT], +[m4_ifval([$1], [ +m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])], + [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.]) +)]) + + + +## ------------------------ ## +## FIXME: Eliminate VARNAME ## +## ------------------------ ## + + +# _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?]) +# ------------------------------------------------------------------- +# CONFIGNAME is the name given to the value in the libtool script. +# VARNAME is the (base) name used in the configure script. +# VALUE may be 0, 1 or 2 for a computed quote escaped value based on +# VARNAME. Any other value will be used directly. +m4_define([_LT_DECL], +[lt_if_append_uniq([lt_decl_varnames], [$2], [, ], + [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name], + [m4_ifval([$1], [$1], [$2])]) + lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3]) + m4_ifval([$4], + [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])]) + lt_dict_add_subkey([lt_decl_dict], [$2], + [tagged?], [m4_ifval([$5], [yes], [no])])]) +]) + + +# _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION]) +# -------------------------------------------------------- +m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])]) + + +# lt_decl_tag_varnames([SEPARATOR], [VARNAME1...]) +# ------------------------------------------------ +m4_define([lt_decl_tag_varnames], +[_lt_decl_filter([tagged?], [yes], $@)]) + + +# _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..]) +# --------------------------------------------------------- +m4_define([_lt_decl_filter], +[m4_case([$#], + [0], [m4_fatal([$0: too few arguments: $#])], + [1], [m4_fatal([$0: too few arguments: $#: $1])], + [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)], + [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)], + [lt_dict_filter([lt_decl_dict], $@)])[]dnl +]) + + +# lt_decl_quote_varnames([SEPARATOR], [VARNAME1...]) +# -------------------------------------------------- +m4_define([lt_decl_quote_varnames], +[_lt_decl_filter([value], [1], $@)]) + + +# lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...]) +# --------------------------------------------------- +m4_define([lt_decl_dquote_varnames], +[_lt_decl_filter([value], [2], $@)]) + + +# lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) +# --------------------------------------------------- +m4_define([lt_decl_varnames_tagged], +[m4_assert([$# <= 2])dnl +_$0(m4_quote(m4_default([$1], [[, ]])), + m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]), + m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))]) +m4_define([_lt_decl_varnames_tagged], +[m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])]) + + +# lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) +# ------------------------------------------------ +m4_define([lt_decl_all_varnames], +[_$0(m4_quote(m4_default([$1], [[, ]])), + m4_if([$2], [], + m4_quote(lt_decl_varnames), + m4_quote(m4_shift($@))))[]dnl +]) +m4_define([_lt_decl_all_varnames], +[lt_join($@, lt_decl_varnames_tagged([$1], + lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl +]) + + +# _LT_CONFIG_STATUS_DECLARE([VARNAME]) +# ------------------------------------ +# Quote a variable value, and forward it to 'config.status' so that its +# declaration there will have the same value as in 'configure'. VARNAME +# must have a single quote delimited value for this to work. +m4_define([_LT_CONFIG_STATUS_DECLARE], +[$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`']) + + +# _LT_CONFIG_STATUS_DECLARATIONS +# ------------------------------ +# We delimit libtool config variables with single quotes, so when +# we write them to config.status, we have to be sure to quote all +# embedded single quotes properly. In configure, this macro expands +# each variable declared with _LT_DECL (and _LT_TAGDECL) into: +# +# <var>='`$ECHO "$<var>" | $SED "$delay_single_quote_subst"`' +m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], +[m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), + [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) + + +# _LT_LIBTOOL_TAGS +# ---------------- +# Output comment and list of tags supported by the script +m4_defun([_LT_LIBTOOL_TAGS], +[_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl +available_tags='_LT_TAGS'dnl +]) + + +# _LT_LIBTOOL_DECLARE(VARNAME, [TAG]) +# ----------------------------------- +# Extract the dictionary values for VARNAME (optionally with TAG) and +# expand to a commented shell variable setting: +# +# # Some comment about what VAR is for. +# visible_name=$lt_internal_name +m4_define([_LT_LIBTOOL_DECLARE], +[_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], + [description])))[]dnl +m4_pushdef([_libtool_name], + m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl +m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])), + [0], [_libtool_name=[$]$1], + [1], [_libtool_name=$lt_[]$1], + [2], [_libtool_name=$lt_[]$1], + [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl +m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl +]) + + +# _LT_LIBTOOL_CONFIG_VARS +# ----------------------- +# Produce commented declarations of non-tagged libtool config variables +# suitable for insertion in the LIBTOOL CONFIG section of the 'libtool' +# script. Tagged libtool config variables (even for the LIBTOOL CONFIG +# section) are produced by _LT_LIBTOOL_TAG_VARS. +m4_defun([_LT_LIBTOOL_CONFIG_VARS], +[m4_foreach([_lt_var], + m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)), + [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])]) + + +# _LT_LIBTOOL_TAG_VARS(TAG) +# ------------------------- +m4_define([_LT_LIBTOOL_TAG_VARS], +[m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames), + [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])]) + + +# _LT_TAGVAR(VARNAME, [TAGNAME]) +# ------------------------------ +m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) + + +# _LT_CONFIG_COMMANDS +# ------------------- +# Send accumulated output to $CONFIG_STATUS. Thanks to the lists of +# variables for single and double quote escaping we saved from calls +# to _LT_DECL, we can put quote escaped variables declarations +# into 'config.status', and then the shell code to quote escape them in +# for loops in 'config.status'. Finally, any additional code accumulated +# from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. +m4_defun([_LT_CONFIG_COMMANDS], +[AC_PROVIDE_IFELSE([LT_OUTPUT], + dnl If the libtool generation code has been placed in $CONFIG_LT, + dnl instead of duplicating it all over again into config.status, + dnl then we will have config.status run $CONFIG_LT later, so it + dnl needs to know what name is stored there: + [AC_CONFIG_COMMANDS([libtool], + [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])], + dnl If the libtool generation code is destined for config.status, + dnl expand the accumulated commands and init code now: + [AC_CONFIG_COMMANDS([libtool], + [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])]) +])#_LT_CONFIG_COMMANDS + + +# Initialize. +m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT], +[ + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +sed_quote_subst='$sed_quote_subst' +double_quote_subst='$double_quote_subst' +delay_variable_subst='$delay_variable_subst' +_LT_CONFIG_STATUS_DECLARATIONS +LTCC='$LTCC' +LTCFLAGS='$LTCFLAGS' +compiler='$compiler_DEFAULT' + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +\$[]1 +_LTECHO_EOF' +} + +# Quote evaled strings. +for var in lt_decl_all_varnames([[ \ +]], lt_decl_quote_varnames); do + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in + *[[\\\\\\\`\\"\\\$]]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes + ;; + *) + 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\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes + ;; + *) + 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 0 = "$lt_write_fail" && chmod +x $1[]dnl +m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT + +# LT_OUTPUT +# --------- +# This macro allows early generation of the libtool script (before +# AC_OUTPUT is called), incase it is used in configure for compilation +# tests. +AC_DEFUN([LT_OUTPUT], +[: ${CONFIG_LT=./config.lt} +AC_MSG_NOTICE([creating $CONFIG_LT]) +_LT_GENERATED_FILE_INIT(["$CONFIG_LT"], +[# Run this file to recreate a libtool stub with the current configuration.]) + +cat >>"$CONFIG_LT" <<\_LTEOF +lt_cl_silent=false +exec AS_MESSAGE_LOG_FD>>config.log +{ + echo + AS_BOX([Running $as_me.]) +} >&AS_MESSAGE_LOG_FD + +lt_cl_help="\ +'$as_me' creates a local libtool stub from the current configuration, +for use in further configure time tests before the real libtool is +generated. + +Usage: $[0] [[OPTIONS]] + + -h, --help print this help, then exit + -V, --version print version number, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + +Report bugs to <bug-libtool@gnu.org>." + +lt_cl_version="\ +m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl +m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) +configured by $[0], generated by m4_PACKAGE_STRING. + +Copyright (C) 2011 Free Software Foundation, Inc. +This config.lt script is free software; the Free Software Foundation +gives unlimited permision to copy, distribute and modify it." + +while test 0 != $[#] +do + case $[1] in + --version | --v* | -V ) + echo "$lt_cl_version"; exit 0 ;; + --help | --h* | -h ) + echo "$lt_cl_help"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --quiet | --q* | --silent | --s* | -q ) + lt_cl_silent=: ;; + + -*) AC_MSG_ERROR([unrecognized option: $[1] +Try '$[0] --help' for more information.]) ;; + + *) AC_MSG_ERROR([unrecognized argument: $[1] +Try '$[0] --help' for more information.]) ;; + esac + shift +done + +if $lt_cl_silent; then + exec AS_MESSAGE_FD>/dev/null +fi +_LTEOF + +cat >>"$CONFIG_LT" <<_LTEOF +_LT_OUTPUT_LIBTOOL_COMMANDS_INIT +_LTEOF + +cat >>"$CONFIG_LT" <<\_LTEOF +AC_MSG_NOTICE([creating $ofile]) +_LT_OUTPUT_LIBTOOL_COMMANDS +AS_EXIT(0) +_LTEOF +chmod +x "$CONFIG_LT" + +# configure is writing to config.log, but config.lt does its own redirection, +# appending to config.log, which fails on DOS, as config.log is still kept +# open by configure. Here we exec the FD to /dev/null, effectively closing +# config.log, so it can be properly (re)opened and appended to by config.lt. +lt_cl_success=: +test yes = "$silent" && + 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 that 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 +# Generated automatically by $as_me ($PACKAGE) $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. + +# Provide generalized library-building support services. +# Written by Gordon Matzigkeit, 1996 + +_LT_COPYING +_LT_LIBTOOL_TAGS + +# Configured defaults for sys_lib_dlsearch_path munging. +: \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"} + +# ### BEGIN LIBTOOL CONFIG +_LT_LIBTOOL_CONFIG_VARS +_LT_LIBTOOL_TAG_VARS +# ### END LIBTOOL CONFIG + +_LT_EOF + + cat <<'_LT_EOF' >> "$cfgfile" + +# ### BEGIN FUNCTIONS SHARED WITH CONFIGURE + +_LT_PREPARE_MUNGE_PATH_LIST +_LT_PREPARE_CC_BASENAME + +# ### END FUNCTIONS SHARED WITH CONFIGURE + +_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 set != "${COLLECT_NAMES+set}"; 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) + + 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' + 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 0 = "$_lt_result"; 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 0 = "$_lt_result" && $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 yes = "$lt_cv_apple_cc_single_mod"; then + _lt_dar_single_mod='$single_module' + fi + if test yes = "$lt_cv_ld_exported_symbols_list"; 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 no = "$lt_cv_ld_force_load"; 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 yes = "$lt_cv_ld_force_load"; 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*|nagfor*) _lt_dar_can_shared=yes ;; + *) _lt_dar_can_shared=$GCC ;; + esac + if test yes = "$_lt_dar_can_shared"; 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 yes != "$lt_cv_apple_cc_single_mod"; 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 set = "${lt_cv_aix_libpath+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 that will find a shell with a builtin +# printf (that 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], +[AS_HELP_STRING([--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 yes = "$GCC"; 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 where 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 no = "$enable_libtool_lock" || 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 what ABI is being produced by ac_compile, and set mode + # options accordingly. + 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 what ABI is being produced by ac_compile, and set linker + # options accordingly. + echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + if test yes = "$lt_cv_prog_gnu_ld"; 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* + ;; + +mips64*-*linux*) + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. + echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + emul=elf + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + emul="${emul}32" + ;; + *64-bit*) + emul="${emul}64" + ;; + esac + case `/usr/bin/file conftest.$ac_objext` in + *MSB*) + emul="${emul}btsmip" + ;; + *LSB*) + emul="${emul}ltsmip" + ;; + esac + case `/usr/bin/file conftest.$ac_objext` in + *N32*) + emul="${emul}n32" + ;; + esac + LD="${LD-ld} -m $emul" + fi + rm -rf conftest* + ;; + +x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ +s390*-*linux*|s390*-*tpf*|sparc*-*linux*) + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. Note that the listed cases only cover the + # situations where additional linker options are needed (such as when + # doing 32-bit compilation for a host where ld defaults to 64-bit, or + # vice versa); the common cases where no linker options are needed do + # not appear in the list. + 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*) + case `/usr/bin/file conftest.o` in + *x86-64*) + LD="${LD-ld} -m elf32_x86_64" + ;; + *) + LD="${LD-ld} -m elf_i386" + ;; + esac + ;; + powerpc64le-*linux*) + LD="${LD-ld} -m elf32lppclinux" + ;; + 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" + ;; + powerpcle-*linux*) + LD="${LD-ld} -m elf64lppc" + ;; + 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 yes != "$lt_cv_cc_needs_belf"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS=$SAVE_CFLAGS + fi + ;; +*-*solaris*) + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. + 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*|x86_64-*-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 0 -eq "$ac_status"; then + # Ensure the archiver fails upon bogus file names. + rm -f conftest.$ac_objext libconftest.a + AC_TRY_EVAL([lt_ar_try]) + if test 0 -ne "$ac_status"; then + lt_cv_ar_at_file=@ + fi + fi + rm -f conftest.* libconftest.a + ]) + ]) + +if test no = "$lt_cv_ar_at_file"; 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 + bitrig* | 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" ## exclude from sc_useless_quotes_in_assignment + # 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 yes = "[$]$2"; 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 yes = "[$]$2"; 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; + ;; + + bitrig* | darwin* | dragonfly* | freebsd* | netbsd* | openbsd*) + # 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" && \ + test undefined != "$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 17 != "$i" # 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 yes = "$cross_compiling"; then : + [$4] +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +[#line $LINENO "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include <dlfcn.h> +#endif + +#include <stdio.h> + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +/* When -fvisibility=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 yes != "$enable_dlopen"; 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 + ]) + ;; + + tpf*) + # Don't try to run any link tests for TPF. We know it's impossible + # because TPF is a cross-compiler, and we know how we open DSOs. + lt_cv_dlopen=dlopen + lt_cv_dlopen_libs= + lt_cv_dlopen_self=no + ;; + + *) + 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 no = "$lt_cv_dlopen"; then + enable_dlopen=no + else + enable_dlopen=yes + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS=$CPPFLAGS + test yes = "$ac_cv_header_dlfcn_h" && 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 yes = "$lt_cv_dlopen_self"; 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 no = "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" && test no != "$need_locks"; 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 no = "$hard_links"; 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 where 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 yes = "$_LT_TAGVAR(hardcode_automatic, $1)"; then + + # We can hardcode non-existent directories. + if test no != "$_LT_TAGVAR(hardcode_direct, $1)" && + # 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 no != "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" && + test no != "$_LT_TAGVAR(hardcode_minus_L, $1)"; 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 relink = "$_LT_TAGVAR(hardcode_action, $1)" || + test yes = "$_LT_TAGVAR(inherit_rpath, $1)"; then + # Fast installation is not supported + enable_fast_install=no +elif test yes = "$shlibpath_overrides_runpath" || + test no = "$enable_shared"; 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_PREPARE_MUNGE_PATH_LIST +# --------------------------- +# Make sure func_munge_path_list() is defined correctly. +m4_defun([_LT_PREPARE_MUNGE_PATH_LIST], +[[# func_munge_path_list VARIABLE PATH +# ----------------------------------- +# VARIABLE is name of variable containing _space_ separated list of +# directories to be munged by the contents of PATH, which is string +# having a format: +# "DIR[:DIR]:" +# string "DIR[ DIR]" will be prepended to VARIABLE +# ":DIR[:DIR]" +# string "DIR[ DIR]" will be appended to VARIABLE +# "DIRP[:DIRP]::[DIRA:]DIRA" +# string "DIRP[ DIRP]" will be prepended to VARIABLE and string +# "DIRA[ DIRA]" will be appended to VARIABLE +# "DIR[:DIR]" +# VARIABLE will be replaced by "DIR[ DIR]" +func_munge_path_list () +{ + case x@S|@2 in + x) + ;; + *:) + eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'` \@S|@@S|@1\" + ;; + x:*) + eval @S|@1=\"\@S|@@S|@1 `$ECHO @S|@2 | $SED 's/:/ /g'`\" + ;; + *::*) + eval @S|@1=\"\@S|@@S|@1\ `$ECHO @S|@2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" + eval @S|@1=\"`$ECHO @S|@2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \@S|@@S|@1\" + ;; + *) + eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'`\" + ;; + esac +} +]])# _LT_PREPARE_PATH_LIST + + +# _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 +m4_require([_LT_PREPARE_MUNGE_PATH_LIST])dnl +AC_MSG_CHECKING([dynamic linker characteristics]) +m4_if([$1], + [], [ +if test yes = "$GCC"; 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` + # ...but if some path component already ends with the multilib dir we assume + # that all is fine and trust -print-search-dirs as is (GCC 4.2? or newer). + case "$lt_multi_os_dir; $lt_search_path_spec " in + "/; "* | "/.; "* | "/./; "* | *"$lt_multi_os_dir "* | *"$lt_multi_os_dir/ "*) + lt_multi_os_dir= + ;; + esac + 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" + elif test -n "$lt_multi_os_dir"; then + 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 + +AC_ARG_VAR([LT_SYS_LIBRARY_PATH], +[User-defined run-time library search path.]) + +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 ia64 = "$host_cpu"; 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 + # Using Import Files as archive members, it is possible to support + # filename-based versioning of shared library archives on AIX. While + # this would work for both with and without runtime linking, it will + # prevent static linking of such archives. So we do filename-based + # shared library versioning with .so extension only, which is used + # when both runtime linking and shared linking is enabled. + # Unfortunately, runtime linking may impact performance, so we do + # not want this to be the default eventually. Also, we use the + # versioned .so libs for executables only if there is the -brtl + # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. + # To allow for filename-based versioning support, we need to create + # libNAME.so.V as an archive file, containing: + # *) an Import File, referring to the versioned filename of the + # archive as well as the shared archive member, telling the + # bitwidth (32 or 64) of that shared object, and providing the + # list of exported symbols of that shared object, eventually + # decorated with the 'weak' keyword + # *) the shared object with the F_LOADONLY flag set, to really avoid + # it being seen by the linker. + # At run time we better use the real file rather than another symlink, + # but for link time we create the symlink libNAME.so -> libNAME.so.V + + case $with_aix_soname,$aix_use_runtimelinking in + # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + aix,yes) # traditional libtool + dynamic_linker='AIX unversionable lib.so' + # If using run time linking (on AIX 4.2 or later) use lib<name>.so + # instead of lib<name>.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + ;; + aix,no) # traditional AIX only + dynamic_linker='AIX lib.a[(]lib.so.V[)]' + # 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' + ;; + svr4,*) # full svr4 only + dynamic_linker="AIX lib.so.V[(]$shared_archive_member_spec.o[)]" + library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' + # We do not specify a path in Import Files, so LIBPATH fires. + shlibpath_overrides_runpath=yes + ;; + *,yes) # both, prefer svr4 + dynamic_linker="AIX lib.so.V[(]$shared_archive_member_spec.o[)], lib.a[(]lib.so.V[)]" + library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' + # unpreferred sharedlib libNAME.a needs extra handling + postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' + postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' + # We do not specify a path in Import Files, so LIBPATH fires. + shlibpath_overrides_runpath=yes + ;; + *,no) # both, prefer aix + dynamic_linker="AIX lib.a[(]lib.so.V[)], lib.so.V[(]$shared_archive_member_spec.o[)]" + library_names_spec='$libname$release.a $libname.a' + soname_spec='$libname$release$shared_ext$major' + # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling + postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' + postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' + ;; + esac + 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%'\''`; $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$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + 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 + ;; + +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=no + 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 32 = "$HPUX_IA64_MODE"; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + sys_lib_dlsearch_path_spec=/usr/lib/hpux32 + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + sys_lib_dlsearch_path_spec=/usr/lib/hpux64 + fi + ;; + 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 yes = "$lt_cv_prog_gnu_ld"; 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 + ;; + +linux*android*) + version_type=none # Android doesn't support versioned libraries. + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext' + soname_spec='$libname$release$shared_ext' + finish_cmds= + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + + # 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 + + dynamic_linker='Android linker' + # Don't embed -rpath directories since the linker doesn't support them. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + ;; + +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu | 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 + + # Ideally, we could use ldconfig to report *all* directores which are + # searched for libraries, however this is still not possible. Aside from not + # being certain /sbin/ldconfig is available, command + # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, + # even though it is searched at run-time. Try to do the best guess by + # appending ld.so.conf contents (and includes) to the search path. + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +*nto* | *qnx*) + version_type=qnx + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='ldqnx.so' + ;; + +openbsd* | bitrig*) + version_type=sunos + sys_lib_dlsearch_path_spec=/usr/lib + need_lib_prefix=no + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then + need_version=no + else + need_version=yes + fi + 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 + shlibpath_overrides_runpath=yes + ;; + +os2*) + libname_spec='$name' + version_type=windows + shrext_cmds=.dll + need_version=no + need_lib_prefix=no + # OS/2 can only load a DLL with a base name of 8 characters or less. + soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; + v=$($ECHO $release$versuffix | tr -d .-); + n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); + $ECHO $n$v`$shared_ext' + library_names_spec='${libname}_dll.$libext' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=BEGINLIBPATH + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + 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' + ;; + +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 yes = "$with_gnu_ld"; 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=sco + 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 yes = "$with_gnu_ld"; 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 no = "$dynamic_linker" && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test yes = "$GCC"; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then + sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec +fi + +if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then + sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec +fi + +# remember unaugmented sys_lib_dlsearch_path content for libtool script decls... +configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec + +# ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code +func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" + +# to be used as default LT_SYS_LIBRARY_PATH value in generated libtool +configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH + +_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], [configure_time_dlsearch_path], [2], + [Detected run-time system search path for libraries]) +_LT_DECL([], [configure_time_lt_sys_library_path], [2], + [Explicit LT_SYS_LIBRARY_PATH set during ./configure time]) +])# _LT_SYS_DYNAMIC_LINKER + + +# _LT_PATH_TOOL_PREFIX(TOOL) +# -------------------------- +# find a file program that 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 that 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 no = "$withval" || with_gnu_ld=yes], + [with_gnu_ld=no])dnl + +ac_prog=ld +if test yes = "$GCC"; 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 yes = "$with_gnu_ld"; then + AC_MSG_CHECKING([for GNU ld]) +else + AC_MSG_CHECKING([for non-GNU ld]) +fi +AC_CACHE_VAL(lt_cv_path_LD, +[if test -z "$LD"; then + lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS=$lt_save_ifs + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD=$ac_dir/$ac_prog + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in + *GNU* | *'with BFD'*) + test no != "$with_gnu_ld" && break + ;; + *) + test yes != "$with_gnu_ld" && break + ;; + esac + fi + done + IFS=$lt_save_ifs +else + lt_cv_path_LD=$LD # Let the user override the test with a path. +fi]) +LD=$lt_cv_path_LD +if test -n "$LD"; then + AC_MSG_RESULT($LD) +else + AC_MSG_RESULT(no) +fi +test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) +_LT_PATH_LD_GNU +AC_SUBST([LD]) + +_LT_TAGDECL([], [LD], [1], [The linker used to build libraries]) +])# LT_PATH_LD + +# Old names: +AU_ALIAS([AM_PROG_LD], [LT_PATH_LD]) +AU_ALIAS([AC_PROG_LD], [LT_PATH_LD]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AM_PROG_LD], []) +dnl AC_DEFUN([AC_PROG_LD], []) + + +# _LT_PATH_LD_GNU +#- -------------- +m4_defun([_LT_PATH_LD_GNU], +[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld, +[# I'd rather use --version here, but apparently some GNU lds only accept -v. +case `$LD -v 2>&1 </dev/null` in +*GNU* | *'with BFD'*) + lt_cv_prog_gnu_ld=yes + ;; +*) + lt_cv_prog_gnu_ld=no + ;; +esac]) +with_gnu_ld=$lt_cv_prog_gnu_ld +])# _LT_PATH_LD_GNU + + +# _LT_CMD_RELOAD +# -------------- +# find reload flag for linker +# -- PORTME Some linkers may need a different reload flag. +m4_defun([_LT_CMD_RELOAD], +[AC_CACHE_CHECK([for $LD option to reload object files], + lt_cv_ld_reload_flag, + [lt_cv_ld_reload_flag='-r']) +reload_flag=$lt_cv_ld_reload_flag +case $reload_flag in +"" | " "*) ;; +*) reload_flag=" $reload_flag" ;; +esac +reload_cmds='$LD$reload_flag -o $output$reload_objs' +case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + if test yes != "$GCC"; then + reload_cmds=false + fi + ;; + darwin*) + if test yes = "$GCC"; then + reload_cmds='$LTCC $LTCFLAGS -nostdlib $wl-r -o $output$reload_objs' + else + reload_cmds='$LD$reload_flag -o $output$reload_objs' + fi + ;; +esac +_LT_TAGDECL([], [reload_flag], [1], [How to create reloadable object files])dnl +_LT_TAGDECL([], [reload_cmds], [2])dnl +])# _LT_CMD_RELOAD + + +# _LT_PATH_DD +# ----------- +# find a working dd +m4_defun([_LT_PATH_DD], +[AC_CACHE_CHECK([for a working dd], [ac_cv_path_lt_DD], +[printf 0123456789abcdef0123456789abcdef >conftest.i +cat conftest.i conftest.i >conftest2.i +: ${lt_DD:=$DD} +AC_PATH_PROGS_FEATURE_CHECK([lt_DD], [dd], +[if "$ac_path_lt_DD" bs=32 count=1 <conftest2.i >conftest.out 2>/dev/null; then + cmp -s conftest.i conftest.out \ + && ac_cv_path_lt_DD="$ac_path_lt_DD" ac_path_lt_DD_found=: +fi]) +rm -f conftest.i conftest2.i conftest.out]) +])# _LT_PATH_DD + + +# _LT_CMD_TRUNCATE +# ---------------- +# find command to truncate a binary pipe +m4_defun([_LT_CMD_TRUNCATE], +[m4_require([_LT_PATH_DD]) +AC_CACHE_CHECK([how to truncate binary pipes], [lt_cv_truncate_bin], +[printf 0123456789abcdef0123456789abcdef >conftest.i +cat conftest.i conftest.i >conftest2.i +lt_cv_truncate_bin= +if "$ac_cv_path_lt_DD" bs=32 count=1 <conftest2.i >conftest.out 2>/dev/null; then + cmp -s conftest.i conftest.out \ + && lt_cv_truncate_bin="$ac_cv_path_lt_DD bs=4096 count=1" +fi +rm -f conftest.i conftest2.i conftest.out +test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q"]) +_LT_DECL([lt_truncate_bin], [lt_cv_truncate_bin], [1], + [Command to truncate a binary pipe]) +])# _LT_CMD_TRUNCATE + + +# _LT_CHECK_MAGIC_METHOD +# ---------------------- +# how to check for library dependencies +# -- PORTME fill in with the dynamic library characteristics +m4_defun([_LT_CHECK_MAGIC_METHOD], +[m4_require([_LT_DECL_EGREP]) +m4_require([_LT_DECL_OBJDUMP]) +AC_CACHE_CHECK([how to recognize dependent libraries], +lt_cv_deplibs_check_method, +[lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file= +lt_cv_deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# 'unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [[regex]]' -- check by looking for files in library path +# that 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. + if ( 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 + ;; + +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 | 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* | bitrig*) + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; 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 + ;; +os2*) + 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 + # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty + case $build_os in + mingw*) lt_bad_file=conftest.nm/nofile ;; + *) lt_bad_file=/dev/null ;; + esac + case `"$tmp_nm" -B $lt_bad_file 2>&1 | sed '1q'` in + *$lt_bad_file* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break 2 + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break 2 + ;; + *) + 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 no != "$lt_cv_path_NM"; 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 -headers /dev/null 2>&1 | sed '1q'` in + *COFF*) + DUMPBIN="$DUMPBIN -symbols -headers" + ;; + *) + 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 one 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 yes != "$lt_cv_path_mainfest_tool"; then + MANIFEST_TOOL=: +fi +_LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl +])# _LT_PATH_MANIFEST_TOOL + + +# _LT_DLL_DEF_P([FILE]) +# --------------------- +# True iff FILE is a Windows DLL '.def' file. +# Keep in sync with func_dll_def_p in the libtool script +AC_DEFUN([_LT_DLL_DEF_P], +[dnl + test DEF = "`$SED -n dnl + -e '\''s/^[[ ]]*//'\'' dnl Strip leading whitespace + -e '\''/^\(;.*\)*$/d'\'' dnl Delete empty lines and comments + -e '\''s/^\(EXPORTS\|LIBRARY\)\([[ ]].*\)*$/DEF/p'\'' dnl + -e q dnl Only consider the first "real" line + $1`" dnl +])# _LT_DLL_DEF_P + + +# 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 yes = "$GCC"; 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 ia64 = "$host_cpu"; 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 + +if test "$lt_cv_nm_interface" = "MS dumpbin"; then + # Gets list of data symbols to import. + lt_cv_sys_global_symbol_to_import="sed -n -e 's/^I .* \(.*\)$/\1/p'" + # Adjust the below global symbol transforms to fixup imported variables. + lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'" + lt_c_name_hook=" -e 's/^I .* \(.*\)$/ {\"\1\", (void *) 0},/p'" + lt_c_name_lib_hook="\ + -e 's/^I .* \(lib.*\)$/ {\"\1\", (void *) 0},/p'\ + -e 's/^I .* \(.*\)$/ {\"lib\1\", (void *) 0},/p'" +else + # Disable hooks by default. + lt_cv_sys_global_symbol_to_import= + lt_cdecl_hook= + lt_c_name_hook= + lt_c_name_lib_hook= +fi + +# 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"\ +$lt_cdecl_hook\ +" -e 's/^T .* \(.*\)$/extern int \1();/p'"\ +" -e 's/^$symcode$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"\ +$lt_c_name_hook\ +" -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ +" -e 's/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/p'" + +# Transform an extracted symbol line into symbol name with lib prefix and +# symbol address. +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n"\ +$lt_c_name_lib_hook\ +" -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ +" -e 's/^$symcode$symcode* .* \(lib.*\)$/ {\"\1\", (void *) \&\1},/p'"\ +" -e 's/^$symcode$symcode* .* \(.*\)$/ {\"lib\1\", (void *) \&\1},/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, + # D for any global variable and I for any imported 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};"\ +" /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\ +" /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\ +" /^ *Type *: data/{print \"I\",si,substr(si,length(prfx))};"\ +" \$ 0!~/External *\|/{next};"\ +" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ +" {if(hide[section]) next};"\ +" {f=\"D\"}; \$ 0~/\(\).*\|/{f=\"T\"};"\ +" {split(\$ 0,a,/\||\r/); split(a[2],s)};"\ +" s[1]~/^[@?]/{print f,s[1],s[1]; next};"\ +" s[1]~prfx {split(s[1],t,\"@\"); print f,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 can'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* .* \(.*\)$/ {\"\1\", (void *) \&\1},/" < "$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 yes = "$pipe_works"; 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_import], [lt_cv_sys_global_symbol_to_import], [1], + [Transform the output of nm into a list of symbols to manually relocate]) +_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_interface], [lt_cv_nm_interface], [1], + [The name lister interface]) +_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 yes = "$GXX"; 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 ia64 = "$host_cpu"; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + + 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']) + case $host_os in + os2*) + _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' + ;; + esac + ;; + 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 ia64 = "$host_cpu"; 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 ia64 != "$host_cpu"; 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 | 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 yes = "$GCC"; 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 ia64 = "$host_cpu"; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + + 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']) + case $host_os in + os2*) + _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' + ;; + esac + ;; + + 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 ia64 = "$host_cpu"; 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 + ;; + + 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' + case $cc_basename in + 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' + ;; + esac + ;; + + 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']) + case $host_os in + os2*) + _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' + ;; + esac + ;; + + 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 | 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' + ;; + tcc*) + # Fabrice Bellard et al's Tiny 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)='-static' + ;; + 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 that 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 GNU nm, but means don't demangle to AIX nm. + # Without the "-l" option, or with the "-B" option, AIX nm treats + # weak defined symbols like other global defined symbols, whereas + # GNU nm marks them as "W". + # While the 'weak' keyword is ignored in the Export File, we need + # it in the Import File for the 'aix-soname' feature, so we have + # to replace the "-B" option with "-P" for AIX nm. + 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) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' + else + _LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | 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 yes != "$GCC"; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; + openbsd* | bitrig*) + 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 yes = "$with_gnu_ld"; 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 yes = "$lt_use_gnu_ld_interface"; 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 | $SED -e 's/([^)]\+)\s\+//' 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 ia64 != "$host_cpu"; then + _LT_TAGVAR(ld_shlibs, $1)=no + cat <<_LT_EOF 1>&2 + +*** Warning: the GNU linker, at least up to release 2.19, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to install binutils +*** 2.20 or above, or modify your PATH so that a non-GNU linker is found. +*** You will then need to restart the configuration process. + +_LT_EOF + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='' + ;; + m68k) + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + # Joseph Beckenbach <jrb3@best.com> says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-all-symbols' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=no + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file, use it as + # is; otherwise, prepend EXPORTS... + _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); 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 + ;; + + os2*) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + shrext_cmds=.dll + _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + prefix_cmds="$SED"~ + if test EXPORTS = "`$SED 1q $export_symbols`"; then + prefix_cmds="$prefix_cmds -e 1d"; + fi~ + prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ + cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' + _LT_TAGVAR(enable_shared_with_static_runtimes, $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 linux-dietlibc = "$host_os"; 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 no = "$tmp_diet" + 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' ;; + nagfor*) # NAGFOR 5.3 + tmp_sharedflag='-Wl,-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 yes = "$supports_anon_versioning"; 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 + tcc*) + _LT_TAGVAR(export_dynamic_flag_spec, $1)='-rdynamic' + ;; + 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 yes = "$supports_anon_versioning"; 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 cannot +*** 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 no = "$_LT_TAGVAR(ld_shlibs, $1)"; 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 yes = "$GCC" && 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 ia64 = "$host_cpu"; 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 GNU nm, but means don't demangle to AIX nm. + # Without the "-l" option, or with the "-B" option, AIX nm treats + # weak defined symbols like other global defined symbols, whereas + # GNU nm marks them as "W". + # While the 'weak' keyword is ignored in the Export File, we need + # it in the Import File for the 'aix-soname' feature, so we have + # to replace the "-B" option with "-P" for AIX nm. + 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) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' + else + _LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | 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 + # have runtime linking enabled, and use it for executables. + # For shared libraries, we enable/disable runtime linking + # depending on the kind of the shared library created - + # when "with_aix_soname,aix_use_runtimelinking" is: + # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables + # "aix,yes" lib.so shared, rtl:yes, for executables + # lib.a static archive + # "both,no" lib.so.V(shr.o) shared, rtl:yes + # lib.a(lib.so.V) shared, rtl:no, for executables + # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables + # lib.a(lib.so.V) shared, rtl:no + # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables + # lib.a static archive + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) + for ld_flag in $LDFLAGS; do + if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then + aix_use_runtimelinking=yes + break + fi + done + if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then + # With aix-soname=svr4, we create the lib.so.V shared archives only, + # so we don't have lib.a shared libs to link our executables. + # We have to force runtime linking in this case. + aix_use_runtimelinking=yes + LDFLAGS="$LDFLAGS -Wl,-brtl" + fi + ;; + 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,' + case $with_aix_soname,$aix_use_runtimelinking in + aix,*) ;; # traditional, no import file + svr4,* | *,yes) # use import file + # The Import File defines what to hardcode. + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=no + ;; + esac + + if test yes = "$GCC"; 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 yes = "$aix_use_runtimelinking"; then + shared_flag="$shared_flag "'$wl-G' + fi + # Need to ensure runtime linking is disabled for the traditional + # shared library, or the linker may eventually find shared libraries + # /with/ Import File - we do not want to mix them. + shared_flag_aix='-shared' + shared_flag_svr4='-shared $wl-G' + else + # not using gcc + if test ia64 = "$host_cpu"; 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 yes = "$aix_use_runtimelinking"; then + shared_flag='$wl-G' + else + shared_flag='$wl-bM:SRE' + fi + shared_flag_aix='$wl-bM:SRE' + shared_flag_svr4='$wl-G' + 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,yes = "$with_aix_soname,$aix_use_runtimelinking"; 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 -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag + else + if test ia64 = "$host_cpu"; 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 yes = "$with_gnu_ld"; 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 + _LT_TAGVAR(archive_expsym_cmds, $1)='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' + # -brtl affects multiple linker settings, -berok does not and is overridden later + compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([[, ]]\\)%-berok\\1%g"`' + if test svr4 != "$with_aix_soname"; then + # This is similar to how AIX traditionally builds its shared libraries. + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' + fi + if test aix != "$with_aix_soname"; then + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' + else + # used by -dlpreopen to get the symbols + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$MV $output_objdir/$realname.d/$soname $output_objdir' + fi + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$RM -r $output_objdir/$realname.d' + 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,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' + _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then + cp "$export_symbols" "$output_objdir/$soname.def"; + echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; + else + $SED -e '\''s/^/-link -EXPORT:/'\'' < $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 yes = "$GCC"; 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 "x$output_objdir/$soname" = "x$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 "x$output_objdir/$soname" = "x$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 yes,no = "$GCC,$with_gnu_ld"; 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 no = "$with_gnu_ld"; 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 yes,no = "$GCC,$with_gnu_ld"; 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 no = "$with_gnu_ld"; 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 yes = "$GCC"; 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 yes = "$lt_cv_irix_exported_symbol"; 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 + ;; + + linux*) + case $cc_basename in + tcc*) + # Fabrice Bellard et al's Tiny C Compiler + _LT_TAGVAR(ld_shlibs, $1)=yes + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + + 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* | bitrig*) + 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__`"; 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 + _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' + 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 + shrext_cmds=.dll + _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + prefix_cmds="$SED"~ + if test EXPORTS = "`$SED 1q $export_symbols`"; then + prefix_cmds="$prefix_cmds -e 1d"; + fi~ + prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ + cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + ;; + + osf3*) + if test yes = "$GCC"; 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 yes = "$GCC"; 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 yes = "$GCC"; 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 yes = "$GCC"; 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 sequent = "$host_vendor"; 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 yes = "$GCC"; 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 CANNOT 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 yes = "$GCC"; 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 sni = "$host_vendor"; 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 no = "$_LT_TAGVAR(ld_shlibs, $1)" && 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 yes,yes = "$GCC,$enable_shared"; 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 what 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 no = "$can_build_shared" && 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 yes = "$enable_shared" && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + + aix[[4-9]]*) + if test ia64 != "$host_cpu"; then + case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in + yes,aix,yes) ;; # shared object as lib.so file only + yes,svr4,*) ;; # shared object as lib.so archive member only + yes,*) enable_static=no ;; # shared object in lib.a archive as well + esac + 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 yes = "$enable_shared" || 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 no != "$CXX" && + ( (test g++ = "$CXX" && `g++ -v >/dev/null 2>&1` ) || + (test g++ != "$CXX"))); 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 yes != "$_lt_caught_CXX_error"; 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 yes = "$GXX"; 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 yes = "$GXX"; 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 yes = "$with_gnu_ld"; 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 ia64 = "$host_cpu"; 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 + # have runtime linking enabled, and use it for executables. + # For shared libraries, we enable/disable runtime linking + # depending on the kind of the shared library created - + # when "with_aix_soname,aix_use_runtimelinking" is: + # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables + # "aix,yes" lib.so shared, rtl:yes, for executables + # lib.a static archive + # "both,no" lib.so.V(shr.o) shared, rtl:yes + # lib.a(lib.so.V) shared, rtl:no, for executables + # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables + # lib.a(lib.so.V) shared, rtl:no + # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables + # lib.a static archive + 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 + if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then + # With aix-soname=svr4, we create the lib.so.V shared archives only, + # so we don't have lib.a shared libs to link our executables. + # We have to force runtime linking in this case. + aix_use_runtimelinking=yes + LDFLAGS="$LDFLAGS -Wl,-brtl" + fi + ;; + 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,' + case $with_aix_soname,$aix_use_runtimelinking in + aix,*) ;; # no import file + svr4,* | *,yes) # use import file + # The Import File defines what to hardcode. + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=no + ;; + esac + + if test yes = "$GXX"; 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 yes = "$aix_use_runtimelinking"; then + shared_flag=$shared_flag' $wl-G' + fi + # Need to ensure runtime linking is disabled for the traditional + # shared library, or the linker may eventually find shared libraries + # /with/ Import File - we do not want to mix them. + shared_flag_aix='-shared' + shared_flag_svr4='-shared $wl-G' + else + # not using gcc + if test ia64 = "$host_cpu"; 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 yes = "$aix_use_runtimelinking"; then + shared_flag='$wl-G' + else + shared_flag='$wl-bM:SRE' + fi + shared_flag_aix='$wl-bM:SRE' + shared_flag_svr4='$wl-G' + 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,yes = "$with_aix_soname,$aix_use_runtimelinking"; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + # The "-G" linker flag allows undefined symbols. + _LT_TAGVAR(no_undefined_flag, $1)='-bernotok' + # 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 -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag + else + if test ia64 = "$host_cpu"; 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 yes = "$with_gnu_ld"; 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 + _LT_TAGVAR(archive_expsym_cmds, $1)='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' + # -brtl affects multiple linker settings, -berok does not and is overridden later + compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([[, ]]\\)%-berok\\1%g"`' + if test svr4 != "$with_aix_soname"; then + # This is similar to how AIX traditionally builds its shared + # libraries. Need -bnortl late, we may have -brtl in LDFLAGS. + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' + fi + if test aix != "$with_aix_soname"; then + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' + else + # used by -dlpreopen to get the symbols + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$MV $output_objdir/$realname.d/$soname $output_objdir' + fi + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$RM -r $output_objdir/$realname.d' + fi + fi + ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + # Joseph Beckenbach <jrb3@best.com> says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + chorus*) + case $cc_basename in + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + cygwin* | mingw* | pw32* | cegcc*) + case $GXX,$cc_basename in + ,cl* | no,cl*) + # Native MSVC + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=.dll + # FIXME: Setting linknames here is a bad hack. + _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' + _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then + cp "$export_symbols" "$output_objdir/$soname.def"; + echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; + else + $SED -e '\''s/^/-link -EXPORT:/'\'' < $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, use it as + # is; otherwise, prepend EXPORTS... + _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); 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) + ;; + + os2*) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + shrext_cmds=.dll + _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + prefix_cmds="$SED"~ + if test EXPORTS = "`$SED 1q $export_symbols`"; then + prefix_cmds="$prefix_cmds -e 1d"; + fi~ + prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ + cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + ;; + + 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 + ;; + + 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 "x$output_objdir/$soname" = "x$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 yes = "$GXX"; 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 "x$output_objdir/$soname" = "x$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 no = "$with_gnu_ld"; 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 yes = "$GXX"; then + if test no = "$with_gnu_ld"; 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 yes = "$GXX"; then + if test no = "$with_gnu_ld"; 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 | 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 yes = "$supports_anon_versioning"; 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 + ;; + + openbsd* | bitrig*) + 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__`"; 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 yes,no = "$GXX,$with_gnu_ld"; 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 yes,no = "$GXX,$with_gnu_ld"; 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 $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 $wl-h $wl$soname -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 $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 $wl-h $wl$soname -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 CANNOT 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 no = "$_LT_TAGVAR(ld_shlibs, $1)" && 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 yes != "$_lt_caught_CXX_error" + +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 @S|@2 in + .*) func_stripname_result=`$ECHO "@S|@3" | $SED "s%^@S|@1%%; s%\\\\@S|@2\$%%"`;; + *) func_stripname_result=`$ECHO "@S|@3" | $SED "s%^@S|@1%%; s%@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 x-L = "$p" || + test x-R = "$p"; 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 no = "$pre_test_object_deps_done"; 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 no = "$pre_test_object_deps_done"; 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)= + ;; +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 no = "$F77"; 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 yes != "$_lt_disable_F77"; 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 no = "$can_build_shared" && 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 yes = "$enable_shared" && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + aix[[4-9]]*) + if test ia64 != "$host_cpu"; then + case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in + yes,aix,yes) ;; # shared object as lib.so file only + yes,svr4,*) ;; # shared object as lib.so archive member only + yes,*) enable_static=no ;; # shared object in lib.a archive as well + esac + 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 yes = "$enable_shared" || 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 yes != "$_lt_disable_F77" + +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 no = "$FC"; 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 yes != "$_lt_disable_FC"; 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 no = "$can_build_shared" && 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 yes = "$enable_shared" && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + aix[[4-9]]*) + if test ia64 != "$host_cpu"; then + case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in + yes,aix,yes) ;; # shared object as lib.so file only + yes,svr4,*) ;; # shared object as lib.so archive member only + yes,*) enable_static=no ;; # shared object in lib.a archive as well + esac + 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 yes = "$enable_shared" || 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 yes != "$_lt_disable_FC" + +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 set = "${GCJFLAGS+set}" || 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 10 -lt "$lt_ac_count" && 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], +[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_PATH_CONVERSION_FUNCTIONS +# ----------------------------- +# Determine what file name conversion functions should be used by +# func_to_host_file (and, implicitly, by func_to_host_path). These are needed +# for certain cross-compile configurations and native mingw. +m4_defun([_LT_PATH_CONVERSION_FUNCTIONS], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_MSG_CHECKING([how to convert $build file names to $host format]) +AC_CACHE_VAL(lt_cv_to_host_file_cmd, +[case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 + ;; + esac + ;; + *-*-cygwin* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin + ;; + esac + ;; + * ) # unhandled hosts (and "normal" native builds) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; +esac +]) +to_host_file_cmd=$lt_cv_to_host_file_cmd +AC_MSG_RESULT([$lt_cv_to_host_file_cmd]) +_LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd], + [0], [convert $build file names to $host format])dnl + +AC_MSG_CHECKING([how to convert $build file names to toolchain format]) +AC_CACHE_VAL(lt_cv_to_tool_file_cmd, +[#assume ordinary cross tools, or native build. +lt_cv_to_tool_file_cmd=func_convert_file_noop +case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 + ;; + esac + ;; +esac +]) +to_tool_file_cmd=$lt_cv_to_tool_file_cmd +AC_MSG_RESULT([$lt_cv_to_tool_file_cmd]) +_LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd], + [0], [convert $build files to toolchain format])dnl +])# _LT_PATH_CONVERSION_FUNCTIONS diff --git a/m4/ltoptions.m4 b/m4/ltoptions.m4 new file mode 100644 index 0000000000000000000000000000000000000000..94b082976667c0c9edf2e9ff7a668c1fd7d997bf --- /dev/null +++ b/m4/ltoptions.m4 @@ -0,0 +1,437 @@ +# Helper functions for option handling. -*- Autoconf -*- +# +# Copyright (C) 2004-2005, 2007-2009, 2011-2015 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 8 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_UNLESS_OPTIONS([LT_INIT], [aix-soname=aix aix-soname=both aix-soname=svr4], + [_LT_WITH_AIX_SONAME([aix])]) + ]) +])# _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_AIX_SONAME([DEFAULT]) +# ---------------------------------- +# implement the --with-aix-soname flag, and support the `aix-soname=aix' +# and `aix-soname=both' and `aix-soname=svr4' LT_INIT options. DEFAULT +# is either `aix', `both' or `svr4'. If omitted, it defaults to `aix'. +m4_define([_LT_WITH_AIX_SONAME], +[m4_define([_LT_WITH_AIX_SONAME_DEFAULT], [m4_if($1, svr4, svr4, m4_if($1, both, both, aix))])dnl +shared_archive_member_spec= +case $host,$enable_shared in +power*-*-aix[[5-9]]*,yes) + AC_MSG_CHECKING([which variant of shared library versioning to provide]) + AC_ARG_WITH([aix-soname], + [AS_HELP_STRING([--with-aix-soname=aix|svr4|both], + [shared library versioning (aka "SONAME") variant to provide on AIX, @<:@default=]_LT_WITH_AIX_SONAME_DEFAULT[@:>@.])], + [case $withval in + aix|svr4|both) + ;; + *) + AC_MSG_ERROR([Unknown argument to --with-aix-soname]) + ;; + esac + lt_cv_with_aix_soname=$with_aix_soname], + [AC_CACHE_VAL([lt_cv_with_aix_soname], + [lt_cv_with_aix_soname=]_LT_WITH_AIX_SONAME_DEFAULT) + with_aix_soname=$lt_cv_with_aix_soname]) + AC_MSG_RESULT([$with_aix_soname]) + if test aix != "$with_aix_soname"; then + # For the AIX way of multilib, we name the shared archive member + # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o', + # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File. + # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag, + # the AIX toolchain works better with OBJECT_MODE set (default 32). + if test 64 = "${OBJECT_MODE-32}"; then + shared_archive_member_spec=shr_64 + else + shared_archive_member_spec=shr + fi + fi + ;; +*) + with_aix_soname=aix + ;; +esac + +_LT_DECL([], [shared_archive_member_spec], [0], + [Shared archive member basename, for filename based shared library versioning on AIX])dnl +])# _LT_WITH_AIX_SONAME + +LT_OPTION_DEFINE([LT_INIT], [aix-soname=aix], [_LT_WITH_AIX_SONAME([aix])]) +LT_OPTION_DEFINE([LT_INIT], [aix-soname=both], [_LT_WITH_AIX_SONAME([both])]) +LT_OPTION_DEFINE([LT_INIT], [aix-soname=svr4], [_LT_WITH_AIX_SONAME([svr4])]) + + +# _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=m4_default([$1], [default])]) + +_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl +])# _LT_WITH_PIC + +LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) +LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) + +# Old name: +AU_DEFUN([AC_LIBTOOL_PICMODE], +[_LT_SET_OPTION([LT_INIT], [pic-only]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you +put the 'pic-only' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) + +## ----------------- ## +## LTDL_INIT Options ## +## ----------------- ## + +m4_define([_LTDL_MODE], []) +LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], + [m4_define([_LTDL_MODE], [nonrecursive])]) +LT_OPTION_DEFINE([LTDL_INIT], [recursive], + [m4_define([_LTDL_MODE], [recursive])]) +LT_OPTION_DEFINE([LTDL_INIT], [subproject], + [m4_define([_LTDL_MODE], [subproject])]) + +m4_define([_LTDL_TYPE], []) +LT_OPTION_DEFINE([LTDL_INIT], [installable], + [m4_define([_LTDL_TYPE], [installable])]) +LT_OPTION_DEFINE([LTDL_INIT], [convenience], + [m4_define([_LTDL_TYPE], [convenience])]) diff --git a/m4/ltsugar.m4 b/m4/ltsugar.m4 new file mode 100644 index 0000000000000000000000000000000000000000..48bc9344a4d661e116be1483d5520753875b2bd1 --- /dev/null +++ b/m4/ltsugar.m4 @@ -0,0 +1,124 @@ +# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- +# +# Copyright (C) 2004-2005, 2007-2008, 2011-2015 Free Software +# Foundation, Inc. +# Written by Gary V. Vaughan, 2004 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# serial 6 ltsugar.m4 + +# This is to help aclocal find these macros, as it can't see m4_define. +AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) + + +# lt_join(SEP, ARG1, [ARG2...]) +# ----------------------------- +# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their +# associated separator. +# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier +# versions in m4sugar had bugs. +m4_define([lt_join], +[m4_if([$#], [1], [], + [$#], [2], [[$2]], + [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) +m4_define([_lt_join], +[m4_if([$#$2], [2], [], + [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) + + +# lt_car(LIST) +# lt_cdr(LIST) +# ------------ +# Manipulate m4 lists. +# These macros are necessary as long as will still need to support +# Autoconf-2.59, which quotes differently. +m4_define([lt_car], [[$1]]) +m4_define([lt_cdr], +[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], + [$#], 1, [], + [m4_dquote(m4_shift($@))])]) +m4_define([lt_unquote], $1) + + +# lt_append(MACRO-NAME, STRING, [SEPARATOR]) +# ------------------------------------------ +# Redefine MACRO-NAME to hold its former content plus 'SEPARATOR''STRING'. +# Note that neither SEPARATOR nor STRING are expanded; they are appended +# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). +# No SEPARATOR is output if MACRO-NAME was previously undefined (different +# than defined and empty). +# +# This macro is needed until we can rely on Autoconf 2.62, since earlier +# versions of m4sugar mistakenly expanded SEPARATOR but not STRING. +m4_define([lt_append], +[m4_define([$1], + m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) + + + +# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) +# ---------------------------------------------------------- +# Produce a SEP delimited list of all paired combinations of elements of +# PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list +# has the form PREFIXmINFIXSUFFIXn. +# Needed until we can rely on m4_combine added in Autoconf 2.62. +m4_define([lt_combine], +[m4_if(m4_eval([$# > 3]), [1], + [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl +[[m4_foreach([_Lt_prefix], [$2], + [m4_foreach([_Lt_suffix], + ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, + [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) + + +# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) +# ----------------------------------------------------------------------- +# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited +# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. +m4_define([lt_if_append_uniq], +[m4_ifdef([$1], + [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], + [lt_append([$1], [$2], [$3])$4], + [$5])], + [lt_append([$1], [$2], [$3])$4])]) + + +# lt_dict_add(DICT, KEY, VALUE) +# ----------------------------- +m4_define([lt_dict_add], +[m4_define([$1($2)], [$3])]) + + +# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) +# -------------------------------------------- +m4_define([lt_dict_add_subkey], +[m4_define([$1($2:$3)], [$4])]) + + +# lt_dict_fetch(DICT, KEY, [SUBKEY]) +# ---------------------------------- +m4_define([lt_dict_fetch], +[m4_ifval([$3], + m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), + m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) + + +# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) +# ----------------------------------------------------------------- +m4_define([lt_if_dict_fetch], +[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], + [$5], + [$6])]) + + +# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) +# -------------------------------------------------------------- +m4_define([lt_dict_filter], +[m4_if([$5], [], [], + [lt_join(m4_quote(m4_default([$4], [[, ]])), + lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), + [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl +]) diff --git a/m4/ltversion.m4 b/m4/ltversion.m4 new file mode 100644 index 0000000000000000000000000000000000000000..fa04b52a3bf868bd57e7ba796d64385a51e7ec5a --- /dev/null +++ b/m4/ltversion.m4 @@ -0,0 +1,23 @@ +# ltversion.m4 -- version numbers -*- Autoconf -*- +# +# Copyright (C) 2004, 2011-2015 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 4179 ltversion.m4 +# This file is part of GNU Libtool + +m4_define([LT_PACKAGE_VERSION], [2.4.6]) +m4_define([LT_PACKAGE_REVISION], [2.4.6]) + +AC_DEFUN([LTVERSION_VERSION], +[macro_version='2.4.6' +macro_revision='2.4.6' +_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) +_LT_DECL(, macro_revision, 0) +]) diff --git a/m4/lt~obsolete.m4 b/m4/lt~obsolete.m4 new file mode 100644 index 0000000000000000000000000000000000000000..c6b26f88f6c3c1a052afa6314ba2adf832d785ee --- /dev/null +++ b/m4/lt~obsolete.m4 @@ -0,0 +1,99 @@ +# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- +# +# Copyright (C) 2004-2005, 2007, 2009, 2011-2015 Free Software +# Foundation, Inc. +# Written by Scott James Remnant, 2004. +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# serial 5 lt~obsolete.m4 + +# These exist entirely to fool aclocal when bootstrapping libtool. +# +# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN), +# which have later been changed to m4_define as they aren't part of the +# exported API, or moved to Autoconf or Automake where they belong. +# +# The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN +# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us +# using a macro with the same name in our local m4/libtool.m4 it'll +# pull the old libtool.m4 in (it doesn't see our shiny new m4_define +# and doesn't know about Autoconf macros at all.) +# +# So we provide this file, which has a silly filename so it's always +# included after everything else. This provides aclocal with the +# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything +# because those macros already exist, or will be overwritten later. +# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. +# +# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. +# Yes, that means every name once taken will need to remain here until +# we give up compatibility with versions before 1.7, at which point +# we need to keep only those names which we still refer to. + +# This is to help aclocal find these macros, as it can't see m4_define. +AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) + +m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) +m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) +m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) +m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) +m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) +m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) +m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) +m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) +m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) +m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) +m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) +m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) +m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) +m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) +m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) +m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) +m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) +m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) +m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) +m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) +m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) +m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) +m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) +m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) +m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) +m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) +m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) +m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) +m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) +m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) +m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) +m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) +m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) +m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) +m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) +m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) +m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) +m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) +m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) +m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) +m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) +m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) +m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) +m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) +m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) +m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) +m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) +m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) +m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) +m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) +m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) +m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) +m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) +m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) +m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) +m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) +m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) diff --git a/src/Makefile.in b/src/Makefile.in new file mode 100644 index 0000000000000000000000000000000000000000..b1322a41e1b8174c27f973d296680b765cab5f43 --- /dev/null +++ b/src/Makefile.in @@ -0,0 +1,1620 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 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@ + + + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +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@ +EXTRA_PROGRAMS = make_fint$(EXEEXT) +@ENABLE_CDI_LIB_TRUE@am__append_1 = \ +@ENABLE_CDI_LIB_TRUE@ calendar.h \ +@ENABLE_CDI_LIB_TRUE@ cdi.h \ +@ENABLE_CDI_LIB_TRUE@ cdi_datetime.h \ +@ENABLE_CDI_LIB_TRUE@ julian_date.h + +@ENABLE_CDI_LIB_TRUE@am__append_2 = libcdi.la +@ENABLE_CDI_LIB_TRUE@am__append_3 = pkgconfig/cdi.pc +@ENABLE_CDI_LIB_TRUE@am__append_4 = \ +@ENABLE_CDI_LIB_TRUE@ cmake/cdi/cdi-config-version.cmake \ +@ENABLE_CDI_LIB_TRUE@ cmake/cdi/cdi-config.cmake + +@ENABLE_CDI_LIB_TRUE@@ENABLE_CF_INTERFACE_TRUE@am__append_5 = cdi.inc +@ENABLE_CDI_LIB_TRUE@@ENABLE_ISOC_INTERFACE_TRUE@am__append_6 = $(mo_cdi_mod) +@ENABLE_CDI_LIB_TRUE@@ENABLE_ISOC_INTERFACE_TRUE@am__append_7 = libcdi_f2003.la +@ENABLE_CDI_LIB_TRUE@@ENABLE_ISOC_INTERFACE_TRUE@am__append_8 = pkgconfig/cdi_f2003.pc +@ENABLE_CDI_LIB_TRUE@@ENABLE_MPI_TRUE@am__append_9 = cdipio.h +@ENABLE_CDI_LIB_TRUE@@ENABLE_MPI_TRUE@am__append_10 = libcdipio.la +@ENABLE_CDI_LIB_TRUE@@ENABLE_MPI_TRUE@am__append_11 = pkgconfig/cdipio.pc +@ENABLE_CDI_LIB_TRUE@@ENABLE_CF_INTERFACE_TRUE@@ENABLE_MPI_TRUE@am__append_12 = cdipio.inc +@ENABLE_CDI_LIB_FALSE@am__append_13 = libcdi.la +@ENABLE_CDI_LIB_FALSE@@ENABLE_ISOC_INTERFACE_TRUE@am__append_14 = libcdi_f2003.la +@ENABLE_CDI_LIB_FALSE@@ENABLE_MPI_TRUE@am__append_15 = libcdipio.la +@with_on_demand_check_programs_TRUE@am__append_16 = libcdiresunpack.la +@with_on_demand_check_programs_FALSE@am__append_17 = libcdiresunpack.la +# TODO: this needs a refactoring but for now we set this macro here and not in +# config.h because the macro is used in several files that do not include the +# header file directly. +@ENABLE_MPI_TRUE@am__append_18 = -DUSE_MPI +@ENABLE_CF_INTERFACE_TRUE@am__append_19 = \ +@ENABLE_CF_INTERFACE_TRUE@ cdiFortran.c \ +@ENABLE_CF_INTERFACE_TRUE@ cfortran.h + +@HAVE_LIBGRIB_API_TRUE@am__append_20 = \ +@HAVE_LIBGRIB_API_TRUE@ gribapi_utilities.c \ +@HAVE_LIBGRIB_API_TRUE@ stream_gribapi.c + +@ENABLE_CF_INTERFACE_TRUE@am__append_21 = \ +@ENABLE_CF_INTERFACE_TRUE@ cdipioFortran.c \ +@ENABLE_CF_INTERFACE_TRUE@ cfortran.h + +@HAVE_PARALLEL_NC4_TRUE@am__append_22 = pio_cdf_int.c +@ENABLE_ISOC_INTERFACE_TRUE@am__append_23 = $(mo_cdi_mod) +subdir = src +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = \ + $(top_srcdir)/m4/acx_assert_lang_is_fortran_variant.m4 \ + $(top_srcdir)/m4/acx_c_package.m4 \ + $(top_srcdir)/m4/acx_cfortran_flags.m4 \ + $(top_srcdir)/m4/acx_check_cfortran.m4 \ + $(top_srcdir)/m4/acx_check_strptr_convert.m4 \ + $(top_srcdir)/m4/acx_execinfo.m4 \ + $(top_srcdir)/m4/acx_fortran_check_include.m4 \ + $(top_srcdir)/m4/acx_fortran_include_flag.m4 \ + $(top_srcdir)/m4/acx_fortran_package.m4 \ + $(top_srcdir)/m4/acx_lang_check_include.m4 \ + $(top_srcdir)/m4/acx_lang_package.m4 \ + $(top_srcdir)/m4/acx_lt_problems.m4 \ + $(top_srcdir)/m4/acx_m4_list_to_quoted_strings.m4 \ + $(top_srcdir)/m4/acx_mpirun.m4 $(top_srcdir)/m4/acx_mv_obj.m4 \ + $(top_srcdir)/m4/acx_option_search_libs.m4 \ + $(top_srcdir)/m4/acx_options.m4 \ + $(top_srcdir)/m4/acx_prog_cc_posix.m4 \ + $(top_srcdir)/m4/acx_sl_fc_mod_path_flag.m4 \ + $(top_srcdir)/m4/acx_sl_mod_suffix.m4 \ + $(top_srcdir)/m4/acx_tls_xlc_retry.m4 \ + $(top_srcdir)/m4/acx_use_libtool_configuration.m4 \ + $(top_srcdir)/m4/acx_uuid.m4 $(top_srcdir)/m4/asx_tr_arg.m4 \ + $(top_srcdir)/m4/asx_unset.m4 $(top_srcdir)/m4/ax_pthread.m4 \ + $(top_srcdir)/m4/ax_python_devel.m4 $(top_srcdir)/m4/ax_tls.m4 \ + $(top_srcdir)/m4/kpse_libtool.m4 $(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/pkg.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/m4/ac_lang_program_fortran.m4 \ + $(top_srcdir)/m4/acx_lang_fortran_check_include.m4 \ + $(top_srcdir)/m4/acx_lang_c_check_include.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__include_HEADERS_DIST) \ + $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = 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)" "$(DESTDIR)$(cmakedir)" \ + "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(includedir)" \ + "$(DESTDIR)$(includedir)" +LTLIBRARIES = $(lib_LTLIBRARIES) $(noinst_LTLIBRARIES) +libcdi_la_LIBADD = +am__libcdi_la_SOURCES_DIST = async_worker.c async_worker.h basetime.c \ + basetime.h binary.c binary.h calendar.c calendar.h cdf.c cdf.h \ + cdf_config.h cdf_int.c cdf_int.h cdf_lazy_grid.c \ + cdf_lazy_grid.h cdf_read.c cdf_records.c cdf_util.c cdf_util.h \ + cdf_write.c cdi.h cdi_across.c cdi_across.h cdi_att.c \ + cdi_att.h cdi_cksum.c cdi_cksum.h cdi_datetime.c \ + cdi_datetime.h cdi_error.c cdi_fdb.c cdi_fdb.h cdi_int.c \ + cdi_int.h cdi_key.c cdi_key.h cdi_limits.h cdi_query.c \ + cdi_util.c cdi_uuid.h cgribex.h cgribexlib.c cksum.c cksum.h \ + dmemory.c dmemory.h dtypes.h error.c error.h exse.h extra.h \ + extralib.c file.c file.h gaussian_latitudes.c \ + get_num_missvals.c get_num_missvals.h grb_read.c grb_write.c \ + gribapi.c gribapi.h gribapi_utilities.h grid.c grid.h ieg.h \ + ieglib.c input_file.c input_file.h institution.c institution.h \ + iterator.c iterator.h iterator_fallback.c iterator_fallback.h \ + iterator_grib.c iterator_grib.h julian_date.c julian_date.h \ + model.c model.h namespace.c namespace.h normalize_month.h \ + referenceCounting.c referenceCounting.h resource_handle.c \ + resource_handle.h serialize.c serialize.h service.h \ + servicelib.c stream.c stream_cdf.h stream_cdf_i.c \ + stream_cdf_o.c stream_cdf_postdef.h stream_cdf_time.c \ + stream_cgribex.c stream_cgribex.h stream_ext.c stream_ext.h \ + stream_grb.c stream_grb.h stream_gribapi.h stream_ieg.c \ + stream_ieg.h stream_read.c stream_record.c stream_scan.c \ + stream_scan.h stream_srv.c stream_srv.h stream_var.c \ + stream_write.c subtype.c subtype.h swap.c swap.h table.c \ + table.h tablepar.h taxis.c taxis.h tsteps.c util.c varscan.c \ + varscan.h version.c vlist.c vlist.h vlist_var.c vlist_var.h \ + vlist_var_key.c vlist_var_pack.c zaxis.c zaxis.h cdiFortran.c \ + cfortran.h gribapi_utilities.c stream_gribapi.c +@ENABLE_CF_INTERFACE_TRUE@am__objects_1 = cdiFortran.lo +@HAVE_LIBGRIB_API_TRUE@am__objects_2 = gribapi_utilities.lo \ +@HAVE_LIBGRIB_API_TRUE@ stream_gribapi.lo +am_libcdi_la_OBJECTS = async_worker.lo basetime.lo binary.lo \ + calendar.lo cdf.lo cdf_int.lo cdf_lazy_grid.lo cdf_read.lo \ + cdf_records.lo cdf_util.lo cdf_write.lo cdi_across.lo \ + cdi_att.lo cdi_cksum.lo cdi_datetime.lo cdi_error.lo \ + cdi_fdb.lo cdi_int.lo cdi_key.lo cdi_query.lo cdi_util.lo \ + cgribexlib.lo cksum.lo dmemory.lo error.lo extralib.lo file.lo \ + gaussian_latitudes.lo get_num_missvals.lo grb_read.lo \ + grb_write.lo gribapi.lo grid.lo ieglib.lo input_file.lo \ + institution.lo iterator.lo iterator_fallback.lo \ + iterator_grib.lo julian_date.lo model.lo namespace.lo \ + referenceCounting.lo resource_handle.lo serialize.lo \ + servicelib.lo stream.lo stream_cdf_i.lo stream_cdf_o.lo \ + stream_cdf_time.lo stream_cgribex.lo stream_ext.lo \ + stream_grb.lo stream_ieg.lo stream_read.lo stream_record.lo \ + stream_scan.lo stream_srv.lo stream_var.lo stream_write.lo \ + subtype.lo swap.lo table.lo taxis.lo tsteps.lo util.lo \ + varscan.lo version.lo vlist.lo vlist_var.lo vlist_var_key.lo \ + vlist_var_pack.lo zaxis.lo $(am__objects_1) $(am__objects_2) +libcdi_la_OBJECTS = $(am_libcdi_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 = +@ENABLE_CDI_LIB_FALSE@am_libcdi_la_rpath = +@ENABLE_CDI_LIB_TRUE@am_libcdi_la_rpath = -rpath $(libdir) +libcdi_f2003_la_DEPENDENCIES = libcdi.la +am_libcdi_f2003_la_OBJECTS = mo_cdi.lo +libcdi_f2003_la_OBJECTS = $(am_libcdi_f2003_la_OBJECTS) +@ENABLE_CDI_LIB_FALSE@@ENABLE_ISOC_INTERFACE_TRUE@am_libcdi_f2003_la_rpath = +@ENABLE_CDI_LIB_TRUE@@ENABLE_ISOC_INTERFACE_TRUE@am_libcdi_f2003_la_rpath = \ +@ENABLE_CDI_LIB_TRUE@@ENABLE_ISOC_INTERFACE_TRUE@ -rpath \ +@ENABLE_CDI_LIB_TRUE@@ENABLE_ISOC_INTERFACE_TRUE@ $(libdir) +am__DEPENDENCIES_1 = +libcdipio_la_DEPENDENCIES = libcdi.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +am__libcdipio_la_SOURCES_DIST = cdipio.h pio.c pio.h pio_cdf_int.h \ + pio_client.c pio_client.h pio_comm.c pio_comm.h pio_conf.c \ + pio_conf.h pio_dbuffer.c pio_dbuffer.h pio_dist_grid.c \ + pio_dist_grid.h pio_id_set.h pio_idxlist_cache.c \ + pio_idxlist_cache.h pio_impl.h pio_interface.c pio_interface.h \ + pio_mpi_fw_at_all.c pio_mpi_fw_at_reblock.c \ + pio_mpi_fw_ordered.c pio_mpinonb.c pio_posixasynch.c \ + pio_posixfpguardsendrecv.c pio_posixnonb.c pio_record_send.c \ + pio_roles.c pio_rpc.c pio_rpc.h pio_serialize.c \ + pio_serialize.h pio_server.c pio_server.h pio_util.c \ + pio_util.h pio_xmap_cache.c pio_xmap_cache.h resource_unpack.c \ + resource_unpack.h cdipioFortran.c cfortran.h pio_cdf_int.c +@ENABLE_CF_INTERFACE_TRUE@am__objects_3 = cdipioFortran.lo +@HAVE_PARALLEL_NC4_TRUE@am__objects_4 = pio_cdf_int.lo +am_libcdipio_la_OBJECTS = pio.lo pio_client.lo pio_comm.lo pio_conf.lo \ + pio_dbuffer.lo pio_dist_grid.lo pio_idxlist_cache.lo \ + pio_interface.lo pio_mpi_fw_at_all.lo pio_mpi_fw_at_reblock.lo \ + pio_mpi_fw_ordered.lo pio_mpinonb.lo pio_posixasynch.lo \ + pio_posixfpguardsendrecv.lo pio_posixnonb.lo \ + pio_record_send.lo pio_roles.lo pio_rpc.lo pio_serialize.lo \ + pio_server.lo pio_util.lo pio_xmap_cache.lo resource_unpack.lo \ + $(am__objects_3) $(am__objects_4) +libcdipio_la_OBJECTS = $(am_libcdipio_la_OBJECTS) +@ENABLE_CDI_LIB_FALSE@@ENABLE_MPI_TRUE@am_libcdipio_la_rpath = +@ENABLE_CDI_LIB_TRUE@@ENABLE_MPI_TRUE@am_libcdipio_la_rpath = -rpath \ +@ENABLE_CDI_LIB_TRUE@@ENABLE_MPI_TRUE@ $(libdir) +libcdiresunpack_la_DEPENDENCIES = libcdi.la +am_libcdiresunpack_la_OBJECTS = resource_unpack.lo +libcdiresunpack_la_OBJECTS = $(am_libcdiresunpack_la_OBJECTS) +@with_on_demand_check_programs_FALSE@am_libcdiresunpack_la_rpath = +@with_on_demand_check_programs_TRUE@am_libcdiresunpack_la_rpath = +am_make_fint_OBJECTS = make_fint-make_fint.$(OBJEXT) +make_fint_OBJECTS = $(am_make_fint_OBJECTS) +make_fint_DEPENDENCIES = $(LIBOBJS) +make_fint_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(make_fint_CFLAGS) \ + $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +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@ +depcomp = $(SHELL) $(top_srcdir)/config/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = $(DEPDIR)/getline.Po \ + ./$(DEPDIR)/async_worker.Plo ./$(DEPDIR)/basetime.Plo \ + ./$(DEPDIR)/binary.Plo ./$(DEPDIR)/calendar.Plo \ + ./$(DEPDIR)/cdf.Plo ./$(DEPDIR)/cdf_int.Plo \ + ./$(DEPDIR)/cdf_lazy_grid.Plo ./$(DEPDIR)/cdf_read.Plo \ + ./$(DEPDIR)/cdf_records.Plo ./$(DEPDIR)/cdf_util.Plo \ + ./$(DEPDIR)/cdf_write.Plo ./$(DEPDIR)/cdiFortran.Plo \ + ./$(DEPDIR)/cdi_across.Plo ./$(DEPDIR)/cdi_att.Plo \ + ./$(DEPDIR)/cdi_cksum.Plo ./$(DEPDIR)/cdi_datetime.Plo \ + ./$(DEPDIR)/cdi_error.Plo ./$(DEPDIR)/cdi_fdb.Plo \ + ./$(DEPDIR)/cdi_int.Plo ./$(DEPDIR)/cdi_key.Plo \ + ./$(DEPDIR)/cdi_query.Plo ./$(DEPDIR)/cdi_util.Plo \ + ./$(DEPDIR)/cdipioFortran.Plo ./$(DEPDIR)/cgribexlib.Plo \ + ./$(DEPDIR)/cksum.Plo ./$(DEPDIR)/dmemory.Plo \ + ./$(DEPDIR)/error.Plo ./$(DEPDIR)/extralib.Plo \ + ./$(DEPDIR)/file.Plo ./$(DEPDIR)/gaussian_latitudes.Plo \ + ./$(DEPDIR)/get_num_missvals.Plo ./$(DEPDIR)/grb_read.Plo \ + ./$(DEPDIR)/grb_write.Plo ./$(DEPDIR)/gribapi.Plo \ + ./$(DEPDIR)/gribapi_utilities.Plo ./$(DEPDIR)/grid.Plo \ + ./$(DEPDIR)/ieglib.Plo ./$(DEPDIR)/input_file.Plo \ + ./$(DEPDIR)/institution.Plo ./$(DEPDIR)/iterator.Plo \ + ./$(DEPDIR)/iterator_fallback.Plo \ + ./$(DEPDIR)/iterator_grib.Plo ./$(DEPDIR)/julian_date.Plo \ + ./$(DEPDIR)/make_fint-make_fint.Po ./$(DEPDIR)/model.Plo \ + ./$(DEPDIR)/namespace.Plo ./$(DEPDIR)/pio.Plo \ + ./$(DEPDIR)/pio_cdf_int.Plo ./$(DEPDIR)/pio_client.Plo \ + ./$(DEPDIR)/pio_comm.Plo ./$(DEPDIR)/pio_conf.Plo \ + ./$(DEPDIR)/pio_dbuffer.Plo ./$(DEPDIR)/pio_dist_grid.Plo \ + ./$(DEPDIR)/pio_idxlist_cache.Plo \ + ./$(DEPDIR)/pio_interface.Plo \ + ./$(DEPDIR)/pio_mpi_fw_at_all.Plo \ + ./$(DEPDIR)/pio_mpi_fw_at_reblock.Plo \ + ./$(DEPDIR)/pio_mpi_fw_ordered.Plo ./$(DEPDIR)/pio_mpinonb.Plo \ + ./$(DEPDIR)/pio_posixasynch.Plo \ + ./$(DEPDIR)/pio_posixfpguardsendrecv.Plo \ + ./$(DEPDIR)/pio_posixnonb.Plo ./$(DEPDIR)/pio_record_send.Plo \ + ./$(DEPDIR)/pio_roles.Plo ./$(DEPDIR)/pio_rpc.Plo \ + ./$(DEPDIR)/pio_serialize.Plo ./$(DEPDIR)/pio_server.Plo \ + ./$(DEPDIR)/pio_util.Plo ./$(DEPDIR)/pio_xmap_cache.Plo \ + ./$(DEPDIR)/referenceCounting.Plo \ + ./$(DEPDIR)/resource_handle.Plo \ + ./$(DEPDIR)/resource_unpack.Plo ./$(DEPDIR)/serialize.Plo \ + ./$(DEPDIR)/servicelib.Plo ./$(DEPDIR)/stream.Plo \ + ./$(DEPDIR)/stream_cdf_i.Plo ./$(DEPDIR)/stream_cdf_o.Plo \ + ./$(DEPDIR)/stream_cdf_time.Plo ./$(DEPDIR)/stream_cgribex.Plo \ + ./$(DEPDIR)/stream_ext.Plo ./$(DEPDIR)/stream_grb.Plo \ + ./$(DEPDIR)/stream_gribapi.Plo ./$(DEPDIR)/stream_ieg.Plo \ + ./$(DEPDIR)/stream_read.Plo ./$(DEPDIR)/stream_record.Plo \ + ./$(DEPDIR)/stream_scan.Plo ./$(DEPDIR)/stream_srv.Plo \ + ./$(DEPDIR)/stream_var.Plo ./$(DEPDIR)/stream_write.Plo \ + ./$(DEPDIR)/subtype.Plo ./$(DEPDIR)/swap.Plo \ + ./$(DEPDIR)/table.Plo ./$(DEPDIR)/taxis.Plo \ + ./$(DEPDIR)/tsteps.Plo ./$(DEPDIR)/util.Plo \ + ./$(DEPDIR)/varscan.Plo ./$(DEPDIR)/version.Plo \ + ./$(DEPDIR)/vlist.Plo ./$(DEPDIR)/vlist_var.Plo \ + ./$(DEPDIR)/vlist_var_key.Plo ./$(DEPDIR)/vlist_var_pack.Plo \ + ./$(DEPDIR)/zaxis.Plo +am__mv = mv -f +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 = +LTFCCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=FC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) +AM_V_FC = $(am__v_FC_@AM_V@) +am__v_FC_ = $(am__v_FC_@AM_DEFAULT_V@) +am__v_FC_0 = @echo " FC " $@; +am__v_FC_1 = +FCLD = $(FC) +FCLINK = $(LIBTOOL) $(AM_V_lt) --tag=FC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(FCLD) $(AM_FCFLAGS) $(FCFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_FCLD = $(am__v_FCLD_@AM_V@) +am__v_FCLD_ = $(am__v_FCLD_@AM_DEFAULT_V@) +am__v_FCLD_0 = @echo " FCLD " $@; +am__v_FCLD_1 = +SOURCES = $(libcdi_la_SOURCES) $(libcdi_f2003_la_SOURCES) \ + $(libcdipio_la_SOURCES) $(libcdiresunpack_la_SOURCES) \ + $(make_fint_SOURCES) +DIST_SOURCES = $(am__libcdi_la_SOURCES_DIST) \ + $(libcdi_f2003_la_SOURCES) $(am__libcdipio_la_SOURCES_DIST) \ + $(libcdiresunpack_la_SOURCES) $(make_fint_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +DATA = $(nodist_cmake_DATA) $(nodist_pkgconfig_DATA) +am__include_HEADERS_DIST = calendar.h cdi.h cdi_datetime.h \ + julian_date.h cdi.inc cdipio.h cdipio.inc +HEADERS = $(include_HEADERS) $(nodist_include_HEADERS) +am__extra_recursive_targets = examples-recursive +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) \ + 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)` +am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \ + $(top_srcdir)/config/depcomp getline.c +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@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DCE_UUIDROOT = @DCE_UUIDROOT@ +DCE_UUID_C_INCLUDE = @DCE_UUID_C_INCLUDE@ +DCE_UUID_C_LIB = @DCE_UUID_C_LIB@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECCODES_INCLUDE = @ECCODES_INCLUDE@ +ECCODES_LIBS = @ECCODES_LIBS@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ENABLE_ACROSS = @ENABLE_ACROSS@ +ENABLE_CDI_LIB = @ENABLE_CDI_LIB@ +ENABLE_CGRIBEX = @ENABLE_CGRIBEX@ +ENABLE_EXTRA = @ENABLE_EXTRA@ +ENABLE_GRIB = @ENABLE_GRIB@ +ENABLE_IEG = @ENABLE_IEG@ +ENABLE_MPI = @ENABLE_MPI@ +ENABLE_NC2 = @ENABLE_NC2@ +ENABLE_NC4 = @ENABLE_NC4@ +ENABLE_NC4HDF5 = @ENABLE_NC4HDF5@ +ENABLE_NC4SZLIB = @ENABLE_NC4SZLIB@ +ENABLE_NETCDF = @ENABLE_NETCDF@ +ENABLE_SERVICE = @ENABLE_SERVICE@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FC = @FC@ +FCFLAGS = @FCFLAGS@ +FCFLAGS_f90 = @FCFLAGS_f90@ +FCMODCASE = @FCMODCASE@ +FCMODEXT = @FCMODEXT@ +FC_DEFINE = @FC_DEFINE@ +FC_MOD_FLAG = @FC_MOD_FLAG@ +FC_OPTINC = @FC_OPTINC@ +FDB5_INCLUDE = @FDB5_INCLUDE@ +FDB5_LIBS = @FDB5_LIBS@ +FFLAGS = @FFLAGS@ +FGREP = @FGREP@ +GREP = @GREP@ +GRIB_API_INCLUDE = @GRIB_API_INCLUDE@ +GRIB_API_LIBS = @GRIB_API_LIBS@ +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@ +LIBRT = @LIBRT@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +MPIROOT = @MPIROOT@ +MPI_C_INCLUDE = @MPI_C_INCLUDE@ +MPI_C_LIB = @MPI_C_LIB@ +MPI_FC_LIB = @MPI_FC_LIB@ +MPI_FC_MOD = @MPI_FC_MOD@ +MPI_LAUNCH = @MPI_LAUNCH@ +NC_CONFIG = @NC_CONFIG@ +NETCDF_INCLUDE = @NETCDF_INCLUDE@ +NETCDF_LIBS = @NETCDF_LIBS@ +NETCDF_ROOT = @NETCDF_ROOT@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OPENMP_CFLAGS = @OPENMP_CFLAGS@ +OSSP_UUIDROOT = @OSSP_UUIDROOT@ +OSSP_UUID_C_INCLUDE = @OSSP_UUID_C_INCLUDE@ +OSSP_UUID_C_LIB = @OSSP_UUID_C_LIB@ +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@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PPM_CORE_C_INCLUDE = @PPM_CORE_C_INCLUDE@ +PPM_CORE_C_LIB = @PPM_CORE_C_LIB@ +PTHREAD_CC = @PTHREAD_CC@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +PYTHON = @PYTHON@ +PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ +PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ +PYTHON_LIBS = @PYTHON_LIBS@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PLATFORM_SITE_PKG = @PYTHON_PLATFORM_SITE_PKG@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +RUBY = @RUBY@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +SWIG = @SWIG@ +SYSTEM_TYPE = @SYSTEM_TYPE@ +SZLIB_INCLUDE = @SZLIB_INCLUDE@ +SZLIB_LIBS = @SZLIB_LIBS@ +THREADS_INCLUDE = @THREADS_INCLUDE@ +THREADS_LIBS = @THREADS_LIBS@ +UTIL_LINUX_UUIDROOT = @UTIL_LINUX_UUIDROOT@ +UTIL_LINUX_UUID_C_INCLUDE = @UTIL_LINUX_UUID_C_INCLUDE@ +UTIL_LINUX_UUID_C_LIB = @UTIL_LINUX_UUID_C_LIB@ +UUID_C_INCLUDE = @UUID_C_INCLUDE@ +UUID_C_LIB = @UUID_C_LIB@ +VERSION = @VERSION@ +YAXT_C_INCLUDE = @YAXT_C_INCLUDE@ +YAXT_C_LIB = @YAXT_C_LIB@ +YAXT_FC_LIB = @YAXT_FC_LIB@ +YAXT_FC_MOD = @YAXT_FC_MOD@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_F77 = @ac_ct_F77@ +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@ +ax_pthread_config = @ax_pthread_config@ +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@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ +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@ +pkgconfigdir = $(libdir)/pkgconfig +cmakedir = $(libdir)/cmake +include_HEADERS = $(am__append_1) $(am__append_5) $(am__append_9) \ + $(am__append_12) +nodist_include_HEADERS = $(am__append_6) +lib_LTLIBRARIES = $(am__append_2) $(am__append_7) $(am__append_10) +check_LTLIBRARIES = $(am__append_16) +noinst_LTLIBRARIES = $(am__append_13) $(am__append_14) \ + $(am__append_15) $(am__append_17) +EXTRA_DIST = \ + cdilib.c \ + make_cdilib + +nodist_pkgconfig_DATA = $(am__append_3) $(am__append_8) \ + $(am__append_11) +nodist_cmake_DATA = $(am__append_4) +@FC_MOD_UPPERCASE_FALSE@mo_cdi_mod = mo_cdi.$(FCMODEXT) +@FC_MOD_UPPERCASE_TRUE@mo_cdi_mod = MO_CDI.$(FCMODEXT) +AM_CPPFLAGS = $(PPM_CORE_C_INCLUDE) $(YAXT_C_INCLUDE) $(MPI_C_INCLUDE) \ + $(am__append_18) +libcdiresunpack_la_SOURCES = \ + resource_unpack.c \ + resource_unpack.h + +libcdiresunpack_la_LIBADD = libcdi.la +make_fint_SOURCES = make_fint.c +make_fint_CFLAGS = -static +make_fint_LDADD = $(LIBOBJS) +libcdi_la_SOURCES = async_worker.c async_worker.h basetime.c \ + basetime.h binary.c binary.h calendar.c calendar.h cdf.c cdf.h \ + cdf_config.h cdf_int.c cdf_int.h cdf_lazy_grid.c \ + cdf_lazy_grid.h cdf_read.c cdf_records.c cdf_util.c cdf_util.h \ + cdf_write.c cdi.h cdi_across.c cdi_across.h cdi_att.c \ + cdi_att.h cdi_cksum.c cdi_cksum.h cdi_datetime.c \ + cdi_datetime.h cdi_error.c cdi_fdb.c cdi_fdb.h cdi_int.c \ + cdi_int.h cdi_key.c cdi_key.h cdi_limits.h cdi_query.c \ + cdi_util.c cdi_uuid.h cgribex.h cgribexlib.c cksum.c cksum.h \ + dmemory.c dmemory.h dtypes.h error.c error.h exse.h extra.h \ + extralib.c file.c file.h gaussian_latitudes.c \ + get_num_missvals.c get_num_missvals.h grb_read.c grb_write.c \ + gribapi.c gribapi.h gribapi_utilities.h grid.c grid.h ieg.h \ + ieglib.c input_file.c input_file.h institution.c institution.h \ + iterator.c iterator.h iterator_fallback.c iterator_fallback.h \ + iterator_grib.c iterator_grib.h julian_date.c julian_date.h \ + model.c model.h namespace.c namespace.h normalize_month.h \ + referenceCounting.c referenceCounting.h resource_handle.c \ + resource_handle.h serialize.c serialize.h service.h \ + servicelib.c stream.c stream_cdf.h stream_cdf_i.c \ + stream_cdf_o.c stream_cdf_postdef.h stream_cdf_time.c \ + stream_cgribex.c stream_cgribex.h stream_ext.c stream_ext.h \ + stream_grb.c stream_grb.h stream_gribapi.h stream_ieg.c \ + stream_ieg.h stream_read.c stream_record.c stream_scan.c \ + stream_scan.h stream_srv.c stream_srv.h stream_var.c \ + stream_write.c subtype.c subtype.h swap.c swap.h table.c \ + table.h tablepar.h taxis.c taxis.h tsteps.c util.c varscan.c \ + varscan.h version.c vlist.c vlist.h vlist_var.c vlist_var.h \ + vlist_var_key.c vlist_var_pack.c zaxis.c zaxis.h \ + $(am__append_19) $(am__append_20) +libcdi_f2003_la_SOURCES = mo_cdi.f90 +libcdi_f2003_la_LIBADD = libcdi.la +libcdipio_la_SOURCES = cdipio.h pio.c pio.h pio_cdf_int.h pio_client.c \ + pio_client.h pio_comm.c pio_comm.h pio_conf.c pio_conf.h \ + pio_dbuffer.c pio_dbuffer.h pio_dist_grid.c pio_dist_grid.h \ + pio_id_set.h pio_idxlist_cache.c pio_idxlist_cache.h \ + pio_impl.h pio_interface.c pio_interface.h pio_mpi_fw_at_all.c \ + pio_mpi_fw_at_reblock.c pio_mpi_fw_ordered.c pio_mpinonb.c \ + pio_posixasynch.c pio_posixfpguardsendrecv.c pio_posixnonb.c \ + pio_record_send.c pio_roles.c pio_rpc.c pio_rpc.h \ + pio_serialize.c pio_serialize.h pio_server.c pio_server.h \ + pio_util.c pio_util.h pio_xmap_cache.c pio_xmap_cache.h \ + resource_unpack.c resource_unpack.h $(am__append_21) \ + $(am__append_22) +libcdipio_la_LIBADD = libcdi.la $(LIBRT) $(PPM_CORE_C_LIB) $(YAXT_C_LIB) $(MPI_C_LIB) +MOSTLYCLEANFILES = make_fint $(am__append_23) +MAINTAINERCLEANFILES = \ + cdi.inc \ + cdiFortran.c \ + cdilib.c \ + cdipio.inc \ + cdipioFortran.c \ + mo_cdi.f90 + + +# Compile programs using Libtool: +COMPILE = $(LTCOMPILE) +FCCOMPILE = $(LTFCCOMPILE) +PPFCCOMPILE = $(LTPPFCCOMPILE) +CXXCOMPILE = $(LTCXXCOMPILE) + +# Compile *.F90 without CPPFLAGS, which are normally meant for the C compiler +# and might not be compatible with the Fortran compiler: +LTPPFCCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=FC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) + +all: config.h + $(MAKE) $(AM_MAKEFLAGS) all-am + +.SUFFIXES: +.SUFFIXES: .c .f90 .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.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 +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__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(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): + +config.h: stamp-h1 + @test -f $@ || rm -f stamp-h1 + @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1 + +stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status + @rm -f stamp-h1 + cd $(top_builddir) && $(SHELL) ./config.status src/config.h +$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) + rm -f stamp-h1 + touch $@ + +distclean-hdr: + -rm -f config.h stamp-h1 + +clean-checkLTLIBRARIES: + -test -z "$(check_LTLIBRARIES)" || rm -f $(check_LTLIBRARIES) + @list='$(check_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}; \ + } + +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}; \ + } + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_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}; \ + } + +libcdi.la: $(libcdi_la_OBJECTS) $(libcdi_la_DEPENDENCIES) $(EXTRA_libcdi_la_DEPENDENCIES) + $(AM_V_CCLD)$(LINK) $(am_libcdi_la_rpath) $(libcdi_la_OBJECTS) $(libcdi_la_LIBADD) $(LIBS) + +libcdi_f2003.la: $(libcdi_f2003_la_OBJECTS) $(libcdi_f2003_la_DEPENDENCIES) $(EXTRA_libcdi_f2003_la_DEPENDENCIES) + $(AM_V_FCLD)$(FCLINK) $(am_libcdi_f2003_la_rpath) $(libcdi_f2003_la_OBJECTS) $(libcdi_f2003_la_LIBADD) $(LIBS) + +libcdipio.la: $(libcdipio_la_OBJECTS) $(libcdipio_la_DEPENDENCIES) $(EXTRA_libcdipio_la_DEPENDENCIES) + $(AM_V_CCLD)$(LINK) $(am_libcdipio_la_rpath) $(libcdipio_la_OBJECTS) $(libcdipio_la_LIBADD) $(LIBS) + +libcdiresunpack.la: $(libcdiresunpack_la_OBJECTS) $(libcdiresunpack_la_DEPENDENCIES) $(EXTRA_libcdiresunpack_la_DEPENDENCIES) + $(AM_V_CCLD)$(LINK) $(am_libcdiresunpack_la_rpath) $(libcdiresunpack_la_OBJECTS) $(libcdiresunpack_la_LIBADD) $(LIBS) + +make_fint$(EXEEXT): $(make_fint_OBJECTS) $(make_fint_DEPENDENCIES) $(EXTRA_make_fint_DEPENDENCIES) + @rm -f make_fint$(EXEEXT) + $(AM_V_CCLD)$(make_fint_LINK) $(make_fint_OBJECTS) $(make_fint_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/getline.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/async_worker.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/basetime.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/binary.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/calendar.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdf.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdf_int.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdf_lazy_grid.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdf_read.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdf_records.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdf_util.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdf_write.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdiFortran.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdi_across.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdi_att.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdi_cksum.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdi_datetime.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdi_error.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdi_fdb.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdi_int.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdi_key.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdi_query.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdi_util.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdipioFortran.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cgribexlib.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cksum.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmemory.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/error.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/extralib.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/file.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gaussian_latitudes.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get_num_missvals.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/grb_read.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/grb_write.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gribapi.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gribapi_utilities.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/grid.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ieglib.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/input_file.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/institution.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iterator.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iterator_fallback.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iterator_grib.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/julian_date.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/make_fint-make_fint.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/model.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/namespace.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pio.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pio_cdf_int.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pio_client.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pio_comm.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pio_conf.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pio_dbuffer.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pio_dist_grid.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pio_idxlist_cache.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pio_interface.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pio_mpi_fw_at_all.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pio_mpi_fw_at_reblock.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pio_mpi_fw_ordered.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pio_mpinonb.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pio_posixasynch.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pio_posixfpguardsendrecv.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pio_posixnonb.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pio_record_send.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pio_roles.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pio_rpc.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pio_serialize.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pio_server.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pio_util.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pio_xmap_cache.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/referenceCounting.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/resource_handle.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/resource_unpack.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/serialize.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/servicelib.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stream.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stream_cdf_i.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stream_cdf_o.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stream_cdf_time.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stream_cgribex.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stream_ext.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stream_grb.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stream_gribapi.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stream_ieg.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stream_read.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stream_record.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stream_scan.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stream_srv.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stream_var.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stream_write.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/subtype.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/swap.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/table.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/taxis.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tsteps.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/util.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varscan.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/version.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vlist.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vlist_var.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vlist_var_key.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vlist_var_pack.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zaxis.Plo@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.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 -o $@ $< + +.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 -o $@ `$(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 $@ $< + +make_fint-make_fint.o: make_fint.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(make_fint_CFLAGS) $(CFLAGS) -MT make_fint-make_fint.o -MD -MP -MF $(DEPDIR)/make_fint-make_fint.Tpo -c -o make_fint-make_fint.o `test -f 'make_fint.c' || echo '$(srcdir)/'`make_fint.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/make_fint-make_fint.Tpo $(DEPDIR)/make_fint-make_fint.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='make_fint.c' object='make_fint-make_fint.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(make_fint_CFLAGS) $(CFLAGS) -c -o make_fint-make_fint.o `test -f 'make_fint.c' || echo '$(srcdir)/'`make_fint.c + +make_fint-make_fint.obj: make_fint.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(make_fint_CFLAGS) $(CFLAGS) -MT make_fint-make_fint.obj -MD -MP -MF $(DEPDIR)/make_fint-make_fint.Tpo -c -o make_fint-make_fint.obj `if test -f 'make_fint.c'; then $(CYGPATH_W) 'make_fint.c'; else $(CYGPATH_W) '$(srcdir)/make_fint.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/make_fint-make_fint.Tpo $(DEPDIR)/make_fint-make_fint.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='make_fint.c' object='make_fint-make_fint.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(make_fint_CFLAGS) $(CFLAGS) -c -o make_fint-make_fint.obj `if test -f 'make_fint.c'; then $(CYGPATH_W) 'make_fint.c'; else $(CYGPATH_W) '$(srcdir)/make_fint.c'; fi` + +.f90.o: + $(AM_V_FC)$(FCCOMPILE) -c -o $@ $(FCFLAGS_f90) $< + +.f90.obj: + $(AM_V_FC)$(FCCOMPILE) -c -o $@ $(FCFLAGS_f90) `$(CYGPATH_W) '$<'` + +.f90.lo: + $(AM_V_FC)$(LTFCCOMPILE) -c -o $@ $(FCFLAGS_f90) $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-nodist_cmakeDATA: $(nodist_cmake_DATA) + @$(NORMAL_INSTALL) + @list='$(nodist_cmake_DATA)'; test -n "$(cmakedir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(cmakedir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(cmakedir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(cmakedir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(cmakedir)" || exit $$?; \ + done + +uninstall-nodist_cmakeDATA: + @$(NORMAL_UNINSTALL) + @list='$(nodist_cmake_DATA)'; test -n "$(cmakedir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(cmakedir)'; $(am__uninstall_files_from_dir) +install-nodist_pkgconfigDATA: $(nodist_pkgconfig_DATA) + @$(NORMAL_INSTALL) + @list='$(nodist_pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(pkgconfigdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \ + done + +uninstall-nodist_pkgconfigDATA: + @$(NORMAL_UNINSTALL) + @list='$(nodist_pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir) +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) +install-nodist_includeHEADERS: $(nodist_include_HEADERS) + @$(NORMAL_INSTALL) + @list='$(nodist_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-nodist_includeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(nodist_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) +examples-local: + +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: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(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_LTLIBRARIES) +check: check-am +all-am: Makefile $(LTLIBRARIES) $(DATA) $(HEADERS) config.h +install-EXTRAPROGRAMS: install-libLTLIBRARIES + +install-checkLTLIBRARIES: install-libLTLIBRARIES + +installdirs: + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(cmakedir)" "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(includedir)" "$(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: + -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) + +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." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-checkLTLIBRARIES clean-generic clean-libLTLIBRARIES \ + clean-libtool clean-noinstLTLIBRARIES mostlyclean-am + +distclean: distclean-am + -rm -f $(DEPDIR)/getline.Po + -rm -f ./$(DEPDIR)/async_worker.Plo + -rm -f ./$(DEPDIR)/basetime.Plo + -rm -f ./$(DEPDIR)/binary.Plo + -rm -f ./$(DEPDIR)/calendar.Plo + -rm -f ./$(DEPDIR)/cdf.Plo + -rm -f ./$(DEPDIR)/cdf_int.Plo + -rm -f ./$(DEPDIR)/cdf_lazy_grid.Plo + -rm -f ./$(DEPDIR)/cdf_read.Plo + -rm -f ./$(DEPDIR)/cdf_records.Plo + -rm -f ./$(DEPDIR)/cdf_util.Plo + -rm -f ./$(DEPDIR)/cdf_write.Plo + -rm -f ./$(DEPDIR)/cdiFortran.Plo + -rm -f ./$(DEPDIR)/cdi_across.Plo + -rm -f ./$(DEPDIR)/cdi_att.Plo + -rm -f ./$(DEPDIR)/cdi_cksum.Plo + -rm -f ./$(DEPDIR)/cdi_datetime.Plo + -rm -f ./$(DEPDIR)/cdi_error.Plo + -rm -f ./$(DEPDIR)/cdi_fdb.Plo + -rm -f ./$(DEPDIR)/cdi_int.Plo + -rm -f ./$(DEPDIR)/cdi_key.Plo + -rm -f ./$(DEPDIR)/cdi_query.Plo + -rm -f ./$(DEPDIR)/cdi_util.Plo + -rm -f ./$(DEPDIR)/cdipioFortran.Plo + -rm -f ./$(DEPDIR)/cgribexlib.Plo + -rm -f ./$(DEPDIR)/cksum.Plo + -rm -f ./$(DEPDIR)/dmemory.Plo + -rm -f ./$(DEPDIR)/error.Plo + -rm -f ./$(DEPDIR)/extralib.Plo + -rm -f ./$(DEPDIR)/file.Plo + -rm -f ./$(DEPDIR)/gaussian_latitudes.Plo + -rm -f ./$(DEPDIR)/get_num_missvals.Plo + -rm -f ./$(DEPDIR)/grb_read.Plo + -rm -f ./$(DEPDIR)/grb_write.Plo + -rm -f ./$(DEPDIR)/gribapi.Plo + -rm -f ./$(DEPDIR)/gribapi_utilities.Plo + -rm -f ./$(DEPDIR)/grid.Plo + -rm -f ./$(DEPDIR)/ieglib.Plo + -rm -f ./$(DEPDIR)/input_file.Plo + -rm -f ./$(DEPDIR)/institution.Plo + -rm -f ./$(DEPDIR)/iterator.Plo + -rm -f ./$(DEPDIR)/iterator_fallback.Plo + -rm -f ./$(DEPDIR)/iterator_grib.Plo + -rm -f ./$(DEPDIR)/julian_date.Plo + -rm -f ./$(DEPDIR)/make_fint-make_fint.Po + -rm -f ./$(DEPDIR)/model.Plo + -rm -f ./$(DEPDIR)/namespace.Plo + -rm -f ./$(DEPDIR)/pio.Plo + -rm -f ./$(DEPDIR)/pio_cdf_int.Plo + -rm -f ./$(DEPDIR)/pio_client.Plo + -rm -f ./$(DEPDIR)/pio_comm.Plo + -rm -f ./$(DEPDIR)/pio_conf.Plo + -rm -f ./$(DEPDIR)/pio_dbuffer.Plo + -rm -f ./$(DEPDIR)/pio_dist_grid.Plo + -rm -f ./$(DEPDIR)/pio_idxlist_cache.Plo + -rm -f ./$(DEPDIR)/pio_interface.Plo + -rm -f ./$(DEPDIR)/pio_mpi_fw_at_all.Plo + -rm -f ./$(DEPDIR)/pio_mpi_fw_at_reblock.Plo + -rm -f ./$(DEPDIR)/pio_mpi_fw_ordered.Plo + -rm -f ./$(DEPDIR)/pio_mpinonb.Plo + -rm -f ./$(DEPDIR)/pio_posixasynch.Plo + -rm -f ./$(DEPDIR)/pio_posixfpguardsendrecv.Plo + -rm -f ./$(DEPDIR)/pio_posixnonb.Plo + -rm -f ./$(DEPDIR)/pio_record_send.Plo + -rm -f ./$(DEPDIR)/pio_roles.Plo + -rm -f ./$(DEPDIR)/pio_rpc.Plo + -rm -f ./$(DEPDIR)/pio_serialize.Plo + -rm -f ./$(DEPDIR)/pio_server.Plo + -rm -f ./$(DEPDIR)/pio_util.Plo + -rm -f ./$(DEPDIR)/pio_xmap_cache.Plo + -rm -f ./$(DEPDIR)/referenceCounting.Plo + -rm -f ./$(DEPDIR)/resource_handle.Plo + -rm -f ./$(DEPDIR)/resource_unpack.Plo + -rm -f ./$(DEPDIR)/serialize.Plo + -rm -f ./$(DEPDIR)/servicelib.Plo + -rm -f ./$(DEPDIR)/stream.Plo + -rm -f ./$(DEPDIR)/stream_cdf_i.Plo + -rm -f ./$(DEPDIR)/stream_cdf_o.Plo + -rm -f ./$(DEPDIR)/stream_cdf_time.Plo + -rm -f ./$(DEPDIR)/stream_cgribex.Plo + -rm -f ./$(DEPDIR)/stream_ext.Plo + -rm -f ./$(DEPDIR)/stream_grb.Plo + -rm -f ./$(DEPDIR)/stream_gribapi.Plo + -rm -f ./$(DEPDIR)/stream_ieg.Plo + -rm -f ./$(DEPDIR)/stream_read.Plo + -rm -f ./$(DEPDIR)/stream_record.Plo + -rm -f ./$(DEPDIR)/stream_scan.Plo + -rm -f ./$(DEPDIR)/stream_srv.Plo + -rm -f ./$(DEPDIR)/stream_var.Plo + -rm -f ./$(DEPDIR)/stream_write.Plo + -rm -f ./$(DEPDIR)/subtype.Plo + -rm -f ./$(DEPDIR)/swap.Plo + -rm -f ./$(DEPDIR)/table.Plo + -rm -f ./$(DEPDIR)/taxis.Plo + -rm -f ./$(DEPDIR)/tsteps.Plo + -rm -f ./$(DEPDIR)/util.Plo + -rm -f ./$(DEPDIR)/varscan.Plo + -rm -f ./$(DEPDIR)/version.Plo + -rm -f ./$(DEPDIR)/vlist.Plo + -rm -f ./$(DEPDIR)/vlist_var.Plo + -rm -f ./$(DEPDIR)/vlist_var_key.Plo + -rm -f ./$(DEPDIR)/vlist_var_pack.Plo + -rm -f ./$(DEPDIR)/zaxis.Plo + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-hdr distclean-tags + +dvi: dvi-am + +dvi-am: + +examples: examples-am + +examples-am: examples-local + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-includeHEADERS install-nodist_cmakeDATA \ + install-nodist_includeHEADERS install-nodist_pkgconfigDATA + +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 -f $(DEPDIR)/getline.Po + -rm -f ./$(DEPDIR)/async_worker.Plo + -rm -f ./$(DEPDIR)/basetime.Plo + -rm -f ./$(DEPDIR)/binary.Plo + -rm -f ./$(DEPDIR)/calendar.Plo + -rm -f ./$(DEPDIR)/cdf.Plo + -rm -f ./$(DEPDIR)/cdf_int.Plo + -rm -f ./$(DEPDIR)/cdf_lazy_grid.Plo + -rm -f ./$(DEPDIR)/cdf_read.Plo + -rm -f ./$(DEPDIR)/cdf_records.Plo + -rm -f ./$(DEPDIR)/cdf_util.Plo + -rm -f ./$(DEPDIR)/cdf_write.Plo + -rm -f ./$(DEPDIR)/cdiFortran.Plo + -rm -f ./$(DEPDIR)/cdi_across.Plo + -rm -f ./$(DEPDIR)/cdi_att.Plo + -rm -f ./$(DEPDIR)/cdi_cksum.Plo + -rm -f ./$(DEPDIR)/cdi_datetime.Plo + -rm -f ./$(DEPDIR)/cdi_error.Plo + -rm -f ./$(DEPDIR)/cdi_fdb.Plo + -rm -f ./$(DEPDIR)/cdi_int.Plo + -rm -f ./$(DEPDIR)/cdi_key.Plo + -rm -f ./$(DEPDIR)/cdi_query.Plo + -rm -f ./$(DEPDIR)/cdi_util.Plo + -rm -f ./$(DEPDIR)/cdipioFortran.Plo + -rm -f ./$(DEPDIR)/cgribexlib.Plo + -rm -f ./$(DEPDIR)/cksum.Plo + -rm -f ./$(DEPDIR)/dmemory.Plo + -rm -f ./$(DEPDIR)/error.Plo + -rm -f ./$(DEPDIR)/extralib.Plo + -rm -f ./$(DEPDIR)/file.Plo + -rm -f ./$(DEPDIR)/gaussian_latitudes.Plo + -rm -f ./$(DEPDIR)/get_num_missvals.Plo + -rm -f ./$(DEPDIR)/grb_read.Plo + -rm -f ./$(DEPDIR)/grb_write.Plo + -rm -f ./$(DEPDIR)/gribapi.Plo + -rm -f ./$(DEPDIR)/gribapi_utilities.Plo + -rm -f ./$(DEPDIR)/grid.Plo + -rm -f ./$(DEPDIR)/ieglib.Plo + -rm -f ./$(DEPDIR)/input_file.Plo + -rm -f ./$(DEPDIR)/institution.Plo + -rm -f ./$(DEPDIR)/iterator.Plo + -rm -f ./$(DEPDIR)/iterator_fallback.Plo + -rm -f ./$(DEPDIR)/iterator_grib.Plo + -rm -f ./$(DEPDIR)/julian_date.Plo + -rm -f ./$(DEPDIR)/make_fint-make_fint.Po + -rm -f ./$(DEPDIR)/model.Plo + -rm -f ./$(DEPDIR)/namespace.Plo + -rm -f ./$(DEPDIR)/pio.Plo + -rm -f ./$(DEPDIR)/pio_cdf_int.Plo + -rm -f ./$(DEPDIR)/pio_client.Plo + -rm -f ./$(DEPDIR)/pio_comm.Plo + -rm -f ./$(DEPDIR)/pio_conf.Plo + -rm -f ./$(DEPDIR)/pio_dbuffer.Plo + -rm -f ./$(DEPDIR)/pio_dist_grid.Plo + -rm -f ./$(DEPDIR)/pio_idxlist_cache.Plo + -rm -f ./$(DEPDIR)/pio_interface.Plo + -rm -f ./$(DEPDIR)/pio_mpi_fw_at_all.Plo + -rm -f ./$(DEPDIR)/pio_mpi_fw_at_reblock.Plo + -rm -f ./$(DEPDIR)/pio_mpi_fw_ordered.Plo + -rm -f ./$(DEPDIR)/pio_mpinonb.Plo + -rm -f ./$(DEPDIR)/pio_posixasynch.Plo + -rm -f ./$(DEPDIR)/pio_posixfpguardsendrecv.Plo + -rm -f ./$(DEPDIR)/pio_posixnonb.Plo + -rm -f ./$(DEPDIR)/pio_record_send.Plo + -rm -f ./$(DEPDIR)/pio_roles.Plo + -rm -f ./$(DEPDIR)/pio_rpc.Plo + -rm -f ./$(DEPDIR)/pio_serialize.Plo + -rm -f ./$(DEPDIR)/pio_server.Plo + -rm -f ./$(DEPDIR)/pio_util.Plo + -rm -f ./$(DEPDIR)/pio_xmap_cache.Plo + -rm -f ./$(DEPDIR)/referenceCounting.Plo + -rm -f ./$(DEPDIR)/resource_handle.Plo + -rm -f ./$(DEPDIR)/resource_unpack.Plo + -rm -f ./$(DEPDIR)/serialize.Plo + -rm -f ./$(DEPDIR)/servicelib.Plo + -rm -f ./$(DEPDIR)/stream.Plo + -rm -f ./$(DEPDIR)/stream_cdf_i.Plo + -rm -f ./$(DEPDIR)/stream_cdf_o.Plo + -rm -f ./$(DEPDIR)/stream_cdf_time.Plo + -rm -f ./$(DEPDIR)/stream_cgribex.Plo + -rm -f ./$(DEPDIR)/stream_ext.Plo + -rm -f ./$(DEPDIR)/stream_grb.Plo + -rm -f ./$(DEPDIR)/stream_gribapi.Plo + -rm -f ./$(DEPDIR)/stream_ieg.Plo + -rm -f ./$(DEPDIR)/stream_read.Plo + -rm -f ./$(DEPDIR)/stream_record.Plo + -rm -f ./$(DEPDIR)/stream_scan.Plo + -rm -f ./$(DEPDIR)/stream_srv.Plo + -rm -f ./$(DEPDIR)/stream_var.Plo + -rm -f ./$(DEPDIR)/stream_write.Plo + -rm -f ./$(DEPDIR)/subtype.Plo + -rm -f ./$(DEPDIR)/swap.Plo + -rm -f ./$(DEPDIR)/table.Plo + -rm -f ./$(DEPDIR)/taxis.Plo + -rm -f ./$(DEPDIR)/tsteps.Plo + -rm -f ./$(DEPDIR)/util.Plo + -rm -f ./$(DEPDIR)/varscan.Plo + -rm -f ./$(DEPDIR)/version.Plo + -rm -f ./$(DEPDIR)/vlist.Plo + -rm -f ./$(DEPDIR)/vlist_var.Plo + -rm -f ./$(DEPDIR)/vlist_var_key.Plo + -rm -f ./$(DEPDIR)/vlist_var_pack.Plo + -rm -f ./$(DEPDIR)/zaxis.Plo + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES \ + uninstall-nodist_cmakeDATA uninstall-nodist_includeHEADERS \ + uninstall-nodist_pkgconfigDATA + +.MAKE: all check-am install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-checkLTLIBRARIES clean-generic clean-libLTLIBRARIES \ + clean-libtool clean-noinstLTLIBRARIES cscopelist-am ctags \ + ctags-am distclean distclean-compile distclean-generic \ + distclean-hdr distclean-libtool distclean-tags distdir dvi \ + dvi-am examples-am examples-local html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-includeHEADERS install-info \ + install-info-am install-libLTLIBRARIES install-man \ + install-nodist_cmakeDATA install-nodist_includeHEADERS \ + install-nodist_pkgconfigDATA 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-includeHEADERS \ + uninstall-libLTLIBRARIES uninstall-nodist_cmakeDATA \ + uninstall-nodist_includeHEADERS uninstall-nodist_pkgconfigDATA + +.PRECIOUS: Makefile + + +@MAINTAINER_MODE_TRUE@cdi.inc: cdi.h make_fint.c +@MAINTAINER_MODE_TRUE@ $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) make_fint +@MAINTAINER_MODE_TRUE@ $(AM_V_GEN)$(top_builddir)/libtool --mode=execute ./make_fint -o $(@D) $< +@MAINTAINER_MODE_TRUE@cdiFortran.c: cdi.inc +@MAINTAINER_MODE_TRUE@ $(AM_V_at)test -f $@ || rm -f $< +@MAINTAINER_MODE_TRUE@ $(AM_V_at)test -f $@ || $(MAKE) $(AM_MAKEFLAGS) $< + +@MAINTAINER_MODE_TRUE@cdipio.inc: cdipio.h make_fint.c cdi.inc +@MAINTAINER_MODE_TRUE@ $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) make_fint +@MAINTAINER_MODE_TRUE@ $(AM_V_GEN)$(top_builddir)/libtool --mode=execute ./make_fint -o $(@D) $< +@MAINTAINER_MODE_TRUE@cdipioFortran.c: cdipio.inc +@MAINTAINER_MODE_TRUE@ $(AM_V_at)test -f $@ || rm -f $< +@MAINTAINER_MODE_TRUE@ $(AM_V_at)test -f $@ || $(MAKE) $(AM_MAKEFLAGS) $< + +@MAINTAINER_MODE_TRUE@mo_cdi.f90: cdi.h $(top_srcdir)/interfaces/f2003/bindGen.rb +@MAINTAINER_MODE_TRUE@ $(AM_V_GEN)$(RUBY) $(top_srcdir)/interfaces/f2003/bindGen.rb $< $@ + +@MAINTAINER_MODE_TRUE@cdilib.c: $(libcdi_la_SOURCES) $(srcdir)/make_cdilib +@MAINTAINER_MODE_TRUE@ $(AM_V_GEN)CPP='$(CPP)' $(srcdir)/make_cdilib $(srcdir) +@MAINTAINER_MODE_FALSE@cdiFortran.c cdi.inc cdipioFortran.c cdipio.inc mo_cdi.f90 cdilib.c: +@MAINTAINER_MODE_FALSE@ @:;{ \ +@MAINTAINER_MODE_FALSE@ echo "ERROR: cannot generate '$@' when the maintainer mode is disabled:"; \ +@MAINTAINER_MODE_FALSE@ echo " re-configure with the '--enable-maintainer-mode' option"; \ +@MAINTAINER_MODE_FALSE@ } >&2; exit 1 + +$(mo_cdi_mod): mo_cdi.lo + $(AM_V_at)test -f $@ || rm -f $< + $(AM_V_at)test -f $@ || $(MAKE) $(AM_MAKEFLAGS) $< + +cmake/cdi/cdi-config.cmake: $(top_builddir)/config.status cmake/cdi/cdi-config.cmake.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ + +cmake/cdi/cdi-config-version.cmake: $(top_builddir)/config.status cmake/cdi/cdi-config-version.cmake.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ + +pkgconfig/cdi.pc: $(top_builddir)/config.status $(srcdir)/pkgconfig/cdi.pc.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ + +pkgconfig/cdipio.pc: $(top_builddir)/config.status $(srcdir)/pkgconfig/cdipio.pc.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ + +pkgconfig/cdi_f2003.pc: $(top_builddir)/config.status $(srcdir)/pkgconfig/cdi_f2003.pc.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/src/cdi.inc b/src/cdi.inc new file mode 100644 index 0000000000000000000000000000000000000000..1913ab219295a71a6b135fdf4f22197eec271365 --- /dev/null +++ b/src/cdi.inc @@ -0,0 +1,2620 @@ +! This file was automatically generated, don't edit! +! +! Fortran interface for CDI library version 2.2.0 +! +! Author: +! ------- +! Uwe Schulzweida, MPI-MET, Hamburg, February 2023 +! + +! +! Start of fortran interface for the following routines (make_fint.c) +! + INTEGER CDI_MAX_NAME + PARAMETER (CDI_MAX_NAME = 256) + INTEGER CDI_UNDEFID + PARAMETER (CDI_UNDEFID = -1) + INTEGER CDI_GLOBAL + PARAMETER (CDI_GLOBAL = -1) + INTEGER CDI_XAXIS + PARAMETER (CDI_XAXIS = 1) + INTEGER CDI_YAXIS + PARAMETER (CDI_YAXIS = 2) +! +! Byte order +! + INTEGER CDI_BIGENDIAN + PARAMETER (CDI_BIGENDIAN = 0) + INTEGER CDI_LITTLEENDIAN + PARAMETER (CDI_LITTLEENDIAN = 1) + INTEGER CDI_PDPENDIAN + PARAMETER (CDI_PDPENDIAN = 2) + INTEGER CDI_REAL + PARAMETER (CDI_REAL = 1) + INTEGER CDI_COMP + PARAMETER (CDI_COMP = 2) + INTEGER CDI_BOTH + PARAMETER (CDI_BOTH = 3) +! +! Error identifier +! + INTEGER CDI_NOERR + PARAMETER (CDI_NOERR = 0) + INTEGER CDI_EEOF + PARAMETER (CDI_EEOF = -1) + INTEGER CDI_ETMOF + PARAMETER (CDI_ETMOF = -9) + INTEGER CDI_ESYSTEM + PARAMETER (CDI_ESYSTEM = -10) + INTEGER CDI_EINVAL + PARAMETER (CDI_EINVAL = -20) + INTEGER CDI_EISDIR + PARAMETER (CDI_EISDIR = -21) + INTEGER CDI_EISEMPTY + PARAMETER (CDI_EISEMPTY = -22) + INTEGER CDI_EUFTYPE + PARAMETER (CDI_EUFTYPE = -23) + INTEGER CDI_ELIBNAVAIL + PARAMETER (CDI_ELIBNAVAIL = -24) + INTEGER CDI_EUFSTRUCT + PARAMETER (CDI_EUFSTRUCT = -25) + INTEGER CDI_EUNC4 + PARAMETER (CDI_EUNC4 = -26) + INTEGER CDI_EDIMSIZE + PARAMETER (CDI_EDIMSIZE = -27) + INTEGER CDI_EQENF + PARAMETER (CDI_EQENF = -50) + INTEGER CDI_EQNAVAIL + PARAMETER (CDI_EQNAVAIL = -51) + INTEGER CDI_ELIMIT + PARAMETER (CDI_ELIMIT = -99) +! +! File types +! + INTEGER CDI_FILETYPE_GRB + PARAMETER (CDI_FILETYPE_GRB = 1) + INTEGER CDI_FILETYPE_GRB2 + PARAMETER (CDI_FILETYPE_GRB2 = 2) + INTEGER CDI_FILETYPE_NC + PARAMETER (CDI_FILETYPE_NC = 3) + INTEGER CDI_FILETYPE_NC2 + PARAMETER (CDI_FILETYPE_NC2 = 4) + INTEGER CDI_FILETYPE_NC4 + PARAMETER (CDI_FILETYPE_NC4 = 5) + INTEGER CDI_FILETYPE_NC4C + PARAMETER (CDI_FILETYPE_NC4C = 6) + INTEGER CDI_FILETYPE_NC5 + PARAMETER (CDI_FILETYPE_NC5 = 7) + INTEGER CDI_FILETYPE_SRV + PARAMETER (CDI_FILETYPE_SRV = 8) + INTEGER CDI_FILETYPE_EXT + PARAMETER (CDI_FILETYPE_EXT = 9) + INTEGER CDI_FILETYPE_IEG + PARAMETER (CDI_FILETYPE_IEG = 10) + INTEGER CDI_FILETYPE_NCZARR + PARAMETER (CDI_FILETYPE_NCZARR = 11) +! +! Compatibility defines for release 1.8.3 (obsolete defines) +! + INTEGER FILETYPE_GRB + PARAMETER (FILETYPE_GRB = 1) + INTEGER FILETYPE_GRB2 + PARAMETER (FILETYPE_GRB2 = 2) + INTEGER FILETYPE_NC + PARAMETER (FILETYPE_NC = 3) + INTEGER FILETYPE_NC2 + PARAMETER (FILETYPE_NC2 = 4) + INTEGER FILETYPE_NC4 + PARAMETER (FILETYPE_NC4 = 5) +! +! Protocols (in filename/URI) +! + INTEGER CDI_PROTOCOL_OTHER + PARAMETER (CDI_PROTOCOL_OTHER = 0) + INTEGER CDI_PROTOCOL_FILE + PARAMETER (CDI_PROTOCOL_FILE = 1) + INTEGER CDI_PROTOCOL_FDB + PARAMETER (CDI_PROTOCOL_FDB = 2) + INTEGER CDI_PROTOCOL_ACROSS + PARAMETER (CDI_PROTOCOL_ACROSS = 3) +! +! Compress types +! + INTEGER CDI_COMPRESS_NONE + PARAMETER (CDI_COMPRESS_NONE = 0) + INTEGER CDI_COMPRESS_SZIP + PARAMETER (CDI_COMPRESS_SZIP = 1) + INTEGER CDI_COMPRESS_AEC + PARAMETER (CDI_COMPRESS_AEC = 2) + INTEGER CDI_COMPRESS_ZIP + PARAMETER (CDI_COMPRESS_ZIP = 3) + INTEGER CDI_COMPRESS_JPEG + PARAMETER (CDI_COMPRESS_JPEG = 4) + INTEGER CDI_COMPRESS_FILTER + PARAMETER (CDI_COMPRESS_FILTER = 5) +! +! external data types +! +! +! Compatibility defines for release 1.8.3 (obsolete defines) +! + INTEGER DATATYPE_PACK16 + PARAMETER (DATATYPE_PACK16 = 16) + INTEGER DATATYPE_PACK24 + PARAMETER (DATATYPE_PACK24 = 24) + INTEGER DATATYPE_FLT32 + PARAMETER (DATATYPE_FLT32 = 132) + INTEGER DATATYPE_FLT64 + PARAMETER (DATATYPE_FLT64 = 164) + INTEGER DATATYPE_INT32 + PARAMETER (DATATYPE_INT32 = 232) + INTEGER DATATYPE_INT + PARAMETER (DATATYPE_INT = 251) + INTEGER CDI_DATATYPE_PACK + PARAMETER (CDI_DATATYPE_PACK = 0) + INTEGER CDI_DATATYPE_PACK1 + PARAMETER (CDI_DATATYPE_PACK1 = 1) + INTEGER CDI_DATATYPE_PACK2 + PARAMETER (CDI_DATATYPE_PACK2 = 2) + INTEGER CDI_DATATYPE_PACK3 + PARAMETER (CDI_DATATYPE_PACK3 = 3) + INTEGER CDI_DATATYPE_PACK4 + PARAMETER (CDI_DATATYPE_PACK4 = 4) + INTEGER CDI_DATATYPE_PACK5 + PARAMETER (CDI_DATATYPE_PACK5 = 5) + INTEGER CDI_DATATYPE_PACK6 + PARAMETER (CDI_DATATYPE_PACK6 = 6) + INTEGER CDI_DATATYPE_PACK7 + PARAMETER (CDI_DATATYPE_PACK7 = 7) + INTEGER CDI_DATATYPE_PACK8 + PARAMETER (CDI_DATATYPE_PACK8 = 8) + INTEGER CDI_DATATYPE_PACK9 + PARAMETER (CDI_DATATYPE_PACK9 = 9) + INTEGER CDI_DATATYPE_PACK10 + PARAMETER (CDI_DATATYPE_PACK10 = 10) + INTEGER CDI_DATATYPE_PACK11 + PARAMETER (CDI_DATATYPE_PACK11 = 11) + INTEGER CDI_DATATYPE_PACK12 + PARAMETER (CDI_DATATYPE_PACK12 = 12) + INTEGER CDI_DATATYPE_PACK13 + PARAMETER (CDI_DATATYPE_PACK13 = 13) + INTEGER CDI_DATATYPE_PACK14 + PARAMETER (CDI_DATATYPE_PACK14 = 14) + INTEGER CDI_DATATYPE_PACK15 + PARAMETER (CDI_DATATYPE_PACK15 = 15) + INTEGER CDI_DATATYPE_PACK16 + PARAMETER (CDI_DATATYPE_PACK16 = 16) + INTEGER CDI_DATATYPE_PACK17 + PARAMETER (CDI_DATATYPE_PACK17 = 17) + INTEGER CDI_DATATYPE_PACK18 + PARAMETER (CDI_DATATYPE_PACK18 = 18) + INTEGER CDI_DATATYPE_PACK19 + PARAMETER (CDI_DATATYPE_PACK19 = 19) + INTEGER CDI_DATATYPE_PACK20 + PARAMETER (CDI_DATATYPE_PACK20 = 20) + INTEGER CDI_DATATYPE_PACK21 + PARAMETER (CDI_DATATYPE_PACK21 = 21) + INTEGER CDI_DATATYPE_PACK22 + PARAMETER (CDI_DATATYPE_PACK22 = 22) + INTEGER CDI_DATATYPE_PACK23 + PARAMETER (CDI_DATATYPE_PACK23 = 23) + INTEGER CDI_DATATYPE_PACK24 + PARAMETER (CDI_DATATYPE_PACK24 = 24) + INTEGER CDI_DATATYPE_PACK25 + PARAMETER (CDI_DATATYPE_PACK25 = 25) + INTEGER CDI_DATATYPE_PACK26 + PARAMETER (CDI_DATATYPE_PACK26 = 26) + INTEGER CDI_DATATYPE_PACK27 + PARAMETER (CDI_DATATYPE_PACK27 = 27) + INTEGER CDI_DATATYPE_PACK28 + PARAMETER (CDI_DATATYPE_PACK28 = 28) + INTEGER CDI_DATATYPE_PACK29 + PARAMETER (CDI_DATATYPE_PACK29 = 29) + INTEGER CDI_DATATYPE_PACK30 + PARAMETER (CDI_DATATYPE_PACK30 = 30) + INTEGER CDI_DATATYPE_PACK31 + PARAMETER (CDI_DATATYPE_PACK31 = 31) + INTEGER CDI_DATATYPE_PACK32 + PARAMETER (CDI_DATATYPE_PACK32 = 32) + INTEGER CDI_DATATYPE_CPX32 + PARAMETER (CDI_DATATYPE_CPX32 = 64) + INTEGER CDI_DATATYPE_CPX64 + PARAMETER (CDI_DATATYPE_CPX64 = 128) + INTEGER CDI_DATATYPE_FLT32 + PARAMETER (CDI_DATATYPE_FLT32 = 132) + INTEGER CDI_DATATYPE_FLT64 + PARAMETER (CDI_DATATYPE_FLT64 = 164) + INTEGER CDI_DATATYPE_INT8 + PARAMETER (CDI_DATATYPE_INT8 = 208) + INTEGER CDI_DATATYPE_INT16 + PARAMETER (CDI_DATATYPE_INT16 = 216) + INTEGER CDI_DATATYPE_INT32 + PARAMETER (CDI_DATATYPE_INT32 = 232) + INTEGER CDI_DATATYPE_UINT8 + PARAMETER (CDI_DATATYPE_UINT8 = 308) + INTEGER CDI_DATATYPE_UINT16 + PARAMETER (CDI_DATATYPE_UINT16 = 316) + INTEGER CDI_DATATYPE_UINT32 + PARAMETER (CDI_DATATYPE_UINT32 = 332) +! +! internal data types +! + INTEGER CDI_DATATYPE_INT + PARAMETER (CDI_DATATYPE_INT = 251) + INTEGER CDI_DATATYPE_FLT + PARAMETER (CDI_DATATYPE_FLT = 252) + INTEGER CDI_DATATYPE_TXT + PARAMETER (CDI_DATATYPE_TXT = 253) + INTEGER CDI_DATATYPE_CPX + PARAMETER (CDI_DATATYPE_CPX = 254) + INTEGER CDI_DATATYPE_UCHAR + PARAMETER (CDI_DATATYPE_UCHAR = 255) + INTEGER CDI_DATATYPE_LONG + PARAMETER (CDI_DATATYPE_LONG = 256) + INTEGER CDI_DATATYPE_UINT + PARAMETER (CDI_DATATYPE_UINT = 257) +! +! Chunk types +! + INTEGER CDI_CHUNK_AUTO + PARAMETER (CDI_CHUNK_AUTO = 1) + INTEGER CDI_CHUNK_GRID + PARAMETER (CDI_CHUNK_GRID = 2) + INTEGER CDI_CHUNK_LINES + PARAMETER (CDI_CHUNK_LINES = 3) +! +! GRID types +! + INTEGER GRID_GENERIC + PARAMETER (GRID_GENERIC = 1) + INTEGER GRID_GAUSSIAN + PARAMETER (GRID_GAUSSIAN = 2) + INTEGER GRID_GAUSSIAN_REDUCED + PARAMETER (GRID_GAUSSIAN_REDUCED = 3) + INTEGER GRID_LONLAT + PARAMETER (GRID_LONLAT = 4) + INTEGER GRID_SPECTRAL + PARAMETER (GRID_SPECTRAL = 5) + INTEGER GRID_FOURIER + PARAMETER (GRID_FOURIER = 6) + INTEGER GRID_GME + PARAMETER (GRID_GME = 7) + INTEGER GRID_TRAJECTORY + PARAMETER (GRID_TRAJECTORY = 8) + INTEGER GRID_UNSTRUCTURED + PARAMETER (GRID_UNSTRUCTURED = 9) + INTEGER GRID_CURVILINEAR + PARAMETER (GRID_CURVILINEAR = 10) + INTEGER GRID_PROJECTION + PARAMETER (GRID_PROJECTION = 12) + INTEGER GRID_CHARXY + PARAMETER (GRID_CHARXY = 13) + INTEGER CDI_PROJ_RLL + PARAMETER (CDI_PROJ_RLL = 21) + INTEGER CDI_PROJ_LCC + PARAMETER (CDI_PROJ_LCC = 22) + INTEGER CDI_PROJ_LAEA + PARAMETER (CDI_PROJ_LAEA = 23) + INTEGER CDI_PROJ_SINU + PARAMETER (CDI_PROJ_SINU = 24) + INTEGER CDI_PROJ_STERE + PARAMETER (CDI_PROJ_STERE = 25) + INTEGER CDI_PROJ_HEALPIX + PARAMETER (CDI_PROJ_HEALPIX = 26) +! +! ZAXIS types +! + INTEGER ZAXIS_SURFACE + PARAMETER (ZAXIS_SURFACE = 0) + INTEGER ZAXIS_GENERIC + PARAMETER (ZAXIS_GENERIC = 1) + INTEGER ZAXIS_HYBRID + PARAMETER (ZAXIS_HYBRID = 2) + INTEGER ZAXIS_HYBRID_HALF + PARAMETER (ZAXIS_HYBRID_HALF = 3) + INTEGER ZAXIS_PRESSURE + PARAMETER (ZAXIS_PRESSURE = 4) + INTEGER ZAXIS_HEIGHT + PARAMETER (ZAXIS_HEIGHT = 5) + INTEGER ZAXIS_DEPTH_BELOW_SEA + PARAMETER (ZAXIS_DEPTH_BELOW_SEA = 6) + INTEGER ZAXIS_DEPTH_BELOW_LAND + PARAMETER (ZAXIS_DEPTH_BELOW_LAND = 7) + INTEGER ZAXIS_ISENTROPIC + PARAMETER (ZAXIS_ISENTROPIC = 8) + INTEGER ZAXIS_TRAJECTORY + PARAMETER (ZAXIS_TRAJECTORY = 9) + INTEGER ZAXIS_ALTITUDE + PARAMETER (ZAXIS_ALTITUDE = 10) + INTEGER ZAXIS_SIGMA + PARAMETER (ZAXIS_SIGMA = 11) + INTEGER ZAXIS_MEANSEA + PARAMETER (ZAXIS_MEANSEA = 12) + INTEGER ZAXIS_TOA + PARAMETER (ZAXIS_TOA = 13) + INTEGER ZAXIS_SEA_BOTTOM + PARAMETER (ZAXIS_SEA_BOTTOM = 14) + INTEGER ZAXIS_ATMOSPHERE + PARAMETER (ZAXIS_ATMOSPHERE = 15) + INTEGER ZAXIS_CLOUD_BASE + PARAMETER (ZAXIS_CLOUD_BASE = 16) + INTEGER ZAXIS_CLOUD_TOP + PARAMETER (ZAXIS_CLOUD_TOP = 17) + INTEGER ZAXIS_ISOTHERM_ZERO + PARAMETER (ZAXIS_ISOTHERM_ZERO = 18) + INTEGER ZAXIS_SNOW + PARAMETER (ZAXIS_SNOW = 19) + INTEGER ZAXIS_LAKE_BOTTOM + PARAMETER (ZAXIS_LAKE_BOTTOM = 20) + INTEGER ZAXIS_SEDIMENT_BOTTOM + PARAMETER (ZAXIS_SEDIMENT_BOTTOM = 21) + INTEGER ZAXIS_SEDIMENT_BOTTOM_TA + PARAMETER (ZAXIS_SEDIMENT_BOTTOM_TA = 22) + INTEGER ZAXIS_SEDIMENT_BOTTOM_TW + PARAMETER (ZAXIS_SEDIMENT_BOTTOM_TW = 23) + INTEGER ZAXIS_MIX_LAYER + PARAMETER (ZAXIS_MIX_LAYER = 24) + INTEGER ZAXIS_REFERENCE + PARAMETER (ZAXIS_REFERENCE = 25) + INTEGER ZAXIS_CHAR + PARAMETER (ZAXIS_CHAR = 26) + INTEGER ZAXIS_TROPOPAUSE + PARAMETER (ZAXIS_TROPOPAUSE = 27) +! +! SUBTYPE types +! + INTEGER MAX_KV_PAIRS_MATCH + PARAMETER (MAX_KV_PAIRS_MATCH = 10) +! +! Data structure defining a key-value search, possibly with multiple +! key-value pairs in combination. +! +! Currently, only multiple pairs combined by AND are supported. +! +! +! TIME types +! + INTEGER TIME_CONSTANT + PARAMETER (TIME_CONSTANT = 0) + INTEGER TIME_VARYING + PARAMETER (TIME_VARYING = 1) + INTEGER TIME_VARIABLE + PARAMETER (TIME_VARIABLE = 1) +! +! TSTEP types +! + INTEGER TSTEP_CONSTANT + PARAMETER (TSTEP_CONSTANT = 0) + INTEGER TSTEP_INSTANT + PARAMETER (TSTEP_INSTANT = 1) + INTEGER TSTEP_AVG + PARAMETER (TSTEP_AVG = 2) + INTEGER TSTEP_ACCUM + PARAMETER (TSTEP_ACCUM = 3) + INTEGER TSTEP_MAX + PARAMETER (TSTEP_MAX = 4) + INTEGER TSTEP_MIN + PARAMETER (TSTEP_MIN = 5) + INTEGER TSTEP_DIFF + PARAMETER (TSTEP_DIFF = 6) + INTEGER TSTEP_RMS + PARAMETER (TSTEP_RMS = 7) + INTEGER TSTEP_SD + PARAMETER (TSTEP_SD = 8) + INTEGER TSTEP_COV + PARAMETER (TSTEP_COV = 9) + INTEGER TSTEP_RATIO + PARAMETER (TSTEP_RATIO = 10) + INTEGER TSTEP_SUM + PARAMETER (TSTEP_SUM = 11) + INTEGER TSTEP_RANGE + PARAMETER (TSTEP_RANGE = 12) + INTEGER TSTEP_INSTANT2 + PARAMETER (TSTEP_INSTANT2 = 13) + INTEGER TSTEP_INSTANT3 + PARAMETER (TSTEP_INSTANT3 = 14) +! +! TAXIS types +! + INTEGER TAXIS_ABSOLUTE + PARAMETER (TAXIS_ABSOLUTE = 1) + INTEGER TAXIS_RELATIVE + PARAMETER (TAXIS_RELATIVE = 2) + INTEGER TAXIS_FORECAST + PARAMETER (TAXIS_FORECAST = 3) +! +! TUNIT types +! + INTEGER TUNIT_SECOND + PARAMETER (TUNIT_SECOND = 1) + INTEGER TUNIT_MINUTE + PARAMETER (TUNIT_MINUTE = 2) + INTEGER TUNIT_QUARTER + PARAMETER (TUNIT_QUARTER = 3) + INTEGER TUNIT_30MINUTES + PARAMETER (TUNIT_30MINUTES = 4) + INTEGER TUNIT_HOUR + PARAMETER (TUNIT_HOUR = 5) + INTEGER TUNIT_3HOURS + PARAMETER (TUNIT_3HOURS = 6) + INTEGER TUNIT_6HOURS + PARAMETER (TUNIT_6HOURS = 7) + INTEGER TUNIT_12HOURS + PARAMETER (TUNIT_12HOURS = 8) + INTEGER TUNIT_DAY + PARAMETER (TUNIT_DAY = 9) + INTEGER TUNIT_MONTH + PARAMETER (TUNIT_MONTH = 10) + INTEGER TUNIT_YEAR + PARAMETER (TUNIT_YEAR = 11) +! +! CALENDAR types +! + INTEGER CALENDAR_STANDARD + PARAMETER (CALENDAR_STANDARD = 0) + INTEGER CALENDAR_GREGORIAN + PARAMETER (CALENDAR_GREGORIAN = 1) + INTEGER CALENDAR_PROLEPTIC + PARAMETER (CALENDAR_PROLEPTIC = 2) + INTEGER CALENDAR_360DAYS + PARAMETER (CALENDAR_360DAYS = 3) + INTEGER CALENDAR_365DAYS + PARAMETER (CALENDAR_365DAYS = 4) + INTEGER CALENDAR_366DAYS + PARAMETER (CALENDAR_366DAYS = 5) + INTEGER CALENDAR_NONE + PARAMETER (CALENDAR_NONE = 6) +! +! number of unsigned char needed to store UUID +! + INTEGER CDI_UUID_SIZE + PARAMETER (CDI_UUID_SIZE = 16) +! +! Structs that are used to return data to the user +! +! +! Opaque types +! +! +! CDI control routines +! +! cdiReset + EXTERNAL cdiReset + + CHARACTER(80) cdiStringError +! (INTEGER cdiErrno) + EXTERNAL cdiStringError + +! cdiDebug +! (INTEGER debug) + EXTERNAL cdiDebug + + CHARACTER(80) cdiLibraryVersion + EXTERNAL cdiLibraryVersion + +! cdiPrintVersion + EXTERNAL cdiPrintVersion + + INTEGER cdiHaveFiletype +! (INTEGER filetype) + EXTERNAL cdiHaveFiletype + +! cdiDefMissval +! (DOUBLEPRECISION missval) + EXTERNAL cdiDefMissval + + DOUBLEPRECISION cdiInqMissval + EXTERNAL cdiInqMissval + +! cdiDefGlobal +! (CHARACTER*(*) string, +! INTEGER val) + EXTERNAL cdiDefGlobal + + INTEGER namespaceNew + EXTERNAL namespaceNew + +! namespaceSetActive +! (INTEGER namespaceID) + EXTERNAL namespaceSetActive + + INTEGER namespaceGetActive + EXTERNAL namespaceGetActive + +! namespaceDelete +! (INTEGER namespaceID) + EXTERNAL namespaceDelete + +! +! CDI converter routines +! +! +! parameter +! +! cdiParamToString +! (INTEGER param, +! CHARACTER*(*) paramstr, +! INTEGER maxlen) + EXTERNAL cdiParamToString + +! cdiDecodeParam +! (INTEGER param, +! INTEGER pnum, +! INTEGER pcat, +! INTEGER pdis) + EXTERNAL cdiDecodeParam + + INTEGER cdiEncodeParam +! (INTEGER pnum, +! INTEGER pcat, +! INTEGER pdis) + EXTERNAL cdiEncodeParam + +! +! date format: YYYYMMDD +! +! +! time format: hhmmss +! +! cdiDecodeDate +! (INTEGER date, +! INTEGER year, +! INTEGER month, +! INTEGER day) + EXTERNAL cdiDecodeDate + + INTEGER cdiEncodeDate +! (INTEGER year, +! INTEGER month, +! INTEGER day) + EXTERNAL cdiEncodeDate + +! cdiDecodeTime +! (INTEGER time, +! INTEGER hour, +! INTEGER minute, +! INTEGER second) + EXTERNAL cdiDecodeTime + + INTEGER cdiEncodeTime +! (INTEGER hour, +! INTEGER minute, +! INTEGER second) + EXTERNAL cdiEncodeTime + +! +! STREAM control routines +! + INTEGER cdiGetFiletype +! (CHARACTER*(*) uri, +! INTEGER byteorder) + EXTERNAL cdiGetFiletype + + INTEGER streamOpenRead +! (CHARACTER*(*) path) + EXTERNAL streamOpenRead + + INTEGER streamOpenWrite +! (CHARACTER*(*) path, +! INTEGER filetype) + EXTERNAL streamOpenWrite + + INTEGER streamOpenAppend +! (CHARACTER*(*) path) + EXTERNAL streamOpenAppend + +! streamClose +! (INTEGER streamID) + EXTERNAL streamClose + +! streamSync +! (INTEGER streamID) + EXTERNAL streamSync + +! streamDefMaxSteps +! (INTEGER streamID, +! INTEGER maxSteps) + EXTERNAL streamDefMaxSteps + +! streamDefNumWorker +! (INTEGER streamID, +! INTEGER numWorker) + EXTERNAL streamDefNumWorker + +! streamDefVlist +! (INTEGER streamID, +! INTEGER vlistID) + EXTERNAL streamDefVlist + + INTEGER streamInqVlist +! (INTEGER streamID) + EXTERNAL streamInqVlist + + INTEGER streamInqFiletype +! (INTEGER streamID) + EXTERNAL streamInqFiletype + +! streamDefByteorder +! (INTEGER streamID, +! INTEGER byteorder) + EXTERNAL streamDefByteorder + + INTEGER streamInqByteorder +! (INTEGER streamID) + EXTERNAL streamInqByteorder + +! streamDefFilter +! (INTEGER streamID, +! INTEGER filterId, +! INTEGER nparams, +! INTEGER params) + EXTERNAL streamDefFilter + +! streamDefCompType +! (INTEGER streamID, +! INTEGER comptype) + EXTERNAL streamDefCompType + + INTEGER streamInqCompType +! (INTEGER streamID) + EXTERNAL streamInqCompType + +! streamDefCompLevel +! (INTEGER streamID, +! INTEGER complevel) + EXTERNAL streamDefCompLevel + + INTEGER streamInqCompLevel +! (INTEGER streamID) + EXTERNAL streamInqCompLevel + + INTEGER streamDefTimestep +! (INTEGER streamID, +! INTEGER tsID) + EXTERNAL streamDefTimestep + + INTEGER streamInqTimestep +! (INTEGER streamID, +! INTEGER tsID) + EXTERNAL streamInqTimestep + + INTEGER streamInqCurTimestepID +! (INTEGER streamID) + EXTERNAL streamInqCurTimestepID + + CHARACTER(80) streamFilename +! (INTEGER streamID) + EXTERNAL streamFilename + + CHARACTER(80) streamFilesuffix +! (INTEGER filetype) + EXTERNAL streamFilesuffix + + INTEGER streamNvals +! (INTEGER streamID) + EXTERNAL streamNvals + + INTEGER streamInqNvars +! (INTEGER streamID) + EXTERNAL streamInqNvars + +! +! STREAM var I/O routines (random access) +! +! streamWriteVar +! (INTEGER streamID, +! INTEGER varID, +! DOUBLEPRECISION data(*), +! INTEGER nmiss) + EXTERNAL streamWriteVar + +! streamWriteVarF +! (INTEGER streamID, +! INTEGER varID, +! REAL data(*), +! INTEGER nmiss) + EXTERNAL streamWriteVarF + +! streamReadVar +! (INTEGER streamID, +! INTEGER varID, +! DOUBLEPRECISION data(*), +! INTEGER nmiss) + EXTERNAL streamReadVar + +! streamReadVarF +! (INTEGER streamID, +! INTEGER varID, +! REAL data(*), +! INTEGER nmiss) + EXTERNAL streamReadVarF + +! streamWriteVarSlice +! (INTEGER streamID, +! INTEGER varID, +! INTEGER levelID, +! DOUBLEPRECISION data(*), +! INTEGER nmiss) + EXTERNAL streamWriteVarSlice + +! streamWriteVarSliceF +! (INTEGER streamID, +! INTEGER varID, +! INTEGER levelID, +! REAL data(*), +! INTEGER nmiss) + EXTERNAL streamWriteVarSliceF + +! streamReadVarSlice +! (INTEGER streamID, +! INTEGER varID, +! INTEGER levelID, +! DOUBLEPRECISION data(*), +! INTEGER nmiss) + EXTERNAL streamReadVarSlice + +! streamReadVarSliceF +! (INTEGER streamID, +! INTEGER varID, +! INTEGER levelID, +! REAL data(*), +! INTEGER nmiss) + EXTERNAL streamReadVarSliceF + +! streamWriteVarChunk +! (INTEGER streamID, +! INTEGER varID, +! INTEGER rect(2,*), +! DOUBLEPRECISION data(*), +! INTEGER nmiss) + EXTERNAL streamWriteVarChunk + +! streamWriteVarChunkF +! (INTEGER streamID, +! INTEGER varID, +! INTEGER rect(2,*), +! REAL data(*), +! INTEGER nmiss) + EXTERNAL streamWriteVarChunkF + +! +! STREAM record I/O routines (sequential access) +! +! streamDefRecord +! (INTEGER streamID, +! INTEGER varID, +! INTEGER levelID) + EXTERNAL streamDefRecord + +! streamInqRecord +! (INTEGER streamID, +! INTEGER varID, +! INTEGER levelID) + EXTERNAL streamInqRecord + +! streamWriteRecord +! (INTEGER streamID, +! DOUBLEPRECISION data(*), +! INTEGER nmiss) + EXTERNAL streamWriteRecord + +! streamWriteRecordF +! (INTEGER streamID, +! REAL data(*), +! INTEGER nmiss) + EXTERNAL streamWriteRecordF + +! streamReadRecord +! (INTEGER streamID, +! DOUBLEPRECISION data(*), +! INTEGER nmiss) + EXTERNAL streamReadRecord + +! streamReadRecordF +! (INTEGER streamID, +! REAL data(*), +! INTEGER nmiss) + EXTERNAL streamReadRecordF + +! streamCopyRecord +! (INTEGER streamIDdest, +! INTEGER streamIDsrc) + EXTERNAL streamCopyRecord + +! +! File driven I/O (may yield better performance than using the streamXXX functions) +! +! +! Creation & Destruction +! +! +! Advancing an iterator +! +! +! Introspecting metadata +! +! +! All outXXX arguments to these functions may be NULL. +! +! +! Reading data +! +! +! TODO[NH]: Add functions to read partial fields. +! +! +! Direct access to grib fields +! +! +! Callthroughs to GRIB-API +! +! +! Convenience functions for accessing GRIB-API keys +! +! +! VLIST routines +! + INTEGER vlistCreate + EXTERNAL vlistCreate + +! vlistDestroy +! (INTEGER vlistID) + EXTERNAL vlistDestroy + + INTEGER vlistDuplicate +! (INTEGER vlistID) + EXTERNAL vlistDuplicate + +! vlistCopy +! (INTEGER vlistID2, +! INTEGER vlistID1) + EXTERNAL vlistCopy + +! vlistCopyFlag +! (INTEGER vlistID2, +! INTEGER vlistID1) + EXTERNAL vlistCopyFlag + +! vlistClearFlag +! (INTEGER vlistID) + EXTERNAL vlistClearFlag + +! vlistCat +! (INTEGER vlistID2, +! INTEGER vlistID1) + EXTERNAL vlistCat + +! vlistMerge +! (INTEGER vlistID2, +! INTEGER vlistID1) + EXTERNAL vlistMerge + +! vlistPrint +! (INTEGER vlistID) + EXTERNAL vlistPrint + + INTEGER vlistNumber +! (INTEGER vlistID) + EXTERNAL vlistNumber + + INTEGER vlistNvars +! (INTEGER vlistID) + EXTERNAL vlistNvars + + INTEGER vlistNgrids +! (INTEGER vlistID) + EXTERNAL vlistNgrids + + INTEGER vlistNzaxis +! (INTEGER vlistID) + EXTERNAL vlistNzaxis + + INTEGER vlistNsubtypes +! (INTEGER vlistID) + EXTERNAL vlistNsubtypes + +! vlistDefNtsteps +! (INTEGER vlistID, +! INTEGER nts) + EXTERNAL vlistDefNtsteps + + INTEGER vlistNtsteps +! (INTEGER vlistID) + EXTERNAL vlistNtsteps + + INTEGER vlistGridsizeMax +! (INTEGER vlistID) + EXTERNAL vlistGridsizeMax + + INTEGER vlistGrid +! (INTEGER vlistID, +! INTEGER index) + EXTERNAL vlistGrid + + INTEGER vlistGridIndex +! (INTEGER vlistID, +! INTEGER gridID) + EXTERNAL vlistGridIndex + +! vlistChangeGridIndex +! (INTEGER vlistID, +! INTEGER index, +! INTEGER gridID) + EXTERNAL vlistChangeGridIndex + +! vlistChangeGrid +! (INTEGER vlistID, +! INTEGER gridID1, +! INTEGER gridID2) + EXTERNAL vlistChangeGrid + + INTEGER vlistZaxis +! (INTEGER vlistID, +! INTEGER index) + EXTERNAL vlistZaxis + + INTEGER vlistZaxisIndex +! (INTEGER vlistID, +! INTEGER zaxisID) + EXTERNAL vlistZaxisIndex + +! vlistChangeZaxisIndex +! (INTEGER vlistID, +! INTEGER index, +! INTEGER zaxisID) + EXTERNAL vlistChangeZaxisIndex + +! vlistChangeZaxis +! (INTEGER vlistID, +! INTEGER zaxisID1, +! INTEGER zaxisID2) + EXTERNAL vlistChangeZaxis + + INTEGER vlistNrecs +! (INTEGER vlistID) + EXTERNAL vlistNrecs + + INTEGER vlistSubtype +! (INTEGER vlistID, +! INTEGER index) + EXTERNAL vlistSubtype + + INTEGER vlistSubtypeIndex +! (INTEGER vlistID, +! INTEGER subtypeID) + EXTERNAL vlistSubtypeIndex + +! vlistDefTaxis +! (INTEGER vlistID, +! INTEGER taxisID) + EXTERNAL vlistDefTaxis + + INTEGER vlistInqTaxis +! (INTEGER vlistID) + EXTERNAL vlistInqTaxis + +! vlistDefTable +! (INTEGER vlistID, +! INTEGER tableID) + EXTERNAL vlistDefTable + + INTEGER vlistInqTable +! (INTEGER vlistID) + EXTERNAL vlistInqTable + +! vlistDefInstitut +! (INTEGER vlistID, +! INTEGER instID) + EXTERNAL vlistDefInstitut + + INTEGER vlistInqInstitut +! (INTEGER vlistID) + EXTERNAL vlistInqInstitut + +! vlistDefModel +! (INTEGER vlistID, +! INTEGER modelID) + EXTERNAL vlistDefModel + + INTEGER vlistInqModel +! (INTEGER vlistID) + EXTERNAL vlistInqModel + +! +! VLIST VAR routines +! + INTEGER vlistDefVarTiles +! (INTEGER vlistID, +! INTEGER gridID, +! INTEGER zaxisID, +! INTEGER timetype, +! INTEGER tilesetID) + EXTERNAL vlistDefVarTiles + + INTEGER vlistDefVar +! (INTEGER vlistID, +! INTEGER gridID, +! INTEGER zaxisID, +! INTEGER timetype) + EXTERNAL vlistDefVar + +! vlistChangeVarGrid +! (INTEGER vlistID, +! INTEGER varID, +! INTEGER gridID) + EXTERNAL vlistChangeVarGrid + +! vlistChangeVarZaxis +! (INTEGER vlistID, +! INTEGER varID, +! INTEGER zaxisID) + EXTERNAL vlistChangeVarZaxis + +! vlistInqVar +! (INTEGER vlistID, +! INTEGER varID, +! INTEGER gridID, +! INTEGER zaxisID, +! INTEGER timetype) + EXTERNAL vlistInqVar + + INTEGER vlistInqVarGrid +! (INTEGER vlistID, +! INTEGER varID) + EXTERNAL vlistInqVarGrid + + INTEGER vlistInqVarZaxis +! (INTEGER vlistID, +! INTEGER varID) + EXTERNAL vlistInqVarZaxis + +! +! used in MPIOM +! + INTEGER vlistInqVarID +! (INTEGER vlistID, +! INTEGER code) + EXTERNAL vlistInqVarID + +! vlistDefVarTimetype +! (INTEGER vlistID, +! INTEGER varID, +! INTEGER timetype) + EXTERNAL vlistDefVarTimetype + + INTEGER vlistInqVarTimetype +! (INTEGER vlistID, +! INTEGER varID) + EXTERNAL vlistInqVarTimetype + +! vlistDefVarTsteptype +! (INTEGER vlistID, +! INTEGER varID, +! INTEGER tsteptype) + EXTERNAL vlistDefVarTsteptype + + INTEGER vlistInqVarTsteptype +! (INTEGER vlistID, +! INTEGER varID) + EXTERNAL vlistInqVarTsteptype + +! vlistDefVarCompType +! (INTEGER vlistID, +! INTEGER varID, +! INTEGER comptype) + EXTERNAL vlistDefVarCompType + + INTEGER vlistInqVarCompType +! (INTEGER vlistID, +! INTEGER varID) + EXTERNAL vlistInqVarCompType + +! vlistDefVarCompLevel +! (INTEGER vlistID, +! INTEGER varID, +! INTEGER complevel) + EXTERNAL vlistDefVarCompLevel + + INTEGER vlistInqVarCompLevel +! (INTEGER vlistID, +! INTEGER varID) + EXTERNAL vlistInqVarCompLevel + +! vlistDefVarParam +! (INTEGER vlistID, +! INTEGER varID, +! INTEGER param) + EXTERNAL vlistDefVarParam + + INTEGER vlistInqVarParam +! (INTEGER vlistID, +! INTEGER varID) + EXTERNAL vlistInqVarParam + +! vlistDefVarCode +! (INTEGER vlistID, +! INTEGER varID, +! INTEGER code) + EXTERNAL vlistDefVarCode + + INTEGER vlistInqVarCode +! (INTEGER vlistID, +! INTEGER varID) + EXTERNAL vlistInqVarCode + +! vlistDefVarDatatype +! (INTEGER vlistID, +! INTEGER varID, +! INTEGER datatype) + EXTERNAL vlistDefVarDatatype + + INTEGER vlistInqVarDatatype +! (INTEGER vlistID, +! INTEGER varID) + EXTERNAL vlistInqVarDatatype + +! vlistDefVarXYZ +! (INTEGER vlistID, +! INTEGER varID, +! INTEGER xyz) + EXTERNAL vlistDefVarXYZ + + INTEGER vlistInqVarXYZ +! (INTEGER vlistID, +! INTEGER varID) + EXTERNAL vlistInqVarXYZ + +! vlistDefVarNSB +! (INTEGER vlistID, +! INTEGER varID, +! INTEGER nsb) + EXTERNAL vlistDefVarNSB + + INTEGER vlistInqVarNSB +! (INTEGER vlistID, +! INTEGER varID) + EXTERNAL vlistInqVarNSB + + INTEGER vlistInqVarNumber +! (INTEGER vlistID, +! INTEGER varID) + EXTERNAL vlistInqVarNumber + +! vlistDefVarInstitut +! (INTEGER vlistID, +! INTEGER varID, +! INTEGER instID) + EXTERNAL vlistDefVarInstitut + + INTEGER vlistInqVarInstitut +! (INTEGER vlistID, +! INTEGER varID) + EXTERNAL vlistInqVarInstitut + +! vlistDefVarModel +! (INTEGER vlistID, +! INTEGER varID, +! INTEGER modelID) + EXTERNAL vlistDefVarModel + + INTEGER vlistInqVarModel +! (INTEGER vlistID, +! INTEGER varID) + EXTERNAL vlistInqVarModel + +! vlistDefVarTable +! (INTEGER vlistID, +! INTEGER varID, +! INTEGER tableID) + EXTERNAL vlistDefVarTable + + INTEGER vlistInqVarTable +! (INTEGER vlistID, +! INTEGER varID) + EXTERNAL vlistInqVarTable + +! vlistDefVarName +! (INTEGER vlistID, +! INTEGER varID, +! CHARACTER*(*) name) + EXTERNAL vlistDefVarName + +! vlistInqVarName +! (INTEGER vlistID, +! INTEGER varID, +! CHARACTER*(*) name) + EXTERNAL vlistInqVarName + + CHARACTER(80) vlistCopyVarName +! (INTEGER vlistId, +! INTEGER varId) + EXTERNAL vlistCopyVarName + +! vlistDefVarStdname +! (INTEGER vlistID, +! INTEGER varID, +! CHARACTER*(*) stdname) + EXTERNAL vlistDefVarStdname + +! vlistInqVarStdname +! (INTEGER vlistID, +! INTEGER varID, +! CHARACTER*(*) stdname) + EXTERNAL vlistInqVarStdname + +! vlistDefVarLongname +! (INTEGER vlistID, +! INTEGER varID, +! CHARACTER*(*) longname) + EXTERNAL vlistDefVarLongname + +! vlistInqVarLongname +! (INTEGER vlistID, +! INTEGER varID, +! CHARACTER*(*) longname) + EXTERNAL vlistInqVarLongname + +! vlistDefVarUnits +! (INTEGER vlistID, +! INTEGER varID, +! CHARACTER*(*) units) + EXTERNAL vlistDefVarUnits + +! vlistInqVarUnits +! (INTEGER vlistID, +! INTEGER varID, +! CHARACTER*(*) units) + EXTERNAL vlistInqVarUnits + +! vlistDefVarMissval +! (INTEGER vlistID, +! INTEGER varID, +! DOUBLEPRECISION missval) + EXTERNAL vlistDefVarMissval + + DOUBLEPRECISION vlistInqVarMissval +! (INTEGER vlistID, +! INTEGER varID) + EXTERNAL vlistInqVarMissval + + INTEGER vlistInqVarSize +! (INTEGER vlistID, +! INTEGER varID) + EXTERNAL vlistInqVarSize + +! vlistDefIndex +! (INTEGER vlistID, +! INTEGER varID, +! INTEGER levID, +! INTEGER index) + EXTERNAL vlistDefIndex + + INTEGER vlistInqIndex +! (INTEGER vlistID, +! INTEGER varID, +! INTEGER levID) + EXTERNAL vlistInqIndex + +! vlistDefFlag +! (INTEGER vlistID, +! INTEGER varID, +! INTEGER levID, +! INTEGER flag) + EXTERNAL vlistDefFlag + + INTEGER vlistInqFlag +! (INTEGER vlistID, +! INTEGER varID, +! INTEGER levID) + EXTERNAL vlistInqFlag + + INTEGER vlistFindVar +! (INTEGER vlistID, +! INTEGER fvarID) + EXTERNAL vlistFindVar + + INTEGER vlistFindLevel +! (INTEGER vlistID, +! INTEGER fvarID, +! INTEGER flevelID) + EXTERNAL vlistFindLevel + + INTEGER vlistMergedVar +! (INTEGER vlistID, +! INTEGER varID) + EXTERNAL vlistMergedVar + + INTEGER vlistMergedLevel +! (INTEGER vlistID, +! INTEGER varID, +! INTEGER levelID) + EXTERNAL vlistMergedLevel + +! cdiClearAdditionalKeys + EXTERNAL cdiClearAdditionalKeys + +! cdiDefAdditionalKey +! (CHARACTER*(*) string) + EXTERNAL cdiDefAdditionalKey + +! vlistDefVarIntKey +! (INTEGER vlistID, +! INTEGER varID, +! CHARACTER*(*) name, +! INTEGER value) + EXTERNAL vlistDefVarIntKey + +! vlistDefVarDblKey +! (INTEGER vlistID, +! INTEGER varID, +! CHARACTER*(*) name, +! DOUBLEPRECISION value) + EXTERNAL vlistDefVarDblKey + + INTEGER vlistHasVarKey +! (INTEGER vlistID, +! INTEGER varID, +! CHARACTER*(*) name) + EXTERNAL vlistHasVarKey + + DOUBLEPRECISION vlistInqVarDblKey +! (INTEGER vlistID, +! INTEGER varID, +! CHARACTER*(*) name) + EXTERNAL vlistInqVarDblKey + + INTEGER vlistInqVarIntKey +! (INTEGER vlistID, +! INTEGER varID, +! CHARACTER*(*) name) + EXTERNAL vlistInqVarIntKey + +! +! CDI attributes +! + INTEGER cdiInqNatts +! (INTEGER cdiID, +! INTEGER varID, +! INTEGER nattsp) + EXTERNAL cdiInqNatts + + INTEGER cdiInqAtt +! (INTEGER cdiID, +! INTEGER varID, +! INTEGER attrnum, +! CHARACTER*(*) name, +! INTEGER typep, +! INTEGER lenp) + EXTERNAL cdiInqAtt + + INTEGER cdiInqAttLen +! (INTEGER cdiID, +! INTEGER varID, +! CHARACTER*(*) name) + EXTERNAL cdiInqAttLen + + INTEGER cdiInqAttType +! (INTEGER cdiID, +! INTEGER varID, +! CHARACTER*(*) name) + EXTERNAL cdiInqAttType + + INTEGER cdiDelAtt +! (INTEGER cdiID, +! INTEGER varID, +! CHARACTER*(*) name) + EXTERNAL cdiDelAtt + + INTEGER cdiCopyAtts +! (INTEGER cdiID1, +! INTEGER varID1, +! INTEGER cdiID2, +! INTEGER varID2) + EXTERNAL cdiCopyAtts + + INTEGER cdiDefAttInt +! (INTEGER cdiID, +! INTEGER varID, +! CHARACTER*(*) name, +! INTEGER type, +! INTEGER len, +! INTEGER ip(*)) + EXTERNAL cdiDefAttInt + + INTEGER cdiDefAttFlt +! (INTEGER cdiID, +! INTEGER varID, +! CHARACTER*(*) name, +! INTEGER type, +! INTEGER len, +! DOUBLEPRECISION dp(*)) + EXTERNAL cdiDefAttFlt + + INTEGER cdiDefAttTxt +! (INTEGER cdiID, +! INTEGER varID, +! CHARACTER*(*) name, +! INTEGER len, +! CHARACTER*(*) tp_cbuf) + EXTERNAL cdiDefAttTxt + + INTEGER cdiInqAttInt +! (INTEGER cdiID, +! INTEGER varID, +! CHARACTER*(*) name, +! INTEGER mlen, +! INTEGER ip(*)) + EXTERNAL cdiInqAttInt + + INTEGER cdiInqAttFlt +! (INTEGER cdiID, +! INTEGER varID, +! CHARACTER*(*) name, +! INTEGER mlen, +! DOUBLEPRECISION dp(*)) + EXTERNAL cdiInqAttFlt + + INTEGER cdiInqAttTxt +! (INTEGER cdiID, +! INTEGER varID, +! CHARACTER*(*) name, +! INTEGER mlen, +! CHARACTER*(*) tp_cbuf) + EXTERNAL cdiInqAttTxt + +! +! GRID routines +! +! gridName +! (INTEGER gridtype, +! CHARACTER*(*) gridname) + EXTERNAL gridName + + CHARACTER(80) gridNamePtr +! (INTEGER gridtype) + EXTERNAL gridNamePtr + +! gridCompress +! (INTEGER gridID) + EXTERNAL gridCompress + +! gridDefMaskGME +! (INTEGER gridID, +! INTEGER mask(*)) + EXTERNAL gridDefMaskGME + + INTEGER gridInqMaskGME +! (INTEGER gridID, +! INTEGER mask(*)) + EXTERNAL gridInqMaskGME + +! gridDefMask +! (INTEGER gridID, +! INTEGER mask(*)) + EXTERNAL gridDefMask + + INTEGER gridInqMask +! (INTEGER gridID, +! INTEGER mask(*)) + EXTERNAL gridInqMask + + INTEGER gridCreate +! (INTEGER gridtype, +! INTEGER size) + EXTERNAL gridCreate + +! gridDestroy +! (INTEGER gridID) + EXTERNAL gridDestroy + + INTEGER gridDuplicate +! (INTEGER gridID) + EXTERNAL gridDuplicate + +! gridDefProj +! (INTEGER gridID, +! INTEGER projID) + EXTERNAL gridDefProj + + INTEGER gridInqProj +! (INTEGER gridID) + EXTERNAL gridInqProj + + INTEGER gridInqProjType +! (INTEGER gridID) + EXTERNAL gridInqProjType + + INTEGER gridInqType +! (INTEGER gridID) + EXTERNAL gridInqType + + INTEGER gridInqSize +! (INTEGER gridID) + EXTERNAL gridInqSize + +! gridDefXsize +! (INTEGER gridID, +! INTEGER xsize) + EXTERNAL gridDefXsize + + INTEGER gridInqXsize +! (INTEGER gridID) + EXTERNAL gridInqXsize + +! gridDefYsize +! (INTEGER gridID, +! INTEGER ysize) + EXTERNAL gridDefYsize + + INTEGER gridInqYsize +! (INTEGER gridID) + EXTERNAL gridInqYsize + +! gridDefNP +! (INTEGER gridID, +! INTEGER np) + EXTERNAL gridDefNP + + INTEGER gridInqNP +! (INTEGER gridID) + EXTERNAL gridInqNP + +! gridDefXvals +! (INTEGER gridID, +! DOUBLEPRECISION xvals(*)) + EXTERNAL gridDefXvals + + INTEGER gridInqXvals +! (INTEGER gridID, +! DOUBLEPRECISION xvals(*)) + EXTERNAL gridInqXvals + + INTEGER gridInqXvalsPart +! (INTEGER gridID, +! INTEGER start, +! INTEGER size, +! DOUBLEPRECISION xvals(*)) + EXTERNAL gridInqXvalsPart + + INTEGER gridInqXIsc +! (INTEGER gridID) + EXTERNAL gridInqXIsc + +! gridDefYvals +! (INTEGER gridID, +! DOUBLEPRECISION yvals(*)) + EXTERNAL gridDefYvals + + INTEGER gridInqYvals +! (INTEGER gridID, +! DOUBLEPRECISION yvals(*)) + EXTERNAL gridInqYvals + + INTEGER gridInqYvalsPart +! (INTEGER gridID, +! INTEGER start, +! INTEGER size, +! DOUBLEPRECISION yvals(*)) + EXTERNAL gridInqYvalsPart + + INTEGER gridInqYIsc +! (INTEGER gridID) + EXTERNAL gridInqYIsc + +! +! CDI var keys +! +! +! String keys +! + INTEGER CDI_KEY_NAME + PARAMETER (CDI_KEY_NAME = 942) + INTEGER CDI_KEY_LONGNAME + PARAMETER (CDI_KEY_LONGNAME = 943) + INTEGER CDI_KEY_STDNAME + PARAMETER (CDI_KEY_STDNAME = 944) + INTEGER CDI_KEY_UNITS + PARAMETER (CDI_KEY_UNITS = 945) + INTEGER CDI_KEY_DATATYPE + PARAMETER (CDI_KEY_DATATYPE = 946) + INTEGER CDI_KEY_REFERENCEURI + PARAMETER (CDI_KEY_REFERENCEURI = 947) + INTEGER CDI_KEY_CHUNKS + PARAMETER (CDI_KEY_CHUNKS = 948) +! +! Integer keys +! + INTEGER CDI_KEY_NUMBEROFGRIDUSED + PARAMETER (CDI_KEY_NUMBEROFGRIDUSED = 961) + INTEGER CDI_KEY_NUMBEROFGRIDINREFERENCE + PARAMETER (CDI_KEY_NUMBEROFGRIDINREFERENCE = 962) + INTEGER CDI_KEY_NUMBEROFVGRIDUSED + PARAMETER (CDI_KEY_NUMBEROFVGRIDUSED = 963) + INTEGER CDI_KEY_NLEV + PARAMETER (CDI_KEY_NLEV = 964) + INTEGER CDI_KEY_CHUNKTYPE + PARAMETER (CDI_KEY_CHUNKTYPE = 965) + INTEGER CDI_KEY_CHUNKSIZE + PARAMETER (CDI_KEY_CHUNKSIZE = 966) +! +! Floating point keys +! + INTEGER CDI_KEY_MISSVAL + PARAMETER (CDI_KEY_MISSVAL = 701) + INTEGER CDI_KEY_ADDOFFSET + PARAMETER (CDI_KEY_ADDOFFSET = 702) + INTEGER CDI_KEY_SCALEFACTOR + PARAMETER (CDI_KEY_SCALEFACTOR = 703) +! +! Byte array keys +! + INTEGER CDI_KEY_UUID + PARAMETER (CDI_KEY_UUID = 960) + INTEGER CDI_KEY_DIMNAME + PARAMETER (CDI_KEY_DIMNAME = 941) + INTEGER CDI_KEY_PSNAME + PARAMETER (CDI_KEY_PSNAME = 950) + INTEGER CDI_KEY_P0NAME + PARAMETER (CDI_KEY_P0NAME = 951) + INTEGER CDI_KEY_P0VALUE + PARAMETER (CDI_KEY_P0VALUE = 952) + INTEGER CDI_KEY_TABLESVERSION + PARAMETER (CDI_KEY_TABLESVERSION = 801) + INTEGER CDI_KEY_LOCALTABLESVERSION + PARAMETER (CDI_KEY_LOCALTABLESVERSION = 802) + INTEGER CDI_KEY_TYPEOFGENERATINGPROCESS + PARAMETER (CDI_KEY_TYPEOFGENERATINGPROCESS = 803) + INTEGER CDI_KEY_PRODUCTDEFINITIONTEMPLATE + PARAMETER (CDI_KEY_PRODUCTDEFINITIONTEMPLATE = 804) + INTEGER CDI_KEY_TYPEOFPROCESSEDDATA + PARAMETER (CDI_KEY_TYPEOFPROCESSEDDATA = 805) + INTEGER CDI_KEY_SHAPEOFTHEEARTH + PARAMETER (CDI_KEY_SHAPEOFTHEEARTH = 806) + INTEGER CDI_KEY_BACKGROUNDPROCESS + PARAMETER (CDI_KEY_BACKGROUNDPROCESS = 807) + INTEGER CDI_KEY_TYPEOFENSEMBLEFORECAST + PARAMETER (CDI_KEY_TYPEOFENSEMBLEFORECAST = 808) + INTEGER CDI_KEY_NUMBEROFFORECASTSINENSEMBLE + PARAMETER (CDI_KEY_NUMBEROFFORECASTSINENSEMBLE = 809) + INTEGER CDI_KEY_PERTURBATIONNUMBER + PARAMETER (CDI_KEY_PERTURBATIONNUMBER = 810) + INTEGER CDI_KEY_CENTRE + PARAMETER (CDI_KEY_CENTRE = 811) + INTEGER CDI_KEY_SUBCENTRE + PARAMETER (CDI_KEY_SUBCENTRE = 812) + INTEGER CDI_KEY_MPIMTYPE + PARAMETER (CDI_KEY_MPIMTYPE = 813) + INTEGER CDI_KEY_MPIMCLASS + PARAMETER (CDI_KEY_MPIMCLASS = 814) + INTEGER CDI_KEY_MPIMUSER + PARAMETER (CDI_KEY_MPIMUSER = 815) + INTEGER CDI_KEY_REVSTATUS + PARAMETER (CDI_KEY_REVSTATUS = 816) + INTEGER CDI_KEY_REVNUMBER + PARAMETER (CDI_KEY_REVNUMBER = 817) + INTEGER CDI_KEY_GRIB2LOCALSECTIONNUMBER + PARAMETER (CDI_KEY_GRIB2LOCALSECTIONNUMBER = 818) + INTEGER CDI_KEY_SECTION2PADDINGLENGTH + PARAMETER (CDI_KEY_SECTION2PADDINGLENGTH = 819) + INTEGER CDI_KEY_SECTION2PADDING + PARAMETER (CDI_KEY_SECTION2PADDING = 820) + INTEGER CDI_KEY_CONSTITUENTTYPE + PARAMETER (CDI_KEY_CONSTITUENTTYPE = 821) + INTEGER CDI_KEY_TYPEOFTIMEINCREMENT + PARAMETER (CDI_KEY_TYPEOFTIMEINCREMENT = 822) + INTEGER CDI_KEY_TYPEOFFIRSTFIXEDSURFACE + PARAMETER (CDI_KEY_TYPEOFFIRSTFIXEDSURFACE = 823) + INTEGER CDI_KEY_TYPEOFSECONDFIXEDSURFACE + PARAMETER (CDI_KEY_TYPEOFSECONDFIXEDSURFACE = 824) + INTEGER CDI_KEY_UVRELATIVETOGRID + PARAMETER (CDI_KEY_UVRELATIVETOGRID = 825) + INTEGER CDI_KEY_SCANNINGMODE + PARAMETER (CDI_KEY_SCANNINGMODE = 826) + INTEGER CDI_KEY_VDIMNAME + PARAMETER (CDI_KEY_VDIMNAME = 920) + INTEGER CDI_KEY_GRIDMAP_VARTYPE + PARAMETER (CDI_KEY_GRIDMAP_VARTYPE = 921) + INTEGER CDI_KEY_GRIDMAP_VARNAME + PARAMETER (CDI_KEY_GRIDMAP_VARNAME = 922) + INTEGER CDI_KEY_GRIDMAP_NAME + PARAMETER (CDI_KEY_GRIDMAP_NAME = 923) + INTEGER cdiDefKeyInt +! (INTEGER cdiID, +! INTEGER varID, +! INTEGER key, +! INTEGER value) + EXTERNAL cdiDefKeyInt + + INTEGER cdiInqKeyInt +! (INTEGER cdiID, +! INTEGER varID, +! INTEGER key, +! INTEGER value) + EXTERNAL cdiInqKeyInt + + INTEGER cdiDefKeyFloat +! (INTEGER cdiID, +! INTEGER varID, +! INTEGER key, +! DOUBLEPRECISION value) + EXTERNAL cdiDefKeyFloat + +! +! cdiInqKeyFloat Get a float value from a key +! + INTEGER cdiInqKeyFloat +! (INTEGER cdiID, +! INTEGER varID, +! INTEGER key, +! DOUBLEPRECISION value) + EXTERNAL cdiInqKeyFloat + + INTEGER cdiDefKeyString +! (INTEGER cdiID, +! INTEGER varID, +! INTEGER key, +! CHARACTER*(*) string) + EXTERNAL cdiDefKeyString + + INTEGER cdiInqKeyString +! (INTEGER cdiID, +! INTEGER varID, +! INTEGER key, +! CHARACTER*(*) string, +! INTEGER length) + EXTERNAL cdiInqKeyString + + INTEGER cdiInqKeyLen +! (INTEGER cdiID, +! INTEGER varID, +! INTEGER key, +! INTEGER length) + EXTERNAL cdiInqKeyLen + + INTEGER cdiCopyKeys +! (INTEGER cdiID1, +! INTEGER varID1, +! INTEGER cdiID2, +! INTEGER varID2) + EXTERNAL cdiCopyKeys + + INTEGER cdiCopyKey +! (INTEGER cdiID1, +! INTEGER varID1, +! INTEGER key, +! INTEGER cdiID2) + EXTERNAL cdiCopyKey + + INTEGER cdiDeleteKey +! (INTEGER cdiID, +! INTEGER varID, +! INTEGER key) + EXTERNAL cdiDeleteKey + +! +! GRID routines +! +! gridDefXname +! (INTEGER gridID, +! CHARACTER*(*) xname) + EXTERNAL gridDefXname + +! gridInqXname +! (INTEGER gridID, +! CHARACTER*(*) xname) + EXTERNAL gridInqXname + +! gridDefXlongname +! (INTEGER gridID, +! CHARACTER*(*) xlongname) + EXTERNAL gridDefXlongname + +! gridInqXlongname +! (INTEGER gridID, +! CHARACTER*(*) xlongname) + EXTERNAL gridInqXlongname + +! gridDefXunits +! (INTEGER gridID, +! CHARACTER*(*) xunits) + EXTERNAL gridDefXunits + +! gridInqXunits +! (INTEGER gridID, +! CHARACTER*(*) xunits) + EXTERNAL gridInqXunits + +! gridDefYname +! (INTEGER gridID, +! CHARACTER*(*) yname) + EXTERNAL gridDefYname + +! gridInqYname +! (INTEGER gridID, +! CHARACTER*(*) yname) + EXTERNAL gridInqYname + +! gridDefYlongname +! (INTEGER gridID, +! CHARACTER*(*) ylongname) + EXTERNAL gridDefYlongname + +! gridInqYlongname +! (INTEGER gridID, +! CHARACTER*(*) ylongname) + EXTERNAL gridInqYlongname + +! gridDefYunits +! (INTEGER gridID, +! CHARACTER*(*) yunits) + EXTERNAL gridDefYunits + +! gridInqYunits +! (INTEGER gridID, +! CHARACTER*(*) yunits) + EXTERNAL gridInqYunits + +! gridDefDatatype +! (INTEGER gridID, +! INTEGER datatype) + EXTERNAL gridDefDatatype + + INTEGER gridInqDatatype +! (INTEGER gridID) + EXTERNAL gridInqDatatype + + DOUBLEPRECISION gridInqXval +! (INTEGER gridID, +! INTEGER index) + EXTERNAL gridInqXval + + DOUBLEPRECISION gridInqYval +! (INTEGER gridID, +! INTEGER index) + EXTERNAL gridInqYval + + DOUBLEPRECISION gridInqXinc +! (INTEGER gridID) + EXTERNAL gridInqXinc + + DOUBLEPRECISION gridInqYinc +! (INTEGER gridID) + EXTERNAL gridInqYinc + + INTEGER gridIsCircular +! (INTEGER gridID) + EXTERNAL gridIsCircular + + INTEGER gridInqTrunc +! (INTEGER gridID) + EXTERNAL gridInqTrunc + +! gridDefTrunc +! (INTEGER gridID, +! INTEGER trunc) + EXTERNAL gridDefTrunc + +! +! Reference of an unstructured grid +! +! gridDefNumber +! (INTEGER gridID, +! INTEGER number) + EXTERNAL gridDefNumber + + INTEGER gridInqNumber +! (INTEGER gridID) + EXTERNAL gridInqNumber + +! gridDefPosition +! (INTEGER gridID, +! INTEGER position) + EXTERNAL gridDefPosition + + INTEGER gridInqPosition +! (INTEGER gridID) + EXTERNAL gridInqPosition + +! gridDefReference +! (INTEGER gridID, +! CHARACTER*(*) reference) + EXTERNAL gridDefReference + + INTEGER gridInqReference +! (INTEGER gridID, +! CHARACTER*(*) reference) + EXTERNAL gridInqReference + +! gridDefUUID +! (INTEGER gridID, +! INTEGER*1(16) uuid) + EXTERNAL gridDefUUID + +! gridInqUUID +! (INTEGER gridID, +! INTEGER*1(16) uuid) + EXTERNAL gridInqUUID + +! +! Rotated Lon/Lat grid +! +! gridDefParamRLL +! (INTEGER gridID, +! DOUBLEPRECISION xpole, +! DOUBLEPRECISION ypole, +! DOUBLEPRECISION angle) + EXTERNAL gridDefParamRLL + +! gridInqParamRLL +! (INTEGER gridID, +! DOUBLEPRECISION xpole, +! DOUBLEPRECISION ypole, +! DOUBLEPRECISION angle) + EXTERNAL gridInqParamRLL + +! +! Hexagonal GME grid +! +! gridDefParamGME +! (INTEGER gridID, +! INTEGER nd, +! INTEGER ni, +! INTEGER ni2, +! INTEGER ni3) + EXTERNAL gridDefParamGME + +! gridInqParamGME +! (INTEGER gridID, +! INTEGER nd, +! INTEGER ni, +! INTEGER ni2, +! INTEGER ni3) + EXTERNAL gridInqParamGME + +! gridDefArea +! (INTEGER gridID, +! DOUBLEPRECISION area(*)) + EXTERNAL gridDefArea + +! gridInqArea +! (INTEGER gridID, +! DOUBLEPRECISION area(*)) + EXTERNAL gridInqArea + + INTEGER gridHasArea +! (INTEGER gridID) + EXTERNAL gridHasArea + +! gridDefNvertex +! (INTEGER gridID, +! INTEGER nvertex) + EXTERNAL gridDefNvertex + + INTEGER gridInqNvertex +! (INTEGER gridID) + EXTERNAL gridInqNvertex + +! gridDefXbounds +! (INTEGER gridID, +! DOUBLEPRECISION xbounds(*)) + EXTERNAL gridDefXbounds + + INTEGER gridInqXbounds +! (INTEGER gridID, +! DOUBLEPRECISION xbounds(*)) + EXTERNAL gridInqXbounds + + INTEGER gridInqXboundsPart +! (INTEGER gridID, +! INTEGER start, +! INTEGER size, +! DOUBLEPRECISION xbounds(*)) + EXTERNAL gridInqXboundsPart + +! gridDefYbounds +! (INTEGER gridID, +! DOUBLEPRECISION ybounds(*)) + EXTERNAL gridDefYbounds + + INTEGER gridInqYbounds +! (INTEGER gridID, +! DOUBLEPRECISION ybounds(*)) + EXTERNAL gridInqYbounds + + INTEGER gridInqYboundsPart +! (INTEGER gridID, +! INTEGER start, +! INTEGER size, +! DOUBLEPRECISION ybounds(*)) + EXTERNAL gridInqYboundsPart + +! gridDefReducedPoints +! (INTEGER gridID, +! INTEGER reducedPointsSize, +! INTEGER reducedPoints(*)) + EXTERNAL gridDefReducedPoints + +! gridInqReducedPoints +! (INTEGER gridID, +! INTEGER reducedPoints(*)) + EXTERNAL gridInqReducedPoints + +! gridChangeType +! (INTEGER gridID, +! INTEGER gridtype) + EXTERNAL gridChangeType + +! gridDefComplexPacking +! (INTEGER gridID, +! INTEGER lpack) + EXTERNAL gridDefComplexPacking + + INTEGER gridInqComplexPacking +! (INTEGER gridID) + EXTERNAL gridInqComplexPacking + +! +! ZAXIS routines +! +! zaxisName +! (INTEGER zaxistype, +! CHARACTER*(*) zaxisname) + EXTERNAL zaxisName + + CHARACTER(80) zaxisNamePtr +! (INTEGER leveltype) + EXTERNAL zaxisNamePtr + + INTEGER zaxisCreate +! (INTEGER zaxistype, +! INTEGER size) + EXTERNAL zaxisCreate + +! zaxisDestroy +! (INTEGER zaxisID) + EXTERNAL zaxisDestroy + + INTEGER zaxisInqType +! (INTEGER zaxisID) + EXTERNAL zaxisInqType + + INTEGER zaxisInqSize +! (INTEGER zaxisID) + EXTERNAL zaxisInqSize + + INTEGER zaxisDuplicate +! (INTEGER zaxisID) + EXTERNAL zaxisDuplicate + +! zaxisDefLevels +! (INTEGER zaxisID, +! DOUBLEPRECISION levels(*)) + EXTERNAL zaxisDefLevels + + INTEGER zaxisInqLevels +! (INTEGER zaxisID, +! DOUBLEPRECISION levels(*)) + EXTERNAL zaxisInqLevels + + INTEGER zaxisInqCLen +! (INTEGER zaxisID) + EXTERNAL zaxisInqCLen + +! zaxisDefLevel +! (INTEGER zaxisID, +! INTEGER levelID, +! DOUBLEPRECISION levels) + EXTERNAL zaxisDefLevel + + DOUBLEPRECISION zaxisInqLevel +! (INTEGER zaxisID, +! INTEGER levelID) + EXTERNAL zaxisInqLevel + +! zaxisDefNlevRef +! (INTEGER gridID, +! INTEGER nhlev) + EXTERNAL zaxisDefNlevRef + + INTEGER zaxisInqNlevRef +! (INTEGER gridID) + EXTERNAL zaxisInqNlevRef + +! zaxisDefNumber +! (INTEGER gridID, +! INTEGER number) + EXTERNAL zaxisDefNumber + + INTEGER zaxisInqNumber +! (INTEGER gridID) + EXTERNAL zaxisInqNumber + +! zaxisDefUUID +! (INTEGER zaxisID, +! INTEGER*1(16) uuid) + EXTERNAL zaxisDefUUID + +! zaxisInqUUID +! (INTEGER zaxisID, +! INTEGER*1(16) uuid) + EXTERNAL zaxisInqUUID + +! zaxisDefName +! (INTEGER zaxisID, +! CHARACTER*(*) name_optional) + EXTERNAL zaxisDefName + +! zaxisInqName +! (INTEGER zaxisID, +! CHARACTER*(*) name) + EXTERNAL zaxisInqName + +! zaxisDefLongname +! (INTEGER zaxisID, +! CHARACTER*(*) longname_optional) + EXTERNAL zaxisDefLongname + +! zaxisInqLongname +! (INTEGER zaxisID, +! CHARACTER*(*) longname) + EXTERNAL zaxisInqLongname + +! zaxisDefUnits +! (INTEGER zaxisID, +! CHARACTER*(*) units_optional) + EXTERNAL zaxisDefUnits + +! zaxisInqUnits +! (INTEGER zaxisID, +! CHARACTER*(*) units) + EXTERNAL zaxisInqUnits + +! zaxisInqStdname +! (INTEGER zaxisID, +! CHARACTER*(*) stdname) + EXTERNAL zaxisInqStdname + +! zaxisDefDatatype +! (INTEGER zaxisID, +! INTEGER datatype) + EXTERNAL zaxisDefDatatype + + INTEGER zaxisInqDatatype +! (INTEGER zaxisID) + EXTERNAL zaxisInqDatatype + +! zaxisDefPositive +! (INTEGER zaxisID, +! INTEGER positive) + EXTERNAL zaxisDefPositive + + INTEGER zaxisInqPositive +! (INTEGER zaxisID) + EXTERNAL zaxisInqPositive + +! zaxisDefScalar +! (INTEGER zaxisID) + EXTERNAL zaxisDefScalar + + INTEGER zaxisInqScalar +! (INTEGER zaxisID) + EXTERNAL zaxisInqScalar + +! zaxisDefVct +! (INTEGER zaxisID, +! INTEGER size, +! DOUBLEPRECISION vct(*)) + EXTERNAL zaxisDefVct + +! zaxisInqVct +! (INTEGER zaxisID, +! DOUBLEPRECISION vct(*)) + EXTERNAL zaxisInqVct + + INTEGER zaxisInqVctSize +! (INTEGER zaxisID) + EXTERNAL zaxisInqVctSize + +! zaxisDefLbounds +! (INTEGER zaxisID, +! DOUBLEPRECISION lbounds(*)) + EXTERNAL zaxisDefLbounds + + INTEGER zaxisInqLbounds +! (INTEGER zaxisID, +! DOUBLEPRECISION lbounds_optional(*)) + EXTERNAL zaxisInqLbounds + + DOUBLEPRECISION zaxisInqLbound +! (INTEGER zaxisID, +! INTEGER index) + EXTERNAL zaxisInqLbound + +! zaxisDefUbounds +! (INTEGER zaxisID, +! DOUBLEPRECISION ubounds(*)) + EXTERNAL zaxisDefUbounds + + INTEGER zaxisInqUbounds +! (INTEGER zaxisID, +! DOUBLEPRECISION ubounds_optional(*)) + EXTERNAL zaxisInqUbounds + + DOUBLEPRECISION zaxisInqUbound +! (INTEGER zaxisID, +! INTEGER index) + EXTERNAL zaxisInqUbound + +! zaxisDefWeights +! (INTEGER zaxisID, +! DOUBLEPRECISION weights(*)) + EXTERNAL zaxisDefWeights + + INTEGER zaxisInqWeights +! (INTEGER zaxisID, +! DOUBLEPRECISION weights_optional(*)) + EXTERNAL zaxisInqWeights + +! zaxisChangeType +! (INTEGER zaxisID, +! INTEGER zaxistype) + EXTERNAL zaxisChangeType + +! +! TAXIS routines +! + INTEGER taxisCreate +! (INTEGER taxistype) + EXTERNAL taxisCreate + +! taxisDestroy +! (INTEGER taxisID) + EXTERNAL taxisDestroy + + INTEGER taxisDuplicate +! (INTEGER taxisID) + EXTERNAL taxisDuplicate + +! taxisCopyTimestep +! (INTEGER taxisIDdes, +! INTEGER taxisIDsrc) + EXTERNAL taxisCopyTimestep + +! taxisDefType +! (INTEGER taxisID, +! INTEGER taxistype) + EXTERNAL taxisDefType + + INTEGER taxisInqType +! (INTEGER taxisID) + EXTERNAL taxisInqType + +! taxisDefVdate +! (INTEGER taxisID, +! INTEGER date) + EXTERNAL taxisDefVdate + +! taxisDefVtime +! (INTEGER taxisID, +! INTEGER time) + EXTERNAL taxisDefVtime + + INTEGER taxisInqVdate +! (INTEGER taxisID) + EXTERNAL taxisInqVdate + + INTEGER taxisInqVtime +! (INTEGER taxisID) + EXTERNAL taxisInqVtime + +! taxisDefRdate +! (INTEGER taxisID, +! INTEGER date) + EXTERNAL taxisDefRdate + +! taxisDefRtime +! (INTEGER taxisID, +! INTEGER time) + EXTERNAL taxisDefRtime + + INTEGER taxisInqRdate +! (INTEGER taxisID) + EXTERNAL taxisInqRdate + + INTEGER taxisInqRtime +! (INTEGER taxisID) + EXTERNAL taxisInqRtime + + INTEGER taxisHasBounds +! (INTEGER taxisID) + EXTERNAL taxisHasBounds + +! taxisWithBounds +! (INTEGER taxisID) + EXTERNAL taxisWithBounds + +! taxisDeleteBounds +! (INTEGER taxisID) + EXTERNAL taxisDeleteBounds + +! taxisDefVdateBounds +! (INTEGER taxisID, +! INTEGER vdate_lb, +! INTEGER vdate_ub) + EXTERNAL taxisDefVdateBounds + +! taxisDefVtimeBounds +! (INTEGER taxisID, +! INTEGER vtime_lb, +! INTEGER vtime_ub) + EXTERNAL taxisDefVtimeBounds + +! taxisInqVdateBounds +! (INTEGER taxisID, +! INTEGER vdate_lb, +! INTEGER vdate_ub) + EXTERNAL taxisInqVdateBounds + +! taxisInqVtimeBounds +! (INTEGER taxisID, +! INTEGER vtime_lb, +! INTEGER vtime_ub) + EXTERNAL taxisInqVtimeBounds + +! taxisDefCalendar +! (INTEGER taxisID, +! INTEGER calendar) + EXTERNAL taxisDefCalendar + + INTEGER taxisInqCalendar +! (INTEGER taxisID) + EXTERNAL taxisInqCalendar + +! taxisDefTunit +! (INTEGER taxisID, +! INTEGER tunit) + EXTERNAL taxisDefTunit + + INTEGER taxisInqTunit +! (INTEGER taxisID) + EXTERNAL taxisInqTunit + +! taxisDefForecastTunit +! (INTEGER taxisID, +! INTEGER tunit) + EXTERNAL taxisDefForecastTunit + + INTEGER taxisInqForecastTunit +! (INTEGER taxisID) + EXTERNAL taxisInqForecastTunit + +! taxisDefForecastPeriod +! (INTEGER taxisID, +! DOUBLEPRECISION fc_period) + EXTERNAL taxisDefForecastPeriod + + DOUBLEPRECISION taxisInqForecastPeriod +! (INTEGER taxisID) + EXTERNAL taxisInqForecastPeriod + +! taxisDefNumavg +! (INTEGER taxisID, +! INTEGER numavg) + EXTERNAL taxisDefNumavg + + INTEGER taxisInqNumavg +! (INTEGER taxisID) + EXTERNAL taxisInqNumavg + + CHARACTER(80) taxisNamePtr +! (INTEGER taxisID) + EXTERNAL taxisNamePtr + + CHARACTER(80) tunitNamePtr +! (INTEGER tunitID) + EXTERNAL tunitNamePtr + +! +! Institut routines +! + INTEGER institutDef +! (INTEGER center, +! INTEGER subcenter, +! CHARACTER*(*) name, +! CHARACTER*(*) longname) + EXTERNAL institutDef + + INTEGER institutInq +! (INTEGER center, +! INTEGER subcenter, +! CHARACTER*(*) name, +! CHARACTER*(*) longname) + EXTERNAL institutInq + + INTEGER institutInqNumber + EXTERNAL institutInqNumber + + INTEGER institutInqCenter +! (INTEGER instID) + EXTERNAL institutInqCenter + + INTEGER institutInqSubcenter +! (INTEGER instID) + EXTERNAL institutInqSubcenter + + CHARACTER(80) institutInqNamePtr +! (INTEGER instID) + EXTERNAL institutInqNamePtr + + CHARACTER(80) institutInqLongnamePtr +! (INTEGER instID) + EXTERNAL institutInqLongnamePtr + +! +! Model routines +! + INTEGER modelDef +! (INTEGER instID, +! INTEGER modelgribID, +! CHARACTER*(*) name) + EXTERNAL modelDef + + INTEGER modelInq +! (INTEGER instID, +! INTEGER modelgribID, +! CHARACTER*(*) name) + EXTERNAL modelInq + + INTEGER modelInqInstitut +! (INTEGER modelID) + EXTERNAL modelInqInstitut + + INTEGER modelInqGribID +! (INTEGER modelID) + EXTERNAL modelInqGribID + + CHARACTER(80) modelInqNamePtr +! (INTEGER modelID) + EXTERNAL modelInqNamePtr + +! +! Table routines +! +! tableWrite +! (CHARACTER*(*) filename, +! INTEGER tableID) + EXTERNAL tableWrite + + INTEGER tableRead +! (CHARACTER*(*) tablefile) + EXTERNAL tableRead + + INTEGER tableDef +! (INTEGER modelID, +! INTEGER tablenum, +! CHARACTER*(*) tablename) + EXTERNAL tableDef + + CHARACTER(80) tableInqNamePtr +! (INTEGER tableID) + EXTERNAL tableInqNamePtr + + INTEGER tableInq +! (INTEGER modelID, +! INTEGER tablenum, +! CHARACTER*(*) tablename) + EXTERNAL tableInq + + INTEGER tableInqNumber + EXTERNAL tableInqNumber + + INTEGER tableInqNum +! (INTEGER tableID) + EXTERNAL tableInqNum + + INTEGER tableInqModel +! (INTEGER tableID) + EXTERNAL tableInqModel + +! tableInqEntry +! (INTEGER tableID, +! INTEGER id, +! INTEGER ltype, +! CHARACTER*(*) name, +! CHARACTER*(*) longname, +! CHARACTER*(*) units) + EXTERNAL tableInqEntry + +! +! Subtype routines +! + INTEGER subtypeCreate +! (INTEGER subtype) + EXTERNAL subtypeCreate + +! +! Gives a textual summary of the variable subtype +! +! subtypePrint +! (INTEGER subtypeID) + EXTERNAL subtypePrint + +! +! Compares two subtype data structures +! + INTEGER subtypeCompare +! (INTEGER subtypeID1, +! INTEGER subtypeID2) + EXTERNAL subtypeCompare + + INTEGER subtypeInqSize +! (INTEGER subtypeID) + EXTERNAL subtypeInqSize + + INTEGER subtypeInqActiveIndex +! (INTEGER subtypeID) + EXTERNAL subtypeInqActiveIndex + +! subtypeDefActiveIndex +! (INTEGER subtypeID, +! INTEGER index) + EXTERNAL subtypeDefActiveIndex + +! +! Generate a "query object" out of a key-value pair +! +! +! Generate an AND-combined "query object" out of two previous query objects +! + INTEGER subtypeInqTile +! (INTEGER subtypeID, +! INTEGER tileindex, +! INTEGER attribute) + EXTERNAL subtypeInqTile + + INTEGER subtypeInqAttribute +! (INTEGER subtypeID, +! INTEGER index, +! CHARACTER*(*) key, +! INTEGER outValue) + EXTERNAL subtypeInqAttribute + + INTEGER vlistInqVarSubtype +! (INTEGER vlistID, +! INTEGER varID) + EXTERNAL vlistInqVarSubtype + +! gribapiLibraryVersion +! (INTEGER major_version, +! INTEGER minor_version, +! INTEGER revision_version) + EXTERNAL gribapiLibraryVersion + +! +! Compatibility functions for release 1.8.3 (obsolete functions) +! +! zaxisDefLtype +! (INTEGER zaxisID, +! INTEGER ltype) + EXTERNAL zaxisDefLtype + + INTEGER vlistInqVarTypeOfGeneratingProcess +! (INTEGER vlistID, +! INTEGER varID) + EXTERNAL vlistInqVarTypeOfGeneratingProcess + +! vlistDefVarTypeOfGeneratingProcess +! (INTEGER vlistID, +! INTEGER varID, +! INTEGER typeOfGeneratingProcess) + EXTERNAL vlistDefVarTypeOfGeneratingProcess + +! vlistDefVarProductDefinitionTemplate +! (INTEGER vlistID, +! INTEGER varID, +! INTEGER productDefinitionTemplate) + EXTERNAL vlistDefVarProductDefinitionTemplate + +! +! End of fortran interface +! diff --git a/src/cdiFortran.c b/src/cdiFortran.c new file mode 100644 index 0000000000000000000000000000000000000000..1c78dfb17fe01d5967423105420cb8e97a894294 --- /dev/null +++ b/src/cdiFortran.c @@ -0,0 +1,812 @@ +// Automatically generated by make_fint.c, don't edit! + +// clang-format off + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifndef CDI_H_ +#include "cdi.h" +#endif + +#ifdef HAVE_CF_INTERFACE + +#include <limits.h> +#include <assert.h> + +#ifndef __CFORTRAN_LOADED +# if defined __clang__ +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wreserved-id-macro" +# endif +# include "cfortran.h" +# if defined __clang__ +# pragma GCC diagnostic pop +# endif +#endif +/* These functions are meant to be called from Fortran and don't + * need an interface declaration in a C header. */ +#ifdef __clang__ +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + +#ifdef CDI_H_ + +static inline +int SizeType_c2f(SizeType value_SizeType) +{ + assert(value_SizeType < INT_MAX); + return (int) value_SizeType; +} + +#endif + +/* Start of fortran interface for the following routines (make_fint.c) */ + + +/* Byte order */ + + +/* Error identifier */ + + +/* File types */ + + +/* Compatibility defines for release 1.8.3 (obsolete defines) */ + + +/* Protocols (in filename/URI) */ + + +/* Compress types */ + + +/* external data types */ + + +/* Compatibility defines for release 1.8.3 (obsolete defines) */ + + +/* internal data types */ + + +/* Chunk types */ + + +/* GRID types */ + + +/* ZAXIS types */ + + +/* SUBTYPE types */ + + +/* Data structure defining a key-value search, possibly with multiple + key-value pairs in combination. + + Currently, only multiple pairs combined by AND are supported. */ + + +/* TIME types */ + + +/* TSTEP types */ + + +/* TAXIS types */ + + +/* TUNIT types */ + + +/* CALENDAR types */ + + +/* number of unsigned char needed to store UUID */ + + +/* Structs that are used to return data to the user */ + + +/* Opaque types */ + + +/* CDI control routines */ + +FCALLSCSUB0 (cdiReset, CDIRESET, cdireset) +FCALLSCFUN1 (STRING, cdiStringError, CDISTRINGERROR, cdistringerror, INT) +FCALLSCSUB1 (cdiDebug, CDIDEBUG, cdidebug, INT) +FCALLSCFUN0 (STRING, cdiLibraryVersion, CDILIBRARYVERSION, cdilibraryversion) +FCALLSCSUB0 (cdiPrintVersion, CDIPRINTVERSION, cdiprintversion) +FCALLSCFUN1 (INT, cdiHaveFiletype, CDIHAVEFILETYPE, cdihavefiletype, INT) +FCALLSCSUB1 (cdiDefMissval, CDIDEFMISSVAL, cdidefmissval, DOUBLE) +FCALLSCFUN0 (DOUBLE, cdiInqMissval, CDIINQMISSVAL, cdiinqmissval) +FCALLSCSUB2 (cdiDefGlobal, CDIDEFGLOBAL, cdidefglobal, STRING, INT) +FCALLSCFUN0 (INT, namespaceNew, NAMESPACENEW, namespacenew) +FCALLSCSUB1 (namespaceSetActive, NAMESPACESETACTIVE, namespacesetactive, INT) +FCALLSCFUN0 (INT, namespaceGetActive, NAMESPACEGETACTIVE, namespacegetactive) +FCALLSCSUB1 (namespaceDelete, NAMESPACEDELETE, namespacedelete, INT) + +/* CDI converter routines */ + + +/* parameter */ + +FCALLSCSUB3 (cdiParamToString, CDIPARAMTOSTRING, cdiparamtostring, INT, PSTRING, INT) +FCALLSCSUB4 (cdiDecodeParam, CDIDECODEPARAM, cdidecodeparam, INT, PINT, PINT, PINT) +FCALLSCFUN3 (INT, cdiEncodeParam, CDIENCODEPARAM, cdiencodeparam, INT, INT, INT) + +/* date format: YYYYMMDD */ + + +/* time format: hhmmss */ + +FCALLSCSUB4 (cdiDecodeDate, CDIDECODEDATE, cdidecodedate, INT, PINT, PINT, PINT) +FCALLSCFUN3 (INT, cdiEncodeDate, CDIENCODEDATE, cdiencodedate, INT, INT, INT) +FCALLSCSUB4 (cdiDecodeTime, CDIDECODETIME, cdidecodetime, INT, PINT, PINT, PINT) +FCALLSCFUN3 (INT, cdiEncodeTime, CDIENCODETIME, cdiencodetime, INT, INT, INT) + +/* STREAM control routines */ + +FCALLSCFUN2 (INT, cdiGetFiletype, CDIGETFILETYPE, cdigetfiletype, STRING, PINT) +FCALLSCFUN1 (INT, streamOpenRead, STREAMOPENREAD, streamopenread, STRING) +FCALLSCFUN2 (INT, streamOpenWrite, STREAMOPENWRITE, streamopenwrite, STRING, INT) +FCALLSCFUN1 (INT, streamOpenAppend, STREAMOPENAPPEND, streamopenappend, STRING) +FCALLSCSUB1 (streamClose, STREAMCLOSE, streamclose, INT) +FCALLSCSUB1 (streamSync, STREAMSYNC, streamsync, INT) +FCALLSCSUB2 (streamDefMaxSteps, STREAMDEFMAXSTEPS, streamdefmaxsteps, INT, INT) +FCALLSCSUB2 (streamDefNumWorker, STREAMDEFNUMWORKER, streamdefnumworker, INT, INT) +FCALLSCSUB2 (streamDefVlist, STREAMDEFVLIST, streamdefvlist, INT, INT) +FCALLSCFUN1 (INT, streamInqVlist, STREAMINQVLIST, streaminqvlist, INT) +FCALLSCFUN1 (INT, streamInqFiletype, STREAMINQFILETYPE, streaminqfiletype, INT) +FCALLSCSUB2 (streamDefByteorder, STREAMDEFBYTEORDER, streamdefbyteorder, INT, INT) +FCALLSCFUN1 (INT, streamInqByteorder, STREAMINQBYTEORDER, streaminqbyteorder, INT) +FCALLSCSUB4 (streamDefFilter, STREAMDEFFILTER, streamdeffilter, INT, INT, INT, PINT) +FCALLSCSUB2 (streamDefCompType, STREAMDEFCOMPTYPE, streamdefcomptype, INT, INT) +FCALLSCFUN1 (INT, streamInqCompType, STREAMINQCOMPTYPE, streaminqcomptype, INT) +FCALLSCSUB2 (streamDefCompLevel, STREAMDEFCOMPLEVEL, streamdefcomplevel, INT, INT) +FCALLSCFUN1 (INT, streamInqCompLevel, STREAMINQCOMPLEVEL, streaminqcomplevel, INT) +FCALLSCFUN2 (INT, streamDefTimestep, STREAMDEFTIMESTEP, streamdeftimestep, INT, INT) +FCALLSCFUN2 (INT, streamInqTimestep, STREAMINQTIMESTEP, streaminqtimestep, INT, INT) +FCALLSCFUN1 (INT, streamInqCurTimestepID, STREAMINQCURTIMESTEPID, streaminqcurtimestepid, INT) +FCALLSCFUN1 (STRING, streamFilename, STREAMFILENAME, streamfilename, INT) +FCALLSCFUN1 (STRING, streamFilesuffix, STREAMFILESUFFIX, streamfilesuffix, INT) +static int streamNvals_fwrap(int streamID) +{ + SizeType v; + v = streamNvals(streamID); + return SizeType_c2f(v); +} +FCALLSCFUN1 (INT, streamNvals_fwrap, STREAMNVALS, streamnvals, INT) +FCALLSCFUN1 (INT, streamInqNvars, STREAMINQNVARS, streaminqnvars, INT) + +/* STREAM var I/O routines (random access) */ + +static void streamWriteVar_fwrap(int streamID, int varID, const double data[], int nmiss) +{ + streamWriteVar(streamID, varID, data, (SizeType)nmiss); +} +FCALLSCSUB4 (streamWriteVar_fwrap, STREAMWRITEVAR, streamwritevar, INT, INT, DOUBLEV, INT) +static void streamWriteVarF_fwrap(int streamID, int varID, const float data[], int nmiss) +{ + streamWriteVarF(streamID, varID, data, (SizeType)nmiss); +} +FCALLSCSUB4 (streamWriteVarF_fwrap, STREAMWRITEVARF, streamwritevarf, INT, INT, FLOATV, INT) +static void streamReadVar_fwrap(int streamID, int varID, double data[], int *nmiss) +{ + SizeType nmiss_SizeType; + streamReadVar(streamID, varID, data, &nmiss_SizeType); + assert(nmiss_SizeType < INT_MAX); + *nmiss = nmiss_SizeType; +} +FCALLSCSUB4 (streamReadVar_fwrap, STREAMREADVAR, streamreadvar, INT, INT, DOUBLEV, PINT) +static void streamReadVarF_fwrap(int streamID, int varID, float data[], int *nmiss) +{ + SizeType nmiss_SizeType; + streamReadVarF(streamID, varID, data, &nmiss_SizeType); + assert(nmiss_SizeType < INT_MAX); + *nmiss = nmiss_SizeType; +} +FCALLSCSUB4 (streamReadVarF_fwrap, STREAMREADVARF, streamreadvarf, INT, INT, FLOATV, PINT) +static void streamWriteVarSlice_fwrap(int streamID, int varID, int levelID, const double data[], int nmiss) +{ + streamWriteVarSlice(streamID, varID, levelID, data, (SizeType)nmiss); +} +FCALLSCSUB5 (streamWriteVarSlice_fwrap, STREAMWRITEVARSLICE, streamwritevarslice, INT, INT, INT, DOUBLEV, INT) +static void streamWriteVarSliceF_fwrap(int streamID, int varID, int levelID, const float data[], int nmiss) +{ + streamWriteVarSliceF(streamID, varID, levelID, data, (SizeType)nmiss); +} +FCALLSCSUB5 (streamWriteVarSliceF_fwrap, STREAMWRITEVARSLICEF, streamwritevarslicef, INT, INT, INT, FLOATV, INT) +static void streamReadVarSlice_fwrap(int streamID, int varID, int levelID, double data[], int *nmiss) +{ + SizeType nmiss_SizeType; + streamReadVarSlice(streamID, varID, levelID, data, &nmiss_SizeType); + assert(nmiss_SizeType < INT_MAX); + *nmiss = nmiss_SizeType; +} +FCALLSCSUB5 (streamReadVarSlice_fwrap, STREAMREADVARSLICE, streamreadvarslice, INT, INT, INT, DOUBLEV, PINT) +static void streamReadVarSliceF_fwrap(int streamID, int varID, int levelID, float data[], int *nmiss) +{ + SizeType nmiss_SizeType; + streamReadVarSliceF(streamID, varID, levelID, data, &nmiss_SizeType); + assert(nmiss_SizeType < INT_MAX); + *nmiss = nmiss_SizeType; +} +FCALLSCSUB5 (streamReadVarSliceF_fwrap, STREAMREADVARSLICEF, streamreadvarslicef, INT, INT, INT, FLOATV, PINT) +static void streamWriteVarChunk_fwrap(int streamID, int varID, const int rect[][2], const double data[], int nmiss) +{ + streamWriteVarChunk(streamID, varID, rect, data, (SizeType)nmiss); +} +FCALLSCSUB5 (streamWriteVarChunk_fwrap, STREAMWRITEVARCHUNK, streamwritevarchunk, INT, INT, INTVV, DOUBLEV, INT) +static void streamWriteVarChunkF_fwrap(int streamID, int varID, const int rect[][2], const float data[], int nmiss) +{ + streamWriteVarChunkF(streamID, varID, rect, data, (SizeType)nmiss); +} +FCALLSCSUB5 (streamWriteVarChunkF_fwrap, STREAMWRITEVARCHUNKF, streamwritevarchunkf, INT, INT, INTVV, FLOATV, INT) + +/* STREAM record I/O routines (sequential access) */ + +FCALLSCSUB3 (streamDefRecord, STREAMDEFRECORD, streamdefrecord, INT, INT, INT) +FCALLSCSUB3 (streamInqRecord, STREAMINQRECORD, streaminqrecord, INT, PINT, PINT) +static void streamWriteRecord_fwrap(int streamID, const double data[], int nmiss) +{ + streamWriteRecord(streamID, data, (SizeType)nmiss); +} +FCALLSCSUB3 (streamWriteRecord_fwrap, STREAMWRITERECORD, streamwriterecord, INT, DOUBLEV, INT) +static void streamWriteRecordF_fwrap(int streamID, const float data[], int nmiss) +{ + streamWriteRecordF(streamID, data, (SizeType)nmiss); +} +FCALLSCSUB3 (streamWriteRecordF_fwrap, STREAMWRITERECORDF, streamwriterecordf, INT, FLOATV, INT) +static void streamReadRecord_fwrap(int streamID, double data[], int *nmiss) +{ + SizeType nmiss_SizeType; + streamReadRecord(streamID, data, &nmiss_SizeType); + assert(nmiss_SizeType < INT_MAX); + *nmiss = nmiss_SizeType; +} +FCALLSCSUB3 (streamReadRecord_fwrap, STREAMREADRECORD, streamreadrecord, INT, DOUBLEV, PINT) +static void streamReadRecordF_fwrap(int streamID, float data[], int *nmiss) +{ + SizeType nmiss_SizeType; + streamReadRecordF(streamID, data, &nmiss_SizeType); + assert(nmiss_SizeType < INT_MAX); + *nmiss = nmiss_SizeType; +} +FCALLSCSUB3 (streamReadRecordF_fwrap, STREAMREADRECORDF, streamreadrecordf, INT, FLOATV, PINT) +FCALLSCSUB2 (streamCopyRecord, STREAMCOPYRECORD, streamcopyrecord, INT, INT) + +/* File driven I/O (may yield better performance than using the streamXXX functions) */ + + +/* Creation & Destruction */ + + +/* Advancing an iterator */ + + +/* Introspecting metadata */ + + +/* All outXXX arguments to these functions may be NULL. */ + + +/* Reading data */ + + +/* TODO[NH]: Add functions to read partial fields. */ + + +/* Direct access to grib fields */ + + +/* Callthroughs to GRIB-API */ + + +/* Convenience functions for accessing GRIB-API keys */ + + +/* VLIST routines */ + +FCALLSCFUN0 (INT, vlistCreate, VLISTCREATE, vlistcreate) +FCALLSCSUB1 (vlistDestroy, VLISTDESTROY, vlistdestroy, INT) +FCALLSCFUN1 (INT, vlistDuplicate, VLISTDUPLICATE, vlistduplicate, INT) +FCALLSCSUB2 (vlistCopy, VLISTCOPY, vlistcopy, INT, INT) +FCALLSCSUB2 (vlistCopyFlag, VLISTCOPYFLAG, vlistcopyflag, INT, INT) +FCALLSCSUB1 (vlistClearFlag, VLISTCLEARFLAG, vlistclearflag, INT) +FCALLSCSUB2 (vlistCat, VLISTCAT, vlistcat, INT, INT) +FCALLSCSUB2 (vlistMerge, VLISTMERGE, vlistmerge, INT, INT) +FCALLSCSUB1 (vlistPrint, VLISTPRINT, vlistprint, INT) +FCALLSCFUN1 (INT, vlistNumber, VLISTNUMBER, vlistnumber, INT) +FCALLSCFUN1 (INT, vlistNvars, VLISTNVARS, vlistnvars, INT) +FCALLSCFUN1 (INT, vlistNgrids, VLISTNGRIDS, vlistngrids, INT) +FCALLSCFUN1 (INT, vlistNzaxis, VLISTNZAXIS, vlistnzaxis, INT) +FCALLSCFUN1 (INT, vlistNsubtypes, VLISTNSUBTYPES, vlistnsubtypes, INT) +FCALLSCSUB2 (vlistDefNtsteps, VLISTDEFNTSTEPS, vlistdefntsteps, INT, INT) +FCALLSCFUN1 (INT, vlistNtsteps, VLISTNTSTEPS, vlistntsteps, INT) +static int vlistGridsizeMax_fwrap(int vlistID) +{ + SizeType v; + v = vlistGridsizeMax(vlistID); + return SizeType_c2f(v); +} +FCALLSCFUN1 (INT, vlistGridsizeMax_fwrap, VLISTGRIDSIZEMAX, vlistgridsizemax, INT) +FCALLSCFUN2 (INT, vlistGrid, VLISTGRID, vlistgrid, INT, INT) +FCALLSCFUN2 (INT, vlistGridIndex, VLISTGRIDINDEX, vlistgridindex, INT, INT) +FCALLSCSUB3 (vlistChangeGridIndex, VLISTCHANGEGRIDINDEX, vlistchangegridindex, INT, INT, INT) +FCALLSCSUB3 (vlistChangeGrid, VLISTCHANGEGRID, vlistchangegrid, INT, INT, INT) +FCALLSCFUN2 (INT, vlistZaxis, VLISTZAXIS, vlistzaxis, INT, INT) +FCALLSCFUN2 (INT, vlistZaxisIndex, VLISTZAXISINDEX, vlistzaxisindex, INT, INT) +FCALLSCSUB3 (vlistChangeZaxisIndex, VLISTCHANGEZAXISINDEX, vlistchangezaxisindex, INT, INT, INT) +FCALLSCSUB3 (vlistChangeZaxis, VLISTCHANGEZAXIS, vlistchangezaxis, INT, INT, INT) +FCALLSCFUN1 (INT, vlistNrecs, VLISTNRECS, vlistnrecs, INT) +FCALLSCFUN2 (INT, vlistSubtype, VLISTSUBTYPE, vlistsubtype, INT, INT) +FCALLSCFUN2 (INT, vlistSubtypeIndex, VLISTSUBTYPEINDEX, vlistsubtypeindex, INT, INT) +FCALLSCSUB2 (vlistDefTaxis, VLISTDEFTAXIS, vlistdeftaxis, INT, INT) +FCALLSCFUN1 (INT, vlistInqTaxis, VLISTINQTAXIS, vlistinqtaxis, INT) +FCALLSCSUB2 (vlistDefTable, VLISTDEFTABLE, vlistdeftable, INT, INT) +FCALLSCFUN1 (INT, vlistInqTable, VLISTINQTABLE, vlistinqtable, INT) +FCALLSCSUB2 (vlistDefInstitut, VLISTDEFINSTITUT, vlistdefinstitut, INT, INT) +FCALLSCFUN1 (INT, vlistInqInstitut, VLISTINQINSTITUT, vlistinqinstitut, INT) +FCALLSCSUB2 (vlistDefModel, VLISTDEFMODEL, vlistdefmodel, INT, INT) +FCALLSCFUN1 (INT, vlistInqModel, VLISTINQMODEL, vlistinqmodel, INT) + +/* VLIST VAR routines */ + +FCALLSCFUN5 (INT, vlistDefVarTiles, VLISTDEFVARTILES, vlistdefvartiles, INT, INT, INT, INT, INT) +FCALLSCFUN4 (INT, vlistDefVar, VLISTDEFVAR, vlistdefvar, INT, INT, INT, INT) +FCALLSCSUB3 (vlistChangeVarGrid, VLISTCHANGEVARGRID, vlistchangevargrid, INT, INT, INT) +FCALLSCSUB3 (vlistChangeVarZaxis, VLISTCHANGEVARZAXIS, vlistchangevarzaxis, INT, INT, INT) +FCALLSCSUB5 (vlistInqVar, VLISTINQVAR, vlistinqvar, INT, INT, PINT, PINT, PINT) +FCALLSCFUN2 (INT, vlistInqVarGrid, VLISTINQVARGRID, vlistinqvargrid, INT, INT) +FCALLSCFUN2 (INT, vlistInqVarZaxis, VLISTINQVARZAXIS, vlistinqvarzaxis, INT, INT) + +/* used in MPIOM */ + +FCALLSCFUN2 (INT, vlistInqVarID, VLISTINQVARID, vlistinqvarid, INT, INT) +FCALLSCSUB3 (vlistDefVarTimetype, VLISTDEFVARTIMETYPE, vlistdefvartimetype, INT, INT, INT) +FCALLSCFUN2 (INT, vlistInqVarTimetype, VLISTINQVARTIMETYPE, vlistinqvartimetype, INT, INT) +FCALLSCSUB3 (vlistDefVarTsteptype, VLISTDEFVARTSTEPTYPE, vlistdefvartsteptype, INT, INT, INT) +FCALLSCFUN2 (INT, vlistInqVarTsteptype, VLISTINQVARTSTEPTYPE, vlistinqvartsteptype, INT, INT) +FCALLSCSUB3 (vlistDefVarCompType, VLISTDEFVARCOMPTYPE, vlistdefvarcomptype, INT, INT, INT) +FCALLSCFUN2 (INT, vlistInqVarCompType, VLISTINQVARCOMPTYPE, vlistinqvarcomptype, INT, INT) +FCALLSCSUB3 (vlistDefVarCompLevel, VLISTDEFVARCOMPLEVEL, vlistdefvarcomplevel, INT, INT, INT) +FCALLSCFUN2 (INT, vlistInqVarCompLevel, VLISTINQVARCOMPLEVEL, vlistinqvarcomplevel, INT, INT) +FCALLSCSUB3 (vlistDefVarParam, VLISTDEFVARPARAM, vlistdefvarparam, INT, INT, INT) +FCALLSCFUN2 (INT, vlistInqVarParam, VLISTINQVARPARAM, vlistinqvarparam, INT, INT) +FCALLSCSUB3 (vlistDefVarCode, VLISTDEFVARCODE, vlistdefvarcode, INT, INT, INT) +FCALLSCFUN2 (INT, vlistInqVarCode, VLISTINQVARCODE, vlistinqvarcode, INT, INT) +FCALLSCSUB3 (vlistDefVarDatatype, VLISTDEFVARDATATYPE, vlistdefvardatatype, INT, INT, INT) +FCALLSCFUN2 (INT, vlistInqVarDatatype, VLISTINQVARDATATYPE, vlistinqvardatatype, INT, INT) +FCALLSCSUB3 (vlistDefVarXYZ, VLISTDEFVARXYZ, vlistdefvarxyz, INT, INT, INT) +FCALLSCFUN2 (INT, vlistInqVarXYZ, VLISTINQVARXYZ, vlistinqvarxyz, INT, INT) +FCALLSCSUB3 (vlistDefVarNSB, VLISTDEFVARNSB, vlistdefvarnsb, INT, INT, INT) +FCALLSCFUN2 (INT, vlistInqVarNSB, VLISTINQVARNSB, vlistinqvarnsb, INT, INT) +FCALLSCFUN2 (INT, vlistInqVarNumber, VLISTINQVARNUMBER, vlistinqvarnumber, INT, INT) +FCALLSCSUB3 (vlistDefVarInstitut, VLISTDEFVARINSTITUT, vlistdefvarinstitut, INT, INT, INT) +FCALLSCFUN2 (INT, vlistInqVarInstitut, VLISTINQVARINSTITUT, vlistinqvarinstitut, INT, INT) +FCALLSCSUB3 (vlistDefVarModel, VLISTDEFVARMODEL, vlistdefvarmodel, INT, INT, INT) +FCALLSCFUN2 (INT, vlistInqVarModel, VLISTINQVARMODEL, vlistinqvarmodel, INT, INT) +FCALLSCSUB3 (vlistDefVarTable, VLISTDEFVARTABLE, vlistdefvartable, INT, INT, INT) +FCALLSCFUN2 (INT, vlistInqVarTable, VLISTINQVARTABLE, vlistinqvartable, INT, INT) +FCALLSCSUB3 (vlistDefVarName, VLISTDEFVARNAME, vlistdefvarname, INT, INT, STRING) +FCALLSCSUB3 (vlistInqVarName, VLISTINQVARNAME, vlistinqvarname, INT, INT, PSTRING) +FCALLSCFUN2 (STRING, vlistCopyVarName, VLISTCOPYVARNAME, vlistcopyvarname, INT, INT) +FCALLSCSUB3 (vlistDefVarStdname, VLISTDEFVARSTDNAME, vlistdefvarstdname, INT, INT, STRING) +FCALLSCSUB3 (vlistInqVarStdname, VLISTINQVARSTDNAME, vlistinqvarstdname, INT, INT, PSTRING) +FCALLSCSUB3 (vlistDefVarLongname, VLISTDEFVARLONGNAME, vlistdefvarlongname, INT, INT, STRING) +FCALLSCSUB3 (vlistInqVarLongname, VLISTINQVARLONGNAME, vlistinqvarlongname, INT, INT, PSTRING) +FCALLSCSUB3 (vlistDefVarUnits, VLISTDEFVARUNITS, vlistdefvarunits, INT, INT, STRING) +FCALLSCSUB3 (vlistInqVarUnits, VLISTINQVARUNITS, vlistinqvarunits, INT, INT, PSTRING) +FCALLSCSUB3 (vlistDefVarMissval, VLISTDEFVARMISSVAL, vlistdefvarmissval, INT, INT, DOUBLE) +FCALLSCFUN2 (DOUBLE, vlistInqVarMissval, VLISTINQVARMISSVAL, vlistinqvarmissval, INT, INT) +static int vlistInqVarSize_fwrap(int vlistID, int varID) +{ + SizeType v; + v = vlistInqVarSize(vlistID, varID); + return SizeType_c2f(v); +} +FCALLSCFUN2 (INT, vlistInqVarSize_fwrap, VLISTINQVARSIZE, vlistinqvarsize, INT, INT) +FCALLSCSUB4 (vlistDefIndex, VLISTDEFINDEX, vlistdefindex, INT, INT, INT, INT) +FCALLSCFUN3 (INT, vlistInqIndex, VLISTINQINDEX, vlistinqindex, INT, INT, INT) +FCALLSCSUB4 (vlistDefFlag, VLISTDEFFLAG, vlistdefflag, INT, INT, INT, INT) +FCALLSCFUN3 (INT, vlistInqFlag, VLISTINQFLAG, vlistinqflag, INT, INT, INT) +FCALLSCFUN2 (INT, vlistFindVar, VLISTFINDVAR, vlistfindvar, INT, INT) +FCALLSCFUN3 (INT, vlistFindLevel, VLISTFINDLEVEL, vlistfindlevel, INT, INT, INT) +FCALLSCFUN2 (INT, vlistMergedVar, VLISTMERGEDVAR, vlistmergedvar, INT, INT) +FCALLSCFUN3 (INT, vlistMergedLevel, VLISTMERGEDLEVEL, vlistmergedlevel, INT, INT, INT) +FCALLSCSUB0 (cdiClearAdditionalKeys, CDICLEARADDITIONALKEYS, cdiclearadditionalkeys) +FCALLSCSUB1 (cdiDefAdditionalKey, CDIDEFADDITIONALKEY, cdidefadditionalkey, STRING) +FCALLSCSUB4 (vlistDefVarIntKey, VLISTDEFVARINTKEY, vlistdefvarintkey, INT, INT, STRING, INT) +FCALLSCSUB4 (vlistDefVarDblKey, VLISTDEFVARDBLKEY, vlistdefvardblkey, INT, INT, STRING, DOUBLE) +FCALLSCFUN3 (INT, vlistHasVarKey, VLISTHASVARKEY, vlisthasvarkey, INT, INT, STRING) +FCALLSCFUN3 (DOUBLE, vlistInqVarDblKey, VLISTINQVARDBLKEY, vlistinqvardblkey, INT, INT, STRING) +FCALLSCFUN3 (INT, vlistInqVarIntKey, VLISTINQVARINTKEY, vlistinqvarintkey, INT, INT, STRING) + +/* CDI attributes */ + +FCALLSCFUN3 (INT, cdiInqNatts, CDIINQNATTS, cdiinqnatts, INT, INT, PINT) +FCALLSCFUN6 (INT, cdiInqAtt, CDIINQATT, cdiinqatt, INT, INT, INT, PSTRING, PINT, PINT) +FCALLSCFUN3 (INT, cdiInqAttLen, CDIINQATTLEN, cdiinqattlen, INT, INT, STRING) +FCALLSCFUN3 (INT, cdiInqAttType, CDIINQATTTYPE, cdiinqatttype, INT, INT, STRING) +FCALLSCFUN3 (INT, cdiDelAtt, CDIDELATT, cdidelatt, INT, INT, STRING) +FCALLSCFUN4 (INT, cdiCopyAtts, CDICOPYATTS, cdicopyatts, INT, INT, INT, INT) +FCALLSCFUN6 (INT, cdiDefAttInt, CDIDEFATTINT, cdidefattint, INT, INT, STRING, INT, INT, INTV) +FCALLSCFUN6 (INT, cdiDefAttFlt, CDIDEFATTFLT, cdidefattflt, INT, INT, STRING, INT, INT, DOUBLEV) +FCALLSCFUN5 (INT, cdiDefAttTxt, CDIDEFATTTXT, cdidefatttxt, INT, INT, STRING, INT, PPSTRING) +FCALLSCFUN5 (INT, cdiInqAttInt, CDIINQATTINT, cdiinqattint, INT, INT, STRING, INT, INTV) +FCALLSCFUN5 (INT, cdiInqAttFlt, CDIINQATTFLT, cdiinqattflt, INT, INT, STRING, INT, DOUBLEV) +FCALLSCFUN5 (INT, cdiInqAttTxt, CDIINQATTTXT, cdiinqatttxt, INT, INT, STRING, INT, PPSTRING) + +/* GRID routines */ + +FCALLSCSUB2 (gridName, GRIDNAME, gridname, INT, PSTRING) +FCALLSCFUN1 (STRING, gridNamePtr, GRIDNAMEPTR, gridnameptr, INT) +FCALLSCSUB1 (gridCompress, GRIDCOMPRESS, gridcompress, INT) +FCALLSCSUB2 (gridDefMaskGME, GRIDDEFMASKGME, griddefmaskgme, INT, INTV) +FCALLSCFUN2 (INT, gridInqMaskGME, GRIDINQMASKGME, gridinqmaskgme, INT, INTV) +FCALLSCSUB2 (gridDefMask, GRIDDEFMASK, griddefmask, INT, INTV) +FCALLSCFUN2 (INT, gridInqMask, GRIDINQMASK, gridinqmask, INT, INTV) +static int gridCreate_fwrap(int gridtype, int size) +{ + int v; + v = gridCreate(gridtype, (SizeType)size); + return v; +} +FCALLSCFUN2 (INT, gridCreate_fwrap, GRIDCREATE, gridcreate, INT, INT) +FCALLSCSUB1 (gridDestroy, GRIDDESTROY, griddestroy, INT) +FCALLSCFUN1 (INT, gridDuplicate, GRIDDUPLICATE, gridduplicate, INT) +FCALLSCSUB2 (gridDefProj, GRIDDEFPROJ, griddefproj, INT, INT) +FCALLSCFUN1 (INT, gridInqProj, GRIDINQPROJ, gridinqproj, INT) +FCALLSCFUN1 (INT, gridInqProjType, GRIDINQPROJTYPE, gridinqprojtype, INT) +FCALLSCFUN1 (INT, gridInqType, GRIDINQTYPE, gridinqtype, INT) +static int gridInqSize_fwrap(int gridID) +{ + SizeType v; + v = gridInqSize(gridID); + return SizeType_c2f(v); +} +FCALLSCFUN1 (INT, gridInqSize_fwrap, GRIDINQSIZE, gridinqsize, INT) +static void gridDefXsize_fwrap(int gridID, int xsize) +{ + gridDefXsize(gridID, (SizeType)xsize); +} +FCALLSCSUB2 (gridDefXsize_fwrap, GRIDDEFXSIZE, griddefxsize, INT, INT) +static int gridInqXsize_fwrap(int gridID) +{ + SizeType v; + v = gridInqXsize(gridID); + return SizeType_c2f(v); +} +FCALLSCFUN1 (INT, gridInqXsize_fwrap, GRIDINQXSIZE, gridinqxsize, INT) +static void gridDefYsize_fwrap(int gridID, int ysize) +{ + gridDefYsize(gridID, (SizeType)ysize); +} +FCALLSCSUB2 (gridDefYsize_fwrap, GRIDDEFYSIZE, griddefysize, INT, INT) +static int gridInqYsize_fwrap(int gridID) +{ + SizeType v; + v = gridInqYsize(gridID); + return SizeType_c2f(v); +} +FCALLSCFUN1 (INT, gridInqYsize_fwrap, GRIDINQYSIZE, gridinqysize, INT) +FCALLSCSUB2 (gridDefNP, GRIDDEFNP, griddefnp, INT, INT) +FCALLSCFUN1 (INT, gridInqNP, GRIDINQNP, gridinqnp, INT) +FCALLSCSUB2 (gridDefXvals, GRIDDEFXVALS, griddefxvals, INT, DOUBLEV) +static int gridInqXvals_fwrap(int gridID, double xvals[]) +{ + SizeType v; + v = gridInqXvals(gridID, xvals); + return SizeType_c2f(v); +} +FCALLSCFUN2 (INT, gridInqXvals_fwrap, GRIDINQXVALS, gridinqxvals, INT, DOUBLEV) +static int gridInqXvalsPart_fwrap(int gridID, int start, int size, double xvals[]) +{ + SizeType v; + v = gridInqXvalsPart(gridID, start, (SizeType)size, xvals); + return SizeType_c2f(v); +} +FCALLSCFUN4 (INT, gridInqXvalsPart_fwrap, GRIDINQXVALSPART, gridinqxvalspart, INT, INT, INT, DOUBLEV) +FCALLSCFUN1 (INT, gridInqXIsc, GRIDINQXISC, gridinqxisc, INT) +FCALLSCSUB2 (gridDefYvals, GRIDDEFYVALS, griddefyvals, INT, DOUBLEV) +static int gridInqYvals_fwrap(int gridID, double yvals[]) +{ + SizeType v; + v = gridInqYvals(gridID, yvals); + return SizeType_c2f(v); +} +FCALLSCFUN2 (INT, gridInqYvals_fwrap, GRIDINQYVALS, gridinqyvals, INT, DOUBLEV) +static int gridInqYvalsPart_fwrap(int gridID, int start, int size, double yvals[]) +{ + SizeType v; + v = gridInqYvalsPart(gridID, start, (SizeType)size, yvals); + return SizeType_c2f(v); +} +FCALLSCFUN4 (INT, gridInqYvalsPart_fwrap, GRIDINQYVALSPART, gridinqyvalspart, INT, INT, INT, DOUBLEV) +FCALLSCFUN1 (INT, gridInqYIsc, GRIDINQYISC, gridinqyisc, INT) + +/* CDI var keys */ + + +/* String keys */ + + +/* Integer keys */ + + +/* Floating point keys */ + + +/* Byte array keys */ + +FCALLSCFUN4 (INT, cdiDefKeyInt, CDIDEFKEYINT, cdidefkeyint, INT, INT, INT, INT) +FCALLSCFUN4 (INT, cdiInqKeyInt, CDIINQKEYINT, cdiinqkeyint, INT, INT, INT, PINT) +FCALLSCFUN4 (INT, cdiDefKeyFloat, CDIDEFKEYFLOAT, cdidefkeyfloat, INT, INT, INT, DOUBLE) + +/* cdiInqKeyFloat Get a float value from a key */ + +FCALLSCFUN4 (INT, cdiInqKeyFloat, CDIINQKEYFLOAT, cdiinqkeyfloat, INT, INT, INT, PDOUBLE) +FCALLSCFUN4 (INT, cdiDefKeyString, CDIDEFKEYSTRING, cdidefkeystring, INT, INT, INT, STRING) +FCALLSCFUN5 (INT, cdiInqKeyString, CDIINQKEYSTRING, cdiinqkeystring, INT, INT, INT, PSTRING, PINT) +FCALLSCFUN4 (INT, cdiInqKeyLen, CDIINQKEYLEN, cdiinqkeylen, INT, INT, INT, PINT) +FCALLSCFUN4 (INT, cdiCopyKeys, CDICOPYKEYS, cdicopykeys, INT, INT, INT, INT) +FCALLSCFUN4 (INT, cdiCopyKey, CDICOPYKEY, cdicopykey, INT, INT, INT, INT) +FCALLSCFUN3 (INT, cdiDeleteKey, CDIDELETEKEY, cdideletekey, INT, INT, INT) + +/* GRID routines */ + +FCALLSCSUB2 (gridDefXname, GRIDDEFXNAME, griddefxname, INT, STRING) +FCALLSCSUB2 (gridInqXname, GRIDINQXNAME, gridinqxname, INT, PSTRING) +FCALLSCSUB2 (gridDefXlongname, GRIDDEFXLONGNAME, griddefxlongname, INT, STRING) +FCALLSCSUB2 (gridInqXlongname, GRIDINQXLONGNAME, gridinqxlongname, INT, PSTRING) +FCALLSCSUB2 (gridDefXunits, GRIDDEFXUNITS, griddefxunits, INT, STRING) +FCALLSCSUB2 (gridInqXunits, GRIDINQXUNITS, gridinqxunits, INT, PSTRING) +FCALLSCSUB2 (gridDefYname, GRIDDEFYNAME, griddefyname, INT, STRING) +FCALLSCSUB2 (gridInqYname, GRIDINQYNAME, gridinqyname, INT, PSTRING) +FCALLSCSUB2 (gridDefYlongname, GRIDDEFYLONGNAME, griddefylongname, INT, STRING) +FCALLSCSUB2 (gridInqYlongname, GRIDINQYLONGNAME, gridinqylongname, INT, PSTRING) +FCALLSCSUB2 (gridDefYunits, GRIDDEFYUNITS, griddefyunits, INT, STRING) +FCALLSCSUB2 (gridInqYunits, GRIDINQYUNITS, gridinqyunits, INT, PSTRING) +FCALLSCSUB2 (gridDefDatatype, GRIDDEFDATATYPE, griddefdatatype, INT, INT) +FCALLSCFUN1 (INT, gridInqDatatype, GRIDINQDATATYPE, gridinqdatatype, INT) +static double gridInqXval_fwrap(int gridID, int index) +{ + double v; + v = gridInqXval(gridID, (SizeType)index); + return v; +} +FCALLSCFUN2 (DOUBLE, gridInqXval_fwrap, GRIDINQXVAL, gridinqxval, INT, INT) +static double gridInqYval_fwrap(int gridID, int index) +{ + double v; + v = gridInqYval(gridID, (SizeType)index); + return v; +} +FCALLSCFUN2 (DOUBLE, gridInqYval_fwrap, GRIDINQYVAL, gridinqyval, INT, INT) +FCALLSCFUN1 (DOUBLE, gridInqXinc, GRIDINQXINC, gridinqxinc, INT) +FCALLSCFUN1 (DOUBLE, gridInqYinc, GRIDINQYINC, gridinqyinc, INT) +FCALLSCFUN1 (INT, gridIsCircular, GRIDISCIRCULAR, gridiscircular, INT) +FCALLSCFUN1 (INT, gridInqTrunc, GRIDINQTRUNC, gridinqtrunc, INT) +FCALLSCSUB2 (gridDefTrunc, GRIDDEFTRUNC, griddeftrunc, INT, INT) + +/* Reference of an unstructured grid */ + +FCALLSCSUB2 (gridDefNumber, GRIDDEFNUMBER, griddefnumber, INT, INT) +FCALLSCFUN1 (INT, gridInqNumber, GRIDINQNUMBER, gridinqnumber, INT) +FCALLSCSUB2 (gridDefPosition, GRIDDEFPOSITION, griddefposition, INT, INT) +FCALLSCFUN1 (INT, gridInqPosition, GRIDINQPOSITION, gridinqposition, INT) +FCALLSCSUB2 (gridDefReference, GRIDDEFREFERENCE, griddefreference, INT, STRING) +FCALLSCFUN2 (INT, gridInqReference, GRIDINQREFERENCE, gridinqreference, INT, PSTRING) +FCALLSCSUB2 (gridDefUUID, GRIDDEFUUID, griddefuuid, INT, PVOID) +FCALLSCSUB2 (gridInqUUID, GRIDINQUUID, gridinquuid, INT, PVOID) + +/* Rotated Lon/Lat grid */ + +FCALLSCSUB4 (gridDefParamRLL, GRIDDEFPARAMRLL, griddefparamrll, INT, DOUBLE, DOUBLE, DOUBLE) +FCALLSCSUB4 (gridInqParamRLL, GRIDINQPARAMRLL, gridinqparamrll, INT, PDOUBLE, PDOUBLE, PDOUBLE) + +/* Hexagonal GME grid */ + +FCALLSCSUB5 (gridDefParamGME, GRIDDEFPARAMGME, griddefparamgme, INT, INT, INT, INT, INT) +FCALLSCSUB5 (gridInqParamGME, GRIDINQPARAMGME, gridinqparamgme, INT, PINT, PINT, PINT, PINT) +FCALLSCSUB2 (gridDefArea, GRIDDEFAREA, griddefarea, INT, DOUBLEV) +FCALLSCSUB2 (gridInqArea, GRIDINQAREA, gridinqarea, INT, DOUBLEV) +FCALLSCFUN1 (INT, gridHasArea, GRIDHASAREA, gridhasarea, INT) +FCALLSCSUB2 (gridDefNvertex, GRIDDEFNVERTEX, griddefnvertex, INT, INT) +FCALLSCFUN1 (INT, gridInqNvertex, GRIDINQNVERTEX, gridinqnvertex, INT) +FCALLSCSUB2 (gridDefXbounds, GRIDDEFXBOUNDS, griddefxbounds, INT, DOUBLEV) +static int gridInqXbounds_fwrap(int gridID, double xbounds[]) +{ + SizeType v; + v = gridInqXbounds(gridID, xbounds); + return SizeType_c2f(v); +} +FCALLSCFUN2 (INT, gridInqXbounds_fwrap, GRIDINQXBOUNDS, gridinqxbounds, INT, DOUBLEV) +static int gridInqXboundsPart_fwrap(int gridID, int start, int size, double xbounds[]) +{ + SizeType v; + v = gridInqXboundsPart(gridID, start, (SizeType)size, xbounds); + return SizeType_c2f(v); +} +FCALLSCFUN4 (INT, gridInqXboundsPart_fwrap, GRIDINQXBOUNDSPART, gridinqxboundspart, INT, INT, INT, DOUBLEV) +FCALLSCSUB2 (gridDefYbounds, GRIDDEFYBOUNDS, griddefybounds, INT, DOUBLEV) +static int gridInqYbounds_fwrap(int gridID, double ybounds[]) +{ + SizeType v; + v = gridInqYbounds(gridID, ybounds); + return SizeType_c2f(v); +} +FCALLSCFUN2 (INT, gridInqYbounds_fwrap, GRIDINQYBOUNDS, gridinqybounds, INT, DOUBLEV) +static int gridInqYboundsPart_fwrap(int gridID, int start, int size, double ybounds[]) +{ + SizeType v; + v = gridInqYboundsPart(gridID, start, (SizeType)size, ybounds); + return SizeType_c2f(v); +} +FCALLSCFUN4 (INT, gridInqYboundsPart_fwrap, GRIDINQYBOUNDSPART, gridinqyboundspart, INT, INT, INT, DOUBLEV) +FCALLSCSUB3 (gridDefReducedPoints, GRIDDEFREDUCEDPOINTS, griddefreducedpoints, INT, INT, INTV) +FCALLSCSUB2 (gridInqReducedPoints, GRIDINQREDUCEDPOINTS, gridinqreducedpoints, INT, INTV) +FCALLSCSUB2 (gridChangeType, GRIDCHANGETYPE, gridchangetype, INT, INT) +FCALLSCSUB2 (gridDefComplexPacking, GRIDDEFCOMPLEXPACKING, griddefcomplexpacking, INT, INT) +FCALLSCFUN1 (INT, gridInqComplexPacking, GRIDINQCOMPLEXPACKING, gridinqcomplexpacking, INT) + +/* ZAXIS routines */ + +FCALLSCSUB2 (zaxisName, ZAXISNAME, zaxisname, INT, PSTRING) +FCALLSCFUN1 (STRING, zaxisNamePtr, ZAXISNAMEPTR, zaxisnameptr, INT) +FCALLSCFUN2 (INT, zaxisCreate, ZAXISCREATE, zaxiscreate, INT, INT) +FCALLSCSUB1 (zaxisDestroy, ZAXISDESTROY, zaxisdestroy, INT) +FCALLSCFUN1 (INT, zaxisInqType, ZAXISINQTYPE, zaxisinqtype, INT) +FCALLSCFUN1 (INT, zaxisInqSize, ZAXISINQSIZE, zaxisinqsize, INT) +FCALLSCFUN1 (INT, zaxisDuplicate, ZAXISDUPLICATE, zaxisduplicate, INT) +FCALLSCSUB2 (zaxisDefLevels, ZAXISDEFLEVELS, zaxisdeflevels, INT, DOUBLEV) +FCALLSCFUN2 (INT, zaxisInqLevels, ZAXISINQLEVELS, zaxisinqlevels, INT, DOUBLEV) +FCALLSCFUN1 (INT, zaxisInqCLen, ZAXISINQCLEN, zaxisinqclen, INT) +FCALLSCSUB3 (zaxisDefLevel, ZAXISDEFLEVEL, zaxisdeflevel, INT, INT, DOUBLE) +FCALLSCFUN2 (DOUBLE, zaxisInqLevel, ZAXISINQLEVEL, zaxisinqlevel, INT, INT) +FCALLSCSUB2 (zaxisDefNlevRef, ZAXISDEFNLEVREF, zaxisdefnlevref, INT, INT) +FCALLSCFUN1 (INT, zaxisInqNlevRef, ZAXISINQNLEVREF, zaxisinqnlevref, INT) +FCALLSCSUB2 (zaxisDefNumber, ZAXISDEFNUMBER, zaxisdefnumber, INT, INT) +FCALLSCFUN1 (INT, zaxisInqNumber, ZAXISINQNUMBER, zaxisinqnumber, INT) +FCALLSCSUB2 (zaxisDefUUID, ZAXISDEFUUID, zaxisdefuuid, INT, PVOID) +FCALLSCSUB2 (zaxisInqUUID, ZAXISINQUUID, zaxisinquuid, INT, PVOID) +FCALLSCSUB2 (zaxisDefName, ZAXISDEFNAME, zaxisdefname, INT, STRING) +FCALLSCSUB2 (zaxisInqName, ZAXISINQNAME, zaxisinqname, INT, PSTRING) +FCALLSCSUB2 (zaxisDefLongname, ZAXISDEFLONGNAME, zaxisdeflongname, INT, STRING) +FCALLSCSUB2 (zaxisInqLongname, ZAXISINQLONGNAME, zaxisinqlongname, INT, PSTRING) +FCALLSCSUB2 (zaxisDefUnits, ZAXISDEFUNITS, zaxisdefunits, INT, STRING) +FCALLSCSUB2 (zaxisInqUnits, ZAXISINQUNITS, zaxisinqunits, INT, PSTRING) +FCALLSCSUB2 (zaxisInqStdname, ZAXISINQSTDNAME, zaxisinqstdname, INT, PSTRING) +FCALLSCSUB2 (zaxisDefDatatype, ZAXISDEFDATATYPE, zaxisdefdatatype, INT, INT) +FCALLSCFUN1 (INT, zaxisInqDatatype, ZAXISINQDATATYPE, zaxisinqdatatype, INT) +FCALLSCSUB2 (zaxisDefPositive, ZAXISDEFPOSITIVE, zaxisdefpositive, INT, INT) +FCALLSCFUN1 (INT, zaxisInqPositive, ZAXISINQPOSITIVE, zaxisinqpositive, INT) +FCALLSCSUB1 (zaxisDefScalar, ZAXISDEFSCALAR, zaxisdefscalar, INT) +FCALLSCFUN1 (INT, zaxisInqScalar, ZAXISINQSCALAR, zaxisinqscalar, INT) +FCALLSCSUB3 (zaxisDefVct, ZAXISDEFVCT, zaxisdefvct, INT, INT, DOUBLEV) +FCALLSCSUB2 (zaxisInqVct, ZAXISINQVCT, zaxisinqvct, INT, DOUBLEV) +FCALLSCFUN1 (INT, zaxisInqVctSize, ZAXISINQVCTSIZE, zaxisinqvctsize, INT) +FCALLSCSUB2 (zaxisDefLbounds, ZAXISDEFLBOUNDS, zaxisdeflbounds, INT, DOUBLEV) +FCALLSCFUN2 (INT, zaxisInqLbounds, ZAXISINQLBOUNDS, zaxisinqlbounds, INT, DOUBLEV) +FCALLSCFUN2 (DOUBLE, zaxisInqLbound, ZAXISINQLBOUND, zaxisinqlbound, INT, INT) +FCALLSCSUB2 (zaxisDefUbounds, ZAXISDEFUBOUNDS, zaxisdefubounds, INT, DOUBLEV) +FCALLSCFUN2 (INT, zaxisInqUbounds, ZAXISINQUBOUNDS, zaxisinqubounds, INT, DOUBLEV) +FCALLSCFUN2 (DOUBLE, zaxisInqUbound, ZAXISINQUBOUND, zaxisinqubound, INT, INT) +FCALLSCSUB2 (zaxisDefWeights, ZAXISDEFWEIGHTS, zaxisdefweights, INT, DOUBLEV) +FCALLSCFUN2 (INT, zaxisInqWeights, ZAXISINQWEIGHTS, zaxisinqweights, INT, DOUBLEV) +FCALLSCSUB2 (zaxisChangeType, ZAXISCHANGETYPE, zaxischangetype, INT, INT) + +/* TAXIS routines */ + +FCALLSCFUN1 (INT, taxisCreate, TAXISCREATE, taxiscreate, INT) +FCALLSCSUB1 (taxisDestroy, TAXISDESTROY, taxisdestroy, INT) +FCALLSCFUN1 (INT, taxisDuplicate, TAXISDUPLICATE, taxisduplicate, INT) +FCALLSCSUB2 (taxisCopyTimestep, TAXISCOPYTIMESTEP, taxiscopytimestep, INT, INT) +FCALLSCSUB2 (taxisDefType, TAXISDEFTYPE, taxisdeftype, INT, INT) +FCALLSCFUN1 (INT, taxisInqType, TAXISINQTYPE, taxisinqtype, INT) +FCALLSCSUB2 (taxisDefVdate, TAXISDEFVDATE, taxisdefvdate, INT, INT) +FCALLSCSUB2 (taxisDefVtime, TAXISDEFVTIME, taxisdefvtime, INT, INT) +FCALLSCFUN1 (INT, taxisInqVdate, TAXISINQVDATE, taxisinqvdate, INT) +FCALLSCFUN1 (INT, taxisInqVtime, TAXISINQVTIME, taxisinqvtime, INT) +FCALLSCSUB2 (taxisDefRdate, TAXISDEFRDATE, taxisdefrdate, INT, INT) +FCALLSCSUB2 (taxisDefRtime, TAXISDEFRTIME, taxisdefrtime, INT, INT) +FCALLSCFUN1 (INT, taxisInqRdate, TAXISINQRDATE, taxisinqrdate, INT) +FCALLSCFUN1 (INT, taxisInqRtime, TAXISINQRTIME, taxisinqrtime, INT) +FCALLSCFUN1 (INT, taxisHasBounds, TAXISHASBOUNDS, taxishasbounds, INT) +FCALLSCSUB1 (taxisWithBounds, TAXISWITHBOUNDS, taxiswithbounds, INT) +FCALLSCSUB1 (taxisDeleteBounds, TAXISDELETEBOUNDS, taxisdeletebounds, INT) +FCALLSCSUB3 (taxisDefVdateBounds, TAXISDEFVDATEBOUNDS, taxisdefvdatebounds, INT, INT, INT) +FCALLSCSUB3 (taxisDefVtimeBounds, TAXISDEFVTIMEBOUNDS, taxisdefvtimebounds, INT, INT, INT) +FCALLSCSUB3 (taxisInqVdateBounds, TAXISINQVDATEBOUNDS, taxisinqvdatebounds, INT, PINT, PINT) +FCALLSCSUB3 (taxisInqVtimeBounds, TAXISINQVTIMEBOUNDS, taxisinqvtimebounds, INT, PINT, PINT) +FCALLSCSUB2 (taxisDefCalendar, TAXISDEFCALENDAR, taxisdefcalendar, INT, INT) +FCALLSCFUN1 (INT, taxisInqCalendar, TAXISINQCALENDAR, taxisinqcalendar, INT) +FCALLSCSUB2 (taxisDefTunit, TAXISDEFTUNIT, taxisdeftunit, INT, INT) +FCALLSCFUN1 (INT, taxisInqTunit, TAXISINQTUNIT, taxisinqtunit, INT) +FCALLSCSUB2 (taxisDefForecastTunit, TAXISDEFFORECASTTUNIT, taxisdefforecasttunit, INT, INT) +FCALLSCFUN1 (INT, taxisInqForecastTunit, TAXISINQFORECASTTUNIT, taxisinqforecasttunit, INT) +FCALLSCSUB2 (taxisDefForecastPeriod, TAXISDEFFORECASTPERIOD, taxisdefforecastperiod, INT, DOUBLE) +FCALLSCFUN1 (DOUBLE, taxisInqForecastPeriod, TAXISINQFORECASTPERIOD, taxisinqforecastperiod, INT) +FCALLSCSUB2 (taxisDefNumavg, TAXISDEFNUMAVG, taxisdefnumavg, INT, INT) +FCALLSCFUN1 (INT, taxisInqNumavg, TAXISINQNUMAVG, taxisinqnumavg, INT) +FCALLSCFUN1 (STRING, taxisNamePtr, TAXISNAMEPTR, taxisnameptr, INT) +FCALLSCFUN1 (STRING, tunitNamePtr, TUNITNAMEPTR, tunitnameptr, INT) + +/* Institut routines */ + +FCALLSCFUN4 (INT, institutDef, INSTITUTDEF, institutdef, INT, INT, STRING, STRING) +FCALLSCFUN4 (INT, institutInq, INSTITUTINQ, institutinq, INT, INT, STRING, STRING) +FCALLSCFUN0 (INT, institutInqNumber, INSTITUTINQNUMBER, institutinqnumber) +FCALLSCFUN1 (INT, institutInqCenter, INSTITUTINQCENTER, institutinqcenter, INT) +FCALLSCFUN1 (INT, institutInqSubcenter, INSTITUTINQSUBCENTER, institutinqsubcenter, INT) +FCALLSCFUN1 (STRING, institutInqNamePtr, INSTITUTINQNAMEPTR, institutinqnameptr, INT) +FCALLSCFUN1 (STRING, institutInqLongnamePtr, INSTITUTINQLONGNAMEPTR, institutinqlongnameptr, INT) + +/* Model routines */ + +FCALLSCFUN3 (INT, modelDef, MODELDEF, modeldef, INT, INT, STRING) +FCALLSCFUN3 (INT, modelInq, MODELINQ, modelinq, INT, INT, STRING) +FCALLSCFUN1 (INT, modelInqInstitut, MODELINQINSTITUT, modelinqinstitut, INT) +FCALLSCFUN1 (INT, modelInqGribID, MODELINQGRIBID, modelinqgribid, INT) +FCALLSCFUN1 (STRING, modelInqNamePtr, MODELINQNAMEPTR, modelinqnameptr, INT) + +/* Table routines */ + +FCALLSCSUB2 (tableWrite, TABLEWRITE, tablewrite, STRING, INT) +FCALLSCFUN1 (INT, tableRead, TABLEREAD, tableread, STRING) +FCALLSCFUN3 (INT, tableDef, TABLEDEF, tabledef, INT, INT, STRING) +FCALLSCFUN1 (STRING, tableInqNamePtr, TABLEINQNAMEPTR, tableinqnameptr, INT) +FCALLSCFUN3 (INT, tableInq, TABLEINQ, tableinq, INT, INT, STRING) +FCALLSCFUN0 (INT, tableInqNumber, TABLEINQNUMBER, tableinqnumber) +FCALLSCFUN1 (INT, tableInqNum, TABLEINQNUM, tableinqnum, INT) +FCALLSCFUN1 (INT, tableInqModel, TABLEINQMODEL, tableinqmodel, INT) +FCALLSCSUB6 (tableInqEntry, TABLEINQENTRY, tableinqentry, INT, INT, INT, PSTRING, PSTRING, PSTRING) + +/* Subtype routines */ + +FCALLSCFUN1 (INT, subtypeCreate, SUBTYPECREATE, subtypecreate, INT) + +/* Gives a textual summary of the variable subtype */ + +FCALLSCSUB1 (subtypePrint, SUBTYPEPRINT, subtypeprint, INT) + +/* Compares two subtype data structures */ + +FCALLSCFUN2 (INT, subtypeCompare, SUBTYPECOMPARE, subtypecompare, INT, INT) +FCALLSCFUN1 (INT, subtypeInqSize, SUBTYPEINQSIZE, subtypeinqsize, INT) +FCALLSCFUN1 (INT, subtypeInqActiveIndex, SUBTYPEINQACTIVEINDEX, subtypeinqactiveindex, INT) +FCALLSCSUB2 (subtypeDefActiveIndex, SUBTYPEDEFACTIVEINDEX, subtypedefactiveindex, INT, INT) + +/* Generate a "query object" out of a key-value pair */ + + +/* Generate an AND-combined "query object" out of two previous query objects */ + +FCALLSCFUN3 (INT, subtypeInqTile, SUBTYPEINQTILE, subtypeinqtile, INT, INT, INT) +FCALLSCFUN4 (INT, subtypeInqAttribute, SUBTYPEINQATTRIBUTE, subtypeinqattribute, INT, INT, STRING, PINT) +FCALLSCFUN2 (INT, vlistInqVarSubtype, VLISTINQVARSUBTYPE, vlistinqvarsubtype, INT, INT) +FCALLSCSUB3 (gribapiLibraryVersion, GRIBAPILIBRARYVERSION, gribapilibraryversion, PINT, PINT, PINT) + +/* Compatibility functions for release 1.8.3 (obsolete functions) */ + +FCALLSCSUB2 (zaxisDefLtype, ZAXISDEFLTYPE, zaxisdefltype, INT, INT) +FCALLSCFUN2 (INT, vlistInqVarTypeOfGeneratingProcess, VLISTINQVARTYPEOFGENERATINGPROCESS, vlistinqvartypeofgeneratingprocess, INT, INT) +FCALLSCSUB3 (vlistDefVarTypeOfGeneratingProcess, VLISTDEFVARTYPEOFGENERATINGPROCESS, vlistdefvartypeofgeneratingprocess, INT, INT, INT) +FCALLSCSUB3 (vlistDefVarProductDefinitionTemplate, VLISTDEFVARPRODUCTDEFINITIONTEMPLATE, vlistdefvarproductdefinitiontemplate, INT, INT, INT) + +/* End of fortran interface */ + + +#if defined __clang__ +# pragma GCC diagnostic pop +#endif + +// clang-format on + +#endif diff --git a/src/cdilib.c b/src/cdilib.c new file mode 100644 index 0000000000000000000000000000000000000000..64cf1b43b00be5276d9f6cddb72bc9065539ac54 --- /dev/null +++ b/src/cdilib.c @@ -0,0 +1,75025 @@ + +/* Automatically generated by m300488 at 2023-02-24, do not edit */ + +/* CDILIB_VERSION="2.2.0" */ + +#if defined(_WIN32) || defined(_WIN64) +#define restrict +#define ssize_t long +#else +#define HAVE_UNISTD_H +#endif + +#ifdef _ARCH_PWR6 +#pragma options nostrict +#endif + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifndef _XOPEN_SOURCE +#define _XOPEN_SOURCE 600 +#endif + +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <stdarg.h> +#include <string.h> +#include <ctype.h> +#include <limits.h> +#include <float.h> +#include <math.h> +#include <errno.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <stdbool.h> +#include <assert.h> + +#ifdef HAVE_LIBGRIB_API +#include <grib_api.h> +#endif + +#ifdef HAVE_MMAP +#include <sys/mman.h> /* mmap() is defined in this header */ +#endif + +#ifdef HAVE_LIBPTHREAD +#include <pthread.h> +#endif + +#ifdef HAVE_LIBSZ +#include <szlib.h> +#endif + +#ifndef HAVE_CONFIG_H +#define HAVE_LIBGRIB 1 +#define HAVE_LIBCGRIBEX 1 +#define HAVE_LIBSERVICE 1 +#define HAVE_LIBEXTRA 1 +#define HAVE_LIBIEG 1 +#define CDI -1 +#endif + +#ifndef ASYNC_WORKER_H +#define ASYNC_WORKER_H + +typedef struct AsyncJob AsyncJob; +typedef struct AsyncManager AsyncManager; + +// a negative threadCount gives the number of cores that should remain unused by the worker threads, returns an error code +int AsyncWorker_init(AsyncManager **jobManager, int threadCount); + +// executes work(data) in a worker thread, must be followed by a call to AsyncWorker_wait() +AsyncJob *AsyncWorker_requestWork(AsyncManager *jobManager, int (*work)(void *data), void *data); + +// waits for the async job to finish and returns its result (or some other error code) +int AsyncWorker_wait(AsyncManager *jobManager, AsyncJob *job); + +// return the number of workers that are currently idle +int AsyncWorker_availableWorkers(AsyncManager *jobManager); + +// waits for all pending jobs to finish, stops all workers, returns a non-zero error code from a pending job if there were any +int AsyncWorker_finalize(AsyncManager *jobManager); + +#endif +#ifndef CDI_DATETIME_H +#define CDI_DATETIME_H + +#include <stdbool.h> +#include <stdint.h> + +// clang-format off + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct +{ + int year; // year of date + short month; // month of date + short day; // day of date +} CdiDate; + +typedef struct +{ + short hour; // hour part of time + short minute; // minute part of time + short second; // second part of time + short ms; // milli-second part of time. 0<=ms<=999 +} CdiTime; + +typedef struct +{ + CdiDate date; // date elements + CdiTime time; // time elements +} CdiDateTime; + +CdiDateTime cdiDateTime_set(int64_t date, int time); +CdiDate cdiDate_set(int64_t date); +CdiTime cdiTime_set(int time); +int64_t cdiDate_get(CdiDate cdiDate); +int cdiTime_get(CdiTime cdiTime); + +CdiDate cdiDate_encode(int year, int month, int day); +void cdiDate_decode(CdiDate cdiDate, int *year, int *month, int *day); +CdiTime cdiTime_encode(int hour, int minute, int second, int ms); +void cdiTime_decode(CdiTime cdiTime, int *hour, int *minute, int *second, int *ms); + +void cdiDate_init(CdiDate *cdiDate); +void cdiTime_init(CdiTime *cdiTime); +void cdiDateTime_init(CdiDateTime *cdiDateTime); + +bool cdiDate_isEQ(CdiDate cdiDate1, CdiDate cdiDate2); +bool cdiTime_isEQ(CdiTime cdiTime1, CdiTime cdiTime2); +bool cdiDateTime_isEQ(CdiDateTime cdiDateTime1, CdiDateTime cdiDateTime2); +bool cdiDateTime_isNE(CdiDateTime cdiDateTime1, CdiDateTime cdiDateTime2); +bool cdiDateTime_isLT(CdiDateTime cdiDateTime1, CdiDateTime cdiDateTime2); +bool cdiDateTime_isNull(CdiDateTime cdiDateTime); + +const char *CdiDateTime_string(CdiDateTime cdiDateTime); + +#ifdef __cplusplus +} +#endif + +// clang-format on + +#endif /* CDI_DATETIME_H */ +/* + CDI C header file + + This is the only file that must be included to use the CDI library from C. +*/ + +#ifndef CDI_H_ +#define CDI_H_ + +// clang-format off + +#include <stdio.h> +#include <stdint.h> // int64_t +#include <stdbool.h> +#include <sys/types.h> + +#ifndef CDI_SIZE_TYPE +#define CDI_SIZE_TYPE int +#endif + +typedef CDI_SIZE_TYPE SizeType; + +//FINT_ON <--- don't change or remove this line!!! +// Start of fortran interface for the following routines (make_fint.c) + +#ifdef __cplusplus +extern "C" { +#endif + +#define CDI_MAX_NAME 256 // Max length of a name + +#define CDI_UNDEFID -1 +#define CDI_GLOBAL -1 // Global var ID for vlist and Z-axis +#define CDI_XAXIS 1 // X-axis ID for grid +#define CDI_YAXIS 2 // Y-axis ID for grid + +// Byte order + +#define CDI_BIGENDIAN 0 // Byte order BIGENDIAN +#define CDI_LITTLEENDIAN 1 // Byte order LITTLEENDIAN +#define CDI_PDPENDIAN 2 + +#define CDI_REAL 1 // Real numbers +#define CDI_COMP 2 // Complex numbers +#define CDI_BOTH 3 // Both numbers + +// Error identifier + +#define CDI_NOERR 0 // No Error +#define CDI_EEOF -1 // The end of file was encountered +#define CDI_ETMOF -9 // Too many open files +#define CDI_ESYSTEM -10 // Operating system error +#define CDI_EINVAL -20 // Invalid argument +#define CDI_EISDIR -21 // Is a directory +#define CDI_EISEMPTY -22 // Is empty +#define CDI_EUFTYPE -23 // Unsupported file type +#define CDI_ELIBNAVAIL -24 // xxx library not available +#define CDI_EUFSTRUCT -25 // Unsupported file structure +#define CDI_EUNC4 -26 // Unsupported NetCDF4 structure +#define CDI_EDIMSIZE -27 // Invalid dimension size +#define CDI_EQENF -50 // Query entries not found +#define CDI_EQNAVAIL -51 // Query not available for file type +#define CDI_ELIMIT -99 // Internal limits exceeded + +// File types + +#define CDI_FILETYPE_GRB 1 // File type GRIB +#define CDI_FILETYPE_GRB2 2 // File type GRIB version 2 +#define CDI_FILETYPE_NC 3 // File type NetCDF +#define CDI_FILETYPE_NC2 4 // File type NetCDF version 2 (64-bit offset) +#define CDI_FILETYPE_NC4 5 // File type NetCDF version 4 +#define CDI_FILETYPE_NC4C 6 // File type NetCDF version 4 (classic) +#define CDI_FILETYPE_NC5 7 // File type NetCDF version 5 (64-bit data) +#define CDI_FILETYPE_SRV 8 // File type SERVICE +#define CDI_FILETYPE_EXT 9 // File type EXTRA +#define CDI_FILETYPE_IEG 10 // File type IEG +#define CDI_FILETYPE_NCZARR 11 // File type NetCDF NCZarr Data Model + +// Compatibility defines for release 1.8.3 (obsolete defines) +#define FILETYPE_GRB 1 // File type GRIB +#define FILETYPE_GRB2 2 // File type GRIB version 2 +#define FILETYPE_NC 3 // File type NetCDF +#define FILETYPE_NC2 4 // File type NetCDF version 2 (64-bit offset) +#define FILETYPE_NC4 5 // File type NetCDF version 4 + +// Protocols (in filename/URI) + +#define CDI_PROTOCOL_OTHER 0 // Any other protocol (might be supported by NetCDF library) +#define CDI_PROTOCOL_FILE 1 +#define CDI_PROTOCOL_FDB 2 +#define CDI_PROTOCOL_ACROSS 3 + +// Compress types + +#define CDI_COMPRESS_NONE 0 +#define CDI_COMPRESS_SZIP 1 +#define CDI_COMPRESS_AEC 2 +#define CDI_COMPRESS_ZIP 3 +#define CDI_COMPRESS_JPEG 4 +#define CDI_COMPRESS_FILTER 5 + +// external data types + +// Compatibility defines for release 1.8.3 (obsolete defines) +#define DATATYPE_PACK16 16 +#define DATATYPE_PACK24 24 +#define DATATYPE_FLT32 132 +#define DATATYPE_FLT64 164 +#define DATATYPE_INT32 232 +#define DATATYPE_INT 251 + +#define CDI_DATATYPE_PACK 0 +#define CDI_DATATYPE_PACK1 1 +#define CDI_DATATYPE_PACK2 2 +#define CDI_DATATYPE_PACK3 3 +#define CDI_DATATYPE_PACK4 4 +#define CDI_DATATYPE_PACK5 5 +#define CDI_DATATYPE_PACK6 6 +#define CDI_DATATYPE_PACK7 7 +#define CDI_DATATYPE_PACK8 8 +#define CDI_DATATYPE_PACK9 9 +#define CDI_DATATYPE_PACK10 10 +#define CDI_DATATYPE_PACK11 11 +#define CDI_DATATYPE_PACK12 12 +#define CDI_DATATYPE_PACK13 13 +#define CDI_DATATYPE_PACK14 14 +#define CDI_DATATYPE_PACK15 15 +#define CDI_DATATYPE_PACK16 16 +#define CDI_DATATYPE_PACK17 17 +#define CDI_DATATYPE_PACK18 18 +#define CDI_DATATYPE_PACK19 19 +#define CDI_DATATYPE_PACK20 20 +#define CDI_DATATYPE_PACK21 21 +#define CDI_DATATYPE_PACK22 22 +#define CDI_DATATYPE_PACK23 23 +#define CDI_DATATYPE_PACK24 24 +#define CDI_DATATYPE_PACK25 25 +#define CDI_DATATYPE_PACK26 26 +#define CDI_DATATYPE_PACK27 27 +#define CDI_DATATYPE_PACK28 28 +#define CDI_DATATYPE_PACK29 29 +#define CDI_DATATYPE_PACK30 30 +#define CDI_DATATYPE_PACK31 31 +#define CDI_DATATYPE_PACK32 32 +#define CDI_DATATYPE_CPX32 64 +#define CDI_DATATYPE_CPX64 128 +#define CDI_DATATYPE_FLT32 132 +#define CDI_DATATYPE_FLT64 164 +#define CDI_DATATYPE_INT8 208 +#define CDI_DATATYPE_INT16 216 +#define CDI_DATATYPE_INT32 232 +#define CDI_DATATYPE_UINT8 308 +#define CDI_DATATYPE_UINT16 316 +#define CDI_DATATYPE_UINT32 332 + +// internal data types +#define CDI_DATATYPE_INT 251 +#define CDI_DATATYPE_FLT 252 +#define CDI_DATATYPE_TXT 253 +#define CDI_DATATYPE_CPX 254 +#define CDI_DATATYPE_UCHAR 255 +#define CDI_DATATYPE_LONG 256 +#define CDI_DATATYPE_UINT 257 + +// Chunk types + +#define CDI_CHUNK_AUTO 1 // use default chunk size +#define CDI_CHUNK_GRID 2 +#define CDI_CHUNK_LINES 3 + +// GRID types + +#define GRID_GENERIC 1 // Generic grid +#define GRID_GAUSSIAN 2 // Regular Gaussian lon/lat grid +#define GRID_GAUSSIAN_REDUCED 3 // Reduced Gaussian lon/lat grid +#define GRID_LONLAT 4 // Regular longitude/latitude grid +#define GRID_SPECTRAL 5 // Spherical harmonic coefficients (spectral gaussian) +#define GRID_FOURIER 6 // Fourier coefficients (spectral gaussian) +#define GRID_GME 7 // Icosahedral-hexagonal GME grid +#define GRID_TRAJECTORY 8 // Trajectory +#define GRID_UNSTRUCTURED 9 // General unstructured grid +#define GRID_CURVILINEAR 10 // Curvilinear grid +#define GRID_PROJECTION 12 // Projected coordinates +#define GRID_CHARXY 13 // One horizontal character dimension + +#define CDI_PROJ_RLL 21 // Rotated Latitude Longitude +#define CDI_PROJ_LCC 22 // Lambert Conformal Conic +#define CDI_PROJ_LAEA 23 // Lambert Azimuthal Equal Area +#define CDI_PROJ_SINU 24 // Sinusoidal +#define CDI_PROJ_STERE 25 // Polar stereographic +#define CDI_PROJ_HEALPIX 26 // Healpix + +// ZAXIS types + +#define ZAXIS_SURFACE 0 // Surface level +#define ZAXIS_GENERIC 1 // Generic level +#define ZAXIS_HYBRID 2 // Hybrid level +#define ZAXIS_HYBRID_HALF 3 // Hybrid half level +#define ZAXIS_PRESSURE 4 // Isobaric pressure level in Pascal +#define ZAXIS_HEIGHT 5 // Height above ground +#define ZAXIS_DEPTH_BELOW_SEA 6 // Depth below sea level in meters +#define ZAXIS_DEPTH_BELOW_LAND 7 // Depth below land surface in centimeters +#define ZAXIS_ISENTROPIC 8 // Isentropic +#define ZAXIS_TRAJECTORY 9 // Trajectory +#define ZAXIS_ALTITUDE 10 // Altitude above mean sea level in meters +#define ZAXIS_SIGMA 11 // Sigma level +#define ZAXIS_MEANSEA 12 // Mean sea level +#define ZAXIS_TOA 13 // Norminal top of atmosphere +#define ZAXIS_SEA_BOTTOM 14 // Sea bottom +#define ZAXIS_ATMOSPHERE 15 // Entire atmosphere +#define ZAXIS_CLOUD_BASE 16 // Cloud base level +#define ZAXIS_CLOUD_TOP 17 // Level of cloud tops +#define ZAXIS_ISOTHERM_ZERO 18 // Level of 0o C isotherm +#define ZAXIS_SNOW 19 // Snow level +#define ZAXIS_LAKE_BOTTOM 20 // Lake or River Bottom +#define ZAXIS_SEDIMENT_BOTTOM 21 // Bottom Of Sediment Layer +#define ZAXIS_SEDIMENT_BOTTOM_TA 22 // Bottom Of Thermally Active Sediment Layer +#define ZAXIS_SEDIMENT_BOTTOM_TW 23 // Bottom Of Sediment Layer Penetrated By Thermal Wave +#define ZAXIS_MIX_LAYER 24 // Mixing Layer +#define ZAXIS_REFERENCE 25 // zaxis reference number +#define ZAXIS_CHAR 26 // Area types +#define ZAXIS_TROPOPAUSE 27 // Tropopause + +// SUBTYPE types + +enum { + SUBTYPE_TILES = 0 // Tiles variable +}; + +#define MAX_KV_PAIRS_MATCH 10 + +/* Data structure defining a key-value search, possibly with multiple + key-value pairs in combination. + + Currently, only multiple pairs combined by AND are supported. +*/ +typedef struct { + int nAND; // no. of key-value pairs that have to match + int key_value_pairs[2][MAX_KV_PAIRS_MATCH]; // key-value pairs +} subtype_query_t; + + + +// TIME types + +#define TIME_CONSTANT 0 // Time constant +#define TIME_VARYING 1 // Time varying +#define TIME_VARIABLE 1 // obsolete, use TIME_VARYING + +// TSTEP types + +#define TSTEP_CONSTANT 0 // obsolete, use TIME_CONSTANT +#define TSTEP_INSTANT 1 // Instant +#define TSTEP_AVG 2 // Average +#define TSTEP_ACCUM 3 // Accumulation +#define TSTEP_MAX 4 // Maximum +#define TSTEP_MIN 5 // Minimum +#define TSTEP_DIFF 6 // Difference +#define TSTEP_RMS 7 // Root mean square +#define TSTEP_SD 8 // Standard deviation +#define TSTEP_COV 9 // Covariance +#define TSTEP_RATIO 10 // Ratio +#define TSTEP_SUM 11 // Summation +#define TSTEP_RANGE 12 +#define TSTEP_INSTANT2 13 +#define TSTEP_INSTANT3 14 + +// TAXIS types + +#define TAXIS_ABSOLUTE 1 +#define TAXIS_RELATIVE 2 +#define TAXIS_FORECAST 3 + +// TUNIT types + +#define TUNIT_SECOND 1 +#define TUNIT_MINUTE 2 +#define TUNIT_QUARTER 3 +#define TUNIT_30MINUTES 4 +#define TUNIT_HOUR 5 +#define TUNIT_3HOURS 6 +#define TUNIT_6HOURS 7 +#define TUNIT_12HOURS 8 +#define TUNIT_DAY 9 +#define TUNIT_MONTH 10 +#define TUNIT_YEAR 11 + +// CALENDAR types + +#define CALENDAR_STANDARD 0 // don't change this value (used also in cgribexlib)! +#define CALENDAR_GREGORIAN 1 +#define CALENDAR_PROLEPTIC 2 +#define CALENDAR_360DAYS 3 +#define CALENDAR_365DAYS 4 +#define CALENDAR_366DAYS 5 +#define CALENDAR_NONE 6 + +// number of unsigned char needed to store UUID +#define CDI_UUID_SIZE 16 + +// Structs that are used to return data to the user + +typedef struct CdiParam { int discipline; int category; int number; } CdiParam; + + +// Opaque types +typedef struct CdiIterator CdiIterator; +typedef struct CdiGribIterator CdiGribIterator; + +// CDI control routines + +void cdiReset(void); + +const char *cdiStringError(int cdiErrno); +void cdiDebug(int debug); + +const char *cdiLibraryVersion(void); +void cdiPrintVersion(void); + +int cdiHaveFiletype(int filetype); + +void cdiDefMissval(double missval); +double cdiInqMissval(void); +void cdiDefGlobal(const char *string, int val); + +int namespaceNew(void); +void namespaceSetActive(int namespaceID); +int namespaceGetActive(void); +void namespaceDelete(int namespaceID); + + +// CDI converter routines + +// parameter + +void cdiParamToString(int param, char *paramstr, int maxlen); + +void cdiDecodeParam(int param, int *pnum, int *pcat, int *pdis); +int cdiEncodeParam(int pnum, int pcat, int pdis); + +// date format: YYYYMMDD +// time format: hhmmss + +void cdiDecodeDate(int date, int *year, int *month, int *day); +int cdiEncodeDate(int year, int month, int day); + +void cdiDecodeTime(int time, int *hour, int *minute, int *second); +int cdiEncodeTime(int hour, int minute, int second); + + +// STREAM control routines + +int cdiGetFiletype(const char *uri, int *byteorder); +int cdiGetProtocol(const char *uri, const char **filename); + +// streamOpenRead: Open a dataset for reading +int streamOpenRead(const char *path); + +// streamOpenWrite: Create a new dataset +int streamOpenWrite(const char *path, int filetype); + +int streamOpenAppend(const char *path); + +// streamClose: Close an open dataset +void streamClose(int streamID); + +// streamSync: Synchronize an Open Dataset to Disk +void streamSync(int streamID); + +void streamDefMaxSteps(int streamID, int maxSteps); +void streamDefNumWorker(int streamID, int numWorker); + +// streamDefVlist: Define the Vlist for a stream +void streamDefVlist(int streamID, int vlistID); + +// streamInqVlist: Get the Vlist of a stream +int streamInqVlist(int streamID); + +// streamInqFiletype: Get the filetype +int streamInqFiletype(int streamID); + +// streamDefByteorder: Define the byteorder +void streamDefByteorder(int streamID, int byteorder); + +// streamInqByteorder: Get the byteorder +int streamInqByteorder(int streamID); + +void streamDefFilter(int streamID, int filterId, int nparams, const int *params); + +// streamDefCompType: Define compression type +void streamDefCompType(int streamID, int comptype); + +// streamInqCompType: Get compression type +int streamInqCompType(int streamID); + +// streamDefCompLevel: Define compression level +void streamDefCompLevel(int streamID, int complevel); + +// streamInqCompLevel: Get compression level +int streamInqCompLevel(int streamID); + +// streamDefTimestep: Define time step +int streamDefTimestep(int streamID, int tsID); + +// streamInqTimestep: Get time step +int streamInqTimestep(int streamID, int tsID); + +// PIO: query currently set timestep id +int streamInqCurTimestepID(int streamID); + +const char *streamFilename(int streamID); +const char *streamFilesuffix(int filetype); + +SizeType streamNvals(int streamID); + +int streamInqNvars(int streamID); + +// STREAM var I/O routines (random access) + +// streamWriteVar: Write a variable +void streamWriteVar(int streamID, int varID, const double data[], SizeType nmiss); +void streamWriteVarF(int streamID, int varID, const float data[], SizeType nmiss); + +// streamReadVar: Read a variable +void streamReadVar(int streamID, int varID, double data[], SizeType *nmiss); +void streamReadVarF(int streamID, int varID, float data[], SizeType *nmiss); +void streamReadVarPart(int streamID, int varID, int varType, int start, SizeType size, void *data, SizeType *nmiss, int memtype); + +// streamWriteVarSlice: Write a horizontal slice of a variable +void streamWriteVarSlice(int streamID, int varID, int levelID, const double data[], SizeType nmiss); +void streamWriteVarSliceF(int streamID, int varID, int levelID, const float data[], SizeType nmiss); +void streamReadVarSlicePart(int streamID, int varID, int levelID, int varType, int start, SizeType size, void *data, SizeType *nmiss, int memtype); + +// streamReadVarSlice: Read a horizontal slice of a variable +void streamReadVarSlice(int streamID, int varID, int levelID, double data[], SizeType *nmiss); +void streamReadVarSliceF(int streamID, int varID, int levelID, float data[], SizeType *nmiss); + +void streamWriteVarChunk(int streamID, int varID, const int rect[][2], const double data[], SizeType nmiss); +void streamWriteVarChunkF(int streamID, int varID, const int rect[][2], const float data[], SizeType nmiss); + + +// STREAM record I/O routines (sequential access) + +void streamDefRecord(int streamID, int varID, int levelID); +void streamInqRecord(int streamID, int *varID, int *levelID); +void streamWriteRecord(int streamID, const double data[], SizeType nmiss); +void streamWriteRecordF(int streamID, const float data[], SizeType nmiss); +void streamReadRecord(int streamID, double data[], SizeType *nmiss); +void streamReadRecordF(int streamID, float data[], SizeType *nmiss); +void streamCopyRecord(int streamIDdest, int streamIDsrc); + +void streamInqGRIBinfo(int streamID, int *intnum, float *fltnum, off_t *bignum); + + +// File driven I/O (may yield better performance than using the streamXXX functions) + +// Creation & Destruction +CdiIterator *cdiIterator_new(const char *path); // Requires a subsequent call to cdiIteratorNextField() to point the iterator at the first field. +CdiIterator *cdiIterator_clone(CdiIterator *me); +char *cdiIterator_serialize(CdiIterator *me); // Returns a malloc'ed string. +CdiIterator *cdiIterator_deserialize(const char *description); // description is a string that was returned by cdiIteratorSerialize(). Returns a copy of the original iterator. +void cdiIterator_print(CdiIterator *me, FILE *stream); +void cdiIterator_delete(CdiIterator *me); + +// Advancing an iterator +int cdiIterator_nextField(CdiIterator *me); // Points the iterator at the next field, returns CDI_EEOF if there are no more fields in the file. + +// Introspecting metadata +// All outXXX arguments to these functions may be NULL. +char *cdiIterator_inqStartTime(CdiIterator *me); // Returns the (start) time as an ISO-8601 coded string. The caller is responsible to Free() the returned string. +char *cdiIterator_inqEndTime(CdiIterator *me); // Returns the end time of an integration period as an ISO-8601 coded string, or NULL if there is no end time. The caller is responsible to Free() the returned string. +char *cdiIterator_inqRTime(CdiIterator *me); // Returns the reference date as an ISO-8601 coded string. The caller is responsible to Free() the returned string. +char *cdiIterator_inqVTime(CdiIterator *me); // Returns the validity date as an ISO-8601 coded string. The caller is responsible to Free() the returned string. +int cdiIterator_inqLevelType(CdiIterator *me, int levelSelector, char **outName_optional, char **outLongName_optional, char **outStdName_optional, char **outUnit_optional); // callers are responsible to Free() strings that they request +int cdiIterator_inqLevel(CdiIterator *me, int levelSelector, double *outValue1_optional, double *outValue2_optional); // outValue2 is only written to if the level is a hybrid level +int cdiIterator_inqLevelUuid(CdiIterator *me, int *outVgridNumber_optional, int *outLevelCount_optional, unsigned char outUuid_optional[CDI_UUID_SIZE]); // outUuid must point to a buffer of 16 bytes, returns an error code if no generalized zaxis is used. +int cdiIterator_inqTile(CdiIterator *me, int *outTileIndex, int *outTileAttribute); // Returns CDI_EINVAL if there is no tile information connected to the current field, *outTileIndex and *outTileAttribute will be set to -1 in this case. +int cdiIterator_inqTileCount(CdiIterator *me, int *outTileCount, int *outTileAttributeCount); // outTileAttributeCount is the count for the tile associated with the current field, a total attribute count cannot be inquired. Returns CDI_EINVAL if there is no tile information connected to the current field, *outTileCount and *outTileAttributeCount will be set to 0 in this case. +CdiParam cdiIterator_inqParam(CdiIterator *me); +void cdiIterator_inqParamParts(CdiIterator *me, int *outDiscipline, int *outCategory, int *outNumber); // Some FORTRAN compilers produce wrong code for the cdiIterator_inqParam()-wrapper, rendering it unusable from FORTRAN. This function is the workaround. +int cdiIterator_inqDatatype(CdiIterator *me); +int cdiIterator_inqFiletype(CdiIterator *me); +int cdiIterator_inqTsteptype(CdiIterator *me); +char *cdiIterator_inqVariableName(CdiIterator *me); // The caller is responsible to Free() the returned buffer. +int cdiIterator_inqGridId(CdiIterator *me); // The returned id is only valid until the next call to cdiIteratorNextField(). + +// Reading data +void cdiIterator_readField(CdiIterator *me, double data[], SizeType *nmiss_optional); +void cdiIterator_readFieldF(CdiIterator *me, float data[], SizeType *nmiss_optional); +// TODO[NH]: Add functions to read partial fields. + + +// Direct access to grib fields +CdiGribIterator *cdiGribIterator_clone(CdiIterator *me); // Returns NULL if the associated file is not a GRIB file. +void cdiGribIterator_delete(CdiGribIterator *me); + +// Callthroughs to GRIB-API +int cdiGribIterator_getLong(CdiGribIterator *me, const char *key, long *value); // Same semantics as grib_get_long(). +int cdiGribIterator_getDouble(CdiGribIterator *me, const char *key, double *value); // Same semantics as grib_get_double(). +int cdiGribIterator_getLength(CdiGribIterator *me, const char *key, size_t *value); // Same semantics as grib_get_length(). +int cdiGribIterator_getString(CdiGribIterator *me, const char *key, char *value, size_t *length); // Same semantics as grib_get_string(). +int cdiGribIterator_getSize(CdiGribIterator *me, const char *key, size_t *value); // Same semantics as grib_get_size(). +int cdiGribIterator_getLongArray(CdiGribIterator *me, const char *key, long *value, size_t *array_size); // Same semantics as grib_get_long_array(). +int cdiGribIterator_getDoubleArray(CdiGribIterator *me, const char *key, double *value, size_t *array_size); // Same semantics as grib_get_double_array(). + +// Convenience functions for accessing GRIB-API keys +int cdiGribIterator_inqEdition(CdiGribIterator *me); +long cdiGribIterator_inqLongValue(CdiGribIterator *me, const char *key); // Aborts on failure to fetch the given key. +long cdiGribIterator_inqLongDefaultValue(CdiGribIterator *me, const char *key, long defaultValue); // Returns the default value if the given key is not present. +double cdiGribIterator_inqDoubleValue(CdiGribIterator *me, const char *key); // Aborts on failure to fetch the given key. +double cdiGribIterator_inqDoubleDefaultValue(CdiGribIterator *me, const char *key, double defaultValue); // Returns the default value if the given key is not present. +char *cdiGribIterator_inqStringValue(CdiGribIterator *me, const char *key); // Returns a malloc'ed string. + +// VLIST routines + +// vlistCreate: Create a variable list +int vlistCreate(void); + +// vlistDestroy: Destroy a variable list +void vlistDestroy(int vlistID); + +// vlistDuplicate: Duplicate a variable list +int vlistDuplicate(int vlistID); + +// vlistCopy: Copy a variable list +void vlistCopy(int vlistID2, int vlistID1); + +// vlistCopyFlag: Copy some entries of a variable list +void vlistCopyFlag(int vlistID2, int vlistID1); + +void vlistClearFlag(int vlistID); + +// vlistCat: Concatenate two variable lists +void vlistCat(int vlistID2, int vlistID1); + +// vlistMerge: Merge two variable lists +void vlistMerge(int vlistID2, int vlistID1); + +void vlistPrint(int vlistID); + +// vlistNumber: Number type in a variable list +int vlistNumber(int vlistID); + +// vlistNvars: Number of variables in a variable list +int vlistNvars(int vlistID); + +// vlistNgrids: Number of grids in a variable list +int vlistNgrids(int vlistID); + +// vlistNzaxis: Number of zaxis in a variable list +int vlistNzaxis(int vlistID); + +// vlistNsubtypes: Number of subtypes in a variable list +int vlistNsubtypes(int vlistID); + +void vlistDefNtsteps(int vlistID, int nts); +int vlistNtsteps(int vlistID); +SizeType vlistGridsizeMax(int vlistID); +int vlistGrid(int vlistID, int index); +int vlistGridIndex(int vlistID, int gridID); +void vlistChangeGridIndex(int vlistID, int index, int gridID); +void vlistChangeGrid(int vlistID, int gridID1, int gridID2); +int vlistZaxis(int vlistID, int index); +int vlistZaxisIndex(int vlistID, int zaxisID); +void vlistChangeZaxisIndex(int vlistID, int index, int zaxisID); +void vlistChangeZaxis(int vlistID, int zaxisID1, int zaxisID2); +int vlistNrecs(int vlistID); +int vlistSubtype(int vlistID, int index); +int vlistSubtypeIndex(int vlistID, int subtypeID); + +// vlistDefTaxis: Define the time axis of a variable list +void vlistDefTaxis(int vlistID, int taxisID); + +// vlistInqTaxis: Get the time axis of a variable list +int vlistInqTaxis(int vlistID); + +void vlistDefTable(int vlistID, int tableID); +int vlistInqTable(int vlistID); +void vlistDefInstitut(int vlistID, int instID); +int vlistInqInstitut(int vlistID); +void vlistDefModel(int vlistID, int modelID); +int vlistInqModel(int vlistID); + + +// VLIST VAR routines + +// vlistDefVarTiles: Create a new tile-based variable +int vlistDefVarTiles(int vlistID, int gridID, int zaxisID, int timetype, int tilesetID); + +// vlistDefVar: Create a new variable +int vlistDefVar(int vlistID, int gridID, int zaxisID, int timetype); + +void vlistChangeVarGrid(int vlistID, int varID, int gridID); +void vlistChangeVarZaxis(int vlistID, int varID, int zaxisID); + +void vlistInqVar(int vlistID, int varID, int *gridID, int *zaxisID, int *timetype); +int vlistInqVarGrid(int vlistID, int varID); +int vlistInqVarZaxis(int vlistID, int varID); + +// used in MPIOM +int vlistInqVarID(int vlistID, int code); + +void vlistDefVarTimetype(int vlistID, int varID, int timetype); +int vlistInqVarTimetype(int vlistID, int varID); + +void vlistDefVarTsteptype(int vlistID, int varID, int tsteptype); + +// vlistInqVarTsteptype: Get the timestep type of a Variable +int vlistInqVarTsteptype(int vlistID, int varID); + +void vlistDefVarCompType(int vlistID, int varID, int comptype); +int vlistInqVarCompType(int vlistID, int varID); +void vlistDefVarCompLevel(int vlistID, int varID, int complevel); +int vlistInqVarCompLevel(int vlistID, int varID); + +// vlistDefVarParam: Define the parameter number of a Variable +void vlistDefVarParam(int vlistID, int varID, int param); + +// vlistInqVarParam: Get the parameter number of a Variable +int vlistInqVarParam(int vlistID, int varID); + +// vlistDefVarCode: Define the code number of a Variable +void vlistDefVarCode(int vlistID, int varID, int code); + +// vlistInqVarCode: Get the code number of a Variable +int vlistInqVarCode(int vlistID, int varID); + +// vlistDefVarDatatype: Define the data type of a Variable +void vlistDefVarDatatype(int vlistID, int varID, int datatype); + +// vlistInqVarDatatype: Get the data type of a Variable +int vlistInqVarDatatype(int vlistID, int varID); + +void vlistDefVarXYZ(int vlistID, int varID, int xyz); +int vlistInqVarXYZ(int vlistID, int varID); + +void vlistDefVarNSB(int vlistID, int varID, int nsb); +int vlistInqVarNSB(int vlistID, int varID); + +int vlistInqVarNumber(int vlistID, int varID); + +void vlistDefVarInstitut(int vlistID, int varID, int instID); +int vlistInqVarInstitut(int vlistID, int varID); +void vlistDefVarModel(int vlistID, int varID, int modelID); +int vlistInqVarModel(int vlistID, int varID); +void vlistDefVarTable(int vlistID, int varID, int tableID); +int vlistInqVarTable(int vlistID, int varID); + +// vlistDefVarName: Define the name of a Variable +void vlistDefVarName(int vlistID, int varID, const char *name); + +// vlistInqVarName: Get the name of a Variable +void vlistInqVarName(int vlistID, int varID, char *name); + +// vlistCopyVarName: Safe and convenient version of vlistInqVarName +char *vlistCopyVarName(int vlistId, int varId); + +// vlistDefVarStdname: Define the standard name of a Variable +void vlistDefVarStdname(int vlistID, int varID, const char *stdname); + +// vlistInqVarStdname: Get the standard name of a Variable +void vlistInqVarStdname(int vlistID, int varID, char *stdname); + +// vlistDefVarLongname: Define the long name of a Variable +void vlistDefVarLongname(int vlistID, int varID, const char *longname); + +// vlistInqVarLongname: Get the long name of a Variable +void vlistInqVarLongname(int vlistID, int varID, char *longname); + +// vlistDefVarUnits: Define the units of a Variable +void vlistDefVarUnits(int vlistID, int varID, const char *units); + +// vlistInqVarUnits: Get the units of a Variable +void vlistInqVarUnits(int vlistID, int varID, char *units); + +// vlistDefVarMissval: Define the missing value of a Variable +void vlistDefVarMissval(int vlistID, int varID, double missval); + +// vlistInqVarMissval: Get the missing value of a Variable +double vlistInqVarMissval(int vlistID, int varID); + +SizeType vlistInqVarSize(int vlistID, int varID); + +void vlistDefIndex(int vlistID, int varID, int levID, int index); +int vlistInqIndex(int vlistID, int varID, int levID); +void vlistDefFlag(int vlistID, int varID, int levID, int flag); +int vlistInqFlag(int vlistID, int varID, int levID); +int vlistFindVar(int vlistID, int fvarID); +int vlistFindLevel(int vlistID, int fvarID, int flevelID); +int vlistMergedVar(int vlistID, int varID); +int vlistMergedLevel(int vlistID, int varID, int levelID); + +// cdiClearAdditionalKeys: Clear the list of additional GRIB keys +void cdiClearAdditionalKeys(void); +// cdiDefAdditionalKey: Register an additional GRIB key which is read when file is opened +void cdiDefAdditionalKey(const char *string); + +// vlistDefVarIntKey: Set an arbitrary keyword/integer value pair for GRIB API +void vlistDefVarIntKey(int vlistID, int varID, const char *name, int value); +// vlistDefVarDblKey: Set an arbitrary keyword/double value pair for GRIB API +void vlistDefVarDblKey(int vlistID, int varID, const char *name, double value); + +// vlistHasVarKey: returns 1 if meta-data key was read, 0 otherwise +int vlistHasVarKey(int vlistID, int varID, const char *name); +// vlistInqVarDblKey: raw access to GRIB meta-data +double vlistInqVarDblKey(int vlistID, int varID, const char *name); +// vlistInqVarIntKey: raw access to GRIB meta-data +int vlistInqVarIntKey(int vlistID, int varID, const char *name); + +// CDI attributes + +// cdiInqNatts: Get number of attributes assigned to this variable +int cdiInqNatts(int cdiID, int varID, int *nattsp); +// cdiInqAtt: Get information about an attribute +int cdiInqAtt(int cdiID, int varID, int attrnum, char *name, int *typep, int *lenp); +int cdiInqAttLen(int cdiID, int varID, const char *name); +int cdiInqAttType(int cdiID, int varID, const char *name); +int cdiDelAtt(int cdiID, int varID, const char *name); + +int cdiCopyAtts(int cdiID1, int varID1, int cdiID2, int varID2); + +// cdiDefAttInt: Define an integer attribute +int cdiDefAttInt(int cdiID, int varID, const char *name, int type, int len, const int ip[]); +// cdiDefAttFlt: Define a floating point attribute +int cdiDefAttFlt(int cdiID, int varID, const char *name, int type, int len, const double dp[]); +// cdiDefAttTxt: Define a text attribute +int cdiDefAttTxt(int cdiID, int varID, const char *name, int len, const char *tp_cbuf); + +// cdiInqAttInt: Get the value(s) of an integer attribute +int cdiInqAttInt(int cdiID, int varID, const char *name, int mlen, int ip[]); +// cdiInqAttFlt: Get the value(s) of a floating point attribute +int cdiInqAttFlt(int cdiID, int varID, const char *name, int mlen, double dp[]); +// cdiInqAttTxt: Get the value(s) of a text attribute +int cdiInqAttTxt(int cdiID, int varID, const char *name, int mlen, char *tp_cbuf); + + +// GRID routines + +void gridName(int gridtype, char *gridname); +const char *gridNamePtr(int gridtype); + +void gridCompress(int gridID); + +void gridDefMaskGME(int gridID, const int mask[]); +int gridInqMaskGME(int gridID, int mask[]); + +void gridDefMask(int gridID, const int mask[]); +int gridInqMask(int gridID, int mask[]); + +// gridCreate: Create a horizontal Grid +int gridCreate(int gridtype, SizeType size); + +// gridDestroy: Destroy a horizontal Grid +void gridDestroy(int gridID); + +// gridDuplicate: Duplicate a Grid +int gridDuplicate(int gridID); + +// gridDefProj: Define the projection ID of a Grid +void gridDefProj(int gridID, int projID); + +// gridInqProj: Get the projection ID of a Grid +int gridInqProj(int gridID); + +// gridInqProjType: Get the projection type +int gridInqProjType(int gridID); + +// gridInqType: Get the type of a Grid +int gridInqType(int gridID); + +// gridInqSize: Get the size of a Grid +SizeType gridInqSize(int gridID); + +// gridDefXsize: Define the size of a X-axis +void gridDefXsize(int gridID, SizeType xsize); + +// gridInqXsize: Get the size of a X-axis +SizeType gridInqXsize(int gridID); + +// gridDefYsize: Define the size of a Y-axis +void gridDefYsize(int gridID, SizeType ysize); + +// gridInqYsize: Get the size of a Y-axis +SizeType gridInqYsize(int gridID); + +// gridDefNP: Define the number of parallels between a pole and the equator +void gridDefNP(int gridID, int np); + +// gridInqNP: Get the number of parallels between a pole and the equator +int gridInqNP(int gridID); + +// gridDefXvals: Define the values of a X-axis +void gridDefXvals(int gridID, const double xvals[]); + +// gridInqXvals: Get all values of a X-axis +SizeType gridInqXvals(int gridID, double xvals[]); +SizeType gridInqXvalsPart(int gridID, int start, SizeType size, double xvals[]); +const double *gridInqXvalsPtr(int gridID); + +// gridInqXIsc: Find out whether X-coordinate is of type CHAR +int gridInqXIsc(int gridID); + +// gridInqXCvals: Get strings from X-axis in case grid is of type GRID_CHARXY +SizeType gridInqXCvals(int gridID, char *xcvals[]); + +// gridDefYvals: Define the values of a Y-axis +void gridDefYvals(int gridID, const double yvals[]); + +// gridInqYvals: Get all values of a Y-axis +SizeType gridInqYvals(int gridID, double yvals[]); +SizeType gridInqYvalsPart(int gridID, int start, SizeType size, double yvals[]); +const double *gridInqYvalsPtr(int gridID); + +// gridInqYIsc: Find out whether Y-coordinate is of type CHAR +int gridInqYIsc(int gridID); + +// gridInqYCvals: Get strings from Y-axis in case grid is of type GRID_CHARXY +SizeType gridInqYCvals(int gridID, char *ycvals[]); + +// CDI var keys + +// String keys +#define CDI_KEY_NAME 942 // Variable name +#define CDI_KEY_LONGNAME 943 // Long name of the variable +#define CDI_KEY_STDNAME 944 // CF Standard name of the variable +#define CDI_KEY_UNITS 945 // Units of the variable +#define CDI_KEY_DATATYPE 946 // Data type +#define CDI_KEY_REFERENCEURI 947 // Reference URI to grid file +#define CDI_KEY_CHUNKS 948 // Chunks + +// Integer keys +#define CDI_KEY_NUMBEROFGRIDUSED 961 // GRIB2 numberOfGridUsed +#define CDI_KEY_NUMBEROFGRIDINREFERENCE 962 // GRIB2 numberOfGridInReference +#define CDI_KEY_NUMBEROFVGRIDUSED 963 // GRIB2 numberOfVGridUsed +#define CDI_KEY_NLEV 964 // GRIB2 nlev +#define CDI_KEY_CHUNKTYPE 965 // ChunkType: CDI_CHUNK_AUTO/CDI_CHUNK_GRID/CDI_CHUNK_LINES +#define CDI_KEY_CHUNKSIZE 966 // ChunkSize + +// Floating point keys +#define CDI_KEY_MISSVAL 701 // Missing value +#define CDI_KEY_ADDOFFSET 702 // Add offset +#define CDI_KEY_SCALEFACTOR 703 // Scale factor + +// Byte array keys +#define CDI_KEY_UUID 960 // UUID for grid/Z-axis reference [size: CDI_UUID_SIZE] + + +#define CDI_KEY_DIMNAME 941 // Dimension name + +#define CDI_KEY_PSNAME 950 // Z-axis surface pressure name +#define CDI_KEY_P0NAME 951 // Z-axis reference pressure name +#define CDI_KEY_P0VALUE 952 // Z-axis reference pressure in Pa + +#define CDI_KEY_TABLESVERSION 801 // GRIB2 tablesVersion +#define CDI_KEY_LOCALTABLESVERSION 802 // GRIB2 localTablesVersion +#define CDI_KEY_TYPEOFGENERATINGPROCESS 803 // GRIB2 typeOfGeneratingProcess +#define CDI_KEY_PRODUCTDEFINITIONTEMPLATE 804 // GRIB2 productDefinitionTemplate +#define CDI_KEY_TYPEOFPROCESSEDDATA 805 // GRIB2 typeOfProcessedData +#define CDI_KEY_SHAPEOFTHEEARTH 806 // GRIB2 shapeOfTheEarth +#define CDI_KEY_BACKGROUNDPROCESS 807 // GRIB2 backgroundProcess +#define CDI_KEY_TYPEOFENSEMBLEFORECAST 808 // GRIB2 typeOfEnsembleForecast +#define CDI_KEY_NUMBEROFFORECASTSINENSEMBLE 809 // GRIB2 numberOfForecastsInEnsemble +#define CDI_KEY_PERTURBATIONNUMBER 810 // GRIB2 perturbationNumber +#define CDI_KEY_CENTRE 811 // GRIB2 centre +#define CDI_KEY_SUBCENTRE 812 // GRIB2 subCentre +#define CDI_KEY_MPIMTYPE 813 // GRIB2 mpimType +#define CDI_KEY_MPIMCLASS 814 // GRIB2 mpimClass +#define CDI_KEY_MPIMUSER 815 // GRIB2 mpimUser +#define CDI_KEY_REVSTATUS 816 // GRIB2 revStatus +#define CDI_KEY_REVNUMBER 817 // GRIB2 revNumber +#define CDI_KEY_GRIB2LOCALSECTIONNUMBER 818 // GRIB2 grib2LocalSectionNumber +#define CDI_KEY_SECTION2PADDINGLENGTH 819 // GRIB2 length of section2Padding +#define CDI_KEY_SECTION2PADDING 820 // GRIB2 section2Padding +#define CDI_KEY_CONSTITUENTTYPE 821 // GRIB2 constituentType +#define CDI_KEY_TYPEOFTIMEINCREMENT 822 // GRIB2 typeOfTimeIncrement +#define CDI_KEY_TYPEOFFIRSTFIXEDSURFACE 823 // GRIB2 typeOfFirstFixedSurface +#define CDI_KEY_TYPEOFSECONDFIXEDSURFACE 824 // GRIB2 typeOfSecondFixedSurface +#define CDI_KEY_UVRELATIVETOGRID 825 // GRIB uvRelativeToGrid +#define CDI_KEY_SCANNINGMODE 826 // GRIB scanningMode + +#define CDI_KEY_VDIMNAME 920 // Vertex dimension name +#define CDI_KEY_GRIDMAP_VARTYPE 921 // Grid mapping var datatype +#define CDI_KEY_GRIDMAP_VARNAME 922 // Grid mapping var name +#define CDI_KEY_GRIDMAP_NAME 923 // Grid mapping name + +// cdiDefKeyInt: Define an integer value from a key +int cdiDefKeyInt(int cdiID, int varID, int key, int value); + +// cdiInqKeyInt: Get an integer value from a key +int cdiInqKeyInt(int cdiID, int varID, int key, int *value); + +// cdiDefKeyFloat: Define a float value from a key +int cdiDefKeyFloat(int cdiID, int varID, int key, double value); + +// cdiInqKeyFloat Get a float value from a key +int cdiInqKeyFloat(int cdiID, int varID, int key, double *value); + +// cdiDefKeyBytes: Define a byte array from a key +int cdiDefKeyBytes(int cdiID, int varID, int key, const unsigned char bytes[], int length); + +// cdiInqKeyBytes: Get a byte array from a key +int cdiInqKeyBytes(int cdiID, int varID, int key, unsigned char bytes[], int *length); + +// cdiDefKeyString: Define a string from a key +int cdiDefKeyString(int cdiID, int varID, int key, const char *string); + +// cdiInqKeyString: Get a string from a key +int cdiInqKeyString(int cdiID, int varID, int key, char *string, int *length); + +// cdiInqKeyLen: Get the length of the string representation of the key +int cdiInqKeyLen(int cdiID, int varID, int key, int *length); + +int cdiCopyKeys(int cdiID1, int varID1, int cdiID2, int varID2); + +int cdiCopyKey(int cdiID1, int varID1, int key, int cdiID2); + +int cdiDeleteKey(int cdiID, int varID, int key); + +// GRID routines + +// gridDefXname: Define the name of a X-axis +void gridDefXname(int gridID, const char *xname); + +// gridInqXname: Get the name of a X-axis +void gridInqXname(int gridID, char *xname); + +// gridDefXlongname: Define the longname of a X-axis +void gridDefXlongname(int gridID, const char *xlongname); + +// gridInqXlongname: Get the longname of a X-axis +void gridInqXlongname(int gridID, char *xlongname); + +// gridDefXunits: Define the units of a X-axis +void gridDefXunits(int gridID, const char *xunits); + +// gridInqXunits: Get the units of a X-axis +void gridInqXunits(int gridID, char *xunits); + +// gridDefYname: Define the name of a Y-axis +void gridDefYname(int gridID, const char *yname); + +// gridInqYname: Get the name of a Y-axis +void gridInqYname(int gridID, char *yname); + +// gridDefYlongname: Define the longname of a Y-axis +void gridDefYlongname(int gridID, const char *ylongname); + +// gridInqYlongname: Get the longname of a Y-axis +void gridInqYlongname(int gridID, char *ylongname); + +// gridDefYunits: Define the units of a Y-axis +void gridDefYunits(int gridID, const char *yunits); + +// gridInqYunits: Get the units of a Y-axis +void gridInqYunits(int gridID, char *yunits); + +void gridDefDatatype(int gridID, int datatype); +int gridInqDatatype(int gridID); + +// gridInqXval: Get one value of a X-axis +double gridInqXval(int gridID, SizeType index); + +// gridInqYval: Get one value of a Y-axis +double gridInqYval(int gridID, SizeType index); + +double gridInqXinc(int gridID); +double gridInqYinc(int gridID); + +int gridIsCircular(int gridID); + +int gridInqTrunc(int gridID); +void gridDefTrunc(int gridID, int trunc); + +// Reference of an unstructured grid + +// gridDefNumber: Define the reference number for an unstructured grid +void gridDefNumber(int gridID, int number); + +// gridInqNumber: Get the reference number to an unstructured grid +int gridInqNumber(int gridID); + +// gridDefPosition: Define the position of grid in the reference file +void gridDefPosition(int gridID, int position); + +// gridInqPosition: Get the position of grid in the reference file +int gridInqPosition(int gridID); + +// gridDefReference: Define the reference URI for an unstructured grid +void gridDefReference(int gridID, const char *reference); + +// gridInqReference: Get the reference URI to an unstructured grid +int gridInqReference(int gridID, char *reference); + +// gridDefUUID: Define the UUID of an unstructured grid +void gridDefUUID(int gridID, const unsigned char uuid[CDI_UUID_SIZE]); + +// gridInqUUID: Get the UUID of an unstructured grid +void gridInqUUID(int gridID, unsigned char uuid[CDI_UUID_SIZE]); + +// Rotated Lon/Lat grid +void gridDefParamRLL(int gridID, double xpole, double ypole, double angle); +void gridInqParamRLL(int gridID, double *xpole, double *ypole, double *angle); + +// Hexagonal GME grid +void gridDefParamGME(int gridID, int nd, int ni, int ni2, int ni3); +void gridInqParamGME(int gridID, int *nd, int *ni, int *ni2, int *ni3); + +void gridDefArea(int gridID, const double area[]); +void gridInqArea(int gridID, double area[]); +int gridHasArea(int gridID); + +// gridDefNvertex: Define the number of vertex of a Gridbox +void gridDefNvertex(int gridID, int nvertex); + +// gridInqNvertex: Get the number of vertex of a Gridbox +int gridInqNvertex(int gridID); + +// gridDefXbounds: Define the bounds of a X-axis +void gridDefXbounds(int gridID, const double xbounds[]); + +// gridInqXbounds: Get the bounds of a X-axis +SizeType gridInqXbounds(int gridID, double xbounds[]); +SizeType gridInqXboundsPart(int gridID, int start, SizeType size, double xbounds[]); +const double *gridInqXboundsPtr(int gridID); + +// gridDefYbounds: Define the bounds of a Y-axis +void gridDefYbounds(int gridID, const double ybounds[]); + +// gridInqYbounds: Get the bounds of a Y-axis +SizeType gridInqYbounds(int gridID, double ybounds[]); +SizeType gridInqYboundsPart(int gridID, int start, SizeType size, double ybounds[]); +const double *gridInqYboundsPtr(int gridID); + +void gridDefReducedPoints(int gridID, int reducedPointsSize, const int reducedPoints[]); +void gridInqReducedPoints(int gridID, int reducedPoints[]); +void gridChangeType(int gridID, int gridtype); + +void gridDefComplexPacking(int gridID, int lpack); +int gridInqComplexPacking(int gridID); + +// ZAXIS routines + +void zaxisName(int zaxistype, char *zaxisname); +const char *zaxisNamePtr(int leveltype); + +// zaxisCreate: Create a vertical Z-axis +int zaxisCreate(int zaxistype, int size); + +// zaxisDestroy: Destroy a vertical Z-axis +void zaxisDestroy(int zaxisID); + +// zaxisInqType: Get the type of a Z-axis +int zaxisInqType(int zaxisID); + +// zaxisInqSize: Get the size of a Z-axis +int zaxisInqSize(int zaxisID); + +// zaxisDuplicate: Duplicate a Z-axis +int zaxisDuplicate(int zaxisID); + +// zaxisDefLevels: Define the levels of a Z-axis +void zaxisDefLevels(int zaxisID, const double levels[]); + +// zaxisDefCvals: Define area types of a Z-axis +void zaxisDefCvals(int zaxisID, const char *cvals[], int clength); + +// zaxisInqLevels: Get all levels of a Z-axis +int zaxisInqLevels(int zaxisID, double levels[]); + +// zaxisInqCLen: Get maximal string length of character Z-axis +int zaxisInqCLen(int zaxisID); + +// zaxisInqCVals: Get all string values of a character Z-axis +int zaxisInqCVals(int zaxisID, char ***clevels); + +// zaxisDefLevel: Define one level of a Z-axis +void zaxisDefLevel(int zaxisID, int levelID, double levels); + +// zaxisInqLevel: Get one level of a Z-axis +double zaxisInqLevel(int zaxisID, int levelID); + +// zaxisDefNlevRef: Define the number of half levels of a generalized Z-axis +void zaxisDefNlevRef(int gridID, int nhlev); + +// zaxisInqNlevRef: Get the number of half levels of a generalized Z-axis +int zaxisInqNlevRef(int gridID); + +// zaxisDefNumber: Define the reference number for a generalized Z-axis +void zaxisDefNumber(int gridID, int number); + +// zaxisInqNumber: Get the reference number to a generalized Z-axis +int zaxisInqNumber(int gridID); + +// zaxisDefUUID: Define the UUID of a generalized Z-axis +void zaxisDefUUID(int zaxisID, const unsigned char uuid[CDI_UUID_SIZE]); + +// zaxisInqUUID: Get the UUID of a generalized Z-axis +void zaxisInqUUID(int zaxisID, unsigned char uuid[CDI_UUID_SIZE]); + +// zaxisDefName: Define the name of a Z-axis +void zaxisDefName(int zaxisID, const char *name_optional); + +// zaxisInqName: Get the name of a Z-axis +void zaxisInqName(int zaxisID, char *name); + +// zaxisDefLongname: Define the longname of a Z-axis +void zaxisDefLongname(int zaxisID, const char *longname_optional); + +// zaxisInqLongname: Get the longname of a Z-axis +void zaxisInqLongname(int zaxisID, char *longname); + +// zaxisDefUnits: Define the units of a Z-axis +void zaxisDefUnits(int zaxisID, const char *units_optional); + +// zaxisInqUnits: Get the units of a Z-axis +void zaxisInqUnits(int zaxisID, char *units); + +// zaxisInqStdname: Get the standard name of a Z-axis +void zaxisInqStdname(int zaxisID, char *stdname); + +void zaxisDefDatatype(int zaxisID, int datatype); +int zaxisInqDatatype(int zaxisID); + +void zaxisDefPositive(int zaxisID, int positive); +int zaxisInqPositive(int zaxisID); + +void zaxisDefScalar(int zaxisID); +int zaxisInqScalar(int zaxisID); + +void zaxisDefVct(int zaxisID, int size, const double vct[]); +void zaxisInqVct(int zaxisID, double vct[]); +int zaxisInqVctSize(int zaxisID); +const double *zaxisInqVctPtr(int zaxisID); +void zaxisDefLbounds(int zaxisID, const double lbounds[]); +int zaxisInqLbounds(int zaxisID, double lbounds_optional[]); +double zaxisInqLbound(int zaxisID, int index); +void zaxisDefUbounds(int zaxisID, const double ubounds[]); +int zaxisInqUbounds(int zaxisID, double ubounds_optional[]); +double zaxisInqUbound(int zaxisID, int index); +void zaxisDefWeights(int zaxisID, const double weights[]); +int zaxisInqWeights(int zaxisID, double weights_optional[]); +void zaxisChangeType(int zaxisID, int zaxistype); + +// TAXIS routines + +// taxisCreate: Create a Time axis +int taxisCreate(int taxistype); + +// taxisDestroy: Destroy a Time axis +void taxisDestroy(int taxisID); + +int taxisDuplicate(int taxisID); + +void taxisCopyTimestep(int taxisIDdes, int taxisIDsrc); + +void taxisDefType(int taxisID, int taxistype); +int taxisInqType(int taxisID); + +// taxisDefVdate: Define the verification date +void taxisDefVdate(int taxisID, int date); + +// taxisDefVtime: Define the verification time +void taxisDefVtime(int taxisID, int time); + +// taxisInqVdate: Get the verification date +int taxisInqVdate(int taxisID); + +// taxisInqVtime: Get the verification time +int taxisInqVtime(int taxisID); + +// taxisDefRdate: Define the reference date +void taxisDefRdate(int taxisID, int date); + +// taxisDefRtime: Define the reference time +void taxisDefRtime(int taxisID, int time); + +// taxisInqRdate: Get the reference date +int taxisInqRdate(int taxisID); + +// taxisInqRtime: Get the reference time +int taxisInqRtime(int taxisID); + +int taxisHasBounds(int taxisID); +void taxisWithBounds(int taxisID); + +void taxisDeleteBounds(int taxisID); + +void taxisDefVdateBounds(int taxisID, int vdate_lb, int vdate_ub); + +void taxisDefVtimeBounds(int taxisID, int vtime_lb, int vtime_ub); + +void taxisInqVdateBounds(int taxisID, int *vdate_lb, int *vdate_ub); + +void taxisInqVtimeBounds(int taxisID, int *vtime_lb, int *vtime_ub); + +// taxisDefCalendar: Define the calendar +void taxisDefCalendar(int taxisID, int calendar); + +// taxisInqCalendar: Get the calendar +int taxisInqCalendar(int taxisID); + +void taxisDefTunit(int taxisID, int tunit); +int taxisInqTunit(int taxisID); + +void taxisDefForecastTunit(int taxisID, int tunit); +int taxisInqForecastTunit(int taxisID); + +void taxisDefForecastPeriod(int taxisID, double fc_period); +double taxisInqForecastPeriod(int taxisID); + +void taxisDefNumavg(int taxisID, int numavg); +int taxisInqNumavg(int taxisID); + +const char *taxisNamePtr(int taxisID); +const char *tunitNamePtr(int tunitID); + + +// Institut routines + +int institutDef(int center, int subcenter, const char *name, const char *longname); +int institutInq(int center, int subcenter, const char *name, const char *longname); +int institutInqNumber(void); +int institutInqCenter(int instID); +int institutInqSubcenter(int instID); +const char *institutInqNamePtr(int instID); +const char *institutInqLongnamePtr(int instID); + +// Model routines + +int modelDef(int instID, int modelgribID, const char *name); +int modelInq(int instID, int modelgribID, const char *name); +int modelInqInstitut(int modelID) ; +int modelInqGribID(int modelID); +const char *modelInqNamePtr(int modelID); + +// Table routines + +// tableFWriteC: write table of parameters to FILE* in C language format +void tableFWriteC(FILE *ptfp, int tableID); +// tableWrite: write table of parameters to file in tabular format +void tableWrite(const char *filename, int tableID); +// tableRead: read table of parameters from file in tabular format +int tableRead(const char *tablefile); +int tableDef(int modelID, int tablenum, const char *tablename); + +const char *tableInqNamePtr(int tableID); + +int tableInq(int modelID, int tablenum, const char *tablename); +int tableInqNumber(void); + +int tableInqNum(int tableID); +int tableInqModel(int tableID); + +void tableInqEntry(int tableID, int id, int ltype, char *name, char *longname, char *units); + +// Subtype routines + +// subtypeCreate: Create a variable subtype +int subtypeCreate(int subtype); + +// Gives a textual summary of the variable subtype +void subtypePrint(int subtypeID); + +// Compares two subtype data structures +int subtypeCompare(int subtypeID1, int subtypeID2); + +// subtypeInqSize: Get the size of a subtype (e.g. no. of tiles) +int subtypeInqSize(int subtypeID); + +// subtypeInqActiveIndex: Get the currently active index of a subtype (e.g. current tile index) +int subtypeInqActiveIndex(int subtypeID); + +// subtypeDefActiveIndex: Set the currently active index of a subtype (e.g. current tile index) +void subtypeDefActiveIndex(int subtypeID, int index); + +// Generate a "query object" out of a key-value pair +subtype_query_t keyValuePair(const char *key, int value); + +// Generate an AND-combined "query object" out of two previous query objects +subtype_query_t matchAND(subtype_query_t q1, subtype_query_t q2); + +// subtypeInqSubEntry: Returns subtype entry ID for a given criterion +int subtypeInqSubEntry(int subtypeID, subtype_query_t criterion); + +// subtypeInqTile: Specialized version of subtypeInqSubEntry looking for tile/attribute pair +int subtypeInqTile(int subtypeID, int tileindex, int attribute); + +// subtypeInqAttribute: Inquire the value of a subtype attribute. Returns CDI_EINVAL if the attribute does not exist. +int subtypeInqAttribute(int subtypeID, int index, const char *key, int *outValue); + +// vlistInqVarSubtype: Return subtype ID for a given variable +int vlistInqVarSubtype(int vlistID, int varID); + +void gribapiLibraryVersion(int *major_version, int *minor_version, int *revision_version); + +// Compatibility functions for release 1.8.3 (obsolete functions) +void zaxisDefLtype(int zaxisID, int ltype); +int vlistInqVarTypeOfGeneratingProcess(int vlistID, int varID); +void vlistDefVarTypeOfGeneratingProcess(int vlistID, int varID, int typeOfGeneratingProcess); +void vlistDefVarProductDefinitionTemplate(int vlistID, int varID, int productDefinitionTemplate); + +#ifdef __cplusplus +} +#endif + +// End of fortran interface +//FINT_OFF <--- don't change or remove this line!!! + +#ifdef __cplusplus +extern "C" { +#endif + +// CDI query interface + +typedef struct +{ + int numEntries; + // Names + int numNames; + bool *namesFound; + char **names; + // Grid cell indices + int numCellidx; + bool *cellidxFound; + size_t *cellidx; + // Level indices + int numLevidx; + bool *levidxFound; + int *levidx; + // Time step indices + int numStepidx; + bool *stepidxFound; + int *stepidx; +} CdiQuery; + +CdiQuery *cdiQueryCreate(); +CdiQuery *cdiQueryClone(const CdiQuery *query); +void cdiQueryDelete(CdiQuery *query); +void cdiQuerySetNames(CdiQuery *query, int numNames, char **names); +void cdiQuerySetCellidx(CdiQuery *query, int numCellidx, size_t *cellidx); +void cdiQuerySetLevidx(CdiQuery *query, int numLevidx, int *levidx); +void cdiQuerySetStepidx(CdiQuery *query, int numStepidx, int *stepidx); +size_t cdiQueryGetCellidx(const CdiQuery *query, int index); +int cdiQueryName(CdiQuery *query, const char *name); +int cdiQueryCellidx(CdiQuery *query, size_t cellidx); +int cdiQueryLevidx(CdiQuery *query, int levidx); +int cdiQueryStepidx(CdiQuery *query, int stepidx); +int cdiQueryNumNames(const CdiQuery *query); +int cdiQueryNumCellidx(const CdiQuery *query); +int cdiQueryNumStepidx(const CdiQuery *query); +int cdiQueryNumEntries(const CdiQuery *query); +int cdiQueryNumEntriesFound(const CdiQuery *query); +void cdiQueryPrint(const CdiQuery *query); +void cdiQueryPrintEntriesNotFound(const CdiQuery *query); + +// streamOpenReadQuery: Open a dataset for reading and apply query +int streamOpenReadQuery(const char *path, CdiQuery *query); + +// CDI interface for paraview vtkCDIReader.cxx + + +// taxisDefRdatetime: Define the reference date/time +void taxisDefRdatetime(int taxisID, CdiDateTime rDateTime); +// taxisInqRdatetime: Get the reference date/time +CdiDateTime taxisInqRdatetime(int taxisID); +// taxisDefFdatetime: Define the forecast reference date/time +void taxisDefFdatetime(int taxisID, CdiDateTime fDateTime); +// taxisInqFdatetime: Get the forecast reference date/time +CdiDateTime taxisInqFdatetime(int taxisID); +// taxisDefVdatetime: Define the verification date/time +void taxisDefVdatetime(int taxisID, CdiDateTime vDateTime); +// taxisInqVdatetime: Get the verification date/time +CdiDateTime taxisInqVdatetime(int taxisID); +void taxisDefVdatetimeBounds(int taxisID, CdiDateTime vDateTime_lb, CdiDateTime vDateTime_ub); +void taxisInqVdatetimeBounds(int taxisID, CdiDateTime *vDateTime_lb, CdiDateTime *vDateTime_ub); + +// date format: YYYYMMDD +// time format: hhmmss + +int64_t date_to_julday(int calendar, int64_t date); // Used in paraview vtkCDIReader.cxx +int64_t julday_to_date(int calendar, int64_t julday); + +int time_to_sec(int time); // Used in paraview vtkCDIReader.cxx +int sec_to_time(int secofday); + +// CDI projection parameter interface + +struct CDI_GridProjParams +{ + double mv; // Missing value + double lon_0; // The East longitude of the meridian which is parallel to the Y-axis + double lat_0; // Latitude of the projection origin + double lat_1; // First latitude from the pole at which the secant cone cuts the sphere + double lat_2; // Second latitude at which the secant cone cuts the sphere + // lat_ts = lat_1; + double a; // Semi-major axis or earth radius in metres (optional) + double b; // Semi-minor axis in metres (optional) + double rf; // Inverse flattening (1/f) (optional) + double xval_0; // Longitude of the first grid point in degree (optional) + double yval_0; // Latitude of the first grid point in degree (optional) + double x_0; // False easting (optional) + double y_0; // False northing (optional) +}; + +void gridProjParamsInit(struct CDI_GridProjParams *gridProjParams); + +// Lambert Conformal Conic grid +void gridDefParamsLCC(int gridID, struct CDI_GridProjParams gridProjParams); +int gridInqParamsLCC(int gridID, struct CDI_GridProjParams *gridProjParams); + +// Polar stereographic grid +void gridDefParamsSTERE(int gridID, struct CDI_GridProjParams gridProjParams); +int gridInqParamsSTERE(int gridID, struct CDI_GridProjParams *gridProjParams); + +#define HAVE_CDI_PROJ_FUNCS 1 +extern int (*proj_lonlat_to_lcc_func)(struct CDI_GridProjParams gpp, size_t, double*, double*); +extern int (*proj_lcc_to_lonlat_func)(struct CDI_GridProjParams gpp, double, double, size_t, double*, double*); +extern int (*proj_lonlat_to_stere_func)(struct CDI_GridProjParams gpp, size_t, double*, double*); +extern int (*proj_stere_to_lonlat_func)(struct CDI_GridProjParams gpp, double, double, size_t, double*, double*); + +#ifdef __cplusplus +} +#endif + +// clang-format on + +#endif /* CDI_H_ */ +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifndef _ERROR_H_ +#define _ERROR_H_ + +// clang-format off + +#include <stdarg.h> +#include <stdlib.h> +#include <stdbool.h> + +#ifndef WITH_CALLER_NAME +#define WITH_CALLER_NAME +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +extern int _ExitOnError; // If set to 1, exit on error (default 1) +extern int _Verbose; // If set to 1, errors are reported (default 1) +extern int _Debug; // If set to 1, debuggig (default 0) + +void SysError_(const char *caller, const char *fmt, ...); +void Error_(const char *caller, const char *fmt, ...); +void Warning_(const char *caller, const char *fmt, ...); +/* delegate used by Warning_ unless mode is PIO */ +void cdiWarning(const char *caller, const char *fmt, va_list ap); +void Message_(const char *caller, const char *fmt, ...); + +#ifdef WITH_CALLER_NAME +# define SysError(...) SysError_(__func__, __VA_ARGS__) +# define Errorc(...) Error_( caller, __VA_ARGS__) +# define Error(...) Error_(__func__, __VA_ARGS__) +# define Warning(...) Warning_(__func__, __VA_ARGS__) +# define Messagec(...) Message_( caller, __VA_ARGS__) +# define Message(...) Message_(__func__, __VA_ARGS__) +#else +# define SysError(...) SysError_((void *), __VA_ARGS__) +# define Errorc(...) Error_((void *), __VA_ARGS__) +# define Error(...) Error_((void *), __VA_ARGS__) +# define Warning(...) Warning_((void *), __VA_ARGS__) +# define Messagec(...) Message_((void *), __VA_ARGS__) +# define Message(...) Message_((void *), __VA_ARGS__) +#endif + +/* If we're not using GNU C, elide __attribute__ */ +#ifndef __GNUC__ +# define __attribute__(x) /*NOTHING*/ +#endif + +void cdiAbortC(const char *caller, const char *filename, + const char *functionname, int line, + const char *errorString, ... ) + __attribute__((noreturn)); +#define xabortC(caller, ...) \ + cdiAbortC(caller, __FILE__, __func__, __LINE__, __VA_ARGS__ ) +#define xabort(...) \ + cdiAbortC(NULL, __FILE__, __func__, __LINE__, __VA_ARGS__ ) +#define cdiAbort(file, func, line, ...) \ + cdiAbortC(NULL, (file), (func), (line), __VA_ARGS__) + +#define xassert(arg) do { \ + if ((arg)) { } else { \ + xabort("assertion `" #arg "` failed");} \ + } while(0) + +void +cdiAbortC_serial(const char *caller, const char *filename, + const char *functionname, int line, + const char *errorString, va_list ap) + __attribute__((noreturn)); + + +bool cdiObsoleteInfo(const char *oldFunction, const char *newFunction); + +#if defined (__cplusplus) +} +#endif + +// clang-format on + +#endif /* _ERROR_H_ */ +#ifdef HAVE_CONFIG_H +#endif + +#ifdef HAVE_LIBPTHREAD +#include <pthread.h> +#endif + + + +#include <stdbool.h> + +#ifdef HAVE_LIBPTHREAD +#ifdef __APPLE__ +#include <dispatch/dispatch.h> +#else +#include <errno.h> +#include <semaphore.h> +#endif + +typedef struct sema +{ +#ifdef __APPLE__ + dispatch_semaphore_t sem; +#else + sem_t sem; +#endif +} sema_t; +#endif + +struct AsyncJob +{ + bool inUse; +#ifdef HAVE_LIBPTHREAD + sema_t request, completion; +#endif + int (*work)(void *data); + void *data; + int result; +}; + +struct AsyncManager +{ + int workerCount, idleWorkerCount; + AsyncJob *communicators; +}; + +#ifdef HAVE_LIBPTHREAD +static inline int +sema_init(sema_t *s, int pshared, uint32_t value) +{ + int status = 0; +#ifdef __APPLE__ + dispatch_semaphore_t *sem = &s->sem; + + (void) pshared; + *sem = dispatch_semaphore_create(value); +#else + status = sem_init(&s->sem, pshared, value); +#endif + return status; +} + +static inline int +sema_wait(sema_t *s) +{ +#ifdef __APPLE__ + dispatch_semaphore_wait(s->sem, DISPATCH_TIME_FOREVER); +#else + int r; + + do + { + r = sem_wait(&s->sem); + } + while (r == -1 && errno == EINTR); +#endif + return 0; +} + +static inline int +sema_post(sema_t *s) +{ +#ifdef __APPLE__ + dispatch_semaphore_signal(s->sem); +#else + sem_post(&s->sem); +#endif + return 0; +} + +static void * +workerMain(void *arg) +{ + AsyncJob *communicator = (AsyncJob *) arg; + + while (true) + { + while (sema_wait(&communicator->request)) + ; + if (communicator->work) + { + communicator->result = communicator->work(communicator->data); + if (sema_post(&communicator->completion)) xabort("sema_post() failed"); + } + else + { + if (sema_post(&communicator->completion)) xabort("sema_post() failed"); + break; + } + } + + return NULL; +} + +static void +startWorker(AsyncJob *communicator) +{ + communicator->inUse = false; + communicator->work = NULL; + communicator->data = NULL; + communicator->result = 0; + if (sema_init(&communicator->request, 0, 0)) xabort("sema_init() failed"); + if (sema_init(&communicator->completion, 0, 0)) xabort("sema_init() failed"); + + pthread_t worker; + if (pthread_create(&worker, NULL, workerMain, communicator)) xabort("pthread_create() failed"); + if (pthread_detach(worker)) xabort("pthread_detach() failed"); +} +#endif + +int +AsyncWorker_init(AsyncManager **jobManager, int threadCount) +{ + if (threadCount <= 0) + { + xabort("CPU core count discovery not implemented yet"); + return CDI_EINVAL; // TODO: discover CPU core count, and set threadCount to a sensible positive value + } + + if (*jobManager) return CDI_NOERR; + +#ifdef HAVE_LIBPTHREAD + *jobManager = (AsyncManager *) malloc(sizeof(AsyncManager)); + if (!*jobManager) return CDI_ESYSTEM; + (*jobManager)->workerCount = threadCount; + (*jobManager)->communicators = (AsyncJob *) malloc(threadCount * sizeof(AsyncJob)); + if (!(*jobManager)->communicators) xabort("memory allocation failure"); + + for (int i = 0; i < threadCount; i++) startWorker(&((*jobManager)->communicators[i])); + (*jobManager)->idleWorkerCount = threadCount; +#else + + Error("pthread support not compiled in!"); +#endif + + return CDI_NOERR; +} + +AsyncJob * +AsyncWorker_requestWork(AsyncManager *jobManager, int (*work)(void *data), void *data) +{ + if (!jobManager) xabort("AsyncWorker_requestWork() called without calling AsyncWorker_init() first"); + if (!work) + xabort("AsyncWorker_requestWork() called without a valid function pointer"); // need to catch this condition to stop users from + // terminating our worker threads + + // find an unused worker + if (!jobManager->idleWorkerCount) return NULL; + + AsyncJob *worker = NULL; + for (int i = 0; i < jobManager->workerCount; i++) + { + if (!jobManager->communicators[i].inUse) + { + worker = &jobManager->communicators[i]; + break; + } + } + if (!worker) xabort("internal error: idleWorkerCount is not in sync with the worker states, please report this bug"); + + // pass the request to that worker + jobManager->idleWorkerCount--; + worker->inUse = true; + worker->work = work; + worker->data = data; + worker->result = 0; +#ifdef HAVE_LIBPTHREAD + if (sema_post(&worker->request)) xabort("sema_post() failed"); +#endif + return worker; +} + +int +AsyncWorker_wait(AsyncManager *jobManager, AsyncJob *job) +{ + if (!jobManager) xabort("AsyncWorker_wait() called without calling AsyncWorker_init() first"); + if (job < jobManager->communicators) return CDI_EINVAL; + if (job >= jobManager->communicators + jobManager->workerCount) return CDI_EINVAL; + if (!job->inUse) return CDI_EINVAL; + +#ifdef HAVE_LIBPTHREAD + while (sema_wait(&job->completion)) + ; +#endif + int result = job->result; + + // reset the communicator + job->work = NULL; + job->data = NULL; + job->result = 0; + job->inUse = false; + jobManager->idleWorkerCount++; + + return result; +} + +int +AsyncWorker_availableWorkers(AsyncManager *jobManager) +{ + if (!jobManager) return 0; + return jobManager->idleWorkerCount; +} + +int +AsyncWorker_finalize(AsyncManager *jobManager) +{ + int result = CDI_NOERR; + if (!jobManager) return CDI_NOERR; + + for (int i = 0; i < jobManager->workerCount; i++) + { + AsyncJob *curWorker = &jobManager->communicators[i]; + + // finish any pending job + if (curWorker->inUse) + { + AsyncWorker_wait(jobManager, curWorker); + if (curWorker->result) result = curWorker->result; + } + + // send the teardown signal + curWorker->inUse = true; + curWorker->work = NULL; + curWorker->data = NULL; + curWorker->result = 0; +#ifdef HAVE_LIBPTHREAD + if (sema_post(&curWorker->request)) xabort("sema_post() failed"); +#endif + // wait for the worker to exit + AsyncWorker_wait(jobManager, curWorker); + } + + free(jobManager->communicators); + free(jobManager); + + return result; +} +#ifndef _BASETIME_H +#define _BASETIME_H + +#include <stdbool.h> + +typedef struct +{ + int ncvarid; + int ncdimid; + int ncvarboundsid; + int leadtimeid; + bool hasUnits; + bool isWRF; // true for time axis in WRF format +} basetime_t; + +void basetimeInit(basetime_t *basetime); + +#endif /* _BASETIME_H */ +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#include <stddef.h> // for NULL + +void +basetimeInit(basetime_t *basetime) +{ + if (basetime == NULL) Error("Internal problem! Basetime not allocated."); + + if (basetime) + { + basetime->ncvarid = CDI_UNDEFID; + basetime->ncdimid = CDI_UNDEFID; + basetime->ncvarboundsid = CDI_UNDEFID; + basetime->leadtimeid = CDI_UNDEFID; + basetime->hasUnits = false; + basetime->isWRF = false; + } +} + +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifndef _FILE_H +#define _FILE_H + +#include <stdio.h> +#include <sys/types.h> + +#define FILE_UNDEFID -1 + +#define FILE_TYPE_OPEN 1 +#define FILE_TYPE_FOPEN 2 + +// buffer types for FILE_TYPE_OPEN +#define FILE_BUFTYPE_STD 1 +#define FILE_BUFTYPE_MMAP 2 + +const char *fileLibraryVersion(void); + +void fileDebug(int debug); + +void *filePtr(int fileID); + +int fileSetBufferType(int fileID, int type); +void fileSetBufferSize(int fileID, long buffersize); + +int fileOpen(const char *filename, const char *mode); +int fileOpen_serial(const char *filename, const char *mode); +int fileClose(int fileID); +int fileClose_serial(int fileID); + +char *fileInqName(int fileID); +int fileInqMode(int fileID); + +int fileFlush(int fileID); +void fileClearerr(int fileID); +int fileEOF(int fileID); +int filePtrEOF(void *fileptr); +void fileRewind(int fileID); + +off_t fileGetPos(int fileID); +int fileSetPos(int fileID, off_t offset, int whence); + +int fileGetc(int fileID); +int filePtrGetc(void *fileptr); + +size_t filePtrRead(void *fileptr, void *restrict ptr, size_t size); +size_t fileRead(int fileID, void *restrict ptr, size_t size); +size_t fileWrite(int fileID, const void *restrict ptr, size_t size); + +#endif /* _FILE_H */ +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifndef SWAP_H_ +#define SWAP_H_ + +void swap4byte(void *ptr, size_t size); +void swap8byte(void *ptr, size_t size); + +#endif + +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifndef DTYPES_H +#define DTYPES_H + +#include <stdio.h> +#include <limits.h> + +/* INT32 */ + +#ifndef INT_MAX +#error INT_MAX undefined +#endif + +#undef INT32 +#if INT_MAX == 2147483647L +#define INT32 int +#elif LONG_MAX == 2147483647L +#define INT32 long +#endif + +/* INT64 */ + +#ifndef LONG_MAX +#error LONG_MAX undefined +#endif + +#undef INT64 +#if LONG_MAX > 2147483647L +#define INT64 long +#else +#define INT64 long long +#endif + +/* FLT32 */ + +#undef FLT32 +#define FLT32 float + +/* FLT64 */ + +#undef FLT64 +#define FLT64 double + +/* UINT32 and UINT64 */ + +#define UINT32 unsigned INT32 +#define UINT64 unsigned INT64 + +#endif /* DTYPES_H */ +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifndef BINARY_H +#define BINARY_H + +#ifdef HAVE_CONFIG_H +#endif + +#include <inttypes.h> + + +#ifndef HOST_ENDIANNESS +#ifdef __cplusplus +static const uint32_t HOST_ENDIANNESS_temp[1] = { UINT32_C(0x00030201) }; +#define HOST_ENDIANNESS (((const unsigned char *) HOST_ENDIANNESS_temp)[0]) +#else +#define HOST_ENDIANNESS (((const unsigned char *) &(const uint32_t[1]){ UINT32_C(0x00030201) })[0]) +#endif +#endif + +UINT32 get_UINT32(unsigned char *x); +UINT32 get_SUINT32(unsigned char *x); +UINT64 get_UINT64(unsigned char *x); +UINT64 get_SUINT64(unsigned char *x); + +size_t binReadF77Block(int fileID, int byteswap); +void binWriteF77Block(int fileID, int byteswap, size_t blocksize); + +int binReadInt32(int fileID, int byteswap, size_t size, INT32 *ptr); +int binReadInt64(int fileID, int byteswap, size_t size, INT64 *ptr); + +int binWriteInt32(int fileID, int byteswap, size_t size, INT32 *ptr); +int binWriteInt64(int fileID, int byteswap, size_t size, INT64 *ptr); + +int binWriteFlt32(int fileID, int byteswap, size_t size, FLT32 *ptr); +int binWriteFlt64(int fileID, int byteswap, size_t size, FLT64 *ptr); + +#endif /* BINARY_H */ +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ + +UINT32 +get_UINT32(unsigned char *x) +{ + // clang-format off + switch (HOST_ENDIANNESS) + { + case CDI_BIGENDIAN: + return (((UINT32)x[0])<<24) + (((UINT32)x[1])<<16) + (((UINT32)x[2])<< 8) + (UINT32)x[3]; + case CDI_LITTLEENDIAN: + return (((UINT32)x[3])<<24) + (((UINT32)x[2])<<16) + (((UINT32)x[1])<< 8) + (UINT32)x[0]; + default: + Error("Unhandled endianness %d", HOST_ENDIANNESS); + return UINT32_C(0xFFFFFFFF); + } + // clang-format on +} + +UINT32 +get_SUINT32(unsigned char *x) +{ + // clang-format off + switch (HOST_ENDIANNESS) + { + case CDI_BIGENDIAN: + return (((UINT32)x[3])<<24) + (((UINT32)x[2])<<16) + (((UINT32)x[1])<< 8) + (UINT32)x[0]; + case CDI_LITTLEENDIAN: + return (((UINT32)x[0])<<24) + (((UINT32)x[1])<<16) + (((UINT32)x[2])<< 8) + (UINT32)x[3]; + default: + Error("Unhandled endianness %d", HOST_ENDIANNESS); + return UINT32_C(0xFFFFFFFF); + } + // clang-format on +} + +UINT64 +get_UINT64(unsigned char *x) +{ + // clang-format off + switch (HOST_ENDIANNESS) + { + case CDI_BIGENDIAN: + return (((UINT64)x[0])<<56) + (((UINT64)x[1])<<48) + (((UINT64)x[2])<<40) + (((UINT64)x[3])<<32) + + (((UINT64)x[4])<<24) + (((UINT64)x[5])<<16) + (((UINT64)x[6])<< 8) + (UINT64)x[7]; + case CDI_LITTLEENDIAN: + return (((UINT64)x[7])<<56) + (((UINT64)x[6])<<48) + (((UINT64)x[5])<<40) + (((UINT64)x[4])<<32) + + (((UINT64)x[3])<<24) + (((UINT64)x[2])<<16) + (((UINT64)x[1])<< 8) + (UINT64)x[0]; + default: + Error("Unhandled endianness %d", HOST_ENDIANNESS); + return UINT64_C(0xFFFFFFFFFFFFFFFF); + } + // clang-format on +} + +UINT64 +get_SUINT64(unsigned char *x) +{ + // clang-format off + switch (HOST_ENDIANNESS) + { + case CDI_BIGENDIAN: + return (((UINT64)x[7])<<56) + (((UINT64)x[6])<<48) + (((UINT64)x[5])<<40) + (((UINT64)x[4])<<32) + + (((UINT64)x[3])<<24) + (((UINT64)x[2])<<16) + (((UINT64)x[1])<< 8) + (UINT64)x[0]; + case CDI_LITTLEENDIAN: + return (((UINT64)x[0])<<56) + (((UINT64)x[1])<<48) + (((UINT64)x[2])<<40) + (((UINT64)x[3])<<32) + + (((UINT64)x[4])<<24) + (((UINT64)x[5])<<16) + (((UINT64)x[6])<< 8) + (UINT64)x[7]; + default: + Error("Unhandled endianness %d", HOST_ENDIANNESS); + return UINT64_C(0xFFFFFFFFFFFFFFFF); + } + // clang-format on +} + +size_t +binReadF77Block(int fileID, int byteswap) +{ + unsigned char f77block[4]; + size_t blocklen = 0; + + if (fileRead(fileID, f77block, 4) == 4) + { + blocklen = byteswap ? get_SUINT32(f77block) : get_UINT32(f77block); + } + + return blocklen; +} + +void +binWriteF77Block(int fileID, int byteswap, size_t blocksize) +{ + static const unsigned int s[4] = { 0, 8, 16, 24 }; + const unsigned long ublocksize = (unsigned long) blocksize; + unsigned char f77block[4]; + + switch (HOST_ENDIANNESS) + { + case CDI_BIGENDIAN: + if (byteswap) + { + for (int i = 0; i <= 3; ++i) f77block[i] = (unsigned char) (ublocksize >> s[i]); + } + else + { + for (int i = 0; i <= 3; ++i) f77block[3 - i] = (unsigned char) (ublocksize >> s[i]); + } + break; + case CDI_LITTLEENDIAN: + if (byteswap) + { + for (int i = 0; i <= 3; ++i) f77block[3 - i] = (unsigned char) (ublocksize >> s[i]); + } + else + { + for (int i = 0; i <= 3; ++i) f77block[i] = (unsigned char) (ublocksize >> s[i]); + } + break; + default: Error("Unhandled endianness %d", HOST_ENDIANNESS); + } + + if (fileWrite(fileID, f77block, 4) != 4) Error("Write failed on %s", fileInqName(fileID)); +} + +int +binReadInt32(int fileID, int byteswap, size_t size, INT32 *ptr) +{ + if (sizeof(INT32) != 4) Error("Not implemented for %d byte integer!", sizeof(INT32)); + + fileRead(fileID, (void *) ptr, 4 * size); + if (byteswap) swap4byte(ptr, size); + + return 0; +} + +int +binReadInt64(int fileID, int byteswap, size_t size, INT64 *ptr) +{ + if (sizeof(INT64) != 8) Error("Not implemented for %d byte integer!", sizeof(INT64)); + + fileRead(fileID, (void *) ptr, 8 * size); + if (byteswap) swap8byte(ptr, size); + + return 0; +} + +int +binWriteInt32(int fileID, int byteswap, size_t size, INT32 *ptr) +{ + if (sizeof(INT32) != 4) Error("Not implemented for %d byte integer!", sizeof(INT32)); + + if (byteswap) swap4byte(ptr, size); + fileWrite(fileID, (void *) ptr, 4 * size); + + return 0; +} + +int +binWriteInt64(int fileID, int byteswap, size_t size, INT64 *ptr) +{ + if (sizeof(INT64) != 8) Error("Not implemented for %d byte integer!", sizeof(INT64)); + + if (byteswap) swap8byte(ptr, size); + fileWrite(fileID, (void *) ptr, 8 * size); + + return 0; +} + +int +binWriteFlt32(int fileID, int byteswap, size_t size, FLT32 *ptr) +{ + if (sizeof(FLT32) != 4) Error("Not implemented for %d byte float!", sizeof(FLT32)); + + if (byteswap) swap4byte(ptr, size); + fileWrite(fileID, (void *) ptr, 4 * size); + + return 0; +} + +int +binWriteFlt64(int fileID, int byteswap, size_t size, FLT64 *ptr) +{ + if (sizeof(FLT64) != 8) Error("Not implemented for %d byte float!", sizeof(FLT64)); + + if (byteswap) swap8byte(ptr, size); + fileWrite(fileID, (void *) ptr, 8 * size); + + return 0; +} +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifndef CALENDAR_H +#define CALENDAR_H + +#include <stdint.h> // int64_t + +// clang-format off + + +#ifdef __cplusplus +extern "C" { +#endif + +void decode_calday(int daysPerYear, int days, int *year, int *month, int *day); +int64_t encode_calday(int daysPerYear, int year, int month, int day); + +static inline int +calendar_dpy(int calendar) +{ + int daysPerYear = 0; + + if (calendar == CALENDAR_360DAYS) daysPerYear = 360; + else if (calendar == CALENDAR_365DAYS) daysPerYear = 365; + else if (calendar == CALENDAR_366DAYS) daysPerYear = 366; + + return daysPerYear; +} + +int days_per_year(int calendar, int year); +int days_per_month(int calendar, int year, int month); + +#ifdef __cplusplus +} +#endif + +// clang-format on + +#endif +#include <stdio.h> + + +static const int month_360[12] = { 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30 }; +static const int month_365[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; +static const int month_366[12] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; + +static const int * +get_dayspermonth_array(int daysPerYear) +{ + // clang-format off + return (daysPerYear == 360) ? month_360 : + (daysPerYear == 365) ? month_365 : + (daysPerYear == 366) ? month_366 : NULL; + // clang-format on +} + +int +days_per_month(int calendar, int year, int month) +{ + const int daysPerYear = calendar_dpy(calendar); + const int *daysPerMonthArray = (daysPerYear == 360) ? month_360 : ((daysPerYear == 365) ? month_365 : month_366); + + int daysPerMonth = (month >= 1 && month <= 12) ? daysPerMonthArray[month - 1] : 0; + + if (daysPerYear == 0 && month == 2) daysPerMonth = ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) ? 29 : 28; + + return daysPerMonth; +} + +int +days_per_year(int calendar, int year) +{ + int daysPerYear = calendar_dpy(calendar); + if (daysPerYear == 0) + { + if (year == 1582 && (calendar == CALENDAR_STANDARD || calendar == CALENDAR_GREGORIAN)) + daysPerYear = 355; + else if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) + daysPerYear = 366; + else + daysPerYear = 365; + } + + return daysPerYear; +} + +void +decode_calday(int daysPerYear, int days, int *year, int *month, int *day) +{ + *year = (days - 1) / daysPerYear; + days -= (*year * daysPerYear); + + const int *daysPerMonthArray = get_dayspermonth_array(daysPerYear); + + int i = 0; + if (daysPerMonthArray) + for (i = 0; i < 12; i++) + { + if (days > daysPerMonthArray[i]) + days -= daysPerMonthArray[i]; + else + break; + } + + *month = i + 1; + *day = days; +} + +int64_t +encode_calday(int daysPerYear, int year, int month, int day) +{ + int64_t rval = (int64_t) daysPerYear * year + day; + + const int *daysPerMonthArray = get_dayspermonth_array(daysPerYear); + + if (daysPerMonthArray) + for (int i = 0; i < month - 1; i++) rval += daysPerMonthArray[i]; + + return rval; +} +#ifndef CDF_H +#define CDF_H + +void cdfDebug(int debug); + +extern int CDF_Debug; + +const char *cdfLibraryVersion(void); +const char *hdfLibraryVersion(void); + +int cdfOpen(const char *filename, const char *mode, int filetype); +int cdf4Open(const char *filename, const char *mode, int *filetype); +void cdfClose(int fileID); + +#endif /* CDF_H */ +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifndef CDF_CONFIG_H_ +#define CDF_CONFIG_H_ + +#ifdef HAVE_CONFIG_H +#endif + +#ifdef HAVE_LIBNETCDF + +#include <netcdf.h> + +#ifdef NC_FORMAT_64BIT_DATA +#define HAVE_NETCDF5 1 +#endif + +#endif + +#endif +#ifndef JULIAN_DATE_H +#define JULIAN_DATE_H + + +// clang-format off + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct +{ + int64_t julianDay; + double secondOfDay; +} JulianDate; + +JulianDate julianDate_encode(int calendar, CdiDateTime dt); +CdiDateTime julianDate_decode(int calendar, JulianDate julianDate); +JulianDate julianDate_add_seconds(JulianDate julianDate, int64_t seconds); +JulianDate julianDate_add(JulianDate julianDate1, JulianDate julianDate2); +JulianDate julianDate_sub(JulianDate julianDate1, JulianDate julianDate2); +double julianDate_to_seconds(JulianDate julianDate); + +double secofday_encode(CdiTime time); +CdiTime secofday_decode(double secondOfDay); + +#ifdef __cplusplus +} +#endif + +// clang-format on + +#endif /* JULIAN_DATE_H */ +#ifndef RESOURCE_HANDLE_H +#define RESOURCE_HANDLE_H + +#ifdef HAVE_CONFIG_H +#endif + +#include <stdio.h> + +/* + * CDI internal handling of resource handles given to user code + */ + +/* + * for reasons of compatibility with cfortran.h, the handle type is: int + */ +typedef int cdiResH; + +/* return 0 on equality, not 0 otherwise */ +typedef int (*valCompareFunc)(void *, void *); +typedef void (*valDestroyFunc)(void *); +typedef void (*valPrintFunc)(void *, FILE *); +typedef int (*valGetPackSizeFunc)(void *, void *context); +typedef void (*valPackFunc)(void *, void *buf, int size, int *pos, void *context); +typedef int (*valTxCodeFunc)(void *); + +typedef struct +{ + valCompareFunc valCompare; + valDestroyFunc valDestroy; + valPrintFunc valPrint; + valGetPackSizeFunc valGetPackSize; + valPackFunc valPack; + valTxCodeFunc valTxCode; +} resOps; + +enum +{ + RESH_IN_USE_BIT = 1 << 0, + RESH_SYNC_BIT = 1 << 1, + /* resource holds no value */ + RESH_UNUSED = 0, + /* resource was deleted and needs to be synced */ + RESH_DESYNC_DELETED = RESH_SYNC_BIT, + /* resource is synchronized */ + RESH_IN_USE = RESH_IN_USE_BIT, + /* resource is in use, desynchronized and needs to be synced */ + RESH_DESYNC_IN_USE = RESH_IN_USE_BIT | RESH_SYNC_BIT, +}; + +void reshListCreate(int namespaceID); +void reshListDestruct(int namespaceID); +int reshPut(void *, const resOps *); +void reshReplace(cdiResH resH, void *p, const resOps *ops); +void reshRemove(cdiResH, const resOps *); +/*> doesn't check resource type */ +void reshDestroy(cdiResH); + +unsigned reshCountType(const resOps *resTypeOps); + +void *reshGetValue(const char *caller, const char *expressionString, cdiResH id, const resOps *ops); +#define reshGetVal(resH, ops) reshGetValue(__func__, #resH, resH, ops) + +void reshGetResHListOfType(unsigned numIDs, int IDs[], const resOps *ops); + +enum cdiApplyRet +{ + CDI_APPLY_ERROR = -1, + CDI_APPLY_STOP, + CDI_APPLY_GO_ON, +}; +enum cdiApplyRet cdiResHApply(enum cdiApplyRet (*func)(int id, void *res, const resOps *p, void *data), void *data); +enum cdiApplyRet cdiResHFilterApply(const resOps *p, enum cdiApplyRet (*func)(int id, void *res, void *data), void *data); + +int reshPackBufferCreate(char **packBuf, int *packBufSize, void *context); +void reshPackBufferDestroy(char **); +int reshResourceGetPackSize_intern(int resh, const resOps *ops, void *context, const char *caller, const char *expressionString); +#define reshResourceGetPackSize(resh, ops, context) reshResourceGetPackSize_intern(resh, ops, context, __func__, #resh) +void reshPackResource_intern(int resh, const resOps *ops, void *buf, int buf_size, int *position, void *context, const char *caller, + const char *expressionString); +#define reshPackResource(resh, ops, buf, buf_size, position, context) \ + reshPackResource_intern(resh, ops, buf, buf_size, position, context, __func__, #resh) + +void reshSetStatus(cdiResH, const resOps *, int); +int reshGetStatus(cdiResH, const resOps *); + +void reshLock(void); +void reshUnlock(void); + +enum reshListMismatch +{ + cdiResHListOccupationMismatch, + cdiResHListResourceTypeMismatch, + cdiResHListResourceContentMismatch, +}; + +int reshListCompare(int nsp0, int nsp1); +void reshListPrint(FILE *fp); +int reshGetTxCode(cdiResH resH); + +#endif +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifndef TAXIS_H +#define TAXIS_H + +#include <stdbool.h> + +#ifndef RESOURCE_HANDLE_H +#endif + +typedef struct +{ + int self; + int datatype; // datatype + int type; // time type + int calendar; + int unit; // time units + int numavg; + CdiDateTime sDateTime; // start date/time + CdiDateTime vDateTime; // verification date/time + CdiDateTime rDateTime; // reference date/time + CdiDateTime fDateTime; // forecast reference date/time + CdiDateTime vDateTime_lb; // lower bounds of verification date/time + CdiDateTime vDateTime_ub; // upper bounds of verification date/time + double fc_period; // forecast time period + int fc_unit; // forecast time unit + char *name; + char *longname; + char *units; + bool climatology; + bool hasBounds; +} taxis_t; + +// taxisInqSdatetime: Get the start date/time +CdiDateTime taxisInqSdatetime(int taxisID); + +void ptaxisInit(taxis_t *taxis); +void ptaxisCopy(taxis_t *dest, taxis_t *source); +taxis_t *taxisPtr(int taxisID); +void cdi_set_forecast_period(double timevalue, taxis_t *taxis); +CdiDateTime cdi_decode_timeval(double timevalue, const taxis_t *taxis); +double cdi_encode_timeval(CdiDateTime datetime, taxis_t *taxis); + +void ptaxisDefDatatype(taxis_t *taxisptr, int datatype); +void ptaxisDefName(taxis_t *taxisptr, const char *name); +void ptaxisDefLongname(taxis_t *taxisptr, const char *longname); +void ptaxisDefUnits(taxis_t *taxisptr, const char *units); +char *ptaxisAllocUnits(taxis_t *taxisptr, size_t len); +void taxisDestroyKernel(taxis_t *taxisptr); +#ifndef SX +extern const resOps taxisOps; +#endif + +int taxisUnpack(char *unpackBuffer, int unpackBufferSize, int *unpackBufferPos, int originNamespace, void *context, + int checkForSameID); + +enum +{ + TAXIS_MAX_UNIT_STR_LEN = 9 +}; + +#endif /* TAXIS_H */ +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifndef CDI_LIMITS_H +#define CDI_LIMITS_H + +#define MAX_DIMENSIONS 5 // maximum number of dimensions per variable +#define MAX_DIMS_PS 16 // maximum number of dimensions per stream +#define MAX_GRIDS_PS 128 // maximum number of different grids per stream +#define MAX_ZAXES_PS 128 // maximum number of different zaxes per stream +#define MAX_ATTRIBUTES 256 // maximum number of attributes per variable +#define MAX_KEYS 64 // maximum number of keys per variable +#define MAX_SUBTYPES_PS 128 // maximum number of different subtypes per stream + +#endif /* CDI_LIMITS_H */ +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifndef _SERVICE_H +#define _SERVICE_H + +typedef struct +{ + int checked; + int byteswap; + int header[8]; + int hprec; /* header precision */ + int dprec; /* data precision */ + size_t datasize; + size_t buffersize; + void *buffer; +} srvrec_t; + +const char *srvLibraryVersion(void); + +void srvDebug(int debug); + +int srvCheckFiletype(int fileID, int *swap); + +void *srvNew(void); +void srvDelete(void *srv); + +int srvRead(int fileID, void *srv); +void srvWrite(int fileID, void *srv); + +int srvInqHeader(void *srv, int *header); +int srvInqDataSP(void *srv, float *data); +int srvInqDataDP(void *srv, double *data); + +int srvDefHeader(void *srv, const int *header); +int srvDefDataSP(void *srv, const float *data); +int srvDefDataDP(void *srv, const double *data); + +#endif /* _SERVICE_H */ +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifndef _EXTRA_H +#define _EXTRA_H + +#define EXT_REAL 1 +#define EXT_COMP 2 + +typedef struct +{ + int checked; + int byteswap; + int header[4]; + int prec; /* single or double precison */ + int number; /* real or complex */ + size_t datasize; + size_t buffersize; + void *buffer; +} extrec_t; + +const char *extLibraryVersion(void); + +void extDebug(int debug); + +int extCheckFiletype(int fileID, int *swap); + +void *extNew(void); +void extDelete(void *ext); + +int extRead(int fileID, void *ext); +int extWrite(int fileID, void *ext); + +int extInqHeader(void *ext, int *header); +int extInqDataSP(void *ext, float *data); +int extInqDataDP(void *ext, double *data); + +int extDefHeader(void *ext, const int *header); +int extDefDataSP(void *ext, const float *data); +int extDefDataDP(void *ext, const double *data); + +#endif /* _EXTRA_H */ +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifndef _IEG_H +#define _IEG_H + +// clang-format off + +/* Level Types */ +#define IEG_LTYPE_SURFACE 1 +#define IEG_LTYPE_99 99 +#define IEG_LTYPE_ISOBARIC 100 +#define IEG_LTYPE_MEANSEA 102 +#define IEG_LTYPE_ALTITUDE 103 +#define IEG_LTYPE_HEIGHT 105 +#define IEG_LTYPE_SIGMA 107 +#define IEG_LTYPE_HYBRID 109 +#define IEG_LTYPE_HYBRID_LAYER 110 +#define IEG_LTYPE_LANDDEPTH 111 +#define IEG_LTYPE_LANDDEPTH_LAYER 112 +#define IEG_LTYPE_SEADEPTH 160 + +/* + * Data representation type (Grid Type) [Table 6] + */ +#define IEG_GTYPE_LATLON 0 /* latitude/longitude */ +#define IEG_GTYPE_LATLON_ROT 10 /* rotated latitude/longitude */ + +#define IEG_P_CodeTable(x) (x[ 5]) /* Version number of code table */ +#define IEG_P_Parameter(x) (x[ 6]) /* Parameter indicator */ +#define IEG_P_LevelType(x) (x[ 7]) /* Type of level indicator */ +#define IEG_P_Level1(x) (x[ 8]) /* Level 1 */ +#define IEG_P_Level2(x) (x[ 9]) /* Level 2 */ +#define IEG_P_Year(x) (x[10]) /* Year of century (YY) */ +#define IEG_P_Month(x) (x[11]) /* Month (MM) */ +#define IEG_P_Day(x) (x[12]) /* Day (DD) */ +#define IEG_P_Hour(x) (x[13]) /* Hour (HH) */ +#define IEG_P_Minute(x) (x[14]) /* Minute (MM) */ + +/* + * Macros for the grid definition section ( Section 2 ) + */ +#define IEG_G_Size(x) (x[ 0]) +#define IEG_G_NumVCP(x) (x[3] == 10 ? (x[0]-42)/4 : (x[0]-32)/4) +#define IEG_G_GridType(x) (x[ 3]) /* Data representation type */ +#define IEG_G_NumLon(x) (x[ 4]) /* Number of points along a parallel (Ni) */ +#define IEG_G_NumLat(x) (x[ 5]) /* Number of points along a meridian (Nj) */ +#define IEG_G_FirstLat(x) (x[ 6]) /* Latitude of the first grid point */ +#define IEG_G_FirstLon(x) (x[ 7]) /* Longitude of the first grid point */ +#define IEG_G_ResFlag(x) (x[ 8]) /* Resolution flag: 128 regular grid */ +#define IEG_G_LastLat(x) (x[ 9]) /* Latitude of the last grid point */ +#define IEG_G_LastLon(x) (x[10]) /* Longitude of the last grid point */ +#define IEG_G_LonIncr(x) (x[11]) /* i direction increment */ +#define IEG_G_LatIncr(x) (x[12]) /* j direction increment */ +#define IEG_G_ScanFlag(x) (x[13]) +#define IEG_G_LatSP(x) (x[16]) /* Latitude of the southern pole of rotation */ +#define IEG_G_LonSP(x) (x[17]) /* Longitude of the southern pole of rotation */ +#define IEG_G_ResFac(x) (x[18]) /* Resolution factor */ + +// clang-format on + +typedef struct +{ + int checked; + int byteswap; + int dprec; /* data precision */ + int ipdb[37]; + double refval; + int igdb[22]; + double vct[100]; + size_t datasize; + size_t buffersize; + void *buffer; +} iegrec_t; + +const char *iegLibraryVersion(void); + +void iegDebug(int debug); +int iegCheckFiletype(int fileID, int *swap); + +void *iegNew(void); +void iegDelete(void *ieg); +void iegInitMem(void *ieg); + +int iegRead(int fileID, void *ieg); +int iegWrite(int fileID, void *ieg); + +void iegCopyMeta(void *dieg, void *sieg); +int iegInqHeader(void *ieg, int *header); +int iegInqDataSP(void *ieg, float *data); +int iegInqDataDP(void *ieg, double *data); + +int iegDefHeader(void *ieg, const int *header); +int iegDefDataSP(void *ieg, const float *data); +int iegDefDataDP(void *ieg, const double *data); + +#endif /* _IEG_H */ +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifndef CDI_INT_H +#define CDI_INT_H + +#ifdef HAVE_CONFIG_H +#endif + +#include <assert.h> +#include <stdio.h> +#include <stdbool.h> +#include <string.h> +#include <errno.h> +#include <limits.h> +#include <math.h> +#include <sys/types.h> + + +// Base file types + +#define CDI_FILETYPE_GRIB 100 // File type GRIB +#define CDI_FILETYPE_NETCDF 101 // File type NetCDF + +// dummy use of unused parameters to silence compiler warnings +#ifndef UNUSED +#define UNUSED(x) (void) x +#endif + +#ifndef strdupx +#ifndef strdup +char *strdup(const char *s); +#endif +#define strdupx strdup +/* +#define strdupx(s) \ +({ \ + const char *__old = (s); \ + size_t __len = strlen(__old) + 1; \ + char *__new = (char *) Malloc(__len); \ + (char *) memcpy(__new, __old, __len); \ +}) +*/ +#endif + +char *str_to_lower(char *str); +bool strStartsWith(const char *vstr, const char *cstr); + +static inline bool +str_is_equal(const char *x, const char *y) +{ + return (*x == *y) && strcmp(x, y) == 0; +} + +#ifndef M_PI +#define M_PI 3.14159265358979323846 /* pi */ +#endif + +#ifndef ERROR_H +#endif +#ifndef _BASETIME_H +#endif +#ifndef JULIAN_DATE_H +#endif +#ifndef TAXIS_H +#endif +#ifndef CDI_LIMITS_H +#endif +#ifndef _SERVICE_H +#endif +#ifndef _EXTRA_H +#endif +#ifndef _IEG_H +#endif +#ifndef RESOURCE_HANDLE_H +#endif + +#define check_parg(arg) \ + if (arg == 0) Warning("Argument '" #arg "' not allocated!") + +#ifdef __xlC__ /* performance problems on IBM */ +#ifndef DBL_IS_NAN +#define DBL_IS_NAN(x) ((x) != (x)) +#endif +#else +#ifndef DBL_IS_NAN +#if defined(HAVE_DECL_ISNAN) +#define DBL_IS_NAN(x) (isnan(x)) +#elif defined(FP_NAN) +#define DBL_IS_NAN(x) (fpclassify(x) == FP_NAN) +#else +#define DBL_IS_NAN(x) ((x) != (x)) +#endif +#endif +#endif + +#ifndef DBL_IS_EQUAL +//#define DBL_IS_EQUAL(x,y) (!(x < y || y < x)) +#define DBL_IS_EQUAL(x, y) (DBL_IS_NAN(x) || DBL_IS_NAN(y) ? (DBL_IS_NAN(x) && DBL_IS_NAN(y)) : !(x < y || y < x)) +#endif + +#ifndef IS_EQUAL +#define IS_NOT_EQUAL(x, y) (x < y || y < x) +#define IS_EQUAL(x, y) (!IS_NOT_EQUAL(x, y)) +#endif + +enum +{ + TYPE_REC, + TYPE_VAR, +}; + +enum +{ + MEMTYPE_DOUBLE = 1, + MEMTYPE_FLOAT, +}; + +typedef struct +{ + void *buffer; // gribapi, cgribex + size_t buffersize; // gribapi, cgribex + off_t position; // file position + int param; + int ilevel; + int vdate; + int vtime; + int gridID; + int varID; + int levelID; + int prec; // ext, srv + void *objectp; // pointer to ieg, ext, srv or cgribex objects +} Record; + +// data structure specifying tile-related meta-data. structure contains "-1" if this is no tile-variable. +typedef struct +{ + int tileindex, totalno_of_tileattr_pairs, tileClassification, numberOfTiles, numberOfAttributes, attribute; +} var_tile_t; + +typedef struct +{ + short perturbationNumber; + short typeOfGeneratingProcess; +} VarScanKeys; + +static inline void +varScanKeysInit(VarScanKeys *s) +{ + memset(s, 0, sizeof(VarScanKeys)); +} + +static inline bool +varScanKeysIsEqual(const VarScanKeys *s1, const VarScanKeys *s2) +{ + return memcmp(s1, s2, sizeof(VarScanKeys)) == 0; +} + +typedef struct +{ + off_t position; + size_t size; + size_t gridsize; + int zip; + int param; + int ilevel; + int ilevel2; + int ltype; + short tsteptype; + short varID; + int levelID; + short used; + char varname[32]; // needed for grib decoding with GRIB_API + VarScanKeys scanKeys; + var_tile_t tiles; // tile-related meta-data, currently for GRIB-API only. +#ifdef HAVE_LIBFDB5 + void *fdbItem; +#endif +} record_t; + +typedef struct +{ + int *recIDs; // IDs of non constant records + record_t *records; + int recordSize; // number of allocated records + int nrecs; // number of used records + // tsID=0 nallrecs + // tsID>0 number of non constant records + int nallrecs; // number of all records + int curRecID; // current record ID + int ncStepIndex; // NetCDF timestep index + off_t position; // timestep file position + taxis_t taxis; + bool next; +} tsteps_t; + +typedef struct +{ + int nlevs; + int subtypeIndex; // corresponding tile in subtype_t structure (subtype->self) + int *recordID; // record IDs: [nlevs] + int *lindex; // level index +} sleveltable_t; + +typedef struct +{ + sleveltable_t *recordTable; // record IDs for each subtype + int ncvarid; + int subtypeSize; + bool defmiss; // true: if missval is defined in file + bool isUsed; + + int gridID; + int zaxisID; + int tsteptype; // TSTEP_* + int subtypeID; // subtype ID, e.g. for tile-related meta-data (currently for GRIB-API only). +} svarinfo_t; + +typedef struct +{ + int ilev; + int mlev; + int ilevID; + int mlevID; +} VCT; + +#ifdef HAVE_LIBNETCDF +enum cdfIDIdx +{ + CDF_DIMID_E, // 3rd dimID of cube sphere grid (len=6) + CDF_DIMID_X, + CDF_DIMID_Y, + CDF_DIMID_RP, // reducedPoints + CDF_VARID_X, + CDF_VARID_Y, + CDF_VARID_RP, // reducedPoints + CDF_VARID_A, + CDF_SIZE_ncIDs, +}; + +typedef struct +{ + int ncIDs[CDF_SIZE_ncIDs]; + int gridID; + long start; + long count; +} ncgrid_t; +#endif + +typedef struct +{ + int self; + int accesstype; // TYPE_REC or TYPE_VAR + int accessmode; + int filetype; + int byteorder; + int fileID; + int filemode; + int nrecs; // number of records + SizeType numvals; + char *filename; + Record *record; + CdiQuery *query; + svarinfo_t *vars; + int nvars; // number of variables + int varsAllocated; + int curTsID; // current timestep ID + int rtsteps; // number of tsteps accessed + long ntsteps; // number of tsteps : only set if all records accessed + int maxSteps; // max. number of timesteps (needed for CDI_FILETYPE_NCZARR) + tsteps_t *tsteps; + int tstepsTableSize; + int tstepsNextID; + basetime_t basetime; + int ncmode; + int vlistID; +#ifdef HAVE_LIBNETCDF + int nc_complex_float_id; + int nc_complex_double_id; + ncgrid_t ncgrid[MAX_GRIDS_PS]; + int zaxisID[MAX_ZAXES_PS]; // Warning: synchronous array to vlist_to_pointer(vlistID)->zaxisIDs + int nczvarID[MAX_ZAXES_PS]; + int ncNumDims; + int ncDimID[MAX_DIMS_PS]; + size_t ncDimLen[MAX_DIMS_PS]; + VCT vct; +#endif + int globalatts; + int localatts; + int unreduced; + int have_missval; + // netcdf4/HDF5 filter + unsigned int filterId; + size_t numParams; + size_t maxParams; + unsigned int params[8]; + + int comptype; // compression type + int complevel; // compression level + bool sortname; + bool sortparam; + void *gribContainers; + + int numWorker; + int nextGlobalRecId; + int cachedTsID; + void *jobs; + void *jobManager; + + int protocol; + void *protocolData; +} stream_t; + +// Length of optional keyword/value pair list +#define MAX_OPT_GRIB_ENTRIES 500 + +enum cdi_convention +{ + CDI_CONVENTION_ECHAM, + CDI_CONVENTION_CF +}; + +// Data type specification for optional key/value pairs (GRIB) +typedef enum +{ + t_double = 0, + t_int = 1 +} key_val_pair_datatype; + +// Data structure holding optional key/value pairs for GRIB +typedef struct +{ + char *keyword; // keyword string + bool update; + key_val_pair_datatype data_type; // data type of this key/value pair + double dbl_val; // double value (data_type == t_double) + int int_val; // integer value (data_type == t_int) + int subtype_index; // tile index for this key-value pair +} opt_key_val_pair_t; + +// enum for differenciating between the different times that we handle +typedef enum +{ + kCdiTimeType_referenceTime, + kCdiTimeType_startTime, + kCdiTimeType_endTime +} CdiTimeType; + +#define CDI_FILETYPE_UNDEF -1 // Unknown/not yet defined file type + +extern int cdiDebugExt; +extern int CDI_Debug; // If set to 1, debuggig (default 0) +extern int CDI_Recopt; +extern bool CDI_gribapi_debug; +extern bool CDI_gribapi_grib1; +extern double CDI_Default_Missval; +extern double CDI_Grid_Missval; +extern int CDI_Default_InstID; +extern int CDI_Default_ModelID; +extern int CDI_Default_TableID; +extern int cdiDefaultLeveltype; +extern int CDI_Default_Calendar; +// extern int cdiNcMissingValue; +extern int CDI_Netcdf_Chunksizehint; +extern int CDI_ChunkType; +extern int CDI_Split_Ltype105; +extern int cdiDataUnreduced; +extern int cdiSortName; +extern int cdiSortParam; +extern int cdiHaveMissval; +extern bool CDI_Ignore_Att_Coordinates; +extern bool CDI_Coordinates_Lon_Lat; +extern bool CDI_Ignore_Valid_Range; +extern int CDI_Skip_Records; +extern const char *CDI_GRIB1_Template; +extern const char *CDI_GRIB2_Template; +extern int CDI_Convention; +extern int CDI_Inventory_Mode; +extern int CDI_Query_Abort; +extern int CDI_Version_Info; +extern int CDI_Convert_Cubesphere; +extern int CDI_Read_Cell_Corners; +extern int CDI_CMOR_Mode; +extern int CDI_Reduce_Dim; +extern int CDI_Shuffle; +extern size_t CDI_Netcdf_Hdr_Pad; +extern size_t CDI_Chunk_Cache; +extern size_t CDI_Chunk_Cache_Max; +extern bool CDI_Netcdf_Lazy_Grid_Load; +extern int STREAM_Debug; + +extern char *cdiPartabPath; +extern int cdiPartabIntern; +extern const resOps streamOps; + +static inline stream_t * +stream_to_pointer(int idx) +{ + return (stream_t *) reshGetVal(idx, &streamOps); +} + +static inline void +stream_check_ptr(const char *caller, stream_t *streamptr) +{ + if (streamptr == NULL) Errorc("stream undefined!"); +} + +int streamInqFileID(int streamID); + +void gridDefHasDims(int gridID, int hasdims); +int gridInqHasDims(int gridID); +int zaxisInqLevelID(int zaxisID, double level); + +void streamCheckID(const char *caller, int streamID); + +void streamDefineTaxis(int streamID); + +int streamsNewEntry(int filetype); +void streamsInitEntry(int streamID); +void cdiStreamSetupVlist(stream_t *streamptr, int vlistID); +// default implementation of the overridable function +void cdiStreamSetupVlist_(stream_t *streamptr, int vlistID); +int stream_new_var(stream_t *streamptr, int gridID, int zaxisID, int tilesetID); + +int tstepsNewEntry(stream_t *streamptr); + +const char *strfiletype(int filetype); + +void cdi_generate_vars(stream_t *streamptr); + +void vlist_check_contents(int vlistID); + +void cdi_create_records(stream_t *streamptr, int tsID); + +void streamFCopyRecord(stream_t *streamptr2, stream_t *streamptr1, const char *container_name); + +int recordNewEntry(stream_t *streamptr, int tsID); + +void cdi_create_timesteps(int numTimesteps, stream_t *streamptr); + +void recordInitEntry(record_t *record); + +void cdiCheckZaxis(int zaxisID); + +void cdiDefAccesstype(int streamID, int type); +int cdiInqAccesstype(int streamID); + +int getByteswap(int byteorder); + +void cdiStreamGetIndexList(unsigned numIDs, int IDs[]); + +void cdiInitialize(void); + +char *cdiEscapeSpaces(const char *string); +char *cdiUnescapeSpaces(const char *string, const char **outStringEnd); + +enum +{ + CDI_UNIT_PA = 1, + CDI_UNIT_HPA, + CDI_UNIT_MM, + CDI_UNIT_CM, + CDI_UNIT_DM, + CDI_UNIT_M, +}; + +struct streamAssoc +{ + int streamID, vlistID; +}; + +struct streamAssoc streamUnpack(char *unpackBuffer, int unpackBufferSize, int *unpackBufferPos, int originNamespace, void *context); + +int cdiStreamOpenDefaultDelegate(const char *filename, char filemode, int filetype, stream_t *streamptr, + int recordBufIsToBeCreated); + +int streamOpenID(const char *filename, char filemode, int filetype, int resH); + +void cdiStreamDefVlist_(int streamID, int vlistID); + +int cdiStreamWriteVar_(int streamID, int varID, int memtype, const void *data, SizeType nmiss); + +void cdiStreamWriteVarChunk_(int streamID, int varID, int memtype, const int rect[][2], const void *data, SizeType nmiss); +void cdiStreamCloseDefaultDelegate(stream_t *streamptr, int recordBufIsToBeDeleted); + +int cdiStreamDefTimestep_(stream_t *streamptr, int tsID); + +void cdiStreamSync_(stream_t *streamptr); + +const char *cdiUnitNamePtr(int cdi_unit); + +enum +{ + // 8192 is known to work on most systems (4096 isn't on Alpha) + commonPageSize = 8192, +}; + +size_t cdiGetPageSize(bool largePageAlign); + +void zaxisGetIndexList(int nzaxis, int *zaxisIndexList); + +// clang-format off + +#ifdef __cplusplus +extern "C" { +#endif + +// functions used in CDO !!! + +void cdiDefTableID(int tableID); + +void gridGenXvals(int xsize, double xfirst, double xlast, double xinc, double *xvals); +void gridGenYvals(int gridtype, int ysize, double yfirst, double ylast, double yinc, double *yvals); + +static inline +void cdi_check_gridsize_int_limit(const char *format, SizeType gridsize) +{ + if (gridsize > INT_MAX) Error("%s format grid size (%zu) limit exceeded (%zu)!", format, gridsize, INT_MAX); +} + +bool cdiFiletypeIsExse(int filetype); +int cdiBaseFiletype(int filetype); + +#ifdef __cplusplus +} +#endif + +// clang-format on + +#endif /* CDI_INT_H */ +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifndef CDF_INT_H +#define CDF_INT_H + +#ifdef HAVE_LIBNETCDF + +#include <netcdf.h> + +void cdf__create(const char *path, int cmode, int *idp); +void cdf_create(const char *path, int cmode, int *idp); +int cdf_open(const char *path, int omode, int *idp); +void cdf_close(int ncid); + +void cdf_redef(int ncid); +void cdf_enddef(int ncid, int streamID); +void cdf__enddef(int ncid, int streamID, const size_t hdr_pad); +void cdf_sync(int ncid); + +void cdf_inq(int ncid, int *ndimsp, int *nvarsp, int *ngattsp, int *unlimdimidp); + +void cdf_def_dim(int ncid, const char *name, size_t len, int *idp); +void cdf_inq_dimid(int ncid, const char *name, int *dimidp); +void cdf_inq_dim(int ncid, int dimid, char *name, size_t *lengthp); +void cdf_inq_dimname(int ncid, int dimid, char *name); +void cdf_inq_dimlen(int ncid, int dimid, size_t *lengthp); +void cdf_def_var(int ncid, const char *name, nc_type xtype, int ndims, const int dimids[], int *varidp); +void cdf_def_var_serial(int ncid, const char *name, nc_type xtype, int ndims, const int dimids[], int *varidp); +void cdf_inq_varid(int ncid, const char *name, int *varidp); +void cdf_inq_nvars(int ncid, int *nvarsp); +void cdf_inq_var(int ncid, int varid, char *name, nc_type *xtypep, int *ndimsp, int dimids[], int *nattsp); +void cdf_inq_varname(int ncid, int varid, char *name); +void cdf_inq_vartype(int ncid, int varid, nc_type *xtypep); +void cdf_inq_varndims(int ncid, int varid, int *ndimsp); +void cdf_inq_vardimid(int ncid, int varid, int dimids[]); +void cdf_inq_varnatts(int ncid, int varid, int *nattsp); + +void cdf_copy_att(int ncid_in, int varid_in, const char *name, int ncid_out, int varid_out); +void cdf_put_var_text(int ncid, int varid, const char *tp); +void cdf_put_var_uchar(int ncid, int varid, const unsigned char *up); +void cdf_put_var_schar(int ncid, int varid, const signed char *cp); +void cdf_put_var_short(int ncid, int varid, const short *sp); +void cdf_put_var_int(int ncid, int varid, const int *ip); +void cdf_put_var_long(int ncid, int varid, const long *lp); +void cdf_put_var_float(int ncid, int varid, const float *fp); +void cdf_put_var_double(int ncid, int varid, const double *dp); + +void cdf_get_var_text(int ncid, int varid, char *tp); +void cdf_get_var_uchar(int ncid, int varid, unsigned char *up); +void cdf_get_var_schar(int ncid, int varid, signed char *cp); +void cdf_get_var_short(int ncid, int varid, short *sp); +void cdf_get_var_int(int ncid, int varid, int *ip); +void cdf_get_var_long(int ncid, int varid, long *lp); +void cdf_get_var_float(int ncid, int varid, float *fp); +void cdf_get_var_double(int ncid, int varid, double *dp); + +void cdf_get_var1_text(int ncid, int varid, const size_t index[], char *tp); + +void cdf_get_var1_double(int ncid, int varid, const size_t index[], double *dp); +void cdf_put_var1_double(int ncid, int varid, const size_t index[], const double *dp); + +void cdf_get_vara_uchar(int ncid, int varid, const size_t start[], const size_t count[], unsigned char *tp); +void cdf_get_vara_text(int ncid, int varid, const size_t start[], const size_t count[], char *tp); + +void cdf_get_vara_double(int ncid, int varid, const size_t start[], const size_t count[], double *dp); +void cdf_put_vara_double(int ncid, int varid, const size_t start[], const size_t count[], const double *dp); + +void cdf_get_vara_float(int ncid, int varid, const size_t start[], const size_t count[], float *fp); +void cdf_put_vara_float(int ncid, int varid, const size_t start[], const size_t count[], const float *fp); + +void cdf_get_vara_int(int ncid, int varid, const size_t start[], const size_t count[], int *dp); + +void cdf_get_vara(int ncid, int varid, const size_t start[], const size_t count[], void *cp); +void cdf_put_vara(int ncid, int varid, const size_t start[], const size_t count[], const void *cp); + +void cdf_put_att_text(int ncid, int varid, const char *name, size_t len, const char *tp); +void cdf_put_att_int(int ncid, int varid, const char *name, nc_type xtype, size_t len, const int *ip); +void cdf_put_att_float(int ncid, int varid, const char *name, nc_type xtype, size_t len, const float *dp); +void cdf_put_att_double(int ncid, int varid, const char *name, nc_type xtype, size_t len, const double *dp); + +void cdf_get_att_string(int ncid, int varid, const char *name, char **tp); +void cdf_get_att_text(int ncid, int varid, const char *name, char *tp); +void cdf_get_att_int(int ncid, int varid, const char *name, int *ip); +void cdf_get_att_double(int ncid, int varid, const char *name, double *dp); + +void cdf_inq_att(int ncid, int varid, const char *name, nc_type *xtypep, size_t *lenp); +void cdf_inq_atttype(int ncid, int varid, const char *name, nc_type *xtypep); +void cdf_inq_attlen(int ncid, int varid, const char *name, size_t *lenp); +void cdf_inq_attname(int ncid, int varid, int attnum, char *name); +void cdf_inq_attid(int ncid, int varid, const char *name, int *attnump); + +void cdf_def_var_chunking(int ncid, int varid, int storage, const size_t *chunksizesp); + +typedef int (*cdi_nc__create_funcp)(const char *path, int cmode, size_t initialsz, size_t *chunksizehintp, int *ncidp); + +typedef void (*cdi_cdf_def_var_funcp)(int ncid, const char *name, nc_type xtype, int ndims, const int dimids[], int *varidp); + +int cdi_nc_enddef_serial(int ncid, int streamID); +int cdi_nc__enddef_serial(int ncid, int streamID, size_t hdr_pad, size_t v_align, size_t v_minfree, size_t r_align); +typedef int (*cdi_nc_enddef_funcp)(int ncid, int streamID); +typedef int (*cdi_nc__enddef_funcp)(int ncid, int streamID, size_t hdr_pad, size_t v_align, size_t v_minfree, size_t r_align); +#endif + +#endif /* CDF_INT_H */ +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifdef HAVE_CONFIG_H +#endif + +#include <ctype.h> + + +#ifdef HAVE_LIBNETCDF +const char * +cdfLibraryVersion(void) +{ + return nc_inq_libvers(); +} + +#ifdef HAVE_H5GET_LIBVERSION +#ifdef __cplusplus +extern "C" +{ +#endif + int H5get_libversion(unsigned *, unsigned *, unsigned *); +#ifdef __cplusplus +} +#endif +#endif + +const char * +hdfLibraryVersion(void) +{ +#ifdef HAVE_H5GET_LIBVERSION + static char hdf_libvers[256]; + static int linit = 0; + if (!linit) + { + linit = 1; + unsigned majnum, minnum, relnum; + H5get_libversion(&majnum, &minnum, &relnum); +#ifdef HAVE_NC4HDF5_THREADSAFE + snprintf(hdf_libvers, sizeof(hdf_libvers), "%u.%u.%u threadsafe", majnum, minnum, relnum); +#else + snprintf(hdf_libvers, sizeof(hdf_libvers), "%u.%u.%u", majnum, minnum, relnum); +#endif + } + + return hdf_libvers; +#else + return "library undefined"; +#endif +} + +int CDF_Debug = 0; /* If set to 1, debugging */ + +void +cdfDebug(int debug) +{ + CDF_Debug = debug; + + if (CDF_Debug) Message("debug level %d", debug); +} + +static void +cdfComment(int ncid) +{ + static char comment[256] = "Climate Data Interface version "; + static bool init = false; + + if (!init) + { + init = true; + const char *libvers = cdiLibraryVersion(); + + if (!isdigit((int) *libvers)) + strcat(comment, "??"); + else + strcat(comment, libvers); + strcat(comment, " (https://mpimet.mpg.de/cdi)"); + } + + cdf_put_att_text(ncid, NC_GLOBAL, "CDI", strlen(comment), comment); +} + +static bool +has_uri_scheme(const char *uri) +{ + const char *pos = strstr(uri, "://"); + if (pos) + { + const int len = pos - uri; + if (strncmp(uri, "file", len) == 0 || strncmp(uri, "https", len) == 0 || strncmp(uri, "s3", len) == 0) return true; + } + + return false; +} + +static int +cdfOpenFile(const char *filename, const char *mode, int *filetype) +{ + int ncid = -1; + const int fmode = tolower(*mode); + int writemode = NC_CLOBBER; + int readmode = NC_NOWRITE; + + if (filename == NULL) + ncid = CDI_EINVAL; + else + { + switch (fmode) + { + case 'r': + { + const int status = cdf_open(filename, readmode, &ncid); + if (status > 0 && ncid < 0) ncid = CDI_ESYSTEM; +#ifdef HAVE_NETCDF4 + else + { + int format = -1; + (void) nc_inq_format(ncid, &format); + if (format == NC_FORMAT_NETCDF4_CLASSIC) *filetype = CDI_FILETYPE_NC4C; + } +#endif + } + break; + case 'w': +#ifdef NC_64BIT_OFFSET + if (*filetype == CDI_FILETYPE_NC2) writemode |= NC_64BIT_OFFSET; +#endif +#ifdef NC_64BIT_DATA + if (*filetype == CDI_FILETYPE_NC5) writemode |= NC_64BIT_DATA; +#endif +#ifdef HAVE_NETCDF4 + if (*filetype == CDI_FILETYPE_NC4C) writemode |= (NC_NETCDF4 | NC_CLASSIC_MODEL); + if (*filetype == CDI_FILETYPE_NC4) writemode |= NC_NETCDF4; + if (*filetype == CDI_FILETYPE_NCZARR) writemode |= NC_NETCDF4; +#endif + if (*filetype == CDI_FILETYPE_NCZARR) + { + if (!has_uri_scheme(filename)) + { + fprintf(stderr, "URI scheme is missing in NCZarr path!\n"); + return CDI_EINVAL; + } + + cdf_create(filename, writemode, &ncid); + } + else + { + if (has_uri_scheme(filename)) fprintf(stderr, "URI scheme defined for non NCZarr Data Model!\n"); + + cdf__create(filename, writemode, &ncid); + } + + if (CDI_Version_Info) cdfComment(ncid); + cdf_put_att_text(ncid, NC_GLOBAL, "Conventions", 6, "CF-1.6"); + break; + case 'a': cdf_open(filename, NC_WRITE, &ncid); break; + default: ncid = CDI_EINVAL; + } + } + + return ncid; +} + +int +cdfOpen(const char *filename, const char *mode, int filetype) +{ + int fileID = -1; + bool open_file = true; + + if (CDF_Debug) Message("Open %s with mode %c", filename, *mode); + +#ifndef NC_64BIT_OFFSET + if (filetype == CDI_FILETYPE_NC2) open_file = false; +#endif +#ifndef NC_64BIT_DATA + if (filetype == CDI_FILETYPE_NC5) open_file = false; +#endif + + if (open_file) + { + fileID = cdfOpenFile(filename, mode, &filetype); + + if (CDF_Debug) Message("File %s opened with id %d", filename, fileID); + } + else + { + fileID = CDI_ELIBNAVAIL; + } + + return fileID; +} + +static int +cdf4CheckLibVersions(void) +{ + int status = 0; +#ifdef HAVE_NETCDF4 +#ifdef HAVE_H5GET_LIBVERSION + static int checked = 0; + if (!checked) + { + checked = 1; + unsigned majnum, minnum, relnum; + + sscanf(nc_inq_libvers(), "%u.%u.%u", &majnum, &minnum, &relnum); + // printf("netCDF %u.%u.%u\n", majnum, minnum, relnum); + const unsigned ncmaxver = 4 * 1000000 + 4 * 1000; + const unsigned nclibver = majnum * 1000000 + minnum * 1000 + relnum; + + if (nclibver <= ncmaxver) + { + H5get_libversion(&majnum, &minnum, &relnum); + const unsigned hdf5maxver = 1 * 1000000 + 10 * 1000; + const unsigned hdf5libver = majnum * 1000000 + minnum * 1000 + relnum; + + if (hdf5libver >= hdf5maxver) + { + fprintf(stderr, "NetCDF library 4.4.0 or earlier, combined with libhdf5 1.10.0 or greater not supported!\n"); + status = 1; + } + } + } +#endif +#endif + return status; +} + +int +cdf4Open(const char *filename, const char *mode, int *filetype) +{ + if (CDF_Debug) Message("Open %s with mode %c", filename, *mode); + +#ifdef HAVE_NETCDF4 + if (cdf4CheckLibVersions() == 0) + { + const int fileID = cdfOpenFile(filename, mode, filetype); + if (CDF_Debug) Message("File %s opened with id %d", filename, fileID); + return fileID; + } + + return CDI_EUFTYPE; +#else + return CDI_ELIBNAVAIL; +#endif +} + +static void +cdfCloseFile(int fileID) +{ + cdf_close(fileID); +} + +void +cdfClose(int fileID) +{ + cdfCloseFile(fileID); +} +#endif +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifndef NAMESPACE_H +#define NAMESPACE_H + +#ifdef HAVE_CONFIG_H +#endif + +typedef struct +{ + int idx; + int nsp; +} namespaceTuple_t; + +enum namespaceSwitch +{ + NSSWITCH_NO_SUCH_SWITCH = -1, + NSSWITCH_ABORT, + NSSWITCH_WARNING, + NSSWITCH_SERIALIZE_GET_SIZE, + NSSWITCH_SERIALIZE_PACK, + NSSWITCH_SERIALIZE_UNPACK, + NSSWITCH_FILE_OPEN, + NSSWITCH_FILE_WRITE, + NSSWITCH_FILE_CLOSE, + NSSWITCH_STREAM_OPEN_BACKEND, + NSSWITCH_STREAM_DEF_VLIST_, + NSSWITCH_STREAM_SETUP_VLIST, + NSSWITCH_STREAM_WRITE_VAR_, + NSSWITCH_STREAM_WRITE_VAR_CHUNK_, + NSSWITCH_STREAM_WRITE_VAR_PART_, + NSSWITCH_STREAM_WRITE_SCATTERED_VAR_PART_, + NSSWITCH_STREAM_CLOSE_BACKEND, + NSSWITCH_STREAM_DEF_TIMESTEP_, + NSSWITCH_STREAM_SYNC, + NSSWITCH_VLIST_DESTROY_, +#ifdef HAVE_LIBNETCDF + NSSWITCH_NC__CREATE, + NSSWITCH_CDF_DEF_VAR, + NSSWITCH_NC_ENDDEF, + NSSWITCH_NC__ENDDEF, + NSSWITCH_CDF_DEF_TIMESTEP, + NSSWITCH_CDF_STREAM_SETUP, + NSSWITCH_CDF_POSTDEFACTION_GRID_PROP, +#endif + NUM_NAMESPACE_SWITCH, +}; + +union namespaceSwitchValue +{ + void *data; + void (*func)(void); +}; + +#define NSSW_FUNC(p) ((union namespaceSwitchValue){ .func = (void (*)(void))(p) }) +#define NSSW_DATA(p) ((union namespaceSwitchValue){ .data = (void *) (p) }) + +// int namespaceNew(); +// void namespaceDelete(int namespaceID); +void namespaceCleanup(void); +int namespaceGetNumber(void); +// void namespaceSetActive(int namespaceID); +// int namespaceGetActive ( void ); +int namespaceIdxEncode(namespaceTuple_t); +int namespaceIdxEncode2(int, int); +namespaceTuple_t namespaceResHDecode(int); +int namespaceAdaptKey(int originResH, int originNamespace); +int namespaceAdaptKey2(int); +void namespaceSwitchSet(int sw, union namespaceSwitchValue value); +union namespaceSwitchValue namespaceSwitchGet(int sw); +/* reserve new dynamic key */ +int cdiNamespaceSwitchNewKey(void); + +#endif +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifdef HAVE_CONFIG_H +#endif + +#include <sys/stat.h> + + +#ifdef HAVE_LIBNETCDF + +void +cdf_create(const char *path, int cmode, int *ncidp) +{ + int status = nc_create(path, cmode, ncidp); + + if (CDF_Debug || status != NC_NOERR) Message("ncid=%d mode=%d file=%s", *ncidp, cmode, path); + + if (status != NC_NOERR) Error("%s: %s", path, nc_strerror(status)); + + int oldfill; + status = nc_set_fill(*ncidp, NC_NOFILL, &oldfill); + + if (status != NC_NOERR) Error("%s: %s", path, nc_strerror(status)); +} + +void +cdf__create(const char *path, int cmode, int *ncidp) +{ + int status = -1; + size_t chunksizehint = 0; + + size_t initialsz = 0; + +#if defined(__SX__) || defined(ES) + chunksizehint = 16777216; // 16 MB +#endif + + if (CDI_Netcdf_Chunksizehint != CDI_UNDEFID) chunksizehint = (size_t) CDI_Netcdf_Chunksizehint; + + cdi_nc__create_funcp my_nc__create = (cdi_nc__create_funcp) namespaceSwitchGet(NSSWITCH_NC__CREATE).func; + status = my_nc__create(path, cmode, initialsz, &chunksizehint, ncidp); + + if (status != NC_NOERR) + { + if (CDF_Debug) Message("ncid=%d mode=%d chunksizehint=%zu file=%s", *ncidp, cmode, chunksizehint, path); + Error("%s: %s", path, nc_strerror(status)); + } + + int oldfill; + status = nc_set_fill(*ncidp, NC_NOFILL, &oldfill); + + if (status != NC_NOERR) Error("%s: %s", path, nc_strerror(status)); +} + +int +cdf_open(const char *path, int omode, int *ncidp) +{ + int status = 0; + + if (strstr(path, ":/")) // ESDM and DAP + { + status = nc_open(path, omode, ncidp); + } + else + { + struct stat filestat; + if (stat(path, &filestat) != 0) SysError(path); + + size_t chunksizehint = 0; +#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE + chunksizehint = (size_t) filestat.st_blksize * 4; + if (chunksizehint > (size_t) filestat.st_size) chunksizehint = (size_t) filestat.st_size; +#endif + // if (chunksizehint < ChunkSizeMin) chunksizehint = ChunkSizeMin; + if (CDI_Netcdf_Chunksizehint != CDI_UNDEFID) chunksizehint = (size_t) CDI_Netcdf_Chunksizehint; + + // FIXME: parallel part missing + status = nc__open(path, omode, &chunksizehint, ncidp); + + if (CDF_Debug) Message("chunksizehint %zu", chunksizehint); + } + + if (CDF_Debug) Message("ncid=%d mode=%d file=%s", *ncidp, omode, path); + + if (CDF_Debug && status != NC_NOERR) Message("%s", nc_strerror(status)); + + return status; +} + +void +cdf_close(int ncid) +{ + int status = nc_close(ncid); + if (status != NC_NOERR) Error("%s", nc_strerror(status)); +} + +void +cdf_redef(int ncid) +{ + int status = nc_redef(ncid); + if (status != NC_NOERR) Error("%s", nc_strerror(status)); +} + +int +cdi_nc_enddef_serial(int ncid, int streamID) +{ + (void) streamID; + return nc_enddef(ncid); +} + +int +cdi_nc__enddef_serial(int ncid, int streamID, size_t hdr_pad, size_t v_align, size_t v_minfree, size_t r_align) +{ + (void) streamID; + return nc__enddef(ncid, hdr_pad, v_align, v_minfree, r_align); +} + +void +cdf_enddef(int ncid, int streamID) +{ + cdi_nc_enddef_funcp my_nc_enddef = (cdi_nc_enddef_funcp) namespaceSwitchGet(NSSWITCH_NC_ENDDEF).func; + int status = my_nc_enddef(ncid, streamID); + if (status != NC_NOERR) Error("%s", nc_strerror(status)); +} + +void +cdf__enddef(int ncid, int streamID, const size_t hdr_pad) +{ + const size_t v_align = 4UL; // [B] Alignment of beginning of data section for fixed variables + const size_t v_minfree = 0UL; // [B] Pad at end of data section for fixed size variables + const size_t r_align = 4UL; // [B] Alignment of beginning of data section for record variables + + // nc_enddef(ncid) is equivalent to nc__enddef(ncid, 0, 4, 0, 4) + cdi_nc__enddef_funcp my_nc__enddef = (cdi_nc__enddef_funcp) namespaceSwitchGet(NSSWITCH_NC_ENDDEF).func; + int status = my_nc__enddef(ncid, streamID, hdr_pad, v_align, v_minfree, r_align); + if (status != NC_NOERR) Error("%s", nc_strerror(status)); +} + +void +cdf_sync(int ncid) +{ + int status = nc_sync(ncid); + if (status != NC_NOERR) Error("%s", nc_strerror(status)); +} + +void +cdf_inq(int ncid, int *ndimsp, int *nvarsp, int *ngattsp, int *unlimdimidp) +{ + int status = nc_inq(ncid, ndimsp, nvarsp, ngattsp, unlimdimidp); + + if (CDF_Debug || status != NC_NOERR) + Message("ncid=%d ndims=%d nvars=%d ngatts=%d unlimid=%d", ncid, *ndimsp, *nvarsp, *ngattsp, *unlimdimidp); + + if (status != NC_NOERR) Error("%s", nc_strerror(status)); +} + +void +cdf_def_dim(int ncid, const char *name, size_t len, int *dimidp) +{ + int status = nc_def_dim(ncid, name, len, dimidp); + + if (CDF_Debug || status != NC_NOERR) Message("ncid=%d name=%s len=%d", ncid, name, len); + + if (status != NC_NOERR) Error("%s", nc_strerror(status)); +} + +void +cdf_inq_dimid(int ncid, const char *name, int *dimidp) +{ + int status = nc_inq_dimid(ncid, name, dimidp); + + if (CDF_Debug || status != NC_NOERR) Message("ncid=%d name=%s dimid=%d", ncid, name, *dimidp); + + if (status != NC_NOERR) Error("%s", nc_strerror(status)); +} + +void +cdf_inq_dim(int ncid, int dimid, char *name, size_t *lengthp) +{ + int status = nc_inq_dim(ncid, dimid, name, lengthp); + + if (CDF_Debug || status != NC_NOERR) Message("ncid=%d dimid=%d length=%d name=%s", ncid, dimid, *lengthp, name); + + if (status != NC_NOERR) Error("%s", nc_strerror(status)); +} + +void +cdf_inq_dimname(int ncid, int dimid, char *name) +{ + int status = nc_inq_dimname(ncid, dimid, name); + + if (CDF_Debug || status != NC_NOERR) Message("ncid=%d dimid=%d name=%s", ncid, dimid, name); + + if (status != NC_NOERR) Error("%s", nc_strerror(status)); +} + +void +cdf_inq_dimlen(int ncid, int dimid, size_t *lengthp) +{ + int status = nc_inq_dimlen(ncid, dimid, lengthp); + + if (CDF_Debug || status != NC_NOERR) Message("ncid=%d dimid=%d length=%d", ncid, dimid, *lengthp); + + if (status != NC_NOERR) Error("%s", nc_strerror(status)); +} + +void +cdf_def_var(int ncid, const char *name, nc_type xtype, int ndims, const int dimids[], int *varidp) +{ + cdi_cdf_def_var_funcp my_cdf_def_var = (cdi_cdf_def_var_funcp) namespaceSwitchGet(NSSWITCH_CDF_DEF_VAR).func; + my_cdf_def_var(ncid, name, xtype, ndims, dimids, varidp); +} + +void +cdf_def_var_serial(int ncid, const char *name, nc_type xtype, int ndims, const int dimids[], int *varidp) +{ + int status = nc_def_var(ncid, name, xtype, ndims, dimids, varidp); + if (CDF_Debug || status != NC_NOERR) Message("ncid=%d name=%s xtype=%d ndims=%d varid=%d", ncid, name, xtype, ndims, *varidp); + if (status == NC_NOERR) + { + int fileFormat; + status = nc_inq_format(ncid, &fileFormat); + if (status == NC_NOERR && (fileFormat == NC_FORMAT_NETCDF4 || fileFormat == NC_FORMAT_NETCDF4_CLASSIC)) + status = nc_def_var_fill(ncid, *varidp, 1, NULL); + } + if (status != NC_NOERR) Error("%s", nc_strerror(status)); +} + +void +cdf_inq_varid(int ncid, const char *name, int *varidp) +{ + int status = nc_inq_varid(ncid, name, varidp); + + if (CDF_Debug || status != NC_NOERR) Message("ncid=%d name=%s varid=%d", ncid, name, *varidp); + + if (status != NC_NOERR) Error("%s", nc_strerror(status)); +} + +void +cdf_inq_nvars(int ncid, int *nvarsp) +{ + int status = nc_inq_nvars(ncid, nvarsp); + + if (CDF_Debug || status != NC_NOERR) Message("ncid=%d nvars=%d", ncid, *nvarsp); + + if (status != NC_NOERR) Error("%s", nc_strerror(status)); +} + +void +cdf_inq_var(int ncid, int varid, char *name, nc_type *xtypep, int *ndimsp, int dimids[], int *nattsp) +{ + int status = nc_inq_var(ncid, varid, name, xtypep, ndimsp, dimids, nattsp); + + if (CDF_Debug || status != NC_NOERR) + Message("ncid=%d varid=%d ndims=%d xtype=%d natts=%d name=%s", ncid, varid, *ndimsp, *xtypep, *nattsp, name); + + if (status != NC_NOERR) Error("%s", nc_strerror(status)); +} + +void +cdf_inq_varname(int ncid, int varid, char *name) +{ + int status = nc_inq_varname(ncid, varid, name); + + if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d name=%s", ncid, varid, name); + + if (status != NC_NOERR) Error("%s", nc_strerror(status)); +} + +void +cdf_inq_vartype(int ncid, int varid, nc_type *xtypep) +{ + int status = nc_inq_vartype(ncid, varid, xtypep); + + if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d xtype=%s", ncid, varid, *xtypep); + + if (status != NC_NOERR) Error("%s", nc_strerror(status)); +} + +void +cdf_inq_varndims(int ncid, int varid, int *ndimsp) +{ + int status = nc_inq_varndims(ncid, varid, ndimsp); + + if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d", ncid, varid); + + if (status != NC_NOERR) Error("%s", nc_strerror(status)); +} + +void +cdf_inq_vardimid(int ncid, int varid, int dimids[]) +{ + int status = nc_inq_vardimid(ncid, varid, dimids); + + if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d", ncid, varid); + + if (status != NC_NOERR) Error("%s", nc_strerror(status)); +} + +void +cdf_inq_varnatts(int ncid, int varid, int *nattsp) +{ + int status = nc_inq_varnatts(ncid, varid, nattsp); + + if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d nattsp=%d", ncid, varid, *nattsp); + + if (status != NC_NOERR) Error("%s", nc_strerror(status)); +} + +void +cdf_put_var_text(int ncid, int varid, const char *tp) +{ + int status = nc_put_var_text(ncid, varid, tp); + + if (CDF_Debug || status != NC_NOERR) Message("%d %d %s", ncid, varid, tp); + + if (status != NC_NOERR) Error("%s", nc_strerror(status)); +} + +void +cdf_put_var_short(int ncid, int varid, const short *sp) +{ + int status = nc_put_var_short(ncid, varid, sp); + + if (CDF_Debug || status != NC_NOERR) Message("%d %d %hd", ncid, varid, *sp); + + if (status != NC_NOERR) Error("%s", nc_strerror(status)); +} + +void +cdf_put_var_int(int ncid, int varid, const int *ip) +{ + int status = nc_put_var_int(ncid, varid, ip); + + if (CDF_Debug || status != NC_NOERR) Message("%d %d %d", ncid, varid, *ip); + + if (status != NC_NOERR) Error("%s", nc_strerror(status)); +} + +void +cdf_put_var_long(int ncid, int varid, const long *lp) +{ + int status = nc_put_var_long(ncid, varid, lp); + + if (CDF_Debug || status != NC_NOERR) Message("%d %d %ld", ncid, varid, *lp); + + if (status != NC_NOERR) Error("%s", nc_strerror(status)); +} + +void +cdf_put_var_float(int ncid, int varid, const float *fp) +{ + int status = nc_put_var_float(ncid, varid, fp); + + if (CDF_Debug || status != NC_NOERR) Message("%d %d %f", ncid, varid, *fp); + + if (status != NC_NOERR) Error("%s", nc_strerror(status)); +} + +static const char * +cdf_var_type(nc_type xtype) +{ + const char *ctype = "unknown"; + + // clang-format off + if (xtype == NC_BYTE ) ctype = "NC_BYTE"; + else if (xtype == NC_CHAR ) ctype = "NC_CHAR"; + else if (xtype == NC_SHORT ) ctype = "NC_SHORT"; + else if (xtype == NC_INT ) ctype = "NC_INT"; + else if (xtype == NC_FLOAT ) ctype = "NC_FLOAT"; + else if (xtype == NC_DOUBLE) ctype = "NC_DOUBLE"; +#ifdef HAVE_NETCDF4 + else if (xtype == NC_UBYTE ) ctype = "NC_UBYTE"; + else if (xtype == NC_LONG ) ctype = "NC_LONG"; + else if (xtype == NC_USHORT) ctype = "NC_USHORT"; + else if (xtype == NC_UINT ) ctype = "NC_UINT"; + else if (xtype == NC_INT64 ) ctype = "NC_INT64"; + else if (xtype == NC_UINT64) ctype = "NC_UINT64"; +#endif + // clang-format on + + return ctype; +} + +static void +minmaxval(size_t nvals, const double *array, double *minval, double *maxval) +{ + double minv = array[0]; + double maxv = array[0]; + for (size_t i = 0; i < nvals; ++i) + { + minv = (array[i] < minv) ? array[i] : minv; + maxv = (array[i] > maxv) ? array[i] : maxv; + } + + *minval = minv; + *maxval = maxv; +} + +static void +minmaxvalf(size_t nvals, const float *array, double *minval, double *maxval) +{ + float minv = array[0]; + float maxv = array[0]; + for (size_t i = 0; i < nvals; ++i) + { + minv = (array[i] < minv) ? array[i] : minv; + maxv = (array[i] > maxv) ? array[i] : maxv; + } + + *minval = minv; + *maxval = maxv; +} + +void +cdf_put_vara_double(int ncid, int varid, const size_t start[], const size_t count[], const double *dp) +{ + int status = nc_put_vara_double(ncid, varid, start, count, dp); + + if (CDF_Debug || status != NC_NOERR) + { + char name[256]; + nc_inq_varname(ncid, varid, name); + nc_type xtype; + nc_inq_vartype(ncid, varid, &xtype); + int ndims; + nc_inq_varndims(ncid, varid, &ndims); + double minval = 0.0, maxval = 0.0; + size_t nvals = 1; + for (int i = 0; i < ndims; ++i) nvals *= count[i]; + minmaxval(nvals, dp, &minval, &maxval); + Message("name=%s type=%s minval=%f maxval=%f", name, cdf_var_type(xtype), minval, maxval); + } + + if (status != NC_NOERR) Error("%s", nc_strerror(status)); +} + +void +cdf_put_vara_float(int ncid, int varid, const size_t start[], const size_t count[], const float *fp) +{ + int status = nc_put_vara_float(ncid, varid, start, count, fp); + + if (CDF_Debug || status != NC_NOERR) + { + char name[256]; + nc_inq_varname(ncid, varid, name); + nc_type xtype; + nc_inq_vartype(ncid, varid, &xtype); + int ndims; + nc_inq_varndims(ncid, varid, &ndims); + double minval = 0.0, maxval = 0.0; + size_t nvals = 1; + for (int i = 0; i < ndims; ++i) nvals *= count[i]; + minmaxvalf(nvals, fp, &minval, &maxval); + Message("name=%s type=%s minval=%f maxval=%f", name, cdf_var_type(xtype), minval, maxval); + } + + if (status != NC_NOERR) Error("%s", nc_strerror(status)); +} + +void +cdf_put_vara(int ncid, int varid, const size_t start[], const size_t count[], const void *cp) +{ + int status = nc_put_vara(ncid, varid, start, count, cp); + + if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d", ncid, varid); + + if (status != NC_NOERR) Error("%s", nc_strerror(status)); +} + +void +cdf_get_vara(int ncid, int varid, const size_t start[], const size_t count[], void *cp) +{ + int status = nc_get_vara(ncid, varid, start, count, cp); + + if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d", ncid, varid); + + if (status != NC_NOERR) Error("%s", nc_strerror(status)); +} + +void +cdf_get_vara_int(int ncid, int varid, const size_t start[], const size_t count[], int *dp) +{ + int status = nc_get_vara_int(ncid, varid, start, count, dp); + + if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d", ncid, varid); + + if (status != NC_NOERR) Error("%s", nc_strerror(status)); +} + +void +cdf_get_vara_double(int ncid, int varid, const size_t start[], const size_t count[], double *dp) +{ + int status = nc_get_vara_double(ncid, varid, start, count, dp); + + if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d start[0]=%zu count[0]=%zu", ncid, varid, start[0], count[0]); + + if (status != NC_NOERR) Error("%s", nc_strerror(status)); +} + +void +cdf_get_vara_float(int ncid, int varid, const size_t start[], const size_t count[], float *fp) +{ + int status = nc_get_vara_float(ncid, varid, start, count, fp); + + if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d start[0]=%zu count[0]=%zu", ncid, varid, start[0], count[0]); + + if (status != NC_NOERR) Error("%s", nc_strerror(status)); +} + +void +cdf_get_vara_text(int ncid, int varid, const size_t start[], const size_t count[], char *tp) +{ + int status = nc_get_vara_text(ncid, varid, start, count, tp); + + if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d", ncid, varid); + + if (status != NC_NOERR) Error("%s", nc_strerror(status)); +} + +void +cdf_get_vara_uchar(int ncid, int varid, const size_t start[], const size_t count[], unsigned char *tp) +{ + int status = nc_get_vara_uchar(ncid, varid, start, count, tp); + + if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d", ncid, varid); + + if (status != NC_NOERR) Error("%s", nc_strerror(status)); +} + +void +cdf_put_var_double(int ncid, int varid, const double *dp) +{ + int status = nc_put_var_double(ncid, varid, dp); + + if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d val0=%f", ncid, varid, *dp); + + if (status != NC_NOERR) Error("%s", nc_strerror(status)); +} + +void +cdf_get_var1_text(int ncid, int varid, const size_t index[], char *tp) +{ + int status = nc_get_var1_text(ncid, varid, index, tp); + + if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d", ncid, varid); + + if (status != NC_NOERR) Error("%s", nc_strerror(status)); +} + +void +cdf_get_var1_double(int ncid, int varid, const size_t index[], double *dp) +{ + int status = nc_get_var1_double(ncid, varid, index, dp); + + if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d", ncid, varid); + + if (status != NC_NOERR) Error("%s", nc_strerror(status)); +} + +void +cdf_put_var1_double(int ncid, int varid, const size_t index[], const double *dp) +{ + int status = nc_put_var1_double(ncid, varid, index, dp); + + if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d val=%f", ncid, varid, *dp); + + if (status != NC_NOERR) Error("%s", nc_strerror(status)); +} + +void +cdf_get_var_text(int ncid, int varid, char *tp) +{ + int status = nc_get_var_text(ncid, varid, tp); + + if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d", ncid, varid); + + if (status != NC_NOERR) Error("%s", nc_strerror(status)); +} + +void +cdf_get_var_short(int ncid, int varid, short *sp) +{ + int status = nc_get_var_short(ncid, varid, sp); + + if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d", ncid, varid); + + if (status != NC_NOERR) Error("%s", nc_strerror(status)); +} + +void +cdf_get_var_int(int ncid, int varid, int *ip) +{ + int status = nc_get_var_int(ncid, varid, ip); + + if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d", ncid, varid); + + if (status != NC_NOERR) Error("%s", nc_strerror(status)); +} + +void +cdf_get_var_long(int ncid, int varid, long *lp) +{ + int status = nc_get_var_long(ncid, varid, lp); + + if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d", ncid, varid); + + if (status != NC_NOERR) Error("%s", nc_strerror(status)); +} + +void +cdf_get_var_float(int ncid, int varid, float *fp) +{ + int status = nc_get_var_float(ncid, varid, fp); + + if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d", ncid, varid); + + if (status != NC_NOERR) Error("%s", nc_strerror(status)); +} + +void +cdf_get_var_double(int ncid, int varid, double *dp) +{ + int status = nc_get_var_double(ncid, varid, dp); + + if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d val[0]=%f", ncid, varid, *dp); + + if (status != NC_NOERR) Error("%s", nc_strerror(status)); +} + +void +cdf_copy_att(int ncid_in, int varid_in, const char *name, int ncid_out, int varid_out) +{ + int status = nc_copy_att(ncid_in, varid_in, name, ncid_out, varid_out); + + if (CDF_Debug || status != NC_NOERR) Message("%d %d %s %d %d", ncid_in, varid_out, name, ncid_out, varid_out); + + if (status != NC_NOERR) Error("%s", nc_strerror(status)); +} + +void +cdf_put_att_text(int ncid, int varid, const char *name, size_t len, const char *tp) +{ + int status = nc_put_att_text(ncid, varid, name, len, tp); + + if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d att=%s text=%.*s", ncid, varid, name, (int) len, tp); + + if (status != NC_NOERR) Error("%s", nc_strerror(status)); +} + +void +cdf_put_att_int(int ncid, int varid, const char *name, nc_type xtype, size_t len, const int *ip) +{ + int status = nc_put_att_int(ncid, varid, name, xtype, len, ip); + + if (status == NC_ERANGE) status = NC_NOERR; + + if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d att=%s val=%d", ncid, varid, name, *ip); + + if (status != NC_NOERR) Error("%s", nc_strerror(status)); +} + +void +cdf_put_att_float(int ncid, int varid, const char *name, nc_type xtype, size_t len, const float *dp) +{ + int status = nc_put_att_float(ncid, varid, name, xtype, len, dp); + + if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d att=%s val=%g", ncid, varid, name, *dp); + + if (status != NC_NOERR) Error("%s", nc_strerror(status)); +} + +void +cdf_put_att_double(int ncid, int varid, const char *name, nc_type xtype, size_t len, const double *dp) +{ + int status = nc_put_att_double(ncid, varid, name, xtype, len, dp); + + if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d att=%s val=%g", ncid, varid, name, *dp); + + if (status != NC_NOERR) Error("%s", nc_strerror(status)); +} + +void +cdf_get_att_text(int ncid, int varid, const char *name, char *tp) +{ + int status = nc_get_att_text(ncid, varid, name, tp); + + if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d name=%s", ncid, varid, name); + + if (status != NC_NOERR) Error("%s", nc_strerror(status)); +} + +void +cdf_get_att_string(int ncid, int varid, const char *name, char **tp) +{ +#ifdef HAVE_NETCDF4 + int status = nc_get_att_string(ncid, varid, name, tp); + + if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d name=%s", ncid, varid, name); + + if (status != NC_NOERR) Error("%s", nc_strerror(status)); +#endif +} + +void +cdf_get_att_int(int ncid, int varid, const char *name, int *ip) +{ + int status = nc_get_att_int(ncid, varid, name, ip); + + if (status == NC_ERANGE) status = NC_NOERR; + + if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d att=%s val=%d", ncid, varid, name, *ip); + + if (status != NC_NOERR) Error("%s", nc_strerror(status)); +} + +void +cdf_get_att_double(int ncid, int varid, const char *name, double *dp) +{ + int status = nc_get_att_double(ncid, varid, name, dp); + + if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d att=%s val=%.9g", ncid, varid, name, *dp); + + if (status != NC_NOERR) Error("%s", nc_strerror(status)); +} + +void +cdf_inq_att(int ncid, int varid, const char *name, nc_type *xtypep, size_t *lenp) +{ + int status = nc_inq_att(ncid, varid, name, xtypep, lenp); + + if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d att=%s", ncid, varid, name); + + if (status != NC_NOERR) Error("%s", nc_strerror(status)); +} + +void +cdf_inq_atttype(int ncid, int varid, const char *name, nc_type *xtypep) +{ + int status = nc_inq_atttype(ncid, varid, name, xtypep); + + if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d att=%s", ncid, varid, name); + + if (status != NC_NOERR) Error("%s", nc_strerror(status)); +} + +void +cdf_inq_attlen(int ncid, int varid, const char *name, size_t *lenp) +{ + int status = nc_inq_attlen(ncid, varid, name, lenp); + + if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d att=%s len=%d", ncid, varid, name, *lenp); + + if (status != NC_NOERR) Error("%s", nc_strerror(status)); +} + +void +cdf_inq_attname(int ncid, int varid, int attnum, char *name) +{ + int status = nc_inq_attname(ncid, varid, attnum, name); + + if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d attnum=%d att=%s", ncid, varid, attnum, name); + + if (status != NC_NOERR) Error("%s", nc_strerror(status)); +} + +void +cdf_inq_attid(int ncid, int varid, const char *name, int *attnump) +{ + int status = nc_inq_attid(ncid, varid, name, attnump); + + if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d att=%s", ncid, varid, name); + + if (status != NC_NOERR) Error("%s", nc_strerror(status)); +} + +#ifdef HAVE_NETCDF4 +void +cdf_def_var_chunking(int ncid, int varid, int storage, const size_t *chunksizesp) +{ + int status = nc_def_var_chunking(ncid, varid, storage, chunksizesp); + if (status != NC_NOERR) Error("%s", nc_strerror(status)); +} +#endif + +#endif +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifndef _DMEMORY_H +#define _DMEMORY_H + +// clang-format off + +#include <stdio.h> + +// if DEBUG_MEMORY is defined setenv MEMORY_DEBUG to debug memory +#define DEBUG_MEMORY + +#ifndef WITH_FUNCTION_NAME +#define WITH_FUNCTION_NAME +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +extern size_t memTotal(void); +extern void memDebug(int debug); +extern void memExitOnError(void); + +#if defined DEBUG_MEMORY + +extern void *memRealloc(void *ptr, size_t size, const char *file, const char *functionname, int line); +extern void *memCalloc (size_t nobjs, size_t size, const char *file, const char *functionname, int line); +extern void *memMalloc (size_t size, const char *file, const char *functionname, int line); +extern void memFree (void *ptr, const char *file, const char *functionname, int line); + +#ifdef __cplusplus +} +#endif + +#ifdef WITH_FUNCTION_NAME +# define Realloc(p, s) memRealloc((p), (s), __FILE__, __func__, __LINE__) +# define Calloc(n, s) memCalloc((n), (s), __FILE__, __func__, __LINE__) +# define Malloc(s) memMalloc((s), __FILE__, __func__, __LINE__) +# define Free(p) memFree((p), __FILE__, __func__, __LINE__) +#else +# define Realloc(p, s) memRealloc((p), (s), __FILE__, (void *) NULL, __LINE__) +# define Calloc(n, s) memCalloc((n), (s), __FILE__, (void *) NULL, __LINE__) +# define Malloc(s) memMalloc((s), __FILE__, (void *) NULL, __LINE__) +# define Free(p) memFree((p), __FILE__, (void *) NULL, __LINE__) +#endif + +#endif /* DEBUG_MEMORY */ + +// clang-format on + +#endif /* _DMEMORY_H */ +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifndef CDF_UTIL_H_ +#define CDF_UTIL_H_ + +#include <stdbool.h> + +bool xtypeIsText(int xtype); + +int get_time_units(size_t len, const char *ptu); + +bool is_time_units(const char *timeunits); +bool is_timeaxis_units(const char *timeunits); + +bool is_height_units(const char *units); +bool is_pressure_units(const char *units); +bool is_DBL_axis(/*const char *units,*/ const char *longname); +bool is_depth_axis(const char *stdname, const char *longname); +bool is_height_axis(const char *stdname, const char *longname); +bool is_altitude_axis(const char *stdname, const char *longname); +bool is_reference_axis(const char *stdname, const char *longname); + +bool is_lon_axis(const char *units, const char *stdname); +bool is_lat_axis(const char *units, const char *stdname); + +bool is_x_axis(const char *units, const char *stdname); +bool is_y_axis(const char *units, const char *stdname); + +void cdf_set_gridtype(const char *attstring, int *gridtype); +void cdf_set_zaxistype(const char *attstring, int *zaxistype); +int attribute_to_calendar(const char *attstring); + +#endif +#include <string.h> +#include <ctype.h> + + +char * +str_to_lower(char *str) +{ + if (str) + for (size_t i = 0; str[i]; ++i) str[i] = (char) tolower((int) str[i]); + + return str; +} + +bool +strStartsWith(const char *vstr, const char *cstr) +{ + bool is_equal = false; + if (vstr && cstr) + { + const size_t clen = strlen(cstr); + const size_t vlen = strlen(vstr); + if (clen <= vlen) is_equal = (memcmp(vstr, cstr, clen) == 0); + } + return is_equal; +} + +int +get_time_units(size_t len, const char *ptu) +{ + int timeunit = -1; + + while (isspace(*ptu) && len) + { + ptu++; + len--; + } + + // clang-format off + if (len > 2) + { + if (strStartsWith(ptu, "sec")) timeunit = TUNIT_SECOND; + else if (strStartsWith(ptu, "minute")) timeunit = TUNIT_MINUTE; + else if (strStartsWith(ptu, "hour")) timeunit = TUNIT_HOUR; + else if (strStartsWith(ptu, "day")) timeunit = TUNIT_DAY; + else if (strStartsWith(ptu, "month")) timeunit = TUNIT_MONTH; + else if (strStartsWith(ptu, "calendar_month")) timeunit = TUNIT_MONTH; + else if (strStartsWith(ptu, "year")) timeunit = TUNIT_YEAR; + } + else if (len == 1 && ptu[0] == 's') timeunit = TUNIT_SECOND; + // clang-format on + + return timeunit; +} + +bool +is_time_units(const char *timeunits) +{ + while (isspace(*timeunits)) timeunits++; + + // clang-format off + return (strStartsWith(timeunits, "sec") + || strStartsWith(timeunits, "minute") + || strStartsWith(timeunits, "hour") + || strStartsWith(timeunits, "day") + || strStartsWith(timeunits, "month") + || strStartsWith(timeunits, "calendar_month") + || strStartsWith(timeunits, "year")); + // clang-format on +} + +bool +is_timeaxis_units(const char *timeunits) +{ + bool status = false; + + const size_t len = strlen(timeunits); + char *tu = (char *) malloc((len + 1) * sizeof(char)); + + for (size_t i = 0; i < len; i++) tu[i] = (char) tolower((int) timeunits[i]); + + int timeunit = get_time_units(len, tu); + if (timeunit != -1) + { + size_t pos = 0; + while (!isspace(tu[pos]) && tu[pos] != 0) pos++; + if (tu[pos]) + { + while (isspace(tu[pos])) pos++; + + status = strStartsWith(tu + pos, "as") || strStartsWith(tu + pos, "since"); + } + } + + free(tu); + + return status; +} + +bool +is_height_units(const char *units) +{ + int u0 = units[0]; + + // clang-format off + return ((u0=='m' && (!units[1] || strStartsWith(units, "meter"))) + || (!units[2] && units[1]=='m' && (u0=='c' || u0=='d' || u0=='k')) + || (strStartsWith(units, "decimeter")) + || (strStartsWith(units, "centimeter")) + || (strStartsWith(units, "millimeter")) + || (strStartsWith(units, "kilometer"))); + // clang-format on +} + +bool +is_pressure_units(const char *units) +{ + // clang-format off + return (strStartsWith(units, "millibar") + || strStartsWith(units, "mb") + || strStartsWith(units, "hectopas") + || strStartsWith(units, "hPa") + || strStartsWith(units, "Pa")); + // clang-format on +} + +bool +is_DBL_axis(const char *longname) +{ + // clang-format off + return (str_is_equal(longname, "depth below land") + || str_is_equal(longname, "depth_below_land") + || str_is_equal(longname, "levels below the surface")); + // clang-format on +} + +bool +is_depth_axis(const char *stdname, const char *longname) +{ + // clang-format off + return (str_is_equal(stdname, "depth") + || str_is_equal(longname, "depth_below_sea") + || str_is_equal(longname, "depth below sea")); + // clang-format ofn +} + + +bool is_height_axis(const char *stdname, const char *longname) +{ + // clang-format off + return (str_is_equal(stdname, "height") + || str_is_equal(longname, "height") + || str_is_equal(longname, "height above the surface")); + // clang-format on +} + +bool +is_altitude_axis(const char *stdname, const char *longname) +{ + // clang-format off + return (str_is_equal(stdname, "altitude") + || str_is_equal(longname, "altitude")); + // clang-format on +} + +bool +is_reference_axis(const char *stdname, const char *longname) +{ + // clang-format off + return ((str_is_equal(longname, "generalized_height") || str_is_equal(longname, "generalized height")) + && str_is_equal(stdname, "height")); + // clang-format on +} + +bool +is_lon_axis(const char *units, const char *stdname) +{ + bool status = false; + char lc_units[16]; + + memcpy(lc_units, units, 15); + lc_units[15] = 0; + str_to_lower(lc_units); + + if ((strStartsWith(lc_units, "degree") || strStartsWith(lc_units, "radian")) + && (strStartsWith(stdname, "grid_longitude") || strStartsWith(stdname, "longitude"))) + { + status = true; + } + else if (strStartsWith(lc_units, "degree") && !strStartsWith(stdname, "grid_latitude") && !strStartsWith(stdname, "latitude")) + { + int ioff = 6; + if (lc_units[ioff] == 's') ioff++; + if (lc_units[ioff] == ' ') ioff++; + if (lc_units[ioff] == '_') ioff++; + if (lc_units[ioff] == 'e') status = true; + } + + return status; +} + +bool +is_lat_axis(const char *units, const char *stdname) +{ + bool status = false; + char lc_units[16]; + + memcpy(lc_units, units, 15); + lc_units[15] = 0; + str_to_lower(lc_units); + + if ((strStartsWith(lc_units, "degree") || strStartsWith(lc_units, "radian")) + && (strStartsWith(stdname, "grid_latitude") || strStartsWith(stdname, "latitude"))) + { + status = true; + } + else if (strStartsWith(lc_units, "degree") && !strStartsWith(stdname, "grid_longitude") && !strStartsWith(stdname, "longitude")) + { + int ioff = 6; + if (lc_units[ioff] == 's') ioff++; + if (lc_units[ioff] == ' ') ioff++; + if (lc_units[ioff] == '_') ioff++; + if (lc_units[ioff] == 'n' || lc_units[ioff] == 's') status = true; + } + + return status; +} + +bool +is_x_axis(const char *units, const char *stdname) +{ + (void) units; + return (str_is_equal(stdname, "projection_x_coordinate")); +} + +bool +is_y_axis(const char *units, const char *stdname) +{ + (void) units; + return (str_is_equal(stdname, "projection_y_coordinate")); +} + +void +cdf_set_gridtype(const char *attstring, int *gridtype) +{ + // clang-format off + if (str_is_equal(attstring, "gaussian_reduced")) *gridtype = GRID_GAUSSIAN_REDUCED; + else if (str_is_equal(attstring, "gaussian")) *gridtype = GRID_GAUSSIAN; + else if (strStartsWith(attstring, "spectral")) *gridtype = GRID_SPECTRAL; + else if (strStartsWith(attstring, "fourier")) *gridtype = GRID_FOURIER; + else if (str_is_equal(attstring, "trajectory")) *gridtype = GRID_TRAJECTORY; + else if (str_is_equal(attstring, "generic")) *gridtype = GRID_GENERIC; + else if (str_is_equal(attstring, "cell")) *gridtype = GRID_UNSTRUCTURED; + else if (str_is_equal(attstring, "unstructured")) *gridtype = GRID_UNSTRUCTURED; + else if (str_is_equal(attstring, "curvilinear")) ; + else if (str_is_equal(attstring, "characterxy")) *gridtype = GRID_CHARXY; + else if (str_is_equal(attstring, "sinusoidal")) ; + else if (str_is_equal(attstring, "laea")) ; + else if (str_is_equal(attstring, "lcc2")) ; + else if (str_is_equal(attstring, "linear")) ; // ignore grid type linear + else + { + static bool warn = true; + if (warn) + { + warn = false; + Warning("NetCDF attribute grid_type='%s' unsupported!", attstring); + } + } + // clang-format on +} + +void +cdf_set_zaxistype(const char *attstring, int *zaxistype) +{ + // clang-format off + if (str_is_equal(attstring, "toa")) *zaxistype = ZAXIS_TOA; + else if (str_is_equal(attstring, "tropopause")) *zaxistype = ZAXIS_TROPOPAUSE; + else if (str_is_equal(attstring, "cloudbase")) *zaxistype = ZAXIS_CLOUD_BASE; + else if (str_is_equal(attstring, "cloudtop")) *zaxistype = ZAXIS_CLOUD_TOP; + else if (str_is_equal(attstring, "isotherm0")) *zaxistype = ZAXIS_ISOTHERM_ZERO; + else if (str_is_equal(attstring, "seabottom")) *zaxistype = ZAXIS_SEA_BOTTOM; + else if (str_is_equal(attstring, "lakebottom")) *zaxistype = ZAXIS_LAKE_BOTTOM; + else if (str_is_equal(attstring, "sedimentbottom")) *zaxistype = ZAXIS_SEDIMENT_BOTTOM; + else if (str_is_equal(attstring, "sedimentbottomta")) *zaxistype = ZAXIS_SEDIMENT_BOTTOM_TA; + else if (str_is_equal(attstring, "sedimentbottomtw")) *zaxistype = ZAXIS_SEDIMENT_BOTTOM_TW; + else if (str_is_equal(attstring, "mixlayer")) *zaxistype = ZAXIS_MIX_LAYER; + else if (str_is_equal(attstring, "atmosphere")) *zaxistype = ZAXIS_ATMOSPHERE; + else + { + static bool warn = true; + if (warn) + { + warn = false; + Warning("NetCDF attribute level_type='%s' unsupported!", attstring); + } + } + // clang-format on +} + +int +attribute_to_calendar(const char *attstring) +{ + int calendar = CALENDAR_STANDARD; + // clang-format off + if (strStartsWith(attstring, "standard")) calendar = CALENDAR_STANDARD; + else if (strStartsWith(attstring, "gregorian")) calendar = CALENDAR_GREGORIAN; + else if (strStartsWith(attstring, "none")) calendar = CALENDAR_NONE; + else if (strStartsWith(attstring, "proleptic")) calendar = CALENDAR_PROLEPTIC; + else if (strStartsWith(attstring, "360")) calendar = CALENDAR_360DAYS; + else if (strStartsWith(attstring, "365") || + strStartsWith(attstring, "noleap")) calendar = CALENDAR_365DAYS; + else if (strStartsWith(attstring, "366") || + strStartsWith(attstring, "all_leap")) calendar = CALENDAR_366DAYS; + else Warning("calendar >%s< unsupported!", attstring); + // clang-format on + return calendar; +} +#ifndef CDI_KEY_H +#define CDI_KEY_H + + +// CDI key +typedef struct +{ + int key; // CDI key + int type; // KEY_INT, KEY_FLOAT, KEY_BYTES + int length; // number of bytes in v.s + union + { + int i; + double d; + unsigned char *s; + } v; +} cdi_key_t; + +typedef struct +{ + size_t nalloc; // number allocated >= nelems + size_t nelems; // length of the array + cdi_key_t value[MAX_KEYS]; +} cdi_keys_t; + +enum +{ + KEY_INT = 1, + KEY_FLOAT, + KEY_BYTES +}; + +void cdiDefVarKeyInt(cdi_keys_t *keysp, int key, int value); +void cdiDefVarKeyFloat(cdi_keys_t *keysp, int key, double value); +void cdiDefVarKeyBytes(cdi_keys_t *keysp, int key, const unsigned char *bytes, int length); +int cdiInqVarKeyInt(const cdi_keys_t *keysp, int key); +int cdiInqVarKeyBytes(const cdi_keys_t *keysp, int key, unsigned char *bytes, int *length); + +cdi_key_t *find_key(cdi_keys_t *keysp, int key); +const char *cdiInqVarKeyStringPtr(const cdi_keys_t *keysp, int key); + +static inline const char * +cdiInqVarKeyString(const cdi_keys_t *keysp, int key) +{ + const char *string = cdiInqVarKeyStringPtr(keysp, key); + if (string == NULL) string = ""; + return string; +} + +int cdiCopyVarKey(const cdi_keys_t *keysp1, int key, cdi_keys_t *keysp2); +void cdiCopyVarKeys(const cdi_keys_t *keysp1, cdi_keys_t *keysp2); +void cdiDeleteVarKeys(cdi_keys_t *keysp); +void cdiDeleteKeys(int cdiID, int varID); +void cdiPrintKeys(int cdiID, int varID); + +void cdiInitKeys(cdi_keys_t *keysp); + +int cdi_key_compare(cdi_keys_t *keyspa, cdi_keys_t *keyspb, int keynum); + +#endif + +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifndef CDI_ATT_H +#define CDI_ATT_H + +#ifdef HAVE_CONFIG_H +#endif + +#ifndef CDI_LIMITS_H +#endif + +// CDI attribute +// clang-format off +typedef struct +{ + size_t xsz; // amount of space at xvalue + size_t namesz; // size of name + char *name; // attribute name + int indtype; // internal data type of xvalue (INT, FLT or TXT) + int exdtype; // external data type + // indtype exdtype + // TXT TXT + // INT INT16, INT32 + // FLT FLT32, FLT64 + size_t nelems; // number of elements + void *xvalue; // the actual data +} cdi_att_t; +// clang-format on + +// clang-format off +typedef struct +{ + size_t nalloc; // number allocated >= nelems + size_t nelems; // length of the array + cdi_att_t value[MAX_ATTRIBUTES]; +} cdi_atts_t; +// clang-format on + +int cdiDeleteAtts(int vlistID, int varID); +int cdiAttsGetSize(void *p, int varID, void *context); +void cdiAttsPack(void *p, int varID, void *buf, int size, int *position, void *context); +void cdiAttsUnpack(int cdiID, int varID, void *buf, int size, int *position, void *context); + +int cdi_att_compare(cdi_atts_t *attspa, cdi_atts_t *attspb, int attnum); + +#endif + +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifndef GRID_H +#define GRID_H + +#include <stdbool.h> + + +typedef unsigned char mask_t; + +typedef struct grid_t grid_t; + +enum gridPropInq +{ + GRID_PROP_MASK, + GRID_PROP_MASK_GME, + GRID_PROP_XVALS, + GRID_PROP_YVALS, + GRID_PROP_AREA, + GRID_PROP_XBOUNDS, + GRID_PROP_YBOUNDS, +}; + +struct gridVirtTable +{ + void (*destroy)(grid_t *gridptr); + grid_t *(*copy)(grid_t *gridptr); + void (*copyScalarFields)(grid_t *gridptrOrig, grid_t *gridptrDup); + void (*copyArrayFields)(grid_t *gridptrOrig, grid_t *gridptrDup); + void (*defXVals)(grid_t *gridptr, const double *xvals); + void (*defYVals)(grid_t *gridptr, const double *yvals); + void (*defMask)(grid_t *gridptr, const int *mask); + void (*defMaskGME)(grid_t *gridptr, const int *mask); + void (*defXBounds)(grid_t *gridptr, const double *xbounds); + void (*defYBounds)(grid_t *gridptr, const double *ybounds); + void (*defArea)(grid_t *gridptr, const double *area); + double (*inqXVal)(grid_t *gridptr, SizeType index); + double (*inqYVal)(grid_t *gridptr, SizeType index); + SizeType (*inqXVals)(grid_t *gridptr, double *xvals); + SizeType (*inqXValsPart)(grid_t *gridptr, int start, SizeType length, double *xvals); + SizeType (*inqYVals)(grid_t *gridptr, double *yvals); + SizeType (*inqYValsPart)(grid_t *gridptr, int start, SizeType length, double *yvals); + const double *(*inqXValsPtr)(grid_t *gridptr); + const double *(*inqYValsPtr)(grid_t *gridptr); +#ifndef USE_MPI + int (*inqXIsc)(grid_t *gridptr); + int (*inqYIsc)(grid_t *gridptr); + SizeType (*inqXCvals)(grid_t *gridptr, char **xcvals); + SizeType (*inqYCvals)(grid_t *gridptr, char **ycvals); + const char **(*inqXCvalsPtr)(grid_t *gridptr); + const char **(*inqYCvalsPtr)(grid_t *gridptr); +#endif + double (*inqXInc)(grid_t *gridptr); + double (*inqYInc)(grid_t *gridptr); + // return true if for both grids, any xval and all yval differ + bool (*compareXYFull)(grid_t *gridRef, grid_t *gridTest); + // return if for both grids, x[0], y[0], x[size-1] and y[size-1] are respectively equal + bool (*compareXYAO)(grid_t *gridRef, grid_t *gridTest); + void (*inqArea)(grid_t *gridptr, double *area); + const double *(*inqAreaPtr)(grid_t *gridptr); + /* return 1 if inq property is set */ + int (*inqPropPresence)(grid_t *gridptr, enum gridPropInq inq); + SizeType (*inqMask)(grid_t *gridptr, int *mask); + int (*inqMaskGME)(grid_t *gridptr, int *mask_gme); + SizeType (*inqXBounds)(grid_t *gridptr, double *xbounds); + SizeType (*inqYBounds)(grid_t *gridptr, double *ybounds); + const double *(*inqXBoundsPtr)(grid_t *gridptr); + const double *(*inqYBoundsPtr)(grid_t *gridptr); + int txCode; + int (*getPackSize)(grid_t *gridptr, void *context); + int (*getPackSizeScalars)(grid_t *gridptr, void *context); + int (*getPackSizeArrays)(grid_t *gridptr, void *context); + int (*unpack)(char *unpackBuffer, int unpackBufferSize, int *unpackBufferPos, int originNamespace, void *context, int force_id); + grid_t *(*unpackScalars)(char *unpackBuffer, int unpackBufferSize, int *unpackBufferPos, int originNamespace, void *context, + int force_id, int *memberMaskP); + void (*unpackArrays)(grid_t *gridptr, int memberMask, char *unpackBuffer, int unpackBufferSize, int *unpackBufferPos, + int originNamespace, void *context); + void (*pack)(grid_t *gridptr, void *packBuffer, int packBufferSize, int *packBufferPos, void *context); + /* return member mask */ + int (*packScalars)(grid_t *gridptr, void *packBuffer, int packBufferSize, int *packBufferPos, void *context); + void (*packArrays)(grid_t *gridptr, int memberMask, void *packBuffer, int packBufferSize, int *packBufferPos, void *context); +}; + +struct gridaxis_t +{ + size_t size; // number of values + short flag; // 0: undefined 1:vals 2:first+inc + double first, last, inc; + double *vals; + double *bounds; + cdi_keys_t keys; +#ifndef USE_MPI + int clength; + char **cvals; +#endif +}; + +// GME Grid +struct grid_gme_t +{ + int nd, ni, ni2, ni3; // parameter for GRID_GME +}; + +struct grid_t +{ + char *name; + int self; + size_t size; + int type; // grid type + int datatype; // grid data type (used only internal in gridComplete()) + int proj; // grid projection + int projtype; // grid projection type + mask_t *mask; + mask_t *mask_gme; + double *area; + struct grid_gme_t gme; + int trunc; // parameter for GRID_SPECTRAL + int nvertex; + int *reducedPoints; + int reducedPointsSize; + int np; // number of parallels between a pole and the equator + signed char isCyclic; // three possible states: + // -1 if unknown, + // 0 if found not cyclic, or + // 1 for global cyclic grids + bool lcomplex; + bool hasdims; + struct gridaxis_t x; + struct gridaxis_t y; + const struct gridVirtTable *vtable; + cdi_keys_t keys; + cdi_atts_t atts; + void *extraData; +}; + +void grid_init(grid_t *gridptr); +void cdiGridTypeInit(grid_t *gridptr, int gridtype, size_t size); +void grid_free(grid_t *gridptr); +grid_t *grid_to_pointer(int gridID); +extern const struct gridVirtTable cdiGridVtable; + +unsigned cdiGridCount(void); + +void gridVerifyProj(int gridID); + +double gridInqXincInMeter(int gridID); +double gridInqYincInMeter(int gridID); + +// const double *gridInqXvalsPtr(int gridID); +// const double *gridInqYvalsPtr(int gridID); + +const char **gridInqXCvalsPtr(int gridID); +const char **gridInqYCvalsPtr(int gridID); + +// const double *gridInqXboundsPtr(int gridID); +// const double *gridInqYboundsPtr(int gridID); +const double *gridInqAreaPtr(int gridID); + +int gridInqPropPresence(int gridID, enum gridPropInq inq); + +int gridGenerate(const grid_t *grid); + +// int gridIsEqual(int gridID1, int gridID2); + +void cdiGridGetIndexList(unsigned, int *); + +int gridUnpack(char *unpackBuffer, int unpackBufferSize, int *unpackBufferPos, int originNamespace, void *context, int force_id); + +/* apply func to each grid */ +enum cdiApplyRet cdiGridApply(enum cdiApplyRet (*func)(int id, void *res, void *data), void *data); + +struct addIfNewRes +{ + int Id; + int isNew; +}; + +struct addIfNewRes cdiVlistAddGridIfNew(int vlistID, grid_t *grid, int mode); + +int gridVerifyProjParamsLCC(struct CDI_GridProjParams *gpp); +int gridVerifyProjParamsSTERE(struct CDI_GridProjParams *gpp); + +bool isGaussianLatitudes(size_t nlats, const double *latitudes); +void gaussianLatitudes(size_t nlats, double *latitudes, double *weights); + +#endif +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifndef _STREAM_CDF_H +#define _STREAM_CDF_H + + +enum +{ + POSITIVE_UP = 1, + POSITIVE_DOWN = 2, +}; + +enum +{ + CDF_MAX_TIME_UNIT_STR /* maximum length of time unit string */ + = TAXIS_MAX_UNIT_STR_LEN /* longest result from tunitNamePtr */ + + 7 /* room for " since " */ + + 7 + 1 + 2 + 1 + 2 /* room for year with 7 digits, + * dashes and 2 digits for month and day */ + + 1 + 2 + 1 + 2 + 1 + 2 /* room for " " and 2 digit hour, minute, + * second */ + + 1 /* and terminating '\0' */ +}; + +int cdfDefVar(stream_t *streamptr, int varID); +void cdfDefCoordinateVars(stream_t *streamptr); +void cdfDefTimestep(stream_t *streamptr, int tsID, size_t valCount); +int cdfInqTimestep(stream_t *streamptr, int tsID); +int cdfInqContents(stream_t *streamptr); + +void cdfEndDef(stream_t *streamptr); +void cdfDefRecord(stream_t *streamptr); + +void cdfCopyRecord(stream_t *streamptr2, stream_t *streamptr1); + +void cdfDefineAttributes(int vlistID, int varID, int fileID, int ncvarID); + +void cdf_read_record(stream_t *streamptr, int memtype, void *data, size_t *nmiss); +void cdf_write_record(stream_t *streamptr, int memtype, const void *data, size_t nmiss); + +void cdf_read_var(stream_t *streamptr, int varID, int memtype, void *data, size_t *nmiss); +void cdf_write_var(stream_t *streamptr, int varID, int memtype, const void *data, size_t nmiss); + +void cdf_read_var_slice(stream_t *streamptr, int varID, int levelID, int memtype, void *data, size_t *nmiss); +void cdf_write_var_slice(stream_t *streamptr, int varID, int levelID, int memtype, const void *data, size_t nmiss); + +void cdf_write_var_chunk(stream_t *streamptr, int varID, int memtype, const int rect[][2], const void *data, size_t nmiss); + +void cdfDefVarDeflate(int ncid, int ncvarid, int deflateLevel); +void cdfDefTime(stream_t *streamptr); + +void cdf_scale_add(size_t size, double *data, double addoffset, double scalefactor); + +int cdfDefDatatype(int datatype, stream_t *streamptr); + +void cdf_create_records(stream_t *streamptr, int tsID); + +#define ChunkSizeMax 65536 +#define ChunkSizeLim 16777216 +size_t calc_chunksize_x(int chunkType, int chunkSize, size_t xsize, bool yIsUndefined); +size_t calc_chunksize_y(int chunkType, size_t gridsize, size_t xsize, size_t ysize); + +#endif +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifndef CDF_LAZY_GRID_H_ +#define CDF_LAZY_GRID_H_ + +#ifdef HAVE_CONFIG_H +#endif + +#ifdef HAVE_MMAP +#include <unistd.h> +#include <sys/mman.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#endif + +#ifdef HAVE_LIBPTHREAD +#include <pthread.h> +#endif + +#include <string.h> + + +struct xyValGet +{ + double scalefactor, addoffset; + size_t start[3], count[3], size, dimsize; + int datasetNCId, varNCId; + short ndims; +}; + +struct cdfLazyGridIds +{ + int datasetNCId, varNCId; +}; + +struct cdfLazyGrid +{ + grid_t base; + const struct gridVirtTable *baseVtable; + struct cdfLazyGridIds cellAreaGet, xBoundsGet, yBoundsGet; + struct xyValGet xValsGet, yValsGet; +#ifdef HAVE_LIBPTHREAD + pthread_mutex_t loadSerialize; +#endif +}; + +extern double *cdfPendingLoad; + +void cdfLazyGridRenew(struct cdfLazyGrid *restrict *restrict gridpptr, int gridtype); +void cdfBaseGridRenew(struct cdfLazyGrid *restrict *restrict gridpptr, int gridtype); + +void cdfLazyGridDestroy(struct cdfLazyGrid *lazyGrid); + +#endif +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifdef HAVE_CONFIG_H +#endif + +#ifdef HAVE_LIBNETCDF + +static struct gridVirtTable cdfLazyGridVtable; +double *cdfPendingLoad; +#ifdef HAVE_LIBPTHREAD +static pthread_once_t cdfLazyInitialized = PTHREAD_ONCE_INIT; +#else +static bool cdfLazyInitialized; +#endif + +#ifdef HAVE_LIBPTHREAD +#define lock_lazy_load(plGrid) pthread_mutex_lock(&((plGrid)->loadSerialize)) +#define unlock_lazy_load(plGrid) pthread_mutex_unlock(&((plGrid)->loadSerialize)) +#define destroy_lazy_load_lock(plGrid) pthread_mutex_destroy(&((plGrid)->loadSerialize)) +#define init_lazy_load_lock(plGrid) pthread_mutex_init(&((plGrid)->loadSerialize), NULL) +#else +#define lock_lazy_load(plGrid) +#define unlock_lazy_load(plGrid) +#define destroy_lazy_load_lock(plGrid) +#define init_lazy_load_lock(plGrid) +#endif + +void +cdfLazyGridDestroy(struct cdfLazyGrid *lazyGrid) +{ + lazyGrid->base.extraData = NULL; + if (lazyGrid->base.area == cdfPendingLoad) lazyGrid->base.area = NULL; + if (lazyGrid->base.x.vals == cdfPendingLoad) lazyGrid->base.x.vals = NULL; + if (lazyGrid->base.y.vals == cdfPendingLoad) lazyGrid->base.y.vals = NULL; + if (lazyGrid->base.x.bounds == cdfPendingLoad) lazyGrid->base.x.bounds = NULL; + if (lazyGrid->base.y.bounds == cdfPendingLoad) lazyGrid->base.y.bounds = NULL; + destroy_lazy_load_lock(lazyGrid); +} + +static void +cdfLazyGridDelete(grid_t *grid) +{ + struct cdfLazyGrid *cdfGrid = (struct cdfLazyGrid *) grid; + void (*baseDestroy)(grid_t * grid) = cdfGrid->baseVtable->destroy; + cdfLazyGridDestroy(cdfGrid); + baseDestroy(grid); +} + +static void +cdfLazyGridDestroyOnce(void) +{ + /* +#ifdef HAVE_MMAP + size_t pgSize = cdiGetPageSize(false); + munmap(cdfPendingLoad, pgSize); +#endif + */ +} + +static void +cdfLazyGridDefArea(grid_t *grid, const double *area) +{ + struct cdfLazyGrid *cdfGrid = (struct cdfLazyGrid *) grid; + lock_lazy_load(cdfGrid); + if (grid->area == cdfPendingLoad) grid->area = NULL; + cdfGrid->cellAreaGet.datasetNCId = -1; + cdfGrid->cellAreaGet.varNCId = -1; + cdfGrid->baseVtable->defArea(grid, area); + unlock_lazy_load(cdfGrid); +} + +static const double * +cdfLazyGridInqAreaPtr(grid_t *grid) +{ + struct cdfLazyGrid *lazyGrid = (struct cdfLazyGrid *) grid; + lock_lazy_load(lazyGrid); + if (grid->area == cdfPendingLoad) + { + grid->area = (double *) Malloc(grid->size * sizeof(double)); + cdf_get_var_double(lazyGrid->cellAreaGet.datasetNCId, lazyGrid->cellAreaGet.varNCId, grid->area); + } + unlock_lazy_load(lazyGrid); + return lazyGrid->baseVtable->inqAreaPtr(grid); +} + +static void +cdfLazyGridInqArea(grid_t *grid, double *area) +{ + grid->vtable->inqAreaPtr(grid); + struct cdfLazyGrid *lazyGrid = (struct cdfLazyGrid *) grid; + lazyGrid->baseVtable->inqArea(grid, area); +} + +static void +cdfLazyLoadXYVals(struct xyValGet *valsGet, double **valsp) +{ + double *grid_vals = (double *) Malloc(valsGet->size * sizeof(double)); + *valsp = grid_vals; + if (valsGet->ndims == 3) + cdf_get_vara_double(valsGet->datasetNCId, valsGet->varNCId, valsGet->start, valsGet->count, grid_vals); + else + cdf_get_var_double(valsGet->datasetNCId, valsGet->varNCId, grid_vals); + cdf_scale_add(valsGet->size, grid_vals, valsGet->addoffset, valsGet->scalefactor); +} + +static const double * +cdfLazyGridInqXValsPtr(grid_t *grid) +{ + struct cdfLazyGrid *lazyGrid = (struct cdfLazyGrid *) grid; + lock_lazy_load(lazyGrid); + if (grid->x.vals == cdfPendingLoad) cdfLazyLoadXYVals(&lazyGrid->xValsGet, &grid->x.vals); + unlock_lazy_load(lazyGrid); + return lazyGrid->baseVtable->inqXValsPtr(grid); +} + +static const double * +cdfLazyGridInqYValsPtr(grid_t *grid) +{ + struct cdfLazyGrid *lazyGrid = (struct cdfLazyGrid *) grid; + lock_lazy_load(lazyGrid); + if (grid->y.vals == cdfPendingLoad) cdfLazyLoadXYVals(&lazyGrid->yValsGet, &grid->y.vals); + unlock_lazy_load(lazyGrid); + return lazyGrid->baseVtable->inqYValsPtr(grid); +} + +static double +cdfLazyGridInqXYVal(grid_t *grid, size_t index, const struct xyValGet *valsGet, double *vals, + const double *(*inqValsPtr)(grid_t *gridptr)) +{ + size_t size = valsGet->size; + double v; + if (vals == cdfPendingLoad) + { + // prevent full load if only first/last values get inspected + if (index == 0 || index == size - 1) + { + size_t indexND[3]; + if (valsGet->ndims == 3) + { + indexND[0] = 0; + indexND[1] = index / valsGet->count[2]; + indexND[2] = index % valsGet->count[2]; + } + else if (valsGet->ndims == 2) + { + indexND[0] = index / grid->x.size; + indexND[1] = index % grid->x.size; + } + else + indexND[0] = index; + cdf_get_var1_double(valsGet->datasetNCId, valsGet->varNCId, indexND, &v); + } + else + { + const double *grid_vals = inqValsPtr(grid); + v = grid_vals[index]; + } + } + else if (vals) + v = vals[index]; + else + v = 0.0; + + return v; +} + +static void +cdfLazyGridDefXVals(grid_t *grid, const double *vals) +{ + struct cdfLazyGrid *cdfGrid = (struct cdfLazyGrid *) grid; + lock_lazy_load(cdfGrid); + if (grid->x.vals == cdfPendingLoad) grid->x.vals = NULL; + cdfGrid->xValsGet.datasetNCId = -1; + cdfGrid->xValsGet.varNCId = -1; + cdfGrid->baseVtable->defXVals(grid, vals); + unlock_lazy_load(cdfGrid); +} + +static void +cdfLazyGridDefYVals(grid_t *grid, const double *vals) +{ + struct cdfLazyGrid *cdfGrid = (struct cdfLazyGrid *) grid; + lock_lazy_load(cdfGrid); + if (grid->y.vals == cdfPendingLoad) grid->y.vals = NULL; + cdfGrid->yValsGet.datasetNCId = -1; + cdfGrid->yValsGet.varNCId = -1; + cdfGrid->baseVtable->defYVals(grid, vals); + unlock_lazy_load(cdfGrid); +} + +static double +cdfLazyGridInqXVal(grid_t *grid, SizeType index) +{ + struct cdfLazyGrid *lazyGrid = (struct cdfLazyGrid *) grid; + lock_lazy_load(lazyGrid); + const double rv = cdfLazyGridInqXYVal(grid, index, &lazyGrid->xValsGet, grid->x.vals, grid->vtable->inqXValsPtr); + unlock_lazy_load(lazyGrid); + return rv; +} + +static double +cdfLazyGridInqYVal(grid_t *grid, SizeType index) +{ + struct cdfLazyGrid *lazyGrid = (struct cdfLazyGrid *) grid; + lock_lazy_load(lazyGrid); + const double rv = cdfLazyGridInqXYVal(grid, index, &lazyGrid->yValsGet, grid->y.vals, grid->vtable->inqYValsPtr); + unlock_lazy_load(lazyGrid); + return rv; +} + +static bool +cdfLazyXYValGetCompare(struct cdfLazyGrid *lazyGridRef, struct cdfLazyGrid *lazyGridTest) +{ + struct xyValGet *valsGetXRef = &lazyGridRef->xValsGet, *valsGetYRef = &lazyGridRef->yValsGet, + *valsGetXTest = &lazyGridTest->xValsGet, *valsGetYTest = &lazyGridTest->yValsGet; + if (valsGetXRef->datasetNCId == -1 || valsGetXTest->datasetNCId == -1 || valsGetYRef->datasetNCId == -1 + || valsGetYTest->datasetNCId == -1) + return lazyGridRef->baseVtable->compareXYFull(&lazyGridRef->base, &lazyGridTest->base); + + return valsGetXRef->datasetNCId != valsGetXTest->datasetNCId || valsGetXRef->varNCId != valsGetXTest->varNCId + || valsGetYRef->datasetNCId != valsGetYTest->datasetNCId || valsGetYRef->varNCId != valsGetYTest->varNCId; +} + +static bool +cdfLazyCompareXYFull(grid_t *gridRef, grid_t *gridTest) +{ + bool diff; + struct cdfLazyGrid *lazyGridRef = (struct cdfLazyGrid *) gridRef; + if (gridTest->vtable == &cdfLazyGridVtable) + diff = cdfLazyXYValGetCompare(lazyGridRef, (struct cdfLazyGrid *) gridTest); + else + diff = lazyGridRef->baseVtable->compareXYFull(gridRef, gridTest); + return diff; +} + +static bool +cdfLazyCompareXYAO(grid_t *gridRef, grid_t *gridTest) +{ + bool diff; + struct cdfLazyGrid *lazyGridRef = (struct cdfLazyGrid *) gridRef; + if (gridTest->vtable == &cdfLazyGridVtable) + diff = cdfLazyXYValGetCompare(lazyGridRef, (struct cdfLazyGrid *) gridTest); + else + diff = lazyGridRef->baseVtable->compareXYAO(gridRef, gridTest); + return diff; +} + +static const double * +cdfLazyGridInqXBoundsPtr(grid_t *grid) +{ + struct cdfLazyGrid *lazyGrid = (struct cdfLazyGrid *) grid; + lock_lazy_load(lazyGrid); + if (grid->x.bounds == cdfPendingLoad) + { + grid->x.bounds = (double *) Malloc((size_t) grid->nvertex * grid->size * sizeof(double)); + cdf_get_var_double(lazyGrid->xBoundsGet.datasetNCId, lazyGrid->xBoundsGet.varNCId, grid->x.bounds); + } + unlock_lazy_load(lazyGrid); + return lazyGrid->baseVtable->inqXBoundsPtr(grid); +} + +static void +cdfLazyGridDefXBounds(grid_t *grid, const double *xbounds) +{ + struct cdfLazyGrid *cdfGrid = (struct cdfLazyGrid *) grid; + lock_lazy_load(cdfGrid); + if (grid->x.bounds == cdfPendingLoad) grid->x.bounds = NULL; + cdfGrid->xBoundsGet.datasetNCId = -1; + cdfGrid->xBoundsGet.varNCId = -1; + cdfGrid->baseVtable->defXBounds(grid, xbounds); + unlock_lazy_load(cdfGrid); +} + +static void +cdfLazyGridDefYBounds(grid_t *grid, const double *ybounds) +{ + struct cdfLazyGrid *cdfGrid = (struct cdfLazyGrid *) grid; + lock_lazy_load(cdfGrid); + if (grid->y.bounds == cdfPendingLoad) grid->y.bounds = NULL; + cdfGrid->yBoundsGet.datasetNCId = -1; + cdfGrid->yBoundsGet.varNCId = -1; + cdfGrid->baseVtable->defYBounds(grid, ybounds); + unlock_lazy_load(cdfGrid); +} + +static const double * +cdfLazyGridInqYBoundsPtr(grid_t *grid) +{ + struct cdfLazyGrid *lazyGrid = (struct cdfLazyGrid *) grid; + lock_lazy_load(lazyGrid); + if (grid->y.bounds == cdfPendingLoad) + { + grid->y.bounds = (double *) Malloc((size_t) grid->nvertex * grid->size * sizeof(double)); + cdf_get_var_double(lazyGrid->yBoundsGet.datasetNCId, lazyGrid->yBoundsGet.varNCId, grid->y.bounds); + } + unlock_lazy_load(lazyGrid); + return lazyGrid->baseVtable->inqYBoundsPtr(grid); +} + +static void +cdfLazyGridCopyScalarFields(grid_t *gridptrOrig, grid_t *gridptrDup) +{ + struct cdfLazyGrid *lazyGridDup = (struct cdfLazyGrid *) gridptrDup, *lazyGridOrig = (struct cdfLazyGrid *) gridptrOrig; + lazyGridOrig->baseVtable->copyScalarFields(gridptrOrig, &lazyGridDup->base); + lazyGridDup->baseVtable = lazyGridOrig->baseVtable; + lazyGridDup->cellAreaGet = lazyGridOrig->cellAreaGet; + lazyGridDup->xBoundsGet = lazyGridOrig->xBoundsGet; + lazyGridDup->yBoundsGet = lazyGridOrig->yBoundsGet; + lazyGridDup->xValsGet = lazyGridOrig->xValsGet; + lazyGridDup->yValsGet = lazyGridOrig->yValsGet; + init_lazy_load_lock(lazyGridDup); +} + +static void +cdfLazyGridCopyArrayFields(grid_t *gridptrOrig, grid_t *gridptrDup) +{ + const size_t reducedPointsSize = (size_t) gridptrOrig->reducedPointsSize; + const size_t gridsize = gridptrOrig->size; + const int gridtype = gridptrOrig->type; + const int irregular = (gridtype == GRID_CURVILINEAR || gridtype == GRID_UNSTRUCTURED); + + if (reducedPointsSize) + { + gridptrDup->reducedPoints = (int *) Malloc(reducedPointsSize * sizeof(int)); + memcpy(gridptrDup->reducedPoints, gridptrOrig->reducedPoints, reducedPointsSize * sizeof(int)); + } + + if (gridptrOrig->x.vals != NULL && gridptrOrig->x.vals != cdfPendingLoad) + { + const size_t size = irregular ? gridsize : gridptrOrig->x.size; + gridptrDup->x.vals = (double *) Malloc(size * sizeof(double)); + memcpy(gridptrDup->x.vals, gridptrOrig->x.vals, size * sizeof(double)); + } + + if (gridptrOrig->y.vals != NULL && gridptrOrig->y.vals != cdfPendingLoad) + { + const size_t size = irregular ? gridsize : gridptrOrig->y.size; + gridptrDup->y.vals = (double *) Malloc(size * sizeof(double)); + memcpy(gridptrDup->y.vals, gridptrOrig->y.vals, size * sizeof(double)); + } + + if (gridptrOrig->x.bounds != NULL && gridptrOrig->x.bounds != cdfPendingLoad) + { + const size_t size = (irregular ? gridsize : gridptrOrig->x.size) * (size_t) gridptrOrig->nvertex; + gridptrDup->x.bounds = (double *) Malloc(size * sizeof(double)); + memcpy(gridptrDup->x.bounds, gridptrOrig->x.bounds, size * sizeof(double)); + } + + if (gridptrOrig->y.bounds != NULL && gridptrOrig->y.bounds != cdfPendingLoad) + { + const size_t size = (irregular ? gridsize : gridptrOrig->y.size) * (size_t) gridptrOrig->nvertex; + gridptrDup->y.bounds = (double *) Malloc(size * sizeof(double)); + memcpy(gridptrDup->y.bounds, gridptrOrig->y.bounds, size * sizeof(double)); + } + + { + if (gridptrOrig->area != NULL && gridptrOrig->area != cdfPendingLoad) + { + const size_t size = gridsize; + gridptrDup->area = (double *) Malloc(size * sizeof(double)); + memcpy(gridptrDup->area, gridptrOrig->area, size * sizeof(double)); + } + } + + if (gridptrOrig->mask != NULL) + { + const size_t size = gridsize; + gridptrDup->mask = (mask_t *) Malloc(size * sizeof(mask_t)); + memcpy(gridptrDup->mask, gridptrOrig->mask, size * sizeof(mask_t)); + } + + if (gridptrOrig->mask_gme != NULL) + { + const size_t size = gridsize; + gridptrDup->mask_gme = (mask_t *) Malloc(size * sizeof(mask_t)); + memcpy(gridptrDup->mask_gme, gridptrOrig->mask_gme, size * sizeof(mask_t)); + } +} + +static grid_t * +cdfLazyGridCopy(grid_t *gridptrOrig) +{ + struct cdfLazyGrid *lazyGridDup = (struct cdfLazyGrid *) Malloc(sizeof(*lazyGridDup)); + gridptrOrig->vtable->copyScalarFields(gridptrOrig, &lazyGridDup->base); + gridptrOrig->vtable->copyArrayFields(gridptrOrig, &lazyGridDup->base); + return &lazyGridDup->base; +} + +static void +cdfLazyGridInitOnce(void) +{ + cdfLazyGridVtable = cdiGridVtable; + cdfLazyGridVtable.destroy = cdfLazyGridDelete; + cdfLazyGridVtable.copy = cdfLazyGridCopy; + cdfLazyGridVtable.copyScalarFields = cdfLazyGridCopyScalarFields; + cdfLazyGridVtable.copyArrayFields = cdfLazyGridCopyArrayFields; + cdfLazyGridVtable.defArea = cdfLazyGridDefArea; + cdfLazyGridVtable.inqAreaPtr = cdfLazyGridInqAreaPtr; + cdfLazyGridVtable.inqArea = cdfLazyGridInqArea; + cdfLazyGridVtable.inqXValsPtr = cdfLazyGridInqXValsPtr; + cdfLazyGridVtable.inqYValsPtr = cdfLazyGridInqYValsPtr; + cdfLazyGridVtable.inqXVal = cdfLazyGridInqXVal; + cdfLazyGridVtable.inqYVal = cdfLazyGridInqYVal; + cdfLazyGridVtable.defXVals = cdfLazyGridDefXVals; + cdfLazyGridVtable.defYVals = cdfLazyGridDefYVals; + cdfLazyGridVtable.compareXYFull = cdfLazyCompareXYFull; + cdfLazyGridVtable.compareXYAO = cdfLazyCompareXYAO; + cdfLazyGridVtable.defXBounds = cdfLazyGridDefXBounds; + cdfLazyGridVtable.defYBounds = cdfLazyGridDefYBounds; + cdfLazyGridVtable.inqXBoundsPtr = cdfLazyGridInqXBoundsPtr; + cdfLazyGridVtable.inqYBoundsPtr = cdfLazyGridInqYBoundsPtr; + /* create inaccessible memory area, if possible, this serves as + * dummy value for pointers to data not yet loaded */ + /* +#ifdef HAVE_MMAP + { + size_t pgSize = cdiGetPageSize(false); + static const char devZero[] = "/dev/zero"; + int fd = open(devZero, O_RDWR); + if (fd == -1) + SysError("Could not open %s to map anonymous memory", devZero); + void *cdfInvalid = mmap(NULL, pgSize, PROT_NONE, MAP_PRIVATE, fd, 0); + if (cdfInvalid == MAP_FAILED) + SysError("Could not mmap anonymous memory"); + cdfPendingLoad = cdfInvalid; + int rc = close(fd); + if (rc == -1) + SysError("Could not close %s file handle %d after mapping anonymous" + " memory", devZero, fd); + } +#else + */ + cdfPendingLoad = (double *) &cdfPendingLoad; + //#endif + atexit(cdfLazyGridDestroyOnce); +#ifndef HAVE_LIBPTHREAD + cdfLazyInitialized = true; +#endif +} + +static void +cdfBaseGridInit(grid_t *grid, int gridtype) +{ + grid_init(grid); + cdiGridTypeInit(grid, gridtype, 0); +} + +static void +cdfLazyGridInit(struct cdfLazyGrid *grid, int gridtype) +{ +#ifdef HAVE_LIBPTHREAD + pthread_once(&cdfLazyInitialized, cdfLazyGridInitOnce); +#else + if (!cdfLazyInitialized) cdfLazyGridInitOnce(); +#endif + cdfBaseGridInit(&grid->base, gridtype); + grid->baseVtable = grid->base.vtable; + grid->cellAreaGet.datasetNCId = -1; + grid->cellAreaGet.varNCId = -1; + grid->xValsGet.datasetNCId = -1; + grid->xValsGet.varNCId = -1; + grid->yValsGet.datasetNCId = -1; + grid->yValsGet.varNCId = -1; + grid->xBoundsGet.datasetNCId = -1; + grid->xBoundsGet.varNCId = -1; + grid->yBoundsGet.datasetNCId = -1; + grid->yBoundsGet.varNCId = -1; + grid->base.vtable = &cdfLazyGridVtable; + init_lazy_load_lock(grid); +} + +void +cdfLazyGridRenew(struct cdfLazyGrid *restrict *restrict gridpptr, int gridtype) +{ + struct cdfLazyGrid *restrict grid = *gridpptr; + if (!grid) *gridpptr = grid = (struct cdfLazyGrid *) Malloc(sizeof(*grid)); + cdfLazyGridInit(grid, gridtype); +} + +void +cdfBaseGridRenew(struct cdfLazyGrid *restrict *restrict gridpptr, int gridtype) +{ + struct cdfLazyGrid *restrict grid = *gridpptr; + if (!grid) *gridpptr = grid = (struct cdfLazyGrid *) Malloc(sizeof(grid_t)); + cdfBaseGridInit((grid_t *) grid, gridtype); +} + +#endif + +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifndef CDI_CKSUM_H_ +#define CDI_CKSUM_H_ + +#include <inttypes.h> + +/* single checksum computation over one array */ +uint32_t cdiCheckSum(int type, int count, const void *data); + +/* composable check-sum computation, + * 0. datatype, + * 1. init, + * 2. partial, appendable computation, and + * 3. final checksum-computation + */ +struct cdiCheckSumState +{ + uint32_t sum; + off_t len; +}; + +void cdiCheckSumRStart(struct cdiCheckSumState *state); +void cdiCheckSumRAdd(struct cdiCheckSumState *state, int type, int count, const void *data); +uint32_t cdiCheckSumRValue(struct cdiCheckSumState state); + +#endif + +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifdef HAVE_CONFIG_H +#endif + +#include <inttypes.h> +#include <sys/types.h> + +void memcrc_r(uint32_t *state, const unsigned char *block, size_t block_len); + +void memcrc_r_eswap(uint32_t *state, const unsigned char *elems, size_t num_elems, size_t elem_size); + +uint32_t memcrc_finish(uint32_t *state, off_t total_size); + +uint32_t memcrc(const unsigned char *b, size_t n); + +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifdef HAVE_CONFIG_H +#endif + +#ifndef SERIALIZE_H +#define SERIALIZE_H + +#include <string.h> + +#ifndef CDI_CKSUM_H_ +#endif +#ifndef CDI_KEY_H_ +#endif +#ifndef ERROR_H +#endif + +/* + * Generic interfaces for (de-)marshalling + */ +int serializeGetSize(int count, int datatype, void *context); +void serializePack(const void *data, int count, int datatype, void *buf, int buf_size, int *position, void *context); +void serializeUnpack(const void *buf, int buf_size, int *position, void *data, int count, int datatype, void *context); + +/* + * (de-)marshalling function for key/value structures + */ +static inline int +serializeKeysGetPackSize(const cdi_keys_t *keysp, void *context) +{ + int packBuffSize = 0; + + int nelems = keysp->nelems; + packBuffSize += serializeGetSize(1, CDI_DATATYPE_INT, context); + for (int keyid = 0; keyid < nelems; keyid++) + { + const cdi_key_t *keyp = &(keysp->value[keyid]); + int type = keyp->type; + packBuffSize += serializeGetSize(1, CDI_DATATYPE_INT, context); // key + packBuffSize += serializeGetSize(1, CDI_DATATYPE_INT, context); // type + if (type == KEY_BYTES) + { + int length = keyp->length; + packBuffSize += serializeGetSize(1, CDI_DATATYPE_INT, context) + serializeGetSize(length, CDI_DATATYPE_TXT, context); + } + else if (type == KEY_INT) + { + packBuffSize += serializeGetSize(1, CDI_DATATYPE_INT, context); + } + else if (type == KEY_FLOAT) + { + packBuffSize += serializeGetSize(1, CDI_DATATYPE_FLT64, context); + } + } + packBuffSize += serializeGetSize(1, CDI_DATATYPE_UINT32, context); + return packBuffSize; +} + +static inline void +serializeKeysPack(const cdi_keys_t *keysp, void *buf, int buf_size, int *position, void *context) +{ + uint32_t d = 0; + + int nelems = keysp->nelems; + serializePack(&nelems, 1, CDI_DATATYPE_INT, buf, buf_size, position, context); + for (int keyid = 0; keyid < nelems; keyid++) + { + const cdi_key_t *keyp = &(keysp->value[keyid]); + int key = keyp->key; + int type = keyp->type; + serializePack(&key, 1, CDI_DATATYPE_INT, buf, buf_size, position, context); + serializePack(&type, 1, CDI_DATATYPE_INT, buf, buf_size, position, context); + if (type == KEY_BYTES) + { + int length = keyp->length; + serializePack(&length, 1, CDI_DATATYPE_INT, buf, buf_size, position, context); + serializePack(keyp->v.s, length, CDI_DATATYPE_TXT, buf, buf_size, position, context); + d ^= cdiCheckSum(CDI_DATATYPE_TXT, length, keyp->v.s); + } + else if (type == KEY_INT) + { + serializePack(&keyp->v.i, 1, CDI_DATATYPE_INT, buf, buf_size, position, context); + } + else if (type == KEY_FLOAT) + { + serializePack(&keyp->v.d, 1, CDI_DATATYPE_FLT64, buf, buf_size, position, context); + } + } + + serializePack(&d, 1, CDI_DATATYPE_UINT32, buf, buf_size, position, context); +} + +static inline void +serializeKeysUnpack(const void *buf, int buf_size, int *position, cdi_keys_t *keysp, void *context) +{ + uint32_t d, d2 = 0; + void *buffer = NULL; + int buffersize = 0; + + int nelems; + serializeUnpack(buf, buf_size, position, &nelems, 1, CDI_DATATYPE_INT, context); + for (int i = 0; i < nelems; ++i) + { + int key, type; + serializeUnpack(buf, buf_size, position, &key, 1, CDI_DATATYPE_INT, context); + serializeUnpack(buf, buf_size, position, &type, 1, CDI_DATATYPE_INT, context); + if (type == KEY_BYTES) + { + int length; + serializeUnpack(buf, buf_size, position, &length, 1, CDI_DATATYPE_INT, context); + if (length > buffersize) + { + buffersize = length; + buffer = realloc(buffer, buffersize); + } + serializeUnpack(buf, buf_size, position, buffer, length, CDI_DATATYPE_TXT, context); + cdiDefVarKeyBytes(keysp, key, (unsigned char *) buffer, length); + d2 ^= cdiCheckSum(CDI_DATATYPE_TXT, length, buffer); + } + else if (type == KEY_INT) + { + int ival; + serializeUnpack(buf, buf_size, position, &ival, 1, CDI_DATATYPE_INT, context); + cdiDefVarKeyInt(keysp, key, ival); + } + else if (type == KEY_FLOAT) + { + double dval; + serializeUnpack(buf, buf_size, position, &dval, 1, CDI_DATATYPE_FLT64, context); + cdiDefVarKeyFloat(keysp, key, dval); + } + } + serializeUnpack(buf, buf_size, position, &d, 1, CDI_DATATYPE_UINT32, context); + xassert(d == d2); + if (buffer) free(buffer); +} + +/* + * (de-)marshalling function for common data structures + */ +static inline int +serializeStrTabGetPackSize(const char **strTab, int numStr, void *context) +{ + xassert(numStr >= 0); + int packBuffSize = 0; + for (size_t i = 0; i < (size_t) numStr; ++i) + { + size_t len = strlen(strTab[i]); + packBuffSize += serializeGetSize(1, CDI_DATATYPE_INT, context) + serializeGetSize((int) len, CDI_DATATYPE_TXT, context); + } + packBuffSize += serializeGetSize(1, CDI_DATATYPE_UINT32, context); + return packBuffSize; +} + +static inline void +serializeStrTabPack(const char **strTab, int numStr, void *buf, int buf_size, int *position, void *context) +{ + uint32_t d = 0; + xassert(numStr >= 0); + for (size_t i = 0; i < (size_t) numStr; ++i) + { + int len = (int) strlen(strTab[i]); + serializePack(&len, 1, CDI_DATATYPE_INT, buf, buf_size, position, context); + serializePack(strTab[i], len, CDI_DATATYPE_TXT, buf, buf_size, position, context); + d ^= cdiCheckSum(CDI_DATATYPE_TXT, len, strTab[i]); + } + serializePack(&d, 1, CDI_DATATYPE_UINT32, buf, buf_size, position, context); +} + +static inline void +serializeStrTabUnpack(const void *buf, int buf_size, int *position, char **strTab, int numStr, void *context) +{ + uint32_t d, d2 = 0; + xassert(numStr >= 0); + for (size_t i = 0; i < (size_t) numStr; ++i) + { + int len; + serializeUnpack(buf, buf_size, position, &len, 1, CDI_DATATYPE_INT, context); + serializeUnpack(buf, buf_size, position, strTab[i], len, CDI_DATATYPE_TXT, context); + strTab[i][len] = '\0'; + d2 ^= cdiCheckSum(CDI_DATATYPE_TXT, len, strTab[i]); + } + serializeUnpack(buf, buf_size, position, &d, 1, CDI_DATATYPE_UINT32, context); + xassert(d == d2); +} + +/* + * Interfaces for marshalling within a single memory domain + */ +int serializeGetSizeInCore(int count, int datatype, void *context); +void serializePackInCore(const void *data, int count, int datatype, void *buf, int buf_size, int *position, void *context); +void serializeUnpackInCore(const void *buf, int buf_size, int *position, void *data, int count, int datatype, void *context); + +#endif +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#include <inttypes.h> +#include <sys/types.h> +#include <stdlib.h> + + +uint32_t +cdiCheckSum(int type, int count, const void *buffer) +{ + uint32_t s = 0U; + xassert(count >= 0); + size_t elemSize = (size_t) serializeGetSizeInCore(1, type, NULL); + memcrc_r_eswap(&s, (const unsigned char *) buffer, (size_t) count, elemSize); + s = memcrc_finish(&s, (off_t) (elemSize * (size_t) count)); + return s; +} + +void +cdiCheckSumRStart(struct cdiCheckSumState *state) +{ + state->sum = 0U; + state->len = 0; +} + +void +cdiCheckSumRAdd(struct cdiCheckSumState *state, int type, int count, const void *buffer) +{ + size_t elemSize = (size_t) serializeGetSizeInCore(1, type, NULL); + memcrc_r_eswap(&state->sum, (const unsigned char *) buffer, (size_t) count, elemSize); + state->len += (off_t) (elemSize * (size_t) count); +} + +uint32_t +cdiCheckSumRValue(struct cdiCheckSumState state) +{ + return memcrc_finish(&state.sum, state.len); +} + +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#include <stdio.h> +#include <string.h> +#include <errno.h> + +const char * +cdiStringError(int cdiErrno) +{ + // clang-format off + static const char UnknownError[] = "Unknown Error"; + static const char _ETMOF[] = "Too many open files"; + static const char _EINVAL[] = "Invalid argument"; + static const char _EISDIR[] = "Is a directory"; + static const char _EISEMPTY[] = "File is empty"; + static const char _EUFTYPE[] = "Unsupported file type"; + static const char _ELIBNAVAIL[] = "Unsupported file type (library support not compiled in)"; + static const char _EUFSTRUCT[] = "Unsupported file structure"; + static const char _EUNC4[] = "Unsupported NetCDF4 structure"; + static const char _EDIMSIZE[] = "Invalid dimension size"; + static const char _EQENF[] = "Query entries not found"; + static const char _EQNAVAIL[] = "Query not available for file type"; + static const char _ELIMIT[] = "Internal limits exceeded"; + + switch (cdiErrno) { + case CDI_ESYSTEM: + { + const char *cp = strerror(errno); + if (cp == NULL) break; + return cp; + } + case CDI_ETMOF: return _ETMOF; + case CDI_EINVAL: return _EINVAL; + case CDI_EISDIR: return _EISDIR; + case CDI_EISEMPTY: return _EISEMPTY; + case CDI_EUFTYPE: return _EUFTYPE; + case CDI_ELIBNAVAIL: return _ELIBNAVAIL; + case CDI_EUFSTRUCT: return _EUFSTRUCT; + case CDI_EUNC4: return _EUNC4; + case CDI_EDIMSIZE: return _EDIMSIZE; + case CDI_EQENF: return _EQENF; + case CDI_EQNAVAIL: return _EQNAVAIL; + case CDI_ELIMIT: return _ELIMIT; + } + // clang-format on + return UnknownError; +} + +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#include <stdio.h> +#include <stdlib.h> + +// ================================================================== +#ifdef __cplusplus +extern "C" +{ +#endif + + // clang-format off +void +cdiDecodeDate(int date, int *year, int *month, int *day) +{ + int iyear = date / 10000; + *year = iyear; + int idate = date - iyear * 10000; + if (idate < 0) idate = -idate; + int imonth = idate / 100; + *month = imonth; + *day = idate - imonth * 100; +} + +int +cdiEncodeDate(int year, int month, int day) +{ + int iyear = abs(year); + int date = iyear * 10000 + month * 100 + day; + if (year < 0) date = -date; + + return date; +} + +void +cdiDecodeTime(int time, int *hour, int *minute, int *second) +{ + int ihour = time / 10000, itime = time - ihour * 10000, iminute = itime / 100; + *hour = ihour; + *minute = iminute; + *second = itime - iminute * 100; +} + +int +cdiEncodeTime(int hour, int minute, int second) +{ + return hour * 10000 + minute * 100 + second; +} + // clang-format on + +#ifdef __cplusplus +} +#endif +// ================================================================== + +CdiDate +cdiDate_set(int64_t date) +{ + int64_t iyear = date / 10000; + int year = iyear; + int64_t idate = date - iyear * 10000; + if (idate < 0) idate = -idate; + int64_t imonth = idate / 100; + int month = imonth; + int day = idate - imonth * 100; + + CdiDate cdiDate; + cdiDate.year = year; + cdiDate.month = (short) month; + cdiDate.day = (short) day; + + return cdiDate; +} + +CdiTime +cdiTime_set(int time) +{ + int hour, minute, second, ms = 0; + cdiDecodeTime(time, &hour, &minute, &second); + + CdiTime cdiTime; + cdiTime.hour = (short) hour; + cdiTime.minute = (short) minute; + cdiTime.second = (short) second; + cdiTime.ms = ms; + + return cdiTime; +} + +CdiDateTime +cdiDateTime_set(int64_t date, int time) +{ + CdiDateTime cdiDateTime; + cdiDateTime.date = cdiDate_set(date); + cdiDateTime.time = cdiTime_set(time); + + return cdiDateTime; +} + +int64_t +cdiDate_get(CdiDate cdiDate) +{ + int64_t iyear = abs(cdiDate.year); + int64_t date = iyear * 10000 + cdiDate.month * 100 + cdiDate.day; + if (cdiDate.year < 0) date = -date; + + return date; +} + +int +cdiTime_get(CdiTime cdiTime) +{ + return cdiEncodeTime(cdiTime.hour, cdiTime.minute, cdiTime.second); +} + +CdiDate +cdiDate_encode(int year, int month, int day) +{ + CdiDate cdiDate; + cdiDate.year = year; + cdiDate.month = month; + cdiDate.day = day; + + return cdiDate; +} + +void +cdiDate_decode(CdiDate cdiDate, int *year, int *month, int *day) +{ + *year = cdiDate.year; + *month = cdiDate.month; + *day = cdiDate.day; +} + +CdiTime +cdiTime_encode(int hour, int minute, int second, int ms) +{ + CdiTime cdiTime; + cdiTime.hour = hour; + cdiTime.minute = minute; + cdiTime.second = second; + cdiTime.ms = ms; + + return cdiTime; +} + +void +cdiTime_decode(CdiTime cdiTime, int *hour, int *minute, int *second, int *ms) +{ + *hour = cdiTime.hour; + *minute = cdiTime.minute; + *second = cdiTime.second; + *ms = cdiTime.ms; +} + +void +cdiDate_init(CdiDate *cdiDate) +{ + cdiDate->year = 0; + cdiDate->month = 0; + cdiDate->day = 0; +} + +void +cdiTime_init(CdiTime *cdiTime) +{ + cdiTime->hour = 0; + cdiTime->minute = 0; + cdiTime->second = 0; + cdiTime->ms = 0; +} + +void +cdiDateTime_init(CdiDateTime *cdiDateTime) +{ + cdiDate_init(&cdiDateTime->date); + cdiTime_init(&cdiDateTime->time); +} + +bool +cdiDate_isEQ(const CdiDate cdiDate1, const CdiDate cdiDate2) +{ + // clang-format off + return (cdiDate1.year == cdiDate2.year + && cdiDate1.month == cdiDate2.month + && cdiDate1.day == cdiDate2.day); + // clang-format on +} + +bool +cdiTime_isEQ(const CdiTime cdiTime1, const CdiTime cdiTime2) +{ + // clang-format off + return (cdiTime1.hour == cdiTime2.hour + && cdiTime1.minute == cdiTime2.minute + && cdiTime1.second == cdiTime2.second + && cdiTime1.ms == cdiTime2.ms); + // clang-format on +} + +bool +cdiDateTime_isEQ(const CdiDateTime cdiDateTime1, const CdiDateTime cdiDateTime2) +{ + // clang-format off + return (cdiDateTime1.date.year == cdiDateTime2.date.year + && cdiDateTime1.date.month == cdiDateTime2.date.month + && cdiDateTime1.date.day == cdiDateTime2.date.day + && cdiDateTime1.time.hour == cdiDateTime2.time.hour + && cdiDateTime1.time.minute == cdiDateTime2.time.minute + && cdiDateTime1.time.second == cdiDateTime2.time.second + && cdiDateTime1.time.ms == cdiDateTime2.time.ms); + // clang-format on +} + +bool +cdiDateTime_isNE(const CdiDateTime cdiDateTime1, const CdiDateTime cdiDateTime2) +{ + return !cdiDateTime_isEQ(cdiDateTime1, cdiDateTime2); +} + +bool +cdiDateTime_isLT(const CdiDateTime cdiDateTime1, const CdiDateTime cdiDateTime2) +{ + const int64_t date1 = cdiDate_get(cdiDateTime1.date); + const int64_t date2 = cdiDate_get(cdiDateTime2.date); + const int time1 = cdiTime_get(cdiDateTime1.time); + const int time2 = cdiTime_get(cdiDateTime2.time); + return (date1 < date2 || (date1 == date2 && time1 < time2)); +} + +bool +cdiDateTime_isNull(const CdiDateTime cdiDateTime) +{ + // clang-format off + return (cdiDateTime.date.year == 0 + && cdiDateTime.date.month == 0 + && cdiDateTime.date.day == 0 + && cdiDateTime.time.hour == 0 + && cdiDateTime.time.minute == 0 + && cdiDateTime.time.second == 0 + && cdiDateTime.time.ms == 0); + // clang-format on +} + +#define DATE_FORMAT "%5.4d-%2.2d-%2.2d" +#define TIME_FORMAT "%2.2d:%2.2d:%2.2d" + +const char * +CdiDateTime_string(CdiDateTime cdiDateTime) +{ + int year, month, day; + cdiDate_decode(cdiDateTime.date, &year, &month, &day); + int hour, minute, second, ms; + cdiTime_decode(cdiDateTime.time, &hour, &minute, &second, &ms); + + static char datetimeString[64]; + snprintf(datetimeString, sizeof(datetimeString), DATE_FORMAT "T" TIME_FORMAT, year, month, day, hour, minute, second); + + return datetimeString; +} +#ifndef GRIBAPI_H +#define GRIBAPI_H + +#ifdef HAVE_LIBGRIB_API +#include <grib_api.h> +#ifndef ERROR_H +#endif +#endif + +#ifndef CDI_INT_H +#endif + +// clang-format off + +#define GRIBAPI_MISSVAL -9.E33 + +// GRIB2 Level Types +#define GRIB2_LTYPE_SURFACE 1 +#define GRIB2_LTYPE_CLOUD_BASE 2 +#define GRIB2_LTYPE_CLOUD_TOP 3 +#define GRIB2_LTYPE_ISOTHERM0 4 +#define GRIB2_LTYPE_TROPOPAUSE 7 +#define GRIB2_LTYPE_TOA 8 +#define GRIB2_LTYPE_SEA_BOTTOM 9 +#define GRIB2_LTYPE_ATMOSPHERE 10 +#define GRIB2_LTYPE_ISOBARIC 100 +#define GRIB2_LTYPE_MEANSEA 101 +#define GRIB2_LTYPE_ALTITUDE 102 +#define GRIB2_LTYPE_HEIGHT 103 +#define GRIB2_LTYPE_SIGMA 104 +#define GRIB2_LTYPE_HYBRID 105 +#define GRIB2_LTYPE_LANDDEPTH 106 +#define GRIB2_LTYPE_ISENTROPIC 107 +#define GRIB2_LTYPE_SNOW 114 +#define GRIB2_LTYPE_REFERENCE 150 +#define GRIB2_LTYPE_SEADEPTH 160 // Depth Below Sea Level +#define GRIB2_LTYPE_LAKE_BOTTOM 162 // Lake or River Bottom +#define GRIB2_LTYPE_SEDIMENT_BOTTOM 163 // Bottom Of Sediment Layer +#define GRIB2_LTYPE_SEDIMENT_BOTTOM_TA 164 // Bottom Of Thermally Active Sediment Layer +#define GRIB2_LTYPE_SEDIMENT_BOTTOM_TW 165 // Bottom Of Sediment Layer Penetrated By Thermal Wave +#define GRIB2_LTYPE_MIX_LAYER 166 // Mixing Layer + +// GRIB2 Data representation type (Grid Type) +#define GRIB2_GTYPE_LATLON 0 // Latitude/longitude (or equidistant cylindrical, or Plate Carree) +#define GRIB2_GTYPE_LATLON_ROT 1 // Rotated Latitude/longitude +#define GRIB2_GTYPE_LATLON_STR 2 // Stretched Latitude/longitude +#define GRIB2_GTYPE_LATLON_ROTSTR 3 // Stretched and Rotated Latitude/longitude +#define GRIB2_GTYPE_STERE 20 // Polar stereographic projection +#define GRIB2_GTYPE_LCC 30 // Lambert conformal +#define GRIB2_GTYPE_GAUSSIAN 40 // Gaussian latitude/longitude +#define GRIB2_GTYPE_GAUSSIAN_ROT 41 // Rotated Gaussian latitude/longitude +#define GRIB2_GTYPE_GAUSSIAN_STR 42 // Stretched Gaussian latitude/longitude +#define GRIB2_GTYPE_GAUSSIAN_ROTSTR 43 // Stretched and rotated Gaussian latitude/longitude +#define GRIB2_GTYPE_SPECTRAL 50 // Spherical harmonic coefficients +#define GRIB2_GTYPE_GME 100 // Triangular grid based on an icosahedron (GME) +#define GRIB2_GTYPE_UNSTRUCTURED 101 // General Unstructured Grid + +const char *gribapiLibraryVersionString(void); +void gribContainersNew(stream_t *streamptr); +void gribContainersDelete(stream_t *streamptr); + +#ifdef HAVE_LIBGRIB_API +static inline int my_grib_set_double(grib_handle* h, const char* key, double val) +{ + if (CDI_gribapi_debug) + fprintf(stderr, "grib_set_double(\tgrib_handle* h, \"%s\", %f)\n", key, val); + + const int retVal = grib_set_double(h, key, val); + if (retVal != 0) + fprintf(stderr, "!!! failed call to grib_set_double(\tgrib_handle* h, \"%s\", %f) !!!\n", key, val); + return retVal; +} + +static inline int my_grib_set_long(grib_handle* h, const char* key, long val) +{ + if (CDI_gribapi_debug) + fprintf(stderr, "grib_set_long( \tgrib_handle* h, \"%s\", %ld)\n", key, val); + + const int retVal = grib_set_long(h, key, val); + if (retVal != 0) + fprintf(stderr, "!!! failed call to grib_set_long( \tgrib_handle* h, \"%s\", %ld) !!!\n", key, val); + return retVal; +} + +static inline int my_grib_set_string(grib_handle* h, const char* key, const char* val, size_t* length) +{ + if (CDI_gribapi_debug) + fprintf(stderr, "grib_set_string(\tgrib_handle* h, \"%s\", \"%s\")\n", key, val); + + int ret_val = grib_set_string(h, key, val, length); + if (ret_val != 0) + fprintf(stderr, "!!! grib_set_string(\tgrib_handle* h, \"%s\", \"%s\") !!!\n", key, val); + return ret_val; +} +#endif + +typedef struct { + bool init; + void *gribHandle; +} +gribContainer_t; + +// clang-format on + +#endif /* GRIBAPI_H */ +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifndef CGRIBEX_H +#define CGRIBEX_H + +// clang-format off + +#include <stdio.h> +#include <stdbool.h> +#include <sys/types.h> + +#define GRIB_MISSVAL -9.E33 + +// GRIB1 Level Types +#define GRIB1_LTYPE_SURFACE 1 +#define GRIB1_LTYPE_CLOUD_BASE 2 +#define GRIB1_LTYPE_CLOUD_TOP 3 +#define GRIB1_LTYPE_ISOTHERM0 4 +#define GRIB1_LTYPE_TROPOPAUSE 7 +#define GRIB1_LTYPE_TOA 8 +#define GRIB1_LTYPE_SEA_BOTTOM 9 +#define GRIB1_LTYPE_ATMOSPHERE 10 +#define GRIB1_LTYPE_99 99 +#define GRIB1_LTYPE_ISOBARIC 100 +#define GRIB1_LTYPE_ISOBARIC_PA 210 +#define GRIB1_LTYPE_MEANSEA 102 +#define GRIB1_LTYPE_ALTITUDE 103 +#define GRIB1_LTYPE_HEIGHT 105 +#define GRIB1_LTYPE_SIGMA 107 +#define GRIB1_LTYPE_SIGMA_LAYER 108 +#define GRIB1_LTYPE_HYBRID 109 +#define GRIB1_LTYPE_HYBRID_LAYER 110 +#define GRIB1_LTYPE_LANDDEPTH 111 +#define GRIB1_LTYPE_LANDDEPTH_LAYER 112 +#define GRIB1_LTYPE_ISENTROPIC 113 +#define GRIB1_LTYPE_SEADEPTH 160 // Depth Below Sea Level +#define GRIB1_LTYPE_LAKE_BOTTOM 162 // Lake or River Bottom +#define GRIB1_LTYPE_SEDIMENT_BOTTOM 163 // Bottom Of Sediment Layer +#define GRIB1_LTYPE_SEDIMENT_BOTTOM_TA 164 // Bottom Of Thermally Active Sediment Layer +#define GRIB1_LTYPE_SEDIMENT_BOTTOM_TW 165 // Bottom Of Sediment Layer Penetrated By Thermal Wave +#define GRIB1_LTYPE_MIX_LAYER 166 // Mixing Layer + +// GRIB1 Data representation type (Grid Type) [Table 6] +#define GRIB1_GTYPE_LATLON 0 // latitude/longitude +#define GRIB1_GTYPE_LATLON_ROT 10 // rotated latitude/longitude +#define GRIB1_GTYPE_LATLON_STR 20 // stretched latitude/longitude +#define GRIB1_GTYPE_LATLON_ROTSTR 30 // rotated and stretched latitude/longitude +#define GRIB1_GTYPE_GAUSSIAN 4 // gaussian grid +#define GRIB1_GTYPE_GAUSSIAN_ROT 14 // rotated gaussian grid +#define GRIB1_GTYPE_GAUSSIAN_STR 24 // stretched gaussian grid +#define GRIB1_GTYPE_GAUSSIAN_ROTSTR 34 // rotated and stretched gaussian grid +#define GRIB1_GTYPE_LCC 3 // Lambert conformal +#define GRIB1_GTYPE_SPECTRAL 50 // spherical harmonics +#define GRIB1_GTYPE_GME 192 // hexagonal GME grid + +// Macros for the indicator section ( Section 0 ) +#define ISEC0_GRIB_Len (isec0[ 0]) // Number of octets in the GRIB message +#define ISEC0_GRIB_Version (isec0[ 1]) // GRIB edition number + + +// Macros for the product definition section ( Section 1 ) +#define ISEC1_TABLE4_MINUTE 0 +#define ISEC1_TABLE4_HOUR 1 +#define ISEC1_TABLE4_DAY 2 +#define ISEC1_TABLE4_3HOURS 10 +#define ISEC1_TABLE4_6HOURS 11 +#define ISEC1_TABLE4_12HOURS 12 +#define ISEC1_TABLE4_QUARTER 13 +#define ISEC1_TABLE4_30MINUTES 14 + + +#define ISEC1_CodeTable (isec1[ 0]) // Version number of code table +#define ISEC1_CenterID (isec1[ 1]) // Identification of centre +#define ISEC1_ModelID (isec1[ 2]) // Identification of model +#define ISEC1_GridDefinition (isec1[ 3]) // Grid definition +#define ISEC1_Sec2Or3Flag (isec1[ 4]) // Section 2 or 3 included +#define ISEC1_Parameter (isec1[ 5]) // Parameter indicator +#define ISEC1_LevelType (isec1[ 6]) // Type of level indicator +#define ISEC1_Level1 (isec1[ 7]) // Level 1 +#define ISEC1_Level2 (isec1[ 8]) // Level 2 +#define ISEC1_Year (isec1[ 9]) // Year of century (YY) +#define ISEC1_Month (isec1[10]) // Month (MM) +#define ISEC1_Day (isec1[11]) // Day (DD) +#define ISEC1_Hour (isec1[12]) // Hour (HH) +#define ISEC1_Minute (isec1[13]) // Minute (MM) +#define ISEC1_TimeUnit (isec1[14]) // Time unit indicator +#define ISEC1_TimePeriod1 (isec1[15]) // P1 Time period +#define ISEC1_TimePeriod2 (isec1[16]) // P2 Time period +#define ISEC1_TimeRange (isec1[17]) // Time range indicator +#define ISEC1_AvgNum (isec1[18]) // Number of products included in an average +#define ISEC1_AvgMiss (isec1[19]) // Number of products missing from an average +#define ISEC1_Century (isec1[20]) // Century +#define ISEC1_SubCenterID (isec1[21]) // Subcenter identifier +#define ISEC1_DecScaleFactor (isec1[22]) // Decimal scale factor +#define ISEC1_LocalFLag (isec1[23]) // Flag field to indicate local use in isec1 + +#define ISEC1_ECMWF_LocalExtension (isec1[36]) +#define ISEC1_ECMWF_Class (isec1[37]) + + +// Macros for the grid definition section ( Section 2 ) +#define ISEC2_GridType (isec2[ 0]) // Data representation type + +// Triangular grids + +#define ISEC2_GME_NI2 (isec2[ 1]) // Number of factor 2 in factorisation of Ni +#define ISEC2_GME_NI3 (isec2[ 2]) // Number of factor 3 in factorisation of Ni +#define ISEC2_GME_ND (isec2[ 3]) // Nubmer of diamonds +#define ISEC2_GME_NI (isec2[ 4]) // Number of tri. subdiv. of the icosahedron +#define ISEC2_GME_AFlag (isec2[ 5]) // Flag for orientation of diamonds (Table A) +#define ISEC2_GME_LatPP (isec2[ 6]) // Latitude of pole point +#define ISEC2_GME_LonPP (isec2[ 7]) // Longitude of pole point +#define ISEC2_GME_LonMPL (isec2[ 8]) // Longitude of the first diamond +#define ISEC2_GME_BFlag (isec2[ 9]) // Flag for storage sequence (Table B) + +// Spherical harmonic coeficients + +#define ISEC2_PentaJ (isec2[ 1]) // J pentagonal resolution parameter +#define ISEC2_PentaK (isec2[ 2]) // K pentagonal resolution parameter +#define ISEC2_PentaM (isec2[ 3]) // M pentagonal resolution parameter +#define ISEC2_RepType (isec2[ 4]) // Representation type +#define ISEC2_RepMode (isec2[ 5]) // Representation mode + +// Gaussian grids + +#define ISEC2_NumLon (isec2[ 1]) // Number of points along a parallel (Ni) +#define ISEC2_NumLat (isec2[ 2]) // Number of points along a meridian (Nj) +#define ISEC2_FirstLat (isec2[ 3]) // Latitude of the first grid point +#define ISEC2_FirstLon (isec2[ 4]) // Longitude of the first grid point +#define ISEC2_ResFlag (isec2[ 5]) // Resolution flag: 128 regular grid +#define ISEC2_LastLat (isec2[ 6]) // Latitude of the last grid point +#define ISEC2_LastLon (isec2[ 7]) // Longitude of the last grid point +#define ISEC2_LonIncr (isec2[ 8]) // i direction increment +#define ISEC2_LatIncr (isec2[ 9]) // j direction increment +#define ISEC2_NumPar (isec2[ 9]) // Number of parallels between a pole and the E. +#define ISEC2_ScanFlag (isec2[10]) // Scanning mode flags +#define ISEC2_NumVCP (isec2[11]) // Number of vertical coordinate parameters + +// Lambert + +#define ISEC2_Lambert_Lov (isec2[ 6]) // Orientation of the grid +#define ISEC2_Lambert_dx (isec2[ 8]) // X-direction grid length +#define ISEC2_Lambert_dy (isec2[ 9]) // Y-direction grid length +#define ISEC2_Lambert_ProjFlag (isec2[12]) // Projection centre flag +#define ISEC2_Lambert_LatS1 (isec2[13]) // First lat at which the secant cone cuts the sphere +#define ISEC2_Lambert_LatS2 (isec2[14]) // Second lat at which the secant cone cuts the sphere +#define ISEC2_Lambert_LatSP (isec2[19]) // Latitude of the southern pole +#define ISEC2_Lambert_LonSP (isec2[20]) // Longitude of the southern pole + + +#define ISEC2_Reduced (isec2[16]) // 0: regular, 1: reduced grid + +#define ISEC2_ReducedPointsPtr (&isec2[22]) +#define ISEC2_ReducedPoints(i) (isec2[22+i]) // Number of points along each parallel + + +#define ISEC2_LatSP (isec2[12]) // Latitude of the southern pole of rotation +#define ISEC2_LonSP (isec2[13]) // Longitude of the southern pole of rotation + +#define FSEC2_RotAngle (fsec2[ 0]) // Angle of rotation +#define FSEC2_StrFact (fsec2[ 1]) // Stretching factor + +// Macros for the bit map section ( Section 3 ) + +#define ISEC3_PredefBitmap (isec3[ 0]) // Predefined bitmap +#define ISEC3_MissVal (isec3[ 1]) // Missing data value for integers +#define FSEC3_MissVal (fsec3[ 1]) // Missing data value for floats + +// Macros for the binary data section ( Section 4 ) + +#define ISEC4_NumValues (isec4[ 0]) // Number of data values for encode/decode +#define ISEC4_NumBits (isec4[ 1]) // Number of bits used for each encoded value +#define ISEC4_NumNonMissValues (isec4[20]) // Number of non-missing values + + +#ifdef __cplusplus +extern "C" { +#endif + + +void gribFixZSE(int flag); // 1: Fix ZeroShiftError of simple packed spherical harmonics +void gribSetConst(int flag); // 1: Don't pack constant fields on regular grids +void gribSetDebug(int debug); // 1: Debugging +void gribSetRound(int round); +void gribSetRefDP(double refval); +void gribSetRefSP(float refval); +void gribSetValueCheck(int vcheck); + + +void gribExSP(int *isec0, int *isec1, int *isec2, float *fsec2, int *isec3, + float *fsec3, int *isec4, float *fsec4, int klenp, int *kgrib, + int kleng, int *kword, const char *hoper, int *kret); + +void gribExDP(int *isec0, int *isec1, int *isec2, double *fsec2, int *isec3, + double *fsec3, int *isec4, double *fsec4, int klenp, int *kgrib, + int kleng, int *kword, const char *hoper, int *kret); + + +const char *cgribexLibraryVersion(void); + +void gribDebug(int debug); +void gribSetCalendar(int calendar); + +void gribDateTimeX(int *isec1, int *date, int *time, int *startDate, int *startTime); +void gribDateTime(int *isec1, int *date, int *time); +int gribRefDate(const int *isec1); +int gribRefTime(const int *isec1); + +bool gribTimeIsFC(const int *isec1); + +void gribPrintSec0(int *isec0); +void gribPrintSec1(int *isec0, int *isec1); +void gribPrintSec2DP(int *isec0, int *isec2, double *fsec2); +void gribPrintSec2SP(int *isec0, int *isec2, float *fsec2); +void gribPrintSec3DP(int *isec0, int *isec3, double *fsec3); +void gribPrintSec3SP(int *isec0, int *isec3, float *fsec3); +void gribPrintSec4DP(int *isec0, int *isec4, double *fsec4); +void gribPrintSec4SP(int *isec0, int *isec4, float *fsec4); +void gribPrintSec4Wave(int *isec4); + +void gribPrintALL(int nrec, long offset, long recpos, long recsize, unsigned char *gribbuffer); +void gribPrintPDS(int nrec, long recpos, long recsize, unsigned char *gribbuffer); +void gribPrintGDS(int nrec, long recpos, long recsize, unsigned char *gribbuffer); +void gribPrintBMS(int nrec, long recpos, long recsize, unsigned char *gribbuffer); +void gribPrintBDS(int nrec, long recpos, long recsize, unsigned char *gribbuffer); +void gribCheck1(int nrec, long recpos, long recsize, unsigned char *gribbuffer); +void gribRepair1(int nrec, long recsize, unsigned char *gribbuffer); + +int gribGetZip(size_t recsize, unsigned char *gribbuffer, size_t *urecsize); + +int gribBzip(unsigned char *dbuf, long dbufsize, unsigned char *sbuf, long sbufsize); +int gribZip(unsigned char *dbuf, long dbufsize, unsigned char *sbuf, long sbufsize); +int gribUnzip(unsigned char *dbuf, long dbufsize, unsigned char *sbuf, long sbufsize); + +int gribOpen(const char *filename, const char *mode); +void gribClose(int fileID); + +int gribRead(int fileID, void *buffer, size_t *buffersize); +int gribWrite(int fileID, void *buffer, size_t buffersize); +off_t gribGetPos(int fileID); +size_t gribGetSize(int fileID); +int gribCheckSeek(int fileID, long *offset, int *version); +int gribFileSeek(int fileID, long *offset); +size_t gribReadSize(int fileID); +int gribVersion(unsigned char *buffer, size_t buffersize); + +int grib_info_for_grads(off_t recpos, long recsize, unsigned char *gribbuffer, int *intnum, float *fltnum, off_t *bignum); + +double calculate_pfactor_float(const float* spectralField, long fieldTruncation, long subsetTruncation); +double calculate_pfactor_double(const double* spectralField, long fieldTruncation, long subsetTruncation); + +#ifdef __cplusplus +} +#endif + +// clang-format on + +#endif /* CGRIBEX_H */ +#ifdef HAVE_CONFIG_H +#endif + +#include <ctype.h> + + +#ifdef HAVE_LIBCGRIBEX +#endif + +int CDI_Default_Calendar = CALENDAR_PROLEPTIC; + +int CDI_Default_InstID = CDI_UNDEFID; +int CDI_Default_ModelID = CDI_UNDEFID; +int CDI_Default_TableID = CDI_UNDEFID; +// int cdiNcMissingValue = CDI_UNDEFID; +int CDI_Netcdf_Chunksizehint = CDI_UNDEFID; +int CDI_Split_Ltype105 = CDI_UNDEFID; + +bool CDI_Ignore_Att_Coordinates = false; +bool CDI_Coordinates_Lon_Lat = false; +bool CDI_Ignore_Valid_Range = false; +int CDI_Skip_Records = 0; +const char *CDI_GRIB1_Template = NULL; +const char *CDI_GRIB2_Template = NULL; +int CDI_Convention = CDI_CONVENTION_ECHAM; +int CDI_Inventory_Mode = 1; +int CDI_Version_Info = 1; +int CDI_Query_Abort = 1; +int CDI_Convert_Cubesphere = 1; +int CDI_Read_Cell_Corners = 1; +int CDI_CMOR_Mode = 0; +int CDI_Reduce_Dim = 0; +int CDI_Shuffle = 0; +size_t CDI_Netcdf_Hdr_Pad = 0UL; +size_t CDI_Chunk_Cache = 0UL; +size_t CDI_Chunk_Cache_Max = 0UL; +bool CDI_Netcdf_Lazy_Grid_Load = false; + +char *cdiPartabPath = NULL; +int cdiPartabIntern = 1; + +double CDI_Default_Missval = -9.E33; +double CDI_Grid_Missval = -9999.; + +// clang-format off +static const char Filetypes[][9] = { + "UNKNOWN", + "GRIB", + "GRIB2", + "NetCDF", + "NetCDF2", + "NetCDF4", + "NetCDF4c", + "NetCDF5", + "SERVICE", + "EXTRA", + "IEG", + "NCZarr", + "HDF5", +}; +// clang-format on + +int CDI_Debug = 0; // If set to 1, debugging +int CDI_Recopt = 0; + +bool CDI_gribapi_debug = false; +bool CDI_gribapi_grib1 = false; +int cdiDefaultLeveltype = -1; +int cdiDataUnreduced = 0; +int cdiSortName = 0; +int cdiSortParam = 0; +int cdiHaveMissval = 0; + +static long +cdi_getenv_int(const char *envName) +{ + long envValue = -1; + + char *envString = getenv(envName); + if (envString) + { + long fact = 1; + int len = (int) strlen(envString); + for (int loop = 0; loop < len; loop++) + { + if (!isdigit((int) envString[loop])) + { + switch (tolower((int) envString[loop])) + { + case 'k': fact = 1024; break; + case 'm': fact = 1048576; break; + case 'g': fact = 1073741824; break; + default: + fact = 0; + Warning("Invalid number string in %s: %s", envName, envString); + Warning("%s must comprise only digits [0-9].", envName); + break; + } + break; + } + } + + if (fact) envValue = fact * atol(envString); + + if (CDI_Debug) Message("set %s to %ld", envName, envValue); + } + + return envValue; +} + +static void +cdiPrintDefaults(void) +{ + fprintf(stderr, + "default instID : %d\n" + "default modelID : %d\n" + "default tableID : %d\n" + "default missval : %g\n", + CDI_Default_InstID, CDI_Default_ModelID, CDI_Default_TableID, CDI_Default_Missval); +} + +#ifdef HAVE_LIBFDB5 +#include <fdb5/fdb5_config.h> +#endif + +void +cdiPrintVersion(void) +{ + fprintf(stdout, " CDI library version : %s\n", cdiLibraryVersion()); +#ifdef HAVE_LIBCGRIBEX + fprintf(stdout, " cgribex library version : %s\n", cgribexLibraryVersion()); +#endif +#ifdef HAVE_LIBGRIB_API + fprintf(stdout, " ecCodes library version : %s\n", gribapiLibraryVersionString()); +#endif +#ifdef HAVE_LIBNETCDF + fprintf(stdout, " NetCDF library version : %s\n", cdfLibraryVersion()); +#endif +#ifdef HAVE_NC4HDF5 + // fprintf(stdout, " HDF5 library version : %s\n", hdfLibraryVersion()); +#endif +#ifdef HAVE_LIBSERVICE + fprintf(stdout, " exse library version : %s\n", srvLibraryVersion()); +#endif + fprintf(stdout, " FILE library version : %s\n", fileLibraryVersion()); +#ifdef HAVE_LIBFDB5 + fprintf(stdout, " FDB5 library version : %s\n", fdb5_version()); +#endif +} + +static void +cdiPrintDatatypes(void) +{ +#define XSTRING(x) #x +#define STRING(x) XSTRING(x) + + fprintf(stderr, + "+-------------+-------+\n" + "| types | bytes |\n" + "+-------------+-------+\n" + "| void * | %3d |\n" + "+-------------+-------+\n" + "| char | %3d |\n" + "+-------------+-------+\n" + "| bool | %3d |\n" + "| short | %3d |\n" + "| int | %3d |\n" + "| long | %3d |\n" + "| long long | %3d |\n" + "| size_t | %3d |\n" + "| off_t | %3d |\n" + "+-------------+-------+\n" + "| float | %3d |\n" + "| double | %3d |\n" + "| long double | %3d |\n" + "+-------------+-------+\n\n", + (int) sizeof(void *), (int) sizeof(char), (int) sizeof(bool), (int) sizeof(short), (int) sizeof(int), (int) sizeof(long), + (int) sizeof(long long), (int) sizeof(size_t), (int) sizeof(off_t), (int) sizeof(float), (int) sizeof(double), + (int) sizeof(long double)); + + fprintf(stderr, + "+-------------+-----------+\n" + "| INT32 | %-9s |\n" + "| INT64 | %-9s |\n" + "| FLT32 | %-9s |\n" + "| FLT64 | %-9s |\n" + "| SizeType | %-9s |\n" + "+-------------+-----------+\n", + STRING(INT32), STRING(INT64), STRING(FLT32), STRING(FLT64), STRING(CDI_SIZE_TYPE)); + + fprintf(stderr, "\n byte ordering is %s\n\n", + ((HOST_ENDIANNESS == CDI_BIGENDIAN) + ? "BIGENDIAN" + : ((HOST_ENDIANNESS == CDI_LITTLEENDIAN) ? "LITTLEENDIAN" : "Unhandled endianness!"))); + +#undef STRING +#undef XSTRING +} + +void +cdiDebug(int level) +{ + if (level < 0) return; + unsigned ulevel = (unsigned) level; + + if (ulevel == 1 || (ulevel & 2)) CDI_Debug = 1; + + if (CDI_Debug) Message("debug level %d", level); + + if (ulevel == 1 || (ulevel & 4)) memDebug(1); + + if (ulevel == 1 || (ulevel & 8)) fileDebug(1); + + if (ulevel == 1 || (ulevel & 16)) + { +#ifdef HAVE_LIBCGRIBEX + gribSetDebug(1); +#endif +#ifdef HAVE_LIBNETCDF + cdfDebug(1); +#endif +#ifdef HAVE_LIBSERVICE + srvDebug(1); +#endif +#ifdef HAVE_LIBEXTRA + extDebug(1); +#endif +#ifdef HAVE_LIBIEG + iegDebug(1); +#endif + } + + if (CDI_Debug) + { + cdiPrintDefaults(); + cdiPrintDatatypes(); + } +} + +int +cdiHaveFiletype(int filetype) +{ + int status = 0; + + switch (filetype) + { +#ifdef HAVE_LIBSERVICE + case CDI_FILETYPE_SRV: status = 1; break; +#endif +#ifdef HAVE_LIBEXTRA + case CDI_FILETYPE_EXT: status = 1; break; +#endif +#ifdef HAVE_LIBIEG + case CDI_FILETYPE_IEG: status = 1; break; +#endif +#ifdef HAVE_LIBGRIB +#if defined HAVE_LIBGRIB_API || defined HAVE_LIBCGRIBEX + case CDI_FILETYPE_GRB: status = 1; break; +#endif +#ifdef HAVE_LIBGRIB_API + case CDI_FILETYPE_GRB2: status = 1; break; +#endif +#endif +#ifdef HAVE_LIBNETCDF + case CDI_FILETYPE_NC: status = 1; break; +#ifdef HAVE_NETCDF2 + case CDI_FILETYPE_NC2: status = 1; break; +#endif +#ifdef HAVE_NETCDF4 + case CDI_FILETYPE_NC4: status = 1; break; + case CDI_FILETYPE_NC4C: status = 1; break; +#endif +#ifdef HAVE_NCZARR + case CDI_FILETYPE_NCZARR: status = 1; break; +#endif +#ifdef HAVE_NETCDF5 + case CDI_FILETYPE_NC5: status = 1; break; +#endif +#endif + default: status = 0; break; + } + + return status; +} + +void +cdiDefTableID(int tableID) +{ + CDI_Default_TableID = tableID; + int modelID = CDI_Default_ModelID = tableInqModel(tableID); + CDI_Default_InstID = modelInqInstitut(modelID); +} + +void +cdiSetEccodesGrib1(bool value) +{ +#ifndef HAVE_LIBGRIB_API + if (value) + { + Warning("ecCodes support not compiled in, used CGRIBEX to decode/encode GRIB1 records!"); + value = false; + } +#endif + CDI_gribapi_grib1 = value; +} + +void +cdiInitialize(void) +{ + static bool Init_CDI = false; + + if (!Init_CDI) + { + Init_CDI = true; + char *envstr; + long value; + +#ifdef HAVE_LIBCGRIBEX + gribFixZSE(1); // 1: Fix ZeroShiftError of simple packed spherical harmonics + gribSetConst(1); // 1: Don't pack constant fields on regular grids +#endif +#ifdef HAVE_LIBGRIB_API + grib_multi_support_off(NULL); +#endif + + value = cdi_getenv_int("CDI_DEBUG"); + if (value >= 0) CDI_Debug = (int) value; + + value = cdi_getenv_int("CDI_GRIBAPI_DEBUG"); + if (value >= 0) CDI_gribapi_debug = (bool) value; + + value = cdi_getenv_int("CDI_ECCODES_DEBUG"); + if (value >= 0) CDI_gribapi_debug = (bool) value; + + value = cdi_getenv_int("CDI_ECCODES_GRIB1"); + if (value >= 0) cdiSetEccodesGrib1((bool) value); + + value = cdi_getenv_int("CDI_READ_CELL_CORNERS"); + if (value >= 0) CDI_Read_Cell_Corners = (int) value; + + value = cdi_getenv_int("CDI_RECOPT"); + if (value >= 0) CDI_Recopt = (int) value; + + value = cdi_getenv_int("CDI_REGULARGRID"); + if (value >= 0) cdiDataUnreduced = (int) value; + + value = cdi_getenv_int("CDI_SORTNAME"); + if (value >= 0) cdiSortName = (int) value; + + value = cdi_getenv_int("CDI_SORTPARAM"); + if (value >= 0) cdiSortParam = (int) value; + + value = cdi_getenv_int("CDI_HAVE_MISSVAL"); + if (value >= 0) cdiHaveMissval = (int) value; + + value = cdi_getenv_int("CDI_LEVELTYPE"); + if (value >= 0) cdiDefaultLeveltype = (int) value; + + value = cdi_getenv_int("CDI_NETCDF_HDR_PAD"); + if (value >= 0) CDI_Netcdf_Hdr_Pad = (size_t) value; + + value = cdi_getenv_int("CDI_CHUNK_CACHE"); + if (value >= 0) CDI_Chunk_Cache = (size_t) value; + + value = cdi_getenv_int("CDI_CHUNK_CACHE_MAX"); + if (value >= 0) CDI_Chunk_Cache_Max = (size_t) value; + + envstr = getenv("CDI_GRIB1_TEMPLATE"); + if (envstr) CDI_GRIB1_Template = envstr; + + envstr = getenv("CDI_GRIB2_TEMPLATE"); + if (envstr) CDI_GRIB2_Template = envstr; + + envstr = getenv("CDI_SHUFFLE"); + if (envstr) CDI_Shuffle = atoi(envstr); + + envstr = getenv("CDI_MISSVAL"); + if (envstr) CDI_Default_Missval = atof(envstr); + /* + envstr = getenv("NC_MISSING_VALUE"); + if ( envstr ) cdiNcMissingValue = atoi(envstr); + */ + envstr = getenv("NC_CHUNKSIZEHINT"); + if (envstr) CDI_Netcdf_Chunksizehint = atoi(envstr); + + envstr = getenv("SPLIT_LTYPE_105"); + if (envstr) CDI_Split_Ltype105 = atoi(envstr); + + envstr = getenv("IGNORE_ATT_COORDINATES"); + if (envstr) CDI_Ignore_Att_Coordinates = atoi(envstr) > 0; + + envstr = getenv("CDI_COORDINATES_LONLAT"); + if (envstr) CDI_Coordinates_Lon_Lat = atoi(envstr) > 0; + + envstr = getenv("IGNORE_VALID_RANGE"); + if (envstr) CDI_Ignore_Valid_Range = atoi(envstr) > 0; + + envstr = getenv("CDI_SKIP_RECORDS"); + if (envstr) + { + CDI_Skip_Records = atoi(envstr); + CDI_Skip_Records = CDI_Skip_Records > 0 ? CDI_Skip_Records : 0; + } + + envstr = getenv("CDI_CONVENTION"); + if (envstr) + { + if (str_is_equal(envstr, "CF") || str_is_equal(envstr, "cf")) + { + CDI_Convention = CDI_CONVENTION_CF; + if (CDI_Debug) Message("CDI convention was set to CF!"); + } + } + + envstr = getenv("CDI_INVENTORY_MODE"); + if (envstr) + { + if (strncmp(envstr, "time", 4) == 0) + { + CDI_Inventory_Mode = 2; + if (CDI_Debug) Message("Inventory mode was set to timestep!"); + } + } + + envstr = getenv("CDI_QUERY_ABORT"); + if (envstr) + { + const int ival = atoi(envstr); + if (ival == 0 || ival == 1) + { + CDI_Query_Abort = ival; + if (CDI_Debug) Message("CDI_Query_Abort = %s", envstr); + } + } + + envstr = getenv("CDI_VERSION_INFO"); + if (envstr) + { + const int ival = atoi(envstr); + if (ival == 0 || ival == 1) + { + CDI_Version_Info = ival; + if (CDI_Debug) Message("CDI_Version_Info = %s", envstr); + } + } + + envstr = getenv("CDI_CONVERT_CUBESPHERE"); + if (envstr) + { + const int ival = atoi(envstr); + if (ival == 0 || ival == 1) + { + CDI_Convert_Cubesphere = ival; + if (CDI_Debug) Message("CDI_Convert_Cubesphere = %s", envstr); + } + } + + envstr = getenv("CDI_CALENDAR"); + if (envstr) + { + // clang-format off + if (strncmp(envstr, "standard", 8) == 0) CDI_Default_Calendar = CALENDAR_STANDARD; + else if (strncmp(envstr, "gregorian", 9) == 0) CDI_Default_Calendar = CALENDAR_GREGORIAN; + else if (strncmp(envstr, "proleptic", 9) == 0) CDI_Default_Calendar = CALENDAR_PROLEPTIC; + else if (strncmp(envstr, "360days", 7) == 0) CDI_Default_Calendar = CALENDAR_360DAYS; + else if (strncmp(envstr, "365days", 7) == 0) CDI_Default_Calendar = CALENDAR_365DAYS; + else if (strncmp(envstr, "366days", 7) == 0) CDI_Default_Calendar = CALENDAR_366DAYS; + else if (strncmp(envstr, "none", 4) == 0) CDI_Default_Calendar = CALENDAR_NONE; + // clang-format on + if (CDI_Debug) Message("Default calendar set to %s!", envstr); + } +#ifdef HAVE_LIBCGRIBEX + gribSetCalendar(CDI_Default_Calendar); +#endif + + envstr = getenv("PARTAB_INTERN"); + if (envstr) cdiPartabIntern = atoi(envstr); + + envstr = getenv("PARTAB_PATH"); + if (envstr) cdiPartabPath = strdup(envstr); + } +} + +const char * +strfiletype(int filetype) +{ + const int size = (int) (sizeof(Filetypes) / sizeof(char *)); + return (filetype > 0 && filetype < size) ? Filetypes[filetype] : Filetypes[0]; +} + +void +cdiDefGlobal(const char *string, int value) +{ + // clang-format off + if (str_is_equal(string, "REGULARGRID") ) cdiDataUnreduced = value; + else if (str_is_equal(string, "ECCODES_DEBUG") ) CDI_gribapi_debug = (bool) value; + else if (str_is_equal(string, "ECCODES_GRIB1") ) cdiSetEccodesGrib1((bool) value); + else if (str_is_equal(string, "SORTNAME") ) cdiSortName = value; + else if (str_is_equal(string, "SORTPARAM") ) cdiSortParam = value; + else if (str_is_equal(string, "HAVE_MISSVAL") ) cdiHaveMissval = value; + else if (str_is_equal(string, "NC_CHUNKSIZEHINT") ) CDI_Netcdf_Chunksizehint = value; + else if (str_is_equal(string, "READ_CELL_CORNERS") ) CDI_Read_Cell_Corners = value; + else if (str_is_equal(string, "CMOR_MODE") ) CDI_CMOR_Mode = value; + else if (str_is_equal(string, "REDUCE_DIM") ) CDI_Reduce_Dim = value; + else if (str_is_equal(string, "NETCDF_HDR_PAD") ) CDI_Netcdf_Hdr_Pad = (size_t) value; + else if (str_is_equal(string, "NETCDF_LAZY_GRID_LOAD")) CDI_Netcdf_Lazy_Grid_Load = (bool) value; + else Warning("Unsupported global key: %s", string); + // clang-format on +} + +void +cdiDefMissval(double missval) +{ + cdiInitialize(); + + CDI_Default_Missval = missval; +} + +double +cdiInqMissval(void) +{ + cdiInitialize(); + + return CDI_Default_Missval; +} + +bool +cdiFiletypeIsExse(int filetype) +{ + return (filetype == CDI_FILETYPE_SRV || filetype == CDI_FILETYPE_EXT || filetype == CDI_FILETYPE_IEG); +} + +int +cdiBaseFiletype(int filetype) +{ + switch (filetype) + { + case CDI_FILETYPE_NC: + case CDI_FILETYPE_NC2: + case CDI_FILETYPE_NC4: + case CDI_FILETYPE_NC4C: + case CDI_FILETYPE_NCZARR: + case CDI_FILETYPE_NC5: return CDI_FILETYPE_NETCDF; + } + + return filetype; +} + +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#include <string.h> +#include <stdlib.h> + +static int +sum_found(int listSize, bool *listFound) +{ + int numFound = 0; + for (int i = 0; i < listSize; ++i) numFound += listFound[i]; + return numFound; +} + +static int +sum_not_found(int listSize, bool *listFound) +{ + return listSize - sum_found(listSize, listFound); +} + +void +cdiQueryInit(CdiQuery *query) +{ + query->numEntries = 0; + + query->numNames = 0; + query->names = NULL; + query->namesFound = NULL; + + query->numCellidx = 0; + query->cellidx = NULL; + query->cellidxFound = NULL; + + query->numLevidx = 0; + query->levidx = NULL; + query->levidxFound = NULL; + + query->numStepidx = 0; + query->stepidx = NULL; + query->stepidxFound = NULL; +} + +CdiQuery * +cdiQueryCreate() +{ + CdiQuery *query = (CdiQuery *) malloc(sizeof(CdiQuery)); + cdiQueryInit(query); + return query; +} + +void +cdiQueryDelete(CdiQuery *query) +{ + if (query) + { + if (query->numNames) + { + for (int i = 0; i < query->numNames; ++i) free(query->names[i]); + free(query->names); + free(query->namesFound); + } + + if (query->numCellidx) + { + free(query->cellidx); + free(query->cellidxFound); + } + + if (query->numLevidx) + { + free(query->levidx); + free(query->levidxFound); + } + + if (query->numStepidx) + { + free(query->stepidx); + free(query->stepidxFound); + } + + cdiQueryInit(query); + free(query); + } +} + +int +cdiQueryNumNames(const CdiQuery *query) +{ + return query ? query->numNames : 0; +} + +int +cdiQueryNumCellidx(const CdiQuery *query) +{ + return query ? query->numCellidx : 0; +} + +int +cdiQueryNumStepidx(const CdiQuery *query) +{ + return query ? query->numStepidx : 0; +} + +int +cdiQueryNumEntries(const CdiQuery *query) +{ + return query ? query->numEntries : 0; +} + +void +cdiQuerySetNames(CdiQuery *query, int numEntries, char **names) +{ + if (numEntries) + { + query->numEntries += numEntries; + query->numNames = numEntries; + query->namesFound = (bool *) calloc(numEntries, sizeof(bool)); + query->names = (char **) malloc(numEntries * sizeof(char *)); + for (int i = 0; i < numEntries; ++i) query->names[i] = strdup(names[i]); + } +} + +void +cdiQuerySetCellidx(CdiQuery *query, int numEntries, size_t *cellidx) +{ + if (numEntries) + { + query->numEntries += numEntries; + query->numCellidx = numEntries; + query->cellidxFound = (bool *) calloc(numEntries, sizeof(bool)); + query->cellidx = (size_t *) malloc(numEntries * sizeof(size_t)); + for (int i = 0; i < numEntries; ++i) query->cellidx[i] = cellidx[i]; + } +} + +void +cdiQuerySetLevidx(CdiQuery *query, int numEntries, int *levidx) +{ + if (numEntries) + { + query->numEntries += numEntries; + query->numLevidx = numEntries; + query->levidxFound = (bool *) calloc(numEntries, sizeof(bool)); + query->levidx = (int *) malloc(numEntries * sizeof(int)); + for (int i = 0; i < numEntries; ++i) query->levidx[i] = levidx[i]; + } +} + +void +cdiQuerySetStepidx(CdiQuery *query, int numEntries, int *stepidx) +{ + if (numEntries) + { + query->numEntries += numEntries; + query->numStepidx = numEntries; + query->stepidxFound = (bool *) calloc(numEntries, sizeof(bool)); + query->stepidx = (int *) malloc(numEntries * sizeof(int)); + for (int i = 0; i < numEntries; ++i) query->stepidx[i] = stepidx[i]; + } +} + +size_t +cdiQueryGetCellidx(const CdiQuery *query, int index) +{ + return (index >= 0 && index < query->numCellidx) ? query->cellidx[index] : (size_t) -1; +} + +CdiQuery * +cdiQueryClone(const CdiQuery *query) +{ + CdiQuery *queryOut = cdiQueryCreate(); + + if (query) + { + cdiQuerySetNames(queryOut, query->numNames, query->names); + cdiQuerySetCellidx(queryOut, query->numCellidx, query->cellidx); + cdiQuerySetLevidx(queryOut, query->numLevidx, query->levidx); + cdiQuerySetStepidx(queryOut, query->numStepidx, query->stepidx); + } + + return queryOut; +} + +void +cdiQueryPrint(const CdiQuery *query) +{ + if (query) + { + if (query->numNames) + { + printf("Names:"); + for (int i = 0; i < query->numNames; ++i) printf(" %s", query->names[i]); + printf("\n"); + } + + if (query->numCellidx) + { + printf("Cellidx:"); + for (int i = 0; i < query->numCellidx; ++i) printf(" %zu", query->cellidx[i]); + printf("\n"); + } + + if (query->numLevidx) + { + printf("Levidx:"); + for (int i = 0; i < query->numLevidx; ++i) printf(" %d", query->levidx[i]); + printf("\n"); + } + + if (query->numStepidx) + { + printf("Stepidx:"); + for (int i = 0; i < query->numStepidx; ++i) printf(" %d", query->stepidx[i]); + printf("\n"); + } + } +} + +int +cdiQueryNumEntriesFound(const CdiQuery *query) +{ + int numEntriesFound = 0; + + if (query) + { + if (query->numNames) numEntriesFound += sum_found(query->numNames, query->namesFound); + if (query->numCellidx) numEntriesFound += sum_found(query->numCellidx, query->cellidxFound); + if (query->numLevidx) numEntriesFound += sum_found(query->numLevidx, query->levidxFound); + if (query->numStepidx) numEntriesFound += sum_found(query->numStepidx, query->stepidxFound); + } + + return numEntriesFound; +} + +void +cdiQueryPrintEntriesNotFound(const CdiQuery *query) +{ + if (query) + { + int numEntriesNotFound = cdiQueryNumEntries(query) - cdiQueryNumEntriesFound(query); + if (numEntriesNotFound > 0) + { + if (query->numNames) + { + if (sum_not_found(query->numNames, query->namesFound) > 0) + { + printf("Name not found:"); + for (int i = 0; i < query->numNames; ++i) + if (!query->namesFound[i]) printf(" %s", query->names[i]); + printf("\n"); + } + } + + if (query->numCellidx) + { + if (sum_not_found(query->numCellidx, query->cellidxFound) > 0) + { + printf("Grid cell index not found:"); + for (int i = 0; i < query->numCellidx; ++i) + if (!query->cellidxFound[i]) printf(" %zu", query->cellidx[i]); + printf("\n"); + } + } + + if (query->numLevidx) + { + if (sum_not_found(query->numLevidx, query->levidxFound) > 0) + { + printf("Level index not found:"); + for (int i = 0; i < query->numLevidx; ++i) + if (!query->levidxFound[i]) printf(" %d", query->levidx[i]); + printf("\n"); + } + } + + if (query->numStepidx) + { + if (sum_not_found(query->numStepidx, query->stepidxFound) > 0) + { + printf("Step index not found:"); + for (int i = 0; i < query->numStepidx; ++i) + if (!query->stepidxFound[i]) printf(" %d", query->stepidx[i]); + printf("\n"); + } + } + } + } +} + +int +cdiQueryName(CdiQuery *query, const char *name) +{ + if (query && query->numNames && name && *name) + { + for (int i = 0; i < query->numNames; ++i) + if (strcmp(name, query->names[i]) == 0) + { + query->namesFound[i] = true; + return 0; + } + } + + return -1; +} + +int +cdiQueryCellidx(CdiQuery *query, size_t cellidx) +{ + if (query && query->numCellidx) + { + for (int i = 0; i < query->numCellidx; ++i) + if (query->cellidx[i] == cellidx) + { + query->cellidxFound[i] = true; + return 0; + } + } + + return -1; +} + +int +cdiQueryLevidx(CdiQuery *query, int levidx) +{ + if (query && query->numLevidx) + { + for (int i = 0; i < query->numLevidx; ++i) + if (query->levidx[i] == levidx) + { + query->levidxFound[i] = true; + return 0; + } + } + + return -1; +} + +int +cdiQueryStepidx(CdiQuery *query, int stepidx) +{ + if (query && query->numStepidx) + { + for (int i = 0; i < query->numStepidx; ++i) + if (query->stepidx[i] == stepidx) + { + query->stepidxFound[i] = true; + return 0; + } + } + + return -1; +} +#ifdef HAVE_CONFIG_H +#endif + +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif + +#include <limits.h> +#include <stdio.h> +#include <stdlib.h> + +void +cdiDecodeParam(int param, int *pnum, int *pcat, int *pdis) +{ + unsigned uparam = (unsigned) param; + + *pdis = (int) (0xffU & uparam); + *pcat = (int) (0xffU & (uparam >> 8)); + unsigned upnum = 0xffffU & (uparam >> 16); + if (upnum > 0x7fffU) upnum = 0x8000U - upnum; + *pnum = (int) upnum; +} + +int +cdiEncodeParam(int pnum, int pcat, int pdis) +{ + if (pcat < 0 || pcat > 255) pcat = 255; + if (pdis < 0 || pdis > 255) pdis = 255; + + unsigned upnum = (unsigned) pnum; + if (pnum < 0) upnum = (unsigned) (0x8000 - pnum); + + unsigned uparam = (upnum << 16) | (((unsigned) pcat) << 8) | (unsigned) pdis; + + return (int) uparam; +} + +void +cdiParamToString(int param, char *paramstr, int maxlen) +{ + int dis, cat, num; + cdiDecodeParam(param, &num, &cat, &dis); + + size_t umaxlen = maxlen >= 0 ? (unsigned) maxlen : 0U; + int len; + if (dis == 255 && (cat == 255 || cat == 0)) + len = snprintf(paramstr, umaxlen, "%d", num); + else if (dis == 255) + len = snprintf(paramstr, umaxlen, "%d.%d", num, cat); + else + len = snprintf(paramstr, umaxlen, "%d.%d.%d", num, cat, dis); + + if (len >= maxlen || len < 0) fprintf(stderr, "Internal problem (%s): size of input string is too small!\n", __func__); +} + +const char * +cdiUnitNamePtr(int cdi_unit) +{ + const char *cdiUnits[] = { + /* 0 */ "undefined", + /* 1 */ "Pa", + /* 2 */ "hPa", + /* 3 */ "mm", + /* 4 */ "cm", + /* 5 */ "dm", + /* 6 */ "m", + }; + enum + { + numUnits = (int) (sizeof(cdiUnits) / sizeof(char *)) + }; + const char *name = (cdi_unit > 0 && cdi_unit < numUnits) ? cdiUnits[cdi_unit] : NULL; + + return name; +} + +size_t +cdiGetPageSize(bool largePageAlign) +{ + long pagesize = -1L; +#if HAVE_DECL__SC_LARGE_PAGESIZE || HAVE_DECL__SC_PAGE_SIZE || HAVE_DECL__SC_PAGESIZE + bool nameAssigned = false; + int name = 0; +#if HAVE_DECL__SC_LARGE_PAGESIZE + if (largePageAlign) + { + name = _SC_LARGE_PAGESIZE; + nameAssigned = true; + } + else +#else + (void) largePageAlign; +#endif + { +#if HAVE_DECL__SC_PAGESIZE || HAVE_DECL__SC_PAGE_SIZE + name = +#if HAVE_DECL__SC_PAGESIZE + _SC_PAGESIZE; +#else + _SC_PAGE_SIZE; +#endif + nameAssigned = true; +#endif + } + if (nameAssigned) pagesize = sysconf(name); +#endif + if (pagesize == -1L) + pagesize = +#if HAVE_DECL_PAGESIZE + PAGESIZE; +#elif HAVE_DECL_PAGE_SIZE + PAGE_SIZE; +#else + commonPageSize; +#endif + return (size_t) pagesize; +} + +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ + +// Automatically generated by m214003 at 2023-02-08, do not edit + +// CGRIBEXLIB_VERSION="2.1.0" + +// clang-format off + +#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 5) || defined (__clang__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic warning "-Wstrict-overflow" +#endif + +#ifdef _ARCH_PWR6 +#pragma options nostrict +#include <ppu_intrinsics.h> +#endif + +#ifdef HAVE_CONFIG_H +#endif + +#include <string.h> +#include <ctype.h> +#include <stdarg.h> +#include <stdbool.h> +#include <sys/types.h> +#include <inttypes.h> + + + +#ifndef CGRIBEX_TEMPLATES_H +#define CGRIBEX_TEMPLATES_H + +#define CAT(X,Y) X##_##Y +#define TEMPLATE(X,Y) CAT(X,Y) + +#endif +#ifndef GRIB_INT_H +#define GRIB_INT_H + +#ifdef HAVE_CONFIG_H +#endif + +#include <inttypes.h> +#include <stdio.h> +#include <stdlib.h> +#include <stdbool.h> +#include <math.h> +#include <float.h> + + +#ifndef CGRIBEX_H +#endif +#ifndef ERROR_H +#endif +#ifndef TYPES_H +#endif + + +#ifndef UCHAR +#define UCHAR unsigned char +#endif + + +#if defined (CRAY) || defined (SX) || defined (__uxpch__) +#define VECTORCODE 1 +#endif + + +#ifdef VECTORCODE +#ifdef INT32 +# define GRIBPACK unsigned INT32 +# define PACK_GRIB packInt32 +# define UNPACK_GRIB unpackInt32 +#else +# define GRIBPACK unsigned INT64 +# define PACK_GRIB packInt64 +# define UNPACK_GRIB unpackInt64 +#endif +#else +# define GRIBPACK unsigned char +#endif + +#ifndef HOST_ENDIANNESS +#ifdef __cplusplus +static const uint32_t HOST_ENDIANNESS_temp[1] = { UINT32_C(0x00030201) }; +#define HOST_ENDIANNESS (((const unsigned char *)HOST_ENDIANNESS_temp)[0]) +#else +#define HOST_ENDIANNESS (((const unsigned char *)&(const uint32_t[1]){UINT32_C(0x00030201)})[0]) +#endif +#endif + +#define IS_BIGENDIAN() (HOST_ENDIANNESS == 0) + +#if defined (__xlC__) /* performance problems on IBM */ +#ifndef DBL_IS_NAN +# define DBL_IS_NAN(x) ((x) != (x)) +#endif +#else +#ifndef DBL_IS_NAN +#if defined (HAVE_DECL_ISNAN) +# define DBL_IS_NAN(x) (isnan(x)) +#elif defined (FP_NAN) +# define DBL_IS_NAN(x) (fpclassify(x) == FP_NAN) +#else +# define DBL_IS_NAN(x) ((x) != (x)) +#endif +#endif +#endif + +#ifndef IS_EQUAL +# define IS_NOT_EQUAL(x,y) (x < y || y < x) +# define IS_EQUAL(x,y) (!IS_NOT_EQUAL(x,y)) +#endif + +/* dummy use of unused parameters to silence compiler warnings */ +#ifndef UNUSED +#define UNUSED(x) (void)(x) +#endif + +#define JP24SET 0xFFFFFF /* 2**24 (---> 16777215) */ +#define JP23SET 0x7FFFFF /* 2**23 - 1 (---> 8388607) */ + +#define POW_2_M24 0.000000059604644775390625 /* pow(2.0, -24.0) */ + +#ifdef __cplusplus +extern "C" { +#endif + +#define intpow2(x) (ldexp(1.0, (x))) + +static inline int +gribrec_len(unsigned b1, unsigned b2, unsigned b3) +{ + /* + If bit 7 of b1 is set, we have to rescale by factor of 120. + This is a fixup to get round the restriction on product lengths + due to the count being only 24 bits. It is only possible because + the (default) rounding for GRIB products is 120 bytes. + */ + const int needRescaling = b1 & (1 << 7); + + int gribsize = (int)((((b1&127) << 16)+(b2<<8) + b3)); + + if ( needRescaling ) gribsize *= 120; + + return gribsize; + +} + +unsigned correct_bdslen(unsigned bdslen, long recsize, long gribpos); + +/* CDI converter routines */ + +/* param format: DDDCCCNNN */ + +void cdiDecodeParam(int param, int *pnum, int *pcat, int *pdis); +int cdiEncodeParam(int pnum, int pcat, int pdis); + +/* date format: YYYYMMDD */ +/* time format: hhmmss */ + +void cdiDecodeDate(int date, int *year, int *month, int *day); +int cdiEncodeDate(int year, int month, int day); + +void cdiDecodeTime(int time, int *hour, int *minute, int *second); +int cdiEncodeTime(int hour, int minute, int second); + +/* CALENDAR types */ + +#define CALENDAR_STANDARD 0 /* don't change this value (used also in cgribexlib)! */ +#define CALENDAR_GREGORIAN 1 +#define CALENDAR_PROLEPTIC 2 +#define CALENDAR_360DAYS 3 +#define CALENDAR_365DAYS 4 +#define CALENDAR_366DAYS 5 +#define CALENDAR_NONE 6 + +extern FILE *grprsm; + +extern int CGRIBEX_Debug, CGRIBEX_Fix_ZSE, CGRIBEX_Const; +extern int CGRIBEX_grib_calendar; + +void gprintf(const char *caller, const char *fmt, ...); + +void grsdef(void); + +void prtbin(int kin, int knbit, int *kout, int *kerr); +void confp3(double pval, int *kexp, int *kmant, int kbits, int kround); +double decfp2(int kexp, int kmant); +void ref2ibm(double *pref, int kbits); + +void scale_complex_double(double *fpdata, int pcStart, int pcScale, int trunc, int inv); +void scale_complex_float(float *fpdata, int pcStart, int pcScale, int trunc, int inv); +void scatter_complex_double(double *fpdata, int pcStart, int trunc, int nsp); +void scatter_complex_float(float *fpdata, int pcStart, int trunc, int nsp); +void gather_complex_double(double *fpdata, size_t pcStart, size_t trunc, size_t nsp); +void gather_complex_float(float *fpdata, size_t pcStart, size_t trunc, size_t nsp); + +int qu2reg2(double *pfield, int *kpoint, int klat, int klon, + double *ztemp, double msval, int *kret); +int qu2reg3_double(double *pfield, int *kpoint, int klat, int klon, + double msval, int *kret, int omisng, int operio, int oveggy); +int qu2reg3_float(float *pfield, int *kpoint, int klat, int klon, + float msval, int *kret, int omisng, int operio, int oveggy); + +#ifdef INT32 +long packInt32(unsigned INT32 *up, unsigned char *cp, long bc, long tc); +#endif +long packInt64(unsigned INT64 *up, unsigned char *cp, long bc, long tc); +#ifdef INT32 +long unpackInt32(const unsigned char *cp, unsigned INT32 *up, long bc, long tc); +#endif +long unpackInt64(const unsigned char *cp, unsigned INT64 *up, long bc, long tc); + +void grib_encode_double(int *isec0, int *isec1, int *isec2, double *fsec2, int *isec3, + double *fsec3, int *isec4, double *fsec4, int klenp, int *kgrib, + int kleng, int *kword, int efunc, int *kret); +void grib_encode_float(int *isec0, int *isec1, int *isec2, float *fsec2, int *isec3, + float *fsec3, int *isec4, float *fsec4, int klenp, int *kgrib, + int kleng, int *kword, int efunc, int *kret); + +void grib_decode_double(int *isec0, int *isec1, int *isec2, double *fsec2, int *isec3, + double *fsec3, int *isec4, double *fsec4, int klenp, int *kgrib, + int kleng, int *kword, int dfunc, int *kret); +void grib_decode_float(int *isec0, int *isec1, int *isec2, float *fsec2, int *isec3, + float *fsec3, int *isec4, float *fsec4, int klenp, int *kgrib, + int kleng, int *kword, int dfunc, int *kret); + + +int grib1Sections(unsigned char *gribbuffer, long gribbufsize, unsigned char **pdsp, + unsigned char **gdsp, unsigned char **bmsp, unsigned char **bdsp, long *gribrecsize); +int grib2Sections(unsigned char *gribbuffer, long gribbufsize, unsigned char **idsp, + unsigned char **lusp, unsigned char **gdsp, unsigned char **pdsp, + unsigned char **drsp, unsigned char **bmsp, unsigned char **bdsp); + +#ifdef __cplusplus +} +#endif + +#endif /* GRIB_INT_H */ +#ifndef GRIBDECODE_H +#define GRIBDECODE_H + +#define UNDEFINED 9.999e20 + + +#define GET_INT3(a,b,c) ((1-(int) ((unsigned) (a & 128) >> 6)) * (int) (((a & 127) << 16)+(b<<8)+c)) +#define GET_INT2(a,b) ((1-(int) ((unsigned) (a & 128) >> 6)) * (int) (((a & 127) << 8) + b)) +#define GET_INT1(a) ((1-(int) ((unsigned) (a & 128) >> 6)) * (int) (a&127)) + +/* this requires a 32-bit default integer machine */ +#define GET_UINT4(a,b,c,d) ((unsigned) ((a << 24) + (b << 16) + (c << 8) + (d))) +#define GET_UINT3(a,b,c) ((unsigned) ((a << 16) + (b << 8) + (c))) +#define GET_UINT2(a,b) ((unsigned) ((a << 8) + (b))) +#define GET_UINT1(a) ((unsigned) (a)) + +#define BUDG_START(s) (s[0]=='B' && s[1]=='U' && s[2]=='D' && s[3]=='G') +#define TIDE_START(s) (s[0]=='T' && s[1]=='I' && s[2]=='D' && s[3]=='E') +#define GRIB_START(s) (s[0]=='G' && s[1]=='R' && s[2]=='I' && s[3]=='B') +#define GRIB_FIN(s) (s[0]=='7' && s[1]=='7' && s[2]=='7' && s[3]=='7') + +/* GRIB1 Section 0: Indicator Section (IS) */ + +#define GRIB1_SECLEN(s) GET_UINT3(s[ 4], s[ 5], s[ 6]) +#define GRIB_EDITION(s) GET_UINT1(s[ 7]) + +/* GRIB1 Section 1: Product Definition Section (PDS) */ + +#define PDS_Len GET_UINT3(pds[ 0], pds[ 1], pds[ 2]) +#define PDS_CodeTable GET_UINT1(pds[ 3]) +#define PDS_CenterID GET_UINT1(pds[ 4]) +#define PDS_ModelID GET_UINT1(pds[ 5]) +#define PDS_GridDefinition GET_UINT1(pds[ 6]) +#define PDS_Sec2Or3Flag GET_UINT1(pds[ 7]) +#define PDS_HAS_GDS ((pds[7] & 128) != 0) +#define PDS_HAS_BMS ((pds[7] & 64) != 0) +#define PDS_Parameter GET_UINT1(pds[ 8]) +#define PDS_LevelType GET_UINT1(pds[ 9]) +#define PDS_Level1 (pds[10]) +#define PDS_Level2 (pds[11]) +#define PDS_Level GET_UINT2(pds[10], pds[11]) +#define PDS_Year GET_INT1(pds[12]) +#define PDS_Month GET_UINT1(pds[13]) +#define PDS_Day GET_UINT1(pds[14]) +#define PDS_Hour GET_UINT1(pds[15]) +#define PDS_Minute GET_UINT1(pds[16]) +#define PDS_Date (PDS_Year*10000+PDS_Month*100+PDS_Day) +#define PDS_Time (PDS_Hour*100+PDS_Minute) +#define PDS_TimeUnit GET_UINT1(pds[17]) +#define PDS_TimePeriod1 GET_UINT1(pds[18]) +#define PDS_TimePeriod2 GET_UINT1(pds[19]) +#define PDS_TimeRange GET_UINT1(pds[20]) +#define PDS_AvgNum GET_UINT2(pds[21], pds[22]) +#define PDS_AvgMiss GET_UINT1(pds[23]) +#define PDS_Century GET_UINT1(pds[24]) +#define PDS_Subcenter GET_UINT1(pds[25]) +#define PDS_DecimalScale GET_INT2(pds[26],pds[27]) + + +/* GRIB1 Section 2: Grid Description Section (GDS) */ + +#define GDS_Len ((gds) == NULL ? 0 : GET_UINT3(gds[0], gds[1], gds[2])) +#define GDS_NV GET_UINT1(gds[ 3]) +#define GDS_PVPL GET_UINT1(gds[ 4]) +#define GDS_PV ((gds[3] == 0) ? -1 : (int) gds[4] - 1) +#define GDS_PL ((gds[4] == 0xFF) ? -1 : (int) gds[3] * 4 + (int) gds[4] - 1) +#define GDS_GridType GET_UINT1(gds[ 5]) + + +/* GRIB1 Triangular grid of DWD */ +#define GDS_GME_NI2 GET_UINT2(gds[ 6], gds[ 7]) +#define GDS_GME_NI3 GET_UINT2(gds[ 8], gds[ 9]) +#define GDS_GME_ND GET_UINT3(gds[10], gds[11], gds[12]) +#define GDS_GME_NI GET_UINT3(gds[13], gds[14], gds[15]) +#define GDS_GME_AFlag GET_UINT1(gds[16]) +#define GDS_GME_LatPP GET_INT3(gds[17], gds[18], gds[19]) +#define GDS_GME_LonPP GET_INT3(gds[20], gds[21], gds[22]) +#define GDS_GME_LonMPL GET_INT3(gds[23], gds[24], gds[25]) +#define GDS_GME_BFlag GET_UINT1(gds[27]) + +/* GRIB1 Spectral */ +#define GDS_PentaJ GET_UINT2(gds[ 6], gds[ 7]) +#define GDS_PentaK GET_UINT2(gds[ 8], gds[ 9]) +#define GDS_PentaM GET_UINT2(gds[10], gds[11]) +#define GDS_RepType GET_UINT1(gds[12]) +#define GDS_RepMode GET_UINT1(gds[13]) + +/* GRIB1 Regular grid */ +#define GDS_NumLon GET_UINT2(gds[ 6], gds[ 7]) +#define GDS_NumLat GET_UINT2(gds[ 8], gds[ 9]) +#define GDS_FirstLat GET_INT3(gds[10], gds[11], gds[12]) +#define GDS_FirstLon GET_INT3(gds[13], gds[14], gds[15]) +#define GDS_ResFlag GET_UINT1(gds[16]) +#define GDS_LastLat GET_INT3(gds[17], gds[18], gds[19]) +#define GDS_LastLon GET_INT3(gds[20], gds[21], gds[22]) +#define GDS_LonIncr GET_UINT2(gds[23], gds[24]) +#define GDS_LatIncr GET_UINT2(gds[25], gds[26]) +#define GDS_NumPar GET_UINT2(gds[25], gds[26]) +#define GDS_ScanFlag GET_UINT1(gds[27]) +#define GDS_LatSP GET_INT3(gds[32], gds[33], gds[34]) +#define GDS_LonSP GET_INT3(gds[35], gds[36], gds[37]) +#define GDS_RotAngle (GET_Real(&(gds[38]))) + +/* GRIB1 Lambert */ +#define GDS_Lambert_Lov GET_INT3(gds[17], gds[18], gds[19]) +#define GDS_Lambert_dx GET_INT3(gds[20], gds[21], gds[22]) +#define GDS_Lambert_dy GET_INT3(gds[23], gds[24], gds[25]) +#define GDS_Lambert_ProjFlag GET_UINT1(gds[26]) +#define GDS_Lambert_LatS1 GET_INT3(gds[28], gds[29], gds[30]) +#define GDS_Lambert_LatS2 GET_INT3(gds[31], gds[32], gds[33]) +#define GDS_Lambert_LatSP GET_INT3(gds[34], gds[35], gds[36]) +#define GDS_Lambert_LonSP GET_INT3(gds[37], gds[37], gds[37]) + +/* GRIB1 Section 3: Bit Map Section (BMS) */ + +#define BMS_Len ((bms) == NULL ? 0 : GET_UINT3(bms[0], bms[1], bms[2])) +#define BMS_UnusedBits (bms[3]) +#define BMS_Bitmap ((bms) == NULL ? NULL : (bms)+6) +#define BMS_BitmapSize (((((bms[0]<<16)+(bms[1]<<8)+bms[2]) - 6)<<3) - bms[3]) + +/* GRIB1 Section 4: Binary Data Section (BDS) */ + +#define BDS_Len GET_UINT3(bds[0], bds[1], bds[2]) +#define BDS_Flag (bds[3]) +#define BDS_BinScale GET_INT2(bds[ 4], bds[ 5]) +#define BDS_RefValue (decfp2((int)bds[ 6], GET_UINT3(bds[7], bds[8], bds[9]))) +#define BDS_NumBits ((int) bds[10]) +#define BDS_RealCoef (decfp2((int)bds[zoff+11], GET_UINT3(bds[zoff+12], bds[zoff+13], bds[zoff+14]))) +#define BDS_PackData ((int) ((bds[zoff+11]<<8) + bds[zoff+12])) +#define BDS_Power GET_INT2(bds[zoff+13], bds[zoff+14]) +#define BDS_Z (bds[13]) + +/* GRIB1 Section 5: End Section (ES) */ + +/* GRIB2 */ + +#define GRIB2_SECLEN(section) (GET_UINT4(section[0], section[1], section[2], section[3])) +#define GRIB2_SECNUM(section) (GET_UINT1(section[4])) + +#endif /* GRIBDECODE_H */ +#ifndef CGRIBEX_GRIB_ENCODE_H +#define CGRIBEX_GRIB_ENCODE_H + +#include <limits.h> + +#define PutnZero(n) \ +{ \ + for ( size_t i___ = z >= 0 ? (size_t)z : 0; i___ < (size_t)(z+n); i___++ ) lGrib[i___] = 0; \ + z += n; \ +} + +#define Put1Byte(Value) (lGrib[z++] = (GRIBPACK)(Value)) +#define Put2Byte(Value) ((lGrib[z++] = (GRIBPACK)((Value) >> 8)), \ + (lGrib[z++] = (GRIBPACK)(Value))) +#define Put3Byte(Value) ((lGrib[z++] = (GRIBPACK)((Value) >> 16)), \ + (lGrib[z++] = (GRIBPACK)((Value) >> 8)), \ + (lGrib[z++] = (GRIBPACK)(Value))) +#define Put4Byte(Value) ((lGrib[z++] = (GRIBPACK)((Value) >> 24)), \ + (lGrib[z++] = (GRIBPACK)((Value) >> 16)), \ + (lGrib[z++] = (GRIBPACK)((Value) >> 8)), \ + (lGrib[z++] = (GRIBPACK)(Value))) + +#define Put1Int(Value) {ival = Value; if ( ival < 0 ) ival = 0x80 - ival; Put1Byte(ival);} +#define Put2Int(Value) {ival = Value; if ( ival < 0 ) ival = 0x8000 - ival; Put2Byte(ival);} +#define Put3Int(Value) {ival = Value; if ( ival < 0 ) ival = 0x800000 - ival; Put3Byte(ival);} + +enum { + BitsPerInt = (int) (sizeof(int) * CHAR_BIT), +}; + + +#define Put1Real(Value) \ +{ \ + confp3(Value, &exponent, &mantissa, BitsPerInt, 1); \ + Put1Byte(exponent); \ + Put3Byte(mantissa); \ +} + +#endif /* CGRIBEX_GRIB_ENCODE_H */ +#ifndef CODEC_COMMON_H +#define CODEC_COMMON_H +#define gribSwapByteOrder_uint16(ui16) ((uint16_t)((ui16<<8) | (ui16>>8))) +#endif /* CODEC_COMMON_H */ +/* +icc -g -Wall -O3 -march=native -std=c99 -qopt-report=5 -DTEST_MINMAXVAL -qopenmp -DOMP_SIMD minmax_val.c + result on hama2 (icc 16.0.0): + float: +minmax_val: fmin: -500000 fmax: 499999 time: 1.22s +simd : fmin: -500000 fmax: 499999 time: 1.20s + double: +minmax_val: fmin: -500000 fmax: 499999 time: 2.86s +orig : fmin: -500000 fmax: 499999 time: 2.74s +simd : fmin: -500000 fmax: 499999 time: 2.70s +avx : fmin: -500000 fmax: 499999 time: 2.99s + +gcc -g -Wall -O3 -march=native -std=c99 -DTEST_MINMAXVAL -fopenmp -DOMP_SIMD -Wa,-q minmax_val.c + result on thunder5 (gcc 6.1.0): +float: +minmax_val: fmin: -500000 fmax: 499999 time: 8.25s + simd : fmin: -500000 fmax: 499999 time: 1.24s +double: +minmax_val: fmin: -500000 fmax: 499999 time: 2.73s + orig : fmin: -500000 fmax: 499999 time: 9.24s + simd : fmin: -500000 fmax: 499999 time: 2.78s + avx : fmin: -500000 fmax: 499999 time: 2.90s + +gcc -g -Wall -O3 -march=native -std=c99 -DTEST_MINMAXVAL minmax_val.c + result on bailung (gcc 4.8.2): + orig : fmin: -500000 fmax: 499999 time: 4.82s + sse2 : fmin: -500000 fmax: 499999 time: 4.83s + +gcc -g -Wall -O3 -march=native -std=c99 -DTEST_MINMAXVAL -fopenmp -DOMP_SIMD -Wa,-q minmax_val.c + result on thunder5 (gcc 4.8.2): + orig : fmin: -500000 fmax: 499999 time: 3.10s + simd : fmin: -500000 fmax: 499999 time: 3.10s # omp simd in gcc 4.9 + avx : fmin: -500000 fmax: 499999 time: 2.84s + +icc -g -Wall -O3 -march=native -std=c99 -qopt-report=5 -DTEST_MINMAXVAL -openmp -DOMP_SIMD minmax_val.c + result on thunder5 (icc 14.0.2): + orig : fmin: -500000 fmax: 499999 time: 2.83s + simd : fmin: -500000 fmax: 499999 time: 2.83s + avx : fmin: -500000 fmax: 499999 time: 2.92s + +xlc_r -g -O3 -qhot -q64 -qarch=auto -qtune=auto -qreport -DTEST_MINMAXVAL minmax_val.c + result on blizzard (xlc 12): + orig : fmin: -500000 fmax: 499999 time: 7.26s + pwr6u6 : fmin: -500000 fmax: 499999 time: 5.92s +*/ +#ifdef _ARCH_PWR6 +#pragma options nostrict +#endif + +#ifdef OMP_SIMD +#include <omp.h> +#endif + +#include <stdlib.h> + +//#undef _GET_X86_COUNTER +//#undef _GET_IBM_COUNTER +//#undef _GET_MACH_COUNTER +//#undef _ARCH_PWR6 + +#if defined(_GET_IBM_COUNTER) +#include <libhpc.h> +#elif defined(_GET_X86_COUNTER) +#include <x86intrin.h> +#elif defined(_GET_MACH_COUNTER) +#include <mach/mach_time.h> +#endif + +#if defined(__GNUC__) && !defined(__ICC) && !defined(__clang__) +#if (__GNUC__ >= 4) && (__GNUC_MINOR__ >= 4) +#define GNUC_PUSH_POP +#endif +#endif + +#ifndef DISABLE_SIMD +#if defined(__GNUC__) && (__GNUC__ >= 4) +#elif defined(__ICC) && (__ICC >= 1100) +#elif defined(__clang__) +#else +#define DISABLE_SIMD +#endif +#endif + +#ifdef DISABLE_SIMD +#define DISABLE_SIMD_MINMAXVAL +#endif + +#ifndef TEST_MINMAXVAL +#define DISABLE_SIMD_MINMAXVAL +#endif + +#ifdef DISABLE_SIMD_MINMAXVAL +#ifdef ENABLE_AVX +#define _ENABLE_AVX +#endif +#ifdef ENABLE_SSE2 +#define _ENABLE_SSE2 +#endif +#endif + +#ifndef DISABLE_SIMD_MINMAXVAL +#ifdef __AVX__ +#define _ENABLE_AVX +#endif +#ifdef __SSE2__ +#define _ENABLE_SSE2 +#endif +#endif + +#include <float.h> +#include <stdint.h> +#include <inttypes.h> + +#if defined(_ENABLE_AVX) +#include <immintrin.h> +#elif defined(_ENABLE_SSE2) +#include <emmintrin.h> +#endif + + +#if defined(_ENABLE_AVX) + +static +void avx_minmax_val_double(const double *restrict buf, size_t nframes, double *min, double *max) +{ + double fmin[4], fmax[4]; + __m256d current_max, current_min, work; + + // load max and min values into all four slots of the YMM registers + current_min = _mm256_set1_pd(*min); + current_max = _mm256_set1_pd(*max); + + // Work input until "buf" reaches 32 byte alignment + while ( ((unsigned long)buf) % 32 != 0 && nframes > 0) { + + // Load the next double into the work buffer + work = _mm256_set1_pd(*buf); + current_min = _mm256_min_pd(current_min, work); + current_max = _mm256_max_pd(current_max, work); + buf++; + nframes--; + } + + while (nframes >= 16) { + + (void) _mm_prefetch((const char *)(buf+8), _MM_HINT_NTA); + + work = _mm256_load_pd(buf); + current_min = _mm256_min_pd(current_min, work); + current_max = _mm256_max_pd(current_max, work); + buf += 4; + + work = _mm256_load_pd(buf); + current_min = _mm256_min_pd(current_min, work); + current_max = _mm256_max_pd(current_max, work); + buf += 4; + + (void) _mm_prefetch((const char *)(buf+8), _MM_HINT_NTA); + + work = _mm256_load_pd(buf); + current_min = _mm256_min_pd(current_min, work); + current_max = _mm256_max_pd(current_max, work); + buf += 4; + + work = _mm256_load_pd(buf); + current_min = _mm256_min_pd(current_min, work); + current_max = _mm256_max_pd(current_max, work); + buf += 4; + nframes -= 16; + } + + // work through aligned buffers + while (nframes >= 4) { + work = _mm256_load_pd(buf); + current_min = _mm256_min_pd(current_min, work); + current_max = _mm256_max_pd(current_max, work); + buf += 4; + nframes -= 4; + } + + // work through the remainung values + while ( nframes > 0) { + work = _mm256_set1_pd(*buf); + current_min = _mm256_min_pd(current_min, work); + current_max = _mm256_max_pd(current_max, work); + buf++; + nframes--; + } + + // find min & max value through shuffle tricks + + work = current_min; + work = _mm256_shuffle_pd(work, work, 5); + work = _mm256_min_pd (work, current_min); + current_min = work; + work = _mm256_permute2f128_pd(work, work, 1); + work = _mm256_min_pd (work, current_min); + _mm256_storeu_pd(fmin, work); + + work = current_max; + work = current_max; + work = _mm256_shuffle_pd(work, work, 5); + work = _mm256_max_pd (work, current_max); + current_max = work; + work = _mm256_permute2f128_pd(work, work, 1); + work = _mm256_max_pd (work, current_max); + _mm256_storeu_pd(fmax, work); + + *min = fmin[0]; + *max = fmax[0]; + + return; +} + +#elif defined(_ENABLE_SSE2) + +static +void sse2_minmax_val_double(const double *restrict buf, size_t nframes, double *min, double *max) +{ + __m128d current_max, current_min, work; + + // load starting max and min values into all slots of the XMM registers + current_min = _mm_set1_pd(*min); + current_max = _mm_set1_pd(*max); + + // work on input until buf reaches 16 byte alignment + while ( ((unsigned long)buf) % 16 != 0 && nframes > 0) { + + // load one double and replicate + work = _mm_set1_pd(*buf); + current_min = _mm_min_pd(current_min, work); + current_max = _mm_max_pd(current_max, work); + buf++; + nframes--; + } + + while (nframes >= 8) { + // use 64 byte prefetch for double octetts + // __builtin_prefetch(buf+64,0,0); // for GCC 4.3.2 + + + work = _mm_load_pd(buf); + current_min = _mm_min_pd(current_min, work); + current_max = _mm_max_pd(current_max, work); + buf += 2; + work = _mm_load_pd(buf); + current_min = _mm_min_pd(current_min, work); + current_max = _mm_max_pd(current_max, work); + buf += 2; + work = _mm_load_pd(buf); + current_min = _mm_min_pd(current_min, work); + current_max = _mm_max_pd(current_max, work); + buf += 2; + work = _mm_load_pd(buf); + current_min = _mm_min_pd(current_min, work); + current_max = _mm_max_pd(current_max, work); + buf += 2; + nframes -= 8; + } + + // work through smaller chunks of aligned buffers without prefetching + while (nframes >= 2) { + work = _mm_load_pd(buf); + current_min = _mm_min_pd(current_min, work); + current_max = _mm_max_pd(current_max, work); + buf += 2; + nframes -= 2; + } + + // work through the remaining value + while ( nframes > 0) { + // load the last double and replicate + work = _mm_set1_pd(*buf); + current_min = _mm_min_pd(current_min, work); + current_max = _mm_max_pd(current_max, work); + buf++; + nframes--; + } + + // find final min and max value through shuffle tricks + work = current_min; + work = _mm_shuffle_pd(work, work, _MM_SHUFFLE2(0, 1)); + work = _mm_min_pd (work, current_min); + _mm_store_sd(min, work); + work = current_max; + work = _mm_shuffle_pd(work, work, _MM_SHUFFLE2(0, 1)); + work = _mm_max_pd (work, current_max); + _mm_store_sd(max, work); + + return; +} + +#endif // SIMD + +#if defined(_ARCH_PWR6) +static +void pwr6_minmax_val_double_unrolled6(const double *restrict data, size_t datasize, double *fmin, double *fmax) +{ +#define __UNROLL_DEPTH_1 6 + + // to allow pipelining we have to unroll + + { + size_t residual = datasize % __UNROLL_DEPTH_1; + size_t ofs = datasize - residual; + double register dmin[__UNROLL_DEPTH_1]; + double register dmax[__UNROLL_DEPTH_1]; + + for (size_t j = 0; j < __UNROLL_DEPTH_1; ++j) + { + dmin[j] = data[0]; + dmax[j] = data[0]; + } + + for (size_t i = 0; i < datasize - residual; i += __UNROLL_DEPTH_1) + { + for (size_t j = 0; j < __UNROLL_DEPTH_1; ++j) + { + dmin[j] = __fsel(dmin[j] - data[i+j], data[i+j], dmin[j]); + dmax[j] = __fsel(data[i+j] - dmax[j], data[i+j], dmax[j]); + } + } + + for (size_t j = 0; j < residual; ++j) + { + dmin[j] = __fsel(dmin[j] - data[ofs+j], data[ofs+j], dmin[j]); + dmax[j] = __fsel(data[ofs+j] - dmax[j], data[ofs+j], dmax[j]); + } + + for (size_t j = 0; j < __UNROLL_DEPTH_1; ++j) + { + *fmin = __fsel(*fmin - dmin[j], dmin[j], *fmin); + *fmax = __fsel(dmax[j] - *fmax, dmax[j], *fmax); + } + } +#undef __UNROLL_DEPTH_1 +} +#endif + +#if defined(TEST_MINMAXVAL) && defined(__GNUC__) +static +void minmax_val_double_orig(const double *restrict data, size_t datasize, double *fmin, double *fmax) __attribute__ ((noinline)); +static +void minmax_val_double_simd(const double *restrict data, size_t datasize, double *fmin, double *fmax) __attribute__ ((noinline)); +static +void minmax_val_double_omp(const double *restrict data, size_t datasize, double *fmin, double *fmax) __attribute__ ((noinline)); +static +void minmax_val_float(const float *restrict data, long datasize, float *fmin, float *fmax) __attribute__ ((noinline)); +static +void minmax_val_float_simd(const float *restrict data, size_t datasize, float *fmin, float *fmax) __attribute__ ((noinline)); +#endif + +#if defined(GNUC_PUSH_POP) +#pragma GCC push_options +#pragma GCC optimize ("O3", "fast-math") +#endif +static +void minmax_val_double_orig(const double *restrict data, size_t datasize, double *fmin, double *fmax) +{ + double dmin = *fmin, dmax = *fmax; + +#if defined(CRAY) +#pragma _CRI ivdep +#elif defined(SX) +#pragma vdir nodep +#elif defined(__uxp__) +#pragma loop novrec +#elif defined (__ICC) +#pragma ivdep +#endif + for (size_t i = 0; i < datasize; ++i) + { + dmin = (dmin < data[i]) ? dmin : data[i]; + dmax = (dmax > data[i]) ? dmax : data[i]; + } + + *fmin = dmin; + *fmax = dmax; +} + +static +void minmax_val_float(const float *restrict data, long idatasize, float *fmin, float *fmax) +{ + size_t datasize = (size_t)idatasize; + float dmin = *fmin, dmax = *fmax; + +#if defined(CRAY) +#pragma _CRI ivdep +#elif defined(SX) +#pragma vdir nodep +#elif defined(__uxp__) +#pragma loop novrec +#elif defined (__ICC) +#pragma ivdep +#endif + for (size_t i = 0; i < datasize; ++i) + { + dmin = (dmin < data[i]) ? dmin : data[i]; + dmax = (dmax > data[i]) ? dmax : data[i]; + } + + *fmin = dmin; + *fmax = dmax; +} +#if defined(GNUC_PUSH_POP) +#pragma GCC pop_options +#endif + +// TEST +#if defined(OMP_SIMD) + +#if defined(GNUC_PUSH_POP) +#pragma GCC push_options +#pragma GCC optimize ("O3", "fast-math") +#endif +static +void minmax_val_double_omp(const double *restrict data, size_t datasize, double *fmin, double *fmax) +{ + double dmin = *fmin, dmax = *fmax; + +#if defined(_OPENMP) +#pragma omp parallel for simd reduction(min:dmin) reduction(max:dmax) +#endif + for (size_t i = 0; i < datasize; ++i) + { + dmin = (dmin < data[i]) ? dmin : data[i]; + dmax = (dmax > data[i]) ? dmax : data[i]; + } + + *fmin = dmin; + *fmax = dmax; +} + +static +void minmax_val_double_simd(const double *restrict data, size_t datasize, double *fmin, double *fmax) +{ + double dmin = *fmin, dmax = *fmax; + +#ifdef _OPENMP +#pragma omp simd reduction(min:dmin) reduction(max:dmax) +#endif + for (size_t i = 0; i < datasize; ++i) + { + dmin = (dmin < data[i]) ? dmin : data[i]; + dmax = (dmax > data[i]) ? dmax : data[i]; + } + + *fmin = dmin; + *fmax = dmax; +} + +static +void minmax_val_float_simd(const float *restrict data, size_t datasize, float *fmin, float *fmax) +{ + float dmin = *fmin, dmax = *fmax; + +#if defined(_OPENMP) +#pragma omp simd reduction(min:dmin) reduction(max:dmax) +#endif + for (size_t i = 0; i < datasize; ++i) + { + dmin = (dmin < data[i]) ? dmin : data[i]; + dmax = (dmax > data[i]) ? dmax : data[i]; + } + + *fmin = dmin; + *fmax = dmax; +} +#if defined(GNUC_PUSH_POP) +#pragma GCC pop_options +#endif +#endif + +static +void minmax_val_double(const double *restrict data, long idatasize, double *fmin, double *fmax) +{ +#if defined(_GET_X86_COUNTER) || defined(_GET_MACH_COUNTER) + uint64_t start_minmax, end_minmax; +#endif + size_t datasize = (size_t)idatasize; + + if ( idatasize >= 1 ) ; else return; + +#if defined(_GET_X86_COUNTER) + start_minmax = _rdtsc(); +#endif +#if defined(_GET_MACH_COUNTER) + start_minmax = mach_absolute_time(); +#endif + +#if defined(_ENABLE_AVX) + + avx_minmax_val_double(data, datasize, fmin, fmax); + +#elif defined(_ENABLE_SSE2) + + sse2_minmax_val_double(data, datasize, fmin, fmax); + +#else + +#if defined(_ARCH_PWR6) +#define __UNROLL_DEPTH_1 6 + + // to allow pipelining we have to unroll + +#if defined(_GET_IBM_COUNTER) + hpmStart(1, "minmax fsel"); +#endif + + pwr6_minmax_val_double_unrolled6(data, datasize, fmin, fmax); + +#if defined(_GET_IBM_COUNTER) + hpmStop(1); +#endif + +#undef __UNROLL_DEPTH_1 + +#else // original loop + +#if defined(_GET_IBM_COUNTER) + hpmStart(1, "minmax base"); +#endif + + minmax_val_double_orig(data, datasize, fmin, fmax); + +#if defined(_GET_IBM_COUNTER) + hpmStop(1); +#endif + +#endif // _ARCH_PWR6 && original loop +#endif // SIMD + +#if defined(_GET_X86_COUNTER) || defined(_GET_MACH_COUNTER) +#if defined(_GET_X86_COUNTER) + end_minmax = _rdtsc(); +#endif +#if defined(_GET_MACH_COUNTER) + end_minmax = mach_absolute_time(); +#endif +#if defined(_ENABLE_AVX) + printf("AVX minmax cycles:: %" PRIu64 "\n", end_minmax-start_minmax); + fprintf (stderr, "AVX min: %lf max: %lf\n", *fmin, *fmax); +#elif defined(_ENABLE_SSE2) + printf("SSE2 minmax cycles:: %" PRIu64 "\n", end_minmax-start_minmax); + fprintf (stderr, "SSE2 min: %lf max: %lf\n", *fmin, *fmax); +#else + printf("loop minmax cycles:: %" PRIu64 "\n", end_minmax-start_minmax); + fprintf (stderr, "loop min: %lf max: %lf\n", *fmin, *fmax); +#endif +#endif + + return; +} + +#if defined(TEST_MINMAXVAL) + +#include <stdio.h> +#include <sys/time.h> + +static +double dtime() +{ + double tseconds = 0.0; + struct timeval mytime; + gettimeofday(&mytime, NULL); + tseconds = (double) (mytime.tv_sec + (double)mytime.tv_usec*1.0e-6); + return (tseconds); +} + +#define NRUN 10000 + +int main(void) +{ + long datasize = 1000000; + double t_begin, t_end; + + printf("datasize %ld\n", datasize); +#if defined(_OPENMP) + printf("_OPENMP=%d\n", _OPENMP); +#endif + +#if defined(__ICC) + printf("icc\n"); +#elif defined(__clang__) + printf("clang\n"); +#elif defined(__GNUC__) + printf("gcc\n"); +#endif + + { + float fmin, fmax; + float *data_sp = (float*) malloc(datasize*sizeof(float)); + + for (long i = 0; i < datasize/2; ++i) data_sp[i] = (float) (i); + for (long i = datasize/2; i < datasize; ++i) data_sp[i] = (float) (-datasize + i); + + printf("float:\n"); + + t_begin = dtime(); + for (int i = 0; i < NRUN; ++i) + { + fmin = fmax = data_sp[0]; + minmax_val_float(data_sp, datasize, &fmin, &fmax); + } + t_end = dtime(); + printf("minmax_val: fmin: %ld fmax: %ld time: %6.2fs\n", (long)fmin, (long) fmax, t_end-t_begin); + +#if defined(OMP_SIMD) + t_begin = dtime(); + for (int i = 0; i < NRUN; ++i) + { + fmin = fmax = data_sp[0]; + minmax_val_float_simd(data_sp, datasize, &fmin, &fmax); + } + t_end = dtime(); + printf("simd : fmin: %ld fmax: %ld time: %6.2fs\n", (long)fmin, (long) fmax, t_end-t_begin); +#endif + + free(data_sp); + } + + { + double fmin, fmax; + double *data_dp = (double*) malloc(datasize*sizeof(double)); + + // for (long i = datasize-1; i >= 0; --i) data[i] = (double) (-datasize/2 + i); + for (long i = 0; i < datasize/2; ++i) data_dp[i] = (double) (i); + for (long i = datasize/2; i < datasize; ++i) data_dp[i] = (double) (-datasize + i); + + printf("double:\n"); + + t_begin = dtime(); + for (int i = 0; i < NRUN; ++i) + { + fmin = fmax = data_dp[0]; + minmax_val_double(data_dp, datasize, &fmin, &fmax); + } + t_end = dtime(); + printf("minmax_val: fmin: %ld fmax: %ld time: %6.2fs\n", (long)fmin, (long) fmax, t_end-t_begin); + + t_begin = dtime(); + for (int i = 0; i < NRUN; ++i) + { + fmin = fmax = data_dp[0]; + minmax_val_double_orig(data_dp, datasize, &fmin, &fmax); + } + t_end = dtime(); + printf("orig : fmin: %ld fmax: %ld time: %6.2fs\n", (long)fmin, (long) fmax, t_end-t_begin); + +#if defined(OMP_SIMD) + t_begin = dtime(); + for (int i = 0; i < NRUN; ++i) + { + fmin = fmax = data_dp[0]; + minmax_val_double_simd(data_dp, datasize, &fmin, &fmax); + } + t_end = dtime(); + printf("simd : fmin: %ld fmax: %ld time: %6.2fs\n", (long)fmin, (long) fmax, t_end-t_begin); + + t_begin = dtime(); + for (int i = 0; i < NRUN; ++i) + { + fmin = fmax = data_dp[0]; + minmax_val_double_omp(data_dp, datasize, &fmin, &fmax); + } + t_end = dtime(); + printf("openmp %d : fmin: %ld fmax: %ld time: %6.2fs\n", omp_get_max_threads(), (long)fmin, (long) fmax, t_end-t_begin); +#endif + +#if defined(_ENABLE_AVX) + t_begin = dtime(); + for (int i = 0; i < NRUN; ++i) + { + fmin = fmax = data_dp[0]; + avx_minmax_val_double(data_dp, datasize, &fmin, &fmax); + } + t_end = dtime(); + printf("avx : fmin: %ld fmax: %ld time: %6.2fs\n", (long)fmin, (long) fmax, t_end-t_begin); +#elif defined(_ENABLE_SSE2) + t_begin = dtime(); + for (int i = 0; i < NRUN; ++i) + { + fmin = fmax = data_dp[0]; + sse2_minmax_val_double(data_dp, datasize, &fmin, &fmax); + } + t_end = dtime(); + printf("sse2 : fmin: %ld fmax: %ld time: %6.2fs\n", (long)fmin, (long) fmax, t_end-t_begin); +#endif +#if defined(_ARCH_PWR6) + t_begin = dtime(); + for (int i = 0; i < NRUN; ++i) + { + fmin = fmax = data_dp[0]; + pwr6_minmax_val_double_unrolled6(data_dp, datasize, &fmin, &fmax); + } + t_end = dtime(); + printf("pwr6u6 : fmin: %ld fmax: %ld time: %6.2fs\n", (long)fmin, (long) fmax, t_end-t_begin); +#endif + free(data_dp); + } + + return 0; +} +#endif // TEST_MINMAXVAL + +#undef DISABLE_SIMD_MINMAXVAL +#undef _ENABLE_AVX +#undef _ENABLE_SSE2 +#undef GNUC_PUSH_POP +/* +### new version with gribSwapByteOrder_uint16() +icc -g -Wall -O3 -march=native -std=c99 -qopt-report=5 -DTEST_ENCODE encode_array.c + result on hama2 (icc 16.0.2): + float: + orig: val1: 1 val2: 1 val3: 2 valn: 66 time: 1.8731s +unrolled: val1: 1 val2: 1 val3: 2 valn: 66 time: 2.0898s + double: + orig: val1: 1 val2: 1 val3: 2 valn: 66 time: 3.68089s +unrolled: val1: 1 val2: 1 val3: 2 valn: 66 time: 4.30798s + avx: val1: 1 val2: 1 val3: 2 valn: 66 time: 4.23864s + +gcc -g -Wall -O3 -march=native -Wa,-q -std=c99 -DTEST_ENCODE encode_array.c + result on hama2 (gcc 6.1.0): +float: + orig: val1: 1 val2: 1 val3: 2 valn: 66 time: 2.22871s +unrolled: val1: 1 val2: 1 val3: 2 valn: 66 time: 2.30281s +double: + orig: val1: 1 val2: 1 val3: 2 valn: 66 time: 4.2669s +unrolled: val1: 1 val2: 1 val3: 2 valn: 66 time: 4.81643s + avx: val1: 1 val2: 1 val3: 2 valn: 66 time: 3.98415s + +### +icc -g -Wall -O3 -march=native -std=c99 -qopt-report=5 -DTEST_ENCODE encode_array.c + result on hama2 (icc 16.0.0): + float: + orig: val1: 1 val2: 1 val3: 2 valn: 66 time: 9.10691s +unrolled: val1: 1 val2: 1 val3: 2 valn: 66 time: 8.63584s + double: + orig: val1: 1 val2: 1 val3: 2 valn: 66 time: 13.5768s +unrolled: val1: 1 val2: 1 val3: 2 valn: 66 time: 9.17742s + avx: val1: 1 val2: 1 val3: 2 valn: 66 time: 3.9488s + +gcc -g -Wall -O3 -std=c99 -DTEST_ENCODE encode_array.c + result on hama2 (gcc 5.2.0): + float: + orig: val1: 1 val2: 1 val3: 2 valn: 66 time: 5.32775s +unrolled: val1: 1 val2: 1 val3: 2 valn: 66 time: 7.87125s + double: + orig: val1: 1 val2: 1 val3: 2 valn: 66 time: 7.85873s +unrolled: val1: 1 val2: 1 val3: 2 valn: 66 time: 12.9979s + +### +gcc -g -Wall -O3 -march=native -std=c99 -DTEST_ENCODE encode_array.c + result on bailung (gcc 4.7): + orig : val1: 1 val2: 1 val3: 2 valn: 66 time: 8.4166s + sse41 : val1: 1 val2: 1 val3: 2 valn: 66 time: 7.1522s + +gcc -g -Wall -O3 -march=native -std=c99 -DTEST_ENCODE encode_array.c + result on thunder5 (gcc 4.7): + orig : val1: 1 val2: 1 val3: 2 valn: 66 time: 6.21976s + avx : val1: 1 val2: 1 val3: 2 valn: 66 time: 4.54485s + +icc -g -Wall -O3 -march=native -std=c99 -vec-report=1 -DTEST_ENCODE encode_array.c + result on thunder5 (icc 13.2): + orig : val1: 1 val2: 1 val3: 2 valn: 66 time: 14.6279s + avx : val1: 1 val2: 1 val3: 2 valn: 66 time: 4.9776s + +xlc_r -g -O3 -qhot -q64 -qarch=auto -qtune=auto -qreport -DTEST_ENCODE encode_array.c + result on blizzard (xlc 12): + orig : val1: 1 val2: 1 val3: 2 valn: 66 time: 132.25s + unrolled: val1: 1 val2: 1 val3: 2 valn: 66 time: 27.202s + orig : val1: 1 val2: 1 val3: 2 valn: 66 time: 106.627s // without -qhot + unrolled: val1: 1 val2: 1 val3: 2 valn: 66 time: 39.929s // without -qhot +*/ +#ifdef _ARCH_PWR6 +#pragma options nostrict +#endif + +#ifdef TEST_ENCODE +#include <stdio.h> +#include <stdlib.h> +#define GRIBPACK unsigned char + +#ifndef HOST_ENDIANNESS +#ifdef __cplusplus +static const uint32_t HOST_ENDIANNESS_temp[1] = { UINT32_C(0x00030201) }; +#define HOST_ENDIANNESS (((const unsigned char *)HOST_ENDIANNESS_temp)[0]) +#else +#define HOST_ENDIANNESS (((const unsigned char *)&(const uint32_t[1]){UINT32_C(0x00030201)})[0]) +#endif +#endif + +#define IS_BIGENDIAN() (HOST_ENDIANNESS == 0) +#define Error(x,y) +#endif + +//#undef _GET_X86_COUNTER +//#undef _GET_MACH_COUNTER +//#undef _GET_IBM_COUNTER +//#undef _ARCH_PWR6 + +#if defined _GET_IBM_COUNTER +#include <libhpc.h> +#elif defined _GET_X86_COUNTER +#include <x86intrin.h> +#elif defined _GET_MACH_COUNTER +#include <mach/mach_time.h> +#endif + +#include <stdint.h> +#include <math.h> + +#ifndef DISABLE_SIMD +#if defined(__GNUC__) && (__GNUC__ >= 4) +#elif defined(__ICC) && (__ICC >= 1100) +#elif defined(__clang__) +#else +#define DISABLE_SIMD +#endif +#endif + +#ifdef DISABLE_SIMD +#define DISABLE_SIMD_ENCODE +#endif + +//#define DISABLE_SIMD_ENCODE + +#ifdef DISABLE_SIMD_ENCODE +# ifdef ENABLE_AVX +# define _ENABLE_AVX +# endif +# ifdef ENABLE_SSE4_1 +# define _ENABLE_SSE4_1 +# endif +#endif + +#ifndef DISABLE_SIMD_ENCODE +# ifdef __AVX__ +# define _ENABLE_AVX +# endif +# ifdef __SSE4_1__ +# define _ENABLE_SSE4_1 +# endif +#endif + +#if defined _ENABLE_AVX +#include <immintrin.h> +#elif defined _ENABLE_SSE4_1 +#include <smmintrin.h> +#endif + +#if defined _ENABLE_AVX + +static +void avx_encode_array_2byte_double(size_t datasize, + unsigned char * restrict lGrib, + const double * restrict data, + double zref, double factor, size_t *gz) + __attribute__((optimize(2))); +static +void avx_encode_array_2byte_double(size_t datasize, + unsigned char * restrict lGrib, + const double * restrict data, + double zref, double factor, size_t *gz) +{ + const double *dval = data; + __m128i *sgrib = (__m128i *) (lGrib+(*gz)); + + const __m128i swap = _mm_set_epi8(14, 15, 12, 13, 10, 11, 8, 9, 6, 7, 4, 5, 2, 3, 0, 1); + + const __m256d c0 = _mm256_set1_pd(zref); + const __m256d c1 = _mm256_set1_pd(factor); + const __m256d c2 = _mm256_set1_pd(0.5); + + __m256d d0, d3, d2, d1; + __m128i i0, i1, i2, i3; + __m128i s0, s1; + + size_t residual = datasize % 16; + + size_t i; + for (i = 0; i < (datasize-residual); i += 16) + { + (void) _mm_prefetch((const char*)(dval+8), _MM_HINT_NTA); + //_____________________________________________________________________________ + + d0 = _mm256_loadu_pd (dval); + d0 = _mm256_sub_pd (d0, c0); + d0 = _mm256_mul_pd (d0, c1); + d0 = _mm256_add_pd (d0, c2); + + i0 = _mm256_cvttpd_epi32 (d0); + + //_____________________________________________________________________________ + + d1 = _mm256_loadu_pd (dval+4); + d1 = _mm256_sub_pd (d1, c0); + d1 = _mm256_mul_pd (d1, c1); + d1 = _mm256_add_pd (d1, c2); + + i1 = _mm256_cvttpd_epi32 (d1); + + //_____________________________________________________________________________ + + s0 = _mm_packus_epi32(i0, i1); + s0 = _mm_shuffle_epi8 (s0, swap); + (void) _mm_storeu_si128 (sgrib, s0); + + //_____________________________________________________________________________ + + (void) _mm_prefetch((const char*)(dval+16), _MM_HINT_NTA); + + //_____________________________________________________________________________ + + d2 = _mm256_loadu_pd (dval+8); + d2 = _mm256_sub_pd (d2, c0); + d2 = _mm256_mul_pd (d2, c1); + d2 = _mm256_add_pd (d2, c2); + + i2 = _mm256_cvttpd_epi32 (d2); + + //_____________________________________________________________________________ + + d3 = _mm256_loadu_pd (dval+12); + d3 = _mm256_sub_pd (d3, c0); + d3 = _mm256_mul_pd (d3, c1); + d3 = _mm256_add_pd (d3, c2); + + i3 = _mm256_cvttpd_epi32 (d3); + + //_____________________________________________________________________________ + + s1 = _mm_packus_epi32(i2, i3); + s1 = _mm_shuffle_epi8 (s1, swap); + (void) _mm_storeu_si128 (sgrib+1, s1); + + //_____________________________________________________________________________ + + dval += 16; + sgrib += 2; + } + + if (i != datasize) + { + uint16_t ui16; + for (size_t j = i; j < datasize; ++j) + { + ui16 = (uint16_t) ((data[j] - zref) * factor + 0.5); + lGrib[*gz+2*j ] = ui16 >> 8; + lGrib[*gz+2*j+1] = ui16; + } + } + + *gz += 2*datasize; + + return; +} + +#define grib_encode_array_2byte_double avx_encode_array_2byte_double + +#elif defined _ENABLE_SSE4_1 + +static +void sse41_encode_array_2byte_double(size_t datasize, + unsigned char * restrict lGrib, + const double * restrict data, + double zref, double factor, size_t *gz) +{ + const double *dval = data; + __m128i *sgrib = (__m128i *) (lGrib+(*gz)); + + const __m128i swap = _mm_set_epi8(14, 15, 12, 13, 10, 11, 8, 9, 6, 7, 4, 5, 2, 3, 0, 1); + + const __m128d c0 = _mm_set1_pd(zref); + const __m128d c1 = _mm_set1_pd(factor); + const __m128d c2 = _mm_set1_pd(0.5); + + __m128d d0, d4, d3, d2, d1; + __m128i i0, i1, i2, i3, i4; + __m128i s0, s1; + + size_t residual = datasize % 16; + + size_t i; + for (i = 0; i < (datasize-residual); i += 16) + { + (void) _mm_prefetch((const char*)(dval+8), _MM_HINT_NTA); + //_____________________________________________________________________________ + + d0 = _mm_loadu_pd (dval); + d0 = _mm_sub_pd (d0, c0); + d0 = _mm_mul_pd (d0, c1); + d0 = _mm_add_pd (d0, c2); + + d4 = _mm_loadu_pd (dval+2); + d4 = _mm_sub_pd (d4, c0); + d4 = _mm_mul_pd (d4, c1); + d4 = _mm_add_pd (d4, c2); + + i0 = _mm_cvttpd_epi32 (d0); + i4 = _mm_cvttpd_epi32 (d4); + i0 = _mm_unpacklo_epi64 (i0, i4); + + //_____________________________________________________________________________ + + d1 = _mm_loadu_pd (dval+4); + d1 = _mm_sub_pd (d1, c0); + d1 = _mm_mul_pd (d1, c1); + d1 = _mm_add_pd (d1, c2); + + d4 = _mm_loadu_pd (dval+6); + d4 = _mm_sub_pd (d4, c0); + d4 = _mm_mul_pd (d4, c1); + d4 = _mm_add_pd (d4, c2); + + i1 = _mm_cvttpd_epi32 (d1); + i4 = _mm_cvttpd_epi32 (d4); + i1 = _mm_unpacklo_epi64 (i1, i4); + + //_____________________________________________________________________________ + + s0 = _mm_packus_epi32(i0, i1); + s0 = _mm_shuffle_epi8 (s0, swap); + (void) _mm_storeu_si128 (sgrib, s0); + + //_____________________________________________________________________________ + + (void) _mm_prefetch((const char*)(dval+16), _MM_HINT_NTA); + + //_____________________________________________________________________________ + + d2 = _mm_loadu_pd (dval+8); + d2 = _mm_sub_pd (d2, c0); + d2 = _mm_mul_pd (d2, c1); + d2 = _mm_add_pd (d2, c2); + + d4 = _mm_loadu_pd (dval+10); + d4 = _mm_sub_pd (d4, c0); + d4 = _mm_mul_pd (d4, c1); + d4 = _mm_add_pd (d4, c2); + + i2 = _mm_cvttpd_epi32 (d2); + i4 = _mm_cvttpd_epi32 (d4); + i2 = _mm_unpacklo_epi64 (i2, i4); + + //_____________________________________________________________________________ + + d3 = _mm_loadu_pd (dval+12); + d3 = _mm_sub_pd (d3, c0); + d3 = _mm_mul_pd (d3, c1); + d3 = _mm_add_pd (d3, c2); + + d4 = _mm_loadu_pd (dval+14); + d4 = _mm_sub_pd (d4, c0); + d4 = _mm_mul_pd (d4, c1); + d4 = _mm_add_pd (d4, c2); + + i3 = _mm_cvttpd_epi32 (d3); + i4 = _mm_cvttpd_epi32 (d4); + i3 = _mm_unpacklo_epi64 (i3, i4); + + //_____________________________________________________________________________ + + s1 = _mm_packus_epi32(i2, i3); + s1 = _mm_shuffle_epi8 (s1, swap); + (void) _mm_storeu_si128 (sgrib+1, s1); + + //_____________________________________________________________________________ + + dval += 16; + sgrib += 2; + } + + if (i != datasize) + { + uint16_t ui16; + for (size_t j = i; j < datasize; ++j) + { + ui16 = (uint16_t) ((data[j] - zref) * factor + 0.5); + lGrib[*gz+2*j ] = ui16 >> 8; + lGrib[*gz+2*j+1] = ui16; + } + } + + *gz += 2*datasize; + + return; +} + +#define grib_encode_array_2byte_double sse41_encode_array_2byte_double + +#else + +#define grib_encode_array_2byte_double encode_array_2byte_double + +#endif // SIMD variants + + +#ifdef TEST_ENCODE + +#define CAT(X,Y) X##_##Y +#define TEMPLATE(X,Y) CAT(X,Y) + +#ifdef T +#undef T +#endif +#define T double + +#ifdef T +#undef T +#endif +#define T float + + +#include <sys/time.h> + +static +double dtime() +{ + double tseconds = 0.0; + struct timeval mytime; + gettimeofday(&mytime, NULL); + tseconds = (double) (mytime.tv_sec + (double)mytime.tv_usec*1.0e-6); + return (tseconds); +} + + +static +void pout(char *name, int s, unsigned char *lgrib, long datasize, double tt) +{ + printf("%8s: val1: %d val2: %d val3: %d valn: %d time: %gs\n", + name, (int) lgrib[s*1+1], (int) lgrib[s*2+1], (int) lgrib[s*3+1], (int) lgrib[2*datasize-1], tt); +} + +int main(void) +{ + enum { + datasize = 1000000, + NRUN = 10000, + }; + + double t_begin, t_end; + + float *dataf = (float*) malloc(datasize*sizeof(float)); + double *data = (double*) malloc(datasize*sizeof(double)); + unsigned char *lgrib = (unsigned char*) malloc(2*datasize*sizeof(unsigned char)); + + for (long i = 0; i < datasize; ++i) dataf[i] = (float) (-datasize/2 + i); + for (long i = 0; i < datasize; ++i) data[i] = (double) (-datasize/2 + i); + + int PackStart = 0; + int nbpv = 16; + double zref = data[0]; + size_t z; + double factor = 0.00390625; + int s = 256; + + if ( 0 ) + { + encode_array_float(0, 0, 0, NULL, NULL, 0, 0, NULL); + encode_array_double(0, 0, 0, NULL, NULL, 0, 0, NULL); + } + +#if defined(__ICC) + printf("icc\n"); +#elif defined(__clang__) + printf("clang\n"); +#elif defined(__GNUC__) + printf("gcc\n"); +#endif + + printf("float:\n"); + + t_begin = dtime(); + for (int i = 0; i < NRUN; ++i) + { + z = 0; + encode_array_2byte_float(datasize, lgrib, dataf, (float)zref, (float)factor, &z); + } + t_end = dtime(); + pout("orig", s, lgrib, datasize, t_end-t_begin); + + t_begin = dtime(); + for (int i = 0; i < NRUN; ++i) + { + z = 0; + encode_array_unrolled_float(nbpv, PackStart, datasize, lgrib, dataf, (float)zref, (float)factor, &z); + } + t_end = dtime(); + pout("unrolled", s, lgrib, datasize, t_end-t_begin); + + printf("double:\n"); + + t_begin = dtime(); + for (int i = 0; i < NRUN; ++i) + { + z = 0; + encode_array_2byte_double(datasize, lgrib, data, zref, factor, &z); + } + t_end = dtime(); + pout("orig", s, lgrib, datasize, t_end-t_begin); + + t_begin = dtime(); + for (int i = 0; i < NRUN; ++i) + { + z = 0; + encode_array_unrolled_double(nbpv, PackStart, datasize, lgrib, data, zref, factor, &z); + } + t_end = dtime(); + pout("unrolled", s, lgrib, datasize, t_end-t_begin); + +#if defined _ENABLE_AVX + t_begin = dtime(); + for (int i = 0; i < NRUN; ++i) + { + z = 0; + avx_encode_array_2byte_double(datasize, lgrib, data, zref, factor, &z); + } + t_end = dtime(); + pout("avx", s, lgrib, datasize, t_end-t_begin); +#elif defined _ENABLE_SSE4_1 + t_begin = dtime(); + for (int i = 0; i < NRUN; ++i) + { + z = 0; + sse41_encode_array_2byte_double(datasize, lgrib, data, zref, factor, &z); + } + t_end = dtime(); + pout("sse41", s, lgrib, datasize, t_end-t_begin); +#endif + + return 0; +} +#endif // TEST_ENCODE + +#undef DISABLE_SIMD_ENCODE +#undef _ENABLE_AVX +#undef _ENABLE_SSE4_1 + +void +confp3(double pval, int *kexp, int *kmant, int kbits, int kround) +{ + /* + + Purpose: + -------- + + Convert floating point number from machine + representation to GRIB representation. + + Input Parameters: + ----------------- + + pval - Floating point number to be converted. + kbits - Number of bits in computer word. + kround - Conversion type. + 0 , Closest number in GRIB format less than + original number. + 1 , Closest number in GRIB format to the + original number (equal to, greater than or + less than original number). + + Output Parameters: + ------------------ + + kexp - 8 Bit signed exponent. + kmant - 24 Bit mantissa. + + Method: + ------- + + Floating point number represented as 8 bit signed + exponent and 24 bit mantissa in integer values. + + Externals. + ---------- + + decfp2 - Decode from IBM floating point format. + + Reference: + ---------- + + WMO Manual on Codes re GRIB representation. + + Comments: + --------- + + Routine aborts if an invalid conversion type parameter + is used or if a 24 bit mantissa is not produced. + + Author: + ------- + + John Hennessy ECMWF 18.06.91 + + Modifications: + -------------- + + Uwe Schulzweida MPIfM 01/04/2001 + + Convert to C from EMOS library version 130 + + Uwe Schulzweida MPIfM 02/08/2002 + + - speed up by factor 1.6 on NEC SX6 + - replace 1.0 / pow(16.0, (double)(iexp - 70)) by rpow16m70tab[iexp] + */ + + // extern int CGRIBEX_Debug; + + /* ----------------------------------------------------------------- */ + /* Section 1 . Initialise */ + /* ----------------------------------------------------------------- */ + + // Check conversion type parameter. + + int iround = kround; + if (iround != 0 && iround != 1) + { + Error("Invalid conversion type = %d", iround); + + // If not aborting, arbitrarily set rounding to 'up'. + iround = 1; + } + + /* ----------------------------------------------------------------- */ + /* Section 2 . Convert value of zero. */ + /* ----------------------------------------------------------------- */ + + if (fabs(pval) <= 0) + { + *kexp = 0; + *kmant = 0; + goto LABEL900; + } + + /* ----------------------------------------------------------------- */ + /* Section 3 . Convert other values. */ + /* ----------------------------------------------------------------- */ + { + const double zeps = (kbits != 32) ? 1.0e-12 : 1.0e-8; + double zref = pval; + + // Sign of value. + const int isign = (zref >= 0.0) ? 0 : 128; + zref = fabs(zref); + + // Exponent. + int iexp = (int) (log(zref) / log(16.0) + 65.0 + zeps); + + // only ANSI C99 has log2 + // iexp = (int) (log2(zref) * 0.25 + 65.0 + zeps); + + if (iexp < 0) iexp = 0; + if (iexp > 127) iexp = 127; + + // double rpowref = zref / pow(16.0, (double)(iexp - 70)); + double rpowref = ldexp(zref, 4 * -(iexp - 70)); + + // Mantissa. + if (iround == 0) + { + /* Closest number in GRIB format less than original number. */ + /* Truncate for positive numbers. */ + /* Round up for negative numbers. */ + *kmant = (isign == 0) ? (int) rpowref : (int) lround(rpowref + 0.5); + } + else + { + /* Closest number in GRIB format to the original number */ + /* (equal to, greater than or less than original number). */ + *kmant = (int) lround(rpowref); + } + + /* Check that mantissa value does not exceed 24 bits. */ + /* If it does, adjust the exponent upwards and recalculate the mantissa. */ + /* 16777215 = 2**24 - 1 */ + if (*kmant > 16777215) + { + + LABEL350: + + ++iexp; + + // Check for exponent overflow during adjustment + if (iexp > 127) + { + Message("Exponent overflow"); + Message("Original number = %30.20f", pval); + Message("Sign = %3d, Exponent = %3d, Mantissa = %12d", isign, iexp, *kmant); + + Error("Exponent overflow"); + + // If not aborting, arbitrarily set value to zero + Message("Value arbitrarily set to zero."); + *kexp = 0; + *kmant = 0; + goto LABEL900; + } + + rpowref = ldexp(zref, 4 * -(iexp - 70)); + + if (iround == 0) + { + /* Closest number in GRIB format less than original number. */ + /* Truncate for positive numbers. */ + /* Round up for negative numbers. */ + *kmant = (isign == 0) ? (int) rpowref : (int) lround(rpowref + 0.5); + } + else + { + /* Closest number in GRIB format to the original number */ + /* (equal to, greater or less than original number). */ + *kmant = (int) lround(rpowref); + } + + // Repeat calculation (with modified exponent) if still have mantissa overflow. + if (*kmant > 16777215) goto LABEL350; + } + + // Add sign bit to exponent. + *kexp = iexp + isign; + } + + /* ----------------------------------------------------------------- */ + /* Section 9. Return */ + /* ----------------------------------------------------------------- */ + +LABEL900: + /* + if ( CGRIBEX_Debug ) + { + double zval; + + Message("Conversion type parameter = %4d", kround); + Message("Original number = %30.20f", pval); + + zval = decfp2(*kexp, *kmant); + + Message("Converted to %30.20f", zval); + Message("Sign = %3d, Exponent = %3d, Mantissa = %12d", isign, iexp, *kmant); + } + */ + return; +} /* confp3 */ +#include <math.h> + + +double decfp2(int kexp, int kmant) +{ + /* + + Purpose: + -------- + + Convert GRIB representation of a floating point + number to machine representation. + + Input Parameters: + ----------------- + + kexp - 8 Bit signed exponent. + kmant - 24 Bit mantissa. + + Output Parameters: + ------------------ + + Return value - Floating point number represented + by kexp and kmant. + + Method: + ------- + + Floating point number represented as 8 bit exponent + and 24 bit mantissa in integer values converted to + machine floating point format. + + Externals: + ---------- + + None. + + Reference: + ---------- + + WMO Manual on Codes re GRIB representation. + + Comments: + --------- + + Rewritten from DECFP, to conform to programming standards. + Sign bit on 0 value now ignored, if present. + If using 32 bit reals, check power of 16 is not so small as to + cause overflows (underflows!); this causes warning to be given + on Fujitsus. + + Author: + ------- + + John Hennessy ECMWF 18.06.91 + + Modifications: + -------------- + + Uwe Schulzweida MPIfM 01/04/2001 + + - Convert to C from EMOS library version 130 + + Uwe Schulzweida MPIfM 02/08/2002 + + - speed up by factor 2 on NEC SX6 + - replace pow(2.0, -24.0) by constant POW_2_M24 + - replace pow(16.0, (double)(iexp - 64)) by pow16m64tab[iexp] + */ + + /* ----------------------------------------------------------------- */ + /* Section 1 . Convert value of 0.0. Ignore sign bit. */ + /* ----------------------------------------------------------------- */ + + if ( (kexp == 128) || (kexp == 0) || (kexp == 255) ) return 0.0; + + /* ----------------------------------------------------------------- */ + /* Section 2 . Convert other values. */ + /* ----------------------------------------------------------------- */ + + /* Sign of value. */ + + int iexp = kexp; + const int isign = (iexp < 128) * 2 - 1; + + iexp -= iexp < 128 ? 0 : 128; + + /* Decode value. */ + + /* pval = isign * pow(2.0, -24.0) * kmant * pow(16.0, (double)(iexp - 64)); */ + + iexp -= 64; + + const double pval = ldexp(1.0, 4 * iexp) * isign * POW_2_M24 * kmant; + + /* ----------------------------------------------------------------- */ + /* Section 9. Return to calling routine. */ + /* ----------------------------------------------------------------- */ + + return pval; +} /* decfp2 */ +#include <stdarg.h> +#include <stdint.h> + + +static +void gribDecodeRefDate(const int *isec1, int *year, int *month, int *day) +{ + int ryear = ISEC1_Year; + + int century = ISEC1_Century; + if (century < 0) century = -century; + century -= 1; + + if (century == -255 && ryear == 127) + { + ryear = 0; + } + else + { + // if ( century != 0 ) + { + if ( ryear == 100 ) + { + ryear = 0; + century += 1; + } + + if ( ryear != 255 ) + { + ryear = century*100 + ryear; + if ( ISEC1_Century < 0 ) ryear = -ryear; + } + else + { + ryear = 1; + } + } + } + + *year = ryear; + *month = ISEC1_Month; + *day = ISEC1_Day; +} + + +int gribRefDate(const int *isec1) +{ + int ryear, rmonth, rday; + gribDecodeRefDate(isec1, &ryear, &rmonth, &rday); + return cdiEncodeDate(ryear, rmonth, rday); +} + +static +void gribDecodeRefTime(const int *isec1, int *hour, int *minute, int *second) +{ + *hour = ISEC1_Hour; + *minute = ISEC1_Minute; + *second = 0; +} + + +int gribRefTime(const int *isec1) +{ + int rhour, rminute, rsecond; + gribDecodeRefTime(isec1, &rhour, &rminute, &rsecond); + return cdiEncodeTime(rhour, rminute, rsecond); +} + + +bool gribTimeIsFC(const int *isec1) +{ + bool isFC = false; + + const int time_period = (ISEC1_TimeRange == 10) ? (ISEC1_TimePeriod1<<8) + ISEC1_TimePeriod2 : ISEC1_TimePeriod1; + + if (time_period > 0 && ISEC1_Day > 0) + { + isFC = (ISEC1_TimeRange == 0 || ISEC1_TimeRange == 10); + } + + return isFC; +} + +static +int getTimeUnitFactor(int timeUnit) +{ + static bool lprint = true; + switch ( timeUnit ) + { + case ISEC1_TABLE4_MINUTE: return 60; break; + case ISEC1_TABLE4_QUARTER: return 900; break; + case ISEC1_TABLE4_30MINUTES: return 1800; break; + case ISEC1_TABLE4_HOUR: return 3600; break; + case ISEC1_TABLE4_3HOURS: return 10800; break; + case ISEC1_TABLE4_6HOURS: return 21600; break; + case ISEC1_TABLE4_12HOURS: return 43200; break; + case ISEC1_TABLE4_DAY: return 86400; break; + default: + if ( lprint ) + { + gprintf(__func__, "Time unit %d unsupported", timeUnit); + lprint = false; + } + break; + } + + return 0; +} + + +void gribDateTimeX(int *isec1, int *date, int *time, int *startDate, int *startTime) +{ + *startDate = 0; + *startTime = 0; + + CdiDateTime rDateTime = cdiDateTime_set(gribRefDate(isec1), gribRefTime(isec1)); + + int64_t time_period = 0, time_period_x = 0; + if (ISEC1_TimeRange == 10) + time_period = (ISEC1_TimePeriod1<<8) + ISEC1_TimePeriod2; + else if (ISEC1_TimeRange >=2 && ISEC1_TimeRange <= 5) + { + time_period_x = ISEC1_TimePeriod1; + time_period = ISEC1_TimePeriod2; + } + else if (ISEC1_TimeRange == 0) + time_period = ISEC1_TimePeriod1; + + if (time_period > 0 && rDateTime.date.day > 0) + { + JulianDate julianDate = julianDate_encode(CGRIBEX_grib_calendar, rDateTime); + + const int timeUnitFactor = getTimeUnitFactor(ISEC1_TimeUnit); + + if (time_period_x > 0) + { + JulianDate julianDate2 = julianDate_add_seconds(julianDate, timeUnitFactor * time_period_x); + CdiDateTime sDateTime = julianDate_decode(CGRIBEX_grib_calendar, julianDate2); + sDateTime.time.second = 0; + *startDate = (int)cdiDate_get(sDateTime.date); + *startTime = cdiTime_get(sDateTime.time); + } + + julianDate = julianDate_add_seconds(julianDate, timeUnitFactor * time_period); + rDateTime = julianDate_decode(CGRIBEX_grib_calendar, julianDate); + } + + *date = (int)cdiDate_get(rDateTime.date); + *time = cdiTime_get(rDateTime.time); +} + + +void gribDateTime(int *isec1, int *date, int *time) +{ + int sdate, stime; + gribDateTimeX(isec1, date, time, &sdate, &stime); +} + + +void gprintf(const char *caller, const char *fmt, ...) +{ + va_list args; + + if ( grprsm == NULL ) Error("GRIBEX initialization missing!"); + + va_start(args, fmt); + + fprintf(grprsm, "%-18s : ", caller); + vfprintf(grprsm, fmt, args); + fputs("\n", grprsm); + + va_end(args); +} + + +void +gribExDP(int *isec0, int *isec1, int *isec2, double *fsec2, int *isec3, + double *fsec3, int *isec4, double *fsec4, int klenp, int *kgrib, + int kleng, int *kword, const char *hoper, int *kret) +{ + int yfunc = *hoper; + + if ( yfunc == 'C' ) + { + grib_encode_double(isec0, isec1, isec2, fsec2, isec3, + fsec3, isec4, fsec4, klenp, kgrib, + kleng, kword, yfunc, kret); + } + else if ( yfunc == 'D' || yfunc == 'J' || yfunc == 'R' ) + { + grib_decode_double(isec0, isec1, isec2, fsec2, isec3, + fsec3, isec4, fsec4, klenp, kgrib, + kleng, kword, yfunc, kret); + } + else if ( yfunc == 'V' ) + { + fprintf(stderr, " cgribex: Version is %s\n", cgribexLibraryVersion()); + } + else + { + Error("oper %c unsupported!", yfunc); + *kret=-9; + } +} + + +void +gribExSP(int *isec0, int *isec1, int *isec2, float *fsec2, int *isec3, + float *fsec3, int *isec4, float *fsec4, int klenp, int *kgrib, + int kleng, int *kword, const char *hoper, int *kret) +{ + int yfunc = *hoper; + + if ( yfunc == 'C' ) + { + grib_encode_float(isec0, isec1, isec2, fsec2, isec3, + fsec3, isec4, fsec4, klenp, kgrib, + kleng, kword, yfunc, kret); + } + else if ( yfunc == 'D' || yfunc == 'J' || yfunc == 'R' ) + { + grib_decode_float(isec0, isec1, isec2, fsec2, isec3, + fsec3, isec4, fsec4, klenp, kgrib, + kleng, kword, yfunc, kret); + } + else if ( yfunc == 'V' ) + { + fprintf(stderr, " cgribex: Version is %s\n", cgribexLibraryVersion()); + } + else + { + Error("oper %c unsupported!", yfunc); + *kret=-9; + } +} + +int CGRIBEX_Fix_ZSE = 0; /* 1: Fix ZeroShiftError of simple packed spherical harmonics */ +int CGRIBEX_Const = 0; /* 1: Don't pack constant fields on regular grids */ +int CGRIBEX_Debug = 0; /* 1: Debugging */ + +void +gribSetDebug(int debug) +{ + CGRIBEX_Debug = debug; + + if (CGRIBEX_Debug) Message("debug level %d", debug); +} + +void +gribFixZSE(int flag) +{ + CGRIBEX_Fix_ZSE = flag; + + if (CGRIBEX_Debug) Message("Fix ZeroShiftError set to %d", flag); +} + +void +gribSetConst(int flag) +{ + CGRIBEX_Const = flag; + + if (CGRIBEX_Debug) Message("Const set to %d", flag); +} + +void +gribSetRound(int round) +{ + UNUSED(round); +} + +void +gribSetRefDP(double refval) +{ + UNUSED(refval); +} + +void +gribSetRefSP(float refval) +{ + gribSetRefDP((double) refval); +} + +void +gribSetValueCheck(int vcheck) +{ + UNUSED(vcheck); +} +#include <string.h> +#include <math.h> + + + +void gribPrintSec0(int *isec0) +{ + /* + + Print the information in the Indicator + Section (Section 0) of decoded GRIB data. + + Input Parameters: + + isec0 - Array of decoded integers from Section 0 + + + Converted from EMOS routine GRPRS0. + + Uwe Schulzweida MPIfM 01/04/2001 + + */ + + grsdef(); + + fprintf(grprsm, " \n"); + fprintf(grprsm, " Section 0 - Indicator Section. \n"); + fprintf(grprsm, " -------------------------------------\n"); + fprintf(grprsm, " Length of GRIB message (octets). %9d\n", ISEC0_GRIB_Len); + fprintf(grprsm, " GRIB Edition Number. %9d\n", ISEC0_GRIB_Version); +} + +void gribPrintSec1(int *isec0, int *isec1) +{ + /* + + Print the information in the Product Definition + Section (Section 1) of decoded GRIB data. + + Input Parameters: + + isec0 - Array of decoded integers from Section 0 + + isec1 - Array of decoded integers from Section 1 + + Comments: + + When decoding data from Experimental Edition or Edition 0, + routine GRIBEX adds the additional fields available in + Edition 1. + + + Converted from EMOS routine GRPRS1. + + Uwe Schulzweida MPIfM 01/04/2001 + + */ + + int iprev, icurr, ioffset; + int ibit, ierr, iout, iyear; + int jiloop; + float value; + + char hversion[9]; + /* + char hfirst[121], hsecond[121], hthird[121], hfourth[121]; + */ + + grsdef(); + + /* + ----------------------------------------------------------------- + Section 0 . Print required information. + ----------------------------------------------------------------- + */ + + fprintf(grprsm, " \n"); + fprintf(grprsm, " Section 1 - Product Definition Section.\n"); + fprintf(grprsm, " ---------------------------------------\n"); + + fprintf(grprsm, " Code Table 2 Version Number. %9d\n", isec1[0]); + fprintf(grprsm, " Originating centre identifier. %9d\n", isec1[1]); + fprintf(grprsm, " Model identification. %9d\n", isec1[2]); + fprintf(grprsm, " Grid definition. %9d\n", isec1[3]); + + ibit = 8; + prtbin(isec1[4], ibit, &iout, &ierr); + fprintf(grprsm, " Flag (Code Table 1) %8.8d\n", iout); + fprintf(grprsm, " Parameter identifier (Code Table 2). %9d\n", isec1[5]); + + /* + IERR = CHKTAB2(ISEC1,HFIRST,HSECOND,HTHIRD,HFOURTH) + IF( IERR .EQ. 0 ) THEN + DO JLOOP = 121, 1, -1 + IF( HSECOND(JLOOP:JLOOP).NE.' ' ) THEN + IOFFSET = JLOOP + GOTO 110 + ENDIF + ENDDO + GOTO 120 + 110 CONTINUE + WRITE(*,'(2H ",A,1H")') HSECOND(1:IOFFSET) + 120 CONTINUE + ENDIF + */ + + if ( isec1[5] != 127 ) + { + fprintf(grprsm, " Type of level (Code Table 3). %9d\n", isec1[6]); + fprintf(grprsm, " Value 1 of level (Code Table 3). %9d\n", isec1[7]); + fprintf(grprsm, " Value 2 of level (Code Table 3). %9d\n", isec1[8]); + } + else + { + fprintf(grprsm, " Satellite identifier. %9d\n", isec1[6]); + fprintf(grprsm, " Spectral band. %9d\n", isec1[7]); + } + + iyear = isec1[9]; + if ( iyear != 255 ) + { + int date, time; + /* iyear = ((isec1[20]-1)*100 + isec1[9]); */ + gribDateTime(isec1, &date, &time); + iyear = date/10000; + fprintf(grprsm, " Year of reference time of data. %9d (%4d)\n", isec1[9], iyear); + } + else + { + fprintf(grprsm, " Year of reference time of data MISSING (=255)\n"); + } + + fprintf(grprsm, " Month of reference time of data. %9d\n", isec1[10]); + fprintf(grprsm, " Day of reference time of data. %9d\n", isec1[11]); + fprintf(grprsm, " Hour of reference time of data. %9d\n", isec1[12]); + fprintf(grprsm, " Minute of reference time of data. %9d\n", isec1[13]); + fprintf(grprsm, " Time unit (Code Table 4). %9d\n", isec1[14]); + fprintf(grprsm, " Time range one. %9d\n", isec1[15]); + fprintf(grprsm, " Time range two. %9d\n", isec1[16]); + fprintf(grprsm, " Time range indicator (Code Table 5) %9d\n", isec1[17]); + fprintf(grprsm, " Number averaged. %9d\n", isec1[18]); + fprintf(grprsm, " Number missing from average. %9d\n", isec1[19]); + /* + All ECMWF data in GRIB Editions before Edition 1 is decoded + as 20th century data. Other centres are decoded as missing. + */ + if ( isec0[1] < 1 && isec1[1] != 98 ) + fprintf(grprsm, " Century of reference time of data. Not given\n"); + else + fprintf(grprsm, " Century of reference time of data. %9d\n", isec1[20]); + + /* Print sub-centre */ + fprintf(grprsm, " Sub-centre identifier. %9d\n", ISEC1_SubCenterID); + + /* Decimal scale factor */ + fprintf(grprsm, " Units decimal scaling factor. %9d\n", isec1[22]); + + /* + ----------------------------------------------------------------- + Section 1 . Print local DWD information. + ----------------------------------------------------------------- + */ + if ( (ISEC1_CenterID == 78 || ISEC1_CenterID == 215 || ISEC1_CenterID == 250) && + (isec1[36] == 253 || isec1[36] == 254) ) + { + fprintf(grprsm, " DWD local usage identifier. %9d\n", isec1[36]); + if ( isec1[36] == 253 ) + fprintf(grprsm, " (Database labelling and ensemble forecast)\n"); + if ( isec1[36] == 254 ) + fprintf(grprsm, " (Database labelling)\n"); + + fprintf(grprsm, " Year of database entry %3d (%4d)\n", isec1[43], 1900+isec1[43]); + fprintf(grprsm, " Month of database entry %3d\n", isec1[44]); + fprintf(grprsm, " Day of database entry %3d\n", isec1[45]); + fprintf(grprsm, " Hour of database entry %3d\n", isec1[46]); + fprintf(grprsm, " Minute of database entry %3d\n", isec1[47]); + fprintf(grprsm, " DWD experiment number %9d\n",isec1[48]); + fprintf(grprsm, " DWD run type %9d\n",isec1[49]); + if ( isec1[36] == 253 ) + { + fprintf(grprsm, " User id %9d\n",isec1[50]); + fprintf(grprsm, " Experiment identifier %9d\n",isec1[51]); + fprintf(grprsm, " Ensemble identification type %9d\n",isec1[52]); + fprintf(grprsm, " Number of ensemble members %9d\n",isec1[53]); + fprintf(grprsm, " Actual number of ensemble member %9d\n",isec1[54]); + fprintf(grprsm, " Model version %2d.%2.2d\n",isec1[55],isec1[56]); + } + } + + /* + ----------------------------------------------------------------- + Section 2 . Print local ECMWF information. + ----------------------------------------------------------------- + */ + /* + Regular MARS labelling, or reformatted Washington EPS products. + */ + if ( (ISEC1_CenterID == 98 && ISEC1_LocalFLag == 1) || + (ISEC1_SubCenterID == 98 && ISEC1_LocalFLag == 1) || + (ISEC1_CenterID == 7 && ISEC1_SubCenterID == 98) ) + { + /* Parameters common to all definitions. */ + + fprintf(grprsm, " ECMWF local usage identifier. %9d\n", isec1[36]); + if ( isec1[36] == 1 ) + fprintf(grprsm, " (Mars labelling or ensemble forecast)\n"); + if ( isec1[36] == 2 ) + fprintf(grprsm, " (Cluster means and standard deviations)\n"); + if ( isec1[36] == 3 ) + fprintf(grprsm, " (Satellite image data)\n"); + if ( isec1[36] == 4 ) + fprintf(grprsm, " (Ocean model data)\n"); + if ( isec1[36] == 5 ) + fprintf(grprsm, " (Forecast probability data)\n"); + if ( isec1[36] == 6 ) + fprintf(grprsm, " (Surface temperature data)\n"); + if ( isec1[36] == 7 ) + fprintf(grprsm, " (Sensitivity data)\n"); + if ( isec1[36] == 8 ) + fprintf(grprsm, " (ECMWF re-analysis data)\n"); + if ( isec1[36] == 9 ) + fprintf(grprsm, " (Singular vectors and ensemble perturbations)\n"); + if ( isec1[36] == 10 ) + fprintf(grprsm, " (EPS tubes)\n"); + if ( isec1[36] == 11 ) + fprintf(grprsm, " (Supplementary data used by analysis)\n"); + if ( isec1[36] == 13 ) + fprintf(grprsm, " (Wave 2D spectra direction and frequency)\n"); + + fprintf(grprsm, " Class. %9d\n", isec1[37]); + fprintf(grprsm, " Type. %9d\n", isec1[38]); + fprintf(grprsm, " Stream. %9d\n", isec1[39]); + sprintf(hversion, "%4s", (char*)&isec1[40]); hversion[4] = 0; + fprintf(grprsm, " Version number or Experiment identifier. %4s\n", hversion); + /* + ECMWF Local definition 1. + (MARS labelling or ensemble forecast data) + */ + if ( isec1[36] == 1 ) + { + fprintf(grprsm, " Forecast number. %9d\n", isec1[41]); + if ( isec1[39] != 1090 ) + fprintf(grprsm, " Total number of forecasts. %9d\n", isec1[42]); + + return; + } + /* + ECMWF Local definition 2. + (Cluster means and standard deviations) + */ + if ( isec1[36] == 2 ) + { + fprintf(grprsm, " Cluster number. %9d\n", isec1[41]); + fprintf(grprsm, " Total number of clusters. %9d\n", isec1[42]); + fprintf(grprsm, " Clustering method. %9d\n", isec1[43]); + fprintf(grprsm, " Start time step when clustering. %9d\n", isec1[44]); + fprintf(grprsm, " End time step when clustering. %9d\n", isec1[45]); + fprintf(grprsm, " Northern latitude of domain. %9d\n", isec1[46]); + fprintf(grprsm, " Western longitude of domain. %9d\n", isec1[47]); + fprintf(grprsm, " Southern latitude of domain. %9d\n", isec1[48]); + fprintf(grprsm, " Eastern longitude of domain. %9d\n", isec1[49]); + fprintf(grprsm, " Operational forecast in cluster %9d\n", isec1[50]); + fprintf(grprsm, " Control forecast in cluster %9d\n", isec1[51]); + fprintf(grprsm, " Number of forecasts in cluster. %9d\n", isec1[52]); + + for (int jloop = 0; jloop < isec1[52]; jloop++) + fprintf(grprsm, " Forecast number %9d\n", isec1[jloop+53]); + + return; + } + /* + ECMWF Local definition 3. + (Satellite image data) + */ + if ( isec1[36] == 3 ) + { + fprintf(grprsm, " Satellite spectral band. %9d\n", isec1[41]); + fprintf(grprsm, " Function code. %9d\n", isec1[42]); + return; + } + /* + ECMWF Local definition 4. + (Ocean model data) + */ + if ( isec1[36] == 4 ) + { + fprintf(grprsm, " Satellite spectral band. %9d\n", isec1[41]); + if ( isec1[39] != 1090 ) + fprintf(grprsm, " Function code. %9d\n", isec1[42]); + fprintf(grprsm, " Coordinate structure definition.\n"); + fprintf(grprsm, " Fundamental spatial reference system.%9d\n", isec1[43]); + fprintf(grprsm, " Fundamental time reference. %9d\n", isec1[44]); + fprintf(grprsm, " Space unit flag. %9d\n", isec1[45]); + fprintf(grprsm, " Vertical coordinate definition. %9d\n", isec1[46]); + fprintf(grprsm, " Horizontal coordinate definition. %9d\n", isec1[47]); + fprintf(grprsm, " Time unit flag. %9d\n", isec1[48]); + fprintf(grprsm, " Time coordinate definition. %9d\n", isec1[49]); + fprintf(grprsm, " Position definition. \n"); + fprintf(grprsm, " Mixed coordinate field flag. %9d\n", isec1[50]); + fprintf(grprsm, " Coordinate 1 flag. %9d\n", isec1[51]); + fprintf(grprsm, " Averaging flag. %9d\n", isec1[52]); + fprintf(grprsm, " Position of level 1. %9d\n", isec1[53]); + fprintf(grprsm, " Position of level 2. %9d\n", isec1[54]); + fprintf(grprsm, " Coordinate 2 flag. %9d\n", isec1[55]); + fprintf(grprsm, " Averaging flag. %9d\n", isec1[56]); + fprintf(grprsm, " Position of level 1. %9d\n", isec1[57]); + fprintf(grprsm, " Position of level 2. %9d\n", isec1[58]); + fprintf(grprsm, " Grid Definition.\n"); + fprintf(grprsm, " Coordinate 3 flag (x-axis) %9d\n", isec1[59]); + fprintf(grprsm, " Coordinate 4 flag (y-axis) %9d\n", isec1[60]); + fprintf(grprsm, " Coordinate 4 of first grid point. %9d\n", isec1[61]); + fprintf(grprsm, " Coordinate 3 of first grid point. %9d\n", isec1[62]); + fprintf(grprsm, " Coordinate 4 of last grid point. %9d\n", isec1[63]); + fprintf(grprsm, " Coordinate 3 of last grid point. %9d\n", isec1[64]); + fprintf(grprsm, " i - increment. %9d\n", isec1[65]); + fprintf(grprsm, " j - increment. %9d\n", isec1[66]); + fprintf(grprsm, " Flag for irregular grid coordinates. %9d\n", isec1[67]); + fprintf(grprsm, " Flag for normal or staggered grids. %9d\n", isec1[68]); + fprintf(grprsm, " Further information.\n"); + fprintf(grprsm, " Further information flag. %9d\n", isec1[69]); + fprintf(grprsm, " Auxiliary information.\n"); + fprintf(grprsm, " No. entries in horizontal coordinate %9d\n", isec1[70]); + fprintf(grprsm, " No. entries in mixed coordinate defn.%9d\n", isec1[71]); + fprintf(grprsm, " No. entries in grid coordinate list. %9d\n", isec1[72]); + fprintf(grprsm, " No. entries in auxiliary array. %9d\n", isec1[73]); + /* + Horizontal coordinate supplement. + */ + fprintf(grprsm, " Horizontal coordinate supplement.\n"); + if ( isec1[70] == 0 ) + { + fprintf(grprsm, "(None).\n"); + } + else + { + fprintf(grprsm, "Number of items = %d\n", isec1[70]); + for (int jloop = 0; jloop < isec1[70]; jloop++) + fprintf(grprsm, " %12d\n", isec1[74+jloop]); + } + /* + Mixed coordinate definition. + */ + fprintf(grprsm, " Mixed coordinate definition.\n"); + if ( isec1[71] == 0 ) + { + fprintf(grprsm, "(None).\n"); + } + else + { + fprintf(grprsm, "Number of items = %d\n", isec1[71]); + ioffset = 74 + isec1[70]; + for (int jloop = 0; jloop < isec1[71]; jloop++) + fprintf(grprsm, " %12d\n", isec1[ioffset+jloop]); + } + /* + Grid coordinate list. + */ + fprintf(grprsm, " Grid coordinate list. \n"); + if ( isec1[72] == 0 ) + { + fprintf(grprsm, "(None).\n"); + } + else + { + fprintf(grprsm, "Number of items = %d\n", isec1[72]); + ioffset = 74 + isec1[70] + isec1[71]; + for (int jloop = 0; jloop < isec1[72]; jloop++) + fprintf(grprsm, " %12d\n", isec1[ioffset+jloop]); + } + /* + Auxiliary array. + */ + fprintf(grprsm, " Auxiliary array. \n"); + if ( isec1[73] == 0 ) + { + fprintf(grprsm, "(None).\n"); + } + else + { + fprintf(grprsm, "Number of items = %d\n", isec1[73]); + ioffset = 74 + isec1[70] + isec1[71] + isec1[72]; + for (int jloop = 0; jloop < isec1[73]; jloop++) + fprintf(grprsm, " %12d\n", isec1[ioffset+jloop]); + } + /* + Post-auxiliary array. + */ + fprintf(grprsm, " Post-auxiliary array. \n"); + ioffset = 74 + isec1[70] + isec1[71] + isec1[72] + isec1[73]; + if ( isec1[ioffset] == 0 ) + { + fprintf(grprsm, "(None).\n"); + } + else + { + fprintf(grprsm, "Number of items = %d\n", isec1[ioffset]); + for (int jloop = 1; jloop < isec1[ioffset]; jloop++) + fprintf(grprsm, " %12d\n", isec1[ioffset+jloop]); + } + + return; + } + /* + ECMWF Local definition 5. + (Forecast probability data) + */ + if ( isec1[36] == 5 ) + { + fprintf(grprsm, " Forecast probability number %9d\n", isec1[41]); + fprintf(grprsm, " Total number of forecast probabilities %7d\n", isec1[42]); + fprintf(grprsm, " Threshold units decimal scale factor %9d\n", isec1[43]); + fprintf(grprsm, " Threshold indicator(1=lower,2=upper,3=both) %2d\n", isec1[44]); + if ( isec1[44] != 2 ) + fprintf(grprsm, " Lower threshold value %9d\n", isec1[45]); + if ( isec1[44] != 1 ) + fprintf(grprsm, " Upper threshold value %9d\n", isec1[46]); + return; + } + /* + ECMWF Local definition 6. + (Surface temperature data) + */ + if ( isec1[36] == 6 ) + { + iyear = isec1[43]; + if ( iyear > 100 ) + { + if ( iyear < 19000000 ) iyear = iyear + 19000000; + fprintf(grprsm, " Date of SST field used %9d\n", iyear); + } + else + fprintf(grprsm, "Date of SST field used Not given\n"); + } + if ( isec1[44] == 0 ) + fprintf(grprsm, " Type of SST field (= climatology) %9d\n", isec1[44]); + if ( isec1[44] == 1 ) + fprintf(grprsm, " Type of SST field (= 1/1 degree) %9d\n", isec1[44]); + if ( isec1[44] == 2 ) + fprintf(grprsm, " Type of SST field (= 2/2 degree) %9d\n", isec1[44]); + + fprintf(grprsm, " Number of ICE fields used: %9d\n", isec1[45]); + + for (int jloop = 1; jloop <= isec1[45]; jloop++) + { + iyear = isec1[44+(jloop*2)]; + if ( iyear > 100 ) + { + if ( iyear < 19000000 ) iyear = iyear + 19000000; + fprintf(grprsm, " Date of ICE field%3d %9d\n", jloop, iyear); + fprintf(grprsm, " Satellite number (ICE field%3d) %9d\n", jloop, + isec1[45+(jloop*2)]); + } + else + fprintf(grprsm, "Date of SST field used Not given\n"); + } + /* + ECMWF Local definition 7. + (Sensitivity data) + */ + if ( isec1[36] == 7 ) + { + if ( isec1[38] == 51 ) + fprintf(grprsm, " Forecast number %9d\n", isec1[41]); + if ( isec1[38] != 51 ) + fprintf(grprsm, " Iteration number %9d\n", isec1[41]); + if ( isec1[38] != 52 ) + fprintf(grprsm, " Total number of diagnostics %9d\n", isec1[42]); + if ( isec1[38] == 52 ) + fprintf(grprsm, " No.interations in diag. minimisation %9d\n", isec1[42]); + fprintf(grprsm, " Domain(0=Global,1=Europe,2=N.Hem.,3=S.Hem.) %2d\n", isec1[43]); + fprintf(grprsm, " Diagnostic number %9d\n", isec1[44]); + } + /* + ECMWF Local definition 8. + (ECMWF re-analysis data) + */ + if ( isec1[36] == 8 ) + { + if ( (isec1[39] == 1043) || + (isec1[39] == 1070) || + (isec1[39] == 1071) ) + { + fprintf(grprsm, " Interval between reference times %9d\n", isec1[41]); + for (int jloop = 43; jloop <= 54; jloop++) + { + jiloop = jloop + 8; + fprintf(grprsm, " ERA section 1 octet %2d. %9d\n", + jiloop, isec1[jloop-1]); + } + } + else + { + for (int jloop = 42; jloop <= 54; jloop++) + { + jiloop = jloop + 8; + fprintf(grprsm, " ERA section 1 octet %2d. %9d\n", + jiloop, isec1[jloop-1]); + } + } + return; + } + + if ( isec1[38] > 4 && isec1[38] < 9 ) + { + fprintf(grprsm, " Simulation number. %9d\n", isec1[41]); + fprintf(grprsm, " Total number of simulations. %9d\n", isec1[42]); + } + /* + ECMWF Local definition 9. + (Singular vectors and ensemble perturbations) + */ + if ( isec1[36] == 9 ) + { + if ( isec1[38] == 60 ) + fprintf(grprsm, " Perturbed ensemble forecast number %9d\n", isec1[41]); + if ( isec1[38] == 61 ) + fprintf(grprsm, " Initial state perturbation number %9d\n", isec1[41]); + if ( isec1[38] == 62 ) + fprintf(grprsm, " Singular vector number %9d\n", isec1[41]); + if ( isec1[38] == 62 ) + { + fprintf(grprsm, " Number of iterations %9d\n", isec1[42]); + fprintf(grprsm, " Number of singular vectors computed %9d\n", isec1[43]); + fprintf(grprsm, " Norm used at initial time %9d\n", isec1[44]); + fprintf(grprsm, " Norm used at final time %9d\n", isec1[45]); + fprintf(grprsm, " Multiplication factor %9d\n", isec1[46]); + fprintf(grprsm, " Latitude of north-west corner %9d\n", isec1[47]); + fprintf(grprsm, " Longitude of north-west corner %9d\n", isec1[48]); + fprintf(grprsm, " Latitude of south-east corner %9d\n", isec1[49]); + fprintf(grprsm, " Longitude of south-east corner %9d\n", isec1[50]); + fprintf(grprsm, " Accuracy %9d\n", isec1[51]); + fprintf(grprsm, " Number of singular vectors evolved %9d\n", isec1[52]); + fprintf(grprsm, " Ritz number one %9d\n", isec1[53]); + fprintf(grprsm, " Ritz number two %9d\n", isec1[54]); + } + } + /* + ECMWF Local definition 10. + (EPS tubes) + */ + if ( isec1[36] == 10 ) + { + fprintf(grprsm, " Tube number %9d\n", isec1[41]); + fprintf(grprsm, " Total number of tubes %9d\n", isec1[42]); + fprintf(grprsm, " Central cluster definition %9d\n", isec1[43]); + fprintf(grprsm, " Parameter %9d\n", isec1[44]); + fprintf(grprsm, " Type of level %9d\n", isec1[45]); + fprintf(grprsm, " Northern latitude of domain of tubing%9d\n", isec1[46]); + fprintf(grprsm, " Western longitude of domain of tubing%9d\n", isec1[47]); + fprintf(grprsm, " Southern latitude of domain of tubing%9d\n", isec1[48]); + fprintf(grprsm, " Eastern longitude of domain of tubing%9d\n", isec1[49]); + fprintf(grprsm, " Tube number of operational forecast %9d\n", isec1[50]); + fprintf(grprsm, " Tube number of control forecast %9d\n", isec1[51]); + fprintf(grprsm, " Height/pressure of level %9d\n", isec1[52]); + fprintf(grprsm, " Reference step %9d\n", isec1[53]); + fprintf(grprsm, " Radius of central cluster %9d\n", isec1[54]); + fprintf(grprsm, " Ensemble standard deviation %9d\n", isec1[55]); + fprintf(grprsm, " Dist.of tube extreme to ensemble mean%9d\n", isec1[56]); + fprintf(grprsm, " Number of forecasts in the tube %9d\n", isec1[57]); + + fprintf(grprsm, " List of ensemble forecast numbers:\n"); + for (int jloop = 1; jloop <= isec1[57]; jloop++) + fprintf(grprsm, " %9d\n", isec1[57+jloop]); + } + /* + ECMWF Local definition 11. + (Supplementary data used by the analysis) + */ + if ( isec1[36] == 11 ) + { + fprintf(grprsm, " Details of analysis which used the supplementary data:\n"); + fprintf(grprsm, " Class %9d\n", isec1[41]); + fprintf(grprsm, " Type %9d\n", isec1[42]); + fprintf(grprsm, " Stream %9d\n", isec1[43]); + /* + sprintf(hversion, "%8d", isec1[44]); + fprintf(grprsm, " Version number/experiment identifier: %4s\n", &hversion[4]); + */ + iyear = isec1[45]; + if ( iyear > 50 ) + iyear = iyear + 1900; + else + iyear = iyear + 2000; + + fprintf(grprsm, " Year %9d\n", iyear); + fprintf(grprsm, " Month %9d\n", isec1[46]); + fprintf(grprsm, " Day %9d\n", isec1[47]); + fprintf(grprsm, " Hour %9d\n", isec1[48]); + fprintf(grprsm, " Minute %9d\n", isec1[49]); + fprintf(grprsm, " Century %9d\n", isec1[50]); + fprintf(grprsm, " Originating centre %9d\n", isec1[51]); + fprintf(grprsm, " Sub-centre %9d\n", isec1[52]); + } + /* + ECMWF Local definition 12. + */ + if ( isec1[36] == 12 ) + { + fprintf(grprsm, " (Mean, average, etc)\n"); + fprintf(grprsm, " Start date of the period %8d\n", isec1[41]); + fprintf(grprsm, " Start time of the period %4.4d\n", isec1[42]); + fprintf(grprsm, " Finish date of the period %8d\n", isec1[43]); + fprintf(grprsm, " Finish time of the period %4.4d\n", isec1[44]); + fprintf(grprsm, " Verifying date of the period %8d\n", isec1[45]); + fprintf(grprsm, " Verifying time of the period %4.4d\n", isec1[46]); + fprintf(grprsm, " Code showing method %8d\n", isec1[47]); + fprintf(grprsm, " Number of different time intervals used %5d\n", isec1[48]); + fprintf(grprsm, " List of different time intervals used:\n"); + iprev = isec1[49]; + unsigned icount = 0; + for (int jloop = 1; jloop <= isec1[48]; jloop++) + { + icurr = isec1[48+jloop]; + if ( icurr != iprev ) + { + if ( icount == 1 ) + fprintf(grprsm, " - interval %5.4d used once\n", iprev); + if ( icount == 2 ) + fprintf(grprsm, " - interval %5.4d used twice\n", iprev); + if ( icount > 2 ) + fprintf(grprsm, " - interval %5.4d used %5u times\n", iprev, icount); + iprev = icurr; + icount = 1; + } + else + icount = icount + 1; + } + if ( icount == 1 ) + fprintf(grprsm, " - interval %5.4d used once\n", iprev); + if ( icount == 2 ) + fprintf(grprsm, " - interval %5.4d used twice\n", iprev); + if ( icount > 2 ) + fprintf(grprsm, " - interval %5.4d used %5u times\n", iprev, icount); + } + /* + ECMWF Local definition 13. + (Wave 2D spectra direction and frequency) + */ + if ( isec1[36] == 13 ) + { + fprintf(grprsm, " Direction number %9d\n", isec1[43]); + fprintf(grprsm, " Frequency number %9d\n", isec1[44]); + fprintf(grprsm, " Total number of directions %9d\n", isec1[45]); + fprintf(grprsm, " Total number of frequencies %9d\n", isec1[46]); + fprintf(grprsm, " Scale factor applied to directions %9d\n", isec1[47]); + fprintf(grprsm, " Scale factor applied to frequencies %9d\n", isec1[48]); + fprintf(grprsm, " List of directions:\n"); + for (int jloop = 1; jloop <= isec1[45]; jloop++) + { + value = (float)(isec1[48+jloop])/(float)(isec1[47]); + if ( isec1[43] == jloop ) + fprintf(grprsm, " %2.2d:%15.7f <-- this field value\n", jloop, value); + else + fprintf(grprsm, "%2.2d:%15.7f\n", jloop, value); + } + fprintf(grprsm, " List of frequencies:\n"); + for (int jloop = 1; jloop <= isec1[46]; jloop++) + { + value = (float)(isec1[48+isec1[45]+jloop])/(float)(isec1[48]); + if ( isec1[44] == jloop ) + fprintf(grprsm, " %2.2d:%15.7f <-- this field value\n", jloop, value); + else + fprintf(grprsm, "%2.2d:%15.7f\n", jloop, value); + + if ( isec1[49+isec1[45]+isec1[46]] != 0 ) + { + fprintf(grprsm, " System number (65535 = missing) %9d\n", + isec1[49+isec1[45]+isec1[46]]); + fprintf(grprsm, " Method number (65535 = missing) %9d\n", + isec1[50+isec1[45]+isec1[46]]); + } + } + /* + ECMWF Local definition 14. + (Brightness temperature) + */ + if ( isec1[36] == 14 ) + { + fprintf(grprsm, " Channel number %9d\n", isec1[43]); + fprintf(grprsm, " Scale factor applied to frequencies %9d\n", isec1[44]); + fprintf(grprsm, " Total number of frequencies %9d\n", isec1[45]); + fprintf(grprsm, " List of frequencies:\n"); + for (int jloop = 1; jloop <= isec1[45]; jloop++) + { + value = (float)(isec1[45+jloop])/(float)(isec1[44]); + if ( isec1[43] == jloop ) + fprintf(grprsm, " %3d:%15.9f <-- this channel\n", jloop, value); + else + fprintf(grprsm, " %3d:%15.9f\n", jloop, value); + } + } + /* + ECMWF Local definition 15. + (Ocean ensemble seasonal forecast) + */ + if ( isec1[36] == 15 ) + { + fprintf(grprsm, " Ensemble member number %9d\n", isec1[41]); + fprintf(grprsm, " System number %9d\n", isec1[42]); + fprintf(grprsm, " Method number %9d\n", isec1[43]); + } + /* + ECMWF Local definition 16. + (Seasonal forecast monthly mean atmosphere data) + */ + if ( isec1[36] == 16 ) + { + fprintf(grprsm, " Ensemble member number %9d\n", isec1[41]); + fprintf(grprsm, " System number %9d\n", isec1[43]); + fprintf(grprsm, " Method number %9d\n", isec1[44]); + fprintf(grprsm, " Verifying month %9d\n", isec1[45]); + fprintf(grprsm, " Averaging period %9d\n", isec1[46]); + } + /* + ECMWF Local definition 17. + (Sst or sea-ice used by analysis) + */ + if ( isec1[36] == 17 ) + { + iyear = isec1[43]; + if ( iyear > 100 ) + { + if ( iyear < 19000000 ) iyear = iyear + 19000000; + fprintf(grprsm, " Date of sst/ice field used %9d\n", iyear); + } + else + fprintf(grprsm, " Date of sst/ice field used Not given\n"); + + if ( isec1[44] == 0 ) + fprintf(grprsm, " Type of sst/ice field (= climatology)%9d\n", isec1[44]); + if ( isec1[44] == 1 ) + fprintf(grprsm, " Type of sst/ice field (= 1/1 degree) %9d\n", isec1[44]); + if ( isec1[44] == 2 ) + fprintf(grprsm, " Type of sst/ice field (= 2/2 degree) %9d\n", isec1[44]); + + fprintf(grprsm, " Number of ICE fields used: %9d\n", isec1[45]); + + for (int jloop = 1; jloop < isec1[45]; jloop++) + { + iyear = isec1[44+(jloop*2)]; + if ( iyear > 100 ) + { + if ( iyear < 19000000 ) iyear = iyear + 19000000; + fprintf(grprsm, " Date of ICE field%3d %9d\n", jloop, + iyear); + fprintf(grprsm, " Satellite number (ICE field%3d) %9d\n", jloop, + isec1[45+(jloop*2)]); + } + else + fprintf(grprsm, "Date of sst/ice field used Not given\n"); + } + } + } + } + /* + ----------------------------------------------------------------- + Section 3 . Print Washington ensemble product information. + ----------------------------------------------------------------- + */ + /* + Washington EPS products (but not reformatted Washington EPS + products. + */ + if ( (isec1[1] == 7 && isec1[23] == 1) && (! (ISEC1_SubCenterID == 98)) ) + { + /* CALL KWPRS1 (iSEC0,iSEC1)*/ + } + /* + ----------------------------------------------------------------- + Section 4 . Print local MPIM information. + ----------------------------------------------------------------- + */ + if (isec1[ 1] == 252 && isec1[36] == 1) + { + fprintf(grprsm, " MPIM local usage identifier. %9d\n", isec1[36]); + fprintf(grprsm, " Type of ensemble forecast %9d\n", isec1[37]); + fprintf(grprsm, " Individual ensemble member %9d\n", isec1[38]); + fprintf(grprsm, " Number of forecasts in ensemble %9d\n", isec1[39]); + } +} + +static void printQuasi(int *isec2) +{ + /* + + Print the qusai-regular information in the Grid Description + Section (Section 2) of decoded GRIB data. + + Input Parameters: + + isec2 - Array of decoded integers from Section 2. + + Comments: + + Only data representation types catered for are Gaussian + grid, latitude/longitude grid, Spherical Harmonics, + Polar stereographic and Space view perspective. + + Converted from EMOS routine PTQUASI. + + Uwe Schulzweida MPIfM 01/04/2001 + + */ + + char yout[64]; + + /* + ----------------------------------------------------------------- + Section 1. Print quasi-grid data. + ----------------------------------------------------------------- + */ + // See if scanning is north->south or south->north + fprintf(grprsm, " Number of points along a parallel varies.\n"); + + int ntos = ( fmod((double) isec2[10], 128.) < 64 ); + + if ( ntos ) + fprintf(grprsm, " Number of points. Parallel. (North to South)\n"); + else + fprintf(grprsm, " Number of points. Parallel. (South to North)\n"); + + // Display number of points for each latitude + int latcnt = isec2[2]; + int nextlat = 0; + memset(yout, ' ', (size_t) 11); + + for (int j = 0; j < latcnt; ++j) + { + nextlat = nextlat + 1; + sprintf(yout, "%4d", nextlat); + + // Finished? + if ( nextlat > latcnt ) break; + if ( nextlat == latcnt ) + { + fprintf(grprsm, " %5d %-12s\n", isec2[nextlat+21], yout); + break; + } + // Look for neighbouring latitudes with same number of points + unsigned nrepeat = 0; + + LABEL110: + // If neighbouring latitudes have same number of points increase the repeat count. + if ( isec2[nextlat+21+1] == isec2[nextlat+21] ) + { + nrepeat = nrepeat + 1; + nextlat = nextlat + 1; + if ( nextlat < latcnt ) goto LABEL110; + } + // Display neighbouring latitudes with same number of points as 'nn to mm'. + if ( nrepeat >= 1 ) sprintf(yout+4, "to %5d", nextlat); + fprintf(grprsm, " %5d %-12s\n", isec2[nextlat+21], yout); + memset(yout, ' ', (size_t) 11); + } +} + +void gribPrintSec2DP(int *isec0, int *isec2, double *fsec2) +{ + /* + + Print the information in the Grid Description + Section (Section 2) of decoded GRIB data. + + Input Parameters: + + isec0 - Array of decoded integers from Section 0 + + isec2 - Array of decoded integers from Section 2 + + fsec2 - Array of decoded floats from Section 2 + + Comments: + + Only data representation types catered for are Gaussian + grid, latitude/longitude grid, Spherical Harmonics, + Polar stereographic and Space view perspective. + + + Converted from EMOS routine GRPRS2. + + Uwe Schulzweida MPIfM 01/04/2001 + + */ + + int ibit, iedit, ierr, iout, iresol; + + grsdef(); + /* + ----------------------------------------------------------------- + Section 1 . Print GRIB Edition number. + ----------------------------------------------------------------- + */ + iedit = isec0[1]; + fprintf(grprsm, " \n"); + fprintf(grprsm, " Section 2 - Grid Description Section.\n"); + fprintf(grprsm, " -------------------------------------\n"); + /* + ----------------------------------------------------------------- + Section 2 . Print spherical harmonic data. + ----------------------------------------------------------------- + */ + if ( isec2[0] == 50 || isec2[0] == 60 || + isec2[0] == 70 || isec2[0] == 80 ) + { + fprintf(grprsm, " Data represent type = spectral (Table 6) %9d\n", isec2[0]); + fprintf(grprsm, " J - Pentagonal resolution parameter. %9d\n", isec2[1]); + fprintf(grprsm, " K - Pentagonal resolution parameter. %9d\n", isec2[2]); + fprintf(grprsm, " M - Pentagonal resolution parameter. %9d\n", isec2[3]); + fprintf(grprsm, " Representation type (Table 9) %9d\n", isec2[4]); + fprintf(grprsm, " Representation mode (Table 10). %9d\n", isec2[5]); + for (int i = 7; i <= 11; ++i) + fprintf(grprsm, " Not used. %9d\n", isec2[i-1]); + fprintf(grprsm, " Number of vertical coordinate parameters. %9d\n", isec2[11]); + goto LABEL800; + } + /* + ----------------------------------------------------------------- + Section 3 . Print Gaussian grid data. + ----------------------------------------------------------------- + */ + if ( isec2[0] == 4 || isec2[0] == 14 || + isec2[0] == 24 || isec2[0] == 34 ) + { + fprintf(grprsm, " (Southern latitudes and Western longitudes are negative.)\n"); + fprintf(grprsm, " Data represent type = gaussian (Table 6) %9d\n", isec2[0]); + /* + Quasi-regular grids introduced in Edition 1. + */ + if ( isec2[16] == 0 || iedit < 1 ) + fprintf(grprsm, " Number of points along a parallel. %9d\n", isec2[1]); + else + printQuasi(isec2); + + fprintf(grprsm, " Number of points along a meridian. %9d\n", isec2[2]); + fprintf(grprsm, " Latitude of first grid point. %9d\n", isec2[3]); + fprintf(grprsm, " Longitude of first grid point. %9d\n", isec2[4]); + + ibit = 8; + iresol = isec2[5] + isec2[17] + isec2[18]; + prtbin(iresol, ibit, &iout, &ierr); + + fprintf(grprsm, " Resolution and components flag. %8.8d\n", iout); + fprintf(grprsm, " Latitude of last grid point. %9d\n", isec2[6]); + fprintf(grprsm, " Longitude of last grid point. %9d\n", isec2[7]); + /* + Print increment if given. + */ + if ( isec2[5] == 128 ) + fprintf(grprsm, " i direction (East-West) increment. %9d\n", isec2[8]); + else + fprintf(grprsm, " i direction (East-West) increment Not given\n"); + + fprintf(grprsm, " Number of parallels between pole and equator.%9d\n", isec2[9]); + + ibit = 8; + prtbin(isec2[10], ibit, &iout, &ierr); + + fprintf(grprsm, " Scanning mode flags (Code Table 8) %8.8d\n", iout); + fprintf(grprsm, " Number of vertical coordinate parameters. %9d\n", isec2[11]); + goto LABEL800; + } + /* + ----------------------------------------------------------------- + Section 4 . Print Latitude / longitude grid data. + ----------------------------------------------------------------- + */ + if ( isec2[0] == 0 || isec2[0] == 10 || + isec2[0] == 20 || isec2[0] == 30 ) + { + fprintf(grprsm, " (Southern latitudes and Western longitudes are negative.)\n"); + fprintf(grprsm, " Data represent type = lat/long (Table 6) %9d\n", isec2[0]); + /* + Quasi-regular lat/long grids also possible. + */ + if ( isec2[16] == 0 ) + fprintf(grprsm, " Number of points along a parallel. %9d\n", isec2[1]); + else + printQuasi(isec2); + + fprintf(grprsm, " Number of points along a meridian. %9d\n", isec2[2]); + fprintf(grprsm, " Latitude of first grid point. %9d\n", isec2[3]); + fprintf(grprsm, " Longitude of first grid point. %9d\n", isec2[4]); + + ibit = 8; + iresol = isec2[5] + isec2[17] + isec2[18]; + prtbin(iresol, ibit, &iout, &ierr); + + fprintf(grprsm, " Resolution and components flag. %8.8d\n", iout); + fprintf(grprsm, " Latitude of last grid point. %9d\n", isec2[6]); + fprintf(grprsm, " Longitude of last grid point. %9d\n", isec2[7]); + /* + Print increment if given. + */ + if ( isec2[8] < 0 ) + fprintf(grprsm, " i direction (East-West) increment Not given\n"); + else + fprintf(grprsm, " i direction (East-West) increment. %9d\n", isec2[8]); + + if ( isec2[9] < 0 ) + fprintf(grprsm, " j direction (North-South) increment Not given\n"); + else + fprintf(grprsm, " j direction (North-South) increment. %9d\n", isec2[9]); + + ibit = 8; + prtbin(isec2[10], ibit, &iout, &ierr); + + fprintf(grprsm, " Scanning mode flags (Code Table 8) %8.8d\n", iout); + fprintf(grprsm, " Number of vertical coordinate parameters. %9d\n", isec2[11]); + goto LABEL800; + } + /* + ----------------------------------------------------------------- + Section 5 . Print polar stereographic data. + ----------------------------------------------------------------- + */ + if ( isec2[0] == 5 ) + { + fprintf(grprsm, " (Southern latitudes and Western longitudes are negative.)\n"); + fprintf(grprsm, " Data represent type = polar stereo (Table 6) %9d\n", isec2[0]); + fprintf(grprsm, " Number of points along X axis. %9d\n", isec2[1]); + fprintf(grprsm, " Number of points along Y axis. %9d\n", isec2[2]); + fprintf(grprsm, " Latitude of first grid point. %9d\n", isec2[3]); + fprintf(grprsm, " Longitude of first grid point. %9d\n", isec2[4]); + ibit = 8; + iresol = isec2[17] + isec2[18]; + prtbin(iresol, ibit, &iout, &ierr); + fprintf(grprsm, " Resolution and components flag. %8.8d\n", iout); + fprintf(grprsm, " Orientation of the grid. %9d\n", isec2[6]); + fprintf(grprsm, " X direction increment. %9d\n", isec2[8]); + fprintf(grprsm, " Y direction increment. %9d\n", isec2[9]); + ibit = 8; + prtbin(isec2[10], ibit, &iout, &ierr); + fprintf(grprsm, " Scanning mode flags (Code Table 8) %8.8d\n", iout); + fprintf(grprsm, " Number of vertical coordinate parameters. %9d\n", isec2[11]); + fprintf(grprsm, " Projection centre flag. %9d\n", isec2[12]); + goto LABEL800; + } + /* + ----------------------------------------------------------------- + Section 6 . Print Lambert conformal data. + ----------------------------------------------------------------- + */ + if ( isec2[0] == 3 ) + { + fprintf(grprsm, " (Southern latitudes and Western longitudes are negative.)\n"); + fprintf(grprsm, " Data represent type = Lambert (Table 6) %9d\n", isec2[0]); + fprintf(grprsm, " Number of points along X axis. %9d\n", isec2[1]); + fprintf(grprsm, " Number of points along Y axis. %9d\n", isec2[2]); + fprintf(grprsm, " Latitude of first grid point. %9d\n", isec2[3]); + fprintf(grprsm, " Longitude of first grid point. %9d\n", isec2[4]); + ibit = 8; + iresol = isec2[17] + isec2[18] + isec2[5]; + prtbin(iresol, ibit, &iout, &ierr); + fprintf(grprsm, " Resolution and components flag. %8.8d\n", iout); + fprintf(grprsm, " Orientation of the grid. %9d\n", isec2[6]); + fprintf(grprsm, " X direction increment. %9d\n", isec2[8]); + fprintf(grprsm, " Y direction increment. %9d\n", isec2[9]); + ibit = 8; + prtbin(isec2[10], ibit, &iout, &ierr); + fprintf(grprsm, " Scanning mode flags (Code Table 8) %8.8d\n", iout); + fprintf(grprsm, " Number of vertical coordinate parameters. %9d\n", isec2[11]); + fprintf(grprsm, " Projection centre flag. %9d\n", isec2[12]); + fprintf(grprsm, " Latitude intersection 1 - Latin 1 -. %9d\n", isec2[13]); + fprintf(grprsm, " Latitude intersection 2 - Latin 2 -. %9d\n", isec2[14]); + fprintf(grprsm, " Latitude of Southern Pole. %9d\n", isec2[19]); + fprintf(grprsm, " Longitude of Southern Pole. %9d\n", isec2[20]); + goto LABEL800; + } + /* + ----------------------------------------------------------------- + Section 7 . Print space view perspective or orthographic data. + ----------------------------------------------------------------- + */ + if ( isec2[0] == 90 ) + { + fprintf(grprsm, " (Southern latitudes and Western longitudes are negative.)\n"); + fprintf(grprsm, " Data represent type = space/ortho (Table 6) %9d\n", isec2[0]); + fprintf(grprsm, " Number of points along X axis. %9d\n", isec2[1]); + fprintf(grprsm, " Number of points along Y axis. %9d\n", isec2[2]); + fprintf(grprsm, " Latitude of sub-satellite point. %9d\n", isec2[3]); + fprintf(grprsm, " Longitude of sub-satellite point. %9d\n", isec2[4]); + //iresol = isec2[17] + isec2[18]; + fprintf(grprsm, " Diameter of the earth in x direction. %9d\n", isec2[6]); + fprintf(grprsm, " Y coordinate of sub-satellite point. %9d\n", isec2[9]); + ibit = 8; + prtbin(isec2[10], ibit, &iout, &ierr); + fprintf(grprsm, " Scanning mode flags (Code Table 8) %8.8d\n", iout); + fprintf(grprsm, " Number of vertical coordinate parameters. %9d\n", isec2[11]); + fprintf(grprsm, " Orientation of the grid. %9d\n", isec2[6]); + fprintf(grprsm, " Altitude of the camera. %9d\n", isec2[13]); + fprintf(grprsm, " Y coordinate of origin of sector image. %9d\n", isec2[14]); + fprintf(grprsm, " X coordinate of origin of sector image. %9d\n", isec2[15]); + goto LABEL800; + } + /* + ----------------------------------------------------------------- + Section 7.5 . Print ocean data + ----------------------------------------------------------------- + */ + /* + if ( isec2[0] == 192 && ISEC1_CenterID == 98 ) + { + fprintf(grprsm, " Data represent type = ECMWF ocean (Table 6) %9d\n", isec2[0]); + if ( isec2[1] == 32767 ) + fprintf(grprsm, " Number of points along the first axis. Not used\n"); + else + fprintf(grprsm, " Number of points along the first axis. %9d\n", isec2[1]); + + if ( isec2[2] == 32767 ) + fprintf(grprsm, " Number of points along the second axis. Not used\n"); + else + fprintf(grprsm, " Number of points along the second axis. %9d\n", isec2[2]); + + ibit = 8; + prtbin(isec2[10], ibit, &iout, &ierr); + fprintf(grprsm, " Scanning mode flags (Code Table 8) %8.8d\n", iout); + goto LABEL800; + } + */ + /* + ----------------------------------------------------------------- + Section 7.6 . Print triangular data + ----------------------------------------------------------------- + */ + if ( isec2[0] == 192 /* && ISEC1_CenterID == 78 */ ) + { + fprintf(grprsm, " Data represent type = triangular (Table 6) %9d\n", isec2[0]); + fprintf(grprsm, " Number of factor 2 in factorisation of Ni. %9d\n", isec2[1]); + fprintf(grprsm, " Number of factor 3 in factorisation of Ni. %9d\n", isec2[2]); + fprintf(grprsm, " Number of diamonds (Nd). %9d\n", isec2[3]); + fprintf(grprsm, " Number of triangular subdivisions of the\n"); + fprintf(grprsm, " icosahedron (Ni). %9d\n", isec2[4]); + fprintf(grprsm, " Flag for orientation of diamonds (Table A). %9d\n", isec2[5]); + fprintf(grprsm, " Latitude of pole point. %9d\n", isec2[6]); + fprintf(grprsm, " Longitude of pole point. %9d\n", isec2[7]); + fprintf(grprsm, " Longitude of the first diamond. %9d\n", isec2[8]); + fprintf(grprsm, " Flag for storage sequence (Table B). %9d\n", isec2[9]); + fprintf(grprsm, " Number of vertical coordinate parameters. %9d\n", isec2[11]); + goto LABEL800; + } + /* + ----------------------------------------------------------------- + Drop through to here => representation type not catered for. + ----------------------------------------------------------------- + */ + fprintf(grprsm, "GRPRS2 :Data representation type not catered for -%d\n", isec2[0]); + + goto LABEL900; + /* + ----------------------------------------------------------------- + Section 8 . Print vertical coordinate parameters, + rotated grid information, + stretched grid information, if any. + ----------------------------------------------------------------- + */ + LABEL800:; + /* + Vertical coordinate parameters ... + */ + if ( isec2[11] != 0 ) + { + fprintf(grprsm, " \n"); + fprintf(grprsm, " Vertical Coordinate Parameters.\n"); + fprintf(grprsm, " -------------------------------\n"); + for (int i = 10; i < isec2[11]+10; ++i) + fprintf(grprsm, " %20.12f\n", fsec2[i]); + } + /* + Rotated and stretched grids introduced in Edition 1. + */ + if ( iedit < 1 ) goto LABEL900; + /* + Rotated grid information ... + */ + if ( isec2[0] == 10 || isec2[0] == 30 || + isec2[0] == 14 || isec2[0] == 34 || + isec2[0] == 60 || isec2[0] == 80 || + isec2[0] == 30 ) + { + fprintf(grprsm, " \n"); + fprintf(grprsm, " Latitude of southern pole of rotation. %9d\n", isec2[12]); + fprintf(grprsm, " Longitude of southern pole of rotation. %9d\n", isec2[13]); + fprintf(grprsm, " Angle of rotation. %20.10f\n", fsec2[0]); + } + /* + Stretched grid information ... + */ + if ( isec2[0] == 20 || isec2[0] == 30 || + isec2[0] == 24 || isec2[0] == 34 || + isec2[0] == 70 || isec2[0] == 80 ) + { + fprintf(grprsm, " \n"); + fprintf(grprsm, " Latitude of pole of stretching. %9d\n", isec2[14]); + fprintf(grprsm, " Longitude of pole of stretching. %9d\n", isec2[15]); + fprintf(grprsm, " Stretching factor. %20.10f\n", fsec2[1]); + } + + LABEL900:; + + return; +} + +void gribPrintSec2SP(int *isec0, int *isec2, float *fsec2sp) +{ + int inum = 10 + isec2[11]; + + double *fsec2 = (double*) Malloc((size_t)inum*sizeof(double)); + if ( fsec2 == NULL ) SysError("No Memory!"); + + for (int j = 0; j < inum; ++j) fsec2[j] = fsec2sp[j]; + + gribPrintSec2DP(isec0, isec2, fsec2); + + Free(fsec2); +} + +void gribPrintSec3DP(int *isec0, int *isec3, double *fsec3) +{ + /* + + Print the information in the Bit-Map Section + (Section 3) of decoded GRIB data. + + Input Parameters: + + isec0 - Array of decoded integers from Section 0 + + isec3 - Array of decoded integers from Section 3 + + fsec3 - Array of decoded floats from Section 3 + + + Converted from EMOS routine GRPRS3. + + Uwe Schulzweida MPIfM 01/04/2001 + + */ + + UNUSED(isec0); + + grsdef(); + + fprintf(grprsm, " \n"); + fprintf(grprsm, " Section 3 - Bit-map Section.\n"); + fprintf(grprsm, " -------------------------------------\n"); + + if ( isec3[0] != 0 ) + fprintf(grprsm, " Predetermined bit-map number. %9d\n", isec3[0]); + else + fprintf(grprsm, " No predetermined bit-map.\n"); + + fprintf(grprsm, " Missing data value for integer data. %14d\n", isec3[1]); + + fprintf(grprsm, " Missing data value for real data. %20.6g\n", fsec3[1]); +} + +void gribPrintSec3SP(int *isec0, int *isec3, float *fsec3sp) +{ + double fsec3[2]; + + fsec3[0] = fsec3sp[0]; + fsec3[1] = fsec3sp[1]; + + gribPrintSec3DP(isec0, isec3, fsec3); +} + +void gribPrintSec4DP(int *isec0, int *isec4, double *fsec4) +{ + /* + + Print the information in the Binary Data Section + (Section 4) of decoded GRIB data. + + Input Parameters: + + isec0 - Array of decoded integers from Section 0 + + isec4 - Array of decoded integers from Section 4 + + fsec4 - Array of decoded floats from Section 4 + + + Converted from EMOS routine GRPRS4. + + Uwe Schulzweida MPIfM 01/04/2001 + + */ + int inum; + + UNUSED(isec0); + + grsdef(); + + /* + ----------------------------------------------------------------- + Section 1 . Print integer information from isec4. + ----------------------------------------------------------------- + */ + fprintf(grprsm, " \n"); + fprintf(grprsm, " Section 4 - Binary Data Section.\n"); + fprintf(grprsm, " -------------------------------------\n"); + + fprintf(grprsm, " Number of data values coded/decoded. %9d\n", isec4[0]); + fprintf(grprsm, " Number of bits per data value. %9d\n", isec4[1]); + fprintf(grprsm, " Type of data (0=grid pt, 128=spectral).%9d\n", isec4[2]); + fprintf(grprsm, " Type of packing (0=simple, 64=complex). %9d\n", isec4[3]); + fprintf(grprsm, " Type of data (0=float, 32=integer). %9d\n", isec4[4]); + fprintf(grprsm, " Additional flags (0=none, 16=present). %9d\n", isec4[5]); + fprintf(grprsm, " Reserved. %9d\n", isec4[6]); + fprintf(grprsm, " Number of values (0=single, 64=matrix). %9d\n", isec4[7]); + fprintf(grprsm, " Secondary bit-maps (0=none, 32=present). %9d\n", isec4[8]); + fprintf(grprsm, " Values width (0=constant, 16=variable).%9d\n", isec4[9]); + /* + If complex packing .. + */ + if ( isec4[3] == 64 ) + { + if ( isec4[2] == 128 ) + { + fprintf(grprsm, " Byte offset of start of packed data (N). %9d\n", isec4[15]); + fprintf(grprsm, " Power (P * 1000). %9d\n", isec4[16]); + fprintf(grprsm, " Pentagonal resolution parameter J for subset.%9d\n", isec4[17]); + fprintf(grprsm, " Pentagonal resolution parameter K for subset.%9d\n", isec4[18]); + fprintf(grprsm, " Pentagonal resolution parameter M for subset.%9d\n", isec4[19]); + } + else + { + fprintf(grprsm, " Bits number of 2nd order values (none=>0).%9d\n", isec4[10]); + fprintf(grprsm, " General extend. 2-order packing (0=no,8=yes).%9d\n", isec4[11]); + fprintf(grprsm, " Boustrophedonic ordering (0=no,4=yes).%9d\n", isec4[12]); + fprintf(grprsm, " Spatial differencing order (0=none).%9d\n", isec4[13]+isec4[14]); + } + } + /* + Number of non-missing values + */ + if ( isec4[20] != 0 ) + fprintf(grprsm, " Number of non-missing values %9d\n", isec4[20]); + /* + Information on matrix of values , if present. + */ + if ( isec4[7] == 64 ) + { + fprintf(grprsm, " First dimension (rows) of each matrix. %9d\n", isec4[49]); + fprintf(grprsm, " Second dimension (columns) of each matrix. %9d\n", isec4[50]); + fprintf(grprsm, " First dimension coordinate values definition.%9d\n", isec4[51]); + fprintf(grprsm, " (Code Table 12)\n"); + fprintf(grprsm, " NC1 - Number of coefficients for 1st dimension.%7d\n", isec4[52]); + fprintf(grprsm, " Second dimension coordinate values definition.%8d\n", isec4[53]); + fprintf(grprsm, " (Code Table 12)\n"); + fprintf(grprsm, " NC2 - Number of coefficients for 2nd dimension.%7d\n", isec4[54]); + fprintf(grprsm, " 1st dimension physical signifance (Table 13). %8d\n", isec4[55]); + fprintf(grprsm, " 2nd dimension physical signifance (Table 13).%8d\n", isec4[56]); + } + /* + ----------------------------------------------------------------- + Section 2. Print values from fsec4. + ----------------------------------------------------------------- + */ + + inum = isec4[0]; + if ( inum < 0 ) inum = - inum; + if ( inum > 20 ) inum = 20; + /* + Print first inum values. + */ + fprintf(grprsm, " \n"); + fprintf(grprsm, " First %4d data values.\n", inum); + + if ( isec4[4] == 0 ) + { + /* + Print real values ... + */ + for (int j = 0; j < inum; ++j) + { + if ( fabs(fsec4[j]) > 0 ) + { + if ( fabs(fsec4[j]) >= 0.1 && fabs(fsec4[j]) <= 1.e8 ) + fprintf(grprsm, " %#16.8G \n", fsec4[j]); + else + fprintf(grprsm, " %#20.8E\n", fsec4[j]); + } + else + fprintf(grprsm, " %#16.0f \n", fabs(fsec4[j])); + } + } + else + { + /* + Print integer values ... + */ + fprintf(grprsm, " Print of integer values not supported\n"); + /* + CALL SETPAR(IBIT,IDUM,IDUM) + DO 212 J=1,INUM + INSPT = 0 + CALL INXBIT(IVALUE,1,INSPT,FSEC4(J),1,IBIT,IBIT,'C',IRET) + WRITE (*,9033) IVALUE + 9033 FORMAT(' ',I15) + 212 CONTINUE + ENDIF + */ + } +} + +void gribPrintSec4SP(int *isec0, int *isec4, float *fsec4sp) +{ + double fsec4[20]; + + int inum = isec4[0]; + if ( inum < 0 ) inum = -inum; + if ( inum > 20 ) inum = 20; + + for (int j = 0; j < inum; ++j) fsec4[j] = fsec4sp[j]; + + gribPrintSec4DP(isec0, isec4, fsec4); +} + +void gribPrintSec4Wave(int *isec4) +{ + /* + + Print the wave coordinate information in the Binary Data + Section (Section 4) of decoded GRIB data. + + Input Parameters: + + isec4 - Array of decoded integers from Section 4 + + Comments: + + Wave coordinate information held in isec4 are 32-bit floats, + hence the PTEMP and NTEMP used for printing are 4-byte variables. + + + Converted from EMOS routine GRPRS4W. + + Uwe Schulzweida MPIfM 01/04/2001 + + */ + int ntemp[100]; + float *ptemp; + + grsdef(); + + /* + ----------------------------------------------------------------- + Section 1 . Print integer information from isec4. + ----------------------------------------------------------------- + */ + fprintf(grprsm, " Coefficients defining first dimension coordinates:\n"); + for (int jloop = 0; jloop < isec4[52]; jloop++) + { + ntemp[jloop] = isec4[59 + jloop]; + ptemp = (float *) &ntemp[jloop]; + fprintf(grprsm, "%20.10f\n", *ptemp); + } + fprintf(grprsm, " Coefficients defining second dimension coordinates:\n"); + for (int jloop = 0; jloop < isec4[54]; jloop++) + { + ntemp[jloop] = isec4[59 + isec4[52] + jloop]; + ptemp = (float *) &ntemp[jloop]; + fprintf(grprsm, "%20.10f\n", *ptemp); + } +} +#ifdef HAVE_CONFIG_H +#endif + +#include <string.h> +#include <ctype.h> + + + +int gribOpen(const char *filename, const char *mode) +{ + int fileID = fileOpen(filename, mode); + +#if defined (__sun) + if ( fileID != FILE_UNDEFID && tolower(*mode) == 'r' ) + { + fileSetBufferType(fileID, FILE_BUFTYPE_MMAP); + } +#endif + + return fileID; +} + + +void gribClose(int fileID) +{ + fileClose(fileID); +} + + +off_t gribGetPos(int fileID) +{ + return fileGetPos(fileID); +} + + +int gribCheckSeek(int fileID, long *offset, int *version) +{ + int ierr = gribFileSeek(fileID, offset); + + *version = -1; + if ( !ierr ) + { + char buffer[4]; + if ( fileRead(fileID, buffer, 4) == 4 ) + *version = buffer[3]; + } + + return ierr; +} + + +int gribFileSeek(int fileID, long *offset) +{ + /* position file pointer after GRIB */ + const long GRIB = 0x47524942; + long code = 0; + int ch; + int retry = 4096*4096; + + *offset = 0; + + void *fileptr = filePtr(fileID); + + while ( retry-- ) + { + ch = filePtrGetc(fileptr); + if ( ch == EOF ) return -1; + + code = ( (code << 8) + ch ) & 0xFFFFFFFF; + if ( code == GRIB ) + { + if ( CGRIBEX_Debug ) Message("record offset = %ld", *offset); + return 0; + } + + (*offset)++; + } + + if ( CGRIBEX_Debug ) Message("record offset = %ld", *offset); + + return 1; +} + +static inline +unsigned read3ByteMSBFirst(void *fileptr) +{ + unsigned b1 = (unsigned)(filePtrGetc(fileptr)); + unsigned b2 = (unsigned)(filePtrGetc(fileptr)); + unsigned b3 = (unsigned)(filePtrGetc(fileptr)); + return GET_UINT3(b1, b2, b3); +} + + +size_t gribReadSize(int fileID) +{ + size_t rgribsize = 0; + void *fileptr = filePtr(fileID); + off_t pos = fileGetPos(fileID); + + unsigned gribsize = read3ByteMSBFirst(fileptr); + + int gribversion = filePtrGetc(fileptr); + + if ( gribsize == 24 && gribversion != 1 && gribversion != 2 ) gribversion = 0; + + if ( CGRIBEX_Debug ) Message("gribversion = %d", gribversion); + + if ( gribversion == 0 ) + { + unsigned gdssize = 0, bmssize = 0; + unsigned issize = 4, essize = 4; + + unsigned pdssize = gribsize; + fileSetPos(fileID, (off_t) 3, SEEK_CUR); + if ( CGRIBEX_Debug ) Message("pdssize = %u", pdssize); + int flag = filePtrGetc(fileptr); + if ( CGRIBEX_Debug ) Message("flag = %d", flag); + + fileSetPos(fileID, (off_t) pdssize-8, SEEK_CUR); + + if ( flag & 128 ) + { + gdssize = read3ByteMSBFirst(fileptr); + fileSetPos(fileID, (off_t) gdssize-3, SEEK_CUR); + if ( CGRIBEX_Debug ) Message("gdssize = %u", gdssize); + } + + if ( flag & 64 ) + { + bmssize = read3ByteMSBFirst(fileptr); + fileSetPos(fileID, (off_t) bmssize-3, SEEK_CUR); + if ( CGRIBEX_Debug ) Message("bmssize = %u", bmssize); + } + + unsigned bdssize = read3ByteMSBFirst(fileptr); + if ( CGRIBEX_Debug ) Message("bdssize = %u", bdssize); + + gribsize = issize + pdssize + gdssize + bmssize + bdssize + essize; + rgribsize = (size_t) gribsize; + } + else if ( gribversion == 1 ) + { + if ( gribsize > JP23SET ) // Large GRIB record + { + unsigned pdssize = read3ByteMSBFirst(fileptr); + if ( CGRIBEX_Debug ) Message("pdssize = %u", pdssize); + + int flag = 0; + for (int i = 0; i < 5; ++i) flag = filePtrGetc(fileptr); + if ( CGRIBEX_Debug ) Message("flag = %d", flag); + + fileSetPos(fileID, (off_t) pdssize-8, SEEK_CUR); + + unsigned gdssize = 0; + if ( flag & 128 ) + { + gdssize = read3ByteMSBFirst(fileptr); + fileSetPos(fileID, (off_t) gdssize-3, SEEK_CUR); + if ( CGRIBEX_Debug ) Message("gdssize = %u", gdssize); + } + + unsigned bmssize = 0; + if ( flag & 64 ) + { + bmssize = read3ByteMSBFirst(fileptr); + fileSetPos(fileID, (off_t) bmssize-3, SEEK_CUR); + if ( CGRIBEX_Debug ) Message("bmssize = %u", bmssize); + } + + unsigned bdssize = read3ByteMSBFirst(fileptr); + if ( CGRIBEX_Debug ) Message("bdssize = %u", bdssize); + if ( bdssize <= 120 ) + { + const int issize = 4; + gribsize &= JP23SET; + gribsize *= 120; + bdssize = correct_bdslen(bdssize, gribsize, issize+pdssize+gdssize+bmssize); + if ( CGRIBEX_Debug ) Message("bdssize = %u", bdssize); + + gribsize = issize + pdssize + gdssize + bmssize + bdssize + 4; + } + } + rgribsize = (size_t) gribsize; + } + else if ( gribversion == 2 ) + { + /* we set gribsize the following way because it doesn't matter then + whether int is 4 or 8 bytes long - we don't have to care if the size + really fits: if it does not, the record can not be read at all */ + rgribsize = 0; + for (int i = 0; i < 8; ++i) rgribsize = (rgribsize << 8) | filePtrGetc(fileptr); + } + else + { + rgribsize = 0; + Warning("GRIB version %d unsupported!", gribversion); + } + + if ( filePtrEOF(fileptr) ) rgribsize = 0; + + if ( CGRIBEX_Debug ) Message("gribsize = %zu", rgribsize); + + fileSetPos(fileID, pos, SEEK_SET); + + return rgribsize; +} + + +size_t gribGetSize(int fileID) +{ + long offset; + int ierr = gribFileSeek(fileID, &offset); // position file pointer after GRIB + if ( ierr > 0 ) + { + Warning("GRIB record not found!"); + return 0; + } + + if ( ierr == -1 ) return 0; + else if ( ierr == 1 ) return 0; + + size_t recSize = gribReadSize(fileID); + + if ( CGRIBEX_Debug ) Message("recsize = %zu", recSize); + + fileSetPos(fileID, (off_t) -4, SEEK_CUR); + + return recSize; +} + + +int gribRead(int fileID, void *buffer, size_t *buffersize) +{ + long offset; + int ierr = gribFileSeek(fileID, &offset); // position file pointer after GRIB + if ( ierr > 0 ) + { + Warning("GRIB record not found!"); + return -2; + } + + if ( ierr == -1 ) { *buffersize = 0; return -1; } + else if ( ierr == 1 ) { *buffersize = 0; return -2; } + + size_t recSize = gribReadSize(fileID); + size_t readSize = recSize; + + if ( readSize > *buffersize ) + { + readSize = *buffersize; + ierr = -3; // Tell the caller that the buffer was insufficient. + } + + *buffersize = recSize; // Inform the caller about the record size. + + // Write the stuff to the buffer that has already been read in gribFileSeek(). + memcpy(buffer, "GRIB", 4); + + readSize -= 4; + // Read the rest of the record into the buffer. + size_t nread = fileRead(fileID, (char *)buffer + 4, readSize); + + if ( nread != readSize ) ierr = 1; + + return ierr; +} + + +int gribWrite(int fileID, void *buffer, size_t buffersize) +{ + int nwrite = (int)(fileWrite(fileID, buffer, buffersize)); + if (nwrite != (int) buffersize) + { + perror(__func__); + nwrite = -1; + } + + return nwrite; +} +#include <string.h> +#include <ctype.h> + + +FILE *grprsm = NULL; +int CGRIBEX_grib_calendar = -1; + + +void gribSetCalendar(int calendar) +{ + CGRIBEX_grib_calendar = calendar; +} + + +void grsdef(void) +{ + /* +C----> +C**** GRSDEF - Initial (default) setting of common area variables +C for GRIBEX package. +C +C Purpose. +C -------- +C +C Sets initial values for common area variables for all +C routines of GRIBEX package, if not already done. +C +C** Interface. +C ---------- +C +C CALL GRSDEF +C +C Input Parameters. +C ----------------- +C +C None. +C +C Output Parameters. +C ------------------ +C +C None. +C +C Method. +C ------- +C +C Self-explanatory. +C +C Externals. +C ---------- +C +C None. +C +C Reference. +C ---------- +C +C See subroutine GRIBEX. +C +C Comments. +C --------- +C +C None +C +C Author. +C ------- +C +C J. Clochard, Meteo France, for ECMWF - March 1998. +C +C Modifications. +C -------------- +C +C J. Clochard, Meteo France, for ECMWF - June 1999. +C Add variable NSUBCE. +C Use a static variable to determine if initialisation has already +C been done. NUSER removed . +C Reverse defaults for NEXT2O and NLOC2O, for consistency with +C version 13.023 of software . +C + */ + /* +C ---------------------------------------------------------------- +C* Section 0 . Definition of variables. +C ---------------------------------------------------------------- + */ + char *envString; + char *env_stream; + static bool lfirst = true; + extern int CGRIBEX_Const; + + if ( ! lfirst ) return; + + /* + ---------------------------------------------------------------- + Section 1 . Set values, conditionally. + ---------------------------------------------------------------- + */ + /* + Common area variables have not been set. Set them. + */ + /* + Set GRIB calendar. + */ + if ( CGRIBEX_grib_calendar == -1 ) + { + CGRIBEX_grib_calendar = CALENDAR_PROLEPTIC; + + envString = getenv("GRIB_CALENDAR"); + if ( envString ) + { + if ( strncmp(envString, "standard", 8) == 0 ) + CGRIBEX_grib_calendar = CALENDAR_STANDARD; + else if ( strncmp(envString, "proleptic", 9) == 0 ) + CGRIBEX_grib_calendar = CALENDAR_PROLEPTIC; + else if ( strncmp(envString, "360days", 7) == 0 ) + CGRIBEX_grib_calendar = CALENDAR_360DAYS; + else if ( strncmp(envString, "365days", 7) == 0 ) + CGRIBEX_grib_calendar = CALENDAR_365DAYS; + else if ( strncmp(envString, "366days", 7) == 0 ) + CGRIBEX_grib_calendar = CALENDAR_366DAYS; + else if ( strncmp(envString, "none", 4) == 0 ) + CGRIBEX_grib_calendar = CALENDAR_NONE; + } + } + /* + Set GRIBEX compatibility mode. + */ + envString = getenv("GRIB_GRIBEX_MODE_ON"); + if ( envString != NULL ) + { + if ( atoi(envString) == 1 ) CGRIBEX_Const = 0; + } + + /* + See if output stream needs changing + */ + grprsm = stdout; + env_stream = getenv("GRPRS_STREAM"); + if ( env_stream ) + { + if ( isdigit((int) env_stream[0]) ) + { + int unit; + unit = atoi(env_stream); + if ( unit < 1 || unit > 99 ) + Warning("Invalid number for GRPRS_STREAM: %d", unit); + else if ( unit == 2 ) + grprsm = stderr; + else if ( unit == 6 ) + grprsm = stdout; + else + { + char filename[] = "unit.00"; + sprintf(filename, "%2.2d", unit); + grprsm = fopen(filename, "w"); + if ( ! grprsm ) + SysError("GRPRS_STREAM = %d", unit); + } + } + else + { + if ( env_stream[0] ) + { + grprsm = fopen(env_stream, "w"); + if ( ! grprsm ) + SysError("GRPRS_STREAM = %s", env_stream); + } + } + } + /* + Mark common area values set by user. + */ + lfirst = false; +} + +/* pack 8-bit bytes from 64-bit words to a packed buffer */ +/* same as : for (int i = 0; i < bc; ++i) cp[i] = (unsigned char) up[i]; */ + +long packInt64(unsigned INT64 *up, unsigned char *cp, long bc, long tc) +{ +#if defined (CRAY) + (void) _pack(up, cp, bc, tc); +#else + unsigned char *cp0; + unsigned INT64 upi, *up0, *ip0, *ip1, *ip2, *ip3, *ip4, *ip5, *ip6, *ip7; + long ipack = sizeof(INT64); + + // Bytes until first word boundary in destination buffer + + long head = ( (long) cp ) & (ipack-1); + if ( head != 0 ) head = ipack - head; + + long inner = bc - head; + + // Trailing bytes which do not make a full word + + long trail = inner & (ipack-1); + + // Number of bytes/words to be processed in fast loop + + inner -= trail; + inner /= ipack; + + ip0 = up + head; + ip1 = ip0 + 1; + ip2 = ip0 + 2; + ip3 = ip0 + 3; + ip4 = ip0 + 4; + ip5 = ip0 + 5; + ip6 = ip0 + 6; + ip7 = ip0 + 7; + + up0 = (unsigned INT64 *)(void *)(cp + head); + + /* Here we should process any bytes until the first word boundary + * of our destination buffer + * That code is missing so far because our output buffer is + * word aligned by FORTRAN + */ + + long j = 0; + + if ( IS_BIGENDIAN() ) + { +#if defined (CRAY) +#pragma _CRI ivdep +#endif +#if defined (SX) +#pragma vdir nodep +#endif +#ifdef __uxpch__ +#pragma loop novrec +#endif + for (long i = 0; i < inner; ++i) + { + upi = ( ip0[j] << 56 ) + | ( ( ip1[j] & 0xFF ) << 48 ) + | ( ( ip2[j] & 0xFF ) << 40 ) + | ( ( ip3[j] & 0xFF ) << 32 ) + | ( ( ip4[j] & 0xFF ) << 24 ) ; + up0[i] = upi | ( ( ip5[j] & 0xFF ) << 16 ) + | ( ( ip6[j] & 0xFF ) << 8 ) + | ( ip7[j] & 0xFF ) ; + j += ipack; + } + } + else + { + for (long i = 0; i < inner; ++i) + { + upi = ( ip7[j] << 56 ) + | ( ( ip6[j] & 0xFF ) << 48 ) + | ( ( ip5[j] & 0xFF ) << 40 ) + | ( ( ip4[j] & 0xFF ) << 32 ) + | ( ( ip3[j] & 0xFF ) << 24 ) ; + up0[i] = upi | ( ( ip2[j] & 0xFF ) << 16 ) + | ( ( ip1[j] & 0xFF ) << 8 ) + | ( ip0[j] & 0xFF ) ; + j += ipack; + } + } + + cp0 = (unsigned char *) ( up0 + inner ); + if ( trail > 0 ) + { + up0[inner] = 0; + for (long i = 0; i < trail ; ++i) + { + *cp0 = (unsigned char) ip0[ipack*inner+i]; + cp0++; + } + } + + if ( tc != -1 ) + { + bc++; + *cp0 = (unsigned char) tc; + } +#endif + return (bc); +} + +/* unpack 8-bit bytes from a packed buffer with 64-bit words */ +/* same as : for (int i = 0; i < bc; ++i) up[i] = (INT64) cp[i]; */ + +long unpackInt64(const unsigned char *cp, unsigned INT64 *up, long bc, long tc) +{ + const unsigned char *cp0; + unsigned INT64 *ip0, *ip1, *ip2, *ip3, *ip4, *ip5, *ip6, *ip7; + long offset; + long ipack = sizeof(INT64); + + UNUSED(tc); + + // Bytes until first word boundary in source buffer + + long head = ( (long) cp ) & (ipack-1); + if ( head != 0 ) head = ipack - head; + if ( head > bc ) head = bc; + + long inner = bc - head; + + // Trailing bytes which do not make a full word + + long trail = inner & (ipack-1); + + // Number of bytes/words to be processed in fast loop + + inner -= trail; + inner /= ipack; + + ip0 = up + head; + ip1 = ip0 + 1; + ip2 = ip0 + 2; + ip3 = ip0 + 3; + ip4 = ip0 + 4; + ip5 = ip0 + 5; + ip6 = ip0 + 6; + ip7 = ip0 + 7; + + const unsigned INT64 *up0 = (const unsigned INT64 *)(const void *)(cp + head); + + /* Process any bytes until the first word boundary + * of our source buffer + */ + for (long i = 0; i < head; ++i) up[i] = (unsigned INT64) cp[i]; + + long j = 0; + + if ( IS_BIGENDIAN() ) + { +#if defined (CRAY) +#pragma _CRI ivdep +#endif +#if defined (SX) +#pragma vdir nodep +#endif +#ifdef __uxpch__ +#pragma loop novrec +#endif + for (long i = 0; i < inner; ++i) + { + ip0[j] = (up0[i] >> 56) & 0xFF; + ip1[j] = (up0[i] >> 48) & 0xFF; + ip2[j] = (up0[i] >> 40) & 0xFF; + ip3[j] = (up0[i] >> 32) & 0xFF; + ip4[j] = (up0[i] >> 24) & 0xFF; + ip5[j] = (up0[i] >> 16) & 0xFF; + ip6[j] = (up0[i] >> 8) & 0xFF; + ip7[j] = (up0[i]) & 0xFF; + + j += ipack; + } + } + else + { + for (long i = 0; i < inner; ++i) + { + ip7[j] = (up0[i] >> 56) & 0xFF; + ip6[j] = (up0[i] >> 48) & 0xFF; + ip5[j] = (up0[i] >> 40) & 0xFF; + ip4[j] = (up0[i] >> 32) & 0xFF; + ip3[j] = (up0[i] >> 24) & 0xFF; + ip2[j] = (up0[i] >> 16) & 0xFF; + ip1[j] = (up0[i] >> 8) & 0xFF; + ip0[j] = (up0[i]) & 0xFF; + + j += ipack; + } + } + + if ( trail > 0 ) + { + offset = head + ipack*inner; + cp0 = cp + offset; + for (long i = 0; i < trail; ++i) up[i+offset] = (unsigned INT64) cp0[i]; + } + /* + if ( tc != -1 ) { + bc++; + *cp0 = (unsigned char) tc; + } + */ + return (bc); +} + +/* pack 8-bit bytes from 32-bit words to a packed buffer */ +/* same as : for (int i = 0; i < bc; ++i) cp[i] = (char) up[i]; */ + +#ifdef INT32 +long packInt32(unsigned INT32 *up, unsigned char *cp, long bc, long tc) +{ + unsigned char *cp0; + unsigned INT32 *up0, *ip0, *ip1, *ip2, *ip3; + long ipack = sizeof(INT32); + + // Bytes until first word boundary in destination buffer + + long head = ( (long) cp ) & (ipack-1); + if ( head != 0 ) head = ipack - head; + + long inner = bc - head; + + // Trailing bytes which do not make a full word + + long trail = inner & (ipack-1); + + // Number of bytes/words to be processed in fast loop + + inner -= trail; + inner /= ipack; + + ip0 = up + head; + ip1 = ip0 + 1; + ip2 = ip0 + 2; + ip3 = ip0 + 3; + + up0 = (unsigned INT32 *)(void *)(cp + head); + + /* Here we should process any bytes until the first word boundary + * of our destination buffer + * That code is missing so far because our output buffer is + * word aligned by FORTRAN + */ + + long j = 0; + + if ( IS_BIGENDIAN() ) + { +#if defined (CRAY) +#pragma _CRI ivdep +#endif +#if defined (SX) +#pragma vdir nodep +#endif +#ifdef __uxpch__ +#pragma loop novrec +#endif + for (long i = 0; i < inner; ++i) + { + up0[i] = ( ip0[j] << 24 ) + | ( ( ip1[j] & 0xFF ) << 16 ) + | ( ( ip2[j] & 0xFF ) << 8 ) + | ( ip3[j] & 0xFF ) ; + j += ipack; + } + } + else + { + for (long i = 0; i < inner; ++i) + { + up0[i] = ( ip3[j] << 24 ) + | ( ( ip2[j] & 0xFF ) << 16 ) + | ( ( ip1[j] & 0xFF ) << 8 ) + | ( ip0[j] & 0xFF ) ; + j += ipack; + } + } + + cp0 = (unsigned char *) ( up0 + inner ); + if ( trail > 0 ) + { + up0[inner] = 0; + for (long i = 0; i < trail; ++i) + { + *cp0 = (unsigned char) ip0[ipack*inner+i]; + cp0++; + } + } + + if ( tc != -1 ) + { + bc++; + *cp0 = (unsigned char) tc; + } + + return (bc); +} +#endif + +/* unpack 8-bit bytes from a packed buffer with 32-bit words */ +/* same as : for (int i = 0; i < bc; ++i) up[i] = (INT32) cp[i]; */ + +#ifdef INT32 +long unpackInt32(const unsigned char *cp, unsigned INT32 *up, long bc, long tc) +{ + const unsigned char *cp0; + unsigned INT32 *ip0, *ip1, *ip2, *ip3; + long offset; + long ipack = sizeof(INT32); + + UNUSED(tc); + + // Bytes until first word boundary in source buffer + + long head = ( (long) cp ) & (ipack-1); + if ( head != 0 ) head = ipack - head; + if ( head > bc ) head = bc; + + long inner = bc - head; + + // Trailing bytes which do not make a full word + + long trail = inner & (ipack-1); + + // Number of bytes/words to be processed in fast loop + + inner -= trail; + inner /= ipack; + + ip0 = up + head; + ip1 = ip0 + 1; + ip2 = ip0 + 2; + ip3 = ip0 + 3; + + const unsigned INT32 *up0 = (const unsigned INT32 *)(const void *)(cp + head); + + /* Process any bytes until the first word boundary + * of our source buffer + */ + for (long i = 0; i < head; ++i) up[i] = (unsigned INT32) cp[i]; + + long j = 0; + + if ( IS_BIGENDIAN() ) + { +#if defined (CRAY) +#pragma _CRI ivdep +#endif +#if defined (SX) +#pragma vdir nodep +#endif +#ifdef __uxpch__ +#pragma loop novrec +#endif + for (long i = 0; i < inner; ++i) + { + ip0[j] = (up0[i] >> 24) & 0xFF; + ip1[j] = (up0[i] >> 16) & 0xFF; + ip2[j] = (up0[i] >> 8) & 0xFF; + ip3[j] = (up0[i]) & 0xFF; + + j += ipack; + } + } + else + { + for (long i = 0; i < inner; ++i) + { + ip3[j] = (up0[i] >> 24) & 0xFF; + ip2[j] = (up0[i] >> 16) & 0xFF; + ip1[j] = (up0[i] >> 8) & 0xFF; + ip0[j] = (up0[i]) & 0xFF; + + j += ipack; + } + } + + if ( trail > 0 ) + { + offset = head + ipack*inner; + cp0 = cp + offset; + for (long i = 0; i < trail; ++i) up[i+offset] = (unsigned INT32) cp0[i]; + } + /* + if ( tc != -1 ) { + bc++; + *cp0 = (unsigned char) tc; + } + */ + + return (bc); +} +#endif +#include <stdio.h> + + +void prtbin(int kin, int knbit, int *kout, int *kerr) +{ + /* + + Produces a decimal number with ones and zeroes + corresponding to the ones and zeroes of the input + binary number. + eg input number 1011 binary, output number 1011 decimal. + + + Input Parameters: + + kin - Integer variable containing binary number. + + knbit - Number of bits in binary number. + + Output Parameters: + + kout - Integer variable containing decimal value + with ones and zeroes corresponding to those of + the input binary number. + + kerr - 0, If no error. + 1, Number of bits in binary number exceeds + maximum allowed or is less than 1. + + + Converted from EMOS routine PRTBIN. + + Uwe Schulzweida MPIfM 01/04/2001 + + */ + int idec; + int ik; + int itemp; + + /* + Check length of binary number to ensure decimal number + generated will fit in the computer word - in this case will + it fit in a Cray 48 bit integer? + */ + if ( knbit < 1 || knbit > 14 ) + { + *kerr = 1; + printf(" prtbin : Error in binary number length - %3d bits.\n", knbit); + return; + } + else + *kerr = 0; + /* + ----------------------------------------------------------------- + Section 1. Generate required number. + ----------------------------------------------------------------- + */ + *kout = 0; + ik = kin; + idec = 1; + + for (int j = 0; j < knbit; ++j) + { + itemp = ik - ( (ik/2)*2 ); + *kout = (*kout) + itemp * idec; + ik = ik / 2; + idec = idec * 10; + } + + return; +} + +void +ref2ibm(double *pref, int kbits) +{ + /* + + Purpose: + -------- + + Code and check reference value in IBM format + + Input Parameters: + ----------------- + + pref - Reference value + kbits - Number of bits per computer word. + + Output Parameters: + ------------------ + + pref - Reference value + + Method: + ------- + + Codes in IBM format, then decides to ensure that reference + value used for packing is not different from that stored + because of packing differences. + + Externals. + ---------- + + confp3 - Encode into IBM floating point format. + decfp2 - Decode from IBM floating point format. + + Reference: + ---------- + + None. + + Comments: + -------- + + None. + + Author: + ------- + + J.D.Chambers ECMWF 17:05:94 + + Modifications: + -------------- + + Uwe Schulzweida MPIfM 01/04/2001 + + Convert to C from EMOS library version 130 + + */ + + int itrnd; + int kexp, kmant; + double ztemp, zdumm; + extern int CGRIBEX_Debug; + + /* ----------------------------------------------------------------- */ + /* Section 1. Convert to and from IBM format. */ + /* ----------------------------------------------------------------- */ + + /* Convert floating point reference value to IBM representation. */ + + itrnd = 1; + zdumm = ztemp = *pref; + confp3(zdumm, &kexp, &kmant, kbits, itrnd); + + if (kexp == 0 && kmant == 0) return; + + /* Set reference value to that actually stored in the GRIB code. */ + + *pref = decfp2(kexp, kmant); + + /* If the nearest number which can be represented in */ + /* GRIB format is greater than the reference value, */ + /* find the nearest number in GRIB format lower */ + /* than the reference value. */ + + if (ztemp < *pref) + { + /* Convert floating point to GRIB representation */ + /* using truncation to ensure that the converted */ + /* number is smaller than the original one. */ + + itrnd = 0; + zdumm = ztemp; + confp3(zdumm, &kexp, &kmant, kbits, itrnd); + + /* Set reference value to that stored in the GRIB code. */ + + *pref = decfp2(kexp, kmant); + + if (ztemp < *pref) + { + if (CGRIBEX_Debug) + { + Message("Reference value error."); + Message("Notify Met.Applications Section."); + Message("ZTEMP = ", ztemp); + Message("PREF = ", pref); + } + *pref = ztemp; + } + } + + return; +} /* ref2ibm */ +#include <math.h> +#include <string.h> + + +unsigned correct_bdslen(unsigned bdslen, long recsize, long gribpos) +{ + /* + If a very large product, the section 4 length field holds + the number of bytes in the product after section 4 upto + the end of the padding bytes. + This is a fixup to get round the restriction on product lengths + due to the count being only 24 bits. It is only possible because + the (default) rounding for GRIB products is 120 bytes. + */ + if ( recsize > JP23SET && bdslen <= 120 ) bdslen = (unsigned)(recsize - gribpos - bdslen); + return bdslen; +} + + +int grib1Sections(unsigned char *gribbuffer, long gribbufsize, unsigned char **pdsp, + unsigned char **gdsp, unsigned char **bmsp, unsigned char **bdsp, long *gribrecsize) +{ + *gribrecsize = 0; + *pdsp = NULL; + *gdsp = NULL; + *bmsp = NULL; + *bdsp = NULL; + + unsigned char *section = gribbuffer; + unsigned char *is = gribbuffer; + if ( ! GRIB_START(section) ) + { + fprintf(stderr, "Wrong GRIB indicator section: found >%c%c%c%c<\n", + section[0], section[1], section[2], section[3]); + return -1; + } + + unsigned recsize = GET_UINT3(section[4], section[5], section[6]); + + int gribversion = GRIB_EDITION(section); + if ( gribversion != 0 && gribversion != 1 ) + { + fprintf(stderr, "Error while decoding GRIB1 sections: GRIB edition %d records not supported!\n", gribversion); + return -1; + } + + unsigned grib1offset = (gribversion == 1) ? 4 : 0; + + unsigned char *pds = is + 4 + grib1offset; + unsigned char *bufpointer = pds + PDS_Len; + unsigned gribsize = 4 + grib1offset + PDS_Len; + + unsigned char *gds = NULL; + if ( PDS_HAS_GDS ) + { + gds = bufpointer; + bufpointer += GDS_Len; + gribsize += GDS_Len; + } + + unsigned char *bms = NULL; + if ( PDS_HAS_BMS ) + { + bms = bufpointer; + bufpointer += BMS_Len; + gribsize += BMS_Len; + } + + unsigned char *bds = bufpointer; + unsigned bdslen = BDS_Len; + if ( recsize > JP23SET && bdslen <= 120 ) + { + recsize &= JP23SET; + recsize *= 120; + bdslen = correct_bdslen(bdslen, recsize, gribsize); + } + bufpointer += bdslen; + gribsize += bdslen; + gribsize += 4; + + *pdsp = pds; + *gdsp = gds; + *bmsp = bms; + *bdsp = bds; + + *gribrecsize = gribsize; + if ( gribbufsize < gribsize ) + { + fprintf(stderr, "Inconsistent length of GRIB message (grib_buffer_size=%ld < grib_record_size=%u)!\n", gribbufsize, gribsize); + return 1; + } + + if ( !GRIB_FIN(bufpointer) ) // end section - "7777" in ASCII + { + fprintf(stderr, "Missing GRIB end section: found >%c%c%c%c<\n", + bufpointer[0], bufpointer[1], bufpointer[2], bufpointer[3]); + return -2; + } + + return 0; +} + + +int grib2Sections(unsigned char *gribbuffer, long gribbufsize, unsigned char **idsp, + unsigned char **lusp, unsigned char **gdsp, unsigned char **pdsp, + unsigned char **drsp, unsigned char **bmsp, unsigned char **bdsp) +{ + UNUSED(gribbufsize); + + *idsp = NULL; + *lusp = NULL; + *gdsp = NULL; + *pdsp = NULL; + *drsp = NULL; + *bmsp = NULL; + *bdsp = NULL; + + unsigned char *section = gribbuffer; + unsigned sec_len = 16; + + if ( !GRIB_START(section) ) + { + fprintf(stderr, "wrong indicator section >%c%c%c%c<\n", + section[0], section[1], section[2], section[3]); + return -1; + } + + int gribversion = GRIB_EDITION(section); + if ( gribversion != 2 ) + { + fprintf(stderr, "wrong GRIB version %d\n", gribversion); + return -1; + } + + unsigned gribsize = 0; + for (int i = 0; i < 8; ++i) gribsize = (gribsize << 8) | section[8+i]; + + unsigned grib_len = sec_len; + section += sec_len; + + /* section 1 */ + sec_len = GRIB2_SECLEN(section); + int sec_num = GRIB2_SECNUM(section); + //fprintf(stderr, "ids %d %ld\n", sec_num, sec_len); + + if ( sec_num != 1 ) + { + fprintf(stderr, "Unexpected section1 number %d\n", sec_num); + return -1; + } + + *idsp = section; + + grib_len += sec_len; + section += sec_len; + + /* section 2 and 3 */ + sec_len = GRIB2_SECLEN(section); + sec_num = GRIB2_SECNUM(section); + //fprintf(stderr, "lus %d %ld\n", sec_num, sec_len); + + if ( sec_num == 2 ) + { + *lusp = section; + + grib_len += sec_len; + section += sec_len; + + /* section 3 */ + sec_len = GRIB2_SECLEN(section); + //sec_num = GRIB2_SECNUM(section); + //fprintf(stderr, "gds %d %ld\n", sec_num, sec_len); + + *gdsp = section; + } + else if ( sec_num == 3 ) + { + *gdsp = section; + } + else + { + fprintf(stderr, "Unexpected section3 number %d\n", sec_num); + return -1; + } + + grib_len += sec_len; + section += sec_len; + + /* section 4 */ + sec_len = GRIB2_SECLEN(section); + sec_num = GRIB2_SECNUM(section); + //fprintf(stderr, "pds %d %ld\n", sec_num, sec_len); + + if ( sec_num != 4 ) + { + fprintf(stderr, "Unexpected section4 number %d\n", sec_num); + return -1; + } + + *pdsp = section; + + grib_len += sec_len; + section += sec_len; + + /* section 5 */ + sec_len = GRIB2_SECLEN(section); + sec_num = GRIB2_SECNUM(section); + //fprintf(stderr, "drs %d %ld\n", sec_num, sec_len); + + if ( sec_num != 5 ) + { + fprintf(stderr, "Unexpected section5 number %d\n", sec_num); + return -1; + } + + *drsp = section; + + grib_len += sec_len; + section += sec_len; + + /* section 6 */ + sec_len = GRIB2_SECLEN(section); + sec_num = GRIB2_SECNUM(section); + //fprintf(stderr, "bms %d %ld\n", sec_num, sec_len); + + if ( sec_num != 6 ) + { + fprintf(stderr, "Unexpected section6 number %d\n", sec_num); + return -1; + } + + *bmsp = section; + + grib_len += sec_len; + section += sec_len; + + /* section 7 */ + sec_len = GRIB2_SECLEN(section); + sec_num = GRIB2_SECNUM(section); + //fprintf(stderr, "bds %d %ld\n", sec_num, sec_len); + + if ( sec_num != 7 ) + { + fprintf(stderr, "Unexpected section7 number %d\n", sec_num); + return -1; + } + + *bdsp = section; + + grib_len += sec_len; + section += sec_len; + + /* skip multi GRIB sections */ + int msec = 1; + while ( !GRIB_FIN(section) ) + { + sec_len = GRIB2_SECLEN(section); + sec_num = GRIB2_SECNUM(section); + + if ( sec_num < 1 || sec_num > 7 ) break; + + if ( sec_num == 7 ) + fprintf(stderr, "Skipped unsupported multi GRIB section %d!\n", ++msec); + + if ( (grib_len + sec_len) > gribsize ) break; + + grib_len += sec_len; + section += sec_len; + } + + /* end section - "7777" in ASCII */ + if ( !GRIB_FIN(section) ) + { + fprintf(stderr, "Missing end section >%2x %2x %2x %2x<\n", + section[0], section[1], section[2], section[3]); + return -2; + } + + return 0; +} + + +int grib_info_for_grads(off_t recpos, long recsize, unsigned char *gribbuffer, + int *intnum, float *fltnum, off_t *bignum) +{ + long gribsize = 0; + off_t bpos = 0; + + unsigned char *section = gribbuffer; + unsigned char *is = gribbuffer; + if ( ! GRIB_START(section) ) + { + fprintf(stderr, "wrong indicator section >%c%c%c%c<\n", + section[0], section[1], section[2], section[3]); + return -1; + } + + int gribversion = GRIB_EDITION(section); + if ( recsize == 24 && gribversion == 0 ) gribversion = 0; + + unsigned grib1offset = (gribversion == 1) ? 4 : 0; + + unsigned char *pds = is + 4 + grib1offset; + unsigned char *bufpointer = pds + PDS_Len; + gribsize += 4 + grib1offset + PDS_Len; + + unsigned char *gds = NULL; + if ( PDS_HAS_GDS ) + { + gds = bufpointer; + bufpointer += GDS_Len; + gribsize += GDS_Len; + } + + unsigned char *bms = NULL; + if ( PDS_HAS_BMS ) + { + bms = bufpointer; + bufpointer += BMS_Len; + bpos = recpos + gribsize + 6; + gribsize += BMS_Len; + } + + unsigned char *bds = bufpointer; + + off_t dpos = recpos + gribsize + 11; + + unsigned bdslen = BDS_Len; + bdslen = correct_bdslen(bdslen, recsize, bds-gribbuffer); + bufpointer += bdslen; + gribsize += bdslen; + gribsize += 4; + + if ( gribsize > recsize ) + { + fprintf(stderr, "GRIB buffer size %ld too small! Min size = %ld\n", recsize, gribsize); + return 1; + } + + /* end section - "7777" in ascii */ + if ( !GRIB_FIN(bufpointer) ) + { + fprintf(stderr, "Missing end section >%2x %2x %2x %2x<\n", + bufpointer[0], bufpointer[1], bufpointer[2], bufpointer[3]); + } + + int bs = BDS_BinScale; + if ( bs > 32767 ) bs = 32768-bs; + float bsf = ldexpf(1.0f, bs); + + bignum[0] = dpos; + bignum[1] = bms ? bpos : -999; + intnum[0] = BDS_NumBits; + + /* fltnum[0] = 1.0; */ + fltnum[0] = powf(10.0f, (float)PDS_DecimalScale); + fltnum[1] = bsf; + fltnum[2] = (float)BDS_RefValue; + /* + printf("intnum %d %d %d\n", intnum[0], intnum[1], intnum[2]); + printf("fltnum %g %g %g\n", fltnum[0], fltnum[1], fltnum[2]); + */ + return 0; +} + +static +int get_level(unsigned char *pds) +{ + int level = 0; + + if ( PDS_LevelType == 100 ) + level = PDS_Level * 100; + else if ( PDS_LevelType == 99 ) + level = PDS_Level; + else if ( PDS_LevelType == 109 ) + level = PDS_Level; + else + level = PDS_Level1; + + return level; +} + +static +double get_cr(unsigned char *w1, unsigned char *w2) +{ + unsigned s1 = GET_UINT3(w1[0], w1[1], w1[2]); + unsigned s2 = GET_UINT3(w2[0], w2[1], w2[2]); + return ((double)s1)/s2; +} + + +static void grib1PrintALL(int nrec, long offset, long recpos, long recsize, unsigned char *gribbuffer) +{ + static bool header = true; + unsigned char *is = NULL, *pds = NULL, *gds = NULL, *bms = NULL, *bds = NULL; + + if ( header ) + { + fprintf(stdout, + " Rec : Off Position Size : V PDS GDS BMS BDS : Code Level : LType GType: CR LL\n"); +/* ----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+ */ + header = false; + } + + is = gribbuffer; + + unsigned gribsize = GET_UINT3(is[4], is[5], is[6]); + + long gribrecsize; + int nerr = grib1Sections(gribbuffer, recsize, &pds, &gds, &bms, &bds, &gribrecsize); + if ( nerr < 0 ) + { + fprintf(stdout, "%5d :%4ld %8ld %6ld : GRIB message error\n", nrec, offset, recpos, recsize); + return; + } + + int GridType = (gds == NULL) ? -1 : (int)GDS_GridType; + + int level = get_level(pds); + + unsigned bdslen = BDS_Len; + + bool llarge = (gribsize > JP23SET && bdslen <= 120); + + bdslen = correct_bdslen(bdslen, recsize, bds-gribbuffer); + + double cr = (((BDS_Flag >> 4)&1) && (BDS_Z == 128 || BDS_Z == 130)) ? get_cr(&bds[14], &gribbuffer[4]) : 1; + + fprintf(stdout, "%5d :%4ld %8ld %6ld :%2d%4d%5d %6d %6d : %3d %6d : %5d %5d %6.4g %c", + nrec, offset, recpos, recsize, GRIB_EDITION(is), + PDS_Len, GDS_Len, BMS_Len, bdslen, + PDS_Parameter, level, PDS_LevelType, GridType, cr, llarge?'T':'F'); + + if ( nerr > 0 ) fprintf(stdout, " <-- GRIB data corrupted!"); + fprintf(stdout, "\n"); +} + + +static void grib2PrintALL(int nrec, long offset, long recpos, long recsize, unsigned char *gribbuffer) +{ + static bool header = true; + unsigned char *is = NULL, *pds = NULL, *gds = NULL, *bms = NULL, *bds = NULL; + unsigned char *ids = NULL, *lus = NULL, *drs = NULL; + long ids_len = 0, lus_len = 0, gds_len = 0, pds_len = 0, drs_len = 0, bms_len = 0, bds_len = 0; + double cr = 1; + + if ( header ) + { + fprintf(stdout, + " Rec : Off Position Size : V IDS LUS GDS PDS DRS BMS BDS : Parameter Level : LType GType: CR\n"); +/* ----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+ */ + header = false; + } + + is = gribbuffer; + + int nerr = grib2Sections(gribbuffer, recsize, &ids, &lus, &gds, &pds, &drs, &bms, &bds); + if ( nerr ) + { + fprintf(stdout, "%5d :%4ld %8ld %6ld : error\n", nrec, offset, recpos, recsize); + return; + } + + if ( ids ) ids_len = GRIB2_SECLEN(ids); + if ( lus ) lus_len = GRIB2_SECLEN(lus); + if ( gds ) gds_len = GRIB2_SECLEN(gds); + if ( pds ) pds_len = GRIB2_SECLEN(pds); + if ( drs ) drs_len = GRIB2_SECLEN(drs); + if ( bms ) bms_len = GRIB2_SECLEN(bms); + if ( bds ) bds_len = GRIB2_SECLEN(bds); + + // double cr = (((BDS_Flag >> 4)&1) && (BDS_Z == 128 || BDS_Z == 130)) ? get_cr(&bds[14], &gribbuffer[4]) : 1; + + int dis = GET_UINT1(is[6]); + int gridtype = GET_UINT2(gds[12],gds[13]); + int paramcat = GET_UINT1(pds[9]); + int paramnum = GET_UINT1(pds[10]); + int level1type = GET_UINT1(pds[22]); + /* level1sf = GET_UINT1(pds[23]); */ + int level1 = GET_UINT4(pds[24],pds[25],pds[26],pds[27]); + /* level2type = GET_UINT1(pds[28]); */ + /* level2sf = GET_UINT1(pds[29]); */ + /* level2 = GET_UINT4(pds[30],pds[31],pds[32],pds[33]); */ + /* + printf("level %d %d %d %d %d %d %d\n", level1type, level1sf, level1, level1*level1sf, level2sf, level2, level2*level2sf); + */ + char paramstr[16]; + sprintf(paramstr, "%d.%d.%d", paramnum, paramcat, dis); + fprintf(stdout, "%5d :%4ld %8ld %6ld :%2d %3ld %3ld %3ld %3ld %4ld %6ld %6ld : %-9s %7d : %5d %5d %6.4g\n", + nrec, offset, recpos, recsize, GRIB_EDITION(is), + ids_len, lus_len, gds_len, pds_len, drs_len, bms_len, bds_len, + paramstr, level1, level1type, gridtype, cr); +} + + +void gribPrintALL(int nrec, long offset, long recpos, long recsize, unsigned char *gribbuffer) +{ + int gribversion = gribVersion(gribbuffer, (size_t)recsize); + + if ( gribversion == 0 || gribversion == 1 ) + grib1PrintALL(nrec, offset, recpos, recsize, gribbuffer); + else if ( gribversion == 2 ) + grib2PrintALL(nrec, offset, recpos, recsize, gribbuffer); + else + { + fprintf(stdout, "%5d :%4ld%9ld%7ld : GRIB version %d unsupported\n", + nrec, offset, recpos, recsize, gribversion); + } +} + + +static void grib1PrintPDS(int nrec, long recpos, long recsize, unsigned char *gribbuffer) +{ + static int header = 1; + unsigned char *is = NULL, *pds = NULL, *gds = NULL, *bms = NULL, *bds = NULL; + int century, subcenter, decimalscale; + int fc_num = 0; + int year = 0, date; + + UNUSED(recpos); + + if ( header ) + { + fprintf(stdout, + " Rec : PDS Tab Cen Sub Ver Grid Code LTyp Level1 Level2 Date Time P1 P2 TU TR NAVE Scale FCnum CT\n"); +/* ----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+ */ + header = 0; + } + + is = gribbuffer; + + long gribrecsize; + int nerr = grib1Sections(gribbuffer, recsize, &pds, &gds, &bms, &bds, &gribrecsize); + if ( nerr < 0 ) + { + fprintf(stdout, "%5d : GRIB message error\n", nrec); + return; + } + + switch(GRIB_EDITION(is)) + { + case 0: + year = GET_UINT1(pds[12]); + century = 1; + subcenter = 0; + decimalscale = 0; + break; + case 1: + year = PDS_Year; + century = PDS_Century; + subcenter = PDS_Subcenter; + decimalscale = PDS_DecimalScale; + break; + default: + fprintf(stderr, "Grib version %d not supported!", GRIB_EDITION(is)); + exit(EXIT_FAILURE); + } + + if ( PDS_Len > 28 ) + if ( PDS_CenterID == 98 || PDS_Subcenter == 98 || + (PDS_CenterID == 7 && PDS_Subcenter == 98) ) + if ( pds[40] == 1 ) + fc_num = GET_UINT1(pds[49]); + + if ( year < 0 ) + { + date = (-year)*10000+PDS_Month*100+PDS_Day; + century = -century; + } + else + { + date = year*10000+PDS_Month*100+PDS_Day; + } + + fprintf(stdout, "%5d :%4d%4d%4d%4d%4d %4d %4d%4d%7d%7d %8d%6d%3d%3d%3d%3d%5d%6d%5d%4d", nrec, + PDS_Len, PDS_CodeTable, PDS_CenterID, subcenter, PDS_ModelID, + PDS_GridDefinition, PDS_Parameter, PDS_LevelType, PDS_Level1, PDS_Level2, + date, PDS_Time, PDS_TimePeriod1, PDS_TimePeriod2, PDS_TimeUnit, PDS_TimeRange, + PDS_AvgNum, decimalscale, fc_num, century); + + if ( nerr > 0 ) fprintf(stdout, " <-- GRIB data corrupted!"); + fprintf(stdout, "\n"); +} + + +void gribPrintPDS(int nrec, long recpos, long recsize, unsigned char *gribbuffer) +{ + int gribversion = gribVersion(gribbuffer, (size_t)recsize); + + if ( gribversion == 0 || gribversion == 1 ) + grib1PrintPDS(nrec, recpos, recsize, gribbuffer); + /* + else if ( gribversion == 2 ) + grib2PrintPDS(nrec, recpos, recsize, gribbuffer); + */ + else + { + fprintf(stdout, "%5d :%4ld%9ld%7ld : GRIB version %d unsupported\n", + nrec, 0L, recpos, recsize, gribversion); + } +} + + +static void grib1PrintGDS(int nrec, long recpos, long recsize, unsigned char *gribbuffer) +{ + static int header = 1; + unsigned char *pds = NULL, *gds = NULL, *bms = NULL, *bds = NULL; + + UNUSED(recpos); + + if ( header ) + { + fprintf(stdout, + " Rec : GDS NV PVPL Typ : xsize ysize Lat1 Lon1 Lat2 Lon2 dx dy\n"); +/* ----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+ */ + header = 0; + } + + long gribrecsize; + int nerr = grib1Sections(gribbuffer, recsize, &pds, &gds, &bms, &bds, &gribrecsize); + if ( nerr < 0 ) + { + fprintf(stdout, "%5d : GRIB message error\n", nrec); + return; + } + + fprintf(stdout, "%5d :", nrec); + + if ( gds ) + fprintf(stdout, "%4d%4d%4d %4d :%6d%6d%7d%7d%7d%7d%6d%6d", + GDS_Len, GDS_NV, GDS_PVPL, GDS_GridType, + GDS_NumLon, GDS_NumLat, + GDS_FirstLat, GDS_FirstLon, + GDS_LastLat, GDS_LastLon, + GDS_LonIncr, GDS_LatIncr); + else + fprintf(stdout, " Grid Description Section not defined"); + + if ( nerr > 0 ) fprintf(stdout, " <-- GRIB data corrupted!"); + fprintf(stdout, "\n"); +} + + +void gribPrintGDS(int nrec, long recpos, long recsize, unsigned char *gribbuffer) +{ + int gribversion = gribVersion(gribbuffer, (size_t)recsize); + + if ( gribversion == 0 || gribversion == 1 ) + grib1PrintGDS(nrec, recpos, recsize, gribbuffer); + /* + else if ( gribversion == 2 ) + grib2PrintGDS(nrec, recpos, recsize, gribbuffer); + */ + else + { + fprintf(stdout, "%5d :%4ld%9ld%7ld : GRIB version %d unsupported\n", + nrec, 0L, recpos, recsize, gribversion); + } +} + + +static void grib1PrintBMS(int nrec, long recpos, long recsize, unsigned char *gribbuffer) +{ + static int header = 1; + unsigned char *pds = NULL, *gds = NULL, *bms = NULL, *bds = NULL; + + UNUSED(recpos); + + if ( header ) + { + fprintf(stdout, + " Rec : Code Level BMS Size\n"); +/* ----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+ */ + header = 0; + } + + long gribrecsize; + int nerr = grib1Sections(gribbuffer, recsize, &pds, &gds, &bms, &bds, &gribrecsize); + if ( nerr < 0 ) + { + fprintf(stdout, "%5d : GRIB message error\n", nrec); + return; + } + + int level = get_level(pds); + + fprintf(stdout, "%5d :", nrec); + + if ( bms ) + fprintf(stdout, "%4d%7d %7d %7d", + PDS_Parameter, level, BMS_Len, BMS_BitmapSize); + else + fprintf(stdout, "%4d%7d Bit Map Section not defined", PDS_Parameter, level); + + if ( nerr > 0 ) fprintf(stdout, " <-- GRIB data corrupted!"); + fprintf(stdout, "\n"); +} + + +void gribPrintBMS(int nrec, long recpos, long recsize, unsigned char *gribbuffer) +{ + int gribversion = gribVersion(gribbuffer, (size_t)recsize); + + if ( gribversion == 0 || gribversion == 1 ) + grib1PrintBMS(nrec, recpos, recsize, gribbuffer); + /* + else if ( gribversion == 2 ) + grib2PrintBMS(nrec, recpos, recsize, gribbuffer); + */ + else + { + fprintf(stdout, "%5d :%4ld%9ld%7ld : GRIB version %d unsupported\n", + nrec, 0L, recpos, recsize, gribversion); + } +} + + +static void grib1PrintBDS(int nrec, long recpos, long recsize, unsigned char *gribbuffer) +{ + static int header = 1; + unsigned char *pds = NULL, *gds = NULL, *bms = NULL, *bds = NULL; + double scale; + + UNUSED(recpos); + + if ( header ) + { + fprintf(stdout, + " Rec : Code Level BDS Flag Scale RefValue Bits CR\n"); +/* ----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+ */ + header = 0; + } + + long gribrecsize; + int nerr = grib1Sections(gribbuffer, recsize, &pds, &gds, &bms, &bds, &gribrecsize); + if ( nerr < 0 ) + { + fprintf(stdout, "%5d : GRIB message error\n", nrec); + return; + } + + int level = get_level(pds); + + double cr = (((BDS_Flag >> 4)&1) && BDS_Z == 128) ? get_cr(&bds[17], &bds[20]) : 1; + + double refval = BDS_RefValue; + + if ( BDS_BinScale < 0 ) + scale = 1.0/pow(2.0, (double) -BDS_BinScale); + else + scale = pow(2.0, (double) BDS_BinScale); + + if ( PDS_DecimalScale ) + { + double decscale = pow(10.0, (double)-PDS_DecimalScale); + refval *= decscale; + scale *= decscale; + } + + fprintf(stdout, "%5d :", nrec); + + if ( bds ) + fprintf(stdout, "%4d%7d %7d %4d %8.5g %11.5g%4d %6.4g", + PDS_Parameter, level, + BDS_Len, BDS_Flag, scale, refval, BDS_NumBits, cr); + else + fprintf(stdout, " Binary Data Section not defined"); + + if ( nerr > 0 ) fprintf(stdout, " <-- GRIB data corrupted!"); + fprintf(stdout, "\n"); +} + + +void gribPrintBDS(int nrec, long recpos, long recsize, unsigned char *gribbuffer) +{ + int gribversion = gribVersion(gribbuffer, (size_t)recsize); + + if ( gribversion == 0 || gribversion == 1 ) + grib1PrintBDS(nrec, recpos, recsize, gribbuffer); + /* + else if ( gribversion == 2 ) + grib2PrintBDS(nrec, recpos, recsize, gribbuffer); + */ + else + { + fprintf(stdout, "%5d :%4ld%9ld%7ld : GRIB version %d unsupported\n", + nrec, 0L, recpos, recsize, gribversion); + } +} + + +void gribCheck1(int nrec, long recpos, long recsize, unsigned char *gribbuffer) +{ + unsigned char *pds = NULL, *gds = NULL, *bms = NULL, *bds = NULL; + + UNUSED(recpos); + + long gribrecsize; + int nerr = grib1Sections(gribbuffer, recsize, &pds, &gds, &bms, &bds, &gribrecsize); + if ( nerr < 0 ) + { + fprintf(stdout, "%5d : GRIB message error\n", nrec); + return; + } + + if ( nerr > 0 ) + { + fprintf(stdout, "%5d : <-- GRIB data corrupted!\n", nrec); + return; + } + + int level = get_level(pds); + + double cr = (((BDS_Flag >> 4)&1) && BDS_Z == 128) ? get_cr(&bds[17], &bds[20]) : 1; + + if ( IS_EQUAL(cr, 1) && BDS_NumBits == 24 ) + fprintf(stdout, "GRIB record %5d : code = %4d level = %7d\n", nrec, PDS_Parameter, level); +} + + +static +void repair1(unsigned char *gbuf, long gbufsize) +{ + unsigned char *pds = NULL, *gds = NULL, *bms = NULL, *bds = NULL; + /* int recLen; */ + unsigned char *source; + size_t sourceLen; + int bds_nbits, bds_flag, lspherc, lcomplex /*, lcompress */; + int bds_head = 11; + int bds_ext = 0, bds_ubits; + int datstart = 0; + + long gribrecsize; + int nerr = grib1Sections(gbuf, gbufsize, &pds, &gds, &bms, &bds, &gribrecsize); + if ( nerr < 0 ) + { + fprintf(stdout, "GRIB message error\n"); + return; + } + + if ( nerr > 0 ) + { + fprintf(stdout, "GRIB data corrupted!\n"); + return; + } + + unsigned bds_len = BDS_Len; + bds_nbits = BDS_NumBits; + bds_flag = BDS_Flag; + bds_ubits = bds_flag & 15; + lspherc = bds_flag >> 7; + lcomplex = (bds_flag >> 6)&1; + /* lcompress = (bds_flag >> 4)&1; */ + + if ( lspherc ) + { + if ( lcomplex ) + { + int jup, ioff; + jup = bds[15]; + ioff = (jup+1)*(jup+2); + bds_ext = 4 + 3 + 4*ioff; + } + else + { + bds_ext = 4; + } + } + + datstart = bds_head + bds_ext; + + source = bds + datstart; + + sourceLen = (size_t)(((((bds_len - datstart)*8-bds_ubits)/bds_nbits)*bds_nbits)/8); + + if ( bds_nbits == 24 ) + { + unsigned char *pbuf = (unsigned char*) Malloc(sourceLen);; + size_t nelem = sourceLen/3; + for (size_t i = 0; i < nelem; ++i) + { + pbuf[3*i ] = source[ i]; + pbuf[3*i+1] = source[ nelem+i]; + pbuf[3*i+2] = source[2*nelem+i]; + } + memcpy(source, pbuf, sourceLen); + Free(pbuf); + } +} + + +void gribRepair1(int nrec, long recsize, unsigned char *gribbuffer) +{ + unsigned char *pds = NULL, *gds = NULL, *bms = NULL, *bds = NULL; + + long gribrecsize; + int nerr = grib1Sections(gribbuffer, recsize, &pds, &gds, &bms, &bds, &gribrecsize); + if ( nerr < 0 ) + { + fprintf(stdout, "%5d : GRIB message error\n", nrec); + return; + } + + if ( nerr > 0 ) + { + fprintf(stdout, "%5d : <-- GRIB data corrupted!\n", nrec); + return; + } + + int level = get_level(pds); + + double cr = (((BDS_Flag >> 4)&1) && BDS_Z == 128) ? get_cr(&bds[17], &bds[20]) : 1; + + if ( IS_EQUAL(cr, 1) && BDS_NumBits == 24 ) + { + fprintf(stdout, "Repair GRIB record %5d : code = %4d level = %7d\n", nrec, PDS_Parameter, level); + repair1(gribbuffer, recsize); + } +} +#include <stdio.h> +#include <string.h> + +#if defined (HAVE_CONFIG_H) +#endif + +#if defined (HAVE_LIBSZ) +#if defined(__cplusplus) +extern "C" { +#endif +#include <szlib.h> +#ifdef __cplusplus +} +#endif + +#define OPTIONS_MASK (SZ_RAW_OPTION_MASK | SZ_MSB_OPTION_MASK | SZ_NN_OPTION_MASK) + +#define PIXELS_PER_BLOCK (8) +#define PIXELS_PER_SCANLINE (PIXELS_PER_BLOCK*128) + +#define MIN_COMPRESS (0.95) +#define MIN_SIZE (256) +#endif + +#define Z_SZIP 128 + +#if defined (HAVE_LIBSZ) || defined (HAVE_LIBAEC) +#define SetLen3(var, offset, value) ((var[offset+0] = 0xFF & (value >> 16)), \ + (var[offset+1] = 0xFF & (value >> 8)), \ + (var[offset+2] = 0xFF & (value ))) +#define SetLen4(var, offset, value) ((var[offset+0] = 0xFF & (value >> 24)), \ + (var[offset+1] = 0xFF & (value >> 16)), \ + (var[offset+2] = 0xFF & (value >> 8)), \ + (var[offset+3] = 0xFF & (value ))) +#endif + +int gribGetZip(size_t recsize, unsigned char *gribbuffer, size_t *urecsize) +{ + int compress = 0; + unsigned char *pds = NULL, *gds = NULL, *bms = NULL, *bds = NULL; + + int gribversion = gribVersion(gribbuffer, recsize); + + if ( gribversion == 2 ) return compress; + + long gribrecsize; + int nerr = grib1Sections(gribbuffer, (long)recsize, &pds, &gds, &bms, &bds, &gribrecsize); + if ( nerr < 0 ) + { + fprintf(stdout, "GRIB message error\n"); + return compress; + } + + if ( nerr > 0 ) + { + fprintf(stdout, "GRIB data corrupted!\n"); + return compress; + } + + /* bds_len = BDS_Len; */ + /* bds_nbits = BDS_NumBits; */ + int bds_flag = BDS_Flag; + /* lspherc = bds_flag >> 7; */ + /* lcomplex = (bds_flag >> 6)&1; */ + int lcompress = (bds_flag >> 4)&1; + + size_t gribsize = 0; + if ( lcompress ) + { + compress = BDS_Z; + if ( compress == Z_SZIP ) gribsize = (size_t) GET_UINT3(bds[14], bds[15], bds[16]); + } + + *urecsize = gribsize; + + return compress; +} + + +int gribZip(unsigned char *dbuf, long dbufsize, unsigned char *sbuf, long sbufsize) +{ +#if ! defined(HAVE_LIBSZ) + static int libszwarn = 1; +#endif + unsigned char *pds = NULL, *gds = NULL, *bms = NULL, *bds = NULL; + bool llarge = false; + + unsigned gribLen = GET_UINT3(dbuf[4], dbuf[5], dbuf[6]); + + int rec_len = gribLen; + + long gribrecsize; + int nerr = grib1Sections(dbuf, dbufsize, &pds, &gds, &bms, &bds, &gribrecsize); + if ( nerr < 0 ) + { + fprintf(stdout, "GRIB message error\n"); + return gribrecsize; + } + + if ( nerr > 0 ) + { + fprintf(stdout, "GRIB data corrupted!\n"); + return gribrecsize; + } + + int bds_zoffset = 12; + + int bds_len = BDS_Len; + if ( gribLen > JP23SET && bds_len <= 120 ) + { + gribLen &= JP23SET; + gribLen *= 120; + bds_len = correct_bdslen(bds_len, gribLen, bds-dbuf); + llarge = true; + bds_zoffset += 2; + } + + if ( gribLen > JP24SET || llarge ) return gribLen; + +#if defined(HAVE_LIBSZ) + { + int bds_zstart = 14; + unsigned gribLenOld = 0; + int bds_head = 11; + int bds_ext = 0; + unsigned char *pbuf = NULL; + + int bds_nbits = BDS_NumBits; + int bds_flag = BDS_Flag; + int bds_ubits = bds_flag & 15; + int lspherc = bds_flag >> 7; + int lcomplex = (bds_flag >> 6)&1; + /* lcompress = (bds_flag >> 4)&1; */ + + if ( bds_nbits != 8 && bds_nbits != 16 && bds_nbits != 24 && bds_nbits != 32 ) + { + static bool linfo = true; + if ( linfo && bds_nbits != 0 ) + { + linfo = false; + fprintf(stderr, "GRIB szip supports only 8, 16, 24 and 32 bit data!\n"); + } + return rec_len; + } + + int bits_per_sample = (bds_nbits == 24) ? 8 : bds_nbits; + + SZ_com_t sz_param; /* szip parameter block */ + sz_param.options_mask = OPTIONS_MASK; + sz_param.bits_per_pixel = bits_per_sample; + sz_param.pixels_per_block = PIXELS_PER_BLOCK; + sz_param.pixels_per_scanline = PIXELS_PER_SCANLINE; + + if ( lspherc ) + { + bds_ext = 4; + if ( lcomplex ) + { + int jup = bds[15]; + int ioff = (jup+1)*(jup+2); + bds_ext += 3 + 4*ioff; + } + } + + size_t datstart = bds_head + bds_ext; + + size_t datsize = ((((bds_len - datstart)*8-bds_ubits)/bds_nbits)*bds_nbits)/8; + + if ( datsize < MIN_SIZE ) return rec_len; + /* + fprintf(stderr, "%d %d %d %d\n", bds_len, datstart, bds_len - datstart, datsize); + */ + size_t sourceLen = datsize; + size_t destLen = sbufsize; + + unsigned char *source = bds + datstart; + unsigned char *dest = sbuf; + + if ( bds_nbits == 24 ) + { + long nelem = sourceLen/3; + pbuf = (unsigned char*) Malloc(sourceLen); + for (long i = 0; i < nelem; ++i) + { + pbuf[ i] = source[3*i ]; + pbuf[ nelem+i] = source[3*i+1]; + pbuf[2*nelem+i] = source[3*i+2]; + } + source = pbuf; + } + + int status = SZ_BufftoBuffCompress(dest, &destLen, source, sourceLen, &sz_param); + if ( status != SZ_OK ) + { + if ( status == SZ_NO_ENCODER_ERROR ) + Warning("SZ_NO_ENCODER_ERROR code %3d level %3d", PDS_Parameter, PDS_Level2); + else if ( status == SZ_PARAM_ERROR ) + Warning("SZ_PARAM_ERROR code %3d level %3d", PDS_Parameter, PDS_Level2); + else if ( status == SZ_MEM_ERROR ) + Warning("SZ_MEM_ERROR code %3d level %3d", PDS_Parameter, PDS_Level2); + else if ( status == SZ_OUTBUFF_FULL ) + /*Warning("SZ_OUTBUFF_FULL code %3d level %3d", PDS_Parameter, PDS_Level2)*/; + else + Warning("SZ ERROR: %d code %3d level %3d", status, PDS_Parameter, PDS_Level2); + } + + if ( pbuf ) Free(pbuf); + /* + fprintf(stderr, "sourceLen, destLen %d %d\n", sourceLen, destLen); + */ + if ( destLen < MIN_COMPRESS*sourceLen ) + { + source = bds + datstart + bds_zoffset; + memcpy(source, dest, destLen); + + /* ----++++ number of unused bits at end of section) */ + + BDS_Flag -= bds_ubits; + + gribLenOld = gribLen; + + if ( bds_ext ) + for (long i = bds_ext-1; i >= 0; --i) + bds[bds_zoffset+bds_head+i] = bds[bds_head+i]; + + /* + fprintf(stderr, "destLen, datsize, datstart %d %d %d\n", destLen, datsize, datstart); + */ + /* memcpy(bds + datstart + bds_zoffset, source, destLen); */ + /* + fprintf(stderr, "z>>> %d %d %d %d <<<\n", (int) bds[0+datstart+bds_zoffset], + (int)bds[1+datstart+bds_zoffset], (int)bds[2+datstart+bds_zoffset], (int)bds[3+datstart+bds_zoffset]); + */ + if ( llarge ) + { + if ( gribLenOld%120 ) + { + fprintf(stderr, "Internal problem, record length not multiple of 120!"); + while ( gribLenOld%120 ) gribLenOld++; + } + // gribLenOld = gribLenOld / (-120); + // gribLenOld = JP23SET - gribLenOld + 1; + + SetLen3(bds, bds_zstart, gribLenOld); + SetLen4(bds, bds_zstart+3, sourceLen); + SetLen4(bds, bds_zstart+7, destLen); + } + else + { + SetLen3(bds, bds_zstart, gribLenOld); + SetLen3(bds, bds_zstart+3, sourceLen); + SetLen3(bds, bds_zstart+6, destLen); + } + + int bdsLen = datstart + bds_zoffset + destLen; + + bds[11] = 0; + bds[12] = 0; + + BDS_Z = Z_SZIP; + + BDS_Flag += 16; + if ( (bdsLen%2) == 1 ) + { + BDS_Flag += 8; + bds[bdsLen++] = 0; + } + + SetLen3(bds, 0, bdsLen); + + gribLen = (bds - dbuf) + bdsLen; + + dbuf[gribLen++] = '7'; + dbuf[gribLen++] = '7'; + dbuf[gribLen++] = '7'; + dbuf[gribLen++] = '7'; + + if ( llarge ) + { + long bdslen = gribLen - 4; + + /* + If a very large product, the section 4 length field holds + the number of bytes in the product after section 4 upto + the end of the padding bytes. + This is a fixup to get round the restriction on product lengths + due to the count being only 24 bits. It is only possible because + the (default) rounding for GRIB products is 120 bytes. + */ + while ( gribLen%120 ) dbuf[gribLen++] = 0; + + long itemp = gribLen / (-120); + itemp = JP23SET - itemp + 1; + + SetLen3(dbuf, 4, itemp); + + bdslen = gribLen - bdslen; + + SetLen3(bds, 0, bdslen); + } + else + { + SetLen3(dbuf, 4, gribLen); + } + } + else + { + } + /* + fprintf(stderr, "%3d %3d griblen in %6d out %6d CR %g slen %6d dlen %6d CR %g\n", + PDS_Parameter, PDS_Level1, gribLenOld, gribLen, + ((double)gribLenOld)/gribLen, sourceLen, destLen, + ((double)sourceLen)/destLen); + */ + } + +#else + + UNUSED(sbuf); + UNUSED(sbufsize); + + if ( libszwarn ) + { + Warning("Compression disabled, szlib not available!"); + libszwarn = 0; + } +#endif + + if ( llarge ) + while ( gribLen%120 ) dbuf[gribLen++] = 0; + else + while ( gribLen & 7 ) dbuf[gribLen++] = 0; + + rec_len = gribLen; + + return rec_len; +} + + +int gribUnzip(unsigned char *dbuf, long dbufsize, unsigned char *sbuf, long sbufsize) +{ +#if ! defined(HAVE_LIBSZ) + static int libszwarn = 1; +#endif + unsigned char *pds = NULL, *gds = NULL, *bms = NULL, *bds = NULL; + size_t gribLen = 0; + size_t destLen, sourceLen; + enum { bds_head = 11 }; + int bds_ext = 0; + + UNUSED(dbufsize); + + long gribrecsize; + int nerr = grib1Sections(sbuf, sbufsize, &pds, &gds, &bms, &bds, &gribrecsize); + if ( nerr < 0 ) + { + fprintf(stdout, "GRIB message error\n"); + return 0; + } + + if ( nerr > 0 ) + { + fprintf(stdout, "GRIB data corrupted!\n"); + return 0; + } + + //unsigned bds_len = BDS_Len; + bool llarge = false; + + int bds_zoffset = 12; + if ( llarge ) bds_zoffset += 2; + + int bds_nbits = BDS_NumBits; + int bds_flag = BDS_Flag; + int lspherc = bds_flag >> 7; + int lcomplex = (bds_flag >> 6)&1; + /* lcompress = (bds_flag >> 4)&1; */ + + if ( lspherc ) + { + if ( lcomplex ) + { + int jup = bds[bds_zoffset+15]; + int ioff = (jup+1)*(jup+2); + bds_ext = 4 + 3 + 4*ioff; + } + else + { + bds_ext = 4; + } + } + + size_t datstart = bds_head + (size_t)bds_ext; + + unsigned char *source = bds + datstart + bds_zoffset; + if ( llarge ) + sourceLen = ((size_t) ((bds[21]<<24)+(bds[22]<<16)+(bds[23]<<8)+bds[24])); + else + sourceLen = ((size_t) ((bds[20]<<16)+(bds[21]<<8)+bds[22])); + + nerr = grib1Sections(dbuf, sbufsize, &pds, &gds, &bms, &bds, &gribrecsize); + if ( nerr < 0 ) + { + fprintf(stdout, "GRIB message error\n"); + return 0; + } + + if ( nerr > 0 ) + { + fprintf(stdout, "GRIB data corrupted!\n"); + return 0; + } + + unsigned char *dest = bds + datstart; + if ( llarge ) + destLen = ((size_t) ((bds[17]<<24)+(bds[18]<<16)+(bds[19]<<8)+bds[20])); + else + destLen = ((size_t) ((bds[17]<<16)+(bds[18]<<8)+bds[19])); + + BDS_Flag = (unsigned char)(BDS_Flag - 16); + + size_t bdsLen = datstart + destLen; + +#if defined(HAVE_LIBSZ) + { + int bds_zstart = 14; + unsigned recLen = GET_UINT3(bds[bds_zstart], bds[bds_zstart+1], bds[bds_zstart+2]); + + int bits_per_sample = (bds_nbits == 24) ? 8 : bds_nbits; + + SZ_com_t sz_param; /* szip parameter block */ + sz_param.options_mask = OPTIONS_MASK; + sz_param.bits_per_pixel = bits_per_sample; + sz_param.pixels_per_block = PIXELS_PER_BLOCK; + sz_param.pixels_per_scanline = PIXELS_PER_SCANLINE; + + if ( bds_ext ) + for (long i = 0; i < bds_ext; ++i) + bds[bds_head+i] = bds[bds_zoffset+bds_head+i]; + + /* fprintf(stderr, "gribUnzip: sourceLen %ld; destLen %ld\n", (long)sourceLen, (long)destLen); + fprintf(stderr, "gribUnzip: sourceOff %d; destOff %d\n", bds[12], bds[11]); + fprintf(stderr, "gribUnzip: reclen %d; bdslen %d\n", recLen, bdsLen); + */ + + size_t tmpLen = destLen; + + int status = SZ_BufftoBuffDecompress(dest, &tmpLen, source, sourceLen, &sz_param); + if ( status != SZ_OK ) + { + if ( status == SZ_NO_ENCODER_ERROR ) + Warning("SZ_NO_ENCODER_ERROR code %3d level %3d", PDS_Parameter, PDS_Level2); + else if ( status == SZ_PARAM_ERROR ) + Warning("SZ_PARAM_ERROR code %3d level %3d", PDS_Parameter, PDS_Level2); + else if ( status == SZ_MEM_ERROR ) + Warning("SZ_MEM_ERROR code %3d level %3d", PDS_Parameter, PDS_Level2); + else if ( status == SZ_OUTBUFF_FULL ) + Warning("SZ_OUTBUFF_FULL code %3d level %3d", PDS_Parameter, PDS_Level2); + else + Warning("SZ ERROR: %d code %3d level %3d", status, PDS_Parameter, PDS_Level2); + } + /* + fprintf(stderr, "gribUnzip: sl = %ld dl = %ld tl = %ld\n", + (long)sourceLen, (long)destLen,(long) tmpLen); + */ + if ( tmpLen != destLen ) + Warning("unzip size differ: code %3d level %3d ibuflen %ld ubuflen %ld", + PDS_Parameter, PDS_Level2, (long) destLen, (long) tmpLen); + + if ( bds_nbits == 24 ) + { + long nelem = tmpLen/3; + unsigned char *pbuf = (unsigned char*) Malloc(tmpLen); + for (long i = 0; i < nelem; ++i) + { + pbuf[3*i ] = dest[ i]; + pbuf[3*i+1] = dest[ nelem+i]; + pbuf[3*i+2] = dest[2*nelem+i]; + } + memcpy(dest, pbuf, tmpLen); + Free(pbuf); + } + + int bds_ubits = BDS_Flag & 15; + BDS_Flag -= bds_ubits; + + if ( (bdsLen%2) == 1 ) + { + BDS_Flag += 8; + bds[bdsLen++] = 0; + } + + SetLen3(bds, 0, bdsLen); + + gribLen = (bds - dbuf) + bdsLen; + + dbuf[gribLen++] = '7'; + dbuf[gribLen++] = '7'; + dbuf[gribLen++] = '7'; + dbuf[gribLen++] = '7'; + + if ( llarge ) + { + long itemp; + bdsLen = gribLen - 4; + /* + If a very large product, the section 4 length field holds + the number of bytes in the product after section 4 upto + the end of the padding bytes. + This is a fixup to get round the restriction on product lengths + due to the count being only 24 bits. It is only possible because + the (default) rounding for GRIB products is 120 bytes. + */ + while ( gribLen%120 ) dbuf[gribLen++] = 0; + + if ( gribLen != (size_t)recLen ) + fprintf(stderr, "Internal problem, recLen and gribLen differ!\n"); + + itemp = gribLen / (-120); + itemp = JP23SET - itemp + 1; + + SetLen3(dbuf, 4, itemp); + + bdsLen = gribLen - bdsLen; + + SetLen3(bds, 0, bdsLen); + } + else + { + SetLen3(dbuf, 4, recLen); + } + /* + fprintf(stderr, "recLen, gribLen, bdsLen %d %d %d\n", recLen, gribLen, bdsLen); + */ + if ( llarge ) + while ( gribLen%120 ) dbuf[gribLen++] = 0; + else + while ( gribLen & 7 ) dbuf[gribLen++] = 0; + /* + fprintf(stderr, "recLen, gribLen, bdsLen %d %d %d\n", recLen, gribLen, bdsLen); + */ + } +#else + UNUSED(bds_nbits); + UNUSED(sourceLen); + UNUSED(source); + UNUSED(bdsLen); + UNUSED(dest); + + if ( libszwarn ) + { + Warning("Decompression disabled, szlib not available!"); + libszwarn = 0; + } +#endif + + return (int)gribLen; +} +#include <stdio.h> +#include <math.h> + + +static void +scm0_double(double *pdl, double *pdr, double *pfl, double *pfr, int klg); + + +static +int rowina2(double *p, int ko, int ki, double *pw, + int kcode, double msval, int *kret) +{ + /* System generated locals */ + int pw_dim1, pw_offset, i_1; + + /* Local variables */ + double zwt1, zrdi, zpos; + int ip; + double zdo, zwt; + + /* Parameter adjustments */ + --p; + pw_dim1 = ko + 3; + pw_offset = pw_dim1; + pw -= pw_offset; + + /* **** ROWINA2 - Interpolation of row of values. */ + /* Input Parameters. */ + /* ----------------- */ + /* P - Row of values to be interpolated. */ + /* Dimension must be at least KO. */ + /* KO - Number of values required. */ + /* KI - Number of values in P on input. */ + /* PW - Working array. */ + /* Dimension must be at least (0:KO+2,3). */ + /* KCODE - Interpolation required. */ + /* 1 , linear. */ + /* 3 , cubic. */ + /* PMSVAL - Value used for missing data indicator. */ + + /* Output Parameters. */ + /* ------------------ */ + /* P - Now contains KO values. */ + /* KRET - Return code */ + /* 0, OK */ + /* Non-zero, error */ + + /* Author. */ + /* ------- */ + /* J.D.Chambers ECMWF 22.07.94 */ + + /* ******************************** */ + /* Section 1. Linear interpolation .. */ + /* ******************************** */ + + *kret = 0; + + if ( kcode == 1 ) + { + /* Move input values to work array */ + for (int jl = 1; jl <= ki; ++jl) + pw[jl + pw_dim1] = p[jl]; + + /* Arrange wrap-around value in work array */ + pw[ki + 1 + pw_dim1] = p[1]; + + /* Set up constants to be used to figure out weighting for */ + /* values in interpolation. */ + zrdi = (double) ki; + zdo = 1.0 / (double) ko; + + /* Loop through the output points */ + for (int jl = 1; jl <= ko; ++jl) + { + + /* Calculate weight from the start of row */ + zpos = (jl - 1) * zdo; + zwt = zpos * zrdi; + + /* Get the current array position(minus 1) from the weight - */ + /* note the implicit truncation. */ + ip = (int) zwt; + + /* If the left value is missing, use the right value */ + if ( IS_EQUAL(pw[ip + 1 + pw_dim1], msval) ) + { + p[jl] = pw[ip + 2 + pw_dim1]; + } + /* If the right value is missing, use the left value */ + else if ( IS_EQUAL(pw[ip + 2 + pw_dim1], msval) ) + { + p[jl] = pw[ip + 1 + pw_dim1]; + } + /* If neither missing, interpolate ... */ + else + { + + /* Adjust the weight to range (0.0 to 1.0) */ + zwt -= ip; + + /* Interpolate using the weighted values on either side */ + /* of the output point position */ + p[jl] = (1.0 - zwt) * pw[ip + 1 + pw_dim1] + + zwt * pw[ip + 2 + pw_dim1]; + } + } + + /* ******************************* */ + /* Section 2. Cubic interpolation .. */ + /* ******************************* */ + + } + else if ( kcode == 3 ) + { + i_1 = ki; + for (int jl = 1; jl <= i_1; ++jl) + { + if ( IS_EQUAL(p[jl], msval) ) + { + fprintf(stderr," ROWINA2: "); + fprintf(stderr," Cubic interpolation not supported"); + fprintf(stderr," for fields containing missing data.\n"); + *kret = 1; + goto L900; + } + pw[jl + pw_dim1] = p[jl]; + } + pw[pw_dim1] = p[ki]; + pw[ki + 1 + pw_dim1] = p[1]; + pw[ki + 2 + pw_dim1] = p[2]; + i_1 = ki; + for (int jl = 1; jl <= i_1; ++jl) + { + pw[jl + (pw_dim1 << 1)] = + - pw[jl - 1 + pw_dim1] / 3.0 - + pw[jl + pw_dim1] * 0.5 + + pw[jl + 1 + pw_dim1] - pw[jl + 2 + pw_dim1] / 6.0; + pw[jl + 1 + pw_dim1 * 3] = + pw[jl - 1 + pw_dim1] / 6.0 - + pw[jl + pw_dim1] + + pw[jl + 1 + pw_dim1] * 0.5 + + pw[jl + 2 + pw_dim1] / 3.0; + } + + scm0_double(&pw[(pw_dim1 << 1) + 1], &pw[pw_dim1 * 3 + 2], + &pw[pw_dim1 + 1], &pw[pw_dim1 + 2], ki); + + zrdi = (double) ki; + zdo = 1.0 / (double) ko; + for (int jl = 1; jl <= ko; ++jl) + { + zpos = (jl - 1) * zdo; + zwt = zpos * zrdi; + ip = (int) zwt + 1; + zwt = zwt + 1.0 - ip; + zwt1 = 1.0 - zwt; + p[jl] = ((3.0 - zwt1 * 2.0) * pw[ip + pw_dim1] + + zwt * pw[ip + (pw_dim1 << 1)]) * zwt1 * zwt1 + + ((3.0 - zwt * 2.0) * pw[ip + 1 + pw_dim1] - + zwt1 * pw[ip + 1 + pw_dim1 * 3]) * zwt * zwt; + } + + } + else + { + /* ************************************** */ + /* Section 3. Invalid interpolation code .. */ + /* ************************************** */ + fprintf(stderr," ROWINA2:"); + fprintf(stderr," Invalid interpolation code = %2d\n",kcode); + *kret = 2; + } + +L900: + return 0; +} /* rowina2 */ + + + +int qu2reg2(double *pfield, int *kpoint, int klat, int klon, + double *ztemp, double msval, int *kret) +{ + /* System generated locals */ + int i_1, i_2; + int kcode = 1; + + /* Local variables */ + int ilii, ilio, icode; + double *zline = NULL; + double *zwork = NULL; + int iregno, iquano; + + + zline = (double*) Malloc(2*(size_t)klon*sizeof(double)); + if ( zline == NULL ) SysError("No Memory!"); + + zwork = (double*) Malloc(3*(2*(size_t)klon+3)*sizeof(double)); + if ( zwork == NULL ) SysError("No Memory!"); + + /* Parameter adjustments */ + --pfield; + --kpoint; + +/* **** QU2REG - Convert quasi-regular grid data to regular. */ +/* Input Parameters. */ +/* ----------------- */ +/* PFIELD - Array containing quasi-regular grid */ +/* data. */ +/* KPOINT - Array containing list of the number of */ +/* points on each latitude (or longitude) of */ +/* the quasi-regular grid. */ +/* KLAT - Number of latitude lines */ +/* KLON - Number of longitude lines */ +/* KCODE - Interpolation required. */ +/* 1 , linear - data quasi-regular on */ +/* latitude lines. */ +/* 3 , cubic - data quasi-regular on */ +/* latitude lines. */ +/* 11, linear - data quasi-regular on */ +/* longitude lines. */ +/* 13, cubic - data quasi-regular on */ +/* longitude lines. */ +/* PMSVAL - Value used for missing data indicator. */ +/* Output Parameters. */ +/* ------------------ */ +/* KRET - return code */ +/* 0 = OK */ +/* non-zero indicates fatal error */ +/* PFIELD - Array containing regular grid data. */ +/* Author. */ +/* ------- */ +/* J.D.Chambers ECMWF 22.07.94 */ +/* J.D.Chambers ECMWF 13.09.94 */ +/* Add return code KRET and remove calls to ABORT. */ + + +/* ------------------------------ */ +/* Section 1. Set initial values. */ +/* ------------------------------ */ + + *kret = 0; + +/* Check input parameters. */ + + if (kcode != 1 && kcode != 3 && kcode != 11 && kcode != 13) { + fprintf(stderr," QU2REG :"); + fprintf(stderr," Invalid interpolation type code = %2d\n",kcode); + *kret = 1; + goto L900; + } + +/* Set array indices to 0. */ + + ilii = 0; + ilio = 0; + +/* Establish values of loop parameters. */ + + if (kcode > 10) { + +/* Quasi-regular along longitude lines. */ + + iquano = klon; + iregno = klat; + icode = kcode - 10; + } else { + +/* Quasi-regular along latitude lines. */ + + iquano = klat; + iregno = klon; + icode = kcode; + } + +/* -------------------------------------------------------- */ +/** Section 2. Interpolate field from quasi to regular grid. */ +/* -------------------------------------------------------- */ + + i_1 = iquano; + for (int j230 = 1; j230 <= i_1; ++j230) { + + if (iregno != kpoint[j230]) { + +/* Line contains less values than required,so */ +/* extract quasi-regular grid values for a line */ + + i_2 = kpoint[j230]; + for (int j210 = 1; j210 <= i_2; ++j210) { + ++ilii; + zline[j210 - 1] = pfield[ilii]; + } + +/* and interpolate this line. */ + + rowina2(zline, iregno, kpoint[j230], zwork, icode, msval, kret); + if (*kret != 0) goto L900; + +/* Add regular grid values for this line to the + temporary array. */ + + i_2 = iregno; + for (int j220 = 1; j220 <= i_2; ++j220) { + ++ilio; + ztemp[ilio - 1] = zline[j220 - 1]; + } + + } else { + +/* Line contains the required number of values, so add */ +/* this line to the temporary array. */ + + i_2 = iregno; + for (int j225 = 1; j225 <= i_2; ++j225) { + ++ilio; + ++ilii; + ztemp[ilio - 1] = pfield[ilii]; + } + } + } + + /* Copy temporary array to user array. */ + + i_1 = klon * klat; + for (int j240 = 1; j240 <= i_1; ++j240) { + pfield[j240] = ztemp[j240 - 1]; + } + +/* -------------------------------------------------------- */ +/* Section 9. Return to calling routine. Format statements. */ +/* -------------------------------------------------------- */ + +L900: + + Free(zline); + Free(zwork); + + return 0; +} /* qu2reg2 */ + + + +#ifdef T +#undef T +#endif +#define T double +#ifdef T + +/* calculate_pfactor: source code from grib_api-1.8.0 */ +double TEMPLATE(calculate_pfactor,T)(const T *spectralField, long fieldTruncation, long subsetTruncation) +{ + /*long n_vals = ((fieldTruncation+1)*(fieldTruncation+2));*/ + long loop, index, m, n = 0; + double zeps = 1.0e-15; + long ismin = (subsetTruncation+1), ismax = (fieldTruncation+1); + double weightedSumOverX = 0.0, weightedSumOverY = 0.0, sumOfWeights = 0.0; + double numerator = 0.0, denominator = 0.0; + + // Setup the weights + + double range = (double) (ismax - ismin +1); + + double *weights = (double*) Malloc(((size_t)ismax+1)*sizeof(double)); + for( loop = ismin; loop <= ismax; loop++ ) + weights[loop] = range / (double) (loop-ismin+1); + + // Compute norms + // Handle values 2 at a time (real and imaginary parts). + double *norms = (double*) Malloc(((size_t)ismax+1)*sizeof(double)); + + for( loop = 0; loop < ismax+1; loop++ ) norms[loop] = 0.0; + + // Form norms for the rows which contain part of the unscaled subset. + + index = -2; + for( m = 0; m < subsetTruncation; m++ ) + for( n = m; n <= fieldTruncation; n++ ) { + index += 2; + if( n >= subsetTruncation ) { + double tval = spectralField[index]; + tval=tval<0?-tval:tval; + norms[n] = norms[n] > tval ? norms[n] : tval; + tval = spectralField[index+1]; + tval=tval<0?-tval:tval; + norms[n] = norms[n] > tval ? norms[n] : tval; + } + } + + // Form norms for the rows which do not contain part of the unscaled subset. + + for( m = subsetTruncation; m <= fieldTruncation; m++ ) + for( n = m; n <= fieldTruncation; n++ ) { + double tval = spectralField[index]; + index += 2; + tval=tval<0?-tval:tval; + norms[n] = norms[n] > tval ? norms[n] : tval; + tval = spectralField[index+1]; + tval=tval<0?-tval:tval; + norms[n] = norms[n] > tval ? norms[n] : tval; + } + + // Ensure the norms have a value which is not too small in case of problems with math functions (e.g. LOG). + + for( loop = ismin; loop <= ismax; loop++ ) { + norms[n] = norms[n] > zeps ? norms[n] : zeps; + if( IS_EQUAL(norms[n], zeps) ) weights[n] = 100.0 * zeps; + } + + // Do linear fit to find the slope + + for( loop = ismin; loop <= ismax; loop++ ) { + double x = log( (double) (loop*(loop+1)) ); + double y = log( norms[loop] ); + weightedSumOverX += x * weights[loop]; + weightedSumOverY += y * weights[loop]; + sumOfWeights = sumOfWeights + weights[loop]; + } + weightedSumOverX /= sumOfWeights; + weightedSumOverY /= sumOfWeights; + + // Perform a least square fit for the equation + + for( loop = ismin; loop <= ismax; loop++ ) { + + double x = log( (double)(loop*(loop+1)) ); + double y = log( norms[loop] ); + numerator += weights[loop] * (y-weightedSumOverY) * (x-weightedSumOverX); + denominator += weights[loop] * ((x-weightedSumOverX) * (x-weightedSumOverX)); + } + double slope = numerator / denominator; + + Free(weights); + Free(norms); + + double pFactor = -slope; + if( pFactor < -9999.9 ) pFactor = -9999.9; + if( pFactor > 9999.9 ) pFactor = 9999.9; + + return pFactor; +} + +void TEMPLATE(scale_complex,T)(T *fpdata, int pcStart, int pcScale, int trunc, int inv) +{ + + if ( pcScale < -10000 || pcScale > 10000 ) + { + fprintf(stderr, " %s: Invalid power given %6d\n", __func__, pcScale); + return; + } + + // Setup scaling factors = n(n+1)^^p for n = 1 to truncation + + if ( pcScale != 0 ) + { + double *scale = (double*) Malloc(((size_t)trunc+1)*sizeof(double)); + const double power = (double) pcScale / 1000.; + scale[0] = 1.0; + + if (pcScale != 1000) + for (int n = 1; n <= trunc; ++n) scale[n] = pow((double) (n*(n+1)), power); + else + for (int n = 1; n <= trunc; ++n) scale[n] = (double) (n*(n+1)); + + if ( inv ) + for (int n = 1; n <= trunc; ++n) scale[n] = 1.0 / scale[n]; + + // Scale the values + + size_t index = 0; + + for (int m = 0; m < pcStart; ++m) + for (int n = m; n <= trunc; n++, index += 2) + if ( n >= pcStart ) + { + fpdata[index ] = (T)(fpdata[index ] * scale[n]); + fpdata[index+1] = (T)(fpdata[index+1] * scale[n]); + } + + for (int m = pcStart; m <= trunc; ++m) + for (int n = m; n <= trunc; n++, index += 2) + { + fpdata[index ] = (T)(fpdata[index ] * scale[n]); + fpdata[index+1] = (T)(fpdata[index+1] * scale[n]); + } + Free(scale); + } +} + + +void TEMPLATE(scatter_complex,T)(T *fpdata, int pcStart, int trunc, int nsp) +{ + T *fphelp = (T*) Malloc((size_t)nsp*sizeof(T)); + size_t inext = 0; + size_t pcStart_ = pcStart >= 0 ? (size_t)pcStart : 0U; + size_t trunc_ = trunc >= 0 ? (size_t)trunc : 0U; + for (size_t m = 0, index = 0; m <= pcStart_; ++m) + { + size_t n_copies = pcStart_ <= trunc_ ? (pcStart_ + 1 - m) * 2 : 0; + for (size_t i = 0; i < n_copies; ++i) fphelp[index + i] = fpdata[inext + i]; + inext += n_copies; + index += m <= trunc_ ? (trunc_ - m + 1) * 2 : 0; + } + for (size_t m = 0, index = 0; m <= trunc_; ++m) + { + size_t advIdx = m <= pcStart_ ? (pcStart_ - m + 1) * 2 : 0; + index += advIdx; + size_t copyStart = m > pcStart_ ? m : pcStart_ + 1; + size_t n_copies = copyStart <= trunc_ ? (trunc_ - copyStart + 1) * 2 : 0; + for (size_t i = 0; i < n_copies; ++i) fphelp[index + i] = fpdata[inext + i]; + inext += n_copies; + index += n_copies; + } + for (size_t m = 0; m < (size_t)nsp; ++m) fpdata[m] = fphelp[m]; + + Free(fphelp); +} + + +void TEMPLATE(gather_complex,T)(T *fpdata, size_t pcStart, size_t trunc, size_t nsp) +{ + T *restrict fphelp = (T*) Malloc(nsp*sizeof(T)); + size_t inext = 0; + + for (size_t m = 0, index = 0; m <= pcStart; ++m) + for (size_t n = m; n <= trunc; ++n) + { + if ( pcStart >= n ) + { + fphelp[inext++] = fpdata[index]; + fphelp[inext++] = fpdata[index+1]; + } + index += 2; + } + + for (size_t m = 0, index = 0; m <= trunc; ++m) + for (size_t n = m; n <= trunc; ++n) + { + if ( n > pcStart ) + { + fphelp[inext++] = fpdata[index]; + fphelp[inext++] = fpdata[index+1]; + } + index += 2; + } + + for (size_t m = 0; m < nsp; ++m) fpdata[m] = fphelp[m]; + + Free(fphelp); +} + + +static void TEMPLATE(scm0,T)(T *pdl, T *pdr, T *pfl, T *pfr, int klg) +{ + /* **** SCM0 - Apply SCM0 limiter to derivative estimates. */ + /* output: */ + /* pdl = the limited derivative at the left edge of the interval */ + /* pdr = the limited derivative at the right edge of the interval */ + /* inputs */ + /* pdl = the original derivative at the left edge */ + /* pdr = the original derivative at the right edge */ + /* pfl = function value at the left edge of the interval */ + /* pfr = function value at the right edge of the interval */ + /* klg = number of intervals where the derivatives are limited */ + + /* define constants */ + + double zeps = 1.0e-12; + double zfac = (1.0 - zeps) * 3.0; + + for (int jl = 0; jl < klg; ++jl) + { + double r_1; + if ( (r_1 = pfr[jl] - pfl[jl], fabs(r_1)) > zeps ) + { + double zalpha = pdl[jl] / (pfr[jl] - pfl[jl]); + double zbeta = pdr[jl] / (pfr[jl] - pfl[jl]); + if ( zalpha <= 0.0 ) pdl[jl] = 0.0; + if ( zbeta <= 0.0 ) pdr[jl] = 0.0; + if ( zalpha > zfac ) pdl[jl] = (T)(zfac * (pfr[jl] - pfl[jl])); + if ( zbeta > zfac ) pdr[jl] = (T)(zfac * (pfr[jl] - pfl[jl])); + } + else + { + pdl[jl] = 0.0; + pdr[jl] = 0.0; + } + } +} /* scm0 */ + +static +int TEMPLATE(rowina3,T)(T *p, int ko, int ki, T *pw, + int kcode, T msval, int *kret, int omisng, int operio, int oveggy) +{ + /* +C----> +C**** ROWINA3 - Interpolation of row of values. +C +C Purpose. +C -------- +C +C Interpolate a row of values. +C +C +C** Interface. +C ---------- +C +C CALL ROWINA3( P, KO, KI, PW, KCODE, PMSVAL, KRET, OMISNG, OPERIO) +C +C +C Input Parameters. +C ----------------- +C +C P - Row of values to be interpolated. +C Dimension must be at least KO. +C +C KO - Number of values required. +C +C KI - Number of values in P on input. +C +C PW - Working array. +C Dimension must be at least (0:KO+2,3). +C +C KCODE - Interpolation required. +C 1 , linear. +C 3 , cubic. +C +C PMSVAL - Value used for missing data indicator. +C +C OMISNG - True if missing values are present in field. +C +C OPERIO - True if input field is periodic. +C +C OVEGGY - True if 'nearest neighbour' processing must be used +C for interpolation +C +C Output Parameters. +C ------------------ +C +C P - Now contains KO values. +C KRET - Return code +C 0, OK +C Non-zero, error +C +C +C Method. +C ------- +C +C Linear or cubic interpolation performed as required. +C +C Comments. +C --------- +C +C This is a version of ROWINA which allows for missing data +C values and hence for bitmapped fields. +C +C +C Author. +C ------- +C +C J.D.Chambers ECMWF 22.07.94 +C +C +C Modifications. +C -------------- +C +C J.D.Chambers ECMWF 13.09.94 +C Add return code KRET and remove calls to ABORT. +C +C J. Clochard, Meteo France, for ECMWF - January 1998. +C Addition of OMISNG and OPERIO arguments. +C +C +C ----------------------------------------------------------------- +*/ + /* System generated locals */ + int pw_dim1, pw_offset, i_1; + + /* Local variables */ + int ip; + double zwt1, zrdi, zpos; + double zdo, zwt; + + UNUSED(omisng); + + /* Parameter adjustments */ + --p; + pw_dim1 = ko + 3; + pw_offset = pw_dim1; + pw -= pw_offset; + + *kret = 0; + + if ( kcode == 1 ) + { + /* Move input values to work array */ + for (int jl = 1; jl <= ki; ++jl) + pw[jl + pw_dim1] = p[jl]; + + if ( operio ) + { + /* Arrange wrap-around value in work array */ + pw[ki + 1 + pw_dim1] = p[1]; + + /* Set up constants to be used to figure out weighting for */ + /* values in interpolation. */ + zrdi = (double) ki; + zdo = 1.0 / (double) ko; + } + else + { + /* Repeat last value, to cope with "implicit truncation" below */ + pw[ki + 1 + pw_dim1] = p[ki]; + + /* Set up constants to be used to figure out weighting for */ + /* values in interpolation. */ + zrdi = (double) (ki-1); + zdo = 1.0 / (double) (ko-1); + } + + /* Loop through the output points */ + for (int jl = 1; jl <= ko; ++jl) + { + + /* Calculate weight from the start of row */ + zpos = (jl - 1) * zdo; + zwt = zpos * zrdi; + + /* Get the current array position(minus 1) from the weight - */ + /* note the implicit truncation. */ + ip = (int) zwt; + + /* Adjust the weight to range (0.0 to 1.0) */ + zwt -= ip; + + /* If 'nearest neighbour' processing must be used */ + if ( oveggy ) + { + if ( zwt < 0.5 ) + p[jl] = pw[ip + 1 + pw_dim1]; + else + p[jl] = pw[ip + 2 + pw_dim1]; + } + else + { + /* If the left value is missing, use the right value */ + if ( IS_EQUAL(pw[ip + 1 + pw_dim1], msval) ) + { + p[jl] = pw[ip + 2 + pw_dim1]; + } + /* If the right value is missing, use the left value */ + else if ( IS_EQUAL(pw[ip + 2 + pw_dim1], msval) ) + { + p[jl] = pw[ip + 1 + pw_dim1]; + } + /* If neither missing, interpolate ... */ + else + { + /* Interpolate using the weighted values on either side */ + /* of the output point position */ + p[jl] = (T)((1.0 - zwt) * pw[ip+1 + pw_dim1] + + zwt * pw[ip+2 + pw_dim1]); + } + } + } + } + else if ( kcode == 3 ) + { + /* ******************************* */ + /* Section 2. Cubic interpolation .. */ + /* ******************************* */ + i_1 = ki; + for (int jl = 1; jl <= i_1; ++jl) + { + if ( IS_EQUAL(p[jl], msval) ) + { + fprintf(stderr," ROWINA3: "); + fprintf(stderr," Cubic interpolation not supported"); + fprintf(stderr," for fields containing missing data.\n"); + *kret = 1; + goto L900; + } + pw[jl + pw_dim1] = p[jl]; + } + pw[pw_dim1] = p[ki]; + pw[ki + 1 + pw_dim1] = p[1]; + pw[ki + 2 + pw_dim1] = p[2]; + i_1 = ki; + for (int jl = 1; jl <= i_1; ++jl) + { + pw[jl + (pw_dim1 << 1)] = + (T)(- pw[jl - 1 + pw_dim1] / 3.0 - + pw[jl + pw_dim1] * 0.5 + + pw[jl + 1 + pw_dim1] - pw[jl + 2 + pw_dim1] / 6.0); + pw[jl + 1 + pw_dim1 * 3] = + (T)(pw[jl - 1 + pw_dim1] / 6.0 - + pw[jl + pw_dim1] + + pw[jl + 1 + pw_dim1] * 0.5 + + pw[jl + 2 + pw_dim1] / 3.0); + } + + TEMPLATE(scm0,T)(&pw[(pw_dim1 << 1) + 1], &pw[pw_dim1 * 3 + 2], + &pw[pw_dim1 + 1], &pw[pw_dim1 + 2], ki); + + zrdi = (double) ki; + zdo = 1.0 / (double) ko; + for (int jl = 1; jl <= ko; ++jl) + { + zpos = (jl - 1) * zdo; + zwt = zpos * zrdi; + ip = (int) zwt + 1; + zwt = zwt + 1.0 - ip; + zwt1 = 1.0 - zwt; + p[jl] = (T)(((3.0 - zwt1 * 2.0) * pw[ip + pw_dim1] + + zwt * pw[ip + (pw_dim1 << 1)]) * zwt1 * zwt1 + + ((3.0 - zwt * 2.0) * pw[ip + 1 + pw_dim1] - + zwt1 * pw[ip + 1 + pw_dim1 * 3]) * zwt * zwt); + } + + } + else + { + /* ************************************** */ + /* Section 3. Invalid interpolation code .. */ + /* ************************************** */ + fprintf(stderr," ROWINA3:"); + fprintf(stderr," Invalid interpolation code = %2d\n",kcode); + *kret = 2; + } + +L900: + return 0; +} /* rowina3 */ + + +int TEMPLATE(qu2reg3,T)(T *pfield, int *kpoint, int klat, int klon, + T msval, int *kret, int omisng, int operio, int oveggy) +{ + /* +C**** QU2REG3 - Convert quasi-regular grid data to regular. +C +C Purpose. +C -------- +C +C Convert quasi-regular grid data to regular, +C using either a linear or cubic interpolation. +C +C +C** Interface. +C ---------- +C +C CALL QU2REG3(PFIELD,KPOINT,KLAT,KLON,KCODE,PMSVAL,OMISNG,OPERIO, +C X OVEGGY) +C +C +C Input Parameters. +C ----------------- +C +C PFIELD - Array containing quasi-regular grid data. +C +C KPOINT - Array containing list of the number of +C points on each latitude (or longitude) of +C the quasi-regular grid. +C +C KLAT - Number of latitude lines +C +C KLON - Number of longitude lines +C +C KCODE - Interpolation required. +C 1 , linear - data quasi-regular on latitude lines. +C 3 , cubic - data quasi-regular on latitude lines. +C 11, linear - data quasi-regular on longitude lines. +C 13, cubic - data quasi-regular on longitude lines. +C +C PMSVAL - Value used for missing data indicator. +C +C OMISNG - True if missing values are present in field. +C +C OPERIO - True if input field is periodic. +C +C OVEGGY - True if 'nearest neighbour' processing must be used +C for interpolation +C +C +C Output Parameters. +C ------------------ +C +C KRET - return code +C 0 = OK +C non-zero indicates fatal error +C +C +C Output Parameters. +C ------------------ +C +C PFIELD - Array containing regular grid data. +C +C +C Method. +C ------- +C +C Data is interpolated and expanded into a temporary array, +C which is then copied back into the user's array. +C Returns an error code if an invalid interpolation is requested +C or field size exceeds array dimensions. +C +C Comments. +C --------- +C +C This routine is an adaptation of QU2REG to allow missing data +C values, and hence bit mapped fields. +C +C +C Author. +C ------- +C +C J.D.Chambers ECMWF 22.07.94 +C +C +C Modifications. +C -------------- +C +C J.D.Chambers ECMWF 13.09.94 +C Add return code KRET and remove calls to ABORT. +C +C J.D.Chambers ECMWF Feb 1997 +C Allow for 64-bit pointers +C +C J. Clochard, Meteo France, for ECMWF - January 1998. +C Addition of OMISNG and OPERIO arguments. +C Fix message for longitude number out of bounds, and routine +C name in title and formats. +C +*/ + /* System generated locals */ + int i_1, i_2; + int kcode = 1; + + /* Local variables */ + int ilii, ilio, icode; + int iregno, iquano; + + T *ztemp = (T*) Malloc((size_t)klon*(size_t)klat*sizeof(T)); + T *zline = (T*) Malloc(2*(size_t)klon*sizeof(T)); + T *zwork = (T*) Malloc(3*(2*(size_t)klon+3)*sizeof(T)); + + /* Parameter adjustments */ + --pfield; + --kpoint; + +/* ------------------------------ */ +/* Section 1. Set initial values. */ +/* ------------------------------ */ + + *kret = 0; + +/* Check input parameters. */ + + if (kcode != 1 && kcode != 3 && kcode != 11 && kcode != 13) { + fprintf(stderr," QU2REG :"); + fprintf(stderr," Invalid interpolation type code = %2d\n",kcode); + *kret = 1; + goto L900; + } + +/* Set array indices to 0. */ + + ilii = 0; + ilio = 0; + +/* Establish values of loop parameters. */ + + if (kcode > 10) { + +/* Quasi-regular along longitude lines. */ + + iquano = klon; + iregno = klat; + icode = kcode - 10; + } else { + +/* Quasi-regular along latitude lines. */ + + iquano = klat; + iregno = klon; + icode = kcode; + } + +/* -------------------------------------------------------- */ +/** Section 2. Interpolate field from quasi to regular grid. */ +/* -------------------------------------------------------- */ + + i_1 = iquano; + for (int j230 = 1; j230 <= i_1; ++j230) { + + if (iregno != kpoint[j230]) { + +/* Line contains less values than required,so */ +/* extract quasi-regular grid values for a line */ + + i_2 = kpoint[j230]; + for (int j210 = 1; j210 <= i_2; ++j210) { + ++ilii; + zline[j210 - 1] = pfield[ilii]; + } + +/* and interpolate this line. */ + + TEMPLATE(rowina3,T)(zline, iregno, kpoint[j230], zwork, icode, msval, kret, omisng, operio , oveggy); + if (*kret != 0) goto L900; + +/* Add regular grid values for this line to the + temporary array. */ + + i_2 = iregno; + for (int j220 = 1; j220 <= i_2; ++j220) { + ++ilio; + ztemp[ilio - 1] = zline[j220 - 1]; + } + + } else { + +/* Line contains the required number of values, so add */ +/* this line to the temporary array. */ + + i_2 = iregno; + for (int j225 = 1; j225 <= i_2; ++j225) { + ++ilio; + ++ilii; + ztemp[ilio - 1] = pfield[ilii]; + } + } + } + +/* Copy temporary array to user array. */ + + i_1 = klon * klat; + for (int j240 = 1; j240 <= i_1; ++j240) { + pfield[j240] = ztemp[j240 - 1]; + } + +/* -------------------------------------------------------- */ +/* Section 9. Return to calling routine. Format statements. */ +/* -------------------------------------------------------- */ + +L900: + + Free(zwork); + Free(zline); + Free(ztemp); + + return 0; +} /* qu2reg3 */ + +#endif /* T */ + +/* + * Local Variables: + * mode: c + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ + +#ifdef T +#undef T +#endif +#define T float +#ifdef T + +/* calculate_pfactor: source code from grib_api-1.8.0 */ +double TEMPLATE(calculate_pfactor,T)(const T *spectralField, long fieldTruncation, long subsetTruncation) +{ + /*long n_vals = ((fieldTruncation+1)*(fieldTruncation+2));*/ + long loop, index, m, n = 0; + double zeps = 1.0e-15; + long ismin = (subsetTruncation+1), ismax = (fieldTruncation+1); + double weightedSumOverX = 0.0, weightedSumOverY = 0.0, sumOfWeights = 0.0; + double numerator = 0.0, denominator = 0.0; + + // Setup the weights + + double range = (double) (ismax - ismin +1); + + double *weights = (double*) Malloc(((size_t)ismax+1)*sizeof(double)); + for( loop = ismin; loop <= ismax; loop++ ) + weights[loop] = range / (double) (loop-ismin+1); + + // Compute norms + // Handle values 2 at a time (real and imaginary parts). + double *norms = (double*) Malloc(((size_t)ismax+1)*sizeof(double)); + + for( loop = 0; loop < ismax+1; loop++ ) norms[loop] = 0.0; + + // Form norms for the rows which contain part of the unscaled subset. + + index = -2; + for( m = 0; m < subsetTruncation; m++ ) + for( n = m; n <= fieldTruncation; n++ ) { + index += 2; + if( n >= subsetTruncation ) { + double tval = spectralField[index]; + tval=tval<0?-tval:tval; + norms[n] = norms[n] > tval ? norms[n] : tval; + tval = spectralField[index+1]; + tval=tval<0?-tval:tval; + norms[n] = norms[n] > tval ? norms[n] : tval; + } + } + + // Form norms for the rows which do not contain part of the unscaled subset. + + for( m = subsetTruncation; m <= fieldTruncation; m++ ) + for( n = m; n <= fieldTruncation; n++ ) { + double tval = spectralField[index]; + index += 2; + tval=tval<0?-tval:tval; + norms[n] = norms[n] > tval ? norms[n] : tval; + tval = spectralField[index+1]; + tval=tval<0?-tval:tval; + norms[n] = norms[n] > tval ? norms[n] : tval; + } + + // Ensure the norms have a value which is not too small in case of problems with math functions (e.g. LOG). + + for( loop = ismin; loop <= ismax; loop++ ) { + norms[n] = norms[n] > zeps ? norms[n] : zeps; + if( IS_EQUAL(norms[n], zeps) ) weights[n] = 100.0 * zeps; + } + + // Do linear fit to find the slope + + for( loop = ismin; loop <= ismax; loop++ ) { + double x = log( (double) (loop*(loop+1)) ); + double y = log( norms[loop] ); + weightedSumOverX += x * weights[loop]; + weightedSumOverY += y * weights[loop]; + sumOfWeights = sumOfWeights + weights[loop]; + } + weightedSumOverX /= sumOfWeights; + weightedSumOverY /= sumOfWeights; + + // Perform a least square fit for the equation + + for( loop = ismin; loop <= ismax; loop++ ) { + + double x = log( (double)(loop*(loop+1)) ); + double y = log( norms[loop] ); + numerator += weights[loop] * (y-weightedSumOverY) * (x-weightedSumOverX); + denominator += weights[loop] * ((x-weightedSumOverX) * (x-weightedSumOverX)); + } + double slope = numerator / denominator; + + Free(weights); + Free(norms); + + double pFactor = -slope; + if( pFactor < -9999.9 ) pFactor = -9999.9; + if( pFactor > 9999.9 ) pFactor = 9999.9; + + return pFactor; +} + +void TEMPLATE(scale_complex,T)(T *fpdata, int pcStart, int pcScale, int trunc, int inv) +{ + + if ( pcScale < -10000 || pcScale > 10000 ) + { + fprintf(stderr, " %s: Invalid power given %6d\n", __func__, pcScale); + return; + } + + // Setup scaling factors = n(n+1)^^p for n = 1 to truncation + + if ( pcScale != 0 ) + { + double *scale = (double*) Malloc(((size_t)trunc+1)*sizeof(double)); + const double power = (double) pcScale / 1000.; + scale[0] = 1.0; + + if (pcScale != 1000) + for (int n = 1; n <= trunc; ++n) scale[n] = pow((double) (n*(n+1)), power); + else + for (int n = 1; n <= trunc; ++n) scale[n] = (double) (n*(n+1)); + + if ( inv ) + for (int n = 1; n <= trunc; ++n) scale[n] = 1.0 / scale[n]; + + // Scale the values + + size_t index = 0; + + for (int m = 0; m < pcStart; ++m) + for (int n = m; n <= trunc; n++, index += 2) + if ( n >= pcStart ) + { + fpdata[index ] = (T)(fpdata[index ] * scale[n]); + fpdata[index+1] = (T)(fpdata[index+1] * scale[n]); + } + + for (int m = pcStart; m <= trunc; ++m) + for (int n = m; n <= trunc; n++, index += 2) + { + fpdata[index ] = (T)(fpdata[index ] * scale[n]); + fpdata[index+1] = (T)(fpdata[index+1] * scale[n]); + } + Free(scale); + } +} + + +void TEMPLATE(scatter_complex,T)(T *fpdata, int pcStart, int trunc, int nsp) +{ + T *fphelp = (T*) Malloc((size_t)nsp*sizeof(T)); + size_t inext = 0; + size_t pcStart_ = pcStart >= 0 ? (size_t)pcStart : 0U; + size_t trunc_ = trunc >= 0 ? (size_t)trunc : 0U; + for (size_t m = 0, index = 0; m <= pcStart_; ++m) + { + size_t n_copies = pcStart_ <= trunc_ ? (pcStart_ + 1 - m) * 2 : 0; + for (size_t i = 0; i < n_copies; ++i) fphelp[index + i] = fpdata[inext + i]; + inext += n_copies; + index += m <= trunc_ ? (trunc_ - m + 1) * 2 : 0; + } + for (size_t m = 0, index = 0; m <= trunc_; ++m) + { + size_t advIdx = m <= pcStart_ ? (pcStart_ - m + 1) * 2 : 0; + index += advIdx; + size_t copyStart = m > pcStart_ ? m : pcStart_ + 1; + size_t n_copies = copyStart <= trunc_ ? (trunc_ - copyStart + 1) * 2 : 0; + for (size_t i = 0; i < n_copies; ++i) fphelp[index + i] = fpdata[inext + i]; + inext += n_copies; + index += n_copies; + } + for (size_t m = 0; m < (size_t)nsp; ++m) fpdata[m] = fphelp[m]; + + Free(fphelp); +} + + +void TEMPLATE(gather_complex,T)(T *fpdata, size_t pcStart, size_t trunc, size_t nsp) +{ + T *restrict fphelp = (T*) Malloc(nsp*sizeof(T)); + size_t inext = 0; + + for (size_t m = 0, index = 0; m <= pcStart; ++m) + for (size_t n = m; n <= trunc; ++n) + { + if ( pcStart >= n ) + { + fphelp[inext++] = fpdata[index]; + fphelp[inext++] = fpdata[index+1]; + } + index += 2; + } + + for (size_t m = 0, index = 0; m <= trunc; ++m) + for (size_t n = m; n <= trunc; ++n) + { + if ( n > pcStart ) + { + fphelp[inext++] = fpdata[index]; + fphelp[inext++] = fpdata[index+1]; + } + index += 2; + } + + for (size_t m = 0; m < nsp; ++m) fpdata[m] = fphelp[m]; + + Free(fphelp); +} + + +static void TEMPLATE(scm0,T)(T *pdl, T *pdr, T *pfl, T *pfr, int klg) +{ + /* **** SCM0 - Apply SCM0 limiter to derivative estimates. */ + /* output: */ + /* pdl = the limited derivative at the left edge of the interval */ + /* pdr = the limited derivative at the right edge of the interval */ + /* inputs */ + /* pdl = the original derivative at the left edge */ + /* pdr = the original derivative at the right edge */ + /* pfl = function value at the left edge of the interval */ + /* pfr = function value at the right edge of the interval */ + /* klg = number of intervals where the derivatives are limited */ + + /* define constants */ + + double zeps = 1.0e-12; + double zfac = (1.0 - zeps) * 3.0; + + for (int jl = 0; jl < klg; ++jl) + { + double r_1; + if ( (r_1 = pfr[jl] - pfl[jl], fabs(r_1)) > zeps ) + { + double zalpha = pdl[jl] / (pfr[jl] - pfl[jl]); + double zbeta = pdr[jl] / (pfr[jl] - pfl[jl]); + if ( zalpha <= 0.0 ) pdl[jl] = 0.0; + if ( zbeta <= 0.0 ) pdr[jl] = 0.0; + if ( zalpha > zfac ) pdl[jl] = (T)(zfac * (pfr[jl] - pfl[jl])); + if ( zbeta > zfac ) pdr[jl] = (T)(zfac * (pfr[jl] - pfl[jl])); + } + else + { + pdl[jl] = 0.0; + pdr[jl] = 0.0; + } + } +} /* scm0 */ + +static +int TEMPLATE(rowina3,T)(T *p, int ko, int ki, T *pw, + int kcode, T msval, int *kret, int omisng, int operio, int oveggy) +{ + /* +C----> +C**** ROWINA3 - Interpolation of row of values. +C +C Purpose. +C -------- +C +C Interpolate a row of values. +C +C +C** Interface. +C ---------- +C +C CALL ROWINA3( P, KO, KI, PW, KCODE, PMSVAL, KRET, OMISNG, OPERIO) +C +C +C Input Parameters. +C ----------------- +C +C P - Row of values to be interpolated. +C Dimension must be at least KO. +C +C KO - Number of values required. +C +C KI - Number of values in P on input. +C +C PW - Working array. +C Dimension must be at least (0:KO+2,3). +C +C KCODE - Interpolation required. +C 1 , linear. +C 3 , cubic. +C +C PMSVAL - Value used for missing data indicator. +C +C OMISNG - True if missing values are present in field. +C +C OPERIO - True if input field is periodic. +C +C OVEGGY - True if 'nearest neighbour' processing must be used +C for interpolation +C +C Output Parameters. +C ------------------ +C +C P - Now contains KO values. +C KRET - Return code +C 0, OK +C Non-zero, error +C +C +C Method. +C ------- +C +C Linear or cubic interpolation performed as required. +C +C Comments. +C --------- +C +C This is a version of ROWINA which allows for missing data +C values and hence for bitmapped fields. +C +C +C Author. +C ------- +C +C J.D.Chambers ECMWF 22.07.94 +C +C +C Modifications. +C -------------- +C +C J.D.Chambers ECMWF 13.09.94 +C Add return code KRET and remove calls to ABORT. +C +C J. Clochard, Meteo France, for ECMWF - January 1998. +C Addition of OMISNG and OPERIO arguments. +C +C +C ----------------------------------------------------------------- +*/ + /* System generated locals */ + int pw_dim1, pw_offset, i_1; + + /* Local variables */ + int ip; + double zwt1, zrdi, zpos; + double zdo, zwt; + + UNUSED(omisng); + + /* Parameter adjustments */ + --p; + pw_dim1 = ko + 3; + pw_offset = pw_dim1; + pw -= pw_offset; + + *kret = 0; + + if ( kcode == 1 ) + { + /* Move input values to work array */ + for (int jl = 1; jl <= ki; ++jl) + pw[jl + pw_dim1] = p[jl]; + + if ( operio ) + { + /* Arrange wrap-around value in work array */ + pw[ki + 1 + pw_dim1] = p[1]; + + /* Set up constants to be used to figure out weighting for */ + /* values in interpolation. */ + zrdi = (double) ki; + zdo = 1.0 / (double) ko; + } + else + { + /* Repeat last value, to cope with "implicit truncation" below */ + pw[ki + 1 + pw_dim1] = p[ki]; + + /* Set up constants to be used to figure out weighting for */ + /* values in interpolation. */ + zrdi = (double) (ki-1); + zdo = 1.0 / (double) (ko-1); + } + + /* Loop through the output points */ + for (int jl = 1; jl <= ko; ++jl) + { + + /* Calculate weight from the start of row */ + zpos = (jl - 1) * zdo; + zwt = zpos * zrdi; + + /* Get the current array position(minus 1) from the weight - */ + /* note the implicit truncation. */ + ip = (int) zwt; + + /* Adjust the weight to range (0.0 to 1.0) */ + zwt -= ip; + + /* If 'nearest neighbour' processing must be used */ + if ( oveggy ) + { + if ( zwt < 0.5 ) + p[jl] = pw[ip + 1 + pw_dim1]; + else + p[jl] = pw[ip + 2 + pw_dim1]; + } + else + { + /* If the left value is missing, use the right value */ + if ( IS_EQUAL(pw[ip + 1 + pw_dim1], msval) ) + { + p[jl] = pw[ip + 2 + pw_dim1]; + } + /* If the right value is missing, use the left value */ + else if ( IS_EQUAL(pw[ip + 2 + pw_dim1], msval) ) + { + p[jl] = pw[ip + 1 + pw_dim1]; + } + /* If neither missing, interpolate ... */ + else + { + /* Interpolate using the weighted values on either side */ + /* of the output point position */ + p[jl] = (T)((1.0 - zwt) * pw[ip+1 + pw_dim1] + + zwt * pw[ip+2 + pw_dim1]); + } + } + } + } + else if ( kcode == 3 ) + { + /* ******************************* */ + /* Section 2. Cubic interpolation .. */ + /* ******************************* */ + i_1 = ki; + for (int jl = 1; jl <= i_1; ++jl) + { + if ( IS_EQUAL(p[jl], msval) ) + { + fprintf(stderr," ROWINA3: "); + fprintf(stderr," Cubic interpolation not supported"); + fprintf(stderr," for fields containing missing data.\n"); + *kret = 1; + goto L900; + } + pw[jl + pw_dim1] = p[jl]; + } + pw[pw_dim1] = p[ki]; + pw[ki + 1 + pw_dim1] = p[1]; + pw[ki + 2 + pw_dim1] = p[2]; + i_1 = ki; + for (int jl = 1; jl <= i_1; ++jl) + { + pw[jl + (pw_dim1 << 1)] = + (T)(- pw[jl - 1 + pw_dim1] / 3.0 - + pw[jl + pw_dim1] * 0.5 + + pw[jl + 1 + pw_dim1] - pw[jl + 2 + pw_dim1] / 6.0); + pw[jl + 1 + pw_dim1 * 3] = + (T)(pw[jl - 1 + pw_dim1] / 6.0 - + pw[jl + pw_dim1] + + pw[jl + 1 + pw_dim1] * 0.5 + + pw[jl + 2 + pw_dim1] / 3.0); + } + + TEMPLATE(scm0,T)(&pw[(pw_dim1 << 1) + 1], &pw[pw_dim1 * 3 + 2], + &pw[pw_dim1 + 1], &pw[pw_dim1 + 2], ki); + + zrdi = (double) ki; + zdo = 1.0 / (double) ko; + for (int jl = 1; jl <= ko; ++jl) + { + zpos = (jl - 1) * zdo; + zwt = zpos * zrdi; + ip = (int) zwt + 1; + zwt = zwt + 1.0 - ip; + zwt1 = 1.0 - zwt; + p[jl] = (T)(((3.0 - zwt1 * 2.0) * pw[ip + pw_dim1] + + zwt * pw[ip + (pw_dim1 << 1)]) * zwt1 * zwt1 + + ((3.0 - zwt * 2.0) * pw[ip + 1 + pw_dim1] - + zwt1 * pw[ip + 1 + pw_dim1 * 3]) * zwt * zwt); + } + + } + else + { + /* ************************************** */ + /* Section 3. Invalid interpolation code .. */ + /* ************************************** */ + fprintf(stderr," ROWINA3:"); + fprintf(stderr," Invalid interpolation code = %2d\n",kcode); + *kret = 2; + } + +L900: + return 0; +} /* rowina3 */ + + +int TEMPLATE(qu2reg3,T)(T *pfield, int *kpoint, int klat, int klon, + T msval, int *kret, int omisng, int operio, int oveggy) +{ + /* +C**** QU2REG3 - Convert quasi-regular grid data to regular. +C +C Purpose. +C -------- +C +C Convert quasi-regular grid data to regular, +C using either a linear or cubic interpolation. +C +C +C** Interface. +C ---------- +C +C CALL QU2REG3(PFIELD,KPOINT,KLAT,KLON,KCODE,PMSVAL,OMISNG,OPERIO, +C X OVEGGY) +C +C +C Input Parameters. +C ----------------- +C +C PFIELD - Array containing quasi-regular grid data. +C +C KPOINT - Array containing list of the number of +C points on each latitude (or longitude) of +C the quasi-regular grid. +C +C KLAT - Number of latitude lines +C +C KLON - Number of longitude lines +C +C KCODE - Interpolation required. +C 1 , linear - data quasi-regular on latitude lines. +C 3 , cubic - data quasi-regular on latitude lines. +C 11, linear - data quasi-regular on longitude lines. +C 13, cubic - data quasi-regular on longitude lines. +C +C PMSVAL - Value used for missing data indicator. +C +C OMISNG - True if missing values are present in field. +C +C OPERIO - True if input field is periodic. +C +C OVEGGY - True if 'nearest neighbour' processing must be used +C for interpolation +C +C +C Output Parameters. +C ------------------ +C +C KRET - return code +C 0 = OK +C non-zero indicates fatal error +C +C +C Output Parameters. +C ------------------ +C +C PFIELD - Array containing regular grid data. +C +C +C Method. +C ------- +C +C Data is interpolated and expanded into a temporary array, +C which is then copied back into the user's array. +C Returns an error code if an invalid interpolation is requested +C or field size exceeds array dimensions. +C +C Comments. +C --------- +C +C This routine is an adaptation of QU2REG to allow missing data +C values, and hence bit mapped fields. +C +C +C Author. +C ------- +C +C J.D.Chambers ECMWF 22.07.94 +C +C +C Modifications. +C -------------- +C +C J.D.Chambers ECMWF 13.09.94 +C Add return code KRET and remove calls to ABORT. +C +C J.D.Chambers ECMWF Feb 1997 +C Allow for 64-bit pointers +C +C J. Clochard, Meteo France, for ECMWF - January 1998. +C Addition of OMISNG and OPERIO arguments. +C Fix message for longitude number out of bounds, and routine +C name in title and formats. +C +*/ + /* System generated locals */ + int i_1, i_2; + int kcode = 1; + + /* Local variables */ + int ilii, ilio, icode; + int iregno, iquano; + + T *ztemp = (T*) Malloc((size_t)klon*(size_t)klat*sizeof(T)); + T *zline = (T*) Malloc(2*(size_t)klon*sizeof(T)); + T *zwork = (T*) Malloc(3*(2*(size_t)klon+3)*sizeof(T)); + + /* Parameter adjustments */ + --pfield; + --kpoint; + +/* ------------------------------ */ +/* Section 1. Set initial values. */ +/* ------------------------------ */ + + *kret = 0; + +/* Check input parameters. */ + + if (kcode != 1 && kcode != 3 && kcode != 11 && kcode != 13) { + fprintf(stderr," QU2REG :"); + fprintf(stderr," Invalid interpolation type code = %2d\n",kcode); + *kret = 1; + goto L900; + } + +/* Set array indices to 0. */ + + ilii = 0; + ilio = 0; + +/* Establish values of loop parameters. */ + + if (kcode > 10) { + +/* Quasi-regular along longitude lines. */ + + iquano = klon; + iregno = klat; + icode = kcode - 10; + } else { + +/* Quasi-regular along latitude lines. */ + + iquano = klat; + iregno = klon; + icode = kcode; + } + +/* -------------------------------------------------------- */ +/** Section 2. Interpolate field from quasi to regular grid. */ +/* -------------------------------------------------------- */ + + i_1 = iquano; + for (int j230 = 1; j230 <= i_1; ++j230) { + + if (iregno != kpoint[j230]) { + +/* Line contains less values than required,so */ +/* extract quasi-regular grid values for a line */ + + i_2 = kpoint[j230]; + for (int j210 = 1; j210 <= i_2; ++j210) { + ++ilii; + zline[j210 - 1] = pfield[ilii]; + } + +/* and interpolate this line. */ + + TEMPLATE(rowina3,T)(zline, iregno, kpoint[j230], zwork, icode, msval, kret, omisng, operio , oveggy); + if (*kret != 0) goto L900; + +/* Add regular grid values for this line to the + temporary array. */ + + i_2 = iregno; + for (int j220 = 1; j220 <= i_2; ++j220) { + ++ilio; + ztemp[ilio - 1] = zline[j220 - 1]; + } + + } else { + +/* Line contains the required number of values, so add */ +/* this line to the temporary array. */ + + i_2 = iregno; + for (int j225 = 1; j225 <= i_2; ++j225) { + ++ilio; + ++ilii; + ztemp[ilio - 1] = pfield[ilii]; + } + } + } + +/* Copy temporary array to user array. */ + + i_1 = klon * klat; + for (int j240 = 1; j240 <= i_1; ++j240) { + pfield[j240] = ztemp[j240 - 1]; + } + +/* -------------------------------------------------------- */ +/* Section 9. Return to calling routine. Format statements. */ +/* -------------------------------------------------------- */ + +L900: + + Free(zwork); + Free(zline); + Free(ztemp); + + return 0; +} /* qu2reg3 */ + +#endif /* T */ + +/* + * Local Variables: + * mode: c + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#include <string.h> + + + +int gribVersion(unsigned char *is, size_t buffersize) +{ + if ( buffersize < 8 ) + Error("Buffer too small (current size %d)!", (int) buffersize); + + return GRIB_EDITION(is); +} + +static +double GET_Real(unsigned char *grib) +{ + int iexp = GET_UINT1(grib[0]); + int imant = GET_UINT3(grib[1], grib[2], grib[3]); + + return decfp2(iexp, imant); +} + +static +int decodeIS(unsigned char *is, int *isec0, int *iret) +{ + // Octets 1 - 4 : The letters G R I B. Four 8 bit fields. + + // Check letters -> GRIB, BUDG or TIDE. + + // Check that 'GRIB' is found where expected. + bool lgrib = GRIB_START(is); + + // ECMWF pseudo-grib data uses 'BUDG' and 'TIDE'. + bool lbudg = BUDG_START(is); + bool ltide = TIDE_START(is); + + // Data is not GRIB or pseudo-grib. + if ( lgrib == false && lbudg == false && ltide == false ) + { + *iret = 305; + gprintf(__func__, "Input data is not GRIB or pseudo-grib."); + gprintf(__func__, "Return code = %d", *iret); + } + if ( lbudg || ltide ) + { + *iret = 305; + gprintf(__func__, "Pseudo-grib data unsupported."); + gprintf(__func__, "Return code = %d", *iret); + } + + // Octets 5 - 7 : Length of message. One 24 bit field. + ISEC0_GRIB_Len = GRIB1_SECLEN(is); + + // Octet 8 : GRIB Edition Number. One 8 bit field. + ISEC0_GRIB_Version = GRIB_EDITION(is); + + if ( ISEC0_GRIB_Version > 1 ) + Error("GRIB version %d unsupported!", ISEC0_GRIB_Version); + + int grib1offset = ISEC0_GRIB_Version * 4; + + int isLen = 4 + grib1offset; + + return isLen; +} + +static +void decodePDS_ECMWF_local_Extension_1(unsigned char *pds, int *isec1) +{ + isec1[36] = GET_UINT1(pds[40]); /* extension identifier */ + isec1[37] = GET_UINT1(pds[41]); /* Class */ + isec1[38] = GET_UINT1(pds[42]); /* Type */ + isec1[39] = GET_UINT2(pds[43],pds[44]); /* Stream */ + /* isec1[40] = GET_UINT4(pds[45],pds[46],pds[47],pds[48]); */ + memcpy((char*) &isec1[40], &pds[45], 4); + isec1[41] = GET_UINT1(pds[49]); /* Forecast number */ + isec1[42] = GET_UINT1(pds[50]); /* Total number of forecasts */ +} + +static +void decodePDS_DWD_local_Extension_254(unsigned char *pds, int *isec1) +{ + isec1[36] = GET_UINT1(pds[40]); /* extension identifier */ + for (int i = 0; i < 11; ++i) isec1[37+i] = GET_UINT1(pds[41+i]); + + int isvn = GET_UINT2(pds[52],pds[53]); + + isec1[48] = isvn % 0x8000; /* DWD experiment identifier */ + isec1[49] = isvn >> 15; /* DWD run type (0=main, 2=ass, 3=test) */ +} + +static +void decodePDS_DWD_local_Extension_253(unsigned char *pds, int *isec1) +{ + isec1[36] = GET_UINT1(pds[40]); /* extension identifier */ + for (int i = 0; i < 11; ++i) isec1[37+i] = GET_UINT1(pds[41+i]); + + int isvn = GET_UINT2(pds[52],pds[53]); + + isec1[48] = isvn % 0x8000; /* DWD experiment identifier */ + isec1[49] = isvn >> 15; /* DWD run type (0=main, 2=ass, 3=test) */ + isec1[50] = GET_UINT1(pds[54]); /* User id, specified by table */ + isec1[51] = GET_UINT2(pds[55],pds[56]); /* Experiment identifier */ + isec1[52] = GET_UINT2(pds[57],pds[58]); /* Ensemble identification by table */ + isec1[53] = GET_UINT2(pds[59],pds[60]); /* Number of ensemble members */ + isec1[54] = GET_UINT2(pds[61],pds[62]); /* Actual number of ensemble member */ + isec1[55] = GET_UINT1(pds[63]); /* Model major version number */ + isec1[56] = GET_UINT1(pds[64]); /* Model minor version number */ +} + +static +void decodePDS_MPIM_local_Extension_1(unsigned char *pds, int *isec1) +{ + isec1[36] = GET_UINT1(pds[40]); /* extension identifier */ + isec1[37] = GET_UINT1(pds[41]); /* type of ensemble forecast */ + isec1[38] = GET_UINT2(pds[42],pds[43]); /* individual ensemble member */ + isec1[39] = GET_UINT2(pds[44],pds[45]); /* number of forecasts in ensemble */ +} + +static +int decodePDS(unsigned char *pds, int *isec0, int *isec1) +{ + int pdsLen = PDS_Len; + + ISEC1_CodeTable = PDS_CodeTable; + ISEC1_CenterID = PDS_CenterID; + ISEC1_ModelID = PDS_ModelID; + ISEC1_GridDefinition = PDS_GridDefinition; + ISEC1_Sec2Or3Flag = PDS_Sec2Or3Flag; + ISEC1_Parameter = PDS_Parameter; + ISEC1_LevelType = PDS_LevelType; + + if ( (ISEC1_LevelType != 20) && + (ISEC1_LevelType != GRIB1_LTYPE_99) && + (ISEC1_LevelType != GRIB1_LTYPE_ISOBARIC) && + (ISEC1_LevelType != GRIB1_LTYPE_ISOBARIC_PA) && + (ISEC1_LevelType != GRIB1_LTYPE_ALTITUDE) && + (ISEC1_LevelType != GRIB1_LTYPE_HEIGHT) && + (ISEC1_LevelType != GRIB1_LTYPE_SIGMA) && + (ISEC1_LevelType != GRIB1_LTYPE_HYBRID) && + (ISEC1_LevelType != GRIB1_LTYPE_LANDDEPTH) && + (ISEC1_LevelType != GRIB1_LTYPE_ISENTROPIC) && + (ISEC1_LevelType != 115) && + (ISEC1_LevelType != 117) && + (ISEC1_LevelType != 125) && + (ISEC1_LevelType != 127) && + (ISEC1_LevelType != GRIB1_LTYPE_SEADEPTH) && + (ISEC1_LevelType != 210) ) + { + ISEC1_Level1 = PDS_Level1; + ISEC1_Level2 = PDS_Level2; + } + else + { + ISEC1_Level1 = PDS_Level; + ISEC1_Level2 = 0; + } + + /* ISEC1_Year = PDS_Year; */ + ISEC1_Month = PDS_Month; + ISEC1_Day = PDS_Day; + ISEC1_Hour = PDS_Hour; + ISEC1_Minute = PDS_Minute; + ISEC1_TimeUnit = PDS_TimeUnit; + ISEC1_TimePeriod1 = PDS_TimePeriod1; + ISEC1_TimePeriod2 = PDS_TimePeriod2; + ISEC1_TimeRange = PDS_TimeRange; + ISEC1_AvgNum = PDS_AvgNum; + ISEC1_AvgMiss = PDS_AvgMiss; + + if ( ISEC0_GRIB_Version == 1 ) + { + ISEC1_Year = PDS_Year; + ISEC1_Century = PDS_Century; + ISEC1_SubCenterID = PDS_Subcenter; + ISEC1_DecScaleFactor = PDS_DecimalScale; + } + else + { + int year = GET_UINT1(pds[12]); + if ( year <= 100 ) + { + ISEC1_Year = year; + ISEC1_Century = 1; + } + else + { + ISEC1_Year = year%100; + ISEC1_Century = 1 + (year-ISEC1_Year)/100; + } + ISEC1_SubCenterID = 0; + ISEC1_DecScaleFactor = 0; + } + + if ( ISEC1_Year < 0 ) + { + ISEC1_Year = -ISEC1_Year; + ISEC1_Century = -ISEC1_Century; + } + + ISEC1_LocalFLag = 0; + if ( pdsLen > 28 ) + { + int localextlen = pdsLen-28; + + if ( localextlen > 4000 ) + { + Warning("PDS larger than 4000 bytes not supported!"); + } + else + { + ISEC1_LocalFLag = 1; + + if ( ISEC1_CenterID == 78 || ISEC1_CenterID == 215 || ISEC1_CenterID == 250 ) + { + if ( pds[40] == 254 ) + decodePDS_DWD_local_Extension_254(pds, isec1); + else if ( pds[40] == 253 ) + decodePDS_DWD_local_Extension_253(pds, isec1); + } + else if ( (ISEC1_CenterID == 98 && ISEC1_LocalFLag == 1) || + (ISEC1_SubCenterID == 98 && ISEC1_LocalFLag == 1) || + (ISEC1_CenterID == 7 && ISEC1_SubCenterID == 98) ) + { + if ( pds[40] == 1 ) + decodePDS_ECMWF_local_Extension_1(pds, isec1); + } + else if ( ISEC1_CenterID == 252 && ISEC1_LocalFLag == 1 ) + { + if ( pds[40] == 1 ) + decodePDS_MPIM_local_Extension_1(pds, isec1); + } + else + { + for (int i = 0; i < localextlen; ++i) isec1[24+i] = pds[28+i]; + } + } + } + + return pdsLen; +} + + +static void gribPrintSec2_double(int *isec0, int *isec2, double *fsec2) {gribPrintSec2DP(isec0, isec2, fsec2);} +static void gribPrintSec3_double(int *isec0, int *isec3, double *fsec3) {gribPrintSec3DP(isec0, isec3, fsec3);} +static void gribPrintSec4_double(int *isec0, int *isec4, double *fsec4) {gribPrintSec4DP(isec0, isec4, fsec4);} +static void gribPrintSec2_float(int *isec0, int *isec2, float *fsec2) {gribPrintSec2SP(isec0, isec2, fsec2);} +static void gribPrintSec3_float(int *isec0, int *isec3, float *fsec3) {gribPrintSec3SP(isec0, isec3, fsec3);} +static void gribPrintSec4_float(int *isec0, int *isec4, float *fsec4) {gribPrintSec4SP(isec0, isec4, fsec4);} + + +#ifdef T +#undef T +#endif +#define T double +#ifdef T + +#include <inttypes.h> + +static +void TEMPLATE(decode_array_common,T)(const unsigned char *restrict igrib, long jlend, int NumBits, + T fmin, T zscale, T *restrict fpdata) +{ + /* code from wgrib routine BDS_unpack */ + const unsigned char *bits = igrib; + unsigned int tbits = 0; + int n_bits = NumBits; + int t_bits = 0; + + const unsigned jmask = (1U << n_bits) - 1U; + for (long i = 0; i < jlend; ++i) + { + if (n_bits - t_bits > 8) + { + tbits = (tbits << 16) | ((unsigned)bits[0] << 8) | ((unsigned)bits[1]); + bits += 2; + t_bits += 16; + } + + while ( t_bits < n_bits ) + { + tbits = (tbits * 256) + *bits++; + t_bits += 8; + } + t_bits -= n_bits; + fpdata[i] = (float)((tbits >> t_bits) & jmask); + } + // at least this vectorizes :) + for (long i = 0; i < jlend; ++i) + fpdata[i] = fmin + zscale*fpdata[i]; +} + +static +void TEMPLATE(decode_array_common2,T)(const unsigned char *restrict igrib, long jlend, int NumBits, + T fmin, T zscale, T *restrict fpdata) +{ + static const unsigned mask[] = {0,1,3,7,15,31,63,127,255}; + static const double shift[9] = {1.0, 2.0, 4.0, 8.0, 16.0, 32.0, 64.0, 128.0, 256.0}; + + // code from wgrib routine BDS_unpack + const unsigned char *bits = igrib; + int n_bits = NumBits; + int c_bits, j_bits; + + // older unoptimized code, not often used + c_bits = 8; + for (long i = 0; i < jlend; ++i) + { + double jj = 0.0; + j_bits = n_bits; + while (c_bits <= j_bits) + { + if (c_bits == 8) + { + jj = jj * 256.0 + (double) (*bits++); + j_bits -= 8; + } + else + { + jj = (jj * shift[c_bits]) + (double) (*bits & mask[c_bits]); + bits++; + j_bits -= c_bits; + c_bits = 8; + } + } + + if (j_bits) + { + c_bits -= j_bits; + jj = (jj * shift[j_bits]) + (double) (((unsigned)*bits >> c_bits) & mask[j_bits]); + } + fpdata[i] = (T)(fmin + zscale*jj); + } +} + +static +void TEMPLATE(decode_array_2byte,T)(size_t jlend, const unsigned char *restrict igrib, + T *fpdata, T fmin, T zscale) +{ + const uint16_t *restrict sgrib = (const uint16_t *)(const void *)(igrib); + + if ( IS_BIGENDIAN() ) + { + for (size_t i = 0; i < jlend; ++i) + { + fpdata[i] = fmin + zscale * sgrib[i]; + } + } + else + { + for (size_t i = 0; i < jlend; ++i) + { + uint16_t ui16 = gribSwapByteOrder_uint16(sgrib[i]); + fpdata[i] = fmin + zscale * ui16; + } + } +} + +static +void TEMPLATE(decode_array,T)(const unsigned char *restrict igrib, long jlend, int numBits, + T fmin, T zscale, T *restrict fpdata) +{ +#if defined _GET_X86_COUNTER || defined _GET_MACH_COUNTER + uint64_t start_decode, end_decode; +#endif + +#ifdef VECTORCODE + GRIBPACK *lgrib = NULL; + + if ( numBits%8 == 0 ) + { + long jlenc = jlend * numBits / 8; + if ( jlenc > 0 ) + { + lgrib = (GRIBPACK*) Malloc(jlenc*sizeof(GRIBPACK)); + if ( lgrib == NULL ) SysError("No Memory!"); + + (void) UNPACK_GRIB(igrib, lgrib, jlenc, -1L); + } + } + + if ( numBits == 0 ) + { + for (long i = 0; i < jlend; ++i) + fpdata[i] = fmin; + } + else if ( numBits == 8 ) + for (long i = 0; i < jlend; ++i) + { + T dval = (int)lgrib[i]; + fpdata[i] = fmin + zscale * dval; + } + else if ( numBits == 16 ) + for (long i = 0; i < jlend; ++i) + { + T dval = (((int)lgrib[2*i ] << 8) + (int)lgrib[2*i+1]); + fpdata[i] = fmin + zscale * dval; + } + else if ( numBits == 24 ) + for (long i = 0; i < jlend; ++i) + { + T dval = (((int)lgrib[3*i ] << 16) + ((int)lgrib[3*i+1] << 8) + + (int)lgrib[3*i+2]); + fpdata[i] = fmin + zscale * dval; + } + else if ( numBits == 32 ) + for (long i = 0; i < jlend; ++i) + { + T dval = (((unsigned int)lgrib[4*i ] << 24) + ((unsigned int)lgrib[4*i+1] << 16) + + ((unsigned int)lgrib[4*i+2] << 8) + (unsigned int)lgrib[4*i+3]); + fpdata[i] = fmin + zscale * dval; + } + else if ( numBits <= 25 ) + { + TEMPLATE(decode_array_common,T)(igrib, jlend, numBits, fmin, zscale, fpdata); + } + else if ( numBits > 25 && numBits < 32 ) + { + TEMPLATE(decode_array_common2,T)(igrib, jlend, numBits, fmin, zscale, fpdata); + } + else + { + Error("Unimplemented packing factor %d!", numBits); + } + + if ( lgrib ) Free(lgrib); + +#else + if ( numBits == 0 ) + { + for (long i = 0; i < jlend; ++i) + fpdata[i] = fmin; + } + else if ( numBits == 8 ) + for (long i = 0; i < jlend; ++i) + { + T dval = (int)igrib[i]; + fpdata[i] = fmin + zscale * dval; + } + else if ( numBits == 16 ) + { + TEMPLATE(decode_array_2byte,T)((size_t) jlend, igrib, fpdata, fmin, zscale); + } + else if ( numBits == 24 ) + for (long i = 0; i < jlend; ++i) + { + T dval = (T)(((int)igrib[3*i ] << 16) + ((int)igrib[3*i+1] << 8) + + (int)igrib[3*i+2]); + fpdata[i] = fmin + zscale * dval; + } + else if ( numBits == 32 ) + for (long i = 0; i < jlend; ++i) + { + T dval = (T)(((unsigned int)igrib[4*i ] << 24) + ((unsigned int)igrib[4*i+1] << 16) + + ((unsigned int)igrib[4*i+2] << 8) + (unsigned int)igrib[4*i+3]); + fpdata[i] = fmin + zscale * dval; + } + else if ( numBits <= 25 ) + { + TEMPLATE(decode_array_common,T)(igrib, jlend, numBits, fmin, zscale, fpdata); + } + else if ( numBits > 25 && numBits < 32 ) + { + TEMPLATE(decode_array_common2,T)(igrib, jlend, numBits, fmin, zscale, fpdata); + } + else + { + Error("Unimplemented packing factor %d!", numBits); + } +#endif +} + +#endif /* T */ + +/* + * Local Variables: + * mode: c + * End: + */ + +#ifdef T +#undef T +#endif +#define T float +#ifdef T + +#include <inttypes.h> + +static +void TEMPLATE(decode_array_common,T)(const unsigned char *restrict igrib, long jlend, int NumBits, + T fmin, T zscale, T *restrict fpdata) +{ + /* code from wgrib routine BDS_unpack */ + const unsigned char *bits = igrib; + unsigned int tbits = 0; + int n_bits = NumBits; + int t_bits = 0; + + const unsigned jmask = (1U << n_bits) - 1U; + for (long i = 0; i < jlend; ++i) + { + if (n_bits - t_bits > 8) + { + tbits = (tbits << 16) | ((unsigned)bits[0] << 8) | ((unsigned)bits[1]); + bits += 2; + t_bits += 16; + } + + while ( t_bits < n_bits ) + { + tbits = (tbits * 256) + *bits++; + t_bits += 8; + } + t_bits -= n_bits; + fpdata[i] = (float)((tbits >> t_bits) & jmask); + } + // at least this vectorizes :) + for (long i = 0; i < jlend; ++i) + fpdata[i] = fmin + zscale*fpdata[i]; +} + +static +void TEMPLATE(decode_array_common2,T)(const unsigned char *restrict igrib, long jlend, int NumBits, + T fmin, T zscale, T *restrict fpdata) +{ + static const unsigned mask[] = {0,1,3,7,15,31,63,127,255}; + static const double shift[9] = {1.0, 2.0, 4.0, 8.0, 16.0, 32.0, 64.0, 128.0, 256.0}; + + // code from wgrib routine BDS_unpack + const unsigned char *bits = igrib; + int n_bits = NumBits; + int c_bits, j_bits; + + // older unoptimized code, not often used + c_bits = 8; + for (long i = 0; i < jlend; ++i) + { + double jj = 0.0; + j_bits = n_bits; + while (c_bits <= j_bits) + { + if (c_bits == 8) + { + jj = jj * 256.0 + (double) (*bits++); + j_bits -= 8; + } + else + { + jj = (jj * shift[c_bits]) + (double) (*bits & mask[c_bits]); + bits++; + j_bits -= c_bits; + c_bits = 8; + } + } + + if (j_bits) + { + c_bits -= j_bits; + jj = (jj * shift[j_bits]) + (double) (((unsigned)*bits >> c_bits) & mask[j_bits]); + } + fpdata[i] = (T)(fmin + zscale*jj); + } +} + +static +void TEMPLATE(decode_array_2byte,T)(size_t jlend, const unsigned char *restrict igrib, + T *fpdata, T fmin, T zscale) +{ + const uint16_t *restrict sgrib = (const uint16_t *)(const void *)(igrib); + + if ( IS_BIGENDIAN() ) + { + for (size_t i = 0; i < jlend; ++i) + { + fpdata[i] = fmin + zscale * sgrib[i]; + } + } + else + { + for (size_t i = 0; i < jlend; ++i) + { + uint16_t ui16 = gribSwapByteOrder_uint16(sgrib[i]); + fpdata[i] = fmin + zscale * ui16; + } + } +} + +static +void TEMPLATE(decode_array,T)(const unsigned char *restrict igrib, long jlend, int numBits, + T fmin, T zscale, T *restrict fpdata) +{ +#if defined _GET_X86_COUNTER || defined _GET_MACH_COUNTER + uint64_t start_decode, end_decode; +#endif + +#ifdef VECTORCODE + GRIBPACK *lgrib = NULL; + + if ( numBits%8 == 0 ) + { + long jlenc = jlend * numBits / 8; + if ( jlenc > 0 ) + { + lgrib = (GRIBPACK*) Malloc(jlenc*sizeof(GRIBPACK)); + if ( lgrib == NULL ) SysError("No Memory!"); + + (void) UNPACK_GRIB(igrib, lgrib, jlenc, -1L); + } + } + + if ( numBits == 0 ) + { + for (long i = 0; i < jlend; ++i) + fpdata[i] = fmin; + } + else if ( numBits == 8 ) + for (long i = 0; i < jlend; ++i) + { + T dval = (int)lgrib[i]; + fpdata[i] = fmin + zscale * dval; + } + else if ( numBits == 16 ) + for (long i = 0; i < jlend; ++i) + { + T dval = (((int)lgrib[2*i ] << 8) + (int)lgrib[2*i+1]); + fpdata[i] = fmin + zscale * dval; + } + else if ( numBits == 24 ) + for (long i = 0; i < jlend; ++i) + { + T dval = (((int)lgrib[3*i ] << 16) + ((int)lgrib[3*i+1] << 8) + + (int)lgrib[3*i+2]); + fpdata[i] = fmin + zscale * dval; + } + else if ( numBits == 32 ) + for (long i = 0; i < jlend; ++i) + { + T dval = (((unsigned int)lgrib[4*i ] << 24) + ((unsigned int)lgrib[4*i+1] << 16) + + ((unsigned int)lgrib[4*i+2] << 8) + (unsigned int)lgrib[4*i+3]); + fpdata[i] = fmin + zscale * dval; + } + else if ( numBits <= 25 ) + { + TEMPLATE(decode_array_common,T)(igrib, jlend, numBits, fmin, zscale, fpdata); + } + else if ( numBits > 25 && numBits < 32 ) + { + TEMPLATE(decode_array_common2,T)(igrib, jlend, numBits, fmin, zscale, fpdata); + } + else + { + Error("Unimplemented packing factor %d!", numBits); + } + + if ( lgrib ) Free(lgrib); + +#else + if ( numBits == 0 ) + { + for (long i = 0; i < jlend; ++i) + fpdata[i] = fmin; + } + else if ( numBits == 8 ) + for (long i = 0; i < jlend; ++i) + { + T dval = (int)igrib[i]; + fpdata[i] = fmin + zscale * dval; + } + else if ( numBits == 16 ) + { + TEMPLATE(decode_array_2byte,T)((size_t) jlend, igrib, fpdata, fmin, zscale); + } + else if ( numBits == 24 ) + for (long i = 0; i < jlend; ++i) + { + T dval = (T)(((int)igrib[3*i ] << 16) + ((int)igrib[3*i+1] << 8) + + (int)igrib[3*i+2]); + fpdata[i] = fmin + zscale * dval; + } + else if ( numBits == 32 ) + for (long i = 0; i < jlend; ++i) + { + T dval = (T)(((unsigned int)igrib[4*i ] << 24) + ((unsigned int)igrib[4*i+1] << 16) + + ((unsigned int)igrib[4*i+2] << 8) + (unsigned int)igrib[4*i+3]); + fpdata[i] = fmin + zscale * dval; + } + else if ( numBits <= 25 ) + { + TEMPLATE(decode_array_common,T)(igrib, jlend, numBits, fmin, zscale, fpdata); + } + else if ( numBits > 25 && numBits < 32 ) + { + TEMPLATE(decode_array_common2,T)(igrib, jlend, numBits, fmin, zscale, fpdata); + } + else + { + Error("Unimplemented packing factor %d!", numBits); + } +#endif +} + +#endif /* T */ + +/* + * Local Variables: + * mode: c + * End: + */ + + +#ifdef T +#undef T +#endif +#define T double +#ifdef T + +static +int TEMPLATE(decodeGDS,T)(unsigned char *gds, int *isec0, int *isec2, T *fsec2, int *numGridVals) +{ + // int imisng = 0; + bool ReducedGrid = false, VertCoorTab = false; +#ifdef VECTORCODE + unsigned char *igrib; + GRIBPACK *lgrib = NULL; + size_t lGribLen = 0; +#endif + + *numGridVals = 0; + + memset(isec2, 0, 22*sizeof(int)); + + const unsigned gdsLen = GDS_Len; + + unsigned ipvpl = GDS_PVPL; + if ( ipvpl == 0 ) ipvpl = 0xFF; + + if ( ipvpl != 0xFF ) + { // Either vct or reduced grid + if ( GDS_NV != 0 ) + { // we have vct + VertCoorTab = true; + const unsigned ipl = 4*GDS_NV + ipvpl - 1; + if ( ipl < gdsLen ) ReducedGrid = true; + } + else + { + VertCoorTab = false; + ReducedGrid = true; + } + // ReducedGrid = (gdsLen - 32 - 4*GDS_NV); + } + + if ( ISEC0_GRIB_Version == 0 ) VertCoorTab = ((gdsLen - 32) > 0); + + if ( ReducedGrid ) + { + const unsigned locnl = GDS_PVPL - 1 + (VertCoorTab * 4 * GDS_NV); + const unsigned jlenl = (gdsLen - locnl) >> 1; + if ( jlenl == GDS_NumLat ) + { + *numGridVals = 0; + ISEC2_Reduced = true; + for (unsigned i = 0; i < jlenl; ++i) + { + ISEC2_ReducedPoints(i) = GET_UINT2(gds[locnl+2*i], gds[locnl+2*i+1]); + *numGridVals += ISEC2_ReducedPoints(i); + } + } + else + { + ReducedGrid = false; + } + } + + ISEC2_GridType = GDS_GridType; + + // Gaussian grid definition. + + if ( ISEC2_GridType == GRIB1_GTYPE_LATLON || + ISEC2_GridType == GRIB1_GTYPE_GAUSSIAN || + ISEC2_GridType == GRIB1_GTYPE_LATLON_ROT ) + { + ISEC2_NumLat = GDS_NumLat; + if ( ! ReducedGrid ) + { + ISEC2_NumLon = GDS_NumLon; + *numGridVals = ISEC2_NumLon*ISEC2_NumLat; + } + ISEC2_FirstLat = GDS_FirstLat; + ISEC2_FirstLon = GDS_FirstLon; + ISEC2_ResFlag = GDS_ResFlag; + ISEC2_LastLat = GDS_LastLat; + ISEC2_LastLon = GDS_LastLon; + ISEC2_LonIncr = GDS_LonIncr; + + ISEC2_NumPar = GDS_NumPar; + ISEC2_ScanFlag = GDS_ScanFlag; + if ( ISEC2_GridType == GRIB1_GTYPE_LATLON_ROT ) + { + ISEC2_LatSP = GDS_LatSP; + ISEC2_LonSP = GDS_LonSP; + FSEC2_RotAngle = (T)GDS_RotAngle; + } + // if ( Lons != Longitudes || Lats != Latitudes ) Error("Latitude/Longitude Conflict"); + } + else if ( ISEC2_GridType == GRIB1_GTYPE_GAUSSIAN || + ISEC2_GridType == GRIB1_GTYPE_GAUSSIAN_ROT || + ISEC2_GridType == GRIB1_GTYPE_GAUSSIAN_STR || + ISEC2_GridType == GRIB1_GTYPE_GAUSSIAN_ROTSTR ) + { + // iret = decodeGDS_GG(gds, gdspos, isec0, isec2, imisng); + } + else if ( ISEC2_GridType == GRIB1_GTYPE_LATLON || + ISEC2_GridType == GRIB1_GTYPE_LATLON_ROT || + ISEC2_GridType == GRIB1_GTYPE_LATLON_STR || + ISEC2_GridType == GRIB1_GTYPE_LATLON_ROTSTR ) + { + // iret = decodeGDS_LL(gds, gdspos, isec0, isec2, imisng); + } + else if ( ISEC2_GridType == GRIB1_GTYPE_LCC ) + { + ISEC2_NumLon = GDS_NumLon; + ISEC2_NumLat = GDS_NumLat; + *numGridVals = ISEC2_NumLon*ISEC2_NumLat; + ISEC2_FirstLat = GDS_FirstLat; + ISEC2_FirstLon = GDS_FirstLon; + ISEC2_ResFlag = GDS_ResFlag; + ISEC2_Lambert_Lov = GDS_Lambert_Lov; + ISEC2_Lambert_dx = GDS_Lambert_dx; + ISEC2_Lambert_dy = GDS_Lambert_dy; + ISEC2_Lambert_LatS1 = GDS_Lambert_LatS1; + ISEC2_Lambert_LatS2 = GDS_Lambert_LatS2; + ISEC2_Lambert_LatSP = GDS_Lambert_LatSP; + ISEC2_Lambert_LonSP = GDS_Lambert_LonSP; + ISEC2_Lambert_ProjFlag = GDS_Lambert_ProjFlag; + ISEC2_ScanFlag = GDS_ScanFlag; + } + else if ( ISEC2_GridType == GRIB1_GTYPE_SPECTRAL ) + { + ISEC2_PentaJ = GDS_PentaJ; // Truncation + ISEC2_PentaK = GDS_PentaK; + ISEC2_PentaM = GDS_PentaM; + ISEC2_RepType = GDS_RepType; + ISEC2_RepMode = GDS_RepMode; + *numGridVals = (ISEC2_PentaJ+1)*(ISEC2_PentaJ+2); + isec2[ 6] = 0; + isec2[ 7] = 0; + isec2[ 8] = 0; + isec2[ 9] = 0; + isec2[10] = 0; + // iret = decodeGDS_SH(gds, gdspos, isec0, isec2, imisng); + } + else if ( ISEC2_GridType == GRIB1_GTYPE_GME ) + { + ISEC2_GME_NI2 = GDS_GME_NI2; + ISEC2_GME_NI3 = GDS_GME_NI3; + ISEC2_GME_ND = GDS_GME_ND; + ISEC2_GME_NI = GDS_GME_NI; + ISEC2_GME_AFlag = GDS_GME_AFlag; + ISEC2_GME_LatPP = GDS_GME_LatPP; + ISEC2_GME_LonPP = GDS_GME_LonPP; + ISEC2_GME_LonMPL = GDS_GME_LonMPL; + ISEC2_GME_BFlag = GDS_GME_BFlag; + *numGridVals = (ISEC2_GME_NI+1)*(ISEC2_GME_NI+1)*10; + // iret = decodeGDS_TR(gds, gdspos, isec0, isec2, imisng); + } + else + { + static bool lwarn = true; + ISEC2_NumLon = GDS_NumLon; + ISEC2_NumLat = GDS_NumLat; + *numGridVals = ISEC2_NumLon*ISEC2_NumLat; + if ( lwarn ) + { + lwarn = false; + Message("GRIB gridtype %d unsupported", ISEC2_GridType); + } + } + + // Vertical coordinate parameters for hybrid levels. + // Get number of vertical coordinate parameters, if any. + + ISEC2_NumVCP = 0; + + isec2[17] = 0; + isec2[18] = 0; + + if ( VertCoorTab ) + { + int locnv; + if ( ISEC0_GRIB_Version == 0 ) + { + locnv = 32; + ISEC2_NumVCP = (gdsLen - 32) >> 2; + } + else + { + locnv = GDS_PVPL - 1; + ISEC2_NumVCP = GDS_NV; + } +#if defined (SX) + lGribLen = 4*ISEC2_NumVCP; + lgrib = (GRIBPACK*) Malloc(lGribLen*sizeof(GRIBPACK)); + + igrib = &gds[locnv]; + if ( ISEC2_NumVCP > 0 ) (void) UNPACK_GRIB(igrib, lgrib, lGribLen, -1L); + for (int i = 0; i < ISEC2_NumVCP; ++i) + { + const int iexp = lgrib[4*i]; + const int imant = GET_UINT3(lgrib[4*i+1], lgrib[4*i+2], lgrib[4*i+3]); + fsec2[10+i] = POW_2_M24 * imant * ldexp(1.0, 4 * (iexp - 64)); + } + + Free(lgrib); +#else + for (int i = 0; i < ISEC2_NumVCP; ++i) + { + const int iexp = gds[locnv+4*i]; + const int imant = GET_UINT3(gds[locnv+4*i+1], gds[locnv+4*i+2], gds[locnv+4*i+3]); + fsec2[10+i] = (T)decfp2(iexp,imant); + } +#endif + } + + return gdsLen; +} + +#define ldexp_double ldexp +#define ldexp_float ldexpf +#define pow_double pow +#define pow_float powf + +static +void TEMPLATE(decodeBDS,T)(int decscale, unsigned char *bds, int *isec2, int *isec4, + T *fsec4, int fsec4len, int dfunc, int bdsLen, int numGridVals, int *iret) +{ + int ioff = 0; + enum { bds_head = 11 }; + T zscale = 0.; + T fmin = 0.; + T *fpdata = fsec4; + + *iret = 0; + unsigned char *igrib = bds; + + memset(isec4, 0, 42*sizeof(int)); + + // 4 bit flag / 4 bit count of unused bits at end of block octet. + + const int bds_flag = BDS_Flag; + + // 0------- grid point + // 1------- spherical harmonics + + const bool lspherc = (bds_flag >> 7)&1; + if ( lspherc ) isec4[2] = 128; + else isec4[2] = 0; + + // -0------ simple packing + // -1------ complex packing + + const bool lcomplex = (bds_flag >> 6)&1; + if ( lcomplex ) isec4[3] = 64; + else isec4[3] = 0; + + // ---0---- No additional flags + // ---1---- No additional flags + + const bool lcompress = (bds_flag >> 4)&1; + + unsigned zoff; + if ( lcompress ) + { isec4[5] = 16; isec4[6] = BDS_Z; zoff = 12; } + else + { isec4[5] = 0; isec4[6] = 0; zoff = 0; } + + // ----++++ number of unused bits at end of section) + + const int bds_ubits = bds_flag & 0xF; + + // scale factor (2 bytes) + const int jscale = BDS_BinScale; + + // check for missing data indicators. + + const int iexp = bds[ 6]; + const int imant = GET_UINT3(bds[ 7], bds[ 8], bds[ 9]); + + const int imiss = (jscale == 0xFFFF && iexp == 0xFF && imant == 0xFFFFFF); + + // convert reference value and scale factor. + + if ( ! (dfunc == 'J') && imiss == 0 ) + { + fmin = (T)BDS_RefValue; + zscale = TEMPLATE(ldexp,T)((T)1.0, jscale); + } + + // get number of bits in each data value. + + ISEC4_NumBits = BDS_NumBits; + + // octet number of start of packed data calculated from start of block 4 - 1 + + unsigned locnd = zoff + bds_head; + + // if data is in spherical harmonic form, distinguish between simple/complex packing (lcomplex = 0/1) + + if ( lspherc ) + { + if ( !lcomplex ) + { + // no unpacked binary data present octet number of start of packed data + // calculated from start of block 4 - 1 + + ioff = 1; + locnd += 4*ioff; // RealCoef + + // get real (0,0) coefficient in grib format and convert to floating point. + if ( dfunc != 'J' ) + { + if ( imiss ) *fpdata++ = 0.0; + else *fpdata++ = (T)BDS_RealCoef; + } + } + else // complex packed spherical harmonics + { + isec4[15] = BDS_PackData; + // scaling factor + isec4[16] = BDS_Power; + + // pentagonal resolution parameters of the unpacked section of data field + + const int jup = bds[zoff+15]; + const int kup = bds[zoff+16]; + const int mup = bds[zoff+17]; + + isec4[zoff+17] = jup; + isec4[zoff+18] = kup; + isec4[zoff+19] = mup; + + // unpacked binary data + + locnd += 4; // 2 + power + locnd += 3; // j, k, m + ioff = (jup+1)*(jup+2); + + if ( dfunc != 'J' ) + for (int i = 0; i < ioff; ++i) + { + if ( imiss ) + *fpdata++ = 0.0; + else + { + const int iexp2 = (bds[locnd+4*i]); + const int imant2 = GET_UINT3(bds[locnd+4*i+1], bds[locnd+4*i+2], bds[locnd+4*i+3]); + *fpdata++ = (T)decfp2(iexp2,imant2); + } + } + + locnd += 4*ioff; /* RealCoef */ + } + } + else + { + if ( lcomplex ) + { + *iret = 1999; + gprintf(__func__, " Second order packed grids unsupported!"); + gprintf(__func__, " Return code = %d", *iret); + return; + } + } + + // Decode data values to floating point and store in fsec4. + // First calculate the number of data values. + // Take into account that spherical harmonics can be packed + // simple (lcomplex = 0) or complex (lcomplex = 1) + + int jlend = bdsLen - locnd; + + if ( ISEC4_NumBits == 0 ) + { + if ( jlend > 1 ) + { + *iret = 2001; + gprintf(__func__, " Number of bits per data value = 0!"); + gprintf(__func__, " Return code = %d", *iret); + return; + } + + if ( numGridVals == 0 ) + { + *iret = 2002; + gprintf(__func__, " Constant field unsupported for this grid type!"); + gprintf(__func__, " Return code = %d", *iret); + return; + } + + jlend = numGridVals; + jlend -= ioff; + } + else + { + jlend = (int) (((long)jlend*8 - bds_ubits) / ISEC4_NumBits); + } + + ISEC4_NumValues = jlend + ioff; + ISEC4_NumNonMissValues = 0; + + if ( lcompress ) + { + const size_t len = ((size_t) ((bds[17]<<16)+(bds[18]<<8)+bds[19])); + + ISEC4_NumValues = (int)(len*8/(size_t)ISEC4_NumBits); + + if ( lspherc ) ISEC4_NumValues += lcomplex ? ioff : 1; + } + + if ( dfunc == 'J' ) return; + + // check length of output array. + + if ( ISEC4_NumValues > fsec4len ) + { + *iret = 710; + gprintf(__func__, " Output array too small. Length = %d", fsec4len); + gprintf(__func__, " Number of values = %d", ISEC4_NumValues); + gprintf(__func__, " Return code = %d", *iret); + return; + } + + if ( imiss ) memset((char *)fpdata, 0, (size_t)jlend*sizeof(T)); + else + { + igrib += locnd; + + TEMPLATE(decode_array,T)(igrib, jlend, ISEC4_NumBits, fmin, zscale, fpdata); + } + + if ( lspherc && lcomplex ) + { + int pcStart = isec4[19], pcScale = isec4[16]; + TEMPLATE(scatter_complex,T)(fsec4, pcStart, ISEC2_PentaJ, ISEC4_NumValues); + TEMPLATE(scale_complex,T)(fsec4, pcStart, pcScale, ISEC2_PentaJ, 1); + } + + if ( CGRIBEX_Fix_ZSE ) // Fix ZeroShiftError of simple packed spherical harmonics + if ( lspherc && !lcomplex ) + { + // 20100705: Fix ZeroShiftError - Edi Kirk + if ( IS_NOT_EQUAL(fsec4[1], 0.0) ) + { + const T zserr = fsec4[1]; + for (int i = 1; i < ISEC4_NumValues; ++i) fsec4[i] -= zserr; + } + } + + if ( decscale ) + { + const T scale = TEMPLATE(pow,T)((T)10.0, (T)-decscale); + for (int i = 0; i < ISEC4_NumValues; ++i) fsec4[i] *= scale; + } +} + + +void TEMPLATE(grib_decode,T)(int *isec0, int *isec1, int *isec2, T *fsec2, int *isec3, + T *fsec3, int *isec4, T *fsec4, int fsec4len, int *kgrib, + int kleng, int *kword, int dfunc, int *iret) +{ + UCHAR *bms = NULL; + bool lsect2 = false, lsect3 = false; + static bool lmissvalinfo = true; + + UNUSED(kleng); + + *iret = 0; + + grsdef(); + + ISEC2_Reduced = false; + + // ---------------------------------------------------------------- + // IS Indicator Section (Section 0) + // ---------------------------------------------------------------- + UCHAR *is = (UCHAR *) &kgrib[0]; + int isLen = decodeIS(is, isec0, iret); + + int gribLen = ISEC0_GRIB_Len; + + /* + When decoding or calculating length, previous editions + of the GRIB code must be taken into account. + + In the table below, covering sections 0 and 1 of the GRIB + code, octet numbering is from the beginning of the GRIB + message; + * indicates that the value is not available in the code edition; + R indicates reserved, should be set to 0; + Experimental edition is considered as edition -1. + + GRIB code edition -1 has fixed length of 20 octets for + section 1, the length not included in the message. + GRIB code edition 0 has fixed length of 24 octets for + section 1, the length being included in the message. + GRIB code edition 1 can have different lengths for section + 1, the minimum being 28 octets, length being included in + the message. + + Octet numbers for code + editions + + Contents. -1 0 1 + --------- ---------------------- + Letters GRIB 1-4 1-4 1-4 + Total length of GRIB message. * * 5-7 + GRIB code edition number * * 8 + Length of Section 1. * 5-7 9-11 + Reserved octet (R). * 8(R) * + Version no. of Code Table 2. * * 12 + Identification of centre. 5 9 13 + Generating process. 6 10 14 + Grid definition . 7 11 15 + Flag (Code Table 1). 8 12 16 + Indicator of parameter. 9 13 17 + Indicator of type of level. 10 14 18 + Height, pressure etc of levels. 11-12 15-16 19-20 + Year of century. 13 17 21 + Month. 14 18 22 + Day. 15 19 23 + Hour. 16 20 24 + Minute. 17 21 25 + Indicator of unit of time. 18 22 26 + P1 - Period of time. 19 23 27 + P2 - Period of time 20(R) 24 28 + or reserved octet (R). + Time range indicator. 21(R) 25 29 + or reserved octet (R). + Number included in average. 22-23(R) 26-27 30-31 + or reserved octet (R). + Number missing from average. 24(R) 28(R) 32 + or reserved octet (R). + Century of data. * * 33 + Designates sub-centre if not 0. * * 34 + Decimal scale factor. * * 35-36 + Reserved. Set to 0. * * 37-48 + (Need not be present) + For originating centre use only. * * 49-nn + (Need not be present) + + Identify which GRIB code edition is being decoded. + + In GRIB edition 1, the edition number is in octet 8. + In GRIB edition 0, octet 8 is reserved and set to 0. + In GRIB edition -1, octet 8 is a flag field and can have a + a valid value of 0, 1, 2 or 3. + + However, GRIB edition number 0 has a fixed + length of 24, included in the message, for section 1, so + if the value extracted from octets 5-7 is 24 and that from + octet 8 is 0, it is safe to assume edition 0 of the code. + + */ + + // Set length of GRIB message to missing data value. + if ( ISEC0_GRIB_Len == 24 && ISEC0_GRIB_Version == 0 ) ISEC0_GRIB_Len = 0; + + // ---------------------------------------------------------------- + // PDS Product Definition Section (Section 1) + // ---------------------------------------------------------------- + UCHAR *pds = is + isLen; + int pdsLen = decodePDS(pds, isec0, isec1); + + // ---------------------------------------------------------------- + // GDS Grid Description Section (Section 2) + // ---------------------------------------------------------------- + int numGridVals = 0; + int gdsLen = 0; + const bool gdsIncluded = ISEC1_Sec2Or3Flag & 128; + if ( gdsIncluded ) + { + UCHAR *gds = is + isLen + pdsLen; + gdsLen = TEMPLATE(decodeGDS,T)(gds, isec0, isec2, fsec2, &numGridVals); + } + + // ---------------------------------------------------------------- + // BMS Bit-Map Section Section (Section 3) + // ---------------------------------------------------------------- + isec3[0] = 0; + int bmsLen = 0, bitmapSize = 0, imaskSize = 0; + const bool bmsIncluded = ISEC1_Sec2Or3Flag & 64; + if ( bmsIncluded ) + { + bms = is + isLen + pdsLen + gdsLen; + bmsLen = BMS_Len; + + imaskSize = (bmsLen > 6) ? (bmsLen - 6)<<3 : 0; + bitmapSize = imaskSize - BMS_UnusedBits; + } + + // ---------------------------------------------------------------- + // BDS Binary Data Section (Section 4) + // ---------------------------------------------------------------- + UCHAR *bds = is + isLen + pdsLen + gdsLen + bmsLen; + int bdsLen = BDS_Len; + /* + If a very large product, the section 4 length field holds + the number of bytes in the product after section 4 upto + the end of the padding bytes. + This is a fixup to get round the restriction on product lengths + due to the count being only 24 bits. It is only possible because + the (default) rounding for GRIB products is 120 bytes. + */ + const bool llarge = (gribLen > JP23SET && bdsLen <= 120); + if ( llarge ) + { + gribLen &= JP23SET; + gribLen *= 120; + ISEC0_GRIB_Len = gribLen; + bdsLen = correct_bdslen(bdsLen, gribLen, isLen+pdsLen+gdsLen+bmsLen); + } + + TEMPLATE(decodeBDS,T)(ISEC1_DecScaleFactor, bds, isec2, isec4, fsec4, fsec4len, dfunc, bdsLen, numGridVals, iret); + + if ( *iret != 0 ) return; + + ISEC4_NumNonMissValues = ISEC4_NumValues; + + if ( bitmapSize > 0 ) + { + if ( dfunc != 'L' && dfunc != 'J' ) + if ( DBL_IS_NAN(FSEC3_MissVal) && lmissvalinfo ) + { + lmissvalinfo = false; + FSEC3_MissVal = (T)GRIB_MISSVAL; + Message("Missing value = NaN is unsupported, set to %g!", GRIB_MISSVAL); + } + + // ISEC4_NumNonMissValues = ISEC4_NumValues; + ISEC4_NumValues = bitmapSize; + + if ( dfunc != 'J' || bitmapSize == ISEC4_NumNonMissValues ) + { + GRIBPACK bitmap; + /* + unsigned char *bitmap; + bitmap = BMS_Bitmap; + int j = ISEC4_NumNonMissValues; + for (int i = ISEC4_NumValues-1; i >= 0; --i) + { + fsec4[i] = ((bitmap[i/8]>>(7-(i&7)))&1) ? fsec4[--j] : FSEC3_MissVal; + } + */ + + GRIBPACK *imask = (GRIBPACK*) Malloc((size_t)imaskSize*sizeof(GRIBPACK)); + +#ifdef VECTORCODE + (void) UNPACK_GRIB(BMS_Bitmap, imask, imaskSize/8, -1L); + GRIBPACK *pbitmap = imask; +#else + GRIBPACK *pbitmap = BMS_Bitmap; +#endif + +#if defined (CRAY) +#pragma _CRI ivdep +#endif +#if defined (SX) +#pragma vdir nodep +#endif +#ifdef __uxpch__ +#pragma loop novrec +#endif + for (int i = imaskSize/8-1; i >= 0; --i) + { + bitmap = pbitmap[i]; + imask[i*8+0] = 1 & (bitmap >> 7); + imask[i*8+1] = 1 & (bitmap >> 6); + imask[i*8+2] = 1 & (bitmap >> 5); + imask[i*8+3] = 1 & (bitmap >> 4); + imask[i*8+4] = 1 & (bitmap >> 3); + imask[i*8+5] = 1 & (bitmap >> 2); + imask[i*8+6] = 1 & (bitmap >> 1); + imask[i*8+7] = 1 & (bitmap); + } + + int j = 0; + for (int i = 0; i < ISEC4_NumValues; ++i) + if ( imask[i] ) j++; + + if ( ISEC4_NumNonMissValues != j ) + { + if ( dfunc != 'J' && ISEC4_NumBits != 0 ) + Warning("Bitmap (%d) and data (%d) section differ, using bitmap section!", j, ISEC4_NumNonMissValues); + + ISEC4_NumNonMissValues = j; + } + + if ( dfunc != 'J' ) + { +#if defined (CRAY) +#pragma _CRI ivdep +#endif +#if defined (SX) +#pragma vdir nodep +#endif +#ifdef __uxpch__ +#pragma loop novrec +#endif + for (int i = ISEC4_NumValues-1; i >= 0; --i) + fsec4[i] = imask[i] ? fsec4[--j] : FSEC3_MissVal; + } + + Free(imask); + } + } + + if ( ISEC2_Reduced ) + { + int nvalues = 0; + int nlat = ISEC2_NumLat; + int nlon = ISEC2_ReducedPointsPtr[0]; + for (int ilat = 0; ilat < nlat; ++ilat) nvalues += ISEC2_ReducedPoints(ilat); + for (int ilat = 1; ilat < nlat; ++ilat) + if ( ISEC2_ReducedPoints(ilat) > nlon ) nlon = ISEC2_ReducedPoints(ilat); + + // int dlon = ISEC2_LastLon-ISEC2_FirstLon; + // if ( dlon < 0 ) dlon += 360000; + + if ( nvalues != ISEC4_NumValues ) *iret = -801; + + //printf("nlat %d nlon %d \n", nlat, nlon); + //printf("nvalues %d %d\n", nvalues, ISEC4_NumValues); + + if ( dfunc == 'R' && *iret == -801 ) + gprintf(__func__, "Number of values (%d) and sum of lons per row (%d) differ, abort conversion to regular Gaussian grid!", + ISEC4_NumValues, nvalues); + + if ( dfunc == 'R' && *iret != -801 ) + { + ISEC2_Reduced = 0; + ISEC2_NumLon = nlon; + ISEC4_NumValues = nlon*nlat; + + lsect3 = bitmapSize > 0; + int lperio = 1; + int lveggy = (ISEC1_CodeTable == 128) && (ISEC1_CenterID == 98) && + ((ISEC1_Parameter == 27) || (ISEC1_Parameter == 28) || + (ISEC1_Parameter == 29) || (ISEC1_Parameter == 30) || + (ISEC1_Parameter == 39) || (ISEC1_Parameter == 40) || + (ISEC1_Parameter == 41) || (ISEC1_Parameter == 42) || + (ISEC1_Parameter == 43)); + + (void) TEMPLATE(qu2reg3,T)(fsec4, ISEC2_ReducedPointsPtr, nlat, nlon, FSEC3_MissVal, iret, lsect3, lperio, lveggy); + + if ( bitmapSize > 0 ) + { + int j = 0; + for (int i = 0; i < ISEC4_NumValues; ++i) + if ( IS_NOT_EQUAL(fsec4[i], FSEC3_MissVal) ) j++; + + ISEC4_NumNonMissValues = j; + } + } + } + + if ( ISEC0_GRIB_Version == 1 ) isLen = 8; + const int esLen = 4; + gribLen = isLen + pdsLen + gdsLen + bmsLen + bdsLen + esLen; + + if ( !llarge && ISEC0_GRIB_Len && ISEC0_GRIB_Len < gribLen ) + Warning("Inconsistent length of GRIB message (grib_message_size=%d < grib_record_size=%d)!", ISEC0_GRIB_Len, gribLen); + + ISEC0_GRIB_Len = gribLen; + + *kword = (int)(((size_t)gribLen + sizeof(int) - 1) / sizeof(int)); + + // ---------------------------------------------------------------- + // Section 9 . Abort/return to calling routine. + // ---------------------------------------------------------------- + bool ldebug = false, l_iorj = false; + if ( ldebug ) + { + gprintf(__func__, "Section 9."); + gprintf(__func__, "Output values set -"); + + gribPrintSec0(isec0); + gribPrintSec1(isec0, isec1); + // Print section 2 if present. + if ( lsect2 ) TEMPLATE(gribPrintSec2,T)(isec0, isec2, fsec2); + + if ( ! l_iorj ) + { + // Print section 3 if present. + if ( lsect3 ) TEMPLATE(gribPrintSec3,T)(isec0, isec3, fsec3); + + TEMPLATE(gribPrintSec4,T)(isec0, isec4, fsec4); + // Special print for 2D spectra wave field real values in section 4 + if ( (isec1[ 0] == 140) && + (isec1[ 1] == 98) && + (isec1[23] == 1) && + ((isec1[39] == 1045) || (isec1[39] == 1081)) && + ((isec1[ 5] == 250) || (isec1[ 5] == 251)) ) + gribPrintSec4Wave(isec4); + } + } +} + +#endif /* T */ + +/* + * Local Variables: + * mode: c + * End: + */ + +#ifdef T +#undef T +#endif +#define T float +#ifdef T + +static +int TEMPLATE(decodeGDS,T)(unsigned char *gds, int *isec0, int *isec2, T *fsec2, int *numGridVals) +{ + // int imisng = 0; + bool ReducedGrid = false, VertCoorTab = false; +#ifdef VECTORCODE + unsigned char *igrib; + GRIBPACK *lgrib = NULL; + size_t lGribLen = 0; +#endif + + *numGridVals = 0; + + memset(isec2, 0, 22*sizeof(int)); + + const unsigned gdsLen = GDS_Len; + + unsigned ipvpl = GDS_PVPL; + if ( ipvpl == 0 ) ipvpl = 0xFF; + + if ( ipvpl != 0xFF ) + { // Either vct or reduced grid + if ( GDS_NV != 0 ) + { // we have vct + VertCoorTab = true; + const unsigned ipl = 4*GDS_NV + ipvpl - 1; + if ( ipl < gdsLen ) ReducedGrid = true; + } + else + { + VertCoorTab = false; + ReducedGrid = true; + } + // ReducedGrid = (gdsLen - 32 - 4*GDS_NV); + } + + if ( ISEC0_GRIB_Version == 0 ) VertCoorTab = ((gdsLen - 32) > 0); + + if ( ReducedGrid ) + { + const unsigned locnl = GDS_PVPL - 1 + (VertCoorTab * 4 * GDS_NV); + const unsigned jlenl = (gdsLen - locnl) >> 1; + if ( jlenl == GDS_NumLat ) + { + *numGridVals = 0; + ISEC2_Reduced = true; + for (unsigned i = 0; i < jlenl; ++i) + { + ISEC2_ReducedPoints(i) = GET_UINT2(gds[locnl+2*i], gds[locnl+2*i+1]); + *numGridVals += ISEC2_ReducedPoints(i); + } + } + else + { + ReducedGrid = false; + } + } + + ISEC2_GridType = GDS_GridType; + + // Gaussian grid definition. + + if ( ISEC2_GridType == GRIB1_GTYPE_LATLON || + ISEC2_GridType == GRIB1_GTYPE_GAUSSIAN || + ISEC2_GridType == GRIB1_GTYPE_LATLON_ROT ) + { + ISEC2_NumLat = GDS_NumLat; + if ( ! ReducedGrid ) + { + ISEC2_NumLon = GDS_NumLon; + *numGridVals = ISEC2_NumLon*ISEC2_NumLat; + } + ISEC2_FirstLat = GDS_FirstLat; + ISEC2_FirstLon = GDS_FirstLon; + ISEC2_ResFlag = GDS_ResFlag; + ISEC2_LastLat = GDS_LastLat; + ISEC2_LastLon = GDS_LastLon; + ISEC2_LonIncr = GDS_LonIncr; + + ISEC2_NumPar = GDS_NumPar; + ISEC2_ScanFlag = GDS_ScanFlag; + if ( ISEC2_GridType == GRIB1_GTYPE_LATLON_ROT ) + { + ISEC2_LatSP = GDS_LatSP; + ISEC2_LonSP = GDS_LonSP; + FSEC2_RotAngle = (T)GDS_RotAngle; + } + // if ( Lons != Longitudes || Lats != Latitudes ) Error("Latitude/Longitude Conflict"); + } + else if ( ISEC2_GridType == GRIB1_GTYPE_GAUSSIAN || + ISEC2_GridType == GRIB1_GTYPE_GAUSSIAN_ROT || + ISEC2_GridType == GRIB1_GTYPE_GAUSSIAN_STR || + ISEC2_GridType == GRIB1_GTYPE_GAUSSIAN_ROTSTR ) + { + // iret = decodeGDS_GG(gds, gdspos, isec0, isec2, imisng); + } + else if ( ISEC2_GridType == GRIB1_GTYPE_LATLON || + ISEC2_GridType == GRIB1_GTYPE_LATLON_ROT || + ISEC2_GridType == GRIB1_GTYPE_LATLON_STR || + ISEC2_GridType == GRIB1_GTYPE_LATLON_ROTSTR ) + { + // iret = decodeGDS_LL(gds, gdspos, isec0, isec2, imisng); + } + else if ( ISEC2_GridType == GRIB1_GTYPE_LCC ) + { + ISEC2_NumLon = GDS_NumLon; + ISEC2_NumLat = GDS_NumLat; + *numGridVals = ISEC2_NumLon*ISEC2_NumLat; + ISEC2_FirstLat = GDS_FirstLat; + ISEC2_FirstLon = GDS_FirstLon; + ISEC2_ResFlag = GDS_ResFlag; + ISEC2_Lambert_Lov = GDS_Lambert_Lov; + ISEC2_Lambert_dx = GDS_Lambert_dx; + ISEC2_Lambert_dy = GDS_Lambert_dy; + ISEC2_Lambert_LatS1 = GDS_Lambert_LatS1; + ISEC2_Lambert_LatS2 = GDS_Lambert_LatS2; + ISEC2_Lambert_LatSP = GDS_Lambert_LatSP; + ISEC2_Lambert_LonSP = GDS_Lambert_LonSP; + ISEC2_Lambert_ProjFlag = GDS_Lambert_ProjFlag; + ISEC2_ScanFlag = GDS_ScanFlag; + } + else if ( ISEC2_GridType == GRIB1_GTYPE_SPECTRAL ) + { + ISEC2_PentaJ = GDS_PentaJ; // Truncation + ISEC2_PentaK = GDS_PentaK; + ISEC2_PentaM = GDS_PentaM; + ISEC2_RepType = GDS_RepType; + ISEC2_RepMode = GDS_RepMode; + *numGridVals = (ISEC2_PentaJ+1)*(ISEC2_PentaJ+2); + isec2[ 6] = 0; + isec2[ 7] = 0; + isec2[ 8] = 0; + isec2[ 9] = 0; + isec2[10] = 0; + // iret = decodeGDS_SH(gds, gdspos, isec0, isec2, imisng); + } + else if ( ISEC2_GridType == GRIB1_GTYPE_GME ) + { + ISEC2_GME_NI2 = GDS_GME_NI2; + ISEC2_GME_NI3 = GDS_GME_NI3; + ISEC2_GME_ND = GDS_GME_ND; + ISEC2_GME_NI = GDS_GME_NI; + ISEC2_GME_AFlag = GDS_GME_AFlag; + ISEC2_GME_LatPP = GDS_GME_LatPP; + ISEC2_GME_LonPP = GDS_GME_LonPP; + ISEC2_GME_LonMPL = GDS_GME_LonMPL; + ISEC2_GME_BFlag = GDS_GME_BFlag; + *numGridVals = (ISEC2_GME_NI+1)*(ISEC2_GME_NI+1)*10; + // iret = decodeGDS_TR(gds, gdspos, isec0, isec2, imisng); + } + else + { + static bool lwarn = true; + ISEC2_NumLon = GDS_NumLon; + ISEC2_NumLat = GDS_NumLat; + *numGridVals = ISEC2_NumLon*ISEC2_NumLat; + if ( lwarn ) + { + lwarn = false; + Message("GRIB gridtype %d unsupported", ISEC2_GridType); + } + } + + // Vertical coordinate parameters for hybrid levels. + // Get number of vertical coordinate parameters, if any. + + ISEC2_NumVCP = 0; + + isec2[17] = 0; + isec2[18] = 0; + + if ( VertCoorTab ) + { + int locnv; + if ( ISEC0_GRIB_Version == 0 ) + { + locnv = 32; + ISEC2_NumVCP = (gdsLen - 32) >> 2; + } + else + { + locnv = GDS_PVPL - 1; + ISEC2_NumVCP = GDS_NV; + } +#if defined (SX) + lGribLen = 4*ISEC2_NumVCP; + lgrib = (GRIBPACK*) Malloc(lGribLen*sizeof(GRIBPACK)); + + igrib = &gds[locnv]; + if ( ISEC2_NumVCP > 0 ) (void) UNPACK_GRIB(igrib, lgrib, lGribLen, -1L); + for (int i = 0; i < ISEC2_NumVCP; ++i) + { + const int iexp = lgrib[4*i]; + const int imant = GET_UINT3(lgrib[4*i+1], lgrib[4*i+2], lgrib[4*i+3]); + fsec2[10+i] = POW_2_M24 * imant * ldexp(1.0, 4 * (iexp - 64)); + } + + Free(lgrib); +#else + for (int i = 0; i < ISEC2_NumVCP; ++i) + { + const int iexp = gds[locnv+4*i]; + const int imant = GET_UINT3(gds[locnv+4*i+1], gds[locnv+4*i+2], gds[locnv+4*i+3]); + fsec2[10+i] = (T)decfp2(iexp,imant); + } +#endif + } + + return gdsLen; +} + +#define ldexp_double ldexp +#define ldexp_float ldexpf +#define pow_double pow +#define pow_float powf + +static +void TEMPLATE(decodeBDS,T)(int decscale, unsigned char *bds, int *isec2, int *isec4, + T *fsec4, int fsec4len, int dfunc, int bdsLen, int numGridVals, int *iret) +{ + int ioff = 0; + enum { bds_head = 11 }; + T zscale = 0.; + T fmin = 0.; + T *fpdata = fsec4; + + *iret = 0; + unsigned char *igrib = bds; + + memset(isec4, 0, 42*sizeof(int)); + + // 4 bit flag / 4 bit count of unused bits at end of block octet. + + const int bds_flag = BDS_Flag; + + // 0------- grid point + // 1------- spherical harmonics + + const bool lspherc = (bds_flag >> 7)&1; + if ( lspherc ) isec4[2] = 128; + else isec4[2] = 0; + + // -0------ simple packing + // -1------ complex packing + + const bool lcomplex = (bds_flag >> 6)&1; + if ( lcomplex ) isec4[3] = 64; + else isec4[3] = 0; + + // ---0---- No additional flags + // ---1---- No additional flags + + const bool lcompress = (bds_flag >> 4)&1; + + unsigned zoff; + if ( lcompress ) + { isec4[5] = 16; isec4[6] = BDS_Z; zoff = 12; } + else + { isec4[5] = 0; isec4[6] = 0; zoff = 0; } + + // ----++++ number of unused bits at end of section) + + const int bds_ubits = bds_flag & 0xF; + + // scale factor (2 bytes) + const int jscale = BDS_BinScale; + + // check for missing data indicators. + + const int iexp = bds[ 6]; + const int imant = GET_UINT3(bds[ 7], bds[ 8], bds[ 9]); + + const int imiss = (jscale == 0xFFFF && iexp == 0xFF && imant == 0xFFFFFF); + + // convert reference value and scale factor. + + if ( ! (dfunc == 'J') && imiss == 0 ) + { + fmin = (T)BDS_RefValue; + zscale = TEMPLATE(ldexp,T)((T)1.0, jscale); + } + + // get number of bits in each data value. + + ISEC4_NumBits = BDS_NumBits; + + // octet number of start of packed data calculated from start of block 4 - 1 + + unsigned locnd = zoff + bds_head; + + // if data is in spherical harmonic form, distinguish between simple/complex packing (lcomplex = 0/1) + + if ( lspherc ) + { + if ( !lcomplex ) + { + // no unpacked binary data present octet number of start of packed data + // calculated from start of block 4 - 1 + + ioff = 1; + locnd += 4*ioff; // RealCoef + + // get real (0,0) coefficient in grib format and convert to floating point. + if ( dfunc != 'J' ) + { + if ( imiss ) *fpdata++ = 0.0; + else *fpdata++ = (T)BDS_RealCoef; + } + } + else // complex packed spherical harmonics + { + isec4[15] = BDS_PackData; + // scaling factor + isec4[16] = BDS_Power; + + // pentagonal resolution parameters of the unpacked section of data field + + const int jup = bds[zoff+15]; + const int kup = bds[zoff+16]; + const int mup = bds[zoff+17]; + + isec4[zoff+17] = jup; + isec4[zoff+18] = kup; + isec4[zoff+19] = mup; + + // unpacked binary data + + locnd += 4; // 2 + power + locnd += 3; // j, k, m + ioff = (jup+1)*(jup+2); + + if ( dfunc != 'J' ) + for (int i = 0; i < ioff; ++i) + { + if ( imiss ) + *fpdata++ = 0.0; + else + { + const int iexp2 = (bds[locnd+4*i]); + const int imant2 = GET_UINT3(bds[locnd+4*i+1], bds[locnd+4*i+2], bds[locnd+4*i+3]); + *fpdata++ = (T)decfp2(iexp2,imant2); + } + } + + locnd += 4*ioff; /* RealCoef */ + } + } + else + { + if ( lcomplex ) + { + *iret = 1999; + gprintf(__func__, " Second order packed grids unsupported!"); + gprintf(__func__, " Return code = %d", *iret); + return; + } + } + + // Decode data values to floating point and store in fsec4. + // First calculate the number of data values. + // Take into account that spherical harmonics can be packed + // simple (lcomplex = 0) or complex (lcomplex = 1) + + int jlend = bdsLen - locnd; + + if ( ISEC4_NumBits == 0 ) + { + if ( jlend > 1 ) + { + *iret = 2001; + gprintf(__func__, " Number of bits per data value = 0!"); + gprintf(__func__, " Return code = %d", *iret); + return; + } + + if ( numGridVals == 0 ) + { + *iret = 2002; + gprintf(__func__, " Constant field unsupported for this grid type!"); + gprintf(__func__, " Return code = %d", *iret); + return; + } + + jlend = numGridVals; + jlend -= ioff; + } + else + { + jlend = (int) (((long)jlend*8 - bds_ubits) / ISEC4_NumBits); + } + + ISEC4_NumValues = jlend + ioff; + ISEC4_NumNonMissValues = 0; + + if ( lcompress ) + { + const size_t len = ((size_t) ((bds[17]<<16)+(bds[18]<<8)+bds[19])); + + ISEC4_NumValues = (int)(len*8/(size_t)ISEC4_NumBits); + + if ( lspherc ) ISEC4_NumValues += lcomplex ? ioff : 1; + } + + if ( dfunc == 'J' ) return; + + // check length of output array. + + if ( ISEC4_NumValues > fsec4len ) + { + *iret = 710; + gprintf(__func__, " Output array too small. Length = %d", fsec4len); + gprintf(__func__, " Number of values = %d", ISEC4_NumValues); + gprintf(__func__, " Return code = %d", *iret); + return; + } + + if ( imiss ) memset((char *)fpdata, 0, (size_t)jlend*sizeof(T)); + else + { + igrib += locnd; + + TEMPLATE(decode_array,T)(igrib, jlend, ISEC4_NumBits, fmin, zscale, fpdata); + } + + if ( lspherc && lcomplex ) + { + int pcStart = isec4[19], pcScale = isec4[16]; + TEMPLATE(scatter_complex,T)(fsec4, pcStart, ISEC2_PentaJ, ISEC4_NumValues); + TEMPLATE(scale_complex,T)(fsec4, pcStart, pcScale, ISEC2_PentaJ, 1); + } + + if ( CGRIBEX_Fix_ZSE ) // Fix ZeroShiftError of simple packed spherical harmonics + if ( lspherc && !lcomplex ) + { + // 20100705: Fix ZeroShiftError - Edi Kirk + if ( IS_NOT_EQUAL(fsec4[1], 0.0) ) + { + const T zserr = fsec4[1]; + for (int i = 1; i < ISEC4_NumValues; ++i) fsec4[i] -= zserr; + } + } + + if ( decscale ) + { + const T scale = TEMPLATE(pow,T)((T)10.0, (T)-decscale); + for (int i = 0; i < ISEC4_NumValues; ++i) fsec4[i] *= scale; + } +} + + +void TEMPLATE(grib_decode,T)(int *isec0, int *isec1, int *isec2, T *fsec2, int *isec3, + T *fsec3, int *isec4, T *fsec4, int fsec4len, int *kgrib, + int kleng, int *kword, int dfunc, int *iret) +{ + UCHAR *bms = NULL; + bool lsect2 = false, lsect3 = false; + static bool lmissvalinfo = true; + + UNUSED(kleng); + + *iret = 0; + + grsdef(); + + ISEC2_Reduced = false; + + // ---------------------------------------------------------------- + // IS Indicator Section (Section 0) + // ---------------------------------------------------------------- + UCHAR *is = (UCHAR *) &kgrib[0]; + int isLen = decodeIS(is, isec0, iret); + + int gribLen = ISEC0_GRIB_Len; + + /* + When decoding or calculating length, previous editions + of the GRIB code must be taken into account. + + In the table below, covering sections 0 and 1 of the GRIB + code, octet numbering is from the beginning of the GRIB + message; + * indicates that the value is not available in the code edition; + R indicates reserved, should be set to 0; + Experimental edition is considered as edition -1. + + GRIB code edition -1 has fixed length of 20 octets for + section 1, the length not included in the message. + GRIB code edition 0 has fixed length of 24 octets for + section 1, the length being included in the message. + GRIB code edition 1 can have different lengths for section + 1, the minimum being 28 octets, length being included in + the message. + + Octet numbers for code + editions + + Contents. -1 0 1 + --------- ---------------------- + Letters GRIB 1-4 1-4 1-4 + Total length of GRIB message. * * 5-7 + GRIB code edition number * * 8 + Length of Section 1. * 5-7 9-11 + Reserved octet (R). * 8(R) * + Version no. of Code Table 2. * * 12 + Identification of centre. 5 9 13 + Generating process. 6 10 14 + Grid definition . 7 11 15 + Flag (Code Table 1). 8 12 16 + Indicator of parameter. 9 13 17 + Indicator of type of level. 10 14 18 + Height, pressure etc of levels. 11-12 15-16 19-20 + Year of century. 13 17 21 + Month. 14 18 22 + Day. 15 19 23 + Hour. 16 20 24 + Minute. 17 21 25 + Indicator of unit of time. 18 22 26 + P1 - Period of time. 19 23 27 + P2 - Period of time 20(R) 24 28 + or reserved octet (R). + Time range indicator. 21(R) 25 29 + or reserved octet (R). + Number included in average. 22-23(R) 26-27 30-31 + or reserved octet (R). + Number missing from average. 24(R) 28(R) 32 + or reserved octet (R). + Century of data. * * 33 + Designates sub-centre if not 0. * * 34 + Decimal scale factor. * * 35-36 + Reserved. Set to 0. * * 37-48 + (Need not be present) + For originating centre use only. * * 49-nn + (Need not be present) + + Identify which GRIB code edition is being decoded. + + In GRIB edition 1, the edition number is in octet 8. + In GRIB edition 0, octet 8 is reserved and set to 0. + In GRIB edition -1, octet 8 is a flag field and can have a + a valid value of 0, 1, 2 or 3. + + However, GRIB edition number 0 has a fixed + length of 24, included in the message, for section 1, so + if the value extracted from octets 5-7 is 24 and that from + octet 8 is 0, it is safe to assume edition 0 of the code. + + */ + + // Set length of GRIB message to missing data value. + if ( ISEC0_GRIB_Len == 24 && ISEC0_GRIB_Version == 0 ) ISEC0_GRIB_Len = 0; + + // ---------------------------------------------------------------- + // PDS Product Definition Section (Section 1) + // ---------------------------------------------------------------- + UCHAR *pds = is + isLen; + int pdsLen = decodePDS(pds, isec0, isec1); + + // ---------------------------------------------------------------- + // GDS Grid Description Section (Section 2) + // ---------------------------------------------------------------- + int numGridVals = 0; + int gdsLen = 0; + const bool gdsIncluded = ISEC1_Sec2Or3Flag & 128; + if ( gdsIncluded ) + { + UCHAR *gds = is + isLen + pdsLen; + gdsLen = TEMPLATE(decodeGDS,T)(gds, isec0, isec2, fsec2, &numGridVals); + } + + // ---------------------------------------------------------------- + // BMS Bit-Map Section Section (Section 3) + // ---------------------------------------------------------------- + isec3[0] = 0; + int bmsLen = 0, bitmapSize = 0, imaskSize = 0; + const bool bmsIncluded = ISEC1_Sec2Or3Flag & 64; + if ( bmsIncluded ) + { + bms = is + isLen + pdsLen + gdsLen; + bmsLen = BMS_Len; + + imaskSize = (bmsLen > 6) ? (bmsLen - 6)<<3 : 0; + bitmapSize = imaskSize - BMS_UnusedBits; + } + + // ---------------------------------------------------------------- + // BDS Binary Data Section (Section 4) + // ---------------------------------------------------------------- + UCHAR *bds = is + isLen + pdsLen + gdsLen + bmsLen; + int bdsLen = BDS_Len; + /* + If a very large product, the section 4 length field holds + the number of bytes in the product after section 4 upto + the end of the padding bytes. + This is a fixup to get round the restriction on product lengths + due to the count being only 24 bits. It is only possible because + the (default) rounding for GRIB products is 120 bytes. + */ + const bool llarge = (gribLen > JP23SET && bdsLen <= 120); + if ( llarge ) + { + gribLen &= JP23SET; + gribLen *= 120; + ISEC0_GRIB_Len = gribLen; + bdsLen = correct_bdslen(bdsLen, gribLen, isLen+pdsLen+gdsLen+bmsLen); + } + + TEMPLATE(decodeBDS,T)(ISEC1_DecScaleFactor, bds, isec2, isec4, fsec4, fsec4len, dfunc, bdsLen, numGridVals, iret); + + if ( *iret != 0 ) return; + + ISEC4_NumNonMissValues = ISEC4_NumValues; + + if ( bitmapSize > 0 ) + { + if ( dfunc != 'L' && dfunc != 'J' ) + if ( DBL_IS_NAN(FSEC3_MissVal) && lmissvalinfo ) + { + lmissvalinfo = false; + FSEC3_MissVal = (T)GRIB_MISSVAL; + Message("Missing value = NaN is unsupported, set to %g!", GRIB_MISSVAL); + } + + // ISEC4_NumNonMissValues = ISEC4_NumValues; + ISEC4_NumValues = bitmapSize; + + if ( dfunc != 'J' || bitmapSize == ISEC4_NumNonMissValues ) + { + GRIBPACK bitmap; + /* + unsigned char *bitmap; + bitmap = BMS_Bitmap; + int j = ISEC4_NumNonMissValues; + for (int i = ISEC4_NumValues-1; i >= 0; --i) + { + fsec4[i] = ((bitmap[i/8]>>(7-(i&7)))&1) ? fsec4[--j] : FSEC3_MissVal; + } + */ + + GRIBPACK *imask = (GRIBPACK*) Malloc((size_t)imaskSize*sizeof(GRIBPACK)); + +#ifdef VECTORCODE + (void) UNPACK_GRIB(BMS_Bitmap, imask, imaskSize/8, -1L); + GRIBPACK *pbitmap = imask; +#else + GRIBPACK *pbitmap = BMS_Bitmap; +#endif + +#if defined (CRAY) +#pragma _CRI ivdep +#endif +#if defined (SX) +#pragma vdir nodep +#endif +#ifdef __uxpch__ +#pragma loop novrec +#endif + for (int i = imaskSize/8-1; i >= 0; --i) + { + bitmap = pbitmap[i]; + imask[i*8+0] = 1 & (bitmap >> 7); + imask[i*8+1] = 1 & (bitmap >> 6); + imask[i*8+2] = 1 & (bitmap >> 5); + imask[i*8+3] = 1 & (bitmap >> 4); + imask[i*8+4] = 1 & (bitmap >> 3); + imask[i*8+5] = 1 & (bitmap >> 2); + imask[i*8+6] = 1 & (bitmap >> 1); + imask[i*8+7] = 1 & (bitmap); + } + + int j = 0; + for (int i = 0; i < ISEC4_NumValues; ++i) + if ( imask[i] ) j++; + + if ( ISEC4_NumNonMissValues != j ) + { + if ( dfunc != 'J' && ISEC4_NumBits != 0 ) + Warning("Bitmap (%d) and data (%d) section differ, using bitmap section!", j, ISEC4_NumNonMissValues); + + ISEC4_NumNonMissValues = j; + } + + if ( dfunc != 'J' ) + { +#if defined (CRAY) +#pragma _CRI ivdep +#endif +#if defined (SX) +#pragma vdir nodep +#endif +#ifdef __uxpch__ +#pragma loop novrec +#endif + for (int i = ISEC4_NumValues-1; i >= 0; --i) + fsec4[i] = imask[i] ? fsec4[--j] : FSEC3_MissVal; + } + + Free(imask); + } + } + + if ( ISEC2_Reduced ) + { + int nvalues = 0; + int nlat = ISEC2_NumLat; + int nlon = ISEC2_ReducedPointsPtr[0]; + for (int ilat = 0; ilat < nlat; ++ilat) nvalues += ISEC2_ReducedPoints(ilat); + for (int ilat = 1; ilat < nlat; ++ilat) + if ( ISEC2_ReducedPoints(ilat) > nlon ) nlon = ISEC2_ReducedPoints(ilat); + + // int dlon = ISEC2_LastLon-ISEC2_FirstLon; + // if ( dlon < 0 ) dlon += 360000; + + if ( nvalues != ISEC4_NumValues ) *iret = -801; + + //printf("nlat %d nlon %d \n", nlat, nlon); + //printf("nvalues %d %d\n", nvalues, ISEC4_NumValues); + + if ( dfunc == 'R' && *iret == -801 ) + gprintf(__func__, "Number of values (%d) and sum of lons per row (%d) differ, abort conversion to regular Gaussian grid!", + ISEC4_NumValues, nvalues); + + if ( dfunc == 'R' && *iret != -801 ) + { + ISEC2_Reduced = 0; + ISEC2_NumLon = nlon; + ISEC4_NumValues = nlon*nlat; + + lsect3 = bitmapSize > 0; + int lperio = 1; + int lveggy = (ISEC1_CodeTable == 128) && (ISEC1_CenterID == 98) && + ((ISEC1_Parameter == 27) || (ISEC1_Parameter == 28) || + (ISEC1_Parameter == 29) || (ISEC1_Parameter == 30) || + (ISEC1_Parameter == 39) || (ISEC1_Parameter == 40) || + (ISEC1_Parameter == 41) || (ISEC1_Parameter == 42) || + (ISEC1_Parameter == 43)); + + (void) TEMPLATE(qu2reg3,T)(fsec4, ISEC2_ReducedPointsPtr, nlat, nlon, FSEC3_MissVal, iret, lsect3, lperio, lveggy); + + if ( bitmapSize > 0 ) + { + int j = 0; + for (int i = 0; i < ISEC4_NumValues; ++i) + if ( IS_NOT_EQUAL(fsec4[i], FSEC3_MissVal) ) j++; + + ISEC4_NumNonMissValues = j; + } + } + } + + if ( ISEC0_GRIB_Version == 1 ) isLen = 8; + const int esLen = 4; + gribLen = isLen + pdsLen + gdsLen + bmsLen + bdsLen + esLen; + + if ( !llarge && ISEC0_GRIB_Len && ISEC0_GRIB_Len < gribLen ) + Warning("Inconsistent length of GRIB message (grib_message_size=%d < grib_record_size=%d)!", ISEC0_GRIB_Len, gribLen); + + ISEC0_GRIB_Len = gribLen; + + *kword = (int)(((size_t)gribLen + sizeof(int) - 1) / sizeof(int)); + + // ---------------------------------------------------------------- + // Section 9 . Abort/return to calling routine. + // ---------------------------------------------------------------- + bool ldebug = false, l_iorj = false; + if ( ldebug ) + { + gprintf(__func__, "Section 9."); + gprintf(__func__, "Output values set -"); + + gribPrintSec0(isec0); + gribPrintSec1(isec0, isec1); + // Print section 2 if present. + if ( lsect2 ) TEMPLATE(gribPrintSec2,T)(isec0, isec2, fsec2); + + if ( ! l_iorj ) + { + // Print section 3 if present. + if ( lsect3 ) TEMPLATE(gribPrintSec3,T)(isec0, isec3, fsec3); + + TEMPLATE(gribPrintSec4,T)(isec0, isec4, fsec4); + // Special print for 2D spectra wave field real values in section 4 + if ( (isec1[ 0] == 140) && + (isec1[ 1] == 98) && + (isec1[23] == 1) && + ((isec1[39] == 1045) || (isec1[39] == 1081)) && + ((isec1[ 5] == 250) || (isec1[ 5] == 251)) ) + gribPrintSec4Wave(isec4); + } + } +} + +#endif /* T */ + +/* + * Local Variables: + * mode: c + * End: + */ + +// GRIB block 0 - indicator block +static +void encodeIS(GRIBPACK *lGrib, long *gribLen) +{ + long z; + // z = *gribLen; + + lGrib[0] = 'G'; + lGrib[1] = 'R'; + lGrib[2] = 'I'; + lGrib[3] = 'B'; + + // lGrib[4]-lGrib[6] contains full length of grib record. + // included before finished CODEGB + + z = 7; + Put1Byte(1); // grib version + z = 8; + + *gribLen = z; +} + +// GRIB block 5 - end block +static +void encodeES(GRIBPACK *lGrib, long *gribLen, long bdsstart) +{ + long z = *gribLen; + + lGrib[z++] = '7'; + lGrib[z++] = '7'; + lGrib[z++] = '7'; + lGrib[z++] = '7'; + + if (z > JP24SET) + { + long bdslen = z - 4; + // fprintf(stderr, "Abort: GRIB record too large (max = %d)!\n", JP23SET); + // exit(1); + /* + If a very large product, the section 4 length field holds + the number of bytes in the product after section 4 upto + the end of the padding bytes. + This is a fixup to get round the restriction on product lengths + due to the count being only 24 bits. It is only possible because + the (default) rounding for GRIB products is 120 bytes. + */ + while (z%120) lGrib[z++] = 0; + + if (z > JP23SET*120) + { + fprintf(stderr, "Abort: GRIB1 record too large (size = %ld; max = %d)!\n", z, JP23SET*120); + exit(1); + } + + long itemp = z / (-120); + itemp = JP23SET - itemp + 1; + + lGrib[4] = (GRIBPACK)(itemp >> 16); + lGrib[5] = (GRIBPACK)(itemp >> 8); + lGrib[6] = (GRIBPACK)itemp; + + bdslen = z - bdslen; + lGrib[bdsstart ] = (GRIBPACK)(bdslen >> 16); + lGrib[bdsstart+1] = (GRIBPACK)(bdslen >> 8); + lGrib[bdsstart+2] = (GRIBPACK)bdslen; + } + else + { + lGrib[4] = (GRIBPACK)(z >> 16); + lGrib[5] = (GRIBPACK)(z >> 8); + lGrib[6] = (GRIBPACK)z; + + while (z%8) lGrib[z++] = 0; + } + + *gribLen = z; +} + +// GRIB block 1 - product definition block. + +#define DWD_extension_253_len 38 +#define DWD_extension_254_len 26 +#define ECMWF_extension_1_len 24 +#define MPIM_extension_1_len 18 + +static +long getLocalExtLen(int *isec1) +{ + long extlen = 0; + + if (ISEC1_LocalFLag) + { + if (ISEC1_CenterID == 78 || ISEC1_CenterID == 215 || ISEC1_CenterID == 250) + { + if (isec1[36] == 254) extlen = DWD_extension_254_len; + else if (isec1[36] == 253) extlen = DWD_extension_253_len; + } + else if (ISEC1_CenterID == 98) + { + if (isec1[36] == 1) extlen = ECMWF_extension_1_len; + } + else if (ISEC1_CenterID == 252) + { + if (isec1[36] == 1) extlen = MPIM_extension_1_len; + } + } + + return extlen; +} + +static +long getPdsLen(int *isec1) +{ + long pdslen = 28; + + pdslen += getLocalExtLen(isec1); + + return pdslen; +} + +static +void encodePDS_DWD_local_Extension_254(GRIBPACK *lGrib, long *zs, int *isec1) +{ + long z = *zs; + + const long localextlen = getLocalExtLen(isec1); + for (long i = 0; i < localextlen-2; i++) Put1Byte(isec1[24+i]); + + int isvn = isec1[49] << 15 | isec1[48]; // DWD experiment identifier + Put2Byte(isvn); // DWD run type (0=main, 2=ass, 3=test) + + *zs = z; +} + +static +void encodePDS_DWD_local_Extension_253(GRIBPACK *lGrib, long *zs, int *isec1) +{ + long z = *zs; + + const long localextlen = DWD_extension_254_len; + for (long i = 0; i < localextlen-2; i++) Put1Byte(isec1[24+i]); + + int isvn = isec1[49] << 15 | isec1[48]; /* DWD experiment identifier */ + Put2Byte(isvn); /* DWD run type (0=main, 2=ass, 3=test) */ + Put1Byte(isec1[50]); /* 55 User id, specified by table */ + Put2Byte(isec1[51]); /* 56 Experiment identifier */ + Put2Byte(isec1[52]); /* 58 Ensemble identification by table */ + Put2Byte(isec1[53]); /* 60 Number of ensemble members */ + Put2Byte(isec1[54]); /* 62 Actual number of ensemble member */ + Put1Byte(isec1[55]); /* 64 Model major version number */ + Put1Byte(isec1[56]); /* 65 Model minor version number */ + Put1Byte(0); /* 66 Blank for even buffer length */ + + *zs = z; +} + +static +void encodePDS_ECMWF_local_Extension_1(GRIBPACK *lGrib, long *zs, int *isec1) +{ + long z = *zs; + + const long localextlen = getLocalExtLen(isec1); + for (long i = 0; i < localextlen-12; i++) Put1Byte(isec1[24+i]); + /* 12 bytes explicitly encoded below: */ + Put1Byte(isec1[36]); /* ECMWF local GRIB use definition identifier */ + /* 1=MARS labelling or ensemble fcst. data */ + Put1Byte(isec1[37]); /* Class */ + Put1Byte(isec1[38]); /* Type */ + Put2Byte(isec1[39]); /* Stream */ + + // Version number or experiment identifier + Put1Byte(((unsigned char*) &isec1[40])[0]); + Put1Byte(((unsigned char*) &isec1[40])[1]); + Put1Byte(((unsigned char*) &isec1[40])[2]); + Put1Byte(((unsigned char*) &isec1[40])[3]); + + Put1Byte(isec1[41]); /* Ensemble forecast number */ + Put1Byte(isec1[42]); /* Total number of forecasts in ensemble */ + Put1Byte(0); /* (Spare) */ + + *zs = z; +} + +static +void encodePDS_MPIM_local_Extension_1(GRIBPACK *lGrib, long *zs, int *isec1) +{ + long z = *zs; + + const long localextlen = getLocalExtLen(isec1); + for (long i = 0; i < localextlen-6; i++) Put1Byte(isec1[24+i]); + /* 6 bytes explicitly encoded below: */ + Put1Byte(isec1[36]); /* MPIM local GRIB use definition identifier */ + /* (extension identifier) */ + Put1Byte(isec1[37]); /* type of ensemble forecast */ + Put2Byte(isec1[38]); /* individual ensemble member */ + Put2Byte(isec1[39]); /* number of forecasts in ensemble */ + + *zs = z; +} + +// GRIB BLOCK 1 - PRODUCT DESCRIPTION SECTION +static +void encodePDS(GRIBPACK *lpds, long pdsLen, int *isec1) +{ + GRIBPACK *lGrib = lpds; + long z = 0; + int ival; + + int century = ISEC1_Century; + int year = ISEC1_Year; + + if ( century < 0 ) + { + century = -century; + year = -year; + } + + Put3Byte(pdsLen); /* 0 Length of Block 1 */ + Put1Byte(ISEC1_CodeTable); /* 3 Local table number */ + Put1Byte(ISEC1_CenterID); /* 4 Identification of centre */ + Put1Byte(ISEC1_ModelID); /* 5 Identification of model */ + Put1Byte(ISEC1_GridDefinition); /* 6 Grid definition */ + Put1Byte(ISEC1_Sec2Or3Flag); /* 7 Block 2 included */ + Put1Byte(ISEC1_Parameter); /* 8 Parameter Code */ + Put1Byte(ISEC1_LevelType); /* 9 Type of level */ + if ( (ISEC1_LevelType != 20) && + (ISEC1_LevelType != GRIB1_LTYPE_99) && + (ISEC1_LevelType != GRIB1_LTYPE_ISOBARIC) && + (ISEC1_LevelType != GRIB1_LTYPE_ISOBARIC_PA) && + (ISEC1_LevelType != GRIB1_LTYPE_ALTITUDE) && + (ISEC1_LevelType != GRIB1_LTYPE_HEIGHT) && + (ISEC1_LevelType != GRIB1_LTYPE_SIGMA) && + (ISEC1_LevelType != GRIB1_LTYPE_HYBRID) && + (ISEC1_LevelType != GRIB1_LTYPE_LANDDEPTH) && + (ISEC1_LevelType != GRIB1_LTYPE_ISENTROPIC) && + (ISEC1_LevelType != 115) && + (ISEC1_LevelType != 117) && + (ISEC1_LevelType != 125) && + (ISEC1_LevelType != 127) && + (ISEC1_LevelType != 160) && + (ISEC1_LevelType != 210) ) + { + Put1Byte(ISEC1_Level1); + Put1Byte(ISEC1_Level2); + } + else + { + Put2Byte(ISEC1_Level1); /* 10 Level */ + } + + Put1Int(year); /* 12 Year of Century */ + Put1Byte(ISEC1_Month); /* 13 Month */ + Put1Byte(ISEC1_Day); /* 14 Day */ + Put1Byte(ISEC1_Hour); /* 15 Hour */ + Put1Byte(ISEC1_Minute); /* 16 Minute */ + + Put1Byte(ISEC1_TimeUnit); /* 17 Time unit */ + if ( ISEC1_TimeRange == 10 ) + { + Put1Byte(ISEC1_TimePeriod1); + Put1Byte(ISEC1_TimePeriod2); + } + else if ( ISEC1_TimeRange == 113 || ISEC1_TimeRange == 0 ) + { + Put1Byte(ISEC1_TimePeriod1); + Put1Byte(0); + } + else if ( ISEC1_TimeRange == 5 || ISEC1_TimeRange == 4 || + ISEC1_TimeRange == 3 || ISEC1_TimeRange == 2 ) + { + Put1Byte(ISEC1_TimePeriod1); + Put1Byte(ISEC1_TimePeriod2); + } + else + { + Put1Byte(0); + Put1Byte(0); + } + Put1Byte(ISEC1_TimeRange); /* 20 Timerange flag */ + Put2Byte(ISEC1_AvgNum); /* 21 Average */ + + Put1Byte(ISEC1_AvgMiss); /* 23 Missing from averages */ + Put1Byte(century); /* 24 Century */ + Put1Byte(ISEC1_SubCenterID); /* 25 Subcenter */ + Put2Int(ISEC1_DecScaleFactor); /* 26 Decimal scale factor */ + + if ( ISEC1_LocalFLag ) + { + if ( ISEC1_CenterID == 78 || ISEC1_CenterID == 215 || ISEC1_CenterID == 250 ) + { + if ( isec1[36] == 254 ) encodePDS_DWD_local_Extension_254(lGrib, &z, isec1); + else if ( isec1[36] == 253 ) encodePDS_DWD_local_Extension_253(lGrib, &z, isec1); + } + else if ( ISEC1_CenterID == 98 ) + { + if ( isec1[36] == 1 ) encodePDS_ECMWF_local_Extension_1(lGrib, &z, isec1); + } + else if ( ISEC1_CenterID == 252 ) + { + if ( isec1[36] == 1 ) encodePDS_MPIM_local_Extension_1(lGrib, &z, isec1); + } + else + { + const long localextlen = getLocalExtLen(isec1); + for (long i = 0; i < localextlen; i++) Put1Byte(isec1[24+i]); + } + } +} + + + + +#ifdef T +#undef T +#endif +#define T double +#ifdef T + + +#define CGRIBEX_FPSCALE(data) (((data) - zref) * factor + 0.5) + +static +void TEMPLATE(encode_array_common,T)(int numBits, size_t packStart, size_t datasize, GRIBPACK *lGrib, + const T *data, T zref, T factor, size_t *gz) +{ + size_t z = *gz; + unsigned int ival; + int cbits, jbits; + unsigned int c; + + // code from gribw routine flist2bitstream + + cbits = 8; + c = 0; + for (size_t i = packStart; i < datasize; ++i) + { + // note float -> unsigned int .. truncate + ival = (unsigned int)(CGRIBEX_FPSCALE(data[i])); + /* + if ( ival > max_nbpv_pow2 ) ival = max_nbpv_pow2; + if ( ival < 0 ) ival = 0; + */ + jbits = numBits; + while ( cbits <= jbits ) + { + if ( cbits == 8 ) + { + jbits -= 8; + lGrib[z++] = (ival >> jbits) & 0xFF; + } + else + { + jbits -= cbits; + lGrib[z++] = (GRIBPACK)((c << cbits) + + ((ival >> jbits) & ((1U << cbits) - 1))); + cbits = 8; + c = 0; + } + } + /* now jbits < cbits */ + if ( jbits ) + { + c = (c << jbits) + (ival & ((1U << jbits)-1)); + cbits -= jbits; + } + } + if ( cbits != 8 ) lGrib[z++] = (GRIBPACK)(c << cbits); + + *gz = z; +} + + +static +void TEMPLATE(encode_array_2byte,T)(size_t datasize, GRIBPACK *restrict lGrib, + const T *restrict data, T zref, T factor, size_t *gz) +{ + uint16_t *restrict sgrib = (uint16_t *)(void *)(lGrib+*gz); + + if (IS_BIGENDIAN()) + { + for (size_t i = 0; i < datasize; ++i) + sgrib[i] = (uint16_t) CGRIBEX_FPSCALE(data[i]); + } + else + { + for (size_t i = 0; i < datasize; ++i) + { + uint16_t ui16 = (uint16_t) CGRIBEX_FPSCALE(data[i]); + sgrib[i] = gribSwapByteOrder_uint16(ui16); + } + } + + *gz += 2*datasize; +} + +static +void TEMPLATE(encode_array,T)(int numBits, size_t packStart, size_t datasize, + GRIBPACK *restrict lGrib, + const T *restrict data, + T zref, T factor, size_t *gz) +{ + size_t z = *gz; + + data += packStart; + datasize -= packStart; + + if (numBits == 8) + { + for (size_t i = 0; i < datasize; ++i) + { + lGrib[z++] = (GRIBPACK) CGRIBEX_FPSCALE(data[i]); + } + } + else if (numBits == 16) + { + if (sizeof(T) == sizeof(double)) + { + grib_encode_array_2byte_double(datasize, lGrib, (const double *)(const void *)data, zref, factor, &z); + } + else + { + TEMPLATE(encode_array_2byte,T)(datasize, lGrib, data, zref, factor, &z); + } + } + else if (numBits == 24) + { + for (size_t i = 0; i < datasize; ++i) + { + uint32_t ui32 = (uint32_t) CGRIBEX_FPSCALE(data[i]); + lGrib[z++] = (GRIBPACK)(ui32 >> 16); + lGrib[z++] = (GRIBPACK)(ui32 >> 8); + lGrib[z++] = (GRIBPACK)ui32; + } + } + else if (numBits == 32) + { + for (size_t i = 0; i < datasize; ++i) + { + uint32_t ui32 = (uint32_t) CGRIBEX_FPSCALE(data[i]); + lGrib[z++] = (GRIBPACK)(ui32 >> 24); + lGrib[z++] = (GRIBPACK)(ui32 >> 16); + lGrib[z++] = (GRIBPACK)(ui32 >> 8); + lGrib[z++] = (GRIBPACK)ui32; + } + } + else if (numBits > 0 && numBits <= 32) + { + TEMPLATE(encode_array_common,T)(numBits, 0, datasize, lGrib, data, zref, factor, &z); + } + else if (numBits == 0) + { + } + else + { + Error("Unimplemented packing factor %d!", numBits); + } + + *gz = z; +} + +static +void TEMPLATE(encode_array_unrolled,T)(int numBits, size_t packStart, size_t datasize, + GRIBPACK *restrict lGrib, + const T *restrict data, + T zref, T factor, size_t *gz) +{ + size_t z = *gz; +#ifdef _ARCH_PWR6 + enum { CGRIBEX__UNROLL_DEPTH_2 = 8 }; +#else + enum { CGRIBEX__UNROLL_DEPTH_2 = 128 }; +#endif + size_t residual; + size_t ofs; + double dval[CGRIBEX__UNROLL_DEPTH_2]; + + data += packStart; + datasize -= packStart; + residual = datasize % CGRIBEX__UNROLL_DEPTH_2; + ofs = datasize - residual; + + // reducing FP operations to single FMA is slowing down on pwr6 ... + + if ( numBits == 8 ) + { +#ifdef _GET_IBM_COUNTER + hpmStart(2, "pack 8 bit unrolled"); +#endif + unsigned char *cgrib = (unsigned char *) (lGrib + z); + size_t i; + for (i = 0; i < datasize - residual; i += CGRIBEX__UNROLL_DEPTH_2) + { + for (size_t j = 0; j < CGRIBEX__UNROLL_DEPTH_2; ++j) + { + dval[j] = CGRIBEX_FPSCALE(data[i+j]); + } + for (size_t j = 0; j < CGRIBEX__UNROLL_DEPTH_2; ++j) + { +#ifdef _ARCH_PWR6 + *cgrib++ = (unsigned long) dval[j]; +#else + *cgrib++ = (unsigned char) dval[j]; +#endif + } + z += CGRIBEX__UNROLL_DEPTH_2; + } + for (size_t j = 0; j < residual; ++j) + { + dval[j] = CGRIBEX_FPSCALE(data[i+j]); + } + for (size_t j = 0; j < residual; ++j) + { +#ifdef _ARCH_PWR6 + *cgrib++ = (unsigned long) dval[j]; +#else + *cgrib++ = (unsigned char) dval[j]; +#endif + } + z += residual; + +#ifdef _GET_IBM_COUNTER + hpmStop(2); +#endif + } + else if ( numBits == 16 ) + { +#ifdef _GET_IBM_COUNTER + hpmStart(3, "pack 16 bit unrolled"); +#endif +#ifdef _ARCH_PWR6 + unsigned long ival; +#else + uint16_t ival; +#endif + uint16_t *sgrib = (uint16_t *)(void *)(lGrib+z); + + for (size_t i = 0; i < datasize - residual; i += CGRIBEX__UNROLL_DEPTH_2) + { + for (size_t j = 0; j < CGRIBEX__UNROLL_DEPTH_2; ++j) + dval[j] = CGRIBEX_FPSCALE(data[j]); + if ( IS_BIGENDIAN() ) + { + for (size_t j = 0; j < CGRIBEX__UNROLL_DEPTH_2; ++j) + { +#ifdef _ARCH_PWR6 + *sgrib++ = (unsigned long) dval[j]; +#else + *sgrib++ = (uint16_t) dval[j]; +#endif + } + z += 2*CGRIBEX__UNROLL_DEPTH_2; + } + else + { + for (size_t j = 0; j < CGRIBEX__UNROLL_DEPTH_2; ++j) + { + ival = (uint16_t) dval[j]; + *sgrib++ = gribSwapByteOrder_uint16(ival); + } + z += 2*CGRIBEX__UNROLL_DEPTH_2; + } + } + for (size_t j = 0; j < residual; ++j) + { + dval[j] = CGRIBEX_FPSCALE(data[j]); + } + if ( IS_BIGENDIAN() ) + { + for (size_t j = 0; j < residual; ++j) + { +#ifdef _ARCH_PWR6 + *sgrib++ = (unsigned long) dval[j]; +#else + *sgrib++ = (uint16_t) dval[j]; +#endif + } + z += 2*residual; + } + else + { + for (size_t j = 0; j < residual; ++j) + { + ival = (uint16_t) dval[j]; + lGrib[z ] = (GRIBPACK)(ival >> 8); + lGrib[z+1] = (GRIBPACK)ival; + z += 2; + } + } +#ifdef _GET_IBM_COUNTER + hpmStop(3); +#endif + } + else if ( numBits == 24 ) + { +#ifdef _GET_IBM_COUNTER + hpmStart(4, "pack 24 bit unrolled"); +#endif +#ifdef _ARCH_PWR6 + unsigned long ival; +#else + uint32_t ival; +#endif + for (size_t i = 0; i < datasize - residual; i += CGRIBEX__UNROLL_DEPTH_2) + { + for (size_t j = 0; j < CGRIBEX__UNROLL_DEPTH_2; ++j) + { + dval[j] = CGRIBEX_FPSCALE(data[j]); + } + for (size_t j = 0; j < CGRIBEX__UNROLL_DEPTH_2; ++j) + { +#ifdef _ARCH_PWR6 + ival = (unsigned long) dval[j]; +#else + ival = (uint32_t) dval[j]; +#endif + lGrib[z ] = (GRIBPACK)(ival >> 16); + lGrib[z+1] = (GRIBPACK)(ival >> 8); + lGrib[z+2] = (GRIBPACK)ival; + z += 3; + } + } + for (size_t j = 0; j < residual; ++j) + { + dval[j] = CGRIBEX_FPSCALE(data[j]); + } + for (size_t j = 0; j < residual; ++j) + { + ival = (uint32_t) dval[j]; + lGrib[z ] = (GRIBPACK)(ival >> 16); + lGrib[z+1] = (GRIBPACK)(ival >> 8); + lGrib[z+2] = (GRIBPACK)ival; + z += 3; + } +#ifdef _GET_IBM_COUNTER + hpmStop(4); +#endif + } + else if ( numBits == 32 ) + { +#ifdef _GET_IBM_COUNTER + hpmStart(5, "pack 32 bit unrolled"); +#endif +#ifdef _ARCH_PWR6 + unsigned long ival; +#else + uint32_t ival; +#endif + unsigned int *igrib = (unsigned int *)(void *)(lGrib + z); + for (size_t i = 0; i < datasize - residual; i += CGRIBEX__UNROLL_DEPTH_2) + { + for (size_t j = 0; j < CGRIBEX__UNROLL_DEPTH_2; ++j) dval[j] = CGRIBEX_FPSCALE(data[i+j]); + + if ( IS_BIGENDIAN() ) + { + for (size_t j = 0; j < CGRIBEX__UNROLL_DEPTH_2; ++j) + { +#ifdef _ARCH_PWR6 + *igrib = (unsigned long) dval[j]; +#else + *igrib = (uint32_t) dval[j]; +#endif + igrib++; + z += 4; + } + } + else + { + for (size_t j = 0; j < CGRIBEX__UNROLL_DEPTH_2; ++j) + { + ival = (uint32_t) dval[j]; + lGrib[z ] = (GRIBPACK)(ival >> 24); + lGrib[z+1] = (GRIBPACK)(ival >> 16); + lGrib[z+2] = (GRIBPACK)(ival >> 8); + lGrib[z+3] = (GRIBPACK)ival; + z += 4; + } + } + } + for (size_t j = 0; j < residual; ++j) + { + dval[j] = CGRIBEX_FPSCALE(data[ofs+j]); + } + if ( IS_BIGENDIAN() ) + { + for (size_t j = 0; j < residual; ++j) + { +#ifdef _ARCH_PWR6 + *igrib = (unsigned long) dval[j]; +#else + *igrib = (uint32_t) dval[j]; +#endif + igrib++; + z += 4; + } + } + else + { + for (size_t j = 0; j < residual; ++j) + { + ival = (uint32_t) dval[j]; + lGrib[z ] = (GRIBPACK)(ival >> 24); + lGrib[z+1] = (GRIBPACK)(ival >> 16); + lGrib[z+2] = (GRIBPACK)(ival >> 8); + lGrib[z+3] = (GRIBPACK)ival; + z += 4; + } + } +#ifdef _GET_IBM_COUNTER + hpmStop(5); +#endif + } + else if ( numBits > 0 && numBits <= 32 ) + { + TEMPLATE(encode_array_common,T)(numBits, 0, datasize, lGrib, data, zref, factor, &z); + } + else if ( numBits == 0 ) + { + } + else + { + Error("Unimplemented packing factor %d!", numBits); + } + + *gz = z; +} + +#ifdef CGRIBEX_FPSCALE +#undef CGRIBEX_FPSCALE +#endif + +#endif /* T */ + +#ifdef T +#undef T +#endif +#define T float +#ifdef T + + +#define CGRIBEX_FPSCALE(data) (((data) - zref) * factor + 0.5) + +static +void TEMPLATE(encode_array_common,T)(int numBits, size_t packStart, size_t datasize, GRIBPACK *lGrib, + const T *data, T zref, T factor, size_t *gz) +{ + size_t z = *gz; + unsigned int ival; + int cbits, jbits; + unsigned int c; + + // code from gribw routine flist2bitstream + + cbits = 8; + c = 0; + for (size_t i = packStart; i < datasize; ++i) + { + // note float -> unsigned int .. truncate + ival = (unsigned int)(CGRIBEX_FPSCALE(data[i])); + /* + if ( ival > max_nbpv_pow2 ) ival = max_nbpv_pow2; + if ( ival < 0 ) ival = 0; + */ + jbits = numBits; + while ( cbits <= jbits ) + { + if ( cbits == 8 ) + { + jbits -= 8; + lGrib[z++] = (ival >> jbits) & 0xFF; + } + else + { + jbits -= cbits; + lGrib[z++] = (GRIBPACK)((c << cbits) + + ((ival >> jbits) & ((1U << cbits) - 1))); + cbits = 8; + c = 0; + } + } + /* now jbits < cbits */ + if ( jbits ) + { + c = (c << jbits) + (ival & ((1U << jbits)-1)); + cbits -= jbits; + } + } + if ( cbits != 8 ) lGrib[z++] = (GRIBPACK)(c << cbits); + + *gz = z; +} + + +static +void TEMPLATE(encode_array_2byte,T)(size_t datasize, GRIBPACK *restrict lGrib, + const T *restrict data, T zref, T factor, size_t *gz) +{ + uint16_t *restrict sgrib = (uint16_t *)(void *)(lGrib+*gz); + + if (IS_BIGENDIAN()) + { + for (size_t i = 0; i < datasize; ++i) + sgrib[i] = (uint16_t) CGRIBEX_FPSCALE(data[i]); + } + else + { + for (size_t i = 0; i < datasize; ++i) + { + uint16_t ui16 = (uint16_t) CGRIBEX_FPSCALE(data[i]); + sgrib[i] = gribSwapByteOrder_uint16(ui16); + } + } + + *gz += 2*datasize; +} + +static +void TEMPLATE(encode_array,T)(int numBits, size_t packStart, size_t datasize, + GRIBPACK *restrict lGrib, + const T *restrict data, + T zref, T factor, size_t *gz) +{ + size_t z = *gz; + + data += packStart; + datasize -= packStart; + + if (numBits == 8) + { + for (size_t i = 0; i < datasize; ++i) + { + lGrib[z++] = (GRIBPACK) CGRIBEX_FPSCALE(data[i]); + } + } + else if (numBits == 16) + { + if (sizeof(T) == sizeof(double)) + { + grib_encode_array_2byte_double(datasize, lGrib, (const double *)(const void *)data, zref, factor, &z); + } + else + { + TEMPLATE(encode_array_2byte,T)(datasize, lGrib, data, zref, factor, &z); + } + } + else if (numBits == 24) + { + for (size_t i = 0; i < datasize; ++i) + { + uint32_t ui32 = (uint32_t) CGRIBEX_FPSCALE(data[i]); + lGrib[z++] = (GRIBPACK)(ui32 >> 16); + lGrib[z++] = (GRIBPACK)(ui32 >> 8); + lGrib[z++] = (GRIBPACK)ui32; + } + } + else if (numBits == 32) + { + for (size_t i = 0; i < datasize; ++i) + { + uint32_t ui32 = (uint32_t) CGRIBEX_FPSCALE(data[i]); + lGrib[z++] = (GRIBPACK)(ui32 >> 24); + lGrib[z++] = (GRIBPACK)(ui32 >> 16); + lGrib[z++] = (GRIBPACK)(ui32 >> 8); + lGrib[z++] = (GRIBPACK)ui32; + } + } + else if (numBits > 0 && numBits <= 32) + { + TEMPLATE(encode_array_common,T)(numBits, 0, datasize, lGrib, data, zref, factor, &z); + } + else if (numBits == 0) + { + } + else + { + Error("Unimplemented packing factor %d!", numBits); + } + + *gz = z; +} + +static +void TEMPLATE(encode_array_unrolled,T)(int numBits, size_t packStart, size_t datasize, + GRIBPACK *restrict lGrib, + const T *restrict data, + T zref, T factor, size_t *gz) +{ + size_t z = *gz; +#ifdef _ARCH_PWR6 + enum { CGRIBEX__UNROLL_DEPTH_2 = 8 }; +#else + enum { CGRIBEX__UNROLL_DEPTH_2 = 128 }; +#endif + size_t residual; + size_t ofs; + double dval[CGRIBEX__UNROLL_DEPTH_2]; + + data += packStart; + datasize -= packStart; + residual = datasize % CGRIBEX__UNROLL_DEPTH_2; + ofs = datasize - residual; + + // reducing FP operations to single FMA is slowing down on pwr6 ... + + if ( numBits == 8 ) + { +#ifdef _GET_IBM_COUNTER + hpmStart(2, "pack 8 bit unrolled"); +#endif + unsigned char *cgrib = (unsigned char *) (lGrib + z); + size_t i; + for (i = 0; i < datasize - residual; i += CGRIBEX__UNROLL_DEPTH_2) + { + for (size_t j = 0; j < CGRIBEX__UNROLL_DEPTH_2; ++j) + { + dval[j] = CGRIBEX_FPSCALE(data[i+j]); + } + for (size_t j = 0; j < CGRIBEX__UNROLL_DEPTH_2; ++j) + { +#ifdef _ARCH_PWR6 + *cgrib++ = (unsigned long) dval[j]; +#else + *cgrib++ = (unsigned char) dval[j]; +#endif + } + z += CGRIBEX__UNROLL_DEPTH_2; + } + for (size_t j = 0; j < residual; ++j) + { + dval[j] = CGRIBEX_FPSCALE(data[i+j]); + } + for (size_t j = 0; j < residual; ++j) + { +#ifdef _ARCH_PWR6 + *cgrib++ = (unsigned long) dval[j]; +#else + *cgrib++ = (unsigned char) dval[j]; +#endif + } + z += residual; + +#ifdef _GET_IBM_COUNTER + hpmStop(2); +#endif + } + else if ( numBits == 16 ) + { +#ifdef _GET_IBM_COUNTER + hpmStart(3, "pack 16 bit unrolled"); +#endif +#ifdef _ARCH_PWR6 + unsigned long ival; +#else + uint16_t ival; +#endif + uint16_t *sgrib = (uint16_t *)(void *)(lGrib+z); + + for (size_t i = 0; i < datasize - residual; i += CGRIBEX__UNROLL_DEPTH_2) + { + for (size_t j = 0; j < CGRIBEX__UNROLL_DEPTH_2; ++j) + dval[j] = CGRIBEX_FPSCALE(data[j]); + if ( IS_BIGENDIAN() ) + { + for (size_t j = 0; j < CGRIBEX__UNROLL_DEPTH_2; ++j) + { +#ifdef _ARCH_PWR6 + *sgrib++ = (unsigned long) dval[j]; +#else + *sgrib++ = (uint16_t) dval[j]; +#endif + } + z += 2*CGRIBEX__UNROLL_DEPTH_2; + } + else + { + for (size_t j = 0; j < CGRIBEX__UNROLL_DEPTH_2; ++j) + { + ival = (uint16_t) dval[j]; + *sgrib++ = gribSwapByteOrder_uint16(ival); + } + z += 2*CGRIBEX__UNROLL_DEPTH_2; + } + } + for (size_t j = 0; j < residual; ++j) + { + dval[j] = CGRIBEX_FPSCALE(data[j]); + } + if ( IS_BIGENDIAN() ) + { + for (size_t j = 0; j < residual; ++j) + { +#ifdef _ARCH_PWR6 + *sgrib++ = (unsigned long) dval[j]; +#else + *sgrib++ = (uint16_t) dval[j]; +#endif + } + z += 2*residual; + } + else + { + for (size_t j = 0; j < residual; ++j) + { + ival = (uint16_t) dval[j]; + lGrib[z ] = (GRIBPACK)(ival >> 8); + lGrib[z+1] = (GRIBPACK)ival; + z += 2; + } + } +#ifdef _GET_IBM_COUNTER + hpmStop(3); +#endif + } + else if ( numBits == 24 ) + { +#ifdef _GET_IBM_COUNTER + hpmStart(4, "pack 24 bit unrolled"); +#endif +#ifdef _ARCH_PWR6 + unsigned long ival; +#else + uint32_t ival; +#endif + for (size_t i = 0; i < datasize - residual; i += CGRIBEX__UNROLL_DEPTH_2) + { + for (size_t j = 0; j < CGRIBEX__UNROLL_DEPTH_2; ++j) + { + dval[j] = CGRIBEX_FPSCALE(data[j]); + } + for (size_t j = 0; j < CGRIBEX__UNROLL_DEPTH_2; ++j) + { +#ifdef _ARCH_PWR6 + ival = (unsigned long) dval[j]; +#else + ival = (uint32_t) dval[j]; +#endif + lGrib[z ] = (GRIBPACK)(ival >> 16); + lGrib[z+1] = (GRIBPACK)(ival >> 8); + lGrib[z+2] = (GRIBPACK)ival; + z += 3; + } + } + for (size_t j = 0; j < residual; ++j) + { + dval[j] = CGRIBEX_FPSCALE(data[j]); + } + for (size_t j = 0; j < residual; ++j) + { + ival = (uint32_t) dval[j]; + lGrib[z ] = (GRIBPACK)(ival >> 16); + lGrib[z+1] = (GRIBPACK)(ival >> 8); + lGrib[z+2] = (GRIBPACK)ival; + z += 3; + } +#ifdef _GET_IBM_COUNTER + hpmStop(4); +#endif + } + else if ( numBits == 32 ) + { +#ifdef _GET_IBM_COUNTER + hpmStart(5, "pack 32 bit unrolled"); +#endif +#ifdef _ARCH_PWR6 + unsigned long ival; +#else + uint32_t ival; +#endif + unsigned int *igrib = (unsigned int *)(void *)(lGrib + z); + for (size_t i = 0; i < datasize - residual; i += CGRIBEX__UNROLL_DEPTH_2) + { + for (size_t j = 0; j < CGRIBEX__UNROLL_DEPTH_2; ++j) dval[j] = CGRIBEX_FPSCALE(data[i+j]); + + if ( IS_BIGENDIAN() ) + { + for (size_t j = 0; j < CGRIBEX__UNROLL_DEPTH_2; ++j) + { +#ifdef _ARCH_PWR6 + *igrib = (unsigned long) dval[j]; +#else + *igrib = (uint32_t) dval[j]; +#endif + igrib++; + z += 4; + } + } + else + { + for (size_t j = 0; j < CGRIBEX__UNROLL_DEPTH_2; ++j) + { + ival = (uint32_t) dval[j]; + lGrib[z ] = (GRIBPACK)(ival >> 24); + lGrib[z+1] = (GRIBPACK)(ival >> 16); + lGrib[z+2] = (GRIBPACK)(ival >> 8); + lGrib[z+3] = (GRIBPACK)ival; + z += 4; + } + } + } + for (size_t j = 0; j < residual; ++j) + { + dval[j] = CGRIBEX_FPSCALE(data[ofs+j]); + } + if ( IS_BIGENDIAN() ) + { + for (size_t j = 0; j < residual; ++j) + { +#ifdef _ARCH_PWR6 + *igrib = (unsigned long) dval[j]; +#else + *igrib = (uint32_t) dval[j]; +#endif + igrib++; + z += 4; + } + } + else + { + for (size_t j = 0; j < residual; ++j) + { + ival = (uint32_t) dval[j]; + lGrib[z ] = (GRIBPACK)(ival >> 24); + lGrib[z+1] = (GRIBPACK)(ival >> 16); + lGrib[z+2] = (GRIBPACK)(ival >> 8); + lGrib[z+3] = (GRIBPACK)ival; + z += 4; + } + } +#ifdef _GET_IBM_COUNTER + hpmStop(5); +#endif + } + else if ( numBits > 0 && numBits <= 32 ) + { + TEMPLATE(encode_array_common,T)(numBits, 0, datasize, lGrib, data, zref, factor, &z); + } + else if ( numBits == 0 ) + { + } + else + { + Error("Unimplemented packing factor %d!", numBits); + } + + *gz = z; +} + +#ifdef CGRIBEX_FPSCALE +#undef CGRIBEX_FPSCALE +#endif + +#endif /* T */ + + +#ifdef T +#undef T +#endif +#define T double +#ifdef T + +// GRIB BLOCK 2 - GRID DESCRIPTION SECTION +static +void TEMPLATE(encodeGDS,T)(GRIBPACK *lGrib, long *gribLen, int *isec2, T *fsec2) +{ + long z = *gribLen; + int exponent, mantissa; + int ival; + int gdslen = 32; + + if ( ISEC2_GridType == GRIB1_GTYPE_LCC ) gdslen += 10; + + if ( ISEC2_GridType == GRIB1_GTYPE_LATLON_ROT ) gdslen += 10; + + const int pvoffset = (ISEC2_NumVCP || ISEC2_Reduced) ? gdslen + 1 : 0xFF; + + if ( ISEC2_Reduced ) gdslen += 2 * ISEC2_NumLat; + + gdslen += ISEC2_NumVCP * 4; + + Put3Byte(gdslen); /* 0- 2 Length of Block 2 Byte 0 */ + Put1Byte(ISEC2_NumVCP); /* 3 NV */ + Put1Byte(pvoffset); /* 4 PV */ + Put1Byte(ISEC2_GridType); /* 5 LatLon=0 Gauss=4 Spectral=50 */ + + if ( ISEC2_GridType == GRIB1_GTYPE_SPECTRAL ) + { + Put2Byte(ISEC2_PentaJ); /* 6- 7 Pentagonal resolution J */ + Put2Byte(ISEC2_PentaK); /* 8- 9 Pentagonal resolution K */ + Put2Byte(ISEC2_PentaM); /* 10-11 Pentagonal resolution M */ + Put1Byte(ISEC2_RepType); /* 12 Representation type */ + Put1Byte(ISEC2_RepMode); /* 13 Representation mode */ + PutnZero(18); /* 14-31 reserved */ + } + else if ( ISEC2_GridType == GRIB1_GTYPE_GME ) + { + Put2Byte(ISEC2_GME_NI2); + Put2Byte(ISEC2_GME_NI3); + Put3Byte(ISEC2_GME_ND); + Put3Byte(ISEC2_GME_NI); + Put1Byte(ISEC2_GME_AFlag); + Put3Int(ISEC2_GME_LatPP); + Put3Int(ISEC2_GME_LonPP); + Put3Int(ISEC2_GME_LonMPL); + Put1Byte(ISEC2_GME_BFlag); + PutnZero(5); + } + else if ( ISEC2_GridType == GRIB1_GTYPE_LCC ) + { + Put2Byte(ISEC2_NumLon); /* 6- 7 Longitudes */ + + Put2Byte(ISEC2_NumLat); /* 8- 9 Latitudes */ + Put3Int(ISEC2_FirstLat); + Put3Int(ISEC2_FirstLon); + Put1Byte(ISEC2_ResFlag); /* 16 Resolution flag */ + Put3Int(ISEC2_Lambert_Lov); /* 17-19 */ + Put3Int(ISEC2_Lambert_dx); /* 20-22 */ + Put3Int(ISEC2_Lambert_dy); /* 23-25 */ + Put1Byte(ISEC2_Lambert_ProjFlag);/* 26 Projection flag */ + Put1Byte(ISEC2_ScanFlag); /* 27 Scanning mode */ + Put3Int(ISEC2_Lambert_LatS1); /* 28-30 */ + Put3Int(ISEC2_Lambert_LatS2); /* 31-33 */ + Put3Int(ISEC2_Lambert_LatSP); /* 34-36 */ + Put3Int(ISEC2_Lambert_LonSP); /* 37-39 */ + PutnZero(2); /* 34-41 */ + } + else if ( ISEC2_GridType == GRIB1_GTYPE_LATLON || + ISEC2_GridType == GRIB1_GTYPE_GAUSSIAN || + ISEC2_GridType == GRIB1_GTYPE_LATLON_ROT ) + { + const int numlon = ISEC2_Reduced ? 0xFFFF : ISEC2_NumLon; + Put2Byte(numlon); /* 6- 7 Number of Longitudes */ + + Put2Byte(ISEC2_NumLat); /* 8- 9 Number of Latitudes */ + Put3Int(ISEC2_FirstLat); + Put3Int(ISEC2_FirstLon); + Put1Byte(ISEC2_ResFlag); /* 16 Resolution flag */ + Put3Int(ISEC2_LastLat); + Put3Int(ISEC2_LastLon); + const unsigned lonIncr = (ISEC2_ResFlag == 0) ? 0xFFFF : (unsigned)ISEC2_LonIncr; + const unsigned latIncr = (ISEC2_ResFlag == 0) ? 0xFFFF : (unsigned)ISEC2_LatIncr; + Put2Byte(lonIncr); /* 23-24 i - direction increment */ + if ( ISEC2_GridType == GRIB1_GTYPE_GAUSSIAN ) + Put2Byte(ISEC2_NumPar); /* 25-26 Latitudes Pole->Equator */ + else + Put2Byte(latIncr); /* 25-26 j - direction increment */ + + Put1Byte(ISEC2_ScanFlag); /* 27 Scanning mode */ + PutnZero(4); /* 28-31 reserved */ + + if ( ISEC2_GridType == GRIB1_GTYPE_LATLON_ROT ) + { + Put3Int(ISEC2_LatSP); + Put3Int(ISEC2_LonSP); + Put1Real((double)(FSEC2_RotAngle)); + } + } + else + { + Error("Unsupported grid type %d", ISEC2_GridType); + } + +#if defined (SX) +#pragma vdir novector /* vectorization gives wrong results on NEC */ +#endif + for (long i = 0; i < ISEC2_NumVCP; ++i) + { + Put1Real((double)(fsec2[10+i])); + } + + if ( ISEC2_Reduced ) + for (long i = 0; i < ISEC2_NumLat; ++i) Put2Byte(ISEC2_ReducedPoints(i)); + + *gribLen = z; +} + +// GRIB BLOCK 3 - BIT MAP SECTION +static +void TEMPLATE(encodeBMS,T)(GRIBPACK *lGrib, long *gribLen, T *fsec3, int *isec4, T *data, long *datasize) +{ + long z = *gribLen; + static bool lmissvalinfo = true; + // unsigned int c, imask; + + if ( DBL_IS_NAN(FSEC3_MissVal) && lmissvalinfo) + { + lmissvalinfo = false; + Message("Missing value = NaN is unsupported!"); + } + + const long bitmapSize = ISEC4_NumValues; + const long imaskSize = ((bitmapSize+7)>>3)<<3; + GRIBPACK *bitmap = &lGrib[z+6]; + long fsec4size = 0; + +#ifdef VECTORCODE + unsigned int *imask = (unsigned int*) Malloc(imaskSize*sizeof(unsigned int)); + memset(imask, 0, imaskSize*sizeof(int)); + +#if defined (CRAY) +#pragma _CRI ivdep +#endif +#if defined (SX) +#pragma vdir nodep +#endif +#ifdef __uxpch__ +#pragma loop novrec +#endif + for (long i = 0; i < bitmapSize; ++i) + { + if ( IS_NOT_EQUAL(data[i], FSEC3_MissVal) ) + { + data[fsec4size++] = data[i]; + imask[i] = 1; + } + } + +#if defined (CRAY) +#pragma _CRI ivdep +#endif +#if defined (SX) +#pragma vdir nodep +#endif +#ifdef __uxpch__ +#pragma loop novrec +#endif + for (long i = 0; i < imaskSize/8; ++i) + { + bitmap[i] = (imask[i*8+0] << 7) | (imask[i*8+1] << 6) | + (imask[i*8+2] << 5) | (imask[i*8+3] << 4) | + (imask[i*8+4] << 3) | (imask[i*8+5] << 2) | + (imask[i*8+6] << 1) | (imask[i*8+7]); + } + + Free(imask); +#else + for (long i = 0; i < imaskSize/8; ++i) bitmap[i] = 0; + + for (long i = 0; i < bitmapSize; ++i) + { + if ( IS_NOT_EQUAL(data[i], FSEC3_MissVal) ) + { + data[fsec4size++] = data[i]; + bitmap[i/8] |= (GRIBPACK)(1<<(7-(i&7))); + } + } +#endif + + const long bmsLen = imaskSize/8 + 6; + const long bmsUnusedBits = imaskSize - bitmapSize; + + Put3Byte(bmsLen); /* 0- 2 Length of Block 3 Byte 0 */ + Put1Byte(bmsUnusedBits); + Put2Byte(0); + + *gribLen += bmsLen; + + *datasize = fsec4size; +} + +#define pow_double pow +#define pow_float powf + +// GRIB BLOCK 4 - BINARY DATA SECTION +static +int TEMPLATE(encodeBDS,T)(GRIBPACK *lGrib, long *gribLen, int decscale, int *isec2, int *isec4, long datasize, T *data, + long *datstart, long *datsize, int code) +{ + // Uwe Schulzweida, 11/04/2003 : Check that number of bits per value is not exceeded + // Uwe Schulzweida, 6/05/2003 : Copy result to fpval to prevent integer overflow + + size_t z = (size_t)*gribLen; + int numBits; + int ival; + long PackStart = 0; + int Flag = 0; + int binscale = 0; + int bds_head = 11; + int bds_ext = 0; + /* ibits = BitsPerInt; */ + int exponent, mantissa; + bool lspherc = false; + int isubset = 0, itemp = 0, itrunc = 0; + T factor = 1, fmin, fmax; + const double jpepsln = 1.0e-12; // -----> tolerance used to check equality + // of floating point numbers - needed + // on some platforms (eg vpp700, linux) + extern int CGRIBEX_Const; // 1: Don't pack constant fields on regular grids + + if ( isec2 ) + { + /* If section 2 is present, it says if data is spherical harmonic */ + + lspherc = ( isec2[0] == 50 || isec2[0] == 60 || + isec2[0] == 70 || isec2[0] == 80 ); + + isec4[2] = lspherc ? 128 : 0; + } + else + { + /* Section 4 says if it's spherical harmonic data.. */ + + lspherc = ( isec4[2] == 128 ); + } + + /* Complex packing supported for spherical harmonics. */ + + const bool lcomplex = ( lspherc && ( isec4[3] == 64 ) ) || + ( lspherc && isec2 && ( isec2[5] == 2 ) ); + + // Check input specification is consistent + + if ( lcomplex && isec2 ) + { + if ( ( isec4[3] != 64 ) && ( isec2[5] == 2 ) ) + { + gprintf(__func__, " COMPLEX mismatch. isec4[3] = %d\n", isec4[3]); + gprintf(__func__, " COMPLEX mismatch. isec2[5] = %d\n", isec2[5]); + return (807); + } + else if ( ( isec4[3] == 64 ) && ( isec2[5] != 2 ) ) + { + gprintf(__func__, " COMPLEX mismatch. isec4[3] = %d\n", isec4[3]); + gprintf(__func__, " COMPLEX mismatch. isec2[5] = %d\n", isec2[5]); + return (807); + } + else if ( lcomplex ) + { + // Truncation of full spectrum, which is supposed triangular, has to be diagnosed. Define also sub-set truncation. + isubset = isec4[17]; + // When encoding, use the total number of data. + itemp = isec4[0]; + itrunc = (int) (sqrt(itemp*4 + 1.) - 3) / 2; + } + } + + if ( decscale ) + { + const T scale = TEMPLATE(pow,T)((T)10.0, (T)decscale); + for (long i = 0; i < datasize; ++i) data[i] *= scale; + } + + if ( lspherc ) + { + if ( lcomplex ) + { + const int jup = isubset; + const int ioff = (jup+1)*(jup+2); + bds_ext = 4 + 3 + 4*ioff; + PackStart = ioff; + Flag = 192; + } + else + { + bds_ext = 4; + PackStart = 1; + Flag = 128; + } + } + + *datstart = bds_head + bds_ext; + + int nbpv = numBits = ISEC4_NumBits; + + if ( lspherc && lcomplex ) + { + const int pcStart = isubset; + const int pcScale = isec4[16]; + TEMPLATE(scale_complex,T)(data, pcStart, pcScale, itrunc, 0); + TEMPLATE(gather_complex,T)(data, (size_t)pcStart, (size_t)itrunc, (size_t)datasize); + } + + fmin = fmax = data[PackStart]; + + TEMPLATE(minmax_val,T)(data+PackStart, datasize-PackStart, &fmin, &fmax); + + double zref = (double)fmin; + if (!(zref < DBL_MAX && zref > -DBL_MAX)) + { + gprintf(__func__, "Minimum value out of range: %g!", zref); + return (707); + } + + if ( CGRIBEX_Const && !lspherc ) + { + if ( IS_EQUAL(fmin, fmax) ) nbpv = 0; + } + + long blockLength = (*datstart) + (nbpv*(datasize - PackStart) + 7)/8; + blockLength += blockLength & 1; + + const long unused_bits = blockLength*8 - (*datstart)*8 - nbpv*(datasize - PackStart); + + Flag += unused_bits; + + + // Adjust number of bits per value if full integer length to avoid hitting most significant bit (sign bit). + // if( nbpv == ibits ) nbpv = nbpv - 1; + /* + Calculate the binary scaling factor to spread the range of values over the number of bits per value. + Limit scaling to 2**-126 to 2**127 (using IEEE 32-bit floatsas a guideline). + */ + const double range = fabs(fmax - fmin); + + if ( fabs(fmin) < FLT_MIN ) fmin = 0; + /* + Have to allow tolerance in comparisons on some platforms (eg vpp700 and linux), + such as 0.9999999999999999 = 1.0, to avoid clipping ranges which are a power of 2. + */ + if ( range <= jpepsln ) + { + binscale = 0; + } + else if ( IS_NOT_EQUAL(fmin, 0.0) && (fabs(range/fmin) <= jpepsln) ) + { + binscale = 0; + } + else if ( fabs(range-1.0) <= jpepsln ) + { + binscale = 1 - nbpv; + } + else if ( range > 1.0 ) + { + const double rangec = range + jpepsln; + double p2 = 2.0; + int jloop = 1; + while ( jloop < 128 && p2 <= rangec ) + { + p2 *= 2.0; + ++jloop; + } + if (jloop < 128) + binscale = jloop - nbpv; + else + { + gprintf(__func__, "Problem calculating binary scale value for encode code %d!", code); + gprintf(__func__, "> range %g rangec %g fmin %g fmax %g", range, rangec, fmin, fmax); + return (707); + } + } + else + { + const double rangec = range - jpepsln; + double p05 = 0.5; + int jloop = 1; + while ( jloop < 127 && p05 >= rangec ) + { + p05 *= 0.5; + jloop++; + } + if ( jloop < 127 ) + { + binscale = 1 - jloop - nbpv; + } + else + { + gprintf(__func__, "Problem calculating binary scale value for encode code %d!", code); + gprintf(__func__, "< range %g rangec %g fmin %g fmax %g", range, rangec, fmin, fmax); + return (707); + } + } + + const uint64_t max_nbpv_pow2 = (uint64_t) ((1ULL << nbpv) - 1); + + if ( binscale != 0 ) + { + while ( (uint64_t)(ldexp(range, -binscale)+0.5) > max_nbpv_pow2 ) binscale++; + + factor = (T)intpow2(-binscale); + } + + ref2ibm(&zref, BitsPerInt); + + Put3Byte(blockLength); // 0-2 Length of Block 4 + Put1Byte(Flag); // 3 Flag & Unused bits + if ( binscale < 0 ) binscale = 32768 - binscale; + Put2Byte(binscale); // 4-5 Scale factor + Put1Real(zref); // 6-9 Reference value + Put1Byte(nbpv); // 10 Packing size + + if ( lspherc ) + { + if ( lcomplex ) + { + const int jup = isubset; + int ioff = (int)z + bds_ext; + if ( ioff > 0xFFFF ) ioff = 0; + Put2Byte(ioff); + Put2Int(isec4[16]); + Put1Byte(jup); + Put1Byte(jup); + Put1Byte(jup); + for (long i = 0; i < ((jup+1)*(jup+2)); ++i) Put1Real((double)(data[i])); + } + else + { + Put1Real((double)(data[0])); + } + } + + *datsize = ((datasize-PackStart)*nbpv + 7)/8; + +#if defined (_ARCH_PWR6) + TEMPLATE(encode_array_unrolled,T)(nbpv, (size_t)PackStart, (size_t)datasize, lGrib, data, (T)zref, factor, &z); +#else + TEMPLATE(encode_array,T)(nbpv, (size_t)PackStart, (size_t)datasize, lGrib, data, (T)zref, factor, &z); +#endif + + if ( unused_bits >= 8 ) Put1Byte(0); // Fillbyte + + *gribLen = (long)z; + + return 0; +} + + +void TEMPLATE(grib_encode,T)(int *isec0, int *isec1, int *isec2, T *fsec2, int *isec3, + T *fsec3, int *isec4, T *fsec4, int klenp, int *kgrib, + int kleng, int *kword, int efunc, int *kret) +{ + long gribLen = 0; // Counter of GRIB length for output + long fsec4size = 0; + long datstart, datsize; + + UNUSED(isec3); + UNUSED(efunc); + + grsdef(); + + unsigned char *CGrib = (unsigned char *) kgrib; + + const bool gdsIncluded = ISEC1_Sec2Or3Flag & 128; + const bool bmsIncluded = ISEC1_Sec2Or3Flag & 64; + + // set max header len + size_t len = 16384; + + // add data len + const size_t numBytes = (size_t)((ISEC4_NumBits+7)>>3); + + len += numBytes*(size_t)klenp; + + // add bitmap len + if ( bmsIncluded ) len += (size_t)((klenp+7)>>3); + +#ifdef VECTORCODE + GRIBPACK *lGrib = (GRIBPACK*) Malloc(len*sizeof(GRIBPACK)); + if ( lGrib == NULL ) SysError("No Memory!"); +#else + GRIBPACK *lGrib = CGrib; +#endif + + const long isLen = 8; + encodeIS(lGrib, &gribLen); + GRIBPACK *lpds = &lGrib[isLen]; + const long pdsLen = getPdsLen(isec1); + + encodePDS(lpds, pdsLen, isec1); + gribLen += pdsLen; + /* + if ( ( isec4[3] == 64 ) && ( isec2[5] == 2 ) ) + { + static bool lwarn_cplx = true; + + if ( lwarn_cplx ) + Message("Complex packing of spectral data unsupported, using simple packing!"); + + isec2[5] = 1; + isec4[3] = 0; + + lwarn_cplx = false; + } + */ + if ( gdsIncluded ) TEMPLATE(encodeGDS,T)(lGrib, &gribLen, isec2, fsec2); + /* + ---------------------------------------------------------------- + BMS Bit-Map Section Section (Section 3) + ---------------------------------------------------------------- + */ + if ( bmsIncluded ) + { + TEMPLATE(encodeBMS,T)(lGrib, &gribLen, fsec3, isec4, fsec4, &fsec4size); + } + else + { + fsec4size = ISEC4_NumValues; + } + + const long bdsstart = gribLen; + int status = TEMPLATE(encodeBDS,T)(lGrib, &gribLen, ISEC1_DecScaleFactor, isec2, + isec4, fsec4size, fsec4, &datstart, &datsize, ISEC1_Parameter); + if ( status ) + { + *kret = status; + return; + } + + encodeES(lGrib, &gribLen, bdsstart); + + if ( (size_t) gribLen > (size_t)kleng*sizeof(int) ) + Error("kgrib buffer too small! kleng = %d gribLen = %d", kleng, gribLen); + +#ifdef VECTORCODE + if ( (size_t) gribLen > len ) + Error("lGrib buffer too small! len = %d gribLen = %d", len, gribLen); + + (void) PACK_GRIB(lGrib, (unsigned char *)CGrib, gribLen, -1L); + + Free(lGrib); +#endif + + ISEC0_GRIB_Len = (int)gribLen; + ISEC0_GRIB_Version = 1; + + *kword = (int)((gribLen + (long)sizeof(int) - 1) / (long)sizeof(int)); + + *kret = status; +} + +#endif /* T */ + +/* + * Local Variables: + * mode: c + * End: + */ + +#ifdef T +#undef T +#endif +#define T float +#ifdef T + +// GRIB BLOCK 2 - GRID DESCRIPTION SECTION +static +void TEMPLATE(encodeGDS,T)(GRIBPACK *lGrib, long *gribLen, int *isec2, T *fsec2) +{ + long z = *gribLen; + int exponent, mantissa; + int ival; + int gdslen = 32; + + if ( ISEC2_GridType == GRIB1_GTYPE_LCC ) gdslen += 10; + + if ( ISEC2_GridType == GRIB1_GTYPE_LATLON_ROT ) gdslen += 10; + + const int pvoffset = (ISEC2_NumVCP || ISEC2_Reduced) ? gdslen + 1 : 0xFF; + + if ( ISEC2_Reduced ) gdslen += 2 * ISEC2_NumLat; + + gdslen += ISEC2_NumVCP * 4; + + Put3Byte(gdslen); /* 0- 2 Length of Block 2 Byte 0 */ + Put1Byte(ISEC2_NumVCP); /* 3 NV */ + Put1Byte(pvoffset); /* 4 PV */ + Put1Byte(ISEC2_GridType); /* 5 LatLon=0 Gauss=4 Spectral=50 */ + + if ( ISEC2_GridType == GRIB1_GTYPE_SPECTRAL ) + { + Put2Byte(ISEC2_PentaJ); /* 6- 7 Pentagonal resolution J */ + Put2Byte(ISEC2_PentaK); /* 8- 9 Pentagonal resolution K */ + Put2Byte(ISEC2_PentaM); /* 10-11 Pentagonal resolution M */ + Put1Byte(ISEC2_RepType); /* 12 Representation type */ + Put1Byte(ISEC2_RepMode); /* 13 Representation mode */ + PutnZero(18); /* 14-31 reserved */ + } + else if ( ISEC2_GridType == GRIB1_GTYPE_GME ) + { + Put2Byte(ISEC2_GME_NI2); + Put2Byte(ISEC2_GME_NI3); + Put3Byte(ISEC2_GME_ND); + Put3Byte(ISEC2_GME_NI); + Put1Byte(ISEC2_GME_AFlag); + Put3Int(ISEC2_GME_LatPP); + Put3Int(ISEC2_GME_LonPP); + Put3Int(ISEC2_GME_LonMPL); + Put1Byte(ISEC2_GME_BFlag); + PutnZero(5); + } + else if ( ISEC2_GridType == GRIB1_GTYPE_LCC ) + { + Put2Byte(ISEC2_NumLon); /* 6- 7 Longitudes */ + + Put2Byte(ISEC2_NumLat); /* 8- 9 Latitudes */ + Put3Int(ISEC2_FirstLat); + Put3Int(ISEC2_FirstLon); + Put1Byte(ISEC2_ResFlag); /* 16 Resolution flag */ + Put3Int(ISEC2_Lambert_Lov); /* 17-19 */ + Put3Int(ISEC2_Lambert_dx); /* 20-22 */ + Put3Int(ISEC2_Lambert_dy); /* 23-25 */ + Put1Byte(ISEC2_Lambert_ProjFlag);/* 26 Projection flag */ + Put1Byte(ISEC2_ScanFlag); /* 27 Scanning mode */ + Put3Int(ISEC2_Lambert_LatS1); /* 28-30 */ + Put3Int(ISEC2_Lambert_LatS2); /* 31-33 */ + Put3Int(ISEC2_Lambert_LatSP); /* 34-36 */ + Put3Int(ISEC2_Lambert_LonSP); /* 37-39 */ + PutnZero(2); /* 34-41 */ + } + else if ( ISEC2_GridType == GRIB1_GTYPE_LATLON || + ISEC2_GridType == GRIB1_GTYPE_GAUSSIAN || + ISEC2_GridType == GRIB1_GTYPE_LATLON_ROT ) + { + const int numlon = ISEC2_Reduced ? 0xFFFF : ISEC2_NumLon; + Put2Byte(numlon); /* 6- 7 Number of Longitudes */ + + Put2Byte(ISEC2_NumLat); /* 8- 9 Number of Latitudes */ + Put3Int(ISEC2_FirstLat); + Put3Int(ISEC2_FirstLon); + Put1Byte(ISEC2_ResFlag); /* 16 Resolution flag */ + Put3Int(ISEC2_LastLat); + Put3Int(ISEC2_LastLon); + const unsigned lonIncr = (ISEC2_ResFlag == 0) ? 0xFFFF : (unsigned)ISEC2_LonIncr; + const unsigned latIncr = (ISEC2_ResFlag == 0) ? 0xFFFF : (unsigned)ISEC2_LatIncr; + Put2Byte(lonIncr); /* 23-24 i - direction increment */ + if ( ISEC2_GridType == GRIB1_GTYPE_GAUSSIAN ) + Put2Byte(ISEC2_NumPar); /* 25-26 Latitudes Pole->Equator */ + else + Put2Byte(latIncr); /* 25-26 j - direction increment */ + + Put1Byte(ISEC2_ScanFlag); /* 27 Scanning mode */ + PutnZero(4); /* 28-31 reserved */ + + if ( ISEC2_GridType == GRIB1_GTYPE_LATLON_ROT ) + { + Put3Int(ISEC2_LatSP); + Put3Int(ISEC2_LonSP); + Put1Real((double)(FSEC2_RotAngle)); + } + } + else + { + Error("Unsupported grid type %d", ISEC2_GridType); + } + +#if defined (SX) +#pragma vdir novector /* vectorization gives wrong results on NEC */ +#endif + for (long i = 0; i < ISEC2_NumVCP; ++i) + { + Put1Real((double)(fsec2[10+i])); + } + + if ( ISEC2_Reduced ) + for (long i = 0; i < ISEC2_NumLat; ++i) Put2Byte(ISEC2_ReducedPoints(i)); + + *gribLen = z; +} + +// GRIB BLOCK 3 - BIT MAP SECTION +static +void TEMPLATE(encodeBMS,T)(GRIBPACK *lGrib, long *gribLen, T *fsec3, int *isec4, T *data, long *datasize) +{ + long z = *gribLen; + static bool lmissvalinfo = true; + // unsigned int c, imask; + + if ( DBL_IS_NAN(FSEC3_MissVal) && lmissvalinfo) + { + lmissvalinfo = false; + Message("Missing value = NaN is unsupported!"); + } + + const long bitmapSize = ISEC4_NumValues; + const long imaskSize = ((bitmapSize+7)>>3)<<3; + GRIBPACK *bitmap = &lGrib[z+6]; + long fsec4size = 0; + +#ifdef VECTORCODE + unsigned int *imask = (unsigned int*) Malloc(imaskSize*sizeof(unsigned int)); + memset(imask, 0, imaskSize*sizeof(int)); + +#if defined (CRAY) +#pragma _CRI ivdep +#endif +#if defined (SX) +#pragma vdir nodep +#endif +#ifdef __uxpch__ +#pragma loop novrec +#endif + for (long i = 0; i < bitmapSize; ++i) + { + if ( IS_NOT_EQUAL(data[i], FSEC3_MissVal) ) + { + data[fsec4size++] = data[i]; + imask[i] = 1; + } + } + +#if defined (CRAY) +#pragma _CRI ivdep +#endif +#if defined (SX) +#pragma vdir nodep +#endif +#ifdef __uxpch__ +#pragma loop novrec +#endif + for (long i = 0; i < imaskSize/8; ++i) + { + bitmap[i] = (imask[i*8+0] << 7) | (imask[i*8+1] << 6) | + (imask[i*8+2] << 5) | (imask[i*8+3] << 4) | + (imask[i*8+4] << 3) | (imask[i*8+5] << 2) | + (imask[i*8+6] << 1) | (imask[i*8+7]); + } + + Free(imask); +#else + for (long i = 0; i < imaskSize/8; ++i) bitmap[i] = 0; + + for (long i = 0; i < bitmapSize; ++i) + { + if ( IS_NOT_EQUAL(data[i], FSEC3_MissVal) ) + { + data[fsec4size++] = data[i]; + bitmap[i/8] |= (GRIBPACK)(1<<(7-(i&7))); + } + } +#endif + + const long bmsLen = imaskSize/8 + 6; + const long bmsUnusedBits = imaskSize - bitmapSize; + + Put3Byte(bmsLen); /* 0- 2 Length of Block 3 Byte 0 */ + Put1Byte(bmsUnusedBits); + Put2Byte(0); + + *gribLen += bmsLen; + + *datasize = fsec4size; +} + +#define pow_double pow +#define pow_float powf + +// GRIB BLOCK 4 - BINARY DATA SECTION +static +int TEMPLATE(encodeBDS,T)(GRIBPACK *lGrib, long *gribLen, int decscale, int *isec2, int *isec4, long datasize, T *data, + long *datstart, long *datsize, int code) +{ + // Uwe Schulzweida, 11/04/2003 : Check that number of bits per value is not exceeded + // Uwe Schulzweida, 6/05/2003 : Copy result to fpval to prevent integer overflow + + size_t z = (size_t)*gribLen; + int numBits; + int ival; + long PackStart = 0; + int Flag = 0; + int binscale = 0; + int bds_head = 11; + int bds_ext = 0; + /* ibits = BitsPerInt; */ + int exponent, mantissa; + bool lspherc = false; + int isubset = 0, itemp = 0, itrunc = 0; + T factor = 1, fmin, fmax; + const double jpepsln = 1.0e-12; // -----> tolerance used to check equality + // of floating point numbers - needed + // on some platforms (eg vpp700, linux) + extern int CGRIBEX_Const; // 1: Don't pack constant fields on regular grids + + if ( isec2 ) + { + /* If section 2 is present, it says if data is spherical harmonic */ + + lspherc = ( isec2[0] == 50 || isec2[0] == 60 || + isec2[0] == 70 || isec2[0] == 80 ); + + isec4[2] = lspherc ? 128 : 0; + } + else + { + /* Section 4 says if it's spherical harmonic data.. */ + + lspherc = ( isec4[2] == 128 ); + } + + /* Complex packing supported for spherical harmonics. */ + + const bool lcomplex = ( lspherc && ( isec4[3] == 64 ) ) || + ( lspherc && isec2 && ( isec2[5] == 2 ) ); + + // Check input specification is consistent + + if ( lcomplex && isec2 ) + { + if ( ( isec4[3] != 64 ) && ( isec2[5] == 2 ) ) + { + gprintf(__func__, " COMPLEX mismatch. isec4[3] = %d\n", isec4[3]); + gprintf(__func__, " COMPLEX mismatch. isec2[5] = %d\n", isec2[5]); + return (807); + } + else if ( ( isec4[3] == 64 ) && ( isec2[5] != 2 ) ) + { + gprintf(__func__, " COMPLEX mismatch. isec4[3] = %d\n", isec4[3]); + gprintf(__func__, " COMPLEX mismatch. isec2[5] = %d\n", isec2[5]); + return (807); + } + else if ( lcomplex ) + { + // Truncation of full spectrum, which is supposed triangular, has to be diagnosed. Define also sub-set truncation. + isubset = isec4[17]; + // When encoding, use the total number of data. + itemp = isec4[0]; + itrunc = (int) (sqrt(itemp*4 + 1.) - 3) / 2; + } + } + + if ( decscale ) + { + const T scale = TEMPLATE(pow,T)((T)10.0, (T)decscale); + for (long i = 0; i < datasize; ++i) data[i] *= scale; + } + + if ( lspherc ) + { + if ( lcomplex ) + { + const int jup = isubset; + const int ioff = (jup+1)*(jup+2); + bds_ext = 4 + 3 + 4*ioff; + PackStart = ioff; + Flag = 192; + } + else + { + bds_ext = 4; + PackStart = 1; + Flag = 128; + } + } + + *datstart = bds_head + bds_ext; + + int nbpv = numBits = ISEC4_NumBits; + + if ( lspherc && lcomplex ) + { + const int pcStart = isubset; + const int pcScale = isec4[16]; + TEMPLATE(scale_complex,T)(data, pcStart, pcScale, itrunc, 0); + TEMPLATE(gather_complex,T)(data, (size_t)pcStart, (size_t)itrunc, (size_t)datasize); + } + + fmin = fmax = data[PackStart]; + + TEMPLATE(minmax_val,T)(data+PackStart, datasize-PackStart, &fmin, &fmax); + + double zref = (double)fmin; + if (!(zref < DBL_MAX && zref > -DBL_MAX)) + { + gprintf(__func__, "Minimum value out of range: %g!", zref); + return (707); + } + + if ( CGRIBEX_Const && !lspherc ) + { + if ( IS_EQUAL(fmin, fmax) ) nbpv = 0; + } + + long blockLength = (*datstart) + (nbpv*(datasize - PackStart) + 7)/8; + blockLength += blockLength & 1; + + const long unused_bits = blockLength*8 - (*datstart)*8 - nbpv*(datasize - PackStart); + + Flag += unused_bits; + + + // Adjust number of bits per value if full integer length to avoid hitting most significant bit (sign bit). + // if( nbpv == ibits ) nbpv = nbpv - 1; + /* + Calculate the binary scaling factor to spread the range of values over the number of bits per value. + Limit scaling to 2**-126 to 2**127 (using IEEE 32-bit floatsas a guideline). + */ + const double range = fabs(fmax - fmin); + + if ( fabs(fmin) < FLT_MIN ) fmin = 0; + /* + Have to allow tolerance in comparisons on some platforms (eg vpp700 and linux), + such as 0.9999999999999999 = 1.0, to avoid clipping ranges which are a power of 2. + */ + if ( range <= jpepsln ) + { + binscale = 0; + } + else if ( IS_NOT_EQUAL(fmin, 0.0) && (fabs(range/fmin) <= jpepsln) ) + { + binscale = 0; + } + else if ( fabs(range-1.0) <= jpepsln ) + { + binscale = 1 - nbpv; + } + else if ( range > 1.0 ) + { + const double rangec = range + jpepsln; + double p2 = 2.0; + int jloop = 1; + while ( jloop < 128 && p2 <= rangec ) + { + p2 *= 2.0; + ++jloop; + } + if (jloop < 128) + binscale = jloop - nbpv; + else + { + gprintf(__func__, "Problem calculating binary scale value for encode code %d!", code); + gprintf(__func__, "> range %g rangec %g fmin %g fmax %g", range, rangec, fmin, fmax); + return (707); + } + } + else + { + const double rangec = range - jpepsln; + double p05 = 0.5; + int jloop = 1; + while ( jloop < 127 && p05 >= rangec ) + { + p05 *= 0.5; + jloop++; + } + if ( jloop < 127 ) + { + binscale = 1 - jloop - nbpv; + } + else + { + gprintf(__func__, "Problem calculating binary scale value for encode code %d!", code); + gprintf(__func__, "< range %g rangec %g fmin %g fmax %g", range, rangec, fmin, fmax); + return (707); + } + } + + const uint64_t max_nbpv_pow2 = (uint64_t) ((1ULL << nbpv) - 1); + + if ( binscale != 0 ) + { + while ( (uint64_t)(ldexp(range, -binscale)+0.5) > max_nbpv_pow2 ) binscale++; + + factor = (T)intpow2(-binscale); + } + + ref2ibm(&zref, BitsPerInt); + + Put3Byte(blockLength); // 0-2 Length of Block 4 + Put1Byte(Flag); // 3 Flag & Unused bits + if ( binscale < 0 ) binscale = 32768 - binscale; + Put2Byte(binscale); // 4-5 Scale factor + Put1Real(zref); // 6-9 Reference value + Put1Byte(nbpv); // 10 Packing size + + if ( lspherc ) + { + if ( lcomplex ) + { + const int jup = isubset; + int ioff = (int)z + bds_ext; + if ( ioff > 0xFFFF ) ioff = 0; + Put2Byte(ioff); + Put2Int(isec4[16]); + Put1Byte(jup); + Put1Byte(jup); + Put1Byte(jup); + for (long i = 0; i < ((jup+1)*(jup+2)); ++i) Put1Real((double)(data[i])); + } + else + { + Put1Real((double)(data[0])); + } + } + + *datsize = ((datasize-PackStart)*nbpv + 7)/8; + +#if defined (_ARCH_PWR6) + TEMPLATE(encode_array_unrolled,T)(nbpv, (size_t)PackStart, (size_t)datasize, lGrib, data, (T)zref, factor, &z); +#else + TEMPLATE(encode_array,T)(nbpv, (size_t)PackStart, (size_t)datasize, lGrib, data, (T)zref, factor, &z); +#endif + + if ( unused_bits >= 8 ) Put1Byte(0); // Fillbyte + + *gribLen = (long)z; + + return 0; +} + + +void TEMPLATE(grib_encode,T)(int *isec0, int *isec1, int *isec2, T *fsec2, int *isec3, + T *fsec3, int *isec4, T *fsec4, int klenp, int *kgrib, + int kleng, int *kword, int efunc, int *kret) +{ + long gribLen = 0; // Counter of GRIB length for output + long fsec4size = 0; + long datstart, datsize; + + UNUSED(isec3); + UNUSED(efunc); + + grsdef(); + + unsigned char *CGrib = (unsigned char *) kgrib; + + const bool gdsIncluded = ISEC1_Sec2Or3Flag & 128; + const bool bmsIncluded = ISEC1_Sec2Or3Flag & 64; + + // set max header len + size_t len = 16384; + + // add data len + const size_t numBytes = (size_t)((ISEC4_NumBits+7)>>3); + + len += numBytes*(size_t)klenp; + + // add bitmap len + if ( bmsIncluded ) len += (size_t)((klenp+7)>>3); + +#ifdef VECTORCODE + GRIBPACK *lGrib = (GRIBPACK*) Malloc(len*sizeof(GRIBPACK)); + if ( lGrib == NULL ) SysError("No Memory!"); +#else + GRIBPACK *lGrib = CGrib; +#endif + + const long isLen = 8; + encodeIS(lGrib, &gribLen); + GRIBPACK *lpds = &lGrib[isLen]; + const long pdsLen = getPdsLen(isec1); + + encodePDS(lpds, pdsLen, isec1); + gribLen += pdsLen; + /* + if ( ( isec4[3] == 64 ) && ( isec2[5] == 2 ) ) + { + static bool lwarn_cplx = true; + + if ( lwarn_cplx ) + Message("Complex packing of spectral data unsupported, using simple packing!"); + + isec2[5] = 1; + isec4[3] = 0; + + lwarn_cplx = false; + } + */ + if ( gdsIncluded ) TEMPLATE(encodeGDS,T)(lGrib, &gribLen, isec2, fsec2); + /* + ---------------------------------------------------------------- + BMS Bit-Map Section Section (Section 3) + ---------------------------------------------------------------- + */ + if ( bmsIncluded ) + { + TEMPLATE(encodeBMS,T)(lGrib, &gribLen, fsec3, isec4, fsec4, &fsec4size); + } + else + { + fsec4size = ISEC4_NumValues; + } + + const long bdsstart = gribLen; + int status = TEMPLATE(encodeBDS,T)(lGrib, &gribLen, ISEC1_DecScaleFactor, isec2, + isec4, fsec4size, fsec4, &datstart, &datsize, ISEC1_Parameter); + if ( status ) + { + *kret = status; + return; + } + + encodeES(lGrib, &gribLen, bdsstart); + + if ( (size_t) gribLen > (size_t)kleng*sizeof(int) ) + Error("kgrib buffer too small! kleng = %d gribLen = %d", kleng, gribLen); + +#ifdef VECTORCODE + if ( (size_t) gribLen > len ) + Error("lGrib buffer too small! len = %d gribLen = %d", len, gribLen); + + (void) PACK_GRIB(lGrib, (unsigned char *)CGrib, gribLen, -1L); + + Free(lGrib); +#endif + + ISEC0_GRIB_Len = (int)gribLen; + ISEC0_GRIB_Version = 1; + + *kword = (int)((gribLen + (long)sizeof(int) - 1) / (long)sizeof(int)); + + *kret = status; +} + +#endif /* T */ + +/* + * Local Variables: + * mode: c + * End: + */ + +void encode_dummy(void); +void encode_dummy(void) +{ + (void) encode_array_unrolled_double(0, 0, 0, NULL, NULL, 0, 0, NULL); + (void) encode_array_unrolled_float(0, 0, 0, NULL, NULL, 0, 0, NULL); +} +static const char grb_libvers[] = "2.1.0"; +const char * +cgribexLibraryVersion(void) +{ + return (grb_libvers); +} + +#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 5) +#pragma GCC diagnostic pop +#endif + +// clang-format on +#ifdef HAVE_CONFIG_H +#endif + +#include <inttypes.h> +#include <stdlib.h> +#include <sys/types.h> +#ifdef WORDS_BIGENDIAN +#include <limits.h> +#endif + + +static const uint32_t crctab[] + = { 0x00000000, 0x04c11db7, 0x09823b6e, 0x0d4326d9, 0x130476dc, 0x17c56b6b, 0x1a864db2, 0x1e475005, 0x2608edb8, 0x22c9f00f, + 0x2f8ad6d6, 0x2b4bcb61, 0x350c9b64, 0x31cd86d3, 0x3c8ea00a, 0x384fbdbd, 0x4c11db70, 0x48d0c6c7, 0x4593e01e, 0x4152fda9, + 0x5f15adac, 0x5bd4b01b, 0x569796c2, 0x52568b75, 0x6a1936c8, 0x6ed82b7f, 0x639b0da6, 0x675a1011, 0x791d4014, 0x7ddc5da3, + 0x709f7b7a, 0x745e66cd, 0x9823b6e0, 0x9ce2ab57, 0x91a18d8e, 0x95609039, 0x8b27c03c, 0x8fe6dd8b, 0x82a5fb52, 0x8664e6e5, + 0xbe2b5b58, 0xbaea46ef, 0xb7a96036, 0xb3687d81, 0xad2f2d84, 0xa9ee3033, 0xa4ad16ea, 0xa06c0b5d, 0xd4326d90, 0xd0f37027, + 0xddb056fe, 0xd9714b49, 0xc7361b4c, 0xc3f706fb, 0xceb42022, 0xca753d95, 0xf23a8028, 0xf6fb9d9f, 0xfbb8bb46, 0xff79a6f1, + 0xe13ef6f4, 0xe5ffeb43, 0xe8bccd9a, 0xec7dd02d, 0x34867077, 0x30476dc0, 0x3d044b19, 0x39c556ae, 0x278206ab, 0x23431b1c, + 0x2e003dc5, 0x2ac12072, 0x128e9dcf, 0x164f8078, 0x1b0ca6a1, 0x1fcdbb16, 0x018aeb13, 0x054bf6a4, 0x0808d07d, 0x0cc9cdca, + 0x7897ab07, 0x7c56b6b0, 0x71159069, 0x75d48dde, 0x6b93dddb, 0x6f52c06c, 0x6211e6b5, 0x66d0fb02, 0x5e9f46bf, 0x5a5e5b08, + 0x571d7dd1, 0x53dc6066, 0x4d9b3063, 0x495a2dd4, 0x44190b0d, 0x40d816ba, 0xaca5c697, 0xa864db20, 0xa527fdf9, 0xa1e6e04e, + 0xbfa1b04b, 0xbb60adfc, 0xb6238b25, 0xb2e29692, 0x8aad2b2f, 0x8e6c3698, 0x832f1041, 0x87ee0df6, 0x99a95df3, 0x9d684044, + 0x902b669d, 0x94ea7b2a, 0xe0b41de7, 0xe4750050, 0xe9362689, 0xedf73b3e, 0xf3b06b3b, 0xf771768c, 0xfa325055, 0xfef34de2, + 0xc6bcf05f, 0xc27dede8, 0xcf3ecb31, 0xcbffd686, 0xd5b88683, 0xd1799b34, 0xdc3abded, 0xd8fba05a, 0x690ce0ee, 0x6dcdfd59, + 0x608edb80, 0x644fc637, 0x7a089632, 0x7ec98b85, 0x738aad5c, 0x774bb0eb, 0x4f040d56, 0x4bc510e1, 0x46863638, 0x42472b8f, + 0x5c007b8a, 0x58c1663d, 0x558240e4, 0x51435d53, 0x251d3b9e, 0x21dc2629, 0x2c9f00f0, 0x285e1d47, 0x36194d42, 0x32d850f5, + 0x3f9b762c, 0x3b5a6b9b, 0x0315d626, 0x07d4cb91, 0x0a97ed48, 0x0e56f0ff, 0x1011a0fa, 0x14d0bd4d, 0x19939b94, 0x1d528623, + 0xf12f560e, 0xf5ee4bb9, 0xf8ad6d60, 0xfc6c70d7, 0xe22b20d2, 0xe6ea3d65, 0xeba91bbc, 0xef68060b, 0xd727bbb6, 0xd3e6a601, + 0xdea580d8, 0xda649d6f, 0xc423cd6a, 0xc0e2d0dd, 0xcda1f604, 0xc960ebb3, 0xbd3e8d7e, 0xb9ff90c9, 0xb4bcb610, 0xb07daba7, + 0xae3afba2, 0xaafbe615, 0xa7b8c0cc, 0xa379dd7b, 0x9b3660c6, 0x9ff77d71, 0x92b45ba8, 0x9675461f, 0x8832161a, 0x8cf30bad, + 0x81b02d74, 0x857130c3, 0x5d8a9099, 0x594b8d2e, 0x5408abf7, 0x50c9b640, 0x4e8ee645, 0x4a4ffbf2, 0x470cdd2b, 0x43cdc09c, + 0x7b827d21, 0x7f436096, 0x7200464f, 0x76c15bf8, 0x68860bfd, 0x6c47164a, 0x61043093, 0x65c52d24, 0x119b4be9, 0x155a565e, + 0x18197087, 0x1cd86d30, 0x029f3d35, 0x065e2082, 0x0b1d065b, 0x0fdc1bec, 0x3793a651, 0x3352bbe6, 0x3e119d3f, 0x3ad08088, + 0x2497d08d, 0x2056cd3a, 0x2d15ebe3, 0x29d4f654, 0xc5a92679, 0xc1683bce, 0xcc2b1d17, 0xc8ea00a0, 0xd6ad50a5, 0xd26c4d12, + 0xdf2f6bcb, 0xdbee767c, 0xe3a1cbc1, 0xe760d676, 0xea23f0af, 0xeee2ed18, 0xf0a5bd1d, 0xf464a0aa, 0xf9278673, 0xfde69bc4, + 0x89b8fd09, 0x8d79e0be, 0x803ac667, 0x84fbdbd0, 0x9abc8bd5, 0x9e7d9662, 0x933eb0bb, 0x97ffad0c, 0xafb010b1, 0xab710d06, + 0xa6322bdf, 0xa2f33668, 0xbcb4666d, 0xb8757bda, 0xb5365d03, 0xb1f740b4 }; + +uint32_t +memcrc(const unsigned char *b, size_t n) +{ + /* Input arguments: + * const char* b == byte sequence to checksum + * size_t n == length of sequence + */ + + uint32_t s = 0; + + memcrc_r(&s, b, n); + + /* Extend with the length of the string. */ + while (n != 0) + { + register uint32_t c = n & 0377; + n >>= 8; + s = (s << 8) ^ crctab[(s >> 24) ^ c]; + } + + return ~s; +} + +void +memcrc_r(uint32_t *state, const unsigned char *block, size_t block_len) +{ + /* Input arguments: + * const char* b == byte sequence to checksum + * size_t n == length of sequence + */ + + register uint32_t c, s = *state; + register size_t n = block_len; + register const unsigned char *b = block; + + for (; n > 0; --n) + { + c = (uint32_t) (*b++); + s = (s << 8) ^ crctab[(s >> 24) ^ c]; + } + + *state = s; +} + +#ifdef WORDS_BIGENDIAN +#define SWAP_CSUM(BITWIDTH, BYTEWIDTH, NACC) \ + do \ + { \ + register const uint##BITWIDTH##_t *b = (uint##BITWIDTH##_t *) elems; \ + for (size_t i = 0; i < num_elems; ++i) \ + { \ + for (size_t aofs = NACC; aofs > 0; --aofs) \ + { \ + uint##BITWIDTH##_t accum = b[i + aofs - 1]; \ + for (size_t j = 0; j < BYTEWIDTH; ++j) \ + { \ + uint32_t c = (uint32_t) (accum & UCHAR_MAX); \ + s = (s << 8) ^ crctab[(s >> 24) ^ c]; \ + accum >>= 8; \ + } \ + } \ + } \ + } \ + while (0) +#endif + +/** + * Does endian-swapping prior to checksumming in case platform is big-endian + * + * @param elems points to first first element with alignment elem_size + * @param num_elems number of elements to process + * @param elem_size size of each element in bytes + */ +void +memcrc_r_eswap(uint32_t *state, const unsigned char *elems, size_t num_elems, size_t elem_size) +{ +#ifdef WORDS_BIGENDIAN + register uint32_t s = *state; + + switch (elem_size) + { + case 1: memcrc_r(state, elems, num_elems * elem_size); return; + case 2: SWAP_CSUM(16, 2, 1); break; + case 4: SWAP_CSUM(32, 4, 1); break; + case 8: SWAP_CSUM(64, 8, 1); break; + case 16: SWAP_CSUM(64, 8, 2); break; + } + *state = s; +#else + memcrc_r(state, elems, num_elems * elem_size); +#endif +} + +uint32_t +memcrc_finish(uint32_t *state, off_t total_size) +{ + register uint32_t c, s = *state; + register uint64_t n = (uint64_t) total_size; + + /* Extend with the length of the string. */ + while (n != 0) + { + c = n & 0377; + n >>= 8; + s = (s << 8) ^ crctab[(s >> 24) ^ c]; + } + + return ~s; +} + +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifdef HAVE_CONFIG_H +#endif + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <ctype.h> +#include <stdarg.h> +#include <errno.h> + +#if !defined(HAVE_CONFIG_H) && !defined(HAVE_MALLOC_H) && defined(SX) +#define HAVE_MALLOC_H +#endif + +#if defined(HAVE_MALLOC_H) +#include <malloc.h> +#endif + + +enum +{ + MALLOC_FUNC = 0, + CALLOC_FUNC, + REALLOC_FUNC, + FREE_FUNC +}; +static const char *const memfunc[] = { "Malloc", "Calloc", "Realloc", "Free" }; + +#undef MEM_UNDEFID +#define MEM_UNDEFID -1 + +#define MEM_MAXNAME 32 /* Min = 8, for "unknown" ! */ + +static int dmemory_ExitOnError = 1; + +typedef struct +{ + void *ptr; + size_t size; + size_t nobj; + int item; + int mtype; + int line; + char filename[MEM_MAXNAME]; + char functionname[MEM_MAXNAME]; +} MemTable_t; + +static MemTable_t *memTable; +static size_t memTableSize = 0; +static long memAccess = 0; + +static size_t MemObjs = 0; +static size_t MaxMemObjs = 0; +static size_t MemUsed = 0; +static size_t MaxMemUsed = 0; + +static int MEM_Debug = 0; /* If set to 1, debugging */ +static int MEM_Info = 0; /* If set to 1, print mem table at exit */ + +static const char * +get_filename(const char *file) +{ + const char *fnptr = strrchr(file, '/'); + if (fnptr) + fnptr++; + else + fnptr = (char *) file; + + return fnptr; +} + +void +memDebug(int debug) +{ + MEM_Debug = debug; +} + +// If we're not using GNU C, elide __attribute__ +#if !defined __GNUC__ && !defined __attribute__ +#define __attribute__(x) /*NOTHING*/ +#endif + +static void memInternalProblem(const char *caller, const char *fmt, ...) __attribute__((noreturn)); + +static void memError(const char *caller, const char *file, int line, size_t size) __attribute__((noreturn)); + +static void +memInternalProblem(const char *caller, const char *fmt, ...) +{ + va_list args; + + va_start(args, fmt); + + printf("\n"); + fprintf(stderr, "Internal problem (%s) : ", caller); + vfprintf(stderr, fmt, args); + fprintf(stderr, "\n"); + + va_end(args); + + exit(EXIT_FAILURE); +} + +static void +memError(const char *caller, const char *file, int line, size_t size) +{ + fputs("\n", stdout); + fprintf(stderr, "Error (%s) : Allocation of %zu bytes failed. [ line %d file %s ]\n", caller, size, line, get_filename(file)); + + if (errno) perror("System error message "); + + exit(EXIT_FAILURE); +} + +static void +memListPrintEntry(int mtype, int item, size_t size, void *ptr, const char *caller, const char *file, int line) +{ + fprintf(stderr, "[%-7s ", memfunc[mtype]); + + fprintf(stderr, "memory item %3d ", item); + fprintf(stderr, "(%6zu byte) ", size); + fprintf(stderr, "at %p", ptr); + if (file != NULL) + { + fprintf(stderr, " line %4d", line); + fprintf(stderr, " file %s", get_filename(file)); + } + if (caller != NULL) fprintf(stderr, " (%s)", caller); + fprintf(stderr, "]\n"); +} + +static void +memListPrintTable(void) +{ + if (MemObjs) fprintf(stderr, "\nMemory table:\n"); + + for (size_t memID = 0; memID < memTableSize; memID++) + { + if (memTable[memID].item != MEM_UNDEFID) + memListPrintEntry(memTable[memID].mtype, memTable[memID].item, memTable[memID].size * memTable[memID].nobj, + memTable[memID].ptr, memTable[memID].functionname, memTable[memID].filename, memTable[memID].line); + } + + if (MemObjs) + { + fprintf(stderr, " Memory access : %6u\n", (unsigned) memAccess); + fprintf(stderr, " Maximum objects : %6zu\n", memTableSize); + fprintf(stderr, " Objects used : %6u\n", (unsigned) MaxMemObjs); + fprintf(stderr, " Objects in use : %6u\n", (unsigned) MemObjs); + fprintf(stderr, " Memory allocated : "); + if (MemUsed > 1024 * 1024 * 1024) + fprintf(stderr, " %5d GB\n", (int) (MemUsed / (1024 * 1024 * 1024))); + else if (MemUsed > 1024 * 1024) + fprintf(stderr, " %5d MB\n", (int) (MemUsed / (1024 * 1024))); + else if (MemUsed > 1024) + fprintf(stderr, " %5d KB\n", (int) (MemUsed / (1024))); + else + fprintf(stderr, " %5d Byte\n", (int) MemUsed); + } + + if (MaxMemUsed) + { + fprintf(stderr, " Maximum memory allocated : "); + if (MaxMemUsed > 1024 * 1024 * 1024) + fprintf(stderr, " %5d GB\n", (int) (MaxMemUsed / (1024 * 1024 * 1024))); + else if (MaxMemUsed > 1024 * 1024) + fprintf(stderr, " %5d MB\n", (int) (MaxMemUsed / (1024 * 1024))); + else if (MaxMemUsed > 1024) + fprintf(stderr, " %5d KB\n", (int) (MaxMemUsed / (1024))); + else + fprintf(stderr, " %5d Byte\n", (int) MaxMemUsed); + } +} + +static void +memGetDebugLevel(void) +{ + const char *envstr = getenv("MEMORY_INFO"); + if (envstr && isdigit((int) envstr[0])) MEM_Info = atoi(envstr); + + envstr = getenv("MEMORY_DEBUG"); + if (envstr && isdigit((int) envstr[0])) MEM_Debug = atoi(envstr); + + if (MEM_Debug && !MEM_Info) MEM_Info = 1; + + if (MEM_Info) atexit(memListPrintTable); +} + +static void +memInit(void) +{ + static int initDebugLevel = 0; + + if (!initDebugLevel) + { + memGetDebugLevel(); + initDebugLevel = 1; + } +} + +static int +memListDeleteEntry(void *ptr, size_t *size) +{ + int item = MEM_UNDEFID; + size_t memID = 0; + + for (memID = 0; memID < memTableSize; memID++) + { + if (memTable[memID].item == MEM_UNDEFID) continue; + if (memTable[memID].ptr == ptr) break; + } + + if (memID != memTableSize) + { + MemObjs--; + MemUsed -= memTable[memID].size * memTable[memID].nobj; + *size = memTable[memID].size * memTable[memID].nobj; + item = memTable[memID].item; + memTable[memID].item = MEM_UNDEFID; + } + + return item; +} + +static void +memTableInitEntry(size_t memID) +{ + if (memID >= memTableSize) memInternalProblem(__func__, "memID %d undefined!", memID); + + memTable[memID].ptr = NULL; + memTable[memID].item = MEM_UNDEFID; + memTable[memID].size = 0; + memTable[memID].nobj = 0; + memTable[memID].mtype = MEM_UNDEFID; + memTable[memID].line = MEM_UNDEFID; +} + +static void +set_filename(const char *file, char *memEntyFilename) +{ + if (file) + { + const char *filename = get_filename(file); + size_t len = strlen(filename); + if (len > MEM_MAXNAME - 1) len = MEM_MAXNAME - 1; + + (void) memcpy(memEntyFilename, filename, len); + memEntyFilename[len] = '\0'; + } + else + { + (void) strcpy(memEntyFilename, "unknown"); + } +} + +static void +set_functionname(const char *functionname, char *memEntyFunctionname) +{ + if (functionname) + { + size_t len = strlen(functionname); + if (len > MEM_MAXNAME - 1) len = MEM_MAXNAME - 1; + + (void) memcpy(memEntyFunctionname, functionname, len); + memEntyFunctionname[len] = '\0'; + } + else + { + (void) strcpy(memEntyFunctionname, "unknown"); + } +} + +static int +memListNewEntry(int mtype, void *ptr, size_t size, size_t nobj, const char *functionname, const char *file, int line) +{ + static int item = 0; + size_t memID = 0; + + // Look for a free slot in memTable (Create the table the first time through). + if (memTableSize == 0) + { + memTableSize = 8; + size_t memSize = memTableSize * sizeof(MemTable_t); + memTable = (MemTable_t *) malloc(memSize); + if (memTable == NULL) memError(__func__, __FILE__, __LINE__, memSize); + + for (size_t i = 0; i < memTableSize; i++) memTableInitEntry(i); + } + else + { + while (memID < memTableSize) + { + if (memTable[memID].item == MEM_UNDEFID) break; + memID++; + } + } + + // If the table overflows, double its size. + if (memID == memTableSize) + { + memTableSize = 2 * memTableSize; + size_t memSize = memTableSize * sizeof(MemTable_t); + memTable = (MemTable_t *) realloc(memTable, memSize); + if (memTable == NULL) memError(__func__, __FILE__, __LINE__, memSize); + + for (size_t i = memID; i < memTableSize; i++) memTableInitEntry(i); + } + + memTable[memID].item = item; + memTable[memID].ptr = ptr; + memTable[memID].size = size; + memTable[memID].nobj = nobj; + memTable[memID].mtype = mtype; + memTable[memID].line = line; + + set_filename(file, memTable[memID].filename); + set_functionname(functionname, memTable[memID].functionname); + + MaxMemObjs++; + MemObjs++; + MemUsed += size * nobj; + if (MemUsed > MaxMemUsed) MaxMemUsed = MemUsed; + + return item++; +} + +static int +memListChangeEntry(void *ptrold, void *ptr, size_t size, const char *functionname, const char *file, int line) +{ + int item = MEM_UNDEFID; + size_t memID = 0; + + while (memID < memTableSize) + { + if (memTable[memID].item != MEM_UNDEFID && memTable[memID].ptr == ptrold) break; + memID++; + } + + if (memID == memTableSize) + { + if (ptrold != NULL) memInternalProblem(__func__, "Item at %p not found.", ptrold); + } + else + { + item = memTable[memID].item; + + const size_t sizeold = memTable[memID].size * memTable[memID].nobj; + + memTable[memID].ptr = ptr; + memTable[memID].size = size; + memTable[memID].nobj = 1; + memTable[memID].mtype = REALLOC_FUNC; + memTable[memID].line = line; + + set_filename(file, memTable[memID].filename); + set_functionname(functionname, memTable[memID].functionname); + + MemUsed -= sizeold; + MemUsed += size; + if (MemUsed > MaxMemUsed) MaxMemUsed = MemUsed; + } + + return item; +} + +void * +memCalloc(size_t nobjs, size_t size, const char *file, const char *functionname, int line) +{ + void *ptr = NULL; + + memInit(); + + if (nobjs * size > 0) + { + ptr = calloc(nobjs, size); + + if (MEM_Info) + { + memAccess++; + + int item = MEM_UNDEFID; + if (ptr) item = memListNewEntry(CALLOC_FUNC, ptr, size, nobjs, functionname, file, line); + + if (MEM_Debug) memListPrintEntry(CALLOC_FUNC, item, size * nobjs, ptr, functionname, file, line); + } + + if (ptr == NULL && dmemory_ExitOnError) memError(functionname, file, line, size * nobjs); + } + else + fprintf(stderr, "Warning (%s) : Allocation of 0 bytes! [ line %d file %s ]\n", functionname, line, file); + + return ptr; +} + +void * +memMalloc(size_t size, const char *file, const char *functionname, int line) +{ + void *ptr = NULL; + + memInit(); + + if (size > 0) + { + ptr = malloc(size); + + if (MEM_Info) + { + memAccess++; + + int item = MEM_UNDEFID; + if (ptr) item = memListNewEntry(MALLOC_FUNC, ptr, size, 1, functionname, file, line); + + if (MEM_Debug) memListPrintEntry(MALLOC_FUNC, item, size, ptr, functionname, file, line); + } + + if (ptr == NULL && dmemory_ExitOnError) memError(functionname, file, line, size); + } + else + fprintf(stderr, "Warning (%s) : Allocation of 0 bytes! [ line %d file %s ]\n", functionname, line, file); + + return ptr; +} + +void * +memRealloc(void *ptrold, size_t size, const char *file, const char *functionname, int line) +{ + void *ptr = NULL; + + memInit(); + + if (size > 0) + { + ptr = realloc(ptrold, size); + + if (MEM_Info) + { + memAccess++; + + int item = MEM_UNDEFID; + if (ptr) + { + item = memListChangeEntry(ptrold, ptr, size, functionname, file, line); + if (item == MEM_UNDEFID) item = memListNewEntry(REALLOC_FUNC, ptr, size, 1, functionname, file, line); + } + + if (MEM_Debug) memListPrintEntry(REALLOC_FUNC, item, size, ptr, functionname, file, line); + } + + if (ptr == NULL && dmemory_ExitOnError) memError(functionname, file, line, size); + } + else + fprintf(stderr, "Warning (%s) : Allocation of 0 bytes! [ line %d file %s ]\n", functionname, line, get_filename(file)); + + return ptr; +} + +void +memFree(void *ptr, const char *file, const char *functionname, int line) +{ + memInit(); + + if (MEM_Info) + { + size_t size = 0; + const int item = memListDeleteEntry(ptr, &size); + if (item >= 0) + { + if (MEM_Debug) memListPrintEntry(FREE_FUNC, item, size, ptr, functionname, file, line); + } + else + { + if (ptr && MEM_Debug) + fprintf(stderr, "%s info: memory entry at %p not found. [line %4d file %s (%s)]\n", __func__, ptr, line, + get_filename(file), functionname); + } + } + + free(ptr); +} + +size_t +memTotal(void) +{ + size_t memtotal = 0; +#ifdef HAVE_MALLINFO + struct mallinfo meminfo = mallinfo(); + if (MEM_Debug) + { + fprintf(stderr, "arena %8zu (non-mmapped space allocated from system)\n", (size_t) meminfo.arena); + fprintf(stderr, "ordblks %8zu (number of free chunks)\n", (size_t) meminfo.ordblks); + fprintf(stderr, "smblks %8zu (number of fastbin blocks)\n", (size_t) meminfo.smblks); + fprintf(stderr, "hblks %8zu (number of mmapped regions)\n", (size_t) meminfo.hblks); + fprintf(stderr, "hblkhd %8zu (space in mmapped regions)\n", (size_t) meminfo.hblkhd); + fprintf(stderr, "usmblks %8zu (maximum total allocated space)\n", (size_t) meminfo.usmblks); + fprintf(stderr, "fsmblks %8zu (maximum total allocated space)\n", (size_t) meminfo.fsmblks); + fprintf(stderr, "uordblks %8zu (total allocated space)\n", (size_t) meminfo.uordblks); + fprintf(stderr, "fordblks %8zu (total free space)\n", (size_t) meminfo.fordblks); + fprintf(stderr, "Memory in use: %8zu bytes\n", (size_t) meminfo.usmblks + (size_t) meminfo.uordblks); + fprintf(stderr, "Total heap size: %8zu bytes\n", (size_t) meminfo.arena); + + // malloc_stats(); + } + memtotal = (size_t) meminfo.arena; +#endif + + return memtotal; +} + +void +memExitOnError(void) +{ + dmemory_ExitOnError = 1; +} +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifdef HAVE_CONFIG_H +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <stdarg.h> +#include <errno.h> + +#if !defined(NAMESPACE_H) +#endif + +int _ExitOnError = 1; // If set to 1, exit on error +int _Verbose = 1; // If set to 1, errors are reported +int _Debug = 0; // If set to 1, debugging + +/* If we're not using GNU C, elide __attribute__ */ +#if !defined __GNUC__ && !defined __attribute__ +#define __attribute__(x) /*NOTHING*/ +#endif + +void SysError_(const char *caller, const char *fmt, ...) __attribute__((noreturn)); + +void +SysError_(const char *caller, const char *fmt, ...) +{ + va_list args; + int saved_errno = errno; + + va_start(args, fmt); + + printf("\n"); + fprintf(stderr, "%s error (%s): ", PACKAGE_NAME, caller); + vfprintf(stderr, fmt, args); + fprintf(stderr, "\n"); + + va_end(args); + + if (saved_errno) + { + errno = saved_errno; + perror("System error message"); + } + + exit(EXIT_FAILURE); +} + +void +Error_(const char *caller, const char *fmt, ...) +{ + va_list args; + + va_start(args, fmt); + + printf("\n"); + fprintf(stderr, "%s error (%s): ", PACKAGE_NAME, caller); + vfprintf(stderr, fmt, args); + fprintf(stderr, "\n"); + + va_end(args); + + if (_ExitOnError) exit(EXIT_FAILURE); +} + +typedef void (*cdiAbortCFunc)(const char *caller, const char *filename, const char *functionname, int line, const char *errorString, + va_list ap) +#ifdef __GNUC__ + __attribute__((noreturn)) +#endif + ; + +void +cdiAbortC(const char *caller, const char *filename, const char *functionname, int line, const char *errorString, ...) +{ + va_list ap; + va_start(ap, errorString); + cdiAbortCFunc cdiAbortC_p = (cdiAbortCFunc) namespaceSwitchGet(NSSWITCH_ABORT).func; + cdiAbortC_p(caller, filename, functionname, line, errorString, ap); + va_end(ap); +} + +void +cdiAbortC_serial(const char *caller, const char *filename, const char *functionname, int line, const char *errorString, va_list ap) +{ + fprintf(stderr, "%s error, %s, %s, line %d%s%s\nerrorString: \"", PACKAGE_NAME, functionname, filename, line, + caller ? ", called from " : "", caller ? caller : ""); + vfprintf(stderr, errorString, ap); + fputs("\"\n", stderr); + exit(EXIT_FAILURE); +} + +typedef void (*cdiWarningFunc)(const char *caller, const char *fmt, va_list ap); + +void +Warning_(const char *caller, const char *fmt, ...) +{ + va_list args; + + va_start(args, fmt); + + if (_Verbose) + { + cdiWarningFunc cdiWarning_p = (cdiWarningFunc) namespaceSwitchGet(NSSWITCH_WARNING).func; + cdiWarning_p(caller, fmt, args); + } + + va_end(args); +} + +void +cdiWarning(const char *caller, const char *fmt, va_list ap) +{ + fprintf(stderr, "%s warning (%s): ", PACKAGE_NAME, caller); + vfprintf(stderr, fmt, ap); + fputc('\n', stderr); +} + +void +Message_(const char *caller, const char *fmt, ...) +{ + va_list args; + + va_start(args, fmt); + + fprintf(stdout, "%s %-18s: ", PACKAGE_NAME, caller); + vfprintf(stdout, fmt, args); + fprintf(stdout, "\n"); + + va_end(args); +} + +bool +cdiObsoleteInfo(const char *oldFunction, const char *newFunction) +{ + fprintf(stdout, "cdi info: Function %s() is deprecated and might be removed in the future versions of CDI.\n", oldFunction); + fprintf(stdout, "cdi info: Consider switching to the new function %s() as soon as possible.\n", newFunction); + return false; +} + +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifndef EXSE_H +#define EXSE_H + +enum +{ + EXSE_SINGLE_PRECISION = 4, + EXSE_DOUBLE_PRECISION = 8, +}; + +#endif +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <ctype.h> + + +enum +{ + EXT_HEADER_LEN = 4, +}; + +union EXT_HEADER +{ + INT32 i32[EXT_HEADER_LEN]; + INT64 i64[EXT_HEADER_LEN]; +}; + +static int initExtLib = 0; +static int extDefaultPrec = 0; +static int extDefaultNumber = EXT_REAL; + +// A version string. +#undef LIBVERSION +#define LIBVERSION 1.5.0 +#define XSTRING(x) #x +#define STRING(x) XSTRING(x) +static const char ext_libvers[] = STRING(LIBVERSION); + +const char * +extLibraryVersion(void) +{ + return ext_libvers; +} + +static int EXT_Debug = 0; // If set to 1, debugging + +void +extDebug(int debug) +{ + if (debug) Message("debug level %d", debug); + EXT_Debug = debug; +} + +static void +extLibInit() +{ + const char *envName = "EXT_PRECISION"; + + char *envString = getenv(envName); + if (envString) + { + if (strlen(envString) == 2) + { + switch (tolower((int) envString[0])) + { + case 'r': + { + extDefaultNumber = EXT_REAL; + switch ((int) envString[1]) + { + case '4': extDefaultPrec = EXSE_SINGLE_PRECISION; break; + case '8': extDefaultPrec = EXSE_DOUBLE_PRECISION; break; + default: Warning("Invalid digit in %s: %s", envName, envString); + } + break; + } + case 'c': + { + extDefaultNumber = EXT_COMP; + switch ((int) envString[1]) + { + case '4': extDefaultPrec = EXSE_SINGLE_PRECISION; break; + case '8': extDefaultPrec = EXSE_DOUBLE_PRECISION; break; + default: Warning("Invalid digit in %s: %s", envName, envString); + } + break; + } + default: + { + Warning("Invalid character in %s: %s", envName, envString); + break; + } + } + } + } + + initExtLib = 1; +} + +static void +extInit(extrec_t *extp) +{ + extp->checked = 0; + extp->byteswap = 0; + extp->prec = 0; + extp->number = extDefaultNumber; + extp->datasize = 0; + extp->buffersize = 0; + extp->buffer = NULL; +} + +void * +extNew(void) +{ + if (!initExtLib) extLibInit(); + + extrec_t *extp = (extrec_t *) Malloc(sizeof(extrec_t)); + + extInit(extp); + + return (void *) extp; +} + +void +extDelete(void *ext) +{ + extrec_t *extp = (extrec_t *) ext; + + if (extp) + { + if (extp->buffer) Free(extp->buffer); + Free(extp); + } +} + +int +extCheckFiletype(int fileID, int *swap) +{ + size_t fact = 0; + size_t data = 0; + size_t dimxy = 0; + unsigned char buffer[40], *pbuf; + + if (fileRead(fileID, buffer, 4) != 4) return 0; + + size_t blocklen = (size_t) get_UINT32(buffer); + size_t sblocklen = (size_t) get_SUINT32(buffer); + + if (EXT_Debug) Message("blocklen = %d sblocklen = %d", blocklen, sblocklen); + + // clang-format off + if (blocklen == 16) + { + *swap = 0; + fact = blocklen/4; + if (fileRead(fileID, buffer, blocklen+8) != blocklen+8) return 0; + pbuf = buffer+3*fact; dimxy = (size_t) get_UINT32(pbuf); + pbuf = buffer+blocklen+4; data = (size_t) get_UINT32(pbuf); + } + else if (blocklen == 32) + { + *swap = 0; + fact = blocklen/4; + if (fileRead(fileID, buffer, blocklen+8) != blocklen+8) return 0; + pbuf = buffer+3*fact; dimxy = (size_t) get_UINT64(pbuf); + pbuf = buffer+blocklen+4; data = (size_t) get_UINT32(pbuf); + } + else if (sblocklen == 16) + { + *swap = 1; + fact = sblocklen/4; + if (fileRead(fileID, buffer, sblocklen+8) != sblocklen+8) return 0; + pbuf = buffer+3*fact; dimxy = (size_t) get_SUINT32(pbuf); + pbuf = buffer+sblocklen+4; data = (size_t) get_SUINT32(pbuf); + } + else if (sblocklen == 32) + { + *swap = 1; + fact = sblocklen/4; + if (fileRead(fileID, buffer, sblocklen+8) != sblocklen+8) return 0; + pbuf = buffer+3*fact; dimxy = (size_t) get_SUINT64(pbuf); + pbuf = buffer+sblocklen+4; data = (size_t) get_SUINT32(pbuf); + } + // clang-format on + + fileRewind(fileID); + + if (EXT_Debug) Message("swap = %d fact = %d", *swap, fact); + if (EXT_Debug) Message("dimxy = %lu data = %lu", dimxy, data); + + int found = data && (dimxy * fact == data || dimxy * fact * 2 == data); + return found; +} + +int +extInqHeader(void *ext, int *header) +{ + extrec_t *extp = (extrec_t *) ext; + + for (int i = 0; i < EXT_HEADER_LEN; i++) header[i] = extp->header[i]; + + if (EXT_Debug) Message("datasize = %zu", extp->datasize); + + return 0; +} + +int +extDefHeader(void *ext, const int *header) +{ + extrec_t *extp = (extrec_t *) ext; + + for (int i = 0; i < EXT_HEADER_LEN; i++) extp->header[i] = header[i]; + + extp->datasize = (size_t) header[3]; + if (extp->number == EXT_COMP) extp->datasize *= 2; + + if (EXT_Debug) Message("datasize = %zu", extp->datasize); + + return 0; +} + +static int +extInqData(extrec_t *extp, int prec, void *data) +{ + int ierr = 0; + int byteswap = extp->byteswap; + size_t datasize = extp->datasize; + void *buffer = extp->buffer; + int rprec = extp->prec; + + switch (rprec) + { + case EXSE_SINGLE_PRECISION: + { + if (sizeof(FLT32) == 4) + { + if (byteswap) swap4byte(buffer, datasize); + + if (rprec == prec) + memcpy(data, buffer, datasize * sizeof(FLT32)); + else + for (size_t i = 0; i < datasize; ++i) ((double *) data)[i] = (double) ((float *) buffer)[i]; + } + else + { + Error("not implemented for %d byte float", sizeof(FLT32)); + } + break; + } + case EXSE_DOUBLE_PRECISION: + if (sizeof(FLT64) == 8) + { + if (byteswap) swap8byte(buffer, datasize); + + if (rprec == prec) + memcpy(data, buffer, datasize * sizeof(FLT64)); + else + for (size_t i = 0; i < datasize; ++i) ((float *) data)[i] = (float) ((double *) buffer)[i]; + } + else + { + Error("not implemented for %d byte float", sizeof(FLT64)); + } + break; + default: + { + Error("unexpected data precision %d", rprec); + break; + } + } + + return ierr; +} + +int +extInqDataSP(void *ext, float *data) +{ + return extInqData((extrec_t *) ext, EXSE_SINGLE_PRECISION, (void *) data); +} + +int +extInqDataDP(void *ext, double *data) +{ + return extInqData((extrec_t *) ext, EXSE_DOUBLE_PRECISION, (void *) data); +} + +static int +extDefData(void *ext, int prec, const void *data) +{ + extrec_t *extp = (extrec_t *) ext; + + int rprec = extDefaultPrec ? extDefaultPrec : extp->prec; + extp->prec = rprec ? rprec : prec; + + int *header = extp->header; + + size_t datasize = (size_t) header[3]; + if (extp->number == EXT_COMP) datasize *= 2; + size_t blocklen = datasize * (size_t) rprec; + + extp->datasize = datasize; + + if (extp->buffersize != blocklen) + { + extp->buffersize = blocklen; + extp->buffer = Realloc(extp->buffer, extp->buffersize); + } + + switch (rprec) + { + case EXSE_SINGLE_PRECISION: + { + if (rprec == prec) + memcpy(extp->buffer, data, datasize * sizeof(FLT32)); + else + for (size_t i = 0; i < datasize; i++) ((float *) extp->buffer)[i] = (float) ((double *) data)[i]; + + break; + } + case EXSE_DOUBLE_PRECISION: + { + if (rprec == prec) + memcpy(extp->buffer, data, datasize * sizeof(FLT64)); + else + for (size_t i = 0; i < datasize; i++) ((double *) extp->buffer)[i] = (double) ((float *) data)[i]; + + break; + } + default: + { + Error("unexpected data precision %d", rprec); + break; + } + } + + return 0; +} + +int +extDefDataSP(void *ext, const float *data) +{ + return extDefData(ext, EXSE_SINGLE_PRECISION, (void *) data); +} + +int +extDefDataDP(void *ext, const double *data) +{ + return extDefData(ext, EXSE_DOUBLE_PRECISION, (void *) data); +} + +int +extRead(int fileID, void *ext) +{ + extrec_t *extp = (extrec_t *) ext; + + if (!extp->checked) + { + int status = extCheckFiletype(fileID, &extp->byteswap); + if (status == 0) Error("Not a EXTRA file!"); + extp->checked = 1; + } + + int byteswap = extp->byteswap; + + // read header record + size_t blocklen = binReadF77Block(fileID, byteswap); + + if (fileEOF(fileID)) return -1; + + if (EXT_Debug) Message("blocklen = %lu", blocklen); + + size_t hprec = blocklen / EXT_HEADER_LEN; + + extp->prec = (int) hprec; + + union EXT_HEADER tempheader; + switch (hprec) + { + case EXSE_SINGLE_PRECISION: + { + binReadInt32(fileID, byteswap, EXT_HEADER_LEN, tempheader.i32); + for (int i = 0; i < EXT_HEADER_LEN; i++) extp->header[i] = (int) tempheader.i32[i]; + break; + } + case EXSE_DOUBLE_PRECISION: + { + binReadInt64(fileID, byteswap, EXT_HEADER_LEN, tempheader.i64); + for (int i = 0; i < EXT_HEADER_LEN; i++) extp->header[i] = (int) tempheader.i64[i]; + break; + } + default: + { + Error("Unexpected header precision %d", hprec); + break; + } + } + + size_t blocklen2 = binReadF77Block(fileID, byteswap); + + if (blocklen2 != blocklen) + { + Warning("Header blocklen differ (blocklen1=%d; blocklen2=%d)!", blocklen, blocklen2); + if (blocklen2 != 0) return -1; + } + + extp->datasize = (size_t) extp->header[3]; + + if (EXT_Debug) Message("datasize = %zu", extp->datasize); + + blocklen = binReadF77Block(fileID, byteswap); + + if (extp->buffersize < blocklen) + { + extp->buffersize = blocklen; + extp->buffer = Realloc(extp->buffer, extp->buffersize); + } + + size_t dprec = blocklen / extp->datasize; + + if (dprec == hprec) + { + extp->number = EXT_REAL; + } + else if (dprec == 2 * hprec) + { + dprec /= 2; + extp->datasize *= 2; + extp->number = EXT_COMP; + } + + if (dprec != EXSE_SINGLE_PRECISION && dprec != EXSE_DOUBLE_PRECISION) + { + Warning("Unexpected data precision %d", dprec); + return -1; + } + + fileRead(fileID, extp->buffer, blocklen); + + blocklen2 = binReadF77Block(fileID, byteswap); + + if (blocklen2 != blocklen) + { + Warning("Data blocklen differ (blocklen1=%d; blocklen2=%d)!", blocklen, blocklen2); + if (blocklen2 != 0) return -1; + } + + return 0; +} + +int +extWrite(int fileID, void *ext) +{ + extrec_t *extp = (extrec_t *) ext; + union EXT_HEADER tempheader; + int byteswap = extp->byteswap; + int rprec = extp->prec; + int number = extp->number; + int *header = extp->header; + + // write header record + size_t blocklen = EXT_HEADER_LEN * (size_t) rprec; + + binWriteF77Block(fileID, byteswap, blocklen); + + switch (rprec) + { + case EXSE_SINGLE_PRECISION: + { + for (int i = 0; i < EXT_HEADER_LEN; i++) tempheader.i32[i] = (INT32) header[i]; + binWriteInt32(fileID, byteswap, EXT_HEADER_LEN, tempheader.i32); + break; + } + case EXSE_DOUBLE_PRECISION: + { + for (int i = 0; i < EXT_HEADER_LEN; i++) tempheader.i64[i] = (INT64) header[i]; + binWriteInt64(fileID, byteswap, EXT_HEADER_LEN, tempheader.i64); + break; + } + default: + { + Error("unexpected header precision %d", rprec); + break; + } + } + + binWriteF77Block(fileID, byteswap, blocklen); + + extp->datasize = (size_t) header[3]; + if (number == EXT_COMP) extp->datasize *= 2; + blocklen = extp->datasize * (size_t) rprec; + + binWriteF77Block(fileID, byteswap, blocklen); + + switch (rprec) + { + case EXSE_SINGLE_PRECISION: + { + binWriteFlt32(fileID, byteswap, extp->datasize, (FLT32 *) extp->buffer); + break; + } + case EXSE_DOUBLE_PRECISION: + { + binWriteFlt64(fileID, byteswap, extp->datasize, (FLT64 *) extp->buffer); + break; + } + default: + { + Error("unexpected data precision %d", rprec); + break; + } + } + + binWriteF77Block(fileID, byteswap, blocklen); + + return 0; +} +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifdef HAVE_CONFIG_H +#endif + +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif + +#include <assert.h> +#include <ctype.h> +#include <errno.h> +#include <fcntl.h> +#include <limits.h> +#include <stdio.h> +#include <stdlib.h> +#include <stdbool.h> +#include <string.h> +#include <sys/types.h> +#include <sys/stat.h> + +#ifdef HAVE_SYS_TIME_H +#include <sys/time.h> // gettimeofday() +#endif + + +#ifdef CDI +#endif + +#ifndef O_BINARY +#define O_BINARY 0 +#endif + +#ifndef strdup +char *strdup(const char *s); +#endif + +#ifdef HAVE_MMAP +#include <sys/mman.h> // mmap() is defined in this header +#endif + +#define MAX_FILES 8192 +static int _file_max = MAX_FILES; + +static void file_initialize(void); + +static bool _file_init = false; + +#ifdef HAVE_LIBPTHREAD +#include <pthread.h> + +static pthread_once_t _file_init_thread = PTHREAD_ONCE_INIT; +static pthread_mutex_t _file_mutex; + +#define FILE_LOCK() pthread_mutex_lock(&_file_mutex) +#define FILE_UNLOCK() pthread_mutex_unlock(&_file_mutex) +#define FILE_INIT() \ + if (_file_init == false) pthread_once(&_file_init_thread, file_initialize) + +#else + +#define FILE_LOCK() +#define FILE_UNLOCK() +#define FILE_INIT() \ + if (_file_init == false) file_initialize() +#endif + +typedef struct +{ + int self; + int flag; // access and error flag + int eof; // end of file flag + int fd; // file descriptor used for read + FILE *fp; // FILE pointer used for write + char *name; // file name + off_t size; // file size + off_t position; // file position + long access; // file access + off_t byteTrans; // + size_t blockSize; // file block size + int mode; // file access mode + int type; // file type [1:open 2:fopen] + int bufferType; // buffer type [1:std 2:mmap] + size_t bufferSize; // file buffer size + size_t mappedSize; // mmap buffer size + char *buffer; // file buffer + long bufferNumFill; // number of buffer fill + char *bufferPtr; // file buffer pointer + off_t bufferPos; + off_t bufferStart; + off_t bufferEnd; + size_t bufferCnt; + double time_in_sec; +} bfile_t; + +enum FILE_Flags +{ + FILE_EOF = 010, + FILE_ERROR = 020 +}; + +#ifndef MIN_BUF_SIZE +#define MIN_BUF_SIZE 131072L +#endif + +static const char *fbtname[] = { "unknown", "standard", "mmap" }; +static const char *ftname[] = { "unknown", "open", "fopen" }; + +static size_t FileBufferSizeMin = MIN_BUF_SIZE; +static long FileBufferSizeEnv = -1; +static int FileBufferTypeEnv = 0; + +static int FileTypeRead = FILE_TYPE_OPEN; +static int FileTypeWrite = FILE_TYPE_FOPEN; +static int FileFlagWrite = 0; + +static int FileDebug = 0; // If set to 1, debugging +static bool FileInfo = false; + +static void file_table_print(void); + +// A version string. +#undef LIBVERSION +#define LIBVERSION 1.9.1 +#define XSTRING(x) #x +#define STRING(x) XSTRING(x) +static const char file_libvers[] = STRING(LIBVERSION); + +/* + 21/05/2004 1.3.2 set min I/O Buffersize to 128k + 31/05/2005 1.4.0 replace fileTable by _fileList + 26/08/2005 1.4.1 fileClose with return value + checks for all fileptr + 01/09/2005 1.5.0 thread safe version + 06/11/2005 1.5.1 add filePtrEOF, filePtr, filePtrGetc + 03/02/2006 1.5.2 ansi C: define getpagesize and strdupx + 27/12/2007 1.6.0 add FILE_TYPE_FOPEN + 24/03/2008 1.6.1 add O_BINARY if available + remove default HAVE_MMAP + use HAVE_STRUCT_STAT_ST_BLKSIZE + 22/08/2010 1.7.0 refactor + 11/11/2010 1.7.1 update for changed interface of error.h + 02/02/2012 1.8.0 cleanup + 16/11/2012 1.8.1 added support for unbuffered write + 27/06/2013 1.8.2 added env. var. FILE_TYPE_WRITE (1:open; 2:fopen) + 29/04/2020 1.9.0 fileSetPos(): refactored + 30/04/2020 1.9.1 fileSetPos(): not initialized correctly (bug fix) + */ + +typedef struct _filePtrToIdx +{ + int idx; + bfile_t *ptr; + struct _filePtrToIdx *next; +} filePtrToIdx; + +static filePtrToIdx *_fileList = NULL; +static filePtrToIdx *_fileAvail = NULL; + +static void +file_list_new(void) +{ + assert(_fileList == NULL); + + _fileList = (filePtrToIdx *) malloc((size_t) _file_max * sizeof(filePtrToIdx)); +} + +static void +file_list_delete(void) +{ + if (_fileList) + { + free(_fileList); + _fileList = NULL; + } +} + +static void +file_init_pointer(void) +{ + for (int i = 0; i < _file_max; i++) + { + _fileList[i].next = _fileList + i + 1; + _fileList[i].idx = i; + _fileList[i].ptr = 0; + } + + _fileList[_file_max - 1].next = 0; + + _fileAvail = _fileList; +} + +static bfile_t * +file_to_pointer(int idx) +{ + bfile_t *fileptr = NULL; + + FILE_INIT(); + + if (idx >= 0 && idx < _file_max) + { + FILE_LOCK(); + fileptr = _fileList[idx].ptr; + FILE_UNLOCK(); + } + else + Error("file index %d undefined!", idx); + + return fileptr; +} + +// Create an index from a pointer +static int +file_from_pointer(bfile_t *ptr) +{ + int idx = -1; + + if (ptr) + { + FILE_LOCK(); + + if (_fileAvail) + { + filePtrToIdx *newptr = _fileAvail; + _fileAvail = _fileAvail->next; + newptr->next = 0; + idx = newptr->idx; + newptr->ptr = ptr; + + if (FileDebug) Message("Pointer %p has idx %d from file list", ptr, idx); + } + else + { + Warning("Too many open files (limit is %d)!", _file_max); + idx = -2; + } + + FILE_UNLOCK(); + } + else + Error("Internal problem (pointer %p undefined)", ptr); + + return idx; +} + +static void +file_init_entry(bfile_t *fileptr) +{ + fileptr->self = file_from_pointer(fileptr); + + fileptr->flag = 0; + fileptr->fd = -1; + fileptr->fp = NULL; + fileptr->mode = 0; + fileptr->size = 0; + fileptr->name = NULL; + fileptr->access = 0; + fileptr->position = 0; + fileptr->byteTrans = 0; + fileptr->type = 0; + fileptr->bufferType = 0; + fileptr->bufferSize = 0; + fileptr->mappedSize = 0; + fileptr->buffer = NULL; + fileptr->bufferNumFill = 0; + fileptr->bufferStart = 0; + fileptr->bufferEnd = -1; + fileptr->bufferPos = 0; + fileptr->bufferCnt = 0; + fileptr->bufferPtr = NULL; + fileptr->time_in_sec = 0.0; +} + +static bfile_t * +file_new_entry(void) +{ + bfile_t *fileptr = (bfile_t *) malloc(sizeof(bfile_t)); + if (fileptr) file_init_entry(fileptr); + return fileptr; +} + +static void +file_delete_entry(bfile_t *fileptr) +{ + int idx = fileptr->self; + + FILE_LOCK(); + + free(fileptr); + + _fileList[idx].next = _fileAvail; + _fileList[idx].ptr = 0; + _fileAvail = &_fileList[idx]; + + FILE_UNLOCK(); + + if (FileDebug) Message("Removed idx %d from file list", idx); +} + +const char * +fileLibraryVersion(void) +{ + return file_libvers; +} + +static int +file_pagesize(void) +{ +#ifdef _SC_PAGESIZE + return (int) sysconf(_SC_PAGESIZE); +#else +#ifndef POSIXIO_DEFAULT_PAGESIZE +#define POSIXIO_DEFAULT_PAGESIZE 4096 +#endif + return (int) POSIXIO_DEFAULT_PAGESIZE; +#endif +} + +static double +file_time() +{ +#ifdef HAVE_SYS_TIME_H + struct timeval mytime; + gettimeofday(&mytime, NULL); + return (double) mytime.tv_sec + (double) mytime.tv_usec * 1.0e-6; +#else + return 0; +#endif +} + +void +fileDebug(int debug) +{ + FileDebug = debug; + if (FileDebug) Message("Debug level %d", debug); +} + +void * +filePtr(int fileID) +{ + return (void *) file_to_pointer(fileID); +} + +static void +file_pointer_info(const char *caller, int fileID) +{ + if (FileDebug) + { + fprintf(stdout, "%-18s : ", caller); + fprintf(stdout, "The fileID %d underlying pointer is not valid!", fileID); + fprintf(stdout, "\n"); + } +} + +int +fileSetBufferType(int fileID, int type) +{ + int ret = 0; + + bfile_t *fileptr = file_to_pointer(fileID); + if (fileptr) + { + switch (type) + { + case FILE_BUFTYPE_STD: + case FILE_BUFTYPE_MMAP: fileptr->bufferType = type; break; + default: Error("File type %d not implemented!", type); + } + } + +#ifndef HAVE_MMAP + if (type == FILE_BUFTYPE_MMAP) ret = 1; +#endif + + return ret; +} + +int +fileFlush(int fileID) +{ + int retval = 0; + bfile_t *fileptr = file_to_pointer(fileID); + if (fileptr) + { + FILE *fp = fileptr->fp; + retval = fflush(fp); + if (retval == 0) retval = fsync(fileno(fp)); + if (retval != 0) retval = errno; + } + + return retval; +} + +void +fileClearerr(int fileID) +{ + bfile_t *fileptr = file_to_pointer(fileID); + if (fileptr) + { + if (fileptr->mode != 'r') clearerr(fileptr->fp); + } +} + +int +filePtrEOF(void *vfileptr) +{ + bfile_t *fileptr = (bfile_t *) vfileptr; + return fileptr ? (fileptr->flag & FILE_EOF) != 0 : 0; +} + +int +fileEOF(int fileID) +{ + bfile_t *fileptr = file_to_pointer(fileID); + return fileptr ? (fileptr->flag & FILE_EOF) != 0 : 0; +} + +void +fileRewind(int fileID) +{ + fileSetPos(fileID, (off_t) 0, SEEK_SET); + fileClearerr(fileID); +} + +off_t +fileGetPos(int fileID) +{ + off_t filepos = 0; + + bfile_t *fileptr = file_to_pointer(fileID); + if (fileptr) + { + if (fileptr->mode == 'r' && fileptr->type == FILE_TYPE_OPEN) + filepos = fileptr->position; + else + filepos = ftell(fileptr->fp); + } + + if (FileDebug) Message("Position %ld", filepos); + + return filepos; +} + +static int +file_set_buffer_pos(bfile_t *fileptr) +{ + off_t position = fileptr->position; + if (position < fileptr->bufferStart || position > fileptr->bufferEnd) + { + if (fileptr->bufferType == FILE_BUFTYPE_STD) + fileptr->bufferPos = position; + else + fileptr->bufferPos = position - position % file_pagesize(); + + fileptr->bufferCnt = 0; + fileptr->bufferPtr = NULL; + + return 1; + } + + return 0; +} + +static void +file_check_buffer_pos(bfile_t *fileptr) +{ + if (fileptr->bufferPos != fileptr->bufferEnd + 1) + { + if (FileDebug) Message("Reset buffer pos from %ld to %ld", fileptr->bufferPos, fileptr->bufferEnd + 1); + + fileptr->bufferPos = fileptr->bufferEnd + 1; + } +} + +static void +file_seek_buffer(bfile_t *fileptr, off_t offset, int whence) +{ + if (whence == SEEK_SET) + { + fileptr->position = offset; + if (!file_set_buffer_pos(fileptr)) + { + file_check_buffer_pos(fileptr); + fileptr->bufferCnt = (size_t) (fileptr->bufferEnd - fileptr->position) + 1; + fileptr->bufferPtr = fileptr->buffer + fileptr->position - fileptr->bufferStart; + } + } + else if (whence == SEEK_CUR) + { + fileptr->position += offset; + if (!file_set_buffer_pos(fileptr)) + { + file_check_buffer_pos(fileptr); + fileptr->bufferCnt -= (size_t) offset; + fileptr->bufferPtr += offset; + } + } +} + +int +fileSetPos(int fileID, off_t offset, int whence) +{ + int status = 0; + + if (FileDebug) Message("Offset %8ld Whence %3d", (long) offset, whence); + + bfile_t *fileptr = file_to_pointer(fileID); + if (fileptr == 0) + { + file_pointer_info(__func__, fileID); + return 1; + } + + if (whence != SEEK_SET && whence != SEEK_CUR) Error("Whence = %d not implemented", whence); + + if (fileptr->mode == 'r' && fileptr->type == FILE_TYPE_OPEN) + file_seek_buffer(fileptr, offset, whence); + else + status = fseek(fileptr->fp, offset, whence); + + if (fileptr->position < fileptr->size) + if ((fileptr->flag & FILE_EOF) != 0) fileptr->flag -= FILE_EOF; + + return status; +} + +static void +file_table_print(void) +{ + int lprintHeader = 1; + + for (int fileID = 0; fileID < _file_max; fileID++) + { + bfile_t *fileptr = file_to_pointer(fileID); + if (fileptr) + { + if (lprintHeader) + { + fprintf(stderr, "\nFile table:\n"); + fprintf(stderr, "+-----+---------+"); + fprintf(stderr, "----------------------------------------------------+\n"); + fprintf(stderr, "| ID | Mode |"); + fprintf(stderr, " Name |\n"); + fprintf(stderr, "+-----+---------+"); + fprintf(stderr, "----------------------------------------------------+\n"); + lprintHeader = 0; + } + + fprintf(stderr, "| %3d | ", fileID); + + switch (fileptr->mode) + { + case 'r': fprintf(stderr, "read "); break; + case 'w': fprintf(stderr, "write "); break; + case 'a': fprintf(stderr, "append "); break; + default: fprintf(stderr, "unknown"); + } + + fprintf(stderr, " | %-51s|\n", fileptr->name); + } + } + + if (lprintHeader == 0) + { + fprintf(stderr, "+-----+---------+"); + fprintf(stderr, "----------------------------------------------------+\n"); + } +} + +char * +fileInqName(int fileID) +{ + bfile_t *fileptr = file_to_pointer(fileID); + return fileptr ? fileptr->name : NULL; +} + +int +fileInqMode(int fileID) +{ + bfile_t *fileptr = file_to_pointer(fileID); + return fileptr ? fileptr->mode : 0; +} + +static long +file_getenv(const char *envName) +{ + long envValue = -1; + char *envString = getenv(envName); + if (envString) + { + long fact = 1; + for (int i = 0; i < (int) strlen(envString); i++) + { + if (!isdigit((int) envString[i])) + { + switch (tolower((int) envString[i])) + { + case 'k': fact = 1024; break; + case 'm': fact = 1048576; break; + case 'g': fact = 1073741824; break; + default: + fact = 0; + Warning("Invalid number string in %s: %s", envName, envString); + Warning("%s must comprise only digits [0-9].", envName); + } + break; + } + } + + if (fact) envValue = fact * atol(envString); + + if (FileDebug) Message("Set %s to %ld", envName, envValue); + } + + return envValue; +} + +static void +file_initialize(void) +{ +#ifdef HAVE_LIBPTHREAD + // initialize global API mutex lock + pthread_mutex_init(&_file_mutex, NULL); +#endif + + long value; + + FileInfo = file_getenv("FILE_INFO") > 0; + + value = file_getenv("FILE_DEBUG"); + if (value >= 0) FileDebug = (int) value; + + value = file_getenv("FILE_MAX"); + if (value >= 0) _file_max = (int) value; + + if (FileInfo) fprintf(stderr, "FILE_MAX = %d\n", _file_max); + + value = file_getenv("FILE_BUFSIZE"); + if (value >= 0) + FileBufferSizeEnv = value; + else + { + value = file_getenv("GRIB_API_IO_BUFFER_SIZE"); + if (value >= 0) FileBufferSizeEnv = value; + } + + if (FileInfo) fprintf(stderr, "FILE_BUFSIZE = %ld\n", FileBufferSizeEnv); + + value = file_getenv("FILE_TYPE_READ"); + if (value > 0) + { + switch (value) + { + case FILE_TYPE_OPEN: + case FILE_TYPE_FOPEN: FileTypeRead = (int) value; break; + default: Warning("File type %ld not implemented!", value); + } + } + + if (FileInfo) + fprintf(stderr, "FILE_TYPE_READ = %d [%d:%s %d:%s]\n", FileTypeRead, FILE_TYPE_OPEN, ftname[FILE_TYPE_OPEN], FILE_TYPE_FOPEN, + ftname[FILE_TYPE_FOPEN]); + + value = file_getenv("FILE_TYPE_WRITE"); + if (value > 0) + { + switch (value) + { + case FILE_TYPE_OPEN: + case FILE_TYPE_FOPEN: FileTypeWrite = (int) value; break; + default: Warning("File type %ld not implemented!", value); + } + } + + if (FileInfo) + fprintf(stderr, "FILE_TYPE_WRITE = %d [%d:%s %d:%s]\n", FileTypeWrite, FILE_TYPE_OPEN, ftname[FILE_TYPE_OPEN], FILE_TYPE_FOPEN, + ftname[FILE_TYPE_FOPEN]); + +#ifdef O_NONBLOCK + FileFlagWrite = O_NONBLOCK; +#endif + char *envString = getenv("FILE_FLAG_WRITE"); + if (envString) + { +#ifdef O_NONBLOCK + if (strcmp(envString, "NONBLOCK") == 0) FileFlagWrite = O_NONBLOCK; +#endif + } + + value = file_getenv("FILE_BUFTYPE"); +#ifndef HAVE_MMAP + if (value == FILE_BUFTYPE_MMAP) + { + Warning("MMAP not available!"); + value = 0; + } +#endif + if (value > 0) + { + switch (value) + { + case FILE_BUFTYPE_STD: + case FILE_BUFTYPE_MMAP: FileBufferTypeEnv = (int) value; break; + default: Warning("File buffer type %ld not implemented!", value); + } + } + + if (FileInfo) + fprintf(stderr, "FILE_BUFTYPE = %d [%d:%s %d:%s]\n", FileBufferTypeEnv, FILE_BUFTYPE_STD, fbtname[FILE_BUFTYPE_STD], + FILE_BUFTYPE_MMAP, fbtname[FILE_BUFTYPE_MMAP]); + + file_list_new(); + atexit(file_list_delete); + + FILE_LOCK(); + file_init_pointer(); + FILE_UNLOCK(); + + if (FileDebug) atexit(file_table_print); + + _file_init = true; +} + +static size_t +file_get_buffersize(bfile_t *fileptr) +{ + size_t buffersize = 0; + + if (FileBufferSizeEnv >= 0) + buffersize = (size_t) FileBufferSizeEnv; + else if (fileptr->bufferSize > 0) + buffersize = fileptr->bufferSize; + else + { + buffersize = fileptr->blockSize * 4; + if (buffersize < FileBufferSizeMin) buffersize = FileBufferSizeMin; + } + + return buffersize; +} + +static void +file_set_buffer(bfile_t *fileptr) +{ + size_t buffersize = 0; + + if (fileptr->mode == 'r') + { + if (FileBufferTypeEnv) + fileptr->bufferType = FileBufferTypeEnv; + else if (fileptr->bufferType == 0) + fileptr->bufferType = FILE_BUFTYPE_STD; + + buffersize = file_get_buffersize(fileptr); + + if ((size_t) fileptr->size < buffersize) buffersize = (size_t) fileptr->size; + + if (fileptr->bufferType == FILE_BUFTYPE_MMAP) + { + size_t blocksize = (size_t) file_pagesize(); + size_t minblocksize = 4 * blocksize; + buffersize = buffersize - buffersize % minblocksize; + + if (buffersize < (size_t) fileptr->size && buffersize < minblocksize) buffersize = minblocksize; + } + + if (buffersize == 0) buffersize = 1; + } + else + { + fileptr->bufferType = FILE_BUFTYPE_STD; + buffersize = file_get_buffersize(fileptr); + } + + if (fileptr->bufferType == FILE_BUFTYPE_STD || fileptr->type == FILE_TYPE_FOPEN) + { + if (buffersize > 0) + { + fileptr->buffer = (char *) malloc(buffersize); + if (fileptr->buffer == NULL) SysError("Allocation of file buffer failed!"); + } + } + + if (fileptr->type == FILE_TYPE_FOPEN) + if (setvbuf(fileptr->fp, fileptr->buffer, fileptr->buffer ? _IOFBF : _IONBF, buffersize)) SysError("setvbuf failed!"); + + fileptr->bufferSize = buffersize; +} + +static int +file_fill_buffer(bfile_t *fileptr) +{ + ssize_t nread; + long offset = 0; + + if (FileDebug) Message("file ptr = %p Cnt = %ld", fileptr, fileptr->bufferCnt); + + if ((fileptr->flag & FILE_EOF) != 0) return EOF; + + if (fileptr->buffer == NULL) file_set_buffer(fileptr); + + if (fileptr->bufferSize == 0) return EOF; + + int fd = fileptr->fd; + +#ifdef HAVE_MMAP + if (fileptr->bufferType == FILE_BUFTYPE_MMAP) + { + if (fileptr->bufferPos >= fileptr->size) + { + nread = 0; + } + else + { +#ifdef CDI + xassert(fileptr->bufferSize <= SSIZE_MAX); +#endif + nread = (ssize_t) fileptr->bufferSize; + if ((nread + fileptr->bufferPos) > fileptr->size) nread = fileptr->size - fileptr->bufferPos; + + if (fileptr->buffer) + { + int ret = munmap(fileptr->buffer, fileptr->mappedSize); + if (ret == -1) SysError("munmap error for read %s", fileptr->name); + fileptr->buffer = NULL; + } + + fileptr->mappedSize = (size_t) nread; + + fileptr->buffer = (char *) mmap(NULL, (size_t) nread, PROT_READ, MAP_PRIVATE, fd, fileptr->bufferPos); + + if (fileptr->buffer == MAP_FAILED) SysError("mmap error for read %s", fileptr->name); + + offset = fileptr->position - fileptr->bufferPos; + } + } + else +#endif + { + off_t retseek = lseek(fileptr->fd, fileptr->bufferPos, SEEK_SET); + if (retseek == (off_t) -1) SysError("lseek error at pos %ld file %s", (long) fileptr->bufferPos, fileptr->name); + + nread = read(fd, fileptr->buffer, fileptr->bufferSize); + if (nread > 0) offset = fileptr->position - fileptr->bufferPos; + } + + if (nread <= 0) + { + fileptr->flag |= (nread == 0) ? FILE_EOF : FILE_ERROR; + fileptr->bufferCnt = 0; + return EOF; + } + + fileptr->bufferPtr = fileptr->buffer; + fileptr->bufferCnt = (size_t) nread; + + fileptr->bufferStart = fileptr->bufferPos; + fileptr->bufferPos += nread; + fileptr->bufferEnd = fileptr->bufferPos - 1; + + if (FileDebug) + { + Message("fileID = %d Val = %d", fileptr->self, (int) fileptr->buffer[0]); + Message("fileID = %d Start = %ld", fileptr->self, fileptr->bufferStart); + Message("fileID = %d End = %ld", fileptr->self, fileptr->bufferEnd); + Message("fileID = %d nread = %ld", fileptr->self, nread); + Message("fileID = %d offset = %ld", fileptr->self, offset); + Message("fileID = %d Pos = %ld", fileptr->self, fileptr->bufferPos); + Message("fileID = %d postion = %ld", fileptr->self, fileptr->position); + } + + if (offset > 0) + { + if (offset > nread) Error("Internal problem with buffer handling. nread = %d offset = %d", nread, offset); + + fileptr->bufferPtr += offset; + fileptr->bufferCnt -= (size_t) offset; + } + + fileptr->bufferNumFill++; + + return (unsigned char) *fileptr->bufferPtr; +} + +static void +file_copy_from_buffer(bfile_t *fileptr, void *ptr, size_t size) +{ + if (FileDebug) Message("size = %ld Cnt = %ld", size, fileptr->bufferCnt); + + if (fileptr->bufferCnt < size) Error("Buffer too small. bufferCnt = %d", fileptr->bufferCnt); + + if (size == 1) + { + ((char *) ptr)[0] = fileptr->bufferPtr[0]; + + fileptr->bufferPtr++; + fileptr->bufferCnt--; + } + else + { + memcpy(ptr, fileptr->bufferPtr, size); + + fileptr->bufferPtr += size; + fileptr->bufferCnt -= size; + } +} + +static size_t +file_read_from_buffer(bfile_t *fileptr, void *ptr, size_t size) +{ + size_t nread; + size_t offset = 0; + + if (FileDebug) Message("size = %ld Cnt = %ld", size, (long) fileptr->bufferCnt); + + if (((long) fileptr->bufferCnt) < 0L) Error("Internal problem. bufferCnt = %ld", (long) fileptr->bufferCnt); + + size_t rsize = size; + + while (fileptr->bufferCnt < rsize) + { + nread = fileptr->bufferCnt; + // fprintf(stderr, "rsize = %d nread = %d\n", (int) rsize, (int) nread); + if (nread > (size_t) 0) file_copy_from_buffer(fileptr, (char *) ptr + offset, nread); + offset += nread; + rsize = (nread < rsize) ? rsize - nread : 0; + + if (file_fill_buffer(fileptr) == EOF) break; + } + + nread = size - offset; + + if (fileptr->bufferCnt < nread) nread = fileptr->bufferCnt; + + if (nread > (unsigned) 0) file_copy_from_buffer(fileptr, (char *) ptr + offset, nread); + + return (nread + offset); +} + +void +fileSetBufferSize(int fileID, long buffersize) +{ +#ifdef CDI + xassert(buffersize >= 0); +#endif + bfile_t *fileptr = file_to_pointer(fileID); + if (fileptr) fileptr->bufferSize = (size_t) buffersize; +} + +/* + * Open a file. Returns file ID, or -1 on error + */ +int +fileOpen(const char *filename, const char *mode) +#ifdef CDI +{ + int (*myFileOpen)(const char *filename, const char *mode) + = (int (*)(const char *, const char *)) namespaceSwitchGet(NSSWITCH_FILE_OPEN).func; + return myFileOpen(filename, mode); +} + +int +fileOpen_serial(const char *filename, const char *mode) +#endif +{ + FILE *fp = NULL; // file pointer (used for write) + int fd = -1; // file descriptor (used for read) + int fileID = FILE_UNDEFID; + struct stat filestat; + bfile_t *fileptr = NULL; + + FILE_INIT(); + + int fmode = tolower((int) mode[0]); + + switch (fmode) + { + case 'r': + if (FileTypeRead == FILE_TYPE_FOPEN) + fp = fopen(filename, "rb"); + else + fd = open(filename, O_RDONLY | O_BINARY); + break; + case 'x': fp = fopen(filename, "rb"); break; + case 'w': + if (FileTypeWrite == FILE_TYPE_FOPEN) + fp = fopen(filename, "wb"); + else + fd = open(filename, O_CREAT | O_TRUNC | O_WRONLY | O_BINARY | FileFlagWrite, 0666); + break; + case 'a': fp = fopen(filename, "ab"); break; + default: Error("Mode %c unexpected!", fmode); + } + + if (FileDebug && fp == NULL && fd == -1) Message("Open failed on %s mode %c errno %d", filename, fmode, errno); + + if (fp) + { + if (stat(filename, &filestat) != 0) return fileID; + + fileptr = file_new_entry(); + if (fileptr) + { + fileID = fileptr->self; + fileptr->fp = fp; + } + } + else if (fd >= 0) + { + if (fstat(fd, &filestat) != 0) return fileID; + + fileptr = file_new_entry(); + if (fileptr) + { + fileID = fileptr->self; + fileptr->fd = fd; + } + } + + if (fileID >= 0) + { + fileptr->mode = fmode; + fileptr->name = strdup(filename); + +#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE + fileptr->blockSize = (size_t) filestat.st_blksize; +#else + fileptr->blockSize = (size_t) 4096; +#endif + + // clang-format off + if (fmode == 'r') fileptr->type = FileTypeRead; + else if (fmode == 'w') fileptr->type = FileTypeWrite; + else fileptr->type = FILE_TYPE_FOPEN; + // clang-format on + + if (fmode == 'r') fileptr->size = filestat.st_size; + + // if (fileptr->type == FILE_TYPE_FOPEN) file_set_buffer(fileptr); + file_set_buffer(fileptr); + + if (FileDebug) Message("File %s opened with ID %d", filename, fileID); + } + + return fileID; +} + +/* + * Close a file. + */ +int +fileClose(int fileID) +#ifdef CDI +{ + int (*myFileClose)(int fileID) = (int (*)(int)) namespaceSwitchGet(NSSWITCH_FILE_CLOSE).func; + return myFileClose(fileID); +} + +int +fileClose_serial(int fileID) +#endif +{ + int ret; + double rout = 0; + + bfile_t *fileptr = file_to_pointer(fileID); + if (fileptr == NULL) + { + file_pointer_info(__func__, fileID); + return 1; + } + + const char *name = fileptr->name; + + if (FileDebug) Message("fileID = %d filename = %s", fileID, name); + + if (FileInfo) + { + fprintf(stderr, "____________________________________________\n"); + fprintf(stderr, " file ID : %d\n", fileID); + fprintf(stderr, " file name : %s\n", fileptr->name); + fprintf(stderr, " file type : %d (%s)\n", fileptr->type, ftname[fileptr->type]); + + if (fileptr->type == FILE_TYPE_FOPEN) + fprintf(stderr, " file pointer : %p\n", (void *) fileptr->fp); + else + { + fprintf(stderr, " file descriptor : %d\n", fileptr->fd); + fprintf(stderr, " file flag : %d\n", FileFlagWrite); + } + fprintf(stderr, " file mode : %c\n", fileptr->mode); + + if (sizeof(off_t) > sizeof(long)) + { +#ifdef _WIN32 + fprintf(stderr, " file size : %I64d\n", (long long) fileptr->size); + if (fileptr->type == FILE_TYPE_OPEN) fprintf(stderr, " file position : %I64d\n", (long long) fileptr->position); + fprintf(stderr, " bytes transfered : %I64d\n", (long long) fileptr->byteTrans); +#else + fprintf(stderr, " file size : %lld\n", (long long) fileptr->size); + if (fileptr->type == FILE_TYPE_OPEN) fprintf(stderr, " file position : %lld\n", (long long) fileptr->position); + fprintf(stderr, " bytes transfered : %lld\n", (long long) fileptr->byteTrans); +#endif + } + else + { + fprintf(stderr, " file size : %ld\n", (long) fileptr->size); + if (fileptr->type == FILE_TYPE_OPEN) fprintf(stderr, " file position : %ld\n", (long) fileptr->position); + fprintf(stderr, " bytes transfered : %ld\n", (long) fileptr->byteTrans); + } + + if (fileptr->time_in_sec > 0) rout = (double) fileptr->byteTrans / (1024. * 1024. * fileptr->time_in_sec); + + fprintf(stderr, " wall time [s] : %.2f\n", fileptr->time_in_sec); + fprintf(stderr, " data rate [MB/s] : %.1f\n", rout); + + fprintf(stderr, " file access : %ld\n", fileptr->access); + if (fileptr->mode == 'r' && fileptr->type == FILE_TYPE_OPEN) + { + fprintf(stderr, " buffer type : %d (%s)\n", fileptr->bufferType, fbtname[fileptr->bufferType]); + fprintf(stderr, " num buffer fill : %ld\n", fileptr->bufferNumFill); + } + fprintf(stderr, " buffer size : %lu\n", (unsigned long) fileptr->bufferSize); + fprintf(stderr, " block size : %lu\n", (unsigned long) fileptr->blockSize); + fprintf(stderr, " page size : %d\n", file_pagesize()); + fprintf(stderr, "--------------------------------------------\n"); + } + + if (fileptr->type == FILE_TYPE_FOPEN) + { + ret = fclose(fileptr->fp); + if (ret == EOF) SysError("EOF returned for close of %s!", name); + } + else + { +#ifdef HAVE_MMAP + if (fileptr->buffer && fileptr->mappedSize) + { + ret = munmap(fileptr->buffer, fileptr->mappedSize); + if (ret == -1) SysError("munmap error for close %s", fileptr->name); + fileptr->buffer = NULL; + } +#endif + ret = close(fileptr->fd); + if (ret == -1) SysError("EOF returned for close of %s!", name); + } + + if (fileptr->name) free((void *) fileptr->name); + if (fileptr->buffer) free((void *) fileptr->buffer); + + file_delete_entry(fileptr); + + return 0; +} + +int +filePtrGetc(void *vfileptr) +{ + int ivalue = EOF; + + bfile_t *fileptr = (bfile_t *) vfileptr; + if (fileptr) + { + if (fileptr->mode == 'r' && fileptr->type == FILE_TYPE_OPEN) + { + int fillret = (fileptr->bufferCnt == 0) ? file_fill_buffer(fileptr) : 0; + if (fillret >= 0) + { + ivalue = (unsigned char) *fileptr->bufferPtr++; + fileptr->bufferCnt--; + fileptr->position++; + + fileptr->byteTrans++; + fileptr->access++; + } + } + else + { + ivalue = fgetc(fileptr->fp); + if (ivalue >= 0) + { + fileptr->byteTrans++; + fileptr->access++; + } + else + fileptr->flag |= FILE_EOF; + } + } + + return ivalue; +} + +int +fileGetc(int fileID) +{ + bfile_t *fileptr = file_to_pointer(fileID); + return filePtrGetc((void *) fileptr); +} + +size_t +filePtrRead(void *vfileptr, void *restrict ptr, size_t size) +{ + size_t nread = 0; + + bfile_t *fileptr = (bfile_t *) vfileptr; + if (fileptr) + { + if (fileptr->mode == 'r' && fileptr->type == FILE_TYPE_OPEN) + { + nread = file_read_from_buffer(fileptr, ptr, size); + } + else + { + nread = fread(ptr, 1, size, fileptr->fp); + if (nread != size) fileptr->flag |= (nread == 0) ? FILE_EOF : FILE_ERROR; + } + + fileptr->position += (off_t) nread; + fileptr->byteTrans += (off_t) nread; + fileptr->access++; + } + + if (FileDebug) Message("size %ld nread %ld", size, nread); + + return nread; +} + +size_t +fileRead(int fileID, void *restrict ptr, size_t size) +{ + size_t nread = 0; + + bfile_t *fileptr = file_to_pointer(fileID); + if (fileptr) + { + double t_begin = 0.0; + + if (FileInfo) t_begin = file_time(); + + if (fileptr->type == FILE_TYPE_OPEN) + { + nread = file_read_from_buffer(fileptr, ptr, size); + } + else + { + nread = fread(ptr, 1, size, fileptr->fp); + if (nread != size) fileptr->flag |= (nread == 0) ? FILE_EOF : FILE_ERROR; + } + + if (FileInfo) fileptr->time_in_sec += file_time() - t_begin; + + fileptr->position += (off_t) nread; + fileptr->byteTrans += (off_t) nread; + fileptr->access++; + } + + if (FileDebug) Message("size %ld nread %ld", size, nread); + + return nread; +} + +size_t +fileWrite(int fileID, const void *restrict ptr, size_t size) +{ + size_t nwrite = 0; + + bfile_t *fileptr = file_to_pointer(fileID); + if (fileptr) + { + double t_begin = 0.0; + + if (FileInfo) t_begin = file_time(); + + if (fileptr->type == FILE_TYPE_FOPEN) + { + nwrite = fwrite(ptr, 1, size, fileptr->fp); + } + else + { + ssize_t temp = write(fileptr->fd, ptr, size); + if (temp == -1) perror("error writing to file"); + nwrite = (temp == -1) ? 0 : (size_t) temp; + } + + if (FileInfo) fileptr->time_in_sec += file_time() - t_begin; + + fileptr->position += (off_t) nwrite; + fileptr->byteTrans += (off_t) nwrite; + fileptr->access++; + } + + return nwrite; +} +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#include <stdio.h> +#include <stdlib.h> +#include <stdbool.h> +#include <float.h> +#include <math.h> + +#ifndef M_SQRT2 +#define M_SQRT2 1.41421356237309504880168872420969808 +#endif + +static void +cpledn(size_t kn, size_t kodd, double *pfn, double pdx, int kflag, double *pw, double *pdxn, double *pxmod) +{ + // 1.0 Newton iteration step + + double zdlx = pdx; + double zdlldn = 0.0; + + size_t ik = 1; + + if (kflag == 0) + { + double zdlk = 0.5 * pfn[0]; + for (size_t jn = 2 - kodd; jn <= kn; jn += 2) + { + // normalised ordinary Legendre polynomial == \overbar{p_n}^0 + zdlk = zdlk + pfn[ik] * cos((double) (jn) *zdlx); + // normalised derivative == d/d\theta(\overbar{p_n}^0) + zdlldn = zdlldn - pfn[ik] * (double) (jn) *sin((double) (jn) *zdlx); + ik++; + } + // Newton method + double zdlmod = -(zdlk / zdlldn); + double zdlxn = zdlx + zdlmod; + *pdxn = zdlxn; + *pxmod = zdlmod; + } + + // 2.0 Compute weights + + if (kflag == 1) + { + for (size_t jn = 2 - kodd; jn <= kn; jn += 2) + { + // normalised derivative + zdlldn = zdlldn - pfn[ik] * (double) (jn) *sin((double) (jn) *zdlx); + ik++; + } + *pw = (double) (2 * kn + 1) / (zdlldn * zdlldn); + } + + return; +} + +static void +gawl(double *pfn, double *pl, double *pw, size_t kn) +{ + double pmod = 0.0; + double zw = 0.0; + double zdlxn = 0.0; + + // 1.0 Initizialization + + int iflag = 0; + int itemax = 20; + + size_t iodd = (kn % 2); + + double zdlx = *pl; + + // 2.0 Newton iteration + + for (int jter = 1; jter <= itemax + 1; ++jter) + { + cpledn(kn, iodd, pfn, zdlx, iflag, &zw, &zdlxn, &pmod); + zdlx = zdlxn; + if (iflag == 1) break; + if (fabs(pmod) <= DBL_EPSILON * 1000.0) iflag = 1; + } + + *pl = zdlxn; + *pw = zw; + + return; +} + +static void +gauaw(size_t kn, double *restrict pl, double *restrict pw) +{ + /* + * 1.0 Initialize Fourier coefficients for ordinary Legendre polynomials + * + * Belousov, Swarztrauber, and ECHAM use zfn(0,0) = sqrt(2) + * IFS normalisation chosen to be 0.5*Integral(Pnm**2) = 1 (zfn(0,0) = 2.0) + */ + double *zfn = (double *) malloc((kn + 1) * (kn + 1) * sizeof(double)); + double *zfnlat = (double *) malloc((kn / 2 + 1 + 1) * sizeof(double)); + + zfn[0] = M_SQRT2; + for (size_t jn = 1; jn <= kn; ++jn) + { + double zfnn = zfn[0]; + for (size_t jgl = 1; jgl <= jn; ++jgl) + { + zfnn *= sqrt(1.0 - 0.25 / ((double) (jgl * jgl))); + } + + zfn[jn * (kn + 1) + jn] = zfnn; + + size_t iodd = jn % 2; + for (size_t jgl = 2; jgl <= jn - iodd; jgl += 2) + { + zfn[jn * (kn + 1) + jn - jgl] = zfn[jn * (kn + 1) + jn - jgl + 2] * ((double) ((jgl - 1) * (2 * jn - jgl + 2))) + / ((double) (jgl * (2 * jn - jgl + 1))); + } + } + + // 2.0 Gaussian latitudes and weights + + size_t iodd = kn % 2; + size_t ik = iodd; + for (size_t jgl = iodd; jgl <= kn; jgl += 2) + { + zfnlat[ik] = zfn[kn * (kn + 1) + jgl]; + ik++; + } + + // 2.1 Find first approximation of the roots of the Legendre polynomial of degree kn + + size_t ins2 = kn / 2 + (kn % 2); + + for (size_t jgl = 1; jgl <= ins2; ++jgl) + { + double z = ((double) (4 * jgl - 1)) * M_PI / ((double) (4 * kn + 2)); + pl[jgl - 1] = z + 1.0 / (tan(z) * ((double) (8 * kn * kn))); + } + + // 2.2 Computes roots and weights for transformed theta + + for (size_t jgl = ins2; jgl >= 1; --jgl) + { + size_t jglm1 = jgl - 1; + gawl(zfnlat, &(pl[jglm1]), &(pw[jglm1]), kn); + } + + // convert to physical latitude + + for (size_t jgl = 0; jgl < ins2; ++jgl) pl[jgl] = cos(pl[jgl]); + + for (size_t jgl = 1; jgl <= kn / 2; ++jgl) + { + size_t jglm1 = jgl - 1; + size_t isym = kn - jgl; + pl[isym] = -pl[jglm1]; + pw[isym] = pw[jglm1]; + } + + free(zfnlat); + free(zfn); + + return; +} + +void +gaussianLatitudes(size_t nlats, double *latitudes, double *weights) +{ + gauaw(nlats, latitudes, weights); +} + +bool +isGaussianLatitudes(size_t nlats, const double *latitudes) +{ + bool is_gauss_lats = false; + + if (nlats > 2) // check if gaussian + { + size_t i; + double *yv = (double *) malloc(nlats * sizeof(double)); + double *yw = (double *) malloc(nlats * sizeof(double)); + gaussianLatitudes(nlats, yv, yw); + free(yw); + + for (i = 0; i < nlats; i++) yv[i] = asin(yv[i]) / M_PI * 180.0; + + for (i = 0; i < nlats; i++) + if (fabs(yv[i] - latitudes[i]) > ((yv[0] - yv[1]) / 500.0)) break; + + if (i == nlats) is_gauss_lats = true; + + // check S->N + if (is_gauss_lats == false) + { + for (i = 0; i < nlats; i++) + if (fabs(yv[i] - latitudes[nlats - i - 1]) > ((yv[0] - yv[1]) / 500.0)) break; + + if (i == nlats) is_gauss_lats = true; + } + + free(yv); + } + + return is_gauss_lats; +} +#ifndef GET_NUM_MISSVALS_H +#define GET_NUM_MISSVALS_H + +#include <stddef.h> + +size_t get_num_missvalsSP(size_t size, float *data, float missval); +size_t get_num_missvalsDP(size_t size, double *data, double missval); +size_t get_cplx_num_missvalsSP(size_t size, float *data, float missval); +size_t get_cplx_num_missvalsDP(size_t size, double *data, double missval); + +#endif + +size_t +get_num_missvalsSP(size_t size, float *data, float missval) +{ + size_t nmiss = 0; + + if (DBL_IS_NAN(missval)) + { + for (size_t i = 0; i < size; i++) + if (DBL_IS_EQUAL(data[i], missval)) + { + data[i] = missval; + nmiss++; + } + } + else + { + for (size_t i = 0; i < size; i++) + if (IS_EQUAL(data[i], missval)) + { + data[i] = missval; + nmiss++; + } + } + + return nmiss; +} + +size_t +get_num_missvalsDP(size_t size, double *data, double missval) +{ + size_t nmiss = 0; + + if (DBL_IS_NAN(missval)) + { + for (size_t i = 0; i < size; i++) + if (DBL_IS_EQUAL(data[i], missval) || DBL_IS_EQUAL(data[i], (float) missval)) + { + data[i] = missval; + nmiss++; + } + } + else + { + for (size_t i = 0; i < size; i++) + if (IS_EQUAL(data[i], missval) || IS_EQUAL(data[i], (float) missval)) + { + data[i] = missval; + nmiss++; + } + } + + return nmiss; +} + +size_t +get_cplx_num_missvalsSP(size_t size, float *data, float missval) +{ + size_t nmiss = 0; + + if (DBL_IS_NAN(missval)) + { + for (size_t i = 0; i < 2 * size; i += 2) + if (DBL_IS_EQUAL(data[i], missval)) + { + data[i] = missval; + nmiss++; + } + } + else + { + for (size_t i = 0; i < 2 * size; i += 2) + if (IS_EQUAL(data[i], missval)) + { + data[i] = missval; + nmiss++; + } + } + + return nmiss; +} + +size_t +get_cplx_num_missvalsDP(size_t size, double *data, double missval) +{ + size_t nmiss = 0; + + if (DBL_IS_NAN(missval)) + { + for (size_t i = 0; i < 2 * size; i += 2) + if (DBL_IS_EQUAL(data[i], missval) || DBL_IS_EQUAL(data[i], (float) missval)) + { + data[i] = missval; + nmiss++; + } + } + else + { + for (size_t i = 0; i < 2 * size; i += 2) + if (IS_EQUAL(data[i], missval) || IS_EQUAL(data[i], (float) missval)) + { + data[i] = missval; + nmiss++; + } + } + + return nmiss; +} +#ifdef HAVE_CONFIG_H +#endif + +#ifdef HAVE_LIBGRIB_API +#include <grib_api.h> +#endif + +#include <stdio.h> + + +static char gribapi_libvers[64] = ""; +#ifdef HAVE_LIBGRIB_API +static bool gribapi_libvers_init; +#endif + +void +gribapiLibraryVersion(int *major_version, int *minor_version, int *revision_version) +{ +#ifdef HAVE_LIBGRIB_API + long version = grib_get_api_version(); + (*major_version) = (int) (version / 10000); + (*minor_version) = (int) ((version - (*major_version) * 10000) / 100); + (*revision_version) = (int) (version - (*major_version) * 10000 - (*minor_version) * 100); +#else + (*major_version) = 0; + (*minor_version) = 0; + (*revision_version) = 0; +#endif +} + +const char * +gribapiLibraryVersionString(void) +{ +#ifdef HAVE_LIBGRIB_API + if (!gribapi_libvers_init) + { + int major_version, minor_version, revision_version; + gribapiLibraryVersion(&major_version, &minor_version, &revision_version); + + snprintf(gribapi_libvers, sizeof(gribapi_libvers), "%d.%d.%d", major_version, minor_version, revision_version); + gribapi_libvers_init = true; + } +#endif + + return gribapi_libvers; +} + +void * +gribHandleNew(int editionNumber) +{ +#ifdef HAVE_LIBGRIB_API + grib_handle *gh = NULL; + const char *fname = (editionNumber == 1) ? CDI_GRIB1_Template : CDI_GRIB2_Template; + if (fname) + { + FILE *fp = fopen(fname, "r"); + if (fp) + { + int error; + gh = grib_handle_new_from_file(NULL, fp, &error); + fclose(fp); + if (gh == NULL) Error("grib_handle_new_from_file failed!"); + } + else + { + Error("Open failed on >%s<!", fname); + } + } + + if (gh == NULL) + { + gh = grib_handle_new_from_samples(NULL, (editionNumber == 1) ? "GRIB1" : "GRIB2"); + if (gh == NULL) Error("grib_handle_new_from_samples failed!"); + + if (editionNumber == 1) GRIB_CHECK(my_grib_set_long(gh, "deleteLocalDefinition", 1L), 0); + if (editionNumber == 2) GRIB_CHECK(my_grib_set_long(gh, "grib2LocalSectionPresent", 0L), 0); + if (editionNumber == 2) GRIB_CHECK(my_grib_set_long(gh, "numberOfValues", 0L), 0); + } + + return gh; +#else + return NULL; +#endif +} + +void +gribHandleDelete(void *gh) +{ +#ifdef HAVE_LIBGRIB_API + grib_handle_delete((struct grib_handle *) gh); +#endif +} + +void +gribContainersNew(stream_t *streamptr) +{ + const int editionNumber = (streamptr->filetype == CDI_FILETYPE_GRB) ? 1 : 2; + +#ifdef HAVE_LIBCGRIBEX + if (editionNumber == 1 && !CDI_gribapi_grib1) + { + } + else +#endif + { + const int nvars = streamptr->nvars; + +#ifdef GRIBCONTAINER2D + gribContainer_t **gribContainers; + gribContainers = (gribContainer_t **) Malloc(nvars * sizeof(gribContainer_t *)); + + for (int varID = 0; varID < nvars; ++varID) + { + const int nlevs = streamptr->vars[varID].nlevs; + gribContainers[varID] = (gribContainer_t *) Malloc(nlevs * sizeof(gribContainer_t)); + + for (int levelID = 0; levelID < nlevs; ++levelID) + { + gribContainers[varID][levelID].gribHandle = gribHandleNew(editionNumber); + gribContainers[varID][levelID].init = false; + } + } + + streamptr->gribContainers = (void *) gribContainers; +#else + gribContainer_t *gribContainers = (gribContainer_t *) Malloc((size_t) nvars * sizeof(gribContainer_t)); + + for (int varID = 0; varID < nvars; ++varID) + { + gribContainers[varID].gribHandle = gribHandleNew(editionNumber); + gribContainers[varID].init = false; + } + + streamptr->gribContainers = (void *) gribContainers; +#endif + } +} + +void +gribContainersDelete(stream_t *streamptr) +{ + if (streamptr->gribContainers) + { + const int nvars = streamptr->nvars; + +#ifdef GRIBCONTAINER2D + gribContainer_t **gribContainers = (gribContainer_t **) streamptr->gribContainers; + + for (int varID = 0; varID < nvars; ++varID) + { + const int nlevs = streamptr->vars[varID].nlevs; + for (int levelID = 0; levelID < nlevs; ++levelID) + { + gribHandleDelete(gribContainers[varID][levelID].gribHandle); + } + Free(gribContainers[varID]); + } +#else + gribContainer_t *gribContainers = (gribContainer_t *) streamptr->gribContainers; + + for (int varID = 0; varID < nvars; ++varID) + { + gribHandleDelete(gribContainers[varID].gribHandle); + } +#endif + + Free(gribContainers); + + streamptr->gribContainers = NULL; + } +} +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifndef INCLUDE_GUARD_CDI_GRIBAPI_UTILITIES_H +#define INCLUDE_GUARD_CDI_GRIBAPI_UTILITIES_H + +#ifdef HAVE_LIBGRIB_API + + +#include <grib_api.h> + +#include <stdbool.h> + +char *gribCopyString(grib_handle *gribHandle, const char *key); +bool gribCheckString(grib_handle *gribHandle, const char *key, const char *expectedValue); + +bool gribCheckLong(grib_handle *gribHandle, const char *key, long expectedValue); +long gribGetLong(grib_handle *gh, const char *key); +long gribGetLongDefault(grib_handle *gribHandle, const char *key, long defaultValue); + +double gribGetDouble(grib_handle *gh, const char *key); +double gribGetDoubleDefault(grib_handle *gribHandle, const char *key, double defaultValue); + +size_t gribGetArraySize(grib_handle *gribHandle, const char *key); +void gribGetDoubleArray(grib_handle *gribHandle, const char *key, + double *array); // The caller is responsible to ensure a sufficiently large buffer. +void gribGetLongArray(grib_handle *gribHandle, const char *key, + long *array); // The caller is responsible to ensure a sufficiently large buffer. + +long gribEditionNumber(grib_handle *gh); +char *gribMakeTimeString(grib_handle *gh, CdiTimeType timeType); // Returns NULL if timeType is kCdiTimeType_endTime and the field + // does not have an integration period (statistical data). +int gribapiTimeIsFC(grib_handle *gh); +int gribapiGetTsteptype(grib_handle *gh); +int gribGetDatatype(grib_handle *gribHandle); +int gribapiGetParam(grib_handle *gh); +int gribapiGetGridType(grib_handle *gh); +bool gribapiGetGrid(grib_handle *gh, grid_t *grid); +size_t gribapiGetGridsize(grib_handle *gh); + +#ifdef HIRLAM_EXTENSIONS +void gribapiSetDataTimeRangeIndicator(grib_handle *gh, int timeRangeIndicator); +void gribapiGetDataTimeRangeIndicator(grib_handle *gh, int *timeRangeIndicator); +#endif // #ifdef HIRLAM_EXTENSIONS + +extern struct cdiGribAPI_ts_str_map_elem +{ + long productionTemplate; + const char sname[8]; +} cdiGribAPI_ts_str_map[]; + +#endif + +#endif + +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifdef HAVE_CONFIG_H +#endif + +#ifdef HAVE_LIBGRIB_API + + + +#include <assert.h> +#include <time.h> + +#define FAIL_ON_GRIB_ERROR(function, gribHandle, key, ...) \ + do \ + { \ + const int errorCode = (int) function(gribHandle, key, __VA_ARGS__); \ + if (errorCode) \ + { \ + fprintf(stderr, "%s:%d: Error in function `%s`: `%s` returned error code %d for key \"%s\"", __FILE__, __LINE__, \ + __func__, #function, errorCode, key); \ + exit(errorCode); \ + } \ + } \ + while (0) + +// A simple wrapper for grib_get_string() that returns a newly allocated string. +char * +gribCopyString(grib_handle *gribHandle, const char *key) +{ + size_t length; +#ifdef HAVE_GRIB_GET_LENGTH + if (!grib_get_length(gribHandle, key, &length)) + { + char *result = (char *) Malloc(length); + if (!grib_get_string(gribHandle, key, result, &length)) + result = (char *) Realloc(result, length); + else + { + Free(result); + result = NULL; + } + return result; + } + else + return NULL; +#else + length = 1024; /* there's an implementation limit + * that makes strings longer than + * this unlikely in grib_api versions + * not providing grib_get_length */ + int rc; + char *result = (char *) Malloc(length); + while ((rc = grib_get_string(gribHandle, key, result, &length)) == GRIB_BUFFER_TOO_SMALL || rc == GRIB_ARRAY_TOO_SMALL) + { + if (length <= 1024UL * 1024UL) + { + length *= 2; + result = Realloc(result, length); + } + else + break; + } + if (!rc) + result = Realloc(result, length); + else + { + Free(result); + result = NULL; + } + return result; +#endif +} + +// A simple wrapper for grib_get_string() for the usecase that the result is only compared to a given constant string. +// Returns true if the key exists and the value is equal to the given string. +bool +gribCheckString(grib_handle *gribHandle, const char *key, const char *expectedValue) +{ + size_t expectedLength = strlen(expectedValue) + 1; +#ifdef HAVE_GRIB_GET_LENGTH + size_t length; + if (grib_get_length(gribHandle, key, &length)) return false; + if (length != expectedLength) return false; + char *value = (char *) Malloc(length); + if (grib_get_string(gribHandle, key, value, &length)) return false; + int rc = str_is_equal(value, expectedValue); + Free(value); +#else + char *value = gribCopyString(gribHandle, key); + int rc = value ? (strlen(value) + 1 == expectedLength ? str_is_equal(value, expectedValue) : false) : false; + Free(value); +#endif + return rc; +} + +// A simple wrapper for grib_get_long() for the usecase that the result is only compared to a given constant value. +// Returns true if the key exists and the value is equal to the given one. +bool +gribCheckLong(grib_handle *gribHandle, const char *key, long expectedValue) +{ + long value; + if (grib_get_long(gribHandle, key, &value)) return false; + return value == expectedValue; +} + +// A simple wrapper for grib_get_long() for the usecase that failure to fetch the value is fatal. +long +gribGetLong(grib_handle *gh, const char *key) +{ + long result; + FAIL_ON_GRIB_ERROR(grib_get_long, gh, key, &result); + return result; +} + +// A simple wrapper for grib_get_long() for the usecase that a default value is used in the case that the operation fails. +long +gribGetLongDefault(grib_handle *gribHandle, const char *key, long defaultValue) +{ + long result; + if (grib_get_long(gribHandle, key, &result) || result == GRIB_MISSING_LONG) result = defaultValue; + return result; +} + +// A simple wrapper for grib_get_double() for the usecase that failure to fetch the value is fatal. +double +gribGetDouble(grib_handle *gh, const char *key) +{ + double result; + FAIL_ON_GRIB_ERROR(grib_get_double, gh, key, &result); + return result; +} + +// A sample wrapper for grib_get_double() for the usecase that a default value is used in the case that the operation fails. +double +gribGetDoubleDefault(grib_handle *gribHandle, const char *key, double defaultValue) +{ + double result; + if (grib_get_double(gribHandle, key, &result) || IS_EQUAL(result, GRIB_MISSING_DOUBLE)) result = defaultValue; + return result; +} + +// A simple wrapper for grib_get_size() for the usecase that failure to fetch the value is fatal. +size_t +gribGetArraySize(grib_handle *gribHandle, const char *key) +{ + size_t result; + FAIL_ON_GRIB_ERROR(grib_get_size, gribHandle, key, &result); + return result; +} + +// A simple wrapper for grib_get_double_array() for the usecase that failure to fetch the data is fatal. +void +gribGetDoubleArray(grib_handle *gribHandle, const char *key, double *array) +{ + size_t valueCount = gribGetArraySize(gribHandle, key); + FAIL_ON_GRIB_ERROR(grib_get_double_array, gribHandle, key, array, &valueCount); +} + +// A simple wrapper for grib_get_long_array() for the usecase that failure to fetch the data is fatal. +void +gribGetLongArray(grib_handle *gribHandle, const char *key, long *array) +{ + size_t valueCount = gribGetArraySize(gribHandle, key); + FAIL_ON_GRIB_ERROR(grib_get_long_array, gribHandle, key, array, &valueCount); +} + +// We need the edition number so frequently, that it's convenient to give it its own function. +long +gribEditionNumber(grib_handle *gh) +{ + return gribGetLong(gh, "editionNumber"); +} + +// This return value of this should be passed to a call to resetTz(), it is a malloc'ed string with the content of the TZ +// environment variable before the call (or NULL if that was not set). +static char * +setUtc() +{ + char *temp = getenv("TZ"), *result = NULL; + if (temp) result = strdup(temp); + setenv("TZ", "UTC", 1); + return result; +} + +// Undoes the effect of setUtc(), pass to it the return value of the corresponding setUtc() call, it will free the string. +static void +resetTz(char *savedTz) +{ + if (savedTz) + { + setenv("TZ", savedTz, 1); + Free(savedTz); + } + else + { + unsetenv("TZ"); + } +} + +// This function uses the system functions to normalize the date representation according to the gregorian calendar. +// Returns zero on success. +static int +normalizeDays(struct tm *me) +{ + char *savedTz = setUtc(); // Ensure that mktime() does not interprete the date according to our local time zone. + + int result = (mktime(me) == (time_t) -1); // This does all the heavy lifting. + + resetTz(savedTz); + return result; +} + +// Returns zero on success. +static int +addSecondsToDate(struct tm *me, long long amount) +{ + // It is irrelevant here whether days are zero or one based, the correction would have be undone again so that it is effectless. + long long seconds = ((me->tm_mday * 24ll + me->tm_hour) * 60 + me->tm_min) * 60 + + me->tm_sec; // The portion of the date that uses fixed increments. + seconds += amount; + me->tm_mday = (int) (seconds / 24 / 60 / 60); + seconds -= (long long) me->tm_mday * 24 * 60 * 60; + me->tm_hour = (int) (seconds / 60 / 60); + seconds -= (long long) me->tm_hour * 60 * 60; + me->tm_min = (int) (seconds / 60); + seconds -= (long long) (me->tm_min * 60); + me->tm_sec = (int) seconds; + return normalizeDays(me); +} + +static void +addMonthsToDate(struct tm *me, long long amount) +{ + long long months = me->tm_year * 12ll + me->tm_mon; + months += amount; + me->tm_year = (int) (months / 12); + months -= (long long) me->tm_year * 12; + me->tm_mon = (int) months; +} + +// unit is a value according to code table 4.4 of the GRIB2 specification, returns non-zero on error +static int +addToDate(struct tm *me, long long amount, long unit) +{ + switch (unit) + { + case 0: return addSecondsToDate(me, 60 * amount); // minute + case 1: return addSecondsToDate(me, 60 * 60 * amount); // hour + case 2: return addSecondsToDate(me, 24 * 60 * 60 * amount); // day + + case 3: addMonthsToDate(me, amount); return 0; // month + case 4: addMonthsToDate(me, 12 * amount); return 0; // year + case 5: addMonthsToDate(me, 10 * 12 * amount); return 0; // decade + case 6: addMonthsToDate(me, 30 * 12 * amount); return 0; // normal + case 7: addMonthsToDate(me, 100 * 12 * amount); return 0; // century + + case 10: return addSecondsToDate(me, 3 * 60 * 60 * amount); // eighth of a day + case 11: return addSecondsToDate(me, 6 * 60 * 60 * amount); // quarter day + case 12: return addSecondsToDate(me, 12 * 60 * 60 * amount); // half day + case 13: return addSecondsToDate(me, amount); // second + + default: return 1; // reserved, unknown, or missing + } +} + +static char * +makeDateString(struct tm *me) +{ + const size_t length = 4 + 1 + 2 + 1 + 2 + 1 + 2 + 1 + 2 + 1 + 2 + 4 + 1; + char *result = (char *) Malloc(length); + snprintf(result, length, "%04d-%02d-%02dT%02d:%02d:%02d.000", me->tm_year + 1900, me->tm_mon + 1, me->tm_mday, me->tm_hour, + me->tm_min, me->tm_sec); + return result; +} + +// FIXME: This ignores any calendar definition that might be present. +// XXX: Identification templates are not implemented in grib_api-1.12.3, so even if I implemented the other calendars now, it +// wouldn't be possible to use them. +static int +getAvailabilityOfRelativeTimes(grib_handle *gh, bool *outHaveForecastTime, bool *outHaveTimeRange) +{ + switch (gribGetLong(gh, "productDefinitionTemplateNumber")) + { + case 20: + case 30: + case 31: + case 254: + case 311: + case 2000: *outHaveForecastTime = false, *outHaveTimeRange = false; return 0; + + // case 55 and case 40455 are the same: 55 is the proposed standard value, 40455 is the value in the local use range that is + // used by the dwd until the standard is updated. + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 15: + case 32: + case 33: + case 40: + case 41: + case 44: + case 45: + case 48: + case 51: + case 53: + case 54: + case 55: + case 56: + case 57: + case 58: + case 60: + case 1000: + case 1002: + case 1100: + case 40033: + case 40455: + case 40456: *outHaveForecastTime = true, *outHaveTimeRange = false; return 0; + + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + case 14: + case 34: + case 42: + case 43: + case 46: + case 47: + case 61: + case 67: + case 68: + case 91: + case 1001: + case 1101: + case 40034: *outHaveForecastTime = true, *outHaveTimeRange = true; return 0; + + default: return 1; + } +} + +char * +gribMakeTimeString(grib_handle *gh, CdiTimeType timeType) +{ + // Get the parts of the reference date. + struct tm date; + date.tm_mon = (int) gribGetLong(gh, "month") - 1; // months are zero based in struct tm and one based in GRIB + date.tm_mday = (int) gribGetLong(gh, "day"); + date.tm_hour = (int) gribGetLong(gh, "hour"); + date.tm_min = (int) gribGetLong(gh, "minute"); + date.tm_isdst = 0; + + if (gribEditionNumber(gh) == 1) + { + date.tm_year = (int) gribGetLong(gh, "yearOfCentury"); // years are -1900 based both in struct tm and GRIB1 + } + else + { + date.tm_year = (int) gribGetLong(gh, "year") - 1900; // years are -1900 based in struct tm and zero based in GRIB2 + date.tm_sec = (int) gribGetLong(gh, "second"); + + // If the start or end time are requested, we need to take the relative times into account. + if (timeType != kCdiTimeType_referenceTime) + { + // Determine whether we have a forecast time and a time range. + bool haveForecastTime, haveTimeRange; + if (getAvailabilityOfRelativeTimes(gh, &haveForecastTime, &haveTimeRange)) return NULL; + if (timeType == kCdiTimeType_endTime && !haveTimeRange) + return NULL; // tell the caller that the requested time does not exist + + // If we have relative times, apply the relative times to the date + if (haveForecastTime) + { + long offset = gribGetLongDefault(gh, "forecastTime", 0); + // if (stepUnits == indicatorOfUnitOfTimeRange) assert(startStep == forecastTime) + long offsetUnit = gribGetLongDefault(gh, "indicatorOfUnitOfTimeRange", 255); + if (addToDate(&date, offset, offsetUnit)) return NULL; + if (timeType == kCdiTimeType_endTime) + { + assert(haveTimeRange); + long range = gribGetLongDefault(gh, "lengthOfTimeRange", 0); + // if (stepUnits == indicatorOfUnitForTimeRange) assert(endStep == startStep + lengthOfTimeRange) + long rangeUnit = gribGetLongDefault(gh, "indicatorOfUnitForTimeRange", 255); + if (addToDate(&date, range, rangeUnit)) return NULL; + } + } + } + } + + // Bake the date into a string. + return makeDateString(&date); +} + +int +gribapiTimeIsFC(grib_handle *gh) +{ + if (gribEditionNumber(gh) <= 1) return true; + + long sigofrtime; + FAIL_ON_GRIB_ERROR(grib_get_long, gh, "significanceOfReferenceTime", &sigofrtime); + return sigofrtime != 3; +} + +struct cdiGribAPI_ts_str_map_elem cdiGribAPI_ts_str_map[] = { + // clang-format off + [TSTEP_INSTANT] = { 0, "instant" }, + [TSTEP_AVG] = { 8, "avg" }, + [TSTEP_ACCUM] = { 8, "accum" }, + [TSTEP_MAX] = { 8, "max" }, + [TSTEP_MIN] = { 8, "min" }, + [TSTEP_DIFF] = { 8, "diff" }, + [TSTEP_RMS] = { 8, "rms" }, + [TSTEP_SD] = { 8, "sd" }, + [TSTEP_COV] = { 8, "cov" }, + [TSTEP_RATIO] = { 8, "ratio" }, + [TSTEP_SUM] = { 8, "sum" }, + { 0, "" } + // clang-format on +}; + +// Fetches the value of the "stepType" key and converts it into a constant in the TSTEP_* range. +int +gribapiGetTsteptype(grib_handle *gh) +{ + size_t len = 256; + char stepType[256]; + int tsteptype = TSTEP_INSTANT; + static bool lprint = true; + + if (gribapiTimeIsFC(gh)) + { + int status = grib_get_string(gh, "stepType", stepType, &len); + if (status == 0 && len > 1 && len < 256) + { + for (int i = TSTEP_INSTANT; cdiGribAPI_ts_str_map[i].sname[0]; ++i) + if (strncmp(cdiGribAPI_ts_str_map[i].sname, stepType, len) == 0) + { + tsteptype = i; + goto tsteptypeFound; + } + + if (lprint) + { + Message("Time stepType %s unsupported, set to instant!", stepType); + lprint = false; + } + // printf("stepType: %s %ld %d\n", stepType, len, tsteptype); + } + + long typeOfStat; + status = grib_get_long(gh, "typeOfStatisticalProcessing", &typeOfStat); + if (status == 0) + { + switch (typeOfStat) + { + case 0: return TSTEP_AVG; + case 1: return TSTEP_ACCUM; + case 2: return TSTEP_MAX; + case 3: return TSTEP_MIN; + case 4: return TSTEP_DIFF; + case 5: return TSTEP_RMS; + case 6: return TSTEP_SD; + case 7: return TSTEP_COV; + case 9: return TSTEP_RATIO; + case 11: return TSTEP_SUM; + } + } + +#ifdef HIRLAM_EXTENSIONS + { + // Normaly cdo looks in grib for attribute called "stepType", see above. + // BUT NWP models such as Hirlam and Harmonie 37h1.2, use "timeRangeIndicator" instead! + // Where for example: 0: for instanteneous fields; 4: for accumulated fields + // 0: Forecast product valid at reference time + P1 + // 2: Product with a valid time ranging between reference time + P1 and reference time + P2 + // 4: Accumulation (reference time + P1 to reference time + P2) + // 5: Difference(reference time + P2 minus reference time + P1) product considered valid at reference time + P2 + // More details on WMO standards: + // http://www.wmo.int/pages/prog/www/WDM/Guides/Guide-binary-2.html + // tsteptype = TSTEP_INSTANT; // default value for any case + long timeRangeIND = 0; // typically 0: for instanteneous fields; 4: for accumulated fields + int rc = grib_get_long(gh, "timeRangeIndicator", &timeRangeIND); + if (rc != 0) + { + // if ( lprint ) + Warning("Could not get 'stepType' either 'timeRangeIndicator'. Using default!"); + return tsteptype; + } + extern int cdiGribUseTimeRangeIndicator; + cdiGribUseTimeRangeIndicator = 1; + switch (timeRangeIND) + { + case 0: tsteptype = TSTEP_INSTANT; break; + case 2: + tsteptype = TSTEP_INSTANT2; + strcpy(stepType, "instant2"); + break; // was incorrectly set before into accum + case 4: tsteptype = TSTEP_ACCUM; break; + case 5: tsteptype = TSTEP_DIFF; break; + default: + if (lprint) + { + if (CDI_Debug) + Warning("timeRangeIND = %d; stepType= %s; tsteptype=%d unsupported timeRangeIND at the moment, set to instant!", + timeRangeIND, stepType, tsteptype); + lprint = false; + } + break; + } + if (CDI_Debug) Warning("timeRangeIND = %d; stepType= %s; tsteptype=%d", timeRangeIND, stepType, tsteptype); + } +#endif // HIRLAM_EXTENSIONS + } + +tsteptypeFound: + return tsteptype; +} + +int +gribGetDatatype(grib_handle *gribHandle) +{ + int datatype; + if (gribEditionNumber(gribHandle) > 1 && gribCheckString(gribHandle, "packingType", "grid_ieee")) + { + datatype = gribCheckLong(gribHandle, "precision", 1) ? CDI_DATATYPE_FLT32 : CDI_DATATYPE_FLT64; + } + else + { + long bitsPerValue; + datatype = (!grib_get_long(gribHandle, "bitsPerValue", &bitsPerValue) && bitsPerValue > 0 && bitsPerValue <= 32) + ? (int) bitsPerValue + : CDI_DATATYPE_PACK; + } + return datatype; +} + +int +gribapiGetParam(grib_handle *gh) +{ + long pdis, pcat, pnum; + if (gribEditionNumber(gh) <= 1) + { + pdis = 255; + FAIL_ON_GRIB_ERROR(grib_get_long, gh, "table2Version", &pcat); + FAIL_ON_GRIB_ERROR(grib_get_long, gh, "indicatorOfParameter", &pnum); + } + else + { + FAIL_ON_GRIB_ERROR(grib_get_long, gh, "discipline", &pdis); + if (grib_get_long(gh, "parameterCategory", &pcat)) pcat = 0; + if (grib_get_long(gh, "parameterNumber", &pnum)) pnum = 0; + } + return cdiEncodeParam((int) pnum, (int) pcat, (int) pdis); +} + +static bool +has_ni(grib_handle *gh) +{ + return (gribGetLong(gh, "Ni") != (long) GRIB_MISSING_LONG); +} + +int +gribapiGetGridType(grib_handle *gh) +{ + const long gridDefinitionTemplateNumber = gribGetLongDefault(gh, "gridDefinitionTemplateNumber", -1); + switch (gridDefinitionTemplateNumber) + { + case GRIB2_GTYPE_LATLON: return has_ni(gh) ? GRID_LONLAT : GRID_GENERIC; + case GRIB2_GTYPE_GAUSSIAN: return has_ni(gh) ? GRID_GAUSSIAN : GRID_GAUSSIAN_REDUCED; + case GRIB2_GTYPE_LATLON_ROT: return GRID_PROJECTION; + case GRIB2_GTYPE_LCC: return CDI_PROJ_LCC; + case GRIB2_GTYPE_STERE: return CDI_PROJ_STERE; + case GRIB2_GTYPE_SPECTRAL: return GRID_SPECTRAL; + case GRIB2_GTYPE_GME: return GRID_GME; + case GRIB2_GTYPE_UNSTRUCTURED: return GRID_UNSTRUCTURED; + default: + { + static bool lwarn = true; + if (lwarn) + { + lwarn = false; + char mesg[256]; + size_t len = sizeof(mesg); + if (grib_get_string(gh, "gridType", mesg, &len) != 0) mesg[0] = 0; + Warning("gridDefinitionTemplateNumber %d unsupported (gridType=%s)!", gridDefinitionTemplateNumber, mesg); + } + } + } + + return GRID_GENERIC; +} + +static int +gribapiGetIsRotated(grib_handle *gh) +{ + return gribGetLongDefault(gh, "gridDefinitionTemplateNumber", -1) == GRIB2_GTYPE_LATLON_ROT; +} + +size_t +gribapiGetGridsize(grib_handle *gh) +{ + size_t gridsize; + FAIL_ON_GRIB_ERROR(grib_get_size, gh, "values", &gridsize); + return gridsize; +} + +static void +gribapiGetGridGaussianReduced(grib_handle *gh, grid_t *grid, int editionNumber, size_t numberOfPoints) +{ + long lpar; + FAIL_ON_GRIB_ERROR(grib_get_long, gh, "numberOfParallelsBetweenAPoleAndTheEquator", &lpar); + grid->np = (int) lpar; + + FAIL_ON_GRIB_ERROR(grib_get_long, gh, "Nj", &lpar); + size_t nlat = (size_t) lpar; + + grid->size = numberOfPoints; + + grid->reducedPointsSize = (int) nlat; + grid->reducedPoints = (int *) Malloc(nlat * sizeof(int)); + long *pl = (long *) Malloc(nlat * sizeof(long)); + size_t dummy = nlat; + FAIL_ON_GRIB_ERROR(grib_get_long_array, gh, "pl", pl, &dummy); + for (size_t i = 0; i < nlat; ++i) grid->reducedPoints[i] = (int) pl[i]; + Free(pl); + + grid->y.size = nlat; + grid->x.inc = 0; + grid->y.inc = 0; + grid->x.flag = 0; + FAIL_ON_GRIB_ERROR(grib_get_double, gh, "longitudeOfFirstGridPointInDegrees", &grid->x.first); + FAIL_ON_GRIB_ERROR(grib_get_double, gh, "longitudeOfLastGridPointInDegrees", &grid->x.last); + FAIL_ON_GRIB_ERROR(grib_get_double, gh, "latitudeOfFirstGridPointInDegrees", &grid->y.first); + FAIL_ON_GRIB_ERROR(grib_get_double, gh, "latitudeOfLastGridPointInDegrees", &grid->y.last); + + // FAIL_ON_GRIB_ERROR(grib_get_double, gh, "iDirectionIncrementInDegrees", &grid->x.inc); + // if ( IS_EQUAL(grid->x.inc, GRIB_MISSING_DOUBLE) ) grid->x.inc = 0; + + if (grid->x.last < grid->x.first) + { + if (grid->x.first >= 180.0) + grid->x.first -= 360.0; + else + grid->x.last += 360.0; + } + + grid->x.flag = 2; + + grid->y.flag = 0; + // if (IS_NOT_EQUAL(grid->y.first, 0) || IS_NOT_EQUAL(grid->y.last, 0)) + { + if (grid->y.size > 1) + { + if (editionNumber <= 1) + { + } + } + grid->y.flag = 2; + } +} + +static void +gribapiGetGridRegular(grib_handle *gh, grid_t *grid, int editionNumber, int gridtype, size_t numberOfPoints) +{ + long lpar; + FAIL_ON_GRIB_ERROR(grib_get_long, gh, "Ni", &lpar); + const size_t nlon = (size_t) lpar; + FAIL_ON_GRIB_ERROR(grib_get_long, gh, "Nj", &lpar); + const size_t nlat = (size_t) lpar; + + if (gridtype == GRID_GAUSSIAN) + { + FAIL_ON_GRIB_ERROR(grib_get_long, gh, "numberOfParallelsBetweenAPoleAndTheEquator", &lpar); + grid->np = (int) lpar; + } + + if (numberOfPoints != nlon * nlat) Error("numberOfPoints (%zu) and gridSize (%zu) differ!", numberOfPoints, nlon * nlat); + + grid->size = numberOfPoints; + grid->x.size = nlon; + grid->y.size = nlat; + grid->x.inc = 0; + grid->y.inc = 0; + grid->x.flag = 0; + FAIL_ON_GRIB_ERROR(grib_get_double, gh, "longitudeOfFirstGridPointInDegrees", &grid->x.first); + FAIL_ON_GRIB_ERROR(grib_get_double, gh, "longitudeOfLastGridPointInDegrees", &grid->x.last); + FAIL_ON_GRIB_ERROR(grib_get_double, gh, "latitudeOfFirstGridPointInDegrees", &grid->y.first); + FAIL_ON_GRIB_ERROR(grib_get_double, gh, "latitudeOfLastGridPointInDegrees", &grid->y.last); + if (nlon > 1) FAIL_ON_GRIB_ERROR(grib_get_double, gh, "iDirectionIncrementInDegrees", &grid->x.inc); + if (gridtype == GRID_LONLAT && nlat > 1) FAIL_ON_GRIB_ERROR(grib_get_double, gh, "jDirectionIncrementInDegrees", &grid->y.inc); + + long iscan = 0, jscan = 0; + FAIL_ON_GRIB_ERROR(grib_get_long, gh, "iScansNegatively", &iscan); + FAIL_ON_GRIB_ERROR(grib_get_long, gh, "jScansPositively", &jscan); + if (iscan) grid->x.inc = -grid->x.inc; + if (!jscan) grid->y.inc = -grid->y.inc; + + if (grid->x.inc < -999 || grid->x.inc > 999) grid->x.inc = 0; + if (grid->y.inc < -999 || grid->y.inc > 999) grid->y.inc = 0; + + // if ( IS_NOT_EQUAL(grid->x.first, 0) || IS_NOT_EQUAL(grid->x.last, 0) ) + { + if (grid->x.size > 1) + { + // if ( editionNumber <= 1 ) + { + if (grid->x.last < grid->x.first) + { + if (grid->x.first >= 180) + grid->x.first -= 360; + else + grid->x.last += 360; + } + + // correct xinc if necessary + if (IS_EQUAL(grid->x.first, 0) && grid->x.last > 354 && grid->x.last < 360) + { + double xinc = 360. / grid->x.size; + if (fabs(grid->x.inc - xinc) > 0.0) + { + grid->x.inc = xinc; + if (CDI_Debug) Message("set xinc to %g", grid->x.inc); + } + } + } + } + grid->x.flag = 2; + } + + grid->y.flag = 0; + // if ( IS_NOT_EQUAL(grid->y.first, 0) || IS_NOT_EQUAL(grid->y.last, 0) ) + { + if (grid->y.size > 1) + { + if (editionNumber <= 1) + { + } + } + grid->y.flag = 2; + } +} + +static void +gribapiGetGridProj(grib_handle *gh, grid_t *grid, size_t numberOfPoints) +{ + long lpar; + FAIL_ON_GRIB_ERROR(grib_get_long, gh, "Nx", &lpar); + const size_t nlon = (size_t) lpar; + FAIL_ON_GRIB_ERROR(grib_get_long, gh, "Ny", &lpar); + const size_t nlat = (size_t) lpar; + + if (numberOfPoints != nlon * nlat) Error("numberOfPoints (%zu) and gridSize (%zu) differ!", numberOfPoints, nlon * nlat); + + grid->size = numberOfPoints; + grid->x.size = nlon; + grid->y.size = nlat; + + double xinc, yinc; + FAIL_ON_GRIB_ERROR(grib_get_double, gh, "DxInMetres", &xinc); + FAIL_ON_GRIB_ERROR(grib_get_double, gh, "DyInMetres", &yinc); + + grid->x.first = 0; + grid->x.last = 0; + grid->x.inc = xinc; + grid->y.first = 0; + grid->y.last = 0; + grid->y.inc = yinc; + grid->x.flag = 2; + grid->y.flag = 2; +} + +static void +gribapiGetGridSpectral(grib_handle *gh, grid_t *grid, size_t datasize) +{ + size_t len = 256; + char typeOfPacking[256]; + FAIL_ON_GRIB_ERROR(grib_get_string, gh, "packingType", typeOfPacking, &len); + grid->lcomplex = 0; + if (strncmp(typeOfPacking, "spectral_complex", len) == 0) grid->lcomplex = 1; + + grid->size = datasize; + + long lpar; + FAIL_ON_GRIB_ERROR(grib_get_long, gh, "J", &lpar); + grid->trunc = (int) lpar; +} + +static void +gribapiGetGridGME(grib_handle *gh, grid_t *grid, size_t numberOfPoints) +{ + grid->size = numberOfPoints; + + long lpar; + if (grib_get_long(gh, "nd", &lpar) == 0) grid->gme.nd = (int) lpar; + if (grib_get_long(gh, "Ni", &lpar) == 0) grid->gme.ni = (int) lpar; + if (grib_get_long(gh, "n2", &lpar) == 0) grid->gme.ni2 = (int) lpar; + if (grib_get_long(gh, "n3", &lpar) == 0) grid->gme.ni3 = (int) lpar; +} + +static void +gribapiGetGridUnstructured(grib_handle *gh, grid_t *grid, size_t numberOfPoints) +{ + unsigned char uuid[CDI_UUID_SIZE]; + /* + char reference_link[8192]; + size_t len = sizeof(reference_link); + reference_link[0] = 0; + */ + grid->size = numberOfPoints; + + long lpar; + if (grib_get_long(gh, "numberOfGridUsed", &lpar) == 0) + { + cdiDefVarKeyInt(&grid->keys, CDI_KEY_NUMBEROFGRIDUSED, (int) lpar); + if (grib_get_long(gh, "numberOfGridInReference", &lpar) == 0) + cdiDefVarKeyInt(&grid->keys, CDI_KEY_NUMBEROFGRIDINREFERENCE, (int) lpar); + /* + if ( grib_get_string(gh, "gridDescriptionFile", reference_link, &len) == 0 ) + { + if ( strncmp(reference_link, "file://", 7) == 0 ) + grid->reference = strdupx(reference_link); + } + */ + size_t len = (size_t) CDI_UUID_SIZE; + if (grib_get_bytes(gh, "uuidOfHGrid", uuid, &len) == 0) cdiDefVarKeyBytes(&grid->keys, CDI_KEY_UUID, uuid, CDI_UUID_SIZE); + } +} + +static void +gribapiGetGridGeneric(grib_handle *gh, grid_t *grid, size_t numberOfPoints) +{ + long lpar; + const size_t nlon = (grib_get_long(gh, "Ni", &lpar) == 0) ? (size_t) lpar : 0; + const size_t nlat = (grib_get_long(gh, "Nj", &lpar) == 0) ? (size_t) lpar : 0; + + grid->size = numberOfPoints; + + const bool lgeneric = (nlon > 0 && nlat > 0 && nlon * nlat == numberOfPoints); + grid->x.size = lgeneric ? nlon : 0; + grid->y.size = lgeneric ? nlat : 0; +} + +// TODO: Simplify by use of the convenience functions (gribGetLong(), gribGetLongDefault(), etc.). +bool +gribapiGetGrid(grib_handle *gh, grid_t *grid) +{ + bool uvRelativeToGrid = false; + const long editionNumber = gribEditionNumber(gh); + int gridtype = gribapiGetGridType(gh); + int projtype = (gridtype == GRID_PROJECTION && gribapiGetIsRotated(gh)) ? CDI_PROJ_RLL : CDI_UNDEFID; + if (gridtype == CDI_PROJ_LCC || gridtype == CDI_PROJ_STERE) + { + projtype = gridtype; + gridtype = GRID_PROJECTION; + } + /* + if ( streamptr->unreduced && gridtype == GRID_GAUSSIAN_REDUCED ) + { + gridtype = GRID_GAUSSIAN; + ISEC2_NumLon = 2*ISEC2_NumLat; + ISEC4_NumValues = ISEC2_NumLon*ISEC2_NumLat; + } + */ + grid_init(grid); + cdiGridTypeInit(grid, gridtype, 0); + + size_t datasize; + FAIL_ON_GRIB_ERROR(grib_get_size, gh, "values", &datasize); + long lpar; + FAIL_ON_GRIB_ERROR(grib_get_long, gh, "numberOfPoints", &lpar); + size_t numberOfPoints = (size_t) lpar; + + if (gridtype == GRID_LONLAT || gridtype == GRID_GAUSSIAN || projtype == CDI_PROJ_RLL) + { + gribapiGetGridRegular(gh, grid, editionNumber, gridtype, numberOfPoints); + } + else if (gridtype == GRID_GAUSSIAN_REDUCED) + { + gribapiGetGridGaussianReduced(gh, grid, editionNumber, numberOfPoints); + } + else if (projtype == CDI_PROJ_LCC) + { + gribapiGetGridProj(gh, grid, numberOfPoints); + } + else if (projtype == CDI_PROJ_STERE) + { + gribapiGetGridProj(gh, grid, numberOfPoints); + } + else if (gridtype == GRID_SPECTRAL) + { + gribapiGetGridSpectral(gh, grid, datasize); + } + else if (gridtype == GRID_GME) + { + gribapiGetGridGME(gh, grid, numberOfPoints); + } + else if (gridtype == GRID_UNSTRUCTURED) + { + gribapiGetGridUnstructured(gh, grid, numberOfPoints); + } + else if (gridtype == GRID_GENERIC) + { + gribapiGetGridGeneric(gh, grid, numberOfPoints); + } + else + { + Error("Unsupported grid type: %s", gridNamePtr(gridtype)); + } + + if (gridtype == GRID_GAUSSIAN || gridtype == GRID_LONLAT || projtype == CDI_PROJ_RLL || projtype == CDI_PROJ_LCC) + { + long temp; + GRIB_CHECK(grib_get_long(gh, "uvRelativeToGrid", &temp), 0); + assert(temp == 0 || temp == 1); + uvRelativeToGrid = (bool) temp; + } + + if (gridtype == GRID_GAUSSIAN || gridtype == GRID_LONLAT || gridtype == GRID_PROJECTION) + { + long iScansNegatively, jScansPositively, jPointsAreConsecutive; + GRIB_CHECK(grib_get_long(gh, "iScansNegatively", &iScansNegatively), 0); + GRIB_CHECK(grib_get_long(gh, "jScansPositively", &jScansPositively), 0); + GRIB_CHECK(grib_get_long(gh, "jPointsAreConsecutive", &jPointsAreConsecutive), 0); + + int scanningMode = 128 * iScansNegatively + 64 * jScansPositively + 32 * jPointsAreConsecutive; + cdiDefVarKeyInt(&grid->keys, CDI_KEY_SCANNINGMODE, scanningMode); + /* scanningMode = 128 * iScansNegatively + 64 * jScansPositively + 32 * jPointsAreConsecutive; + 64 = 128 * 0 + 64 * 1 + 32 * 0 + 00 = 128 * 0 + 64 * 0 + 32 * 0 + 96 = 128 * 0 + 64 * 1 + 32 * 1 + Default / implicit scanning mode is 64: + i and j scan positively, i points are consecutive (row-major) */ +#ifdef HIRLAM_EXTENSIONS + if (cdiDebugExt >= 30 && gribEditionNumber(gh) <= 1) + { + // indicatorOfParameter=33,indicatorOfTypeOfLevel=105,level + long paramId, levelTypeId, levelId; + GRIB_CHECK(grib_get_long(gh, "indicatorOfParameter", ¶mId), 0); + GRIB_CHECK(grib_get_long(gh, "indicatorOfTypeOfLevel", &levelTypeId), 0); + GRIB_CHECK(grib_get_long(gh, "level", &levelId), 0); + Message("(param,ltype,level) = (%3d,%3d,%4d); Scanning mode = %02d -> bits:(%1d.%1d.%1d)*32; uvRelativeToGrid = %02d", + (int) paramId, (int) levelTypeId, (int) levelId, scanningMode, jPointsAreConsecutive, jScansPositively, + iScansNegatively, uvRelativeToGrid); + } +#endif // HIRLAM_EXTENSIONS + } + + grid->type = gridtype; + grid->projtype = projtype; + + return uvRelativeToGrid; +} +#endif +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifndef CDI_UUID_H +#define CDI_UUID_H + +#ifdef HAVE_CONFIG_H +#endif + + +// clang-format off +#ifdef __cplusplus +extern "C" { +#endif + +enum { + uuidNumHexChars = 36, +}; + +static inline +int cdiUUIDIsNull(const unsigned char uuid[]) +{ + int isNull = 1; + for (size_t i = 0; i < CDI_UUID_SIZE; ++i) isNull &= (uuid[i] == 0); + return isNull; +} + +void cdiCreateUUID(unsigned char uuid[CDI_UUID_SIZE]); + +int cdiUUID2Str(const unsigned char uuid[], char uuidstr[]); +int cdiStr2UUID(const char *uuidstr, unsigned char uuid[]); + +#ifdef __cplusplus +} +#endif +// clang-format on + +#endif +#ifndef RESOURCE_UNPACK_H +#define RESOURCE_UNPACK_H + +#ifdef HAVE_CONFIG_H +#endif + +enum +{ + GRID = 1, + ZAXIS = 2, + TAXIS = 3, + INSTITUTE = 4, + MODEL = 5, + STREAM = 6, + VLIST = 7, + DIST_GRID = 8, + RESH_DELETE, + START = 55555555, + END = 99999999 +}; + +typedef void (*cdiPostResUpdateHook)(int resH, int resType); + +int reshUnpackResources(char *unpackBuffer, int unpackBufferSize, void *context, cdiPostResUpdateHook postHook); + +extern int (*reshDistGridUnpack)(char *unpackBuffer, int unpackBufferSize, int *unpackBufferPos, int originNamespace, void *context, + int force_id); +#endif + +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifndef VLIST_H +#define VLIST_H + +#ifdef HAVE_CONFIG_H +#endif + +#ifndef ERROR_H +#endif + +#include <stdbool.h> +#include <stddef.h> /* size_t */ + +#ifndef CDI_LIMITS_H +#endif + +#define VALIDMISS 1.e+303 + + +typedef struct +{ + bool flag; + int index; + int mlevelID; + int flevelID; +} levinfo_t; + +#define DEFAULT_LEVINFO(levID) \ + (levinfo_t) { 0, -1, levID, levID } +/* +#define DEFAULT_LEVINFO(levID) \ + (levinfo_t){ .flag = 0, .index = -1, .flevelID = levID, .mlevelID = levID} +*/ +typedef struct +{ + int ens_index; + int ens_count; + int forecast_init_type; +} ensinfo_t; + +typedef struct +{ + bool isUsed; + bool flag; + bool lvalidrange; + signed char xyz; /* order of spatial dimensions, + * a permutation of 123 */ + bool missvalused; // true if missval is defined + int mvarID; + int fvarID; + int param; + int gridID; + int zaxisID; + int timetype; // TIME_* + int tsteptype; // TSTEP_* + int datatype; // CDI_DATATYPE_PACKX for GRIB data, else CDI_DATATYPE_FLT32 or CDI_DATATYPE_FLT64 + int instID; + int modelID; + int tableID; + int timave; + int nsb; // Number of significant bits + double missval; + double validrange[2]; + levinfo_t *levinfo; + int comptype; // compression type + int complevel; // compression level + cdi_keys_t keys; + cdi_atts_t atts; + int subtypeID; // subtype ID for tile-related meta-data, currently for GRIB-API only. + + int opt_grib_nentries; // current no. key-value pairs + int opt_grib_kvpair_size; // current allocated size + opt_key_val_pair_t *opt_grib_kvpair; // (optional) list of keyword/value pairs +} var_t; + +typedef struct +{ + // set when a vlist is passed to streamDefVlist() to safeguard against modifications of the wrong vlist object + bool immutable; + // set if this vlist has been created by CDI itself, and must not be destroyed by the user, consequently + bool internal; + int self; + int nvars; // number of variables + int ngrids; + int nzaxis; + int nsubtypes; // no. of variable subtypes (e.g. sets of tiles) + long ntsteps; + int taxisID; + int tableID; + int instID; + int modelID; + int varsAllocated; + int gridIDs[MAX_GRIDS_PS]; + int zaxisIDs[MAX_ZAXES_PS]; + int subtypeIDs[MAX_SUBTYPES_PS]; + var_t *vars; + cdi_keys_t keys; + cdi_atts_t atts; +} vlist_t; + +vlist_t *vlist_to_pointer(int vlistID); +void cdiVlistMakeInternal(int vlistID); +void cdiVlistMakeImmutable(int vlistID); +void cdiVlistDestroy_(int vlistID, bool assertInternal); +int vlistInqVarMissvalUsed(int vlistID, int varID); +int vlistHasTime(int vlistID); + +int vlistUnpack(char *buffer, int bufferSize, int *pos, int originNamespace, void *context, int force_id); + +/* vlistDefVarValidrange: Define the valid range of a Variable */ +void vlistDefVarValidrange(int vlistID, int varID, const double *validrange); + +/* vlistInqVarValidrange: Get the valid range of a Variable */ +int vlistInqVarValidrange(int vlistID, int varID, double *validrange); + +void vlistInqVarDimorder(int vlistID, int varID, int outDimorder[3]); + +void resize_opt_grib_entries(var_t *var, int nentries); + +static inline void +vlistAdd2GridIDs(vlist_t *vlistptr, int gridID) +{ + int index, ngrids = vlistptr->ngrids; + for (index = 0; index < ngrids; index++) + { + if (vlistptr->gridIDs[index] == gridID) break; + // if ( gridIsEqual(vlistptr->gridIDs[index], gridID) ) break; + } + + if (index == ngrids) + { + if (ngrids >= MAX_GRIDS_PS) Error("Internal limit exceeded: more than %d grids.", MAX_GRIDS_PS); + vlistptr->gridIDs[ngrids] = gridID; + ++(vlistptr->ngrids); + } +} + +static inline void +vlistAdd2ZaxisIDs(vlist_t *vlistptr, int zaxisID) +{ + int index, nzaxis = vlistptr->nzaxis; + for (index = 0; index < nzaxis; index++) + if (zaxisID == vlistptr->zaxisIDs[index]) break; + + if (index == nzaxis) + { + if (nzaxis >= MAX_ZAXES_PS) Error("Internal limit exceeded: more than %d zaxis.", MAX_ZAXES_PS); + vlistptr->zaxisIDs[nzaxis] = zaxisID; + ++(vlistptr->nzaxis); + } +} + +static inline void +vlistAdd2SubtypeIDs(vlist_t *vlistptr, int subtypeID) +{ + if (subtypeID == CDI_UNDEFID) return; + + int index, nsubs = vlistptr->nsubtypes; + for (index = 0; index < nsubs; index++) + if (vlistptr->subtypeIDs[index] == subtypeID) break; + + if (index == nsubs) + { + if (nsubs >= MAX_SUBTYPES_PS) Error("Internal limit exceeded: more than %d subs.", MAX_SUBTYPES_PS); + vlistptr->subtypeIDs[nsubs] = subtypeID; + ++(vlistptr->nsubtypes); + } +} + +#ifdef HAVE_LIBGRIB_API +extern int cdiNAdditionalGRIBKeys; +extern char *cdiAdditionalGRIBKeys[]; +#endif + +extern +#ifndef __cplusplus + const +#endif + resOps vlistOps; + +#endif /* VLIST_H */ +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifdef HAVE_CONFIG_H +#endif + +#include <assert.h> +#include <string.h> + + +int (*proj_lonlat_to_lcc_func)(struct CDI_GridProjParams gpp, size_t, double *, double *) = NULL; +int (*proj_lcc_to_lonlat_func)(struct CDI_GridProjParams gpp, double, double, size_t, double *, double *) = NULL; +int (*proj_lonlat_to_stere_func)(struct CDI_GridProjParams gpp, size_t, double *, double *) = NULL; +int (*proj_stere_to_lonlat_func)(struct CDI_GridProjParams gpp, double, double, size_t, double *, double *) = NULL; + +// the value in the second pair of brackets must match the length of the longest string (including terminating NUL) +static const char Grids[][17] = { + /* 0 */ "undefined", + /* 1 */ "generic", + /* 2 */ "gaussian", + /* 3 */ "gaussian_reduced", + /* 4 */ "lonlat", + /* 5 */ "spectral", + /* 6 */ "fourier", + /* 7 */ "gme", + /* 8 */ "trajectory", + /* 9 */ "unstructured", + /* 10 */ "curvilinear", + /* 11 */ "lcc", + /* 12 */ "projection", + /* 13 */ "characterXY", +}; + +// must match table below +enum xystdname_idx +{ + grid_xystdname_grid_latlon, + grid_xystdname_latlon, + grid_xystdname_projection, + grid_xystdname_char, +}; +static const char xystdname_tab[][2][24] = { + [grid_xystdname_grid_latlon] = { "grid_longitude", "grid_latitude" }, + [grid_xystdname_latlon] = { "longitude", "latitude" }, + [grid_xystdname_projection] = { "projection_x_coordinate", "projection_y_coordinate" }, + [grid_xystdname_char] = { "region", "region" }, +}; + +static int gridCompareP(void *gridptr1, void *gridptr2); +static void gridDestroyP(void *gridptr); +static void gridPrintP(void *gridptr, FILE *fp); +static int gridGetPackSize(void *gridptr, void *context); +static void gridPack(void *gridptr, void *buff, int size, int *position, void *context); +static int gridTxCode(void *gridptr); + +static const resOps gridOps = { gridCompareP, gridDestroyP, gridPrintP, gridGetPackSize, gridPack, gridTxCode }; + +grid_t * +grid_to_pointer(int gridID) +{ + return (grid_t *) reshGetVal(gridID, &gridOps); +} + +#define gridMark4Update(gridID) reshSetStatus(gridID, &gridOps, RESH_DESYNC_IN_USE) + +static inline bool +grid_is_irregular(int gridType) +{ + return (gridType == GRID_UNSTRUCTURED || gridType == GRID_CURVILINEAR); +} + +static bool +cdiInqAttConvertedToFloat(int gridID, int atttype, const char *attname, int attlen, double *attflt) +{ + bool status = true; + + if (atttype == CDI_DATATYPE_INT32) + { + int attint; + int *pattint = attlen > 1 ? (int *) malloc(attlen * sizeof(int)) : &attint; + cdiInqAttInt(gridID, CDI_GLOBAL, attname, attlen, pattint); + for (int i = 0; i < attlen; ++i) attflt[i] = (double) pattint[i]; + if (attlen > 1) free(pattint); + } + else if (atttype == CDI_DATATYPE_FLT32 || atttype == CDI_DATATYPE_FLT64) + { + cdiInqAttFlt(gridID, CDI_GLOBAL, attname, attlen, attflt); + } + else + { + status = false; + } + + return status; +} + +static void +grid_axis_init(struct gridaxis_t *axisptr) +{ + axisptr->size = 0; + axisptr->vals = NULL; + axisptr->bounds = NULL; + axisptr->flag = 0; + axisptr->first = 0.0; + axisptr->last = 0.0; + axisptr->inc = 0.0; +#ifndef USE_MPI + axisptr->clength = 0; + axisptr->cvals = NULL; +#endif + cdiInitKeys(&axisptr->keys); +} + +enum cdiApplyRet +cdiGridApply(enum cdiApplyRet (*func)(int id, void *res, void *data), void *data) +{ + return cdiResHFilterApply(&gridOps, func, data); +} + +void +grid_init(grid_t *gridptr) +{ + gridptr->self = CDI_UNDEFID; + gridptr->type = CDI_UNDEFID; + gridptr->datatype = CDI_UNDEFID; + gridptr->proj = CDI_UNDEFID; + gridptr->projtype = CDI_UNDEFID; + gridptr->mask = NULL; + gridptr->mask_gme = NULL; + gridptr->size = 0; + + grid_axis_init(&gridptr->x); + grid_axis_init(&gridptr->y); + + gridptr->area = NULL; + gridptr->reducedPoints = NULL; + gridptr->reducedPointsSize = 0; + + gridptr->gme.nd = 0; + gridptr->gme.ni = 0; + gridptr->gme.ni2 = 0; + gridptr->gme.ni3 = 0; + + gridptr->trunc = 0; + gridptr->nvertex = 0; + gridptr->np = 0; + gridptr->isCyclic = CDI_UNDEFID; + + gridptr->lcomplex = false; + gridptr->hasdims = true; + gridptr->name = NULL; + gridptr->vtable = &cdiGridVtable; + + cdiInitKeys(&gridptr->keys); + gridptr->atts.nalloc = MAX_ATTRIBUTES; + gridptr->atts.nelems = 0; + + cdiDefVarKeyInt(&gridptr->keys, CDI_KEY_DATATYPE, CDI_DATATYPE_FLT64); + + gridptr->extraData = NULL; +} + +static void +grid_free_components(grid_t *gridptr) +{ + void *p2free[] = { gridptr->mask, gridptr->mask_gme, gridptr->x.vals, gridptr->y.vals, +#ifndef USE_MPI + gridptr->x.cvals, gridptr->y.cvals, +#endif + gridptr->x.bounds, gridptr->y.bounds, gridptr->reducedPoints, gridptr->area, gridptr->name }; + + for (size_t i = 0; i < sizeof(p2free) / sizeof(p2free[0]); ++i) + if (p2free[i]) Free(p2free[i]); + + cdiDeleteVarKeys(&(gridptr->x.keys)); + cdiDeleteVarKeys(&(gridptr->y.keys)); + cdiDeleteVarKeys(&(gridptr->keys)); + /* + int gridID = gridptr->self; + if (gridID != CDI_UNDEFID) cdiDeleteAtts(gridID, CDI_GLOBAL); + */ +} + +void +grid_free(grid_t *gridptr) +{ + if (gridptr) + { + grid_free_components(gridptr); + grid_init(gridptr); + } +} + +static grid_t * +gridNewEntry(cdiResH resH) +{ + grid_t *gridptr = (grid_t *) Malloc(sizeof(grid_t)); + grid_init(gridptr); + + if (resH == CDI_UNDEFID) + gridptr->self = reshPut(gridptr, &gridOps); + else + { + gridptr->self = resH; + reshReplace(resH, gridptr, &gridOps); + } + + return gridptr; +} + +static void +gridInit(void) +{ + static bool gridInitialized = false; + if (gridInitialized) return; + gridInitialized = true; +} + +static void +grid_copy_base_scalar_fields(grid_t *gridptrOrig, grid_t *gridptrDup) +{ + memcpy(gridptrDup, gridptrOrig, sizeof(grid_t)); + gridptrDup->self = CDI_UNDEFID; + cdiInitKeys(&gridptrDup->keys); + cdiCopyVarKeys(&gridptrOrig->keys, &gridptrDup->keys); + cdiInitKeys(&gridptrDup->x.keys); + cdiCopyVarKeys(&gridptrOrig->x.keys, &gridptrDup->x.keys); + cdiInitKeys(&gridptrDup->y.keys); + cdiCopyVarKeys(&gridptrOrig->y.keys, &gridptrDup->y.keys); +} + +static grid_t * +grid_copy_base(grid_t *gridptrOrig) +{ + grid_t *gridptrDup = (grid_t *) Malloc(sizeof(*gridptrDup)); + gridptrOrig->vtable->copyScalarFields(gridptrOrig, gridptrDup); + gridptrOrig->vtable->copyArrayFields(gridptrOrig, gridptrDup); + return gridptrDup; +} + +unsigned +cdiGridCount(void) +{ + return reshCountType(&gridOps); +} + +static inline void +gridaxisSetKey(struct gridaxis_t *axisptr, int key, const char *name) +{ + if (find_key(&axisptr->keys, key) == NULL) + cdiDefVarKeyBytes(&axisptr->keys, key, (const unsigned char *) name, (int) strlen(name) + 1); +} + +void +cdiGridTypeInit(grid_t *gridptr, int gridtype, size_t size) +{ + gridptr->type = gridtype; + gridptr->size = size; + + // clang-format off + if (gridtype == GRID_LONLAT) gridptr->nvertex = 2; + else if (gridtype == GRID_GAUSSIAN) gridptr->nvertex = 2; + else if (gridtype == GRID_GAUSSIAN_REDUCED) gridptr->nvertex = 2; + else if (gridtype == GRID_CURVILINEAR) gridptr->nvertex = 4; + else if (gridtype == GRID_UNSTRUCTURED) gridptr->x.size = size; + // clang-format on + + switch (gridtype) + { + case GRID_LONLAT: + case GRID_GAUSSIAN: + case GRID_GAUSSIAN_REDUCED: + case GRID_TRAJECTORY: + case GRID_CURVILINEAR: + case GRID_UNSTRUCTURED: + case GRID_GME: + { + if (gridtype == GRID_TRAJECTORY) + { + gridaxisSetKey(&gridptr->x, CDI_KEY_NAME, "tlon"); + gridaxisSetKey(&gridptr->y, CDI_KEY_NAME, "tlat"); + } + else + { + gridaxisSetKey(&gridptr->x, CDI_KEY_NAME, "lon"); + gridaxisSetKey(&gridptr->y, CDI_KEY_NAME, "lat"); + } + + gridaxisSetKey(&gridptr->x, CDI_KEY_LONGNAME, "longitude"); + gridaxisSetKey(&gridptr->y, CDI_KEY_LONGNAME, "latitude"); + + gridaxisSetKey(&gridptr->x, CDI_KEY_UNITS, "degrees_east"); + gridaxisSetKey(&gridptr->y, CDI_KEY_UNITS, "degrees_north"); + + gridaxisSetKey(&gridptr->x, CDI_KEY_STDNAME, xystdname_tab[grid_xystdname_latlon][0]); + gridaxisSetKey(&gridptr->y, CDI_KEY_STDNAME, xystdname_tab[grid_xystdname_latlon][1]); + + break; + } +#ifndef USE_MPI + case GRID_CHARXY: + { + if (gridptr->x.cvals) gridaxisSetKey(&gridptr->x, CDI_KEY_STDNAME, xystdname_tab[grid_xystdname_char][0]); + if (gridptr->y.cvals) gridaxisSetKey(&gridptr->y, CDI_KEY_STDNAME, xystdname_tab[grid_xystdname_char][1]); + + break; + } +#endif + case GRID_GENERIC: + case GRID_PROJECTION: + { + gridaxisSetKey(&gridptr->x, CDI_KEY_NAME, "x"); + gridaxisSetKey(&gridptr->y, CDI_KEY_NAME, "y"); + if (gridtype == GRID_PROJECTION) + { + gridaxisSetKey(&gridptr->x, CDI_KEY_STDNAME, xystdname_tab[grid_xystdname_projection][0]); + gridaxisSetKey(&gridptr->y, CDI_KEY_STDNAME, xystdname_tab[grid_xystdname_projection][1]); + gridaxisSetKey(&gridptr->x, CDI_KEY_UNITS, "m"); + gridaxisSetKey(&gridptr->y, CDI_KEY_UNITS, "m"); + } + break; + } + } +} + +// used also in CDO +void +gridGenXvals(int xsize, double xfirst, double xlast, double xinc, double *restrict xvals) +{ + if (fabs(xinc) <= 0 && xsize > 1) + { + if (xfirst >= xlast) + { + while (xfirst >= xlast) xlast += 360; + xinc = (xlast - xfirst) / (xsize); + } + else + { + xinc = (xlast - xfirst) / (xsize - 1); + } + } + + for (int i = 0; i < xsize; ++i) xvals[i] = xfirst + i * xinc; +} + +static void +calc_gaussgrid(double *restrict yvals, int ysize, double yfirst, double ylast) +{ + double *restrict yw = (double *) malloc((size_t) ysize * sizeof(double)); + gaussianLatitudes((size_t) ysize, yvals, yw); + free(yw); + for (int i = 0; i < ysize; i++) yvals[i] = asin(yvals[i]) / M_PI * 180.0; + + if (yfirst < ylast && yfirst > -90.0 && ylast < 90.0) + { + int yhsize = ysize / 2; + for (int i = 0; i < yhsize; i++) + { + const double ytmp = yvals[i]; + yvals[i] = yvals[ysize - i - 1]; + yvals[ysize - i - 1] = ytmp; + } + } +} + +static void +gridGenYvalsGaussian(int ysize, double yfirst, double ylast, double *restrict yvals) +{ + const double deleps = 0.002; + + calc_gaussgrid(yvals, ysize, yfirst, ylast); + + if (!(IS_EQUAL(yfirst, 0) && IS_EQUAL(ylast, 0))) + if (fabs(yvals[0] - yfirst) > deleps || fabs(yvals[ysize - 1] - ylast) > deleps) + { + bool lfound = false; + int ny = (int) (180. / (fabs(ylast - yfirst) / (ysize - 1)) + 0.5); + ny -= ny % 2; + if (ny > ysize && ny < 4096) + { + double *ytmp = (double *) Malloc((size_t) ny * sizeof(double)); + calc_gaussgrid(ytmp, ny, yfirst, ylast); + + int i; + for (i = 0; i < (ny - ysize); i++) + if (fabs(ytmp[i] - yfirst) < deleps) break; + int nstart = i; + + lfound = (nstart + ysize - 1) < ny && fabs(ytmp[nstart + ysize - 1] - ylast) < deleps; + if (lfound) + { + for (i = 0; i < ysize; i++) yvals[i] = ytmp[i + nstart]; + } + + if (ytmp) Free(ytmp); + } + + if (!lfound) + { + Warning("Cannot calculate gaussian latitudes for lat1 = %g latn = %g!", yfirst, ylast); + for (int i = 0; i < ysize; i++) yvals[i] = 0; + yvals[0] = yfirst; + yvals[ysize - 1] = ylast; + } + } +} + +static void +gridGenYvalsRegular(int ysize, double yfirst, double ylast, double yinc, double *restrict yvals) +{ + if (fabs(yinc) <= 0 && ysize > 1) + { + if (IS_EQUAL(yfirst, ylast) && IS_NOT_EQUAL(yfirst, 0)) ylast *= -1; + + if (yfirst > ylast) + yinc = (yfirst - ylast) / (ysize - 1); + else if (yfirst < ylast) + yinc = (ylast - yfirst) / (ysize - 1); + else + { + if (ysize % 2 != 0) + { + yinc = 180.0 / (ysize - 1); + yfirst = -90; + } + else + { + yinc = 180.0 / ysize; + yfirst = -90 + yinc / 2; + } + } + } + + if (yfirst > ylast && yinc > 0) yinc = -yinc; + + for (int i = 0; i < ysize; i++) yvals[i] = yfirst + i * yinc; +} + +// used also in CDO +void +gridGenYvals(int gridtype, int ysize, double yfirst, double ylast, double yinc, double *restrict yvals) +{ + if (gridtype == GRID_GAUSSIAN || gridtype == GRID_GAUSSIAN_REDUCED) + { + if (ysize > 2) + { + gridGenYvalsGaussian(ysize, yfirst, ylast, yvals); + } + else + { + yvals[0] = yfirst; + yvals[ysize - 1] = ylast; + } + } + // else if (gridtype == GRID_LONLAT || gridtype == GRID_GENERIC) + else + { + gridGenYvalsRegular(ysize, yfirst, ylast, yinc, yvals); + } + /* + else + Error("unable to calculate values for %s grid!", gridNamePtr(gridtype)); + */ +} + +/* +@Function gridCreate +@Title Create a horizontal Grid + +@Prototype int gridCreate(int gridtype, SizeType size) +@Parameter + @Item gridtype The type of the grid, one of the set of predefined CDI grid types. + The valid CDI grid types are @func{GRID_GENERIC}, @func{GRID_LONLAT}, + @func{GRID_GAUSSIAN}, @func{GRID_PROJECTION}, @func{GRID_SPECTRAL}, + @func{GRID_GME}, @func{GRID_CURVILINEAR} and @func{GRID_UNSTRUCTURED}. + @Item size Number of gridpoints. + +@Description +The function @func{gridCreate} creates a horizontal Grid. + +@Result +@func{gridCreate} returns an identifier to the Grid. + +@Example +Here is an example using @func{gridCreate} to create a regular lon/lat Grid: + +@Source + ... +#define nlon 12 +#define nlat 6 + ... +double lons[nlon] = {0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330}; +double lats[nlat] = {-75, -45, -15, 15, 45, 75}; +int gridID; + ... +gridID = gridCreate(GRID_LONLAT, nlon*nlat); +gridDefXsize(gridID, nlon); +gridDefYsize(gridID, nlat); +gridDefXvals(gridID, lons); +gridDefYvals(gridID, lats); + ... +@EndSource +@EndFunction +*/ +int +gridCreate(int gridtype, SizeType size) +{ + if (CDI_Debug) Message("gridtype=%s size=%zu", gridNamePtr(gridtype), size); + + xassert(size); + gridInit(); + + grid_t *gridptr = gridNewEntry(CDI_UNDEFID); + if (!gridptr) Error("No memory"); + + int gridID = gridptr->self; + + if (CDI_Debug) Message("gridID: %d", gridID); + + cdiGridTypeInit(gridptr, gridtype, (size_t) size); + + return gridID; +} + +static void +gridDestroyKernel(grid_t *gridptr) +{ + xassert(gridptr); + + grid_free_components(gridptr); + Free(gridptr); +} + +/* +@Function gridDestroy +@Title Destroy a horizontal Grid + +@Prototype void gridDestroy(int gridID) +@Parameter + @Item gridID Grid ID, from a previous call to @fref{gridCreate}. + +@EndFunction +*/ +void +gridDestroy(int gridID) +{ + grid_t *gridptr = grid_to_pointer(gridID); + gridptr->vtable->destroy(gridptr); + reshRemove(gridID, &gridOps); +} + +static void +gridDestroyP(void *gridptr) +{ + ((grid_t *) gridptr)->vtable->destroy((grid_t *) gridptr); +} + +const char * +gridNamePtr(int gridtype) +{ + int size = (int) (sizeof(Grids) / sizeof(Grids[0])); + + const char *name = (gridtype >= 0 && gridtype < size) ? Grids[gridtype] : Grids[GRID_GENERIC]; + + return name; +} + +void +gridName(int gridtype, char *gridname) +{ + strcpy(gridname, gridNamePtr(gridtype)); +} + +/* +@Function gridDefXname +@Title Define the name of a X-axis + +@Prototype void gridDefXname(int gridID, const char *name) +@Parameter + @Item gridID Grid ID, from a previous call to @fref{gridCreate}. + @Item name Name of the X-axis. + +@Description +The function @func{gridDefXname} defines the name of a X-axis. + +@EndFunction +*/ +void +gridDefXname(int gridID, const char *name) +{ + (void) cdiDefKeyString(gridID, CDI_XAXIS, CDI_KEY_NAME, name); +} + +/* +@Function gridDefXlongname +@Title Define the longname of a X-axis + +@Prototype void gridDefXlongname(int gridID, const char *longname) +@Parameter + @Item gridID Grid ID, from a previous call to @fref{gridCreate}. + @Item longname Longname of the X-axis. + +@Description +The function @func{gridDefXlongname} defines the longname of a X-axis. + +@EndFunction +*/ +void +gridDefXlongname(int gridID, const char *longname) +{ + (void) cdiDefKeyString(gridID, CDI_XAXIS, CDI_KEY_LONGNAME, longname); +} + +/* +@Function gridDefXunits +@Title Define the units of a X-axis + +@Prototype void gridDefXunits(int gridID, const char *units) +@Parameter + @Item gridID Grid ID, from a previous call to @fref{gridCreate}. + @Item units Units of the X-axis. + +@Description +The function @func{gridDefXunits} defines the units of a X-axis. + +@EndFunction +*/ +void +gridDefXunits(int gridID, const char *units) +{ + (void) cdiDefKeyString(gridID, CDI_XAXIS, CDI_KEY_UNITS, units); +} + +/* +@Function gridDefYname +@Title Define the name of a Y-axis + +@Prototype void gridDefYname(int gridID, const char *name) +@Parameter + @Item gridID Grid ID, from a previous call to @fref{gridCreate}. + @Item name Name of the Y-axis. + +@Description +The function @func{gridDefYname} defines the name of a Y-axis. + +@EndFunction +*/ +void +gridDefYname(int gridID, const char *name) +{ + (void) cdiDefKeyString(gridID, CDI_YAXIS, CDI_KEY_NAME, name); +} + +/* +@Function gridDefYlongname +@Title Define the longname of a Y-axis + +@Prototype void gridDefYlongname(int gridID, const char *longname) +@Parameter + @Item gridID Grid ID, from a previous call to @fref{gridCreate}. + @Item longname Longname of the Y-axis. + +@Description +The function @func{gridDefYlongname} defines the longname of a Y-axis. + +@EndFunction +*/ +void +gridDefYlongname(int gridID, const char *longname) +{ + (void) cdiDefKeyString(gridID, CDI_YAXIS, CDI_KEY_LONGNAME, longname); +} + +/* +@Function gridDefYunits +@Title Define the units of a Y-axis + +@Prototype void gridDefYunits(int gridID, const char *units) +@Parameter + @Item gridID Grid ID, from a previous call to @fref{gridCreate}. + @Item units Units of the Y-axis. + +@Description +The function @func{gridDefYunits} defines the units of a Y-axis. + +@EndFunction +*/ +void +gridDefYunits(int gridID, const char *units) +{ + (void) cdiDefKeyString(gridID, CDI_YAXIS, CDI_KEY_UNITS, units); +} + +/* +@Function gridInqXname +@Title Get the name of a X-axis + +@Prototype void gridInqXname(int gridID, char *name) +@Parameter + @Item gridID Grid ID, from a previous call to @fref{gridCreate} or @fref{vlistInqVarGrid}. + @Item name Name of the X-axis. The caller must allocate space for the + returned string. The maximum possible length, in characters, of + the string is given by the predefined constant @func{CDI_MAX_NAME}. + +@Description +The function @func{gridInqXname} returns the name of a X-axis. + +@Result +@func{gridInqXname} returns the name of the X-axis to the parameter name. + +@EndFunction +*/ +void +gridInqXname(int gridID, char *name) +{ + int length = CDI_MAX_NAME; + (void) cdiInqKeyString(gridID, CDI_XAXIS, CDI_KEY_NAME, name, &length); +} + +/* +@Function gridInqXlongname +@Title Get the longname of a X-axis + +@Prototype void gridInqXlongname(int gridID, char *longname) +@Parameter + @Item gridID Grid ID, from a previous call to @fref{gridCreate} or @fref{vlistInqVarGrid}. + @Item longname Longname of the X-axis. The caller must allocate space for the + returned string. The maximum possible length, in characters, of + the string is given by the predefined constant @func{CDI_MAX_NAME}. + +@Description +The function @func{gridInqXlongname} returns the longname of a X-axis. + +@Result +@func{gridInqXlongname} returns the longname of the X-axis to the parameter longname. + +@EndFunction +*/ +void +gridInqXlongname(int gridID, char *longname) +{ + int length = CDI_MAX_NAME; + (void) cdiInqKeyString(gridID, CDI_XAXIS, CDI_KEY_LONGNAME, longname, &length); +} + +/* +@Function gridInqXunits +@Title Get the units of a X-axis + +@Prototype void gridInqXunits(int gridID, char *units) +@Parameter + @Item gridID Grid ID, from a previous call to @fref{gridCreate} or @fref{vlistInqVarGrid}. + @Item units Units of the X-axis. The caller must allocate space for the + returned string. The maximum possible length, in characters, of + the string is given by the predefined constant @func{CDI_MAX_NAME}. + +@Description +The function @func{gridInqXunits} returns the units of a X-axis. + +@Result +@func{gridInqXunits} returns the units of the X-axis to the parameter units. + +@EndFunction +*/ +void +gridInqXunits(int gridID, char *units) +{ + int length = CDI_MAX_NAME; + (void) cdiInqKeyString(gridID, CDI_XAXIS, CDI_KEY_UNITS, units, &length); +} + +/* +@Function gridInqYname +@Title Get the name of a Y-axis + +@Prototype void gridInqYname(int gridID, char *name) +@Parameter + @Item gridID Grid ID, from a previous call to @fref{gridCreate} or @fref{vlistInqVarGrid}. + @Item name Name of the Y-axis. The caller must allocate space for the + returned string. The maximum possible length, in characters, of + the string is given by the predefined constant @func{CDI_MAX_NAME}. + +@Description +The function @func{gridInqYname} returns the name of a Y-axis. + +@Result +@func{gridInqYname} returns the name of the Y-axis to the parameter name. + +@EndFunction +*/ +void +gridInqYname(int gridID, char *name) +{ + int length = CDI_MAX_NAME; + (void) cdiInqKeyString(gridID, CDI_YAXIS, CDI_KEY_NAME, name, &length); +} + +/* +@Function gridInqYlongname +@Title Get the longname of a Y-axis + +@Prototype void gridInqYlongname(int gridID, char *longname) +@Parameter + @Item gridID Grid ID, from a previous call to @fref{gridCreate} or @fref{vlistInqVarGrid}. + @Item longname Longname of the Y-axis. The caller must allocate space for the + returned string. The maximum possible length, in characters, of + the string is given by the predefined constant @func{CDI_MAX_NAME}. + +@Description +The function @func{gridInqYlongname} returns the longname of a Y-axis. + +@Result +@func{gridInqYlongname} returns the longname of the Y-axis to the parameter longname. + +@EndFunction +*/ +void +gridInqYlongname(int gridID, char *longname) +{ + int length = CDI_MAX_NAME; + (void) cdiInqKeyString(gridID, CDI_YAXIS, CDI_KEY_LONGNAME, longname, &length); +} + +/* +@Function gridInqYunits +@Title Get the units of a Y-axis + +@Prototype void gridInqYunits(int gridID, char *units) +@Parameter + @Item gridID Grid ID, from a previous call to @fref{gridCreate} or @fref{vlistInqVarGrid}. + @Item units Units of the Y-axis. The caller must allocate space for the + returned string. The maximum possible length, in characters, of + the string is given by the predefined constant @func{CDI_MAX_NAME}. + +@Description +The function @func{gridInqYunits} returns the units of a Y-axis. + +@Result +@func{gridInqYunits} returns the units of the Y-axis to the parameter units. + +@EndFunction +*/ +void +gridInqYunits(int gridID, char *units) +{ + int length = CDI_MAX_NAME; + (void) cdiInqKeyString(gridID, CDI_YAXIS, CDI_KEY_UNITS, units, &length); +} + +void +gridDefProj(int gridID, int projID) +{ + grid_t *gridptr = grid_to_pointer(gridID); + gridptr->proj = projID; + + if (gridptr->type == GRID_CURVILINEAR) + { + grid_t *projptr = grid_to_pointer(projID); + const char *xdimname = cdiInqVarKeyStringPtr(&gridptr->x.keys, CDI_KEY_DIMNAME); + const char *ydimname = cdiInqVarKeyStringPtr(&gridptr->y.keys, CDI_KEY_DIMNAME); + if (xdimname && find_key(&projptr->x.keys, CDI_KEY_NAME)) cdiDefKeyString(projID, CDI_XAXIS, CDI_KEY_NAME, xdimname); + if (ydimname && find_key(&projptr->y.keys, CDI_KEY_NAME)) cdiDefKeyString(projID, CDI_YAXIS, CDI_KEY_NAME, ydimname); + } +} + +int +gridInqProj(int gridID) +{ + grid_t *gridptr = grid_to_pointer(gridID); + return gridptr->proj; +} + +int +gridInqProjType(int gridID) +{ + grid_t *gridptr = grid_to_pointer(gridID); + + int projtype = gridptr->projtype; + if (projtype == -1) + { + char gmapname[CDI_MAX_NAME]; + int length = CDI_MAX_NAME; + cdiInqKeyString(gridID, CDI_GLOBAL, CDI_KEY_GRIDMAP_NAME, gmapname, &length); + if (gmapname[0]) + { + // clang-format off + if (str_is_equal(gmapname, "rotated_latitude_longitude")) projtype = CDI_PROJ_RLL; + else if (str_is_equal(gmapname, "lambert_azimuthal_equal_area")) projtype = CDI_PROJ_LAEA; + else if (str_is_equal(gmapname, "lambert_conformal_conic")) projtype = CDI_PROJ_LCC; + else if (str_is_equal(gmapname, "sinusoidal")) projtype = CDI_PROJ_SINU; + else if (str_is_equal(gmapname, "polar_stereographic")) projtype = CDI_PROJ_STERE; + else if (str_is_equal(gmapname, "healpix")) projtype = CDI_PROJ_HEALPIX; + // clang-format on + gridptr->projtype = projtype; + } + } + + return projtype; +} + +void +gridVerifyProj(int gridID) +{ + grid_t *gridptr = grid_to_pointer(gridID); + + int projtype = gridInqProjType(gridID); + if (projtype == CDI_PROJ_RLL) + { + gridaxisSetKey(&gridptr->x, CDI_KEY_STDNAME, xystdname_tab[grid_xystdname_grid_latlon][0]); + gridaxisSetKey(&gridptr->y, CDI_KEY_STDNAME, xystdname_tab[grid_xystdname_grid_latlon][1]); + gridaxisSetKey(&gridptr->x, CDI_KEY_UNITS, "degrees"); + gridaxisSetKey(&gridptr->y, CDI_KEY_UNITS, "degrees"); + } + else if (projtype == CDI_PROJ_LCC) + { + gridaxisSetKey(&gridptr->x, CDI_KEY_STDNAME, xystdname_tab[grid_xystdname_projection][0]); + gridaxisSetKey(&gridptr->y, CDI_KEY_STDNAME, xystdname_tab[grid_xystdname_projection][1]); + gridaxisSetKey(&gridptr->x, CDI_KEY_UNITS, "m"); + gridaxisSetKey(&gridptr->y, CDI_KEY_UNITS, "m"); + } +} + +/* +@Function gridInqType +@Title Get the type of a Grid + +@Prototype int gridInqType(int gridID) +@Parameter + @Item gridID Grid ID, from a previous call to @fref{gridCreate} or @fref{vlistInqVarGrid}. + +@Description +The function @func{gridInqType} returns the type of a Grid. + +@Result +@func{gridInqType} returns the type of the grid, +one of the set of predefined CDI grid types. +The valid CDI grid types are @func{GRID_GENERIC}, @func{GRID_LONLAT}, +@func{GRID_GAUSSIAN}, @func{GRID_PROJECTION}, @func{GRID_SPECTRAL}, @func{GRID_GME}, +@func{GRID_CURVILINEAR} and @func{GRID_UNSTRUCTURED}. + +@EndFunction +*/ +int +gridInqType(int gridID) +{ + grid_t *gridptr = grid_to_pointer(gridID); + return gridptr->type; +} + +/* +@Function gridInqSize +@Title Get the size of a Grid + +@Prototype SizeType gridInqSize(int gridID) +@Parameter + @Item gridID Grid ID, from a previous call to @fref{gridCreate} or @fref{vlistInqVarGrid}. + +@Description +The function @func{gridInqSize} returns the size of a Grid. + +@Result +@func{gridInqSize} returns the number of grid points of a Grid. + +@EndFunction +*/ +SizeType +gridInqSize(int gridID) +{ + grid_t *gridptr = grid_to_pointer(gridID); + + size_t size = gridptr->size; + if (size == 0) + { + size_t xsize = gridptr->x.size; + size_t ysize = gridptr->y.size; + + size = ysize ? xsize * ysize : xsize; + + gridptr->size = size; + } + + return (SizeType) size; +} + +static int +nsp2trunc(int nsp) +{ + /* nsp = (trunc+1)*(trunc+1) */ + /* => trunc^2 + 3*trunc - (x-2) = 0 */ + /* */ + /* with: y^2 + p*y + q = 0 */ + /* y = -p/2 +- sqrt((p/2)^2 - q) */ + /* p = 3 and q = - (x-2) */ + int trunc = (int) (sqrt(nsp * 4 + 1.) - 3) / 2; + return trunc; +} + +int +gridInqTrunc(int gridID) +{ + grid_t *gridptr = grid_to_pointer(gridID); + + if (gridptr->trunc == 0) + { + if (gridptr->type == GRID_SPECTRAL) gridptr->trunc = nsp2trunc(gridptr->size); + /* + else if ( gridptr->type == GRID_GAUSSIAN ) + gridptr->trunc = nlat2trunc(gridptr->y.size); + */ + } + + return gridptr->trunc; +} + +void +gridDefTrunc(int gridID, int trunc) +{ + grid_t *gridptr = grid_to_pointer(gridID); + + if (gridptr->trunc != trunc) + { + gridMark4Update(gridID); + gridptr->trunc = trunc; + } +} + +/* +@Function gridDefXsize +@Title Define the number of values of a X-axis + +@Prototype void gridDefXsize(int gridID, SizeType xsize) +@Parameter + @Item gridID Grid ID, from a previous call to @fref{gridCreate}. + @Item xsize Number of values of a X-axis. + +@Description +The function @func{gridDefXsize} defines the number of values of a X-axis. + +@EndFunction +*/ +void +gridDefXsize(int gridID, SizeType xsize) +{ + grid_t *gridptr = grid_to_pointer(gridID); + + size_t gridSize = gridInqSize(gridID); + if ((size_t) xsize > gridSize) Error("xsize %zu is greater then gridsize %zu", (size_t) xsize, gridSize); + + int gridType = gridInqType(gridID); + if (gridType == GRID_UNSTRUCTURED && (size_t) xsize != gridSize) + Error("xsize %zu must be equal to gridsize %zu for gridtype: %s", (size_t) xsize, gridSize, gridNamePtr(gridType)); + if (gridType == GRID_GAUSSIAN_REDUCED && xsize != 2 && (size_t) xsize != gridSize) + Error("xsize %zu must be equal to gridsize %zu for gridtype: %s", (size_t) xsize, gridSize, gridNamePtr(gridType)); + + if (gridptr->x.size != (size_t) xsize) + { + gridMark4Update(gridID); + gridptr->x.size = (size_t) xsize; + } + + if (gridType != GRID_UNSTRUCTURED && gridType != GRID_GAUSSIAN_REDUCED && gridType != GRID_PROJECTION) + { + size_t axisproduct = gridptr->x.size * gridptr->y.size; + if (axisproduct > 0 && axisproduct != gridSize) + Error("Inconsistent grid declaration! (xsize=%zu ysize=%zu gridsize=%zu)", gridptr->x.size, gridptr->y.size, gridSize); + } +} + +void +gridDefDatatype(int gridID, int datatype) +{ + cdiDefKeyInt(gridID, CDI_GLOBAL, CDI_KEY_DATATYPE, datatype); +} + +int +gridInqDatatype(int gridID) +{ + int datatype = CDI_UNDEFID; + cdiInqKeyInt(gridID, CDI_GLOBAL, CDI_KEY_DATATYPE, &datatype); + return datatype; +} + +/* +@Function gridInqXsize +@Title Get the number of values of a X-axis + +@Prototype SizeType gridInqXsize(int gridID) +@Parameter + @Item gridID Grid ID, from a previous call to @fref{gridCreate} or @fref{vlistInqVarGrid}. + +@Description +The function @func{gridInqXsize} returns the number of values of a X-axis. + +@Result +@func{gridInqXsize} returns the number of values of a X-axis. + +@EndFunction +*/ +SizeType +gridInqXsize(int gridID) +{ + grid_t *gridptr = grid_to_pointer(gridID); + return (SizeType) gridptr->x.size; +} + +/* +@Function gridDefYsize +@Title Define the number of values of a Y-axis + +@Prototype void gridDefYsize(int gridID, SizeType ysize) +@Parameter + @Item gridID Grid ID, from a previous call to @fref{gridCreate}. + @Item ysize Number of values of a Y-axis. + +@Description +The function @func{gridDefYsize} defines the number of values of a Y-axis. + +@EndFunction +*/ +void +gridDefYsize(int gridID, SizeType ysize) +{ + grid_t *gridptr = grid_to_pointer(gridID); + + size_t gridSize = gridInqSize(gridID); + + if ((size_t) ysize > gridSize) Error("ysize %zu is greater then gridsize %zu", (size_t) ysize, gridSize); + + int gridType = gridInqType(gridID); + if (gridType == GRID_UNSTRUCTURED && (size_t) ysize != gridSize) + Error("ysize %zu must be equal gridsize %zu for gridtype: %s", gridNamePtr(gridType), (size_t) ysize, gridSize); + + if (gridptr->y.size != (size_t) ysize) + { + gridMark4Update(gridID); + gridptr->y.size = (size_t) ysize; + } + + if (gridType != GRID_UNSTRUCTURED && gridType != GRID_GAUSSIAN_REDUCED && gridType != GRID_PROJECTION) + { + size_t axisproduct = gridptr->x.size * gridptr->y.size; + if (axisproduct > 0 && axisproduct != gridSize) + Error("Inconsistent grid declaration! (xsize=%zu ysize=%zu gridsize=%zu)", gridptr->x.size, gridptr->y.size, gridSize); + } +} + +/* +@Function gridInqYsize +@Title Get the number of values of a Y-axis + +@Prototype SizeType gridInqYsize(int gridID) +@Parameter + @Item gridID Grid ID, from a previous call to @fref{gridCreate} or @fref{vlistInqVarGrid}. + +@Description +The function @func{gridInqYsize} returns the number of values of a Y-axis. + +@Result +@func{gridInqYsize} returns the number of values of a Y-axis. + +@EndFunction +*/ +SizeType +gridInqYsize(int gridID) +{ + grid_t *gridptr = grid_to_pointer(gridID); + return (SizeType) gridptr->y.size; +} + +/* +@Function gridDefNP +@Title Define the number of parallels between a pole and the equator + +@Prototype void gridDefNP(int gridID, int np) +@Parameter + @Item gridID Grid ID, from a previous call to @fref{gridCreate}. + @Item np Number of parallels between a pole and the equator. + +@Description +The function @func{gridDefNP} defines the number of parallels between a pole and the equator +of a Gaussian grid. + +@EndFunction +*/ +void +gridDefNP(int gridID, int np) +{ + grid_t *gridptr = grid_to_pointer(gridID); + + if (gridptr->np != np) + { + gridMark4Update(gridID); + gridptr->np = np; + } +} + +/* +@Function gridInqNP +@Title Get the number of parallels between a pole and the equator + +@Prototype int gridInqNP(int gridID) +@Parameter + @Item gridID Grid ID, from a previous call to @fref{gridCreate} or @fref{vlistInqVarGrid}. + +@Description +The function @func{gridInqNP} returns the number of parallels between a pole and the equator +of a Gaussian grid. + +@Result +@func{gridInqNP} returns the number of parallels between a pole and the equator. + +@EndFunction +*/ +int +gridInqNP(int gridID) +{ + grid_t *gridptr = grid_to_pointer(gridID); + return gridptr->np; +} + +/* +@Function +@Title + +@Prototype +@Parameter + @Item Grid identifier + +@EndFunction +*/ +void +gridDefReducedPoints(int gridID, int reducedPointsSize, const int reducedPoints[]) +{ + grid_t *gridptr = grid_to_pointer(gridID); + + gridptr->reducedPoints = (int *) Malloc((size_t) reducedPointsSize * sizeof(int)); + gridptr->reducedPointsSize = reducedPointsSize; + memcpy(gridptr->reducedPoints, reducedPoints, (size_t) reducedPointsSize * sizeof(int)); + gridMark4Update(gridID); +} + +/* +@Function +@Title + +@Prototype +@Parameter + @Item Grid identifier + +@EndFunction +*/ +void +gridInqReducedPoints(int gridID, int *reducedPoints) +{ + grid_t *gridptr = grid_to_pointer(gridID); + + if (gridptr->reducedPoints == 0) Error("undefined pointer!"); + + memcpy(reducedPoints, gridptr->reducedPoints, (size_t) gridptr->reducedPointsSize * sizeof(int)); +} + +static size_t +gridInqMaskSerialGeneric(grid_t *gridptr, mask_t **internalMask, int *restrict mask) +{ + size_t size = gridptr->size; + + if (CDI_Debug && size == 0) Warning("Size undefined for gridID = %d", gridptr->self); + + const mask_t *restrict mask_src = *internalMask; + if (mask_src) + { + if (mask && size > 0) + for (size_t i = 0; i < size; ++i) mask[i] = (int) mask_src[i]; + } + else + size = 0; + + return size; +} + +static SizeType +gridInqMaskSerial(grid_t *gridptr, int *mask) +{ + return (SizeType) gridInqMaskSerialGeneric(gridptr, &gridptr->mask, mask); +} + +int +gridInqMask(int gridID, int *mask) +{ + grid_t *gridptr = grid_to_pointer(gridID); + return gridptr->vtable->inqMask(gridptr, mask); +} + +static void +gridDefMaskSerial(grid_t *gridptr, const int *mask) +{ + size_t size = gridptr->size; + if (size == 0) Error("Size undefined for gridID = %d", gridptr->self); + + if (mask == NULL) + { + if (gridptr->mask) + { + Free(gridptr->mask); + gridptr->mask = NULL; + } + } + else + { + if (gridptr->mask == NULL) + gridptr->mask = (mask_t *) Malloc(size * sizeof(mask_t)); + else if (CDI_Debug) + Warning("grid mask already defined!"); + + for (size_t i = 0; i < size; ++i) gridptr->mask[i] = (mask_t) (mask[i] != 0); + } +} + +void +gridDefMask(int gridID, const int *mask) +{ + grid_t *gridptr = grid_to_pointer(gridID); + gridptr->vtable->defMask(gridptr, mask); + gridMark4Update(gridID); +} + +static int +gridInqMaskGMESerial(grid_t *gridptr, int *mask_gme) +{ + return gridInqMaskSerialGeneric(gridptr, &gridptr->mask_gme, mask_gme); +} + +int +gridInqMaskGME(int gridID, int *mask) +{ + grid_t *gridptr = grid_to_pointer(gridID); + return gridptr->vtable->inqMaskGME(gridptr, mask); +} + +static void +gridDefMaskGMESerial(grid_t *gridptr, const int *mask) +{ + size_t size = gridptr->size; + if (size == 0) Error("Size undefined for gridID = %d", gridptr->self); + + if (gridptr->mask_gme == NULL) + gridptr->mask_gme = (mask_t *) Malloc(size * sizeof(mask_t)); + else if (CDI_Debug) + Warning("mask already defined!"); + + for (size_t i = 0; i < size; ++i) gridptr->mask_gme[i] = (mask_t) (mask[i] != 0); +} + +void +gridDefMaskGME(int gridID, const int *mask) +{ + grid_t *gridptr = grid_to_pointer(gridID); + gridptr->vtable->defMaskGME(gridptr, mask); + gridMark4Update(gridID); +} + +static void +copy_darray(size_t n, const double *restrict in, double *restrict out) +{ +#ifdef _OPENMP +#pragma omp parallel for if (n > 99999) default(shared) schedule(static) +#endif + for (size_t i = 0; i < n; ++i) out[i] = in[i]; +} + +static SizeType +gridInqXValsSerial(grid_t *gridptr, double *xvals) +{ + int gridtype = gridptr->type; + size_t size = grid_is_irregular(gridtype) ? gridptr->size : gridptr->x.size; + + if (CDI_Debug && size == 0) Warning("size undefined for gridID = %d", gridptr->self); + + if (gridptr->x.vals) + { + if (size && xvals) + { + const double *gridptr_xvals = gridptr->vtable->inqXValsPtr(gridptr); + copy_darray(size, gridptr_xvals, xvals); + } + } + else + size = 0; + + return (SizeType) size; +} + +static SizeType +gridInqXValsPartSerial(grid_t *gridptr, int start, SizeType length, double *xvals) +{ + int gridtype = gridptr->type; + size_t size = grid_is_irregular(gridtype) ? gridptr->size : gridptr->x.size; + + if (CDI_Debug && size == 0) Warning("size undefined for gridID = %d", gridptr->self); + + if (gridptr->x.vals) + { + if (size && xvals && (size_t) length <= size) + { + const double *gridptr_xvals = gridptr->vtable->inqXValsPtr(gridptr); + memcpy(xvals, gridptr_xvals + start, (size_t) length * sizeof(double)); + } + } + else + size = 0; + + return (SizeType) size; +} + +#ifndef USE_MPI +static SizeType +gridInqXCvalsSerial(grid_t *gridptr, char **xcvals) +{ + if (gridptr->type != GRID_CHARXY) Error("Function only valid for grid type 'GRID_CHARXY'."); + + size_t size = gridptr->x.size; + size_t maxclength = 0; + + const char **gridptr_xcvals = gridptr->vtable->inqXCvalsPtr(gridptr); + if (gridptr_xcvals && size && xcvals) + { + maxclength = gridptr->x.clength; + for (size_t i = 0; i < size; i++) memcpy(xcvals[i], gridptr_xcvals[i], maxclength * sizeof(char)); + } + + return (SizeType) maxclength; +} + +static int +gridInqXIscSerial(grid_t *gridptr) +{ + /* + if ( gridptr->type != GRID_CHARXY ) + Error("Axis type is 'char' but grid is not type 'GRID_CHARXY'."); + */ + return gridptr->x.clength; +} +#endif + +/* +@Function gridInqXvals +@Title Get all values of a X-axis + +@Prototype SizeType gridInqXvals(int gridID, double *xvals) +@Parameter + @Item gridID Grid ID, from a previous call to @fref{gridCreate} or @fref{vlistInqVarGrid}. + @Item xvals Pointer to the location into which the X-values are read. + The caller must allocate space for the returned values. + +@Description +The function @func{gridInqXvals} returns all values of the X-axis. + +@Result +Upon successful completion @func{gridInqXvals} returns the number of values and +the values are stored in @func{xvals}. +Otherwise, 0 is returned and @func{xvals} is empty. + +@EndFunction +*/ +SizeType +gridInqXvals(int gridID, double *xvals) +{ + grid_t *gridptr = grid_to_pointer(gridID); + return gridptr->vtable->inqXVals(gridptr, xvals); +} + +SizeType +gridInqXvalsPart(int gridID, int start, SizeType length, double *xvals) +{ + grid_t *gridptr = grid_to_pointer(gridID); + return gridptr->vtable->inqXValsPart(gridptr, start, length, xvals); +} + +SizeType +gridInqXCvals(int gridID, char **xcvals) +{ + grid_t *gridptr = grid_to_pointer(gridID); +#ifndef USE_MPI + return gridptr->vtable->inqXCvals(gridptr, xcvals); +#else + return 0; +#endif +} + +int +gridInqXIsc(int gridID) +{ + grid_t *gridptr = grid_to_pointer(gridID); +#ifndef USE_MPI + return gridptr->vtable->inqXIsc(gridptr); +#else + return 0; +#endif +} + +static void +gridDefXValsSerial(grid_t *gridptr, const double *xvals) +{ + int gridtype = gridptr->type; + size_t size = grid_is_irregular(gridtype) ? gridptr->size : gridptr->x.size; + + if (size == 0) Error("Size undefined for gridID = %d", gridptr->self); + + if (gridptr->x.vals && CDI_Debug) Warning("values already defined!"); + gridptr->x.vals = (double *) Realloc(gridptr->x.vals, size * sizeof(double)); + copy_darray(size, xvals, gridptr->x.vals); +} + +#ifndef USE_MPI +static SizeType +gridInqYCvalsSerial(grid_t *gridptr, char **ycvals) +{ + if (gridptr->type != GRID_CHARXY) Error("Function only valid for grid type 'GRID_CHARXY'."); + + size_t size = gridptr->y.size; + size_t maxclength = 0; + + const char **gridptr_ycvals = gridptr->vtable->inqYCvalsPtr(gridptr); + if (gridptr_ycvals && size && ycvals) + { + maxclength = gridptr->y.clength; + for (size_t i = 0; i < size; i++) memcpy(ycvals[i], gridptr_ycvals[i], maxclength * sizeof(char)); + } + + return (SizeType) maxclength; +} + +static int +gridInqYIscSerial(grid_t *gridptr) +{ + // if ( gridptr->type != GRID_CHARXY ) Error("Axis type is 'char' but grid is not type 'GRID_CHARXY'."); + return gridptr->y.clength; +} +#endif + +/* +@Function gridDefXvals +@Title Define the values of a X-axis + +@Prototype void gridDefXvals(int gridID, const double *xvals) +@Parameter + @Item gridID Grid ID, from a previous call to @fref{gridCreate}. + @Item xvals X-values of the grid. + +@Description +The function @func{gridDefXvals} defines all values of the X-axis. + +@EndFunction +*/ +void +gridDefXvals(int gridID, const double *xvals) +{ + grid_t *gridptr = grid_to_pointer(gridID); + gridptr->vtable->defXVals(gridptr, xvals); + gridMark4Update(gridID); +} + +static SizeType +gridInqYValsSerial(grid_t *gridptr, double *yvals) +{ + int gridtype = gridptr->type; + size_t size = grid_is_irregular(gridtype) ? gridptr->size : gridptr->y.size; + + if (CDI_Debug && size == 0) Warning("size undefined for gridID = %d!", gridptr->self); + + if (gridptr->y.vals) + { + if (size && yvals) + { + const double *gridptr_yvals = gridptr->vtable->inqYValsPtr(gridptr); + copy_darray(size, gridptr_yvals, yvals); + } + } + else + size = 0; + + return (SizeType) size; +} + +static SizeType +gridInqYValsPartSerial(grid_t *gridptr, int start, SizeType length, double *yvals) +{ + int gridtype = gridptr->type; + size_t size = grid_is_irregular(gridtype) ? gridptr->size : gridptr->y.size; + + if (CDI_Debug && size == 0) Warning("size undefined for gridID = %d!", gridptr->self); + + if (gridptr->y.vals) + { + if (size && yvals && (size_t) length <= size) + { + const double *gridptr_yvals = gridptr->vtable->inqYValsPtr(gridptr); + memcpy(yvals, gridptr_yvals + start, (size_t) length * sizeof(double)); + } + } + else + size = 0; + + return (SizeType) size; +} + +/* +@Function gridInqYvals +@Title Get all values of a Y-axis + +@Prototype SizeType gridInqYvals(int gridID, double *yvals) +@Parameter + @Item gridID Grid ID, from a previous call to @fref{gridCreate} or @fref{vlistInqVarGrid}. + @Item yvals Pointer to the location into which the Y-values are read. + The caller must allocate space for the returned values. + +@Description +The function @func{gridInqYvals} returns all values of the Y-axis. + +@Result +Upon successful completion @func{gridInqYvals} returns the number of values and +the values are stored in @func{yvals}. +Otherwise, 0 is returned and @func{yvals} is empty. + +@EndFunction +*/ +SizeType +gridInqYvals(int gridID, double *yvals) +{ + grid_t *gridptr = grid_to_pointer(gridID); + return gridptr->vtable->inqYVals(gridptr, yvals); +} + +SizeType +gridInqYvalsPart(int gridID, int start, SizeType size, double *yvals) +{ + grid_t *gridptr = grid_to_pointer(gridID); + return gridptr->vtable->inqYValsPart(gridptr, start, size, yvals); +} + +SizeType +gridInqYCvals(int gridID, char **ycvals) +{ + grid_t *gridptr = grid_to_pointer(gridID); +#ifndef USE_MPI + return gridptr->vtable->inqYCvals(gridptr, ycvals); +#else + return 0; +#endif +} + +int +gridInqYIsc(int gridID) +{ + grid_t *gridptr = grid_to_pointer(gridID); +#ifndef USE_MPI + return gridptr->vtable->inqYIsc(gridptr); +#else + return 0; +#endif +} + +static void +gridDefYValsSerial(grid_t *gridptr, const double *yvals) +{ + int gridtype = gridptr->type; + size_t size = grid_is_irregular(gridtype) ? gridptr->size : gridptr->y.size; + + if (size == 0) Error("Size undefined for gridID = %d!", gridptr->self); + + if (gridptr->y.vals && CDI_Debug) Warning("Values already defined!"); + + gridptr->y.vals = (double *) Realloc(gridptr->y.vals, size * sizeof(double)); + copy_darray(size, yvals, gridptr->y.vals); +} + +/* +@Function gridDefYvals +@Title Define the values of a Y-axis + +@Prototype void gridDefYvals(int gridID, const double *yvals) +@Parameter + @Item gridID Grid ID, from a previous call to @fref{gridCreate}. + @Item yvals Y-values of the grid. + +@Description +The function @func{gridDefYvals} defines all values of the Y-axis. + +@EndFunction +*/ +void +gridDefYvals(int gridID, const double *yvals) +{ + grid_t *gridptr = grid_to_pointer(gridID); + gridptr->vtable->defYVals(gridptr, yvals); + gridMark4Update(gridID); +} + +static double +gridInqXValSerial(grid_t *gridptr, SizeType index) +{ + const double xval = gridptr->x.vals ? gridptr->x.vals[index] : 0; + return xval; +} + +double +gridInqXval(int gridID, SizeType index) +{ + grid_t *gridptr = grid_to_pointer(gridID); + return gridptr->vtable->inqXVal(gridptr, index); +} + +static double +gridInqYValSerial(grid_t *gridptr, SizeType index) +{ + const double yval = gridptr->y.vals ? gridptr->y.vals[index] : 0; + return yval; +} + +/* +@Function +@Title + +@Prototype +@Parameter + @Item Grid identifier + +@EndFunction +*/ +double +gridInqYval(int gridID, SizeType index) +{ + grid_t *gridptr = grid_to_pointer(gridID); + return gridptr->vtable->inqYVal(gridptr, index); +} + +static double +grid_calc_increment(size_t size, const double *vals) +{ + if (size > 1) + { + double inc = (vals[size - 1] - vals[0]) / (size - 1); + const double abs_inc = fabs(inc); + for (size_t i = 1; i < size; ++i) + if (fabs(fabs(vals[i - 1] - vals[i]) - abs_inc) > 0.01 * abs_inc) + { + inc = 0.0; + break; + } + + return inc; + } + + return 0.0; +} + +static double +grid_calc_increment_in_meter(SizeType size, const double *vals) +{ + if (size > 1) + { + const double inc = (vals[size - 1] - vals[0]) / (size - 1); + return round(fabs(inc)); + } + + return 0.0; +} + +static double +gridInqXIncBase(grid_t *gridptr) +{ + if (fabs(gridptr->x.inc) <= 0 && gridptr->x.vals) + { + size_t xsize = gridptr->x.size; + if (xsize > 1) + { + const double *xvals = gridptr->vtable->inqXValsPtr(gridptr); + gridptr->x.inc = grid_calc_increment(xsize, xvals); + } + } + + return gridptr->x.inc; +} + +double +gridInqXincInMeter(int gridID) +{ + grid_t *gridptr = grid_to_pointer(gridID); + const double *xvals = gridptr->vtable->inqXValsPtr(gridptr); + + if (fabs(gridptr->x.inc) <= 0 && xvals) + { + size_t xsize = gridptr->x.size; + if (xsize > 1) gridptr->x.inc = grid_calc_increment_in_meter(xsize, xvals); + } + + return gridptr->x.inc; +} + +/* +@Function +@Title + +@Prototype +@Parameter + @Item Grid identifier + +@EndFunction +*/ +double +gridInqXinc(int gridID) +{ + grid_t *gridptr = grid_to_pointer(gridID); + return gridptr->vtable->inqXInc(gridptr); +} + +static double +gridInqYIncBase(grid_t *gridptr) +{ + if (fabs(gridptr->y.inc) <= 0 && gridptr->y.vals) + { + size_t ysize = gridptr->y.size; + if (ysize > 1) + { + const double *yvals = gridptr->vtable->inqYValsPtr(gridptr); + gridptr->y.inc = grid_calc_increment(ysize, yvals); + } + } + + return gridptr->y.inc; +} + +double +gridInqYincInMeter(int gridID) +{ + grid_t *gridptr = grid_to_pointer(gridID); + const double *yvals = gridptr->vtable->inqYValsPtr(gridptr); + + if (fabs(gridptr->y.inc) <= 0 && yvals) + { + size_t ysize = gridptr->y.size; + if (ysize > 1) gridptr->y.inc = grid_calc_increment_in_meter(ysize, yvals); + } + + return gridptr->y.inc; +} + +/* +@Function +@Title + +@Prototype +@Parameter + @Item Grid identifier + +@EndFunction +*/ +double +gridInqYinc(int gridID) +{ + grid_t *gridptr = grid_to_pointer(gridID); + return gridptr->vtable->inqYInc(gridptr); +} + +/* +@Function +@Title + +@Prototype +@Parameter + @Item Grid identifier + +@EndFunction +*/ +void +gridInqParamRLL(int gridID, double *xpole, double *ypole, double *angle) +{ + *xpole = 0; + *ypole = 0; + *angle = 0; + + static const char projection[] = "rotated_latitude_longitude"; + char name[CDI_MAX_NAME + 1]; + int length = CDI_MAX_NAME; + cdiInqKeyString(gridID, CDI_GLOBAL, CDI_KEY_GRIDMAP_NAME, name, &length); + if (name[0] && str_is_equal(name, projection)) + { + int atttype, attlen; + + int natts, nfound = 0; + cdiInqNatts(gridID, CDI_GLOBAL, &natts); + + for (int iatt = 0; iatt < natts; ++iatt) + { + cdiInqAtt(gridID, CDI_GLOBAL, iatt, name, &atttype, &attlen); + if (attlen == 1) + { + double *attflt; + // clang-format off + if (str_is_equal(name, "grid_north_pole_longitude")) attflt = xpole; + else if (str_is_equal(name, "grid_north_pole_latitude") ) attflt = ypole; + else if (str_is_equal(name, "north_pole_grid_longitude")) attflt = angle; + else continue; + // clang-format on + bool valid = cdiInqAttConvertedToFloat(gridID, atttype, name, attlen, attflt); + if ((nfound += valid) == 3) return; + } + } + } + else + Warning("%s mapping parameter missing!", projection); +} + +/* +@Function +@Title + +@Prototype +@Parameter + @Item Grid identifier + +@EndFunction +*/ +void +gridDefParamRLL(int gridID, double xpole, double ypole, double angle) +{ + cdiDefKeyString(gridID, CDI_XAXIS, CDI_KEY_UNITS, "degrees"); + cdiDefKeyString(gridID, CDI_YAXIS, CDI_KEY_UNITS, "degrees"); + + cdiDefKeyString(gridID, CDI_GLOBAL, CDI_KEY_GRIDMAP_VARNAME, "rotated_pole"); + + const char *gmapname = "rotated_latitude_longitude"; + cdiDefKeyString(gridID, CDI_GLOBAL, CDI_KEY_GRIDMAP_NAME, gmapname); + cdiDefAttTxt(gridID, CDI_GLOBAL, "grid_mapping_name", (int) (strlen(gmapname)), gmapname); + cdiDefAttFlt(gridID, CDI_GLOBAL, "grid_north_pole_longitude", CDI_DATATYPE_FLT64, 1, &xpole); + cdiDefAttFlt(gridID, CDI_GLOBAL, "grid_north_pole_latitude", CDI_DATATYPE_FLT64, 1, &ypole); + if (IS_NOT_EQUAL(angle, 0)) cdiDefAttFlt(gridID, CDI_GLOBAL, "north_pole_grid_longitude", CDI_DATATYPE_FLT64, 1, &angle); + + grid_t *gridptr = grid_to_pointer(gridID); + gridptr->projtype = CDI_PROJ_RLL; + + gridVerifyProj(gridID); +} + +/* +@Function +@Title + +@Prototype +@Parameter + @Item Grid identifier + +@EndFunction +*/ +void +gridInqParamGME(int gridID, int *nd, int *ni, int *ni2, int *ni3) +{ + grid_t *gridptr = grid_to_pointer(gridID); + + *nd = gridptr->gme.nd; + *ni = gridptr->gme.ni; + *ni2 = gridptr->gme.ni2; + *ni3 = gridptr->gme.ni3; +} + +/* +@Function +@Title + +@Prototype +@Parameter + @Item Grid identifier + +@EndFunction +*/ +void +gridDefParamGME(int gridID, int nd, int ni, int ni2, int ni3) +{ + grid_t *gridptr = grid_to_pointer(gridID); + + if (gridptr->gme.nd != nd) + { + gridptr->gme.nd = nd; + gridptr->gme.ni = ni; + gridptr->gme.ni2 = ni2; + gridptr->gme.ni3 = ni3; + gridMark4Update(gridID); + } +} + +/* +@Function +@Title + +@Prototype +@Parameter + @Item Grid identifier + +@EndFunction +*/ +void +gridChangeType(int gridID, int gridtype) +{ + grid_t *gridptr = grid_to_pointer(gridID); + + if (CDI_Debug) Message("Changed grid type from %s to %s", gridNamePtr(gridptr->type), gridNamePtr(gridtype)); + + if (gridptr->type != gridtype) + { + gridptr->type = gridtype; + gridMark4Update(gridID); + } +} + +static void +grid_check_cyclic(grid_t *gridptr) +{ + gridptr->isCyclic = 0; + enum + { + numVertices = 4 + }; + size_t xsize = gridptr->x.size, ysize = gridptr->y.size; + const double *xvals = gridptr->vtable->inqXValsPtr(gridptr), *yvals = gridptr->vtable->inqYValsPtr(gridptr), + (*xbounds)[numVertices] = (const double(*)[numVertices]) gridptr->vtable->inqXBoundsPtr(gridptr); + + if (gridptr->type == GRID_GAUSSIAN || gridptr->type == GRID_LONLAT) + { + if (xvals && xsize > 1) + { + double xval1 = xvals[0]; + double xval2 = xvals[1]; + double xvaln = xvals[xsize - 1]; + if (xval2 < xval1) xval2 += 360; + if (xvaln < xval1) xvaln += 360; + + if (IS_NOT_EQUAL(xval1, xvaln)) + { + double xinc = xval2 - xval1; + if (IS_EQUAL(xinc, 0)) xinc = (xvaln - xval1) / (xsize - 1); + + const double x0 = xvaln + xinc - 360; + + if (fabs(x0 - xval1) < 0.01 * xinc) gridptr->isCyclic = 1; + } + } + } + else if (gridptr->type == GRID_CURVILINEAR) + { + bool lcheck = true; + if (yvals && xvals) + { + if ((fabs(yvals[0] - yvals[xsize - 1]) > fabs(yvals[0] - yvals[xsize * ysize - xsize])) + && (fabs(yvals[xsize * ysize - xsize] - yvals[xsize * ysize - 1]) + > fabs(yvals[xsize - 1] - yvals[xsize * ysize - 1]))) + lcheck = false; + } + else + lcheck = false; + + if (lcheck && xvals && xsize > 1) + { + size_t nc = 0; + for (size_t j = 0; j < ysize; ++j) + { + size_t i1 = j * xsize, i2 = j * xsize + 1, in = j * xsize + (xsize - 1); + double val1 = xvals[i1], val2 = xvals[i2], valn = xvals[in]; + double xinc = fabs(val2 - val1); + + if (val1 < 1 && valn > 300) val1 += 360; + if (valn < 1 && val1 > 300) valn += 360; + if (val1 < -179 && valn > 120) val1 += 360; + if (valn < -179 && val1 > 120) valn += 360; + if (fabs(valn - val1) > 180) val1 += 360; + + double x0 = valn + copysign(xinc, val1 - valn); + + nc += fabs(x0 - val1) < 0.5 * xinc; + } + gridptr->isCyclic = nc > ysize / 2; + } + + if (lcheck && xbounds && xsize > 1) + { + bool isCyclic = true; + for (size_t j = 0; j < ysize; ++j) + { + size_t i1 = j * xsize, i2 = j * xsize + (xsize - 1); + for (size_t k1 = 0; k1 < numVertices; ++k1) + { + double val1 = xbounds[i1][k1]; + for (size_t k2 = 0; k2 < numVertices; ++k2) + { + double val2 = xbounds[i2][k2]; + + if (val1 < 1 && val2 > 300) val1 += 360; + if (val2 < 1 && val1 > 300) val2 += 360; + if (val1 < -179 && val2 > 120) val1 += 360; + if (val2 < -179 && val1 > 120) val2 += 360; + if (fabs(val2 - val1) > 180) val1 += 360; + + if (fabs(val1 - val2) < 0.001) goto foundCloseVertices; + } + } + // all vertices more than 0.001 degrees apart + isCyclic = false; + break; + foundCloseVertices:; + } + gridptr->isCyclic = isCyclic; + } + } +} + +int +gridIsCircular(int gridID) +{ + grid_t *gridptr = grid_to_pointer(gridID); + + if (gridptr->isCyclic == CDI_UNDEFID) grid_check_cyclic(gridptr); + + return gridptr->isCyclic; +} + +static bool +compareXYvals(grid_t *gridRef, grid_t *gridTest) +{ + bool differ = false; + int gridtype = gridTest->type; + + size_t xsizeTest = grid_is_irregular(gridtype) ? gridTest->size : gridTest->x.size; + size_t xsizeRef = (size_t) gridRef->vtable->inqXVals(gridRef, NULL); + if (xsizeTest != xsizeRef) return true; + + if (xsizeTest > 0) + { + const double *xvalsRef = gridRef->vtable->inqXValsPtr(gridRef); + const double *xvalsTest = gridTest->vtable->inqXValsPtr(gridTest); + if (!xvalsTest) return true; + + for (size_t i = 0; i < xsizeTest; ++i) + if (fabs(xvalsTest[i] - xvalsRef[i]) > 1.e-10) return true; + } + + size_t ysizeTest = grid_is_irregular(gridtype) ? gridTest->size : gridTest->y.size; + size_t ysizeRef = (size_t) gridRef->vtable->inqYVals(gridRef, NULL); + if (ysizeTest != ysizeRef) return true; + + if (ysizeTest > 0) + { + const double *yvalsRef = gridRef->vtable->inqYValsPtr(gridRef); + const double *yvalsTest = gridTest->vtable->inqYValsPtr(gridTest); + if (!yvalsTest) return true; + + for (size_t i = 0; i < ysizeTest; ++i) + if (fabs(yvalsTest[i] - yvalsRef[i]) > 1.e-10) return true; + } + + return differ; +} + +static bool +compareXYvals2(grid_t *gridRef, grid_t *gridTest) +{ + size_t gridsize = gridTest->size; + bool differ = ((gridTest->x.vals == NULL) ^ (gridRef->x.vals == NULL)) || ((gridTest->y.vals == NULL) ^ (gridRef->y.vals == NULL)) + || ((gridTest->x.bounds == NULL) ^ (gridRef->x.bounds == NULL)) + || ((gridTest->y.bounds == NULL) ^ (gridRef->y.bounds == NULL)); + + typedef double (*inqVal)(grid_t * grid, SizeType index); + inqVal inqXValRef = gridRef->vtable->inqXVal, inqYValRef = gridRef->vtable->inqYVal, inqXValTest = gridTest->vtable->inqXVal, + inqYValTest = gridTest->vtable->inqYVal; + + if (!differ && gridTest->x.vals) + differ = fabs(inqXValTest(gridTest, 0) - inqXValRef(gridRef, 0)) > 1.e-9 + || fabs(inqXValTest(gridTest, gridsize - 1) - inqXValRef(gridRef, gridsize - 1)) > 1.e-9; + + if (!differ && gridTest->y.vals) + differ = fabs(inqYValTest(gridTest, 0) - inqYValRef(gridRef, 0)) > 1.e-9 + || fabs(inqYValTest(gridTest, gridsize - 1) - inqYValRef(gridRef, gridsize - 1)) > 1.e-9; + + return differ; +} + +static bool +compare_bounds(const grid_t *grid, const grid_t *gridRef) +{ + bool differ = false; + + if ((grid->x.bounds && !gridRef->x.bounds) || (!grid->x.bounds && gridRef->x.bounds) || (grid->y.bounds && !gridRef->y.bounds) + || (!grid->y.bounds && gridRef->y.bounds)) + differ = true; + + return differ; +} + +static bool +compare_lonlat(int gridID, const grid_t *grid, const grid_t *gridRef) +{ + bool differ = false; + /* + printf("gridID %d\n", gridID); + printf("grid.xdef %d\n", grid->x.flag); + printf("grid.ydef %d\n", grid->y.flag); + printf("grid.xsize %zu\n", grid->x.size); + printf("grid.ysize %zu\n", grid->y.size); + printf("grid.xfirst %f\n", grid->x.first); + printf("grid.yfirst %f\n", grid->y.first); + printf("grid.xfirst %f\n", gridInqXval(gridID, 0)); + printf("grid.yfirst %f\n", gridInqYval(gridID, 0)); + printf("grid.xinc %f\n", grid->x.inc); + printf("grid.yinc %f\n", grid->y.inc); + printf("grid.xinc %f\n", gridInqXinc(gridID)); + printf("grid.yinc %f\n", gridInqYinc(gridID)); + */ + if (grid->x.size == gridRef->x.size && grid->y.size == gridRef->y.size) + { + if (grid->x.flag == 2 && grid->y.flag == 2) + { + if (!(IS_EQUAL(grid->x.first, 0) && IS_EQUAL(grid->x.last, 0) && IS_EQUAL(grid->x.inc, 0)) + && !(IS_EQUAL(grid->y.first, 0) && IS_EQUAL(grid->y.last, 0) && IS_EQUAL(grid->y.inc, 0)) + && IS_NOT_EQUAL(grid->x.first, grid->x.last) && IS_NOT_EQUAL(grid->y.first, grid->y.last)) + { + if (IS_NOT_EQUAL(grid->x.first, gridInqXval(gridID, 0)) || IS_NOT_EQUAL(grid->y.first, gridInqYval(gridID, 0))) + { + differ = true; + } + if (!differ && fabs(grid->x.inc) > 0 && fabs(fabs(grid->x.inc) - fabs(gridRef->x.inc)) > fabs(grid->x.inc / 1000)) + { + differ = true; + } + if (!differ && fabs(grid->y.inc) > 0 && fabs(fabs(grid->y.inc) - fabs(gridRef->y.inc)) > fabs(grid->y.inc / 1000)) + { + differ = true; + } + } + } + else if (grid->x.vals && grid->y.vals) + differ = gridRef->vtable->compareXYFull((grid_t *) gridRef, (grid_t *) grid); + + if (!differ) differ = compare_bounds(grid, gridRef); + } + else + differ = true; + + return differ; +} + +static bool +compare_projection(int gridID, const grid_t *grid, const grid_t *gridRef) +{ + bool differ = compare_lonlat(gridID, grid, gridRef); + + if (!differ) + { + // printf(">%s< >%s<\n", cdiInqVarKeyString(&grid->keys, CDI_KEY_GRIDMAP_VARNAME), cdiInqVarKeyString(&gridRef->keys, + // CDI_KEY_GRIDMAP_VARNAME)); printf(">%s< >%s<\n", cdiInqVarKeyString(&grid->keys, CDI_KEY_GRIDMAP_NAME), + // cdiInqVarKeyString(&gridRef->keys, CDI_KEY_GRIDMAP_NAME)); + // if (!str_is_equal(cdiInqVarKeyString(&grid->keys, CDI_KEY_GRIDMAP_VARNAME), cdiInqVarKeyString(&gridRef->keys, + // CDI_KEY_GRIDMAP_VARNAME))) return true; if (!str_is_equal(cdiInqVarKeyString(&grid->keys, CDI_KEY_GRIDMAP_NAME), + // cdiInqVarKeyString(&gridRef->keys, CDI_KEY_GRIDMAP_NAME))) return true; + } + + return differ; +} + +static bool +compare_generic(const grid_t *grid, const grid_t *gridRef) +{ + bool differ = false; + + if (grid->x.size == gridRef->x.size && grid->y.size == gridRef->y.size) + { + if (grid->x.flag == 1 && grid->y.flag == 1 && grid->x.vals && grid->y.vals) + differ = gridRef->vtable->compareXYFull((grid_t *) gridRef, (grid_t *) grid); + } + else if ((grid->y.size == 0 || grid->y.size == 1) && grid->x.size == gridRef->x.size * gridRef->y.size) + { + } + else + differ = true; + + return differ; +} + +static bool +compare_gaussian(int gridID, const grid_t *grid, const grid_t *gridRef) +{ + const double cmp_eps = 0.0015; + bool differ = false; + + if (grid->x.size == gridRef->x.size && grid->y.size == gridRef->y.size) + { + if (grid->x.flag == 2 && grid->y.flag == 2) + { + if (!(IS_EQUAL(grid->x.first, 0) && IS_EQUAL(grid->x.last, 0) && IS_EQUAL(grid->x.inc, 0)) + && !(IS_EQUAL(grid->y.first, 0) && IS_EQUAL(grid->y.last, 0))) + if (fabs(grid->x.first - gridInqXval(gridID, 0)) > cmp_eps || fabs(grid->y.first - gridInqYval(gridID, 0)) > cmp_eps + || (fabs(grid->x.inc) > 0 && fabs(fabs(grid->x.inc) - fabs(gridRef->x.inc)) > fabs(grid->x.inc / 1000))) + { + differ = true; + } + } + else if (grid->x.vals && grid->y.vals) + differ = gridRef->vtable->compareXYFull((grid_t *) gridRef, (grid_t *) grid); + + if (!differ) differ = compare_bounds(grid, gridRef); + } + else + differ = true; + + return differ; +} + +static bool +compare_curvilinear(const grid_t *grid, const grid_t *gridRef) +{ + bool differ = false; + + /* + printf("gridID %d\n", gridID); + printf("grid.xsize %d\n", grid->x.size); + printf("grid.ysize %d\n", grid->y.size); + printf("grid.xfirst %f\n", grid->x.vals[0]); + printf("grid.yfirst %f\n", grid->y.vals[0]); + printf("grid xfirst %f\n", gridInqXval(gridID, 0)); + printf("grid yfirst %f\n", gridInqYval(gridID, 0)); + printf("grid.xlast %f\n", grid->x.vals[grid->size-1]); + printf("grid.ylast %f\n", grid->y.vals[grid->size-1]); + printf("grid xlast %f\n", gridInqXval(gridID, grid->size-1)); + printf("grid ylast %f\n", gridInqYval(gridID, grid->size-1)); + printf("grid.nv %d\n", grid->nvertex); + printf("grid nv %d\n", gridInqNvertex(gridID)); + */ + if (grid->x.size == gridRef->x.size && grid->y.size == gridRef->y.size) + differ = gridRef->vtable->compareXYAO((grid_t *) gridRef, (grid_t *) grid); + + return differ; +} + +static bool +compare_unstructured(const grid_t *grid, const grid_t *gridRef, bool compareCoord) +{ + bool differ = false; + + unsigned char uuid1[CDI_UUID_SIZE] = { 0 }; + unsigned char uuid2[CDI_UUID_SIZE] = { 0 }; + int length = CDI_UUID_SIZE; + cdiInqVarKeyBytes(&gridRef->keys, CDI_KEY_UUID, uuid1, &length); + length = CDI_UUID_SIZE; + cdiInqVarKeyBytes(&grid->keys, CDI_KEY_UUID, uuid2, &length); + differ = ((!cdiUUIDIsNull(uuid1) || !cdiUUIDIsNull(uuid2)) && memcmp(uuid1, uuid2, CDI_UUID_SIZE)); + if (!differ) + { + int numberA = cdiInqVarKeyInt(&grid->keys, CDI_KEY_NUMBEROFGRIDUSED); + int numberB = cdiInqVarKeyInt(&gridRef->keys, CDI_KEY_NUMBEROFGRIDUSED); + int positionA = cdiInqVarKeyInt(&grid->keys, CDI_KEY_NUMBEROFGRIDINREFERENCE); + int positionB = cdiInqVarKeyInt(&gridRef->keys, CDI_KEY_NUMBEROFGRIDINREFERENCE); + if (compareCoord) + { + differ = (grid->nvertex != gridRef->nvertex || (numberA > 0 && positionA != positionB) + || gridRef->vtable->compareXYFull((grid_t *) gridRef, (grid_t *) grid)); + } + else + { + if (((grid->x.vals == NULL) ^ (gridRef->x.vals == NULL)) && ((grid->y.vals == NULL) ^ (gridRef->y.vals == NULL))) + { + int nvertexA = grid->nvertex, nvertexB = gridRef->nvertex; + differ = (nvertexA && nvertexB && (nvertexA != nvertexB)) + || ((numberA && numberB && (numberA != numberB)) || (numberA && numberB && positionA != positionB)); + } + else + { + differ = (grid->nvertex != gridRef->nvertex || numberA != numberB || (numberA > 0 && positionA != positionB) + || gridRef->vtable->compareXYAO((grid_t *) gridRef, (grid_t *) grid)); + } + } + } + + return differ; +} + +static bool +gridCompare(int gridID, const grid_t *grid, bool compareCoord) +{ + bool differ = true; + const grid_t *gridRef = grid_to_pointer(gridID); + + if (grid->type == gridRef->type || grid->type == GRID_GENERIC) + { + if (grid->size == gridRef->size) + { + differ = false; + if (grid->type == GRID_LONLAT) + { + differ = compare_lonlat(gridID, grid, gridRef); + } + else if (grid->type == GRID_PROJECTION) + { + differ = compare_projection(gridID, grid, gridRef); + } + else if (grid->type == GRID_GENERIC) + { + differ = compare_generic(grid, gridRef); + } + else if (grid->type == GRID_GAUSSIAN) + { + differ = compare_gaussian(gridID, grid, gridRef); + } + else if (grid->type == GRID_CURVILINEAR) + { + differ = compare_curvilinear(grid, gridRef); + } + else if (grid->type == GRID_UNSTRUCTURED) + { + differ = compare_unstructured(grid, gridRef, compareCoord); + } + } + } + + int scanningModeA = cdiInqVarKeyInt(&grid->keys, CDI_KEY_SCANNINGMODE); + int scanningModeB = cdiInqVarKeyInt(&gridRef->keys, CDI_KEY_SCANNINGMODE); + if (scanningModeA != scanningModeB) + { + // often grid definition may differ in UV-relativeToGrid + differ = true; +#ifdef HIRLAM_EXTENSIONS + if (cdiDebugExt >= 200) + printf("gridCompare(gridID=%d): Differs: scanningModeA [%d] != scanningModeB(gridID) [%d]\n", gridID, scanningModeA, + scanningModeB); +#endif // HIRLAM_EXTENSIONS + } + + return differ; +} + +int +cmp_key_int(const cdi_keys_t *keysp1, const cdi_keys_t *keysp2, int key) +{ + int v1 = cdiInqVarKeyInt(keysp1, key); + int v2 = cdiInqVarKeyInt(keysp2, key); + return (v1 != v2); +} + +int +gridCompareP(void *gridptr1, void *gridptr2) +{ + grid_t *g1 = (grid_t *) gridptr1; + grid_t *g2 = (grid_t *) gridptr2; + enum + { + equal = 0, + differ = -1 + }; + + xassert(g1); + xassert(g2); + + if (cdiInqVarKeyInt(&g1->keys, CDI_KEY_DATATYPE) != cdiInqVarKeyInt(&g2->keys, CDI_KEY_DATATYPE)) return differ; + if (g1->type != g2->type) return differ; + if (g1->isCyclic != g2->isCyclic) return differ; + if (g1->x.flag != g2->x.flag) return differ; + if (g1->y.flag != g2->y.flag) return differ; + if (g1->gme.nd != g2->gme.nd) return differ; + if (g1->gme.ni != g2->gme.ni) return differ; + if (g1->gme.ni2 != g2->gme.ni2) return differ; + if (g1->gme.ni3 != g2->gme.ni3) return differ; + if (cmp_key_int(&g1->keys, &g2->keys, CDI_KEY_NUMBEROFGRIDUSED)) return differ; + if (cmp_key_int(&g1->keys, &g2->keys, CDI_KEY_NUMBEROFGRIDINREFERENCE)) return differ; + if (g1->trunc != g2->trunc) return differ; + if (g1->nvertex != g2->nvertex) return differ; + if (g1->reducedPointsSize != g2->reducedPointsSize) return differ; + if (g1->size != g2->size) return differ; + if (g1->x.size != g2->x.size) return differ; + if (g1->y.size != g2->y.size) return differ; + if (g1->lcomplex != g2->lcomplex) return differ; + + if (IS_NOT_EQUAL(g1->x.first, g2->x.first)) return differ; + if (IS_NOT_EQUAL(g1->y.first, g2->y.first)) return differ; + if (IS_NOT_EQUAL(g1->x.last, g2->x.last)) return differ; + if (IS_NOT_EQUAL(g1->y.last, g2->y.last)) return differ; + if (IS_NOT_EQUAL(g1->x.inc, g2->x.inc)) return differ; + if (IS_NOT_EQUAL(g1->y.inc, g2->y.inc)) return differ; + if (cmp_key_int(&g1->keys, &g2->keys, CDI_KEY_SCANNINGMODE)) return differ; + + bool isIrregular = grid_is_irregular(g1->type); + { + const double *restrict g1_xvals = g1->vtable->inqXValsPtr(g1), *restrict g2_xvals = g2->vtable->inqXValsPtr(g2); + if ((g1_xvals != NULL) ^ (g2_xvals != NULL)) return differ; + if (g1_xvals) + { + size_t size = isIrregular ? g1->size : g1->x.size; + xassert(size); + for (size_t i = 0; i < size; i++) + if (IS_NOT_EQUAL(g1_xvals[i], g2_xvals[i])) return differ; + } + } + + { + const double *restrict g1_yvals = g1->vtable->inqYValsPtr(g1), *restrict g2_yvals = g2->vtable->inqYValsPtr(g2); + if ((g1_yvals != NULL) ^ (g2_yvals != NULL)) return differ; + if (g1_yvals) + { + size_t size = isIrregular ? g1->size : g1->y.size; + xassert(size); + for (size_t i = 0; i < size; i++) + if (IS_NOT_EQUAL(g1_yvals[i], g2_yvals[i])) return differ; + } + } + + { + const double *restrict g1_area = g1->vtable->inqAreaPtr(g1), *restrict g2_area = g2->vtable->inqAreaPtr(g2); + if ((g1_area != NULL) ^ (g2_area != NULL)) return differ; + if (g1_area) + { + size_t size = g1->size; + xassert(size); + + for (size_t i = 0; i < size; i++) + if (IS_NOT_EQUAL(g1_area[i], g2_area[i])) return differ; + } + } + + { + const double *restrict g1_xbounds = g1->vtable->inqXBoundsPtr(g1), *restrict g2_xbounds = g2->vtable->inqXBoundsPtr(g2); + if ((g1_xbounds != NULL) ^ (g2_xbounds != NULL)) return differ; + if (g1_xbounds) + { + xassert(g1->nvertex); + size_t size = g1->nvertex * (isIrregular ? g1->size : g1->x.size); + xassert(size); + + for (size_t i = 0; i < size; i++) + if (IS_NOT_EQUAL(g1_xbounds[i], g2_xbounds[i])) return differ; + } + } + + { + const double *restrict g1_ybounds = g1->vtable->inqYBoundsPtr(g1), *restrict g2_ybounds = g2->vtable->inqYBoundsPtr(g2); + if ((g1_ybounds != NULL) ^ (g2_ybounds != NULL)) return differ; + if (g1_ybounds) + { + xassert(g1->nvertex); + size_t size = g1->nvertex * (isIrregular ? g1->size : g1->y.size); + xassert(size); + + for (size_t i = 0; i < size; i++) + if (IS_NOT_EQUAL(g1_ybounds[i], g2_ybounds[i])) return differ; + } + } + + if (!str_is_equal(cdiInqVarKeyString(&g1->x.keys, CDI_KEY_NAME), cdiInqVarKeyString(&g2->x.keys, CDI_KEY_NAME))) return differ; + if (!str_is_equal(cdiInqVarKeyString(&g1->y.keys, CDI_KEY_NAME), cdiInqVarKeyString(&g2->y.keys, CDI_KEY_NAME))) return differ; + if (!str_is_equal(cdiInqVarKeyString(&g1->x.keys, CDI_KEY_LONGNAME), cdiInqVarKeyString(&g2->x.keys, CDI_KEY_LONGNAME))) + return differ; + if (!str_is_equal(cdiInqVarKeyString(&g1->y.keys, CDI_KEY_LONGNAME), cdiInqVarKeyString(&g2->y.keys, CDI_KEY_LONGNAME))) + return differ; + if (!str_is_equal(cdiInqVarKeyString(&g1->x.keys, CDI_KEY_UNITS), cdiInqVarKeyString(&g2->x.keys, CDI_KEY_UNITS))) return differ; + if (!str_is_equal(cdiInqVarKeyString(&g1->y.keys, CDI_KEY_UNITS), cdiInqVarKeyString(&g2->y.keys, CDI_KEY_UNITS))) return differ; + if (!str_is_equal(cdiInqVarKeyString(&g1->x.keys, CDI_KEY_STDNAME), cdiInqVarKeyString(&g2->x.keys, CDI_KEY_STDNAME))) + return differ; + if (!str_is_equal(cdiInqVarKeyString(&g1->y.keys, CDI_KEY_STDNAME), cdiInqVarKeyString(&g2->y.keys, CDI_KEY_STDNAME))) + return differ; + + if (!str_is_equal(cdiInqVarKeyString(&g1->y.keys, CDI_KEY_REFERENCEURI), cdiInqVarKeyString(&g2->y.keys, CDI_KEY_REFERENCEURI))) + return differ; + + if (g1->mask) + { + xassert(g1->size); + if (!g2->mask) return differ; + if (memcmp(g1->mask, g2->mask, g1->size * sizeof(mask_t))) return differ; + } + else if (g2->mask) + return differ; + + if (g1->mask_gme) + { + xassert(g1->size); + if (!g2->mask_gme) return differ; + if (memcmp(g1->mask_gme, g2->mask_gme, g1->size * sizeof(mask_t))) return differ; + } + else if (g2->mask_gme) + return differ; + + unsigned char uuid1[CDI_UUID_SIZE] = { 0 }; + unsigned char uuid2[CDI_UUID_SIZE] = { 0 }; + int length = CDI_UUID_SIZE; + cdiInqVarKeyBytes(&g1->keys, CDI_KEY_UUID, uuid1, &length); + length = CDI_UUID_SIZE; + cdiInqVarKeyBytes(&g2->keys, CDI_KEY_UUID, uuid2, &length); + if (memcmp(uuid1, uuid2, CDI_UUID_SIZE)) return differ; + + return equal; +} + +static void +grid_complete(grid_t *grid) +{ + int gridID = grid->self; + + if (grid->datatype != CDI_UNDEFID) cdiDefKeyInt(gridID, CDI_GLOBAL, CDI_KEY_DATATYPE, grid->datatype); + + int gridtype = grid->type; + switch (gridtype) + { + case GRID_LONLAT: + case GRID_GAUSSIAN: + case GRID_UNSTRUCTURED: + case GRID_CURVILINEAR: + case GRID_GENERIC: + case GRID_PROJECTION: + case GRID_CHARXY: + { + if (grid->x.size > 0) gridDefXsize(gridID, grid->x.size); + if (grid->y.size > 0) gridDefYsize(gridID, grid->y.size); + + if (gridtype == GRID_GAUSSIAN) gridDefNP(gridID, grid->np); + + if (grid->nvertex > 0) gridDefNvertex(gridID, grid->nvertex); + + if (grid->x.flag == 2) + { + assert(gridtype != GRID_UNSTRUCTURED && gridtype != GRID_CURVILINEAR); + double *xvals = (double *) Malloc(grid->x.size * sizeof(double)); + gridGenXvals(grid->x.size, grid->x.first, grid->x.last, grid->x.inc, xvals); + grid->x.vals = xvals; + // gridDefXinc(gridID, grid->x.inc); + } + + if (grid->y.flag == 2) + { + assert(gridtype != GRID_UNSTRUCTURED && gridtype != GRID_CURVILINEAR); + double *yvals = (double *) Malloc(grid->y.size * sizeof(double)); + gridGenYvals(gridtype, grid->y.size, grid->y.first, grid->y.last, grid->y.inc, yvals); + grid->y.vals = yvals; + // gridDefYinc(gridID, grid->y.inc); + } + + if (grid->projtype == CDI_PROJ_RLL) + { + const char *name = cdiInqVarKeyString(&grid->x.keys, CDI_KEY_NAME); + if (name[0] == 0 || name[0] == 'x') cdiDefKeyString(gridID, CDI_XAXIS, CDI_KEY_NAME, "rlon"); + name = cdiInqVarKeyString(&grid->y.keys, CDI_KEY_NAME); + if (name[0] == 0 || name[0] == 'y') cdiDefKeyString(gridID, CDI_YAXIS, CDI_KEY_NAME, "rlat"); + name = cdiInqVarKeyString(&grid->x.keys, CDI_KEY_LONGNAME); + if (name[0] == 0) cdiDefKeyString(gridID, CDI_XAXIS, CDI_KEY_LONGNAME, "longitude in rotated pole grid"); + name = cdiInqVarKeyString(&grid->y.keys, CDI_KEY_LONGNAME); + if (name[0] == 0) cdiDefKeyString(gridID, CDI_YAXIS, CDI_KEY_LONGNAME, "latitude in rotated pole grid"); + name = cdiInqVarKeyString(&grid->x.keys, CDI_KEY_UNITS); + if (name[0] == 0) cdiDefKeyString(gridID, CDI_XAXIS, CDI_KEY_UNITS, "degrees"); + name = cdiInqVarKeyString(&grid->y.keys, CDI_KEY_UNITS); + if (name[0] == 0) cdiDefKeyString(gridID, CDI_YAXIS, CDI_KEY_UNITS, "degrees"); + cdiDefKeyString(gridID, CDI_XAXIS, CDI_KEY_STDNAME, xystdname_tab[grid_xystdname_grid_latlon][0]); + cdiDefKeyString(gridID, CDI_YAXIS, CDI_KEY_STDNAME, xystdname_tab[grid_xystdname_grid_latlon][1]); + } + + if (gridtype == GRID_UNSTRUCTURED) + { + int number = cdiInqVarKeyInt(&grid->keys, CDI_KEY_NUMBEROFGRIDUSED); + if (number > 0) + { + cdiDefKeyInt(gridID, CDI_GLOBAL, CDI_KEY_NUMBEROFGRIDUSED, number); + int position = cdiInqVarKeyInt(&grid->keys, CDI_KEY_NUMBEROFGRIDINREFERENCE); + if (position > 0) cdiDefKeyInt(gridID, CDI_GLOBAL, CDI_KEY_NUMBEROFGRIDINREFERENCE, position); + } + } + + break; + } + case GRID_GAUSSIAN_REDUCED: + { + gridDefNP(gridID, grid->np); + gridDefYsize(gridID, grid->y.size); + if (grid->x.flag == 2) + { + double xvals[2] = { grid->x.first, grid->x.last }; + gridDefXsize(gridID, 2); + gridDefXvals(gridID, xvals); + } + + if (grid->y.flag == 2) + { + double *yvals = (double *) Malloc(grid->y.size * sizeof(double)); + gridGenYvals(gridtype, grid->y.size, grid->y.first, grid->y.last, grid->y.inc, yvals); + grid->y.vals = yvals; + // gridDefYinc(gridID, grid->y.inc); + } + break; + } + case GRID_SPECTRAL: + { + gridDefTrunc(gridID, grid->trunc); + if (grid->lcomplex) gridDefComplexPacking(gridID, 1); + break; + } + case GRID_FOURIER: + { + gridDefTrunc(gridID, grid->trunc); + break; + } + case GRID_GME: + { + gridDefParamGME(gridID, grid->gme.nd, grid->gme.ni, grid->gme.ni2, grid->gme.ni3); + break; + } + /* + case GRID_GENERIC: + { + if ( grid->x.size > 0 && grid->y.size > 0 ) + { + gridDefXsize(gridID, grid->x.size); + gridDefYsize(gridID, grid->y.size); + if ( grid->x.vals ) gridDefXvals(gridID, grid->x.vals); + if ( grid->y.vals ) gridDefYvals(gridID, grid->y.vals); + } + break; + } + */ + case GRID_TRAJECTORY: + { + gridDefXsize(gridID, 1); + gridDefYsize(gridID, 1); + break; + } + default: + { + Error("Gridtype %s unsupported!", gridNamePtr(gridtype)); + break; + } + } +} + +// Used only in iterator_grib.c +int +gridGenerate(const grid_t *grid) +{ + int gridtype = grid->type; + int gridID = gridCreate(gridtype, grid->size); + grid_t *restrict gridptr = grid_to_pointer(gridID); + cdiCopyVarKey(&grid->keys, CDI_KEY_DATATYPE, &gridptr->keys); + gridptr->x.size = grid->x.size; + gridptr->y.size = grid->y.size; + gridptr->np = grid->np; + gridptr->nvertex = grid->nvertex; + gridptr->x.flag = grid->x.flag; + int valdef_group1 = 0; + static const int valdef_group1_tab[] + = { GRID_LONLAT, GRID_GAUSSIAN, GRID_UNSTRUCTURED, GRID_CURVILINEAR, GRID_GENERIC, GRID_PROJECTION }; + for (size_t i = 0; i < sizeof(valdef_group1_tab) / sizeof(valdef_group1_tab[0]); ++i) + valdef_group1 |= (gridtype == valdef_group1_tab[i]); + if (valdef_group1 && grid->x.flag == 1) + { + gridDefXvals(gridID, grid->x.vals); + if (grid->x.bounds) gridDefXbounds(gridID, grid->x.bounds); + } + gridptr->x.first = grid->x.first; + gridptr->x.last = grid->x.last; + gridptr->x.inc = grid->x.inc; + gridptr->y.flag = grid->y.flag; + if ((valdef_group1 || gridtype == GRID_GAUSSIAN_REDUCED) && grid->y.flag == 1) + { + gridDefYvals(gridID, grid->y.vals); + if (grid->y.bounds) gridDefYbounds(gridID, grid->y.bounds); + } + gridptr->y.first = grid->y.first; + gridptr->y.last = grid->y.last; + gridptr->y.inc = grid->y.inc; + if (valdef_group1 && grid->area) gridDefArea(gridID, grid->area); + + cdiCopyVarKey(&grid->keys, CDI_KEY_NUMBEROFGRIDUSED, &gridptr->keys); + cdiCopyVarKey(&grid->keys, CDI_KEY_NUMBEROFGRIDINREFERENCE, &gridptr->keys); + cdiCopyVarKey(&grid->keys, CDI_KEY_REFERENCEURI, &gridptr->keys); + + cdiCopyVarKey(&grid->keys, CDI_KEY_SCANNINGMODE, &gridptr->keys); + + if (gridtype == GRID_PROJECTION) gridptr->name = strdup(grid->name); + if (gridtype == GRID_GAUSSIAN_REDUCED) gridDefReducedPoints(gridID, grid->y.size, grid->reducedPoints); + gridptr->trunc = grid->trunc; + gridptr->lcomplex = grid->lcomplex; + gridptr->gme.nd = grid->gme.nd; + gridptr->gme.ni = grid->gme.ni; + gridptr->gme.ni2 = grid->gme.ni2; + gridptr->gme.ni3 = grid->gme.ni3; + + grid_complete(gridptr); + + cdiCopyVarKey(&grid->keys, CDI_KEY_UUID, &gridptr->keys); + + return gridID; +} + +static void +grid_copy_base_array_fields(grid_t *gridptrOrig, grid_t *gridptrDup) +{ + size_t reducedPointsSize = (SizeType) gridptrOrig->reducedPointsSize; + size_t gridsize = gridptrOrig->size; + int gridtype = gridptrOrig->type; + bool isIrregular = grid_is_irregular(gridtype); + if (reducedPointsSize) + { + gridptrDup->reducedPoints = (int *) Malloc(reducedPointsSize * sizeof(int)); + memcpy(gridptrDup->reducedPoints, gridptrOrig->reducedPoints, reducedPointsSize * sizeof(int)); + } + + if (gridptrOrig->x.vals != NULL) + { + size_t size = isIrregular ? gridsize : gridptrOrig->x.size; + gridptrDup->x.vals = (double *) Malloc(size * sizeof(double)); + memcpy(gridptrDup->x.vals, gridptrOrig->x.vals, size * sizeof(double)); + } + + if (gridptrOrig->y.vals != NULL) + { + size_t size = isIrregular ? gridsize : gridptrOrig->y.size; + gridptrDup->y.vals = (double *) Malloc(size * sizeof(double)); + memcpy(gridptrDup->y.vals, gridptrOrig->y.vals, size * sizeof(double)); + } + + if (gridptrOrig->x.bounds != NULL) + { + size_t size = (isIrregular ? gridsize : gridptrOrig->x.size) * gridptrOrig->nvertex; + gridptrDup->x.bounds = (double *) Malloc(size * sizeof(double)); + memcpy(gridptrDup->x.bounds, gridptrOrig->x.bounds, size * sizeof(double)); + } + + if (gridptrOrig->y.bounds != NULL) + { + size_t size = (isIrregular ? gridsize : gridptrOrig->y.size) * gridptrOrig->nvertex; + gridptrDup->y.bounds = (double *) Malloc(size * sizeof(double)); + memcpy(gridptrDup->y.bounds, gridptrOrig->y.bounds, size * sizeof(double)); + } + + { + const double *gridptrOrig_area = gridptrOrig->vtable->inqAreaPtr(gridptrOrig); + if (gridptrOrig_area != NULL) + { + size_t size = gridsize; + gridptrDup->area = (double *) Malloc(size * sizeof(double)); + memcpy(gridptrDup->area, gridptrOrig_area, size * sizeof(double)); + } + } + + if (gridptrOrig->mask != NULL) + { + size_t size = gridsize; + gridptrDup->mask = (mask_t *) Malloc(size * sizeof(mask_t)); + memcpy(gridptrDup->mask, gridptrOrig->mask, size * sizeof(mask_t)); + } + + if (gridptrOrig->mask_gme != NULL) + { + size_t size = gridsize; + gridptrDup->mask_gme = (mask_t *) Malloc(size * sizeof(mask_t)); + memcpy(gridptrDup->mask_gme, gridptrOrig->mask_gme, size * sizeof(mask_t)); + } +} + +/* +@Function gridDuplicate +@Title Duplicate a horizontal Grid + +@Prototype int gridDuplicate(int gridID) +@Parameter + @Item gridID Grid ID, from a previous call to @fref{gridCreate} or @fref{vlistInqVarGrid}. + +@Description +The function @func{gridDuplicate} duplicates a horizontal Grid. + +@Result +@func{gridDuplicate} returns an identifier to the duplicated Grid. + +@EndFunction +*/ +int +gridDuplicate(int gridID) +{ + grid_t *gridptr = grid_to_pointer(gridID); + grid_t *gridptrnew = gridptr->vtable->copy(gridptr); + int gridIDnew = reshPut(gridptrnew, &gridOps); + gridptrnew->self = gridIDnew; + return gridIDnew; +} + +void +gridCompress(int gridID) +{ + grid_t *gridptr = grid_to_pointer(gridID); + + int gridtype = gridInqType(gridID); + if (gridtype == GRID_UNSTRUCTURED) + { + if (gridptr->mask_gme != NULL) + { + size_t gridsize = gridInqSize(gridID); + size_t nv = (size_t) gridptr->nvertex; + double *restrict area = (double *) gridptr->vtable->inqAreaPtr(gridptr), + *restrict xvals = (double *) gridptr->vtable->inqXValsPtr(gridptr), + *restrict yvals = (double *) gridptr->vtable->inqYValsPtr(gridptr), + *restrict xbounds = (double *) gridptr->vtable->inqXBoundsPtr(gridptr), + *restrict ybounds = (double *) gridptr->vtable->inqYBoundsPtr(gridptr); + mask_t *restrict mask_gme = gridptr->mask_gme; + size_t *restrict selection = (size_t *) Malloc(gridsize * sizeof(selection[0])); + size_t nselect; + { + size_t j = 0; + for (size_t i = 0; i < gridsize; i++) selection[j] = i, j += (mask_gme[i] != 0); + nselect = j; + } + selection = (size_t *) Realloc(selection, nselect * sizeof(selection[0])); + if (xvals) + for (size_t i = 0; i < nselect; i++) xvals[i] = xvals[selection[i]]; + if (yvals) + for (size_t i = 0; i < nselect; i++) yvals[i] = yvals[selection[i]]; + if (area) + for (size_t i = 0; i < nselect; i++) area[i] = area[selection[i]]; + if (xbounds) + for (size_t i = 0; i < nselect; i++) + for (size_t iv = 0; iv < nv; iv++) xbounds[i * nv + iv] = xbounds[selection[i] * nv + iv]; + if (ybounds) + for (size_t i = 0; i < nselect; i++) + for (size_t iv = 0; iv < nv; iv++) ybounds[i * nv + iv] = ybounds[selection[i] * nv + iv]; + Free(selection); + + /* fprintf(stderr, "grid compress %d %d %d\n", i, j, gridsize); */ + gridsize = nselect; + gridptr->size = (int) gridsize; + gridptr->x.size = (int) gridsize; + gridptr->y.size = (int) gridsize; + + double **resizeP[] = { &gridptr->x.vals, &gridptr->y.vals, &gridptr->area, &gridptr->x.bounds, &gridptr->y.bounds }; + size_t newSize[] = { gridsize, gridsize, gridsize, nv * gridsize, nv * gridsize }; + for (size_t i = 0; i < sizeof(resizeP) / sizeof(resizeP[0]); ++i) + if (*(resizeP[i])) *(resizeP[i]) = (double *) Realloc(*(resizeP[i]), newSize[i] * sizeof(double)); + + Free(gridptr->mask_gme); + gridptr->mask_gme = NULL; + gridMark4Update(gridID); + } + } + else + Warning("Unsupported grid type: %s", gridNamePtr(gridtype)); +} + +static void +gridDefAreaSerial(grid_t *gridptr, const double *area) +{ + size_t size = gridptr->size; + + if (size == 0) Error("size undefined for gridID = %d", gridptr->self); + + if (gridptr->area == NULL) + gridptr->area = (double *) Malloc(size * sizeof(double)); + else if (CDI_Debug) + Warning("values already defined!"); + + memcpy(gridptr->area, area, size * sizeof(double)); +} + +void +gridDefArea(int gridID, const double *area) +{ + grid_t *gridptr = grid_to_pointer(gridID); + gridptr->vtable->defArea(gridptr, area); + gridMark4Update(gridID); +} + +static void +gridInqAreaSerial(grid_t *gridptr, double *area) +{ + if (gridptr->area) memcpy(area, gridptr->area, gridptr->size * sizeof(double)); +} + +void +gridInqArea(int gridID, double *area) +{ + grid_t *gridptr = grid_to_pointer(gridID); + gridptr->vtable->inqArea(gridptr, area); +} + +static int +gridInqPropPresenceBase(grid_t *gridptr, enum gridPropInq inq) +{ + bool present = false; + switch (inq) + { + case GRID_PROP_MASK: present = gridptr->mask != NULL; break; + case GRID_PROP_MASK_GME: present = gridptr->mask != NULL; break; + case GRID_PROP_AREA: present = gridptr->area != NULL; break; + case GRID_PROP_XVALS: present = gridptr->x.vals != NULL; break; + case GRID_PROP_YVALS: present = gridptr->y.vals != NULL; break; + case GRID_PROP_XBOUNDS: present = gridptr->x.bounds != NULL; break; + case GRID_PROP_YBOUNDS: present = gridptr->y.bounds != NULL; break; + } + return present; +} + +int +gridInqPropPresence(int gridID, enum gridPropInq inq) +{ + grid_t *gridptr = grid_to_pointer(gridID); + return gridptr->vtable->inqPropPresence(gridptr, inq); +} + +int +gridHasArea(int gridID) +{ + grid_t *gridptr = grid_to_pointer(gridID); + return gridptr->vtable->inqPropPresence(gridptr, GRID_PROP_AREA); +} + +static const double * +gridInqAreaPtrBase(grid_t *gridptr) +{ + return gridptr->area; +} + +const double * +gridInqAreaPtr(int gridID) +{ + grid_t *gridptr = grid_to_pointer(gridID); + return gridptr->vtable->inqAreaPtr(gridptr); +} + +void +gridDefNvertex(int gridID, int nvertex) +{ + grid_t *gridptr = grid_to_pointer(gridID); + if (gridptr->nvertex != nvertex) + { + gridptr->nvertex = nvertex; + gridMark4Update(gridID); + } +} + +int +gridInqNvertex(int gridID) +{ + grid_t *gridptr = grid_to_pointer(gridID); + return gridptr->nvertex; +} + +static void +gridDefBoundsGeneric(grid_t *gridptr, const double *bounds, size_t regularSize, double **field) +{ + bool isIrregular = grid_is_irregular(gridptr->type); + size_t nvertex = (size_t) gridptr->nvertex; + if (nvertex == 0) + { + Warning("nvertex undefined for gridID = %d. Cannot define bounds!", gridptr->self); + return; + } + + size_t size = nvertex * (isIrregular ? gridptr->size : regularSize); + if (size == 0) Error("size undefined for gridID = %d", gridptr->self); + + if (*field == NULL && size) + *field = (double *) Malloc(size * sizeof(double)); + else if (CDI_Debug) + Warning("values already defined!"); + + copy_darray(size, bounds, *field); +} + +static void +gridDefXBoundsSerial(grid_t *gridptr, const double *xbounds) +{ + gridDefBoundsGeneric(gridptr, xbounds, gridptr->x.size, &gridptr->x.bounds); +} + +/* +@Function gridDefXbounds +@Title Define the bounds of a X-axis + +@Prototype void gridDefXbounds(int gridID, const double *xbounds) +@Parameter + @Item gridID Grid ID, from a previous call to @fref{gridCreate}. + @Item xbounds X-bounds of the grid. + +@Description +The function @func{gridDefXbounds} defines all bounds of the X-axis. + +@EndFunction +*/ +void +gridDefXbounds(int gridID, const double *xbounds) +{ + grid_t *gridptr = grid_to_pointer(gridID); + gridptr->vtable->defXBounds(gridptr, xbounds); + gridMark4Update(gridID); +} + +static SizeType +gridInqXBoundsSerial(grid_t *gridptr, double *xbounds) +{ + size_t nvertex = (size_t) gridptr->nvertex; + + bool isIrregular = grid_is_irregular(gridptr->type); + size_t size = nvertex * (isIrregular ? gridptr->size : gridptr->x.size); + + if (gridptr->x.bounds) + { + if (size && xbounds) + { + const double *gridptr_xbounds = gridptr->vtable->inqXBoundsPtr(gridptr); + copy_darray(size, gridptr_xbounds, xbounds); + } + } + else + size = 0; + + return (SizeType) size; +} + +/* +@Function gridInqXbounds +@Title Get the bounds of a X-axis + +@Prototype SizeType gridInqXbounds(int gridID, double *xbounds) +@Parameter + @Item gridID Grid ID, from a previous call to @fref{gridCreate} or @fref{vlistInqVarGrid}. + @Item xbounds Pointer to the location into which the X-bounds are read. + The caller must allocate space for the returned values. + +@Description +The function @func{gridInqXbounds} returns the bounds of the X-axis. + +@Result +Upon successful completion @func{gridInqXbounds} returns the number of bounds and +the bounds are stored in @func{xbounds}. +Otherwise, 0 is returned and @func{xbounds} is empty. + +@EndFunction +*/ +SizeType +gridInqXbounds(int gridID, double *xbounds) +{ + grid_t *gridptr = grid_to_pointer(gridID); + return gridptr->vtable->inqXBounds(gridptr, xbounds); +} + +static const double * +gridInqXBoundsPtrSerial(grid_t *gridptr) +{ + return gridptr->x.bounds; +} + +const double * +gridInqXboundsPtr(int gridID) +{ + grid_t *gridptr = grid_to_pointer(gridID); + return gridptr->vtable->inqXBoundsPtr(gridptr); +} + +static void +gridDefYBoundsSerial(grid_t *gridptr, const double *ybounds) +{ + gridDefBoundsGeneric(gridptr, ybounds, gridptr->y.size, &gridptr->y.bounds); +} + +//---------------------------------------------------------------------------- +// Parallel Version +//---------------------------------------------------------------------------- + +SizeType +gridInqXboundsPart(int gridID, int start, SizeType size, double *xbounds) +{ + grid_t *gridptr = grid_to_pointer(gridID); + const double *gridptr_xbounds = gridptr->vtable->inqXBoundsPtr(gridptr); + if (gridptr_xbounds && size && xbounds) memcpy(xbounds, gridptr_xbounds + start, size * sizeof(double)); + + return size; +} + +SizeType +gridInqYboundsPart(int gridID, int start, SizeType size, double *ybounds) +{ + grid_t *gridptr = grid_to_pointer(gridID); + const double *gridptr_ybounds = gridptr->vtable->inqYBoundsPtr(gridptr); + if (gridptr_ybounds && size && ybounds) memcpy(ybounds, gridptr_ybounds + start, size * sizeof(double)); + + return size; +} + +/* +@Function gridDefYbounds +@Title Define the bounds of a Y-axis + +@Prototype void gridDefYbounds(int gridID, const double *ybounds) +@Parameter + @Item gridID Grid ID, from a previous call to @fref{gridCreate}. + @Item ybounds Y-bounds of the grid. + +@Description +The function @func{gridDefYbounds} defines all bounds of the Y-axis. + +@EndFunction +*/ +void +gridDefYbounds(int gridID, const double *ybounds) +{ + grid_t *gridptr = grid_to_pointer(gridID); + gridptr->vtable->defYBounds(gridptr, ybounds); + gridMark4Update(gridID); +} + +static SizeType +gridInqYBoundsSerial(grid_t *gridptr, double *ybounds) +{ + size_t nvertex = (size_t) gridptr->nvertex; + + bool isIrregular = grid_is_irregular(gridptr->type); + size_t size = nvertex * (isIrregular ? gridptr->size : gridptr->y.size); + + if (gridptr->y.bounds) + { + if (size && ybounds) + { + const double *gridptr_ybounds = gridptr->vtable->inqYBoundsPtr(gridptr); + copy_darray(size, gridptr_ybounds, ybounds); + } + } + else + size = 0; + + return (SizeType) size; +} + +/* +@Function gridInqYbounds +@Title Get the bounds of a Y-axis + +@Prototype SizeType gridInqYbounds(int gridID, double *ybounds) +@Parameter + @Item gridID Grid ID, from a previous call to @fref{gridCreate} or @fref{vlistInqVarGrid}. + @Item ybounds Pointer to the location into which the Y-bounds are read. + The caller must allocate space for the returned values. + +@Description +The function @func{gridInqYbounds} returns the bounds of the Y-axis. + +@Result +Upon successful completion @func{gridInqYbounds} returns the number of bounds and +the bounds are stored in @func{ybounds}. +Otherwise, 0 is returned and @func{ybounds} is empty. + +@EndFunction +*/ +SizeType +gridInqYbounds(int gridID, double *ybounds) +{ + grid_t *gridptr = grid_to_pointer(gridID); + return gridptr->vtable->inqYBounds(gridptr, ybounds); +} + +static const double * +gridInqYBoundsPtrSerial(grid_t *gridptr) +{ + return gridptr->y.bounds; +} + +const double * +gridInqYboundsPtr(int gridID) +{ + grid_t *gridptr = grid_to_pointer(gridID); + return gridptr->vtable->inqYBoundsPtr(gridptr); +} + +static void +printDblsPrefixAutoBrk(FILE *fp, int dig, const char prefix[], size_t nbyte0, size_t n, const double vals[]) +{ + fputs(prefix, fp); + size_t nbyte = nbyte0; + for (size_t i = 0; i < n; i++) + { + if (nbyte > 80) + { + fprintf(fp, "\n%*s", (int) nbyte0, ""); + nbyte = nbyte0; + } + nbyte += (size_t) fprintf(fp, "%.*g ", dig, vals[i]); + } + fputs("\n", fp); +} + +static inline void * +resizeBuffer(void **buf, size_t *bufSize, size_t reqSize) +{ + if (reqSize > *bufSize) + { + *buf = Realloc(*buf, reqSize); + *bufSize = reqSize; + } + return *buf; +} + +static void +gridPrintAttributes(FILE *fp, int gridID) +{ + int cdiID = gridID; + int varID = CDI_GLOBAL; + int atttype, attlen; + char attname[CDI_MAX_NAME + 1]; + void *attBuf = NULL; + size_t attBufSize = 0; + + int natts; + cdiInqNatts(cdiID, varID, &natts); + + for (int iatt = 0; iatt < natts; ++iatt) + { + cdiInqAtt(cdiID, varID, iatt, attname, &atttype, &attlen); + + if (attlen == 0) continue; + + if (atttype == CDI_DATATYPE_TXT) + { + size_t attSize = (size_t) (attlen + 1) * sizeof(char); + char *atttxt = (char *) resizeBuffer(&attBuf, &attBufSize, attSize); + cdiInqAttTxt(cdiID, varID, attname, attlen, atttxt); + atttxt[attlen] = 0; + fprintf(fp, "ATTR_TXT: %s = \"%s\"\n", attname, atttxt); + } + else if (atttype == CDI_DATATYPE_INT8 || atttype == CDI_DATATYPE_UINT8 || atttype == CDI_DATATYPE_INT16 + || atttype == CDI_DATATYPE_UINT16 || atttype == CDI_DATATYPE_INT32 || atttype == CDI_DATATYPE_UINT32) + { + size_t attSize = (size_t) attlen * sizeof(int); + int *attint = (int *) resizeBuffer(&attBuf, &attBufSize, attSize); + cdiInqAttInt(cdiID, varID, attname, attlen, &attint[0]); + if (attlen == 1) + fprintf(fp, "ATTR_INT: %s =", attname); + else + fprintf(fp, "ATTR_INT_%d: %s =", attlen, attname); + for (int i = 0; i < attlen; ++i) fprintf(fp, " %d", attint[i]); + fprintf(fp, "\n"); + } + else if (atttype == CDI_DATATYPE_FLT32 || atttype == CDI_DATATYPE_FLT64) + { + size_t attSize = (size_t) attlen * sizeof(double); + double *attflt = (double *) resizeBuffer(&attBuf, &attBufSize, attSize); + int dig = (atttype == CDI_DATATYPE_FLT64) ? 15 : 7; + cdiInqAttFlt(cdiID, varID, attname, attlen, attflt); + if (attlen == 1) + fprintf(fp, "ATTR_FLT: %s =", attname); + else + fprintf(fp, "ATTR_FLT_%d: %s =", attlen, attname); + for (int i = 0; i < attlen; ++i) fprintf(fp, " %.*g", dig, attflt[i]); + fprintf(fp, "\n"); + } + } + + Free(attBuf); +} + +static void +gridPrintKernel(int gridID, int opt, FILE *fp) +{ + char attstr[CDI_MAX_NAME]; + char attstr2[CDI_MAX_NAME]; + size_t nxvals = gridInqXvals(gridID, NULL); + size_t nyvals = gridInqYvals(gridID, NULL); + + int type = gridInqType(gridID); + size_t gridsize = gridInqSize(gridID); + size_t xsize = gridInqXsize(gridID); + size_t ysize = gridInqYsize(gridID); + int nvertex = gridInqNvertex(gridID); + int datatype; + cdiInqKeyInt(gridID, CDI_GLOBAL, CDI_KEY_DATATYPE, &datatype); + + int dig = (datatype == CDI_DATATYPE_FLT64) ? 15 : 7; + + fprintf(fp, + "gridtype = %s\n" + "gridsize = %zu\n", + gridNamePtr(type), gridsize); + + if (type != GRID_GME) + { + if (type != GRID_UNSTRUCTURED && type != GRID_SPECTRAL && type != GRID_FOURIER) + { + if (xsize > 0) fprintf(fp, "xsize = %zu\n", xsize); + if (ysize > 0) fprintf(fp, "ysize = %zu\n", ysize); + } + + if (nxvals > 0) + { + int length = CDI_MAX_NAME; + cdiInqKeyString(gridID, CDI_XAXIS, CDI_KEY_NAME, attstr, &length); + if (attstr[0]) fprintf(fp, "xname = %s\n", attstr); + length = CDI_MAX_NAME; + cdiInqKeyString(gridID, CDI_XAXIS, CDI_KEY_DIMNAME, attstr2, &length); + if (attstr2[0] && !str_is_equal(attstr, attstr2)) fprintf(fp, "xdimname = %s\n", attstr2); + length = CDI_MAX_NAME; + cdiInqKeyString(gridID, CDI_XAXIS, CDI_KEY_LONGNAME, attstr, &length); + if (attstr[0]) fprintf(fp, "xlongname = %s\n", attstr); + length = CDI_MAX_NAME; + cdiInqKeyString(gridID, CDI_XAXIS, CDI_KEY_UNITS, attstr, &length); + if (attstr[0]) fprintf(fp, "xunits = %s\n", attstr); + } + + if (nyvals > 0) + { + int length = CDI_MAX_NAME; + cdiInqKeyString(gridID, CDI_YAXIS, CDI_KEY_NAME, attstr, &length); + if (attstr[0]) fprintf(fp, "yname = %s\n", attstr); + length = CDI_MAX_NAME; + cdiInqKeyString(gridID, CDI_YAXIS, CDI_KEY_DIMNAME, attstr2, &length); + if (attstr2[0] && !str_is_equal(attstr, attstr2)) fprintf(fp, "ydimname = %s\n", attstr2); + length = CDI_MAX_NAME; + cdiInqKeyString(gridID, CDI_YAXIS, CDI_KEY_LONGNAME, attstr, &length); + if (attstr[0]) fprintf(fp, "ylongname = %s\n", attstr); + length = CDI_MAX_NAME; + cdiInqKeyString(gridID, CDI_YAXIS, CDI_KEY_UNITS, attstr, &length); + if (attstr[0]) fprintf(fp, "yunits = %s\n", attstr); + } + + if (type == GRID_UNSTRUCTURED && nvertex > 0) fprintf(fp, "nvertex = %d\n", nvertex); + } + + switch (type) + { + case GRID_LONLAT: + case GRID_GAUSSIAN: + case GRID_GAUSSIAN_REDUCED: + case GRID_GENERIC: + case GRID_PROJECTION: + case GRID_CURVILINEAR: + case GRID_UNSTRUCTURED: + case GRID_CHARXY: + { + if (type == GRID_GAUSSIAN || type == GRID_GAUSSIAN_REDUCED) fprintf(fp, "np = %d\n", gridInqNP(gridID)); + + if (type == GRID_UNSTRUCTURED) + { + int number = 0; + cdiInqKeyInt(gridID, CDI_GLOBAL, CDI_KEY_NUMBEROFGRIDUSED, &number); + if (number > 0) + { + fprintf(fp, "number = %d\n", number); + int position = 0; + cdiInqKeyInt(gridID, CDI_GLOBAL, CDI_KEY_NUMBEROFGRIDINREFERENCE, &position); + if (position >= 0) fprintf(fp, "position = %d\n", position); + } + + int length; + if (CDI_NOERR == cdiInqKeyLen(gridID, CDI_GLOBAL, CDI_KEY_REFERENCEURI, &length)) + { + char reference_link[8192]; + length = sizeof(reference_link); + cdiInqKeyString(gridID, CDI_GLOBAL, CDI_KEY_REFERENCEURI, reference_link, &length); + fprintf(fp, "uri = %s\n", reference_link); + } + } + + if (nxvals > 0) + { + double xfirst = 0.0, xinc = 0.0; + + if (type == GRID_LONLAT || type == GRID_GAUSSIAN || type == GRID_PROJECTION || type == GRID_GENERIC) + { + xfirst = gridInqXval(gridID, 0); + xinc = gridInqXinc(gridID); + } + + if (IS_NOT_EQUAL(xinc, 0) && opt) + { + fprintf(fp, + "xfirst = %.*g\n" + "xinc = %.*g\n", + dig, xfirst, dig, xinc); + } + else + { + double *xvals = (double *) Malloc(nxvals * sizeof(double)); + gridInqXvals(gridID, xvals); + static const char prefix[] = "xvals = "; + printDblsPrefixAutoBrk(fp, dig, prefix, sizeof(prefix) - 1, nxvals, xvals); + Free(xvals); + } + } + + if (nyvals > 0) + { + double yfirst = 0.0, yinc = 0.0; + + if (type == GRID_LONLAT || type == GRID_GENERIC || type == GRID_PROJECTION || type == GRID_GENERIC) + { + yfirst = gridInqYval(gridID, 0); + yinc = gridInqYinc(gridID); + } + + if (IS_NOT_EQUAL(yinc, 0) && opt) + { + fprintf(fp, + "yfirst = %.*g\n" + "yinc = %.*g\n", + dig, yfirst, dig, yinc); + } + else + { + double *yvals = (double *) Malloc(nyvals * sizeof(double)); + gridInqYvals(gridID, yvals); + static const char prefix[] = "yvals = "; + printDblsPrefixAutoBrk(fp, dig, prefix, sizeof(prefix) - 1, nyvals, yvals); + Free(yvals); + } + } + + if (type == GRID_PROJECTION) gridPrintAttributes(fp, gridID); + + break; + } + case GRID_SPECTRAL: + { + fprintf(fp, + "truncation = %d\n" + "complexpacking = %d\n", + gridInqTrunc(gridID), gridInqComplexPacking(gridID)); + break; + } + case GRID_FOURIER: + { + fprintf(fp, "truncation = %d\n", gridInqTrunc(gridID)); + break; + } + case GRID_GME: + { + int nd, ni, ni2, ni3; + gridInqParamGME(gridID, &nd, &ni, &ni2, &ni3); + fprintf(fp, "ni = %d\n", ni); + break; + } + default: + { + fprintf(stderr, "Unsupported grid type: %s\n", gridNamePtr(type)); + break; + } + } +} + +void +gridPrintP(void *voidptr, FILE *fp) +{ + grid_t *gridptr = (grid_t *) voidptr; + int gridID = gridptr->self; + + xassert(gridptr); + + gridPrintKernel(gridID, 0, fp); + + int datatype = CDI_UNDEFID; + cdiInqKeyInt(gridID, CDI_GLOBAL, CDI_KEY_DATATYPE, &datatype); + + fprintf(fp, + "datatype = %d\n" + "nd = %d\n" + "ni = %d\n" + "ni2 = %d\n" + "ni3 = %d\n" + "trunc = %d\n" + "lcomplex = %d\n" + "reducedPointsSize = %d\n", + datatype, gridptr->gme.nd, gridptr->gme.ni, gridptr->gme.ni2, gridptr->gme.ni3, gridptr->trunc, gridptr->lcomplex, + gridptr->reducedPointsSize); +} + +static const double * +gridInqXValsPtrSerial(grid_t *gridptr) +{ + return gridptr->x.vals; +} + +#ifndef USE_MPI +static const char ** +gridInqXCvalsPtrSerial(grid_t *gridptr) +{ + return (const char **) gridptr->x.cvals; +} +#endif + +const double * +gridInqXvalsPtr(int gridID) +{ + grid_t *gridptr = grid_to_pointer(gridID); + return gridptr->vtable->inqXValsPtr(gridptr); +} + +#ifndef USE_MPI +const char ** +gridInqXCvalsPtr(int gridID) +{ + grid_t *gridptr = grid_to_pointer(gridID); + return gridptr->vtable->inqXCvalsPtr(gridptr); +} +#endif + +static const double * +gridInqYValsPtrSerial(grid_t *gridptr) +{ + return gridptr->y.vals; +} + +#ifndef USE_MPI +static const char ** +gridInqYCvalsPtrSerial(grid_t *gridptr) +{ + return (const char **) gridptr->y.cvals; +} +#endif + +const double * +gridInqYvalsPtr(int gridID) +{ + grid_t *gridptr = grid_to_pointer(gridID); + return gridptr->vtable->inqYValsPtr(gridptr); +} + +#ifndef USE_MPI +const char ** +gridInqYCvalsPtr(int gridID) +{ + grid_t *gridptr = grid_to_pointer(gridID); + return gridptr->vtable->inqYCvalsPtr(gridptr); +} +#endif + +void +gridProjParamsInit(struct CDI_GridProjParams *gpp) +{ + // clang-format off + gpp->mv = CDI_Grid_Missval; // Missing value + gpp->lon_0 = CDI_Grid_Missval; // The East longitude of the meridian which is parallel to the Y-axis + gpp->lat_0 = CDI_Grid_Missval; // Latitude of the projection origin + gpp->lat_1 = CDI_Grid_Missval; // First latitude from the pole at which the secant cone cuts the sphere + gpp->lat_2 = CDI_Grid_Missval; // Second latitude at which the secant cone cuts the sphere + gpp->a = CDI_Grid_Missval; // Semi-major axis or earth radius in metres (optional) + gpp->b = CDI_Grid_Missval; // Semi-minor axis in metres (optional) + gpp->rf = CDI_Grid_Missval; // Inverse flattening (1/f) (optional) + gpp->xval_0 = CDI_Grid_Missval; // Longitude of the first grid point in degree (optional) + gpp->yval_0 = CDI_Grid_Missval; // Latitude of the first grid point in degree (optional) + gpp->x_0 = CDI_Grid_Missval; // False easting (optional) + gpp->y_0 = CDI_Grid_Missval; // False northing (optional) + // clang-format on +} + +static void +gridDefParamsCommon(int gridID, struct CDI_GridProjParams gpp) +{ + if (IS_NOT_EQUAL(gpp.a, gpp.mv)) + { + if (IS_NOT_EQUAL(gpp.b, gpp.mv)) + { + cdiDefAttFlt(gridID, CDI_GLOBAL, "semi_major_axis", CDI_DATATYPE_FLT64, 1, &gpp.a); + cdiDefAttFlt(gridID, CDI_GLOBAL, "semi_minor_axis", CDI_DATATYPE_FLT64, 1, &gpp.b); + } + else + { + cdiDefAttFlt(gridID, CDI_GLOBAL, "earth_radius", CDI_DATATYPE_FLT64, 1, &gpp.a); + } + } + if (IS_NOT_EQUAL(gpp.rf, gpp.mv)) cdiDefAttFlt(gridID, CDI_GLOBAL, "inverse_flattening", CDI_DATATYPE_FLT64, 1, &gpp.rf); + if (IS_NOT_EQUAL(gpp.x_0, gpp.mv)) cdiDefAttFlt(gridID, CDI_GLOBAL, "false_easting", CDI_DATATYPE_FLT64, 1, &gpp.x_0); + if (IS_NOT_EQUAL(gpp.y_0, gpp.mv)) cdiDefAttFlt(gridID, CDI_GLOBAL, "false_northing", CDI_DATATYPE_FLT64, 1, &gpp.y_0); + if (IS_NOT_EQUAL(gpp.xval_0, gpp.mv)) + cdiDefAttFlt(gridID, CDI_GLOBAL, "longitudeOfFirstGridPointInDegrees", CDI_DATATYPE_FLT64, 1, &gpp.xval_0); + if (IS_NOT_EQUAL(gpp.yval_0, gpp.mv)) + cdiDefAttFlt(gridID, CDI_GLOBAL, "latitudeOfFirstGridPointInDegrees", CDI_DATATYPE_FLT64, 1, &gpp.yval_0); +} + +/* +@Function gridDefParamsLCC +@Title Define the parameters of a Lambert Conformal Conic grid + +@Prototype void gridDefParamsLCC(int gridID, struct CDI_GridProjParams gridProjParams) +@Parameter + @Item gridID Grid ID, from a previous call to @fref{gridCreate}. + @Item gridProjParams Grid projection parameters. + +@Description +The function @func{gridDefParamsLCC} defines the parameters of a Lambert Conformal Conic grid. + +@EndFunction +*/ +void +gridDefParamsLCC(int gridID, struct CDI_GridProjParams gpp) +{ + cdiDefKeyString(gridID, CDI_GLOBAL, CDI_KEY_GRIDMAP_VARNAME, "Lambert_Conformal"); + + const char *gmapname = "lambert_conformal_conic"; + cdiDefKeyString(gridID, CDI_GLOBAL, CDI_KEY_GRIDMAP_NAME, gmapname); + cdiDefAttTxt(gridID, CDI_GLOBAL, "grid_mapping_name", (int) (strlen(gmapname)), gmapname); + int nlats = 0; + double lats[2]; + lats[nlats++] = gpp.lat_1; + if (IS_NOT_EQUAL(gpp.lat_1, gpp.lat_2)) lats[nlats++] = gpp.lat_2; + cdiDefAttFlt(gridID, CDI_GLOBAL, "standard_parallel", CDI_DATATYPE_FLT64, nlats, lats); + cdiDefAttFlt(gridID, CDI_GLOBAL, "longitude_of_central_meridian", CDI_DATATYPE_FLT64, 1, &gpp.lon_0); + cdiDefAttFlt(gridID, CDI_GLOBAL, "latitude_of_projection_origin", CDI_DATATYPE_FLT64, 1, &gpp.lat_0); + + gridDefParamsCommon(gridID, gpp); + + grid_t *gridptr = grid_to_pointer(gridID); + gridptr->projtype = CDI_PROJ_LCC; + + if (gridptr->type != GRID_PROJECTION) gridptr->type = GRID_PROJECTION; + + gridVerifyProj(gridID); +} + +/* +@Function gridInqParamsLCC +@Title Get the parameter of a Lambert Conformal Conic grid + +@Prototype void gridInqParamsLCC(int gridID, struct CDI_GridProjParams *gpp) +@Parameter + @Item gridID Grid ID, from a previous call to @fref{gridCreate} or @fref{vlistInqVarGrid}. + @Item gridProjParams Grid projection parameters. + +@Description +The function @func{gridInqParamsLCC} returns the parameter of a Lambert Conformal Conic grid. + +@EndFunction +*/ +int +gridInqParamsLCC(int gridID, struct CDI_GridProjParams *gpp) +{ + int status = -1; + if (gridInqType(gridID) != GRID_PROJECTION) return status; + + gridProjParamsInit(gpp); + + status = -2; + const char *projection = "lambert_conformal_conic"; + char gmapname[CDI_MAX_NAME]; + int length = CDI_MAX_NAME; + cdiInqKeyString(gridID, CDI_GLOBAL, CDI_KEY_GRIDMAP_NAME, gmapname, &length); + if (gmapname[0] && str_is_equal(gmapname, projection)) + { + char attname[CDI_MAX_NAME + 1]; + + int natts; + cdiInqNatts(gridID, CDI_GLOBAL, &natts); + + if (natts) status = 0; + + for (int iatt = 0; iatt < natts; ++iatt) + { + int atttype, attlen; + cdiInqAtt(gridID, CDI_GLOBAL, iatt, attname, &atttype, &attlen); + if (attlen > 2) continue; + + double attflt[2]; + if (cdiInqAttConvertedToFloat(gridID, atttype, attname, attlen, attflt)) + { + // clang-format off + if (str_is_equal(attname, "earth_radius")) gpp->a = attflt[0]; + else if (str_is_equal(attname, "semi_major_axis")) gpp->a = attflt[0]; + else if (str_is_equal(attname, "semi_minor_axis")) gpp->b = attflt[0]; + else if (str_is_equal(attname, "inverse_flattening")) gpp->rf = attflt[0]; + else if (str_is_equal(attname, "longitude_of_central_meridian")) gpp->lon_0 = attflt[0]; + else if (str_is_equal(attname, "latitude_of_projection_origin")) gpp->lat_0 = attflt[0]; + else if (str_is_equal(attname, "false_easting")) gpp->x_0 = attflt[0]; + else if (str_is_equal(attname, "false_northing")) gpp->y_0 = attflt[0]; + else if (str_is_equal(attname, "longitudeOfFirstGridPointInDegrees")) gpp->xval_0 = attflt[0]; + else if (str_is_equal(attname, "latitudeOfFirstGridPointInDegrees")) gpp->yval_0 = attflt[0]; + else if (str_is_equal(attname, "standard_parallel")) + { + gpp->lat_1 = attflt[0]; + gpp->lat_2 = (attlen == 2) ? attflt[1] : attflt[0]; + } + // clang-format on + } + } + } + + return status; +} + +int +gridVerifyProjParamsLCC(struct CDI_GridProjParams *gpp) +{ + static bool lwarn = true; + + if (lwarn) + { + // lwarn = false; + const char *projection = "lambert_conformal_conic"; + if (IS_EQUAL(gpp->lon_0, gpp->mv)) Warning("%s mapping parameter %s missing!", projection, "longitude_of_central_meridian"); + if (IS_EQUAL(gpp->lat_0, gpp->mv)) Warning("%s mapping parameter %s missing!", projection, "latitude_of_central_meridian"); + if (IS_EQUAL(gpp->lat_1, gpp->mv)) Warning("%s mapping parameter %s missing!", projection, "standard_parallel"); + if (IS_NOT_EQUAL(gpp->x_0, gpp->mv) && IS_NOT_EQUAL(gpp->y_0, gpp->mv) + && (IS_EQUAL(gpp->xval_0, gpp->mv) || IS_EQUAL(gpp->yval_0, gpp->mv))) + { + if (proj_lcc_to_lonlat_func) + { + gpp->xval_0 = -gpp->x_0; + gpp->yval_0 = -gpp->y_0; + proj_lcc_to_lonlat_func(*gpp, 0.0, 0.0, (SizeType) 1, &gpp->xval_0, &gpp->yval_0); + } + if (IS_EQUAL(gpp->xval_0, gpp->mv) || IS_EQUAL(gpp->yval_0, gpp->mv)) + Warning("%s mapping parameter %s missing!", projection, + "longitudeOfFirstGridPointInDegrees and latitudeOfFirstGridPointInDegrees"); + } + } + + return 0; +} + +int +gridVerifyProjParamsSTERE(struct CDI_GridProjParams *gpp) +{ + static bool lwarn = true; + + if (lwarn) + { + // lwarn = false; + const char *projection = "lambert_conformal_conic"; + if (IS_EQUAL(gpp->lon_0, gpp->mv)) + Warning("%s mapping parameter %s missing!", projection, "straight_vertical_longitude_from_pole"); + if (IS_EQUAL(gpp->lat_0, gpp->mv)) Warning("%s mapping parameter %s missing!", projection, "latitude_of_projection_origin"); + if (IS_EQUAL(gpp->lat_1, gpp->mv)) Warning("%s mapping parameter %s missing!", projection, "standard_parallel"); + if (IS_NOT_EQUAL(gpp->x_0, gpp->mv) && IS_NOT_EQUAL(gpp->y_0, gpp->mv) + && (IS_EQUAL(gpp->xval_0, gpp->mv) || IS_EQUAL(gpp->yval_0, gpp->mv))) + { + if (proj_stere_to_lonlat_func) + { + gpp->xval_0 = -gpp->x_0; + gpp->xval_0 = -gpp->y_0; + proj_stere_to_lonlat_func(*gpp, 0.0, 0.0, (SizeType) 1, &gpp->xval_0, &gpp->yval_0); + } + if (IS_EQUAL(gpp->xval_0, gpp->mv) || IS_EQUAL(gpp->yval_0, gpp->mv)) + Warning("%s mapping parameter %s missing!", projection, + "longitudeOfFirstGridPointInDegrees and latitudeOfFirstGridPointInDegrees"); + } + } + + return 0; +} + +/* +@Function gridDefParamsSTERE +@Title Define the parameter of a Polar stereographic grid + +@Prototype void gridDefParamsSTERE(int gridID, struct CDI_GridProjParams gridProjParams) +@Parameter + @Item gridID Grid ID, from a previous call to @fref{gridCreate}. + @Item gridProjParams Grid projection parameters. + +@Description +The function @func{gridDefParamsSTERE} defines the parameter of a Polar stereographic grid. + +@EndFunction +*/ +void +gridDefParamsSTERE(int gridID, struct CDI_GridProjParams gpp) +{ + cdiDefKeyString(gridID, CDI_GLOBAL, CDI_KEY_GRIDMAP_VARNAME, "Polar_Stereographic"); + + const char *gmapname = "polar_stereographic"; + cdiDefKeyString(gridID, CDI_GLOBAL, CDI_KEY_GRIDMAP_NAME, gmapname); + cdiDefAttTxt(gridID, CDI_GLOBAL, "grid_mapping_name", (int) (strlen(gmapname)), gmapname); + cdiDefAttFlt(gridID, CDI_GLOBAL, "standard_parallel", CDI_DATATYPE_FLT64, 1, &gpp.lat_1); + cdiDefAttFlt(gridID, CDI_GLOBAL, "straight_vertical_longitude_from_pole", CDI_DATATYPE_FLT64, 1, &gpp.lon_0); + cdiDefAttFlt(gridID, CDI_GLOBAL, "latitude_of_projection_origin", CDI_DATATYPE_FLT64, 1, &gpp.lat_0); + + gridDefParamsCommon(gridID, gpp); + + grid_t *gridptr = grid_to_pointer(gridID); + gridptr->projtype = CDI_PROJ_STERE; + + gridVerifyProj(gridID); +} + +/* +@Function gridInqParamsSTERE +@Title Get the parameter of a Polar stereographic grid + +@Prototype void gridInqParamsSTERE(int gridID, struct CDI_GridProjParams *gpp) +@Parameter + @Item gridID Grid ID, from a previous call to @fref{gridCreate} or @fref{vlistInqVarGrid}. + @Item gridProjParams Grid projection parameters. + +@Description +The function @func{gridInqParamsSTERE} returns the parameter of a Polar stereographic grid. + +@EndFunction +*/ +int +gridInqParamsSTERE(int gridID, struct CDI_GridProjParams *gpp) +{ + int status = -1; + if (gridInqType(gridID) != GRID_PROJECTION) return status; + + gridProjParamsInit(gpp); + + status = -2; + const char *projection = "polar_stereographic"; + char gmapname[CDI_MAX_NAME]; + int length = CDI_MAX_NAME; + cdiInqKeyString(gridID, CDI_GLOBAL, CDI_KEY_GRIDMAP_NAME, gmapname, &length); + if (gmapname[0] && str_is_equal(gmapname, projection)) + { + int atttype, attlen; + char attname[CDI_MAX_NAME + 1]; + + int natts; + cdiInqNatts(gridID, CDI_GLOBAL, &natts); + + if (natts) status = 0; + + for (int iatt = 0; iatt < natts; ++iatt) + { + cdiInqAtt(gridID, CDI_GLOBAL, iatt, attname, &atttype, &attlen); + if (attlen > 2) continue; + + double attflt[2]; + if (cdiInqAttConvertedToFloat(gridID, atttype, attname, attlen, attflt)) + { + // clang-format off + if (str_is_equal(attname, "earth_radius")) gpp->a = attflt[0]; + else if (str_is_equal(attname, "semi_major_axis")) gpp->a = attflt[0]; + else if (str_is_equal(attname, "semi_minor_axis")) gpp->b = attflt[0]; + else if (str_is_equal(attname, "inverse_flattening")) gpp->rf = attflt[0]; + else if (str_is_equal(attname, "standard_parallel")) gpp->lat_1 = attflt[0]; + else if (str_is_equal(attname, "straight_vertical_longitude_from_pole")) gpp->lon_0 = attflt[0]; + else if (str_is_equal(attname, "latitude_of_projection_origin")) gpp->lat_0 = attflt[0]; + else if (str_is_equal(attname, "false_easting")) gpp->x_0 = attflt[0]; + else if (str_is_equal(attname, "false_northing")) gpp->y_0 = attflt[0]; + else if (str_is_equal(attname, "longitudeOfFirstGridPointInDegrees")) gpp->xval_0 = attflt[0]; + else if (str_is_equal(attname, "latitudeOfFirstGridPointInDegrees")) gpp->yval_0 = attflt[0]; + // clang-format on + } + } + } + + return status; +} + +void +gridDefComplexPacking(int gridID, int lcomplex) +{ + grid_t *gridptr = grid_to_pointer(gridID); + + if (gridptr->lcomplex != lcomplex) + { + gridptr->lcomplex = lcomplex != 0; + gridMark4Update(gridID); + } +} + +int +gridInqComplexPacking(int gridID) +{ + grid_t *gridptr = grid_to_pointer(gridID); + + return (int) gridptr->lcomplex; +} + +void +gridDefHasDims(int gridID, int hasdims) +{ + grid_t *gridptr = grid_to_pointer(gridID); + + if (gridptr->hasdims != (hasdims != 0)) + { + gridptr->hasdims = hasdims != 0; + gridMark4Update(gridID); + } +} + +int +gridInqHasDims(int gridID) +{ + grid_t *gridptr = grid_to_pointer(gridID); + + return (int) gridptr->hasdims; +} + +/* +@Function gridDefNumber +@Title Define the reference number for an unstructured grid + +@Prototype void gridDefNumber(int gridID, int number) +@Parameter + @Item gridID Grid ID, from a previous call to @fref{gridCreate}. + @Item number Reference number for an unstructured grid. + +@Description +The function @func{gridDefNumber} defines the reference number for an unstructured grid. + +@EndFunction +*/ +void +gridDefNumber(int gridID, int number) +{ + cdiDefKeyInt(gridID, CDI_GLOBAL, CDI_KEY_NUMBEROFGRIDUSED, number); +} + +/* +@Function gridInqNumber +@Title Get the reference number to an unstructured grid + +@Prototype int gridInqNumber(int gridID) +@Parameter + @Item gridID Grid ID, from a previous call to @fref{gridCreate} or @fref{vlistInqVarGrid}. + +@Description +The function @func{gridInqNumber} returns the reference number to an unstructured grid. + +@Result +@func{gridInqNumber} returns the reference number to an unstructured grid. +@EndFunction +*/ +int +gridInqNumber(int gridID) +{ + int number = 0; + cdiInqKeyInt(gridID, CDI_GLOBAL, CDI_KEY_NUMBEROFGRIDUSED, &number); + return number; +} + +/* +@Function gridDefPosition +@Title Define the position of grid in the reference file + +@Prototype void gridDefPosition(int gridID, int position) +@Parameter + @Item gridID Grid ID, from a previous call to @fref{gridCreate}. + @Item position Position of grid in the reference file. + +@Description +The function @func{gridDefPosition} defines the position of grid in the reference file. + +@EndFunction +*/ +void +gridDefPosition(int gridID, int position) +{ + cdiDefKeyInt(gridID, CDI_GLOBAL, CDI_KEY_NUMBEROFGRIDINREFERENCE, position); +} + +/* +@Function gridInqPosition +@Title Get the position of grid in the reference file + +@Prototype int gridInqPosition(int gridID) +@Parameter + @Item gridID Grid ID, from a previous call to @fref{gridCreate} or @fref{vlistInqVarGrid}. + +@Description +The function @func{gridInqPosition} returns the position of grid in the reference file. + +@Result +@func{gridInqPosition} returns the position of grid in the reference file. +@EndFunction +*/ +int +gridInqPosition(int gridID) +{ + int position = 0; + cdiInqKeyInt(gridID, CDI_GLOBAL, CDI_KEY_NUMBEROFGRIDINREFERENCE, &position); + return position; +} + +/* +@Function gridDefReference +@Title Define the reference URI for an unstructured grid + +@Prototype void gridDefReference(int gridID, const char *reference) +@Parameter + @Item gridID Grid ID, from a previous call to @fref{gridCreate}. + @Item reference Reference URI for an unstructured grid. + +@Description +The function @func{gridDefReference} defines the reference URI for an unstructured grid. + +@EndFunction +*/ +void +gridDefReference(int gridID, const char *reference) +{ + if (reference) + { + cdiDefKeyString(gridID, CDI_GLOBAL, CDI_KEY_REFERENCEURI, reference); + gridMark4Update(gridID); + } +} + +/* +@Function gridInqReference +@Title Get the reference URI to an unstructured grid + +@Prototype char *gridInqReference(int gridID, char *reference) +@Parameter + @Item gridID Grid ID, from a previous call to @fref{gridCreate} or @fref{vlistInqVarGrid}. + +@Description +The function @func{gridInqReference} returns the reference URI to an unstructured grid. + +@Result +@func{gridInqReference} returns the reference URI to an unstructured grid. +@EndFunction +*/ +int +gridInqReference(int gridID, char *reference) +{ + int length = 0; + if (CDI_NOERR == cdiInqKeyLen(gridID, CDI_GLOBAL, CDI_KEY_REFERENCEURI, &length)) + { + if (reference) cdiInqKeyString(gridID, CDI_GLOBAL, CDI_KEY_REFERENCEURI, reference, &length); + } + + return length; +} + +/* +@Function gridDefUUID +@Title Define the UUID for an unstructured grid + +@Prototype void gridDefUUID(int gridID, const char *uuid) +@Parameter + @Item gridID Grid ID, from a previous call to @fref{gridCreate}. + @Item uuid UUID for an unstructured grid. + +@Description +The function @func{gridDefUUID} defines the UUID for an unstructured grid. + +@EndFunction +*/ +void +gridDefUUID(int gridID, const unsigned char uuid[CDI_UUID_SIZE]) +{ + cdiDefKeyBytes(gridID, CDI_GLOBAL, CDI_KEY_UUID, uuid, CDI_UUID_SIZE); + + gridMark4Update(gridID); +} + +/* +@Function gridInqUUID +@Title Get the UUID to an unstructured grid + +@Prototype void gridInqUUID(int gridID, char *uuid) +@Parameter + @Item gridID Grid ID, from a previous call to @fref{gridCreate} or @fref{vlistInqVarGrid}. + +@Description +The function @func{gridInqUUID} returns the UUID to an unstructured grid. + +@Result +@func{gridInqUUID} returns the UUID to an unstructured grid to the parameter uuid. +@EndFunction +*/ +void +gridInqUUID(int gridID, unsigned char uuid[CDI_UUID_SIZE]) +{ + memset(uuid, 0, CDI_UUID_SIZE); + int length = CDI_UUID_SIZE; + cdiInqKeyBytes(gridID, CDI_GLOBAL, CDI_KEY_UUID, uuid, &length); +} + +void +cdiGridGetIndexList(unsigned ngrids, int *gridIndexList) +{ + reshGetResHListOfType(ngrids, gridIndexList, &gridOps); +} + +static int +gridTxCode(void *voidP) +{ + grid_t *gridptr = (grid_t *) voidP; + return gridptr->vtable->txCode; +} + +enum +{ + GRID_PACK_INT_IDX_SELF, + GRID_PACK_INT_IDX_TYPE, + GRID_PACK_INT_IDX_IS_CYCLIC, + GRID_PACK_INT_IDX_X_FLAG, + GRID_PACK_INT_IDX_Y_FLAG, + GRID_PACK_INT_IDX_GME_ND, + GRID_PACK_INT_IDX_GME_NI, + GRID_PACK_INT_IDX_GME_NI2, + GRID_PACK_INT_IDX_GME_NI3, + GRID_PACK_INT_IDX_TRUNC, + GRID_PACK_INT_IDX_NVERTEX, + GRID_PACK_INT_IDX_REDUCED_POINTS_SIZE, + GRID_PACK_INT_IDX_SIZE, + GRID_PACK_INT_IDX_X_SIZE, + GRID_PACK_INT_IDX_Y_SIZE, + GRID_PACK_INT_IDX_LCOMPLEX, + GRID_PACK_INT_IDX_MEMBERMASK, + /* + GRID_PACK_INT_IDX_XTSTDNNAME, + GRID_PACK_INT_IDX_YTSTDNNAME, + GRID_PACK_INT_IDX_ISCANSNEGATIVELY, + GRID_PACK_INT_IDX_JSCANSPOSITIVELY, + GRID_PACK_INT_IDX_JPOINTSARECONSECUTIVE, + */ + gridNint +}; + +enum +{ + GRID_PACK_DBL_IDX_X_FIRST, + GRID_PACK_DBL_IDX_Y_FIRST, + GRID_PACK_DBL_IDX_X_LAST, + GRID_PACK_DBL_IDX_Y_LAST, + GRID_PACK_DBL_IDX_X_INC, + GRID_PACK_DBL_IDX_Y_INC, + gridNdouble +}; + +enum +{ + gridHasMaskFlag = 1 << 0, + gridHasGMEMaskFlag = 1 << 1, + gridHasXValsFlag = 1 << 2, + gridHasYValsFlag = 1 << 3, + gridHasAreaFlag = 1 << 4, + gridHasXBoundsFlag = 1 << 5, + gridHasYBoundsFlag = 1 << 6, + gridHasReducedPointsFlag = 1 << 7, +}; + +static int +gridGetComponentFlags(const grid_t *gridP) +{ + int flags = 0; + for (int prop = 0; prop < GRID_PROP_YBOUNDS + 1; ++prop) + flags |= (gridP->vtable->inqPropPresence((grid_t *) gridP, (enum gridPropInq) prop) << prop); + flags |= (gridHasReducedPointsFlag & (int) ((unsigned) (gridP->reducedPoints == NULL) - 1U)); + return flags; +} + +static int +gridGetPackSize(void *voidP, void *context) +{ + grid_t *gridP = (grid_t *) voidP; + return gridP->vtable->getPackSize(gridP, context); +} + +static int gridGetPackSizeScalars(grid_t *gridP, void *context); + +static int gridGetPackSizeArrays(grid_t *gridP, void *context); + +static int +gridGetPackSizeBase(grid_t *gridP, void *context) +{ + return gridP->vtable->getPackSizeScalars(gridP, context) + gridP->vtable->getPackSizeArrays(gridP, context); +} + +static int +gridGetPackSizeScalars(grid_t *gridP, void *context) +{ + int packBuffSize = 0, ui32PackSize = serializeGetSize(1, CDI_DATATYPE_UINT32, context); + + packBuffSize += serializeGetSize(gridNint, CDI_DATATYPE_INT, context) + ui32PackSize; + + packBuffSize += serializeGetSize(gridNdouble, CDI_DATATYPE_FLT64, context) + ui32PackSize; + + packBuffSize += serializeKeysGetPackSize(&gridP->keys, context); + packBuffSize += serializeKeysGetPackSize(&gridP->x.keys, context); + packBuffSize += serializeKeysGetPackSize(&gridP->y.keys, context); + + return packBuffSize; +} + +static int +gridGetPackSizeArrays(grid_t *gridP, void *context) +{ + int packBuffSize = 0, count, ui32PackSize = serializeGetSize(1, CDI_DATATYPE_UINT32, context); + + if (gridP->reducedPoints) + { + xassert(gridP->reducedPointsSize); + packBuffSize += serializeGetSize(gridP->reducedPointsSize, CDI_DATATYPE_INT, context) + ui32PackSize; + } + + if (gridP->vtable->inqXValsPtr(gridP)) + { + if (gridP->type == GRID_UNSTRUCTURED || gridP->type == GRID_CURVILINEAR) + count = gridP->size; + else + count = gridP->x.size; + xassert(count); + packBuffSize += serializeGetSize(count, CDI_DATATYPE_FLT64, context) + ui32PackSize; + } + + if (gridP->vtable->inqYValsPtr(gridP)) + { + if (gridP->type == GRID_UNSTRUCTURED || gridP->type == GRID_CURVILINEAR) + count = gridP->size; + else + count = gridP->y.size; + xassert(count); + packBuffSize += serializeGetSize(count, CDI_DATATYPE_FLT64, context) + ui32PackSize; + } + + if (gridP->vtable->inqAreaPtr(gridP)) + { + xassert(gridP->size); + packBuffSize += serializeGetSize(gridP->size, CDI_DATATYPE_FLT64, context) + ui32PackSize; + } + + if (gridP->x.bounds) + { + xassert(gridP->nvertex); + count = grid_is_irregular(gridP->type) ? gridP->size : gridP->x.size; + xassert(count); + packBuffSize += (serializeGetSize(gridP->nvertex * count, CDI_DATATYPE_FLT64, context) + ui32PackSize); + } + + if (gridP->y.bounds) + { + xassert(gridP->nvertex); + count = grid_is_irregular(gridP->type) ? gridP->size : gridP->y.size; + xassert(count); + packBuffSize += (serializeGetSize(gridP->nvertex * count, CDI_DATATYPE_FLT64, context) + ui32PackSize); + } + + if (gridP->mask) + { + xassert(gridP->size); + packBuffSize += serializeGetSize(gridP->size, CDI_DATATYPE_UCHAR, context) + ui32PackSize; + } + + if (gridP->mask_gme) + { + xassert(gridP->size); + packBuffSize += serializeGetSize(gridP->size, CDI_DATATYPE_UCHAR, context) + ui32PackSize; + } + + return packBuffSize; +} + +static grid_t *gridUnpackScalars(char *unpackBuffer, int unpackBufferSize, int *unpackBufferPos, int originNamespace, void *context, + int force_id, int *memberMaskP); + +static void gridUnpackArrays(grid_t *gridP, int memberMask, char *unpackBuffer, int unpackBufferSize, int *unpackBufferPos, + int originNamespace, void *context); + +int +gridUnpack(char *unpackBuffer, int unpackBufferSize, int *unpackBufferPos, int originNamespace, void *context, int force_id) +{ + gridInit(); + int memberMask; + grid_t *gridP + = gridUnpackScalars(unpackBuffer, unpackBufferSize, unpackBufferPos, originNamespace, context, force_id, &memberMask); + gridP->vtable->unpackArrays(gridP, memberMask, unpackBuffer, unpackBufferSize, unpackBufferPos, originNamespace, context); + reshSetStatus(gridP->self, &gridOps, reshGetStatus(gridP->self, &gridOps) & ~RESH_SYNC_BIT); + return gridP->self; +} + +static grid_t * +gridUnpackScalars(char *unpackBuffer, int unpackBufferSize, int *unpackBufferPos, int originNamespace, void *context, int force_id, + int *memberMaskP) +{ + grid_t *gridP; + uint32_t d; + int memberMask; + { + int intBuffer[gridNint]; + serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, intBuffer, gridNint, CDI_DATATYPE_INT, context); + serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, &d, 1, CDI_DATATYPE_UINT32, context); + + xassert(cdiCheckSum(CDI_DATATYPE_INT, gridNint, intBuffer) == d); + int targetID = namespaceAdaptKey(intBuffer[0], originNamespace); + gridP = gridNewEntry(force_id ? targetID : CDI_UNDEFID); + + xassert(!force_id || targetID == gridP->self); + + gridP->type = intBuffer[GRID_PACK_INT_IDX_TYPE]; + gridP->isCyclic = (signed char) intBuffer[GRID_PACK_INT_IDX_IS_CYCLIC]; + gridP->x.flag = (short) intBuffer[GRID_PACK_INT_IDX_X_FLAG]; + gridP->y.flag = (short) intBuffer[GRID_PACK_INT_IDX_Y_FLAG]; + gridP->gme.nd = intBuffer[GRID_PACK_INT_IDX_GME_ND]; + gridP->gme.ni = intBuffer[GRID_PACK_INT_IDX_GME_NI]; + gridP->gme.ni2 = intBuffer[GRID_PACK_INT_IDX_GME_NI2]; + gridP->gme.ni3 = intBuffer[GRID_PACK_INT_IDX_GME_NI3]; + gridP->trunc = intBuffer[GRID_PACK_INT_IDX_TRUNC]; + gridP->nvertex = intBuffer[GRID_PACK_INT_IDX_NVERTEX]; + gridP->reducedPointsSize = intBuffer[GRID_PACK_INT_IDX_REDUCED_POINTS_SIZE]; + gridP->size = intBuffer[GRID_PACK_INT_IDX_SIZE]; + gridP->x.size = intBuffer[GRID_PACK_INT_IDX_X_SIZE]; + gridP->y.size = intBuffer[GRID_PACK_INT_IDX_Y_SIZE]; + gridP->lcomplex = (bool) intBuffer[GRID_PACK_INT_IDX_LCOMPLEX]; + memberMask = intBuffer[GRID_PACK_INT_IDX_MEMBERMASK]; + } + + { + double doubleBuffer[gridNdouble]; + serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, doubleBuffer, gridNdouble, CDI_DATATYPE_FLT64, context); + serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, &d, 1, CDI_DATATYPE_UINT32, context); + xassert(d == cdiCheckSum(CDI_DATATYPE_FLT, gridNdouble, doubleBuffer)); + + gridP->x.first = doubleBuffer[GRID_PACK_DBL_IDX_X_FIRST]; + gridP->y.first = doubleBuffer[GRID_PACK_DBL_IDX_Y_FIRST]; + gridP->x.last = doubleBuffer[GRID_PACK_DBL_IDX_X_LAST]; + gridP->y.last = doubleBuffer[GRID_PACK_DBL_IDX_Y_LAST]; + gridP->x.inc = doubleBuffer[GRID_PACK_DBL_IDX_X_INC]; + gridP->y.inc = doubleBuffer[GRID_PACK_DBL_IDX_Y_INC]; + } + + serializeKeysUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, &gridP->keys, context); + serializeKeysUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, &gridP->x.keys, context); + serializeKeysUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, &gridP->y.keys, context); + + *memberMaskP = memberMask; + return gridP; +} + +static void +gridUnpackArrays(grid_t *gridP, int memberMask, char *unpackBuffer, int unpackBufferSize, int *unpackBufferPos, int originNamespace, + void *context) +{ + UNUSED(originNamespace); + uint32_t d; + + if (memberMask & gridHasReducedPointsFlag) + { + xassert(gridP->reducedPointsSize); + gridP->reducedPoints = (int *) Malloc((size_t) gridP->reducedPointsSize * sizeof(int)); + serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, gridP->reducedPoints, gridP->reducedPointsSize, + CDI_DATATYPE_INT, context); + serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, &d, 1, CDI_DATATYPE_UINT32, context); + xassert(cdiCheckSum(CDI_DATATYPE_INT, gridP->reducedPointsSize, gridP->reducedPoints) == d); + } + + bool isIrregular = grid_is_irregular(gridP->type); + if (memberMask & gridHasXValsFlag) + { + int size = isIrregular ? gridP->size : gridP->x.size; + + gridP->x.vals = (double *) Malloc(size * sizeof(double)); + serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, gridP->x.vals, size, CDI_DATATYPE_FLT64, context); + serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, &d, 1, CDI_DATATYPE_UINT32, context); + xassert(cdiCheckSum(CDI_DATATYPE_FLT, size, gridP->x.vals) == d); + } + + if (memberMask & gridHasYValsFlag) + { + int size = isIrregular ? gridP->size : gridP->y.size; + + gridP->y.vals = (double *) Malloc(size * sizeof(double)); + serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, gridP->y.vals, size, CDI_DATATYPE_FLT64, context); + serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, &d, 1, CDI_DATATYPE_UINT32, context); + xassert(cdiCheckSum(CDI_DATATYPE_FLT, size, gridP->y.vals) == d); + } + + if (memberMask & gridHasAreaFlag) + { + int size = gridP->size; + xassert(size); + gridP->area = (double *) Malloc(size * sizeof(double)); + serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, gridP->area, size, CDI_DATATYPE_FLT64, context); + serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, &d, 1, CDI_DATATYPE_UINT32, context); + xassert(cdiCheckSum(CDI_DATATYPE_FLT, size, gridP->area) == d); + } + + if (memberMask & gridHasXBoundsFlag) + { + int size = gridP->nvertex * (isIrregular ? gridP->size : gridP->x.size); + xassert(size); + + gridP->x.bounds = (double *) Malloc(size * sizeof(double)); + serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, gridP->x.bounds, size, CDI_DATATYPE_FLT64, context); + serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, &d, 1, CDI_DATATYPE_UINT32, context); + xassert(cdiCheckSum(CDI_DATATYPE_FLT, size, gridP->x.bounds) == d); + } + + if (memberMask & gridHasYBoundsFlag) + { + int size = gridP->nvertex * (isIrregular ? gridP->size : gridP->y.size); + xassert(size); + + gridP->y.bounds = (double *) Malloc(size * sizeof(double)); + serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, gridP->y.bounds, size, CDI_DATATYPE_FLT64, context); + serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, &d, 1, CDI_DATATYPE_UINT32, context); + xassert(cdiCheckSum(CDI_DATATYPE_FLT, size, gridP->y.bounds) == d); + } + + if (memberMask & gridHasMaskFlag) + { + int size = gridP->size; + xassert(size); + gridP->mask = (mask_t *) Malloc(size * sizeof(mask_t)); + serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, gridP->mask, gridP->size, CDI_DATATYPE_UCHAR, context); + serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, &d, 1, CDI_DATATYPE_UINT32, context); + xassert(cdiCheckSum(CDI_DATATYPE_UCHAR, gridP->size, gridP->mask) == d); + } + + if (memberMask & gridHasGMEMaskFlag) + { + int size = gridP->size; + xassert(size); + gridP->mask_gme = (mask_t *) Malloc(size * sizeof(mask_t)); + serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, gridP->mask_gme, gridP->size, CDI_DATATYPE_UCHAR, context); + serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, &d, 1, CDI_DATATYPE_UINT32, context); + xassert(cdiCheckSum(CDI_DATATYPE_UCHAR, gridP->size, gridP->mask_gme) == d); + } +} + +void +gridPack(void *voidP, void *packBuffer, int packBufferSize, int *packBufferPos, void *context) +{ + grid_t *gridP = (grid_t *) voidP; + gridP->vtable->pack(gridP, packBuffer, packBufferSize, packBufferPos, context); +} + +static void +gridPackBase(grid_t *gridP, void *packBuffer, int packBufferSize, int *packBufferPos, void *context) +{ + int memberMask = gridP->vtable->packScalars(gridP, packBuffer, packBufferSize, packBufferPos, context); + gridP->vtable->packArrays(gridP, memberMask, packBuffer, packBufferSize, packBufferPos, context); +} + +static int +gridPackScalars(grid_t *gridP, void *packBuffer, int packBufferSize, int *packBufferPos, void *context) +{ + uint32_t d; + int memberMask; + + { + int intBuffer[gridNint]; + + intBuffer[GRID_PACK_INT_IDX_SELF] = gridP->self; + intBuffer[GRID_PACK_INT_IDX_TYPE] = gridP->type; + intBuffer[GRID_PACK_INT_IDX_IS_CYCLIC] = gridP->isCyclic; + intBuffer[GRID_PACK_INT_IDX_X_FLAG] = gridP->x.flag; + intBuffer[GRID_PACK_INT_IDX_Y_FLAG] = gridP->y.flag; + intBuffer[GRID_PACK_INT_IDX_GME_ND] = gridP->gme.nd; + intBuffer[GRID_PACK_INT_IDX_GME_NI] = gridP->gme.ni; + intBuffer[GRID_PACK_INT_IDX_GME_NI2] = gridP->gme.ni2; + intBuffer[GRID_PACK_INT_IDX_GME_NI3] = gridP->gme.ni3; + intBuffer[GRID_PACK_INT_IDX_TRUNC] = gridP->trunc; + intBuffer[GRID_PACK_INT_IDX_NVERTEX] = gridP->nvertex; + intBuffer[GRID_PACK_INT_IDX_REDUCED_POINTS_SIZE] = gridP->reducedPointsSize; + intBuffer[GRID_PACK_INT_IDX_SIZE] = gridP->size; + intBuffer[GRID_PACK_INT_IDX_X_SIZE] = gridP->x.size; + intBuffer[GRID_PACK_INT_IDX_Y_SIZE] = gridP->y.size; + intBuffer[GRID_PACK_INT_IDX_LCOMPLEX] = gridP->lcomplex; + intBuffer[GRID_PACK_INT_IDX_MEMBERMASK] = memberMask = gridGetComponentFlags(gridP); + + serializePack(intBuffer, gridNint, CDI_DATATYPE_INT, packBuffer, packBufferSize, packBufferPos, context); + d = cdiCheckSum(CDI_DATATYPE_INT, gridNint, intBuffer); + serializePack(&d, 1, CDI_DATATYPE_UINT32, packBuffer, packBufferSize, packBufferPos, context); + } + + { + double doubleBuffer[gridNdouble]; + + doubleBuffer[GRID_PACK_DBL_IDX_X_FIRST] = gridP->x.first; + doubleBuffer[GRID_PACK_DBL_IDX_Y_FIRST] = gridP->y.first; + doubleBuffer[GRID_PACK_DBL_IDX_X_LAST] = gridP->x.last; + doubleBuffer[GRID_PACK_DBL_IDX_Y_LAST] = gridP->y.last; + doubleBuffer[GRID_PACK_DBL_IDX_X_INC] = gridP->x.inc; + doubleBuffer[GRID_PACK_DBL_IDX_Y_INC] = gridP->y.inc; + + serializePack(doubleBuffer, gridNdouble, CDI_DATATYPE_FLT64, packBuffer, packBufferSize, packBufferPos, context); + d = cdiCheckSum(CDI_DATATYPE_FLT, gridNdouble, doubleBuffer); + serializePack(&d, 1, CDI_DATATYPE_UINT32, packBuffer, packBufferSize, packBufferPos, context); + } + + serializeKeysPack(&gridP->keys, packBuffer, packBufferSize, packBufferPos, context); + serializeKeysPack(&gridP->x.keys, packBuffer, packBufferSize, packBufferPos, context); + serializeKeysPack(&gridP->y.keys, packBuffer, packBufferSize, packBufferPos, context); + + return memberMask; +} + +static void +gridPackArrays(grid_t *gridP, int memberMask, void *packBuffer, int packBufferSize, int *packBufferPos, void *context) +{ + uint32_t d; + bool isIrregular = grid_is_irregular(gridP->type); + + if (memberMask & gridHasReducedPointsFlag) + { + int size = gridP->reducedPointsSize; + xassert(size > 0); + serializePack(gridP->reducedPoints, size, CDI_DATATYPE_INT, packBuffer, packBufferSize, packBufferPos, context); + d = cdiCheckSum(CDI_DATATYPE_INT, size, gridP->reducedPoints); + serializePack(&d, 1, CDI_DATATYPE_UINT32, packBuffer, packBufferSize, packBufferPos, context); + } + + if (memberMask & gridHasXValsFlag) + { + int size = isIrregular ? gridP->size : gridP->x.size; + xassert(size); + + const double *gridP_xvals = gridP->vtable->inqXValsPtr(gridP); + serializePack(gridP_xvals, size, CDI_DATATYPE_FLT64, packBuffer, packBufferSize, packBufferPos, context); + d = cdiCheckSum(CDI_DATATYPE_FLT, size, gridP_xvals); + serializePack(&d, 1, CDI_DATATYPE_UINT32, packBuffer, packBufferSize, packBufferPos, context); + } + + if (memberMask & gridHasYValsFlag) + { + int size = isIrregular ? gridP->size : gridP->y.size; + xassert(size); + const double *gridP_yvals = gridP->vtable->inqYValsPtr(gridP); + serializePack(gridP_yvals, size, CDI_DATATYPE_FLT64, packBuffer, packBufferSize, packBufferPos, context); + d = cdiCheckSum(CDI_DATATYPE_FLT, size, gridP_yvals); + serializePack(&d, 1, CDI_DATATYPE_UINT32, packBuffer, packBufferSize, packBufferPos, context); + } + + if (memberMask & gridHasAreaFlag) + { + int size = gridP->size; + xassert(size); + + serializePack(gridP->area, size, CDI_DATATYPE_FLT64, packBuffer, packBufferSize, packBufferPos, context); + d = cdiCheckSum(CDI_DATATYPE_FLT, size, gridP->area); + serializePack(&d, 1, CDI_DATATYPE_UINT32, packBuffer, packBufferSize, packBufferPos, context); + } + + if (memberMask & gridHasXBoundsFlag) + { + xassert(gridP->nvertex); + int size = isIrregular ? gridP->nvertex * gridP->size : gridP->nvertex * gridP->x.size; + xassert(size); + + serializePack(gridP->x.bounds, size, CDI_DATATYPE_FLT64, packBuffer, packBufferSize, packBufferPos, context); + d = cdiCheckSum(CDI_DATATYPE_FLT, size, gridP->x.bounds); + serializePack(&d, 1, CDI_DATATYPE_UINT32, packBuffer, packBufferSize, packBufferPos, context); + } + + if (memberMask & gridHasYBoundsFlag) + { + xassert(gridP->nvertex); + int size = isIrregular ? gridP->nvertex * gridP->size : gridP->nvertex * gridP->y.size; + xassert(size); + + serializePack(gridP->y.bounds, size, CDI_DATATYPE_FLT64, packBuffer, packBufferSize, packBufferPos, context); + d = cdiCheckSum(CDI_DATATYPE_FLT, size, gridP->y.bounds); + serializePack(&d, 1, CDI_DATATYPE_UINT32, packBuffer, packBufferSize, packBufferPos, context); + } + + if (memberMask & gridHasMaskFlag) + { + int size = gridP->size; + xassert(size); + serializePack(gridP->mask, size, CDI_DATATYPE_UCHAR, packBuffer, packBufferSize, packBufferPos, context); + d = cdiCheckSum(CDI_DATATYPE_UCHAR, size, gridP->mask); + serializePack(&d, 1, CDI_DATATYPE_UINT32, packBuffer, packBufferSize, packBufferPos, context); + } + + if (memberMask & gridHasGMEMaskFlag) + { + int size = gridP->size; + xassert(size); + + serializePack(gridP->mask_gme, size, CDI_DATATYPE_UCHAR, packBuffer, packBufferSize, packBufferPos, context); + d = cdiCheckSum(CDI_DATATYPE_UCHAR, size, gridP->mask_gme); + serializePack(&d, 1, CDI_DATATYPE_UINT32, packBuffer, packBufferSize, packBufferPos, context); + } +} + +struct gridCompareSearchState +{ + int resIDValue; + const grid_t *queryKey; +}; + +static enum cdiApplyRet +gridCompareSearch(int id, void *res, void *data) +{ + struct gridCompareSearchState *state = (struct gridCompareSearchState *) data; + (void) res; + if (gridCompare(id, state->queryKey, true) == false) + { + state->resIDValue = id; + return CDI_APPLY_STOP; + } + else + return CDI_APPLY_GO_ON; +} + +// Add grid (which must be Malloc'ed to vlist if not already found) +struct addIfNewRes +cdiVlistAddGridIfNew(int vlistID, grid_t *grid, int mode) +{ + /* + mode: 0 search in vlist and grid table + 1 search in grid table only + 2 search in grid table only and don't store the grid in vlist + */ + bool gridIsDefinedGlobal = false; + bool gridIsDefined = false; + int gridID = CDI_UNDEFID; + vlist_t *vlistptr = vlist_to_pointer(vlistID); + + int ngrids = vlistptr->ngrids; + + if (mode == 0) + for (int index = 0; index < ngrids; index++) + { + if ((gridID = vlistptr->gridIDs[index]) != CDI_UNDEFID) + { + if (gridCompare(gridID, grid, false) == false) + { + gridIsDefined = true; + break; + } + } + else + Error("Internal problem: undefined gridID in vlist %d, position %u!", vlistID, index); + } + + if (!gridIsDefined) + { + struct gridCompareSearchState query; + query.queryKey = grid; // = { .queryKey = grid }; + if ((gridIsDefinedGlobal = (cdiGridApply(gridCompareSearch, &query) == CDI_APPLY_STOP))) gridID = query.resIDValue; + + if (mode == 1 && gridIsDefinedGlobal) + for (int index = 0; index < ngrids; index++) + if (vlistptr->gridIDs[index] == gridID) + { + gridIsDefinedGlobal = false; + break; + } + } + + if (!gridIsDefined) + { + if (!gridIsDefinedGlobal) + { + grid->self = gridID = reshPut(grid, &gridOps); + grid_complete(grid); + } + if (mode < 2) + { + if (ngrids >= MAX_GRIDS_PS) Error("Internal limit exceeded, MAX_GRIDS_PS=%d needs to be increased!", MAX_GRIDS_PS); + vlistptr->gridIDs[ngrids] = gridID; + vlistptr->ngrids++; + } + } + + return (struct addIfNewRes){ .Id = gridID, .isNew = (!gridIsDefined && !gridIsDefinedGlobal) }; +} + +const struct gridVirtTable cdiGridVtable = { + .destroy = gridDestroyKernel, + .copy = grid_copy_base, + .copyScalarFields = grid_copy_base_scalar_fields, + .copyArrayFields = grid_copy_base_array_fields, + .defXVals = gridDefXValsSerial, + .defYVals = gridDefYValsSerial, + .defMask = gridDefMaskSerial, + .defMaskGME = gridDefMaskGMESerial, + .defXBounds = gridDefXBoundsSerial, + .defYBounds = gridDefYBoundsSerial, + .defArea = gridDefAreaSerial, + .inqXVal = gridInqXValSerial, + .inqYVal = gridInqYValSerial, + .inqXVals = gridInqXValsSerial, + .inqXValsPart = gridInqXValsPartSerial, + .inqYVals = gridInqYValsSerial, + .inqYValsPart = gridInqYValsPartSerial, + .inqXValsPtr = gridInqXValsPtrSerial, + .inqYValsPtr = gridInqYValsPtrSerial, +#ifndef USE_MPI + .inqXIsc = gridInqXIscSerial, + .inqYIsc = gridInqYIscSerial, + .inqXCvals = gridInqXCvalsSerial, + .inqYCvals = gridInqYCvalsSerial, + .inqXCvalsPtr = gridInqXCvalsPtrSerial, + .inqYCvalsPtr = gridInqYCvalsPtrSerial, +#endif + .inqXInc = gridInqXIncBase, + .inqYInc = gridInqYIncBase, + .compareXYFull = compareXYvals, + .compareXYAO = compareXYvals2, + .inqArea = gridInqAreaSerial, + .inqAreaPtr = gridInqAreaPtrBase, + .inqPropPresence = gridInqPropPresenceBase, + .inqMask = gridInqMaskSerial, + .inqMaskGME = gridInqMaskGMESerial, + .inqXBounds = gridInqXBoundsSerial, + .inqYBounds = gridInqYBoundsSerial, + .inqXBoundsPtr = gridInqXBoundsPtrSerial, + .inqYBoundsPtr = gridInqYBoundsPtrSerial, + .txCode = GRID, + .getPackSize = gridGetPackSizeBase, + .getPackSizeScalars = gridGetPackSizeScalars, + .getPackSizeArrays = gridGetPackSizeArrays, + .unpackScalars = gridUnpackScalars, + .unpackArrays = gridUnpackArrays, + .pack = gridPackBase, + .packScalars = gridPackScalars, + .packArrays = gridPackArrays, +}; + +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <ctype.h> + + +static int initIegLib = 0; +static int iegDefaultDprec = 0; + +// A version string. +#undef LIBVERSION +#define LIBVERSION 1.5.0 +#define XSTRING(x) #x +#define STRING(x) XSTRING(x) +static const char ieg_libvers[] = STRING(LIBVERSION); + +const char * +iegLibraryVersion(void) +{ + return ieg_libvers; +} + +static int IEG_Debug = 0; // If set to 1, debugging + +static void +iegLibInit(void) +{ + const char *envName = "IEG_PRECISION"; + + char *envString = getenv(envName); + if (envString) + { + int nrun = (strlen(envString) == 2) ? 1 : 2; + int pos = 0; + while (nrun--) + { + switch (tolower((int) envString[pos])) + { + case 'r': + { + switch ((int) envString[pos + 1]) + { + case '4': iegDefaultDprec = EXSE_SINGLE_PRECISION; break; + case '8': iegDefaultDprec = EXSE_DOUBLE_PRECISION; break; + default: Warning("Invalid digit in %s: %s", envName, envString); + } + break; + } + default: + { + Warning("Invalid character in %s: %s", envName, envString); + break; + } + } + pos += 2; + } + } + + initIegLib = 1; +} + +void +iegDebug(int debug) +{ + if (debug) Message("debug level %d", debug); + IEG_Debug = debug; +} + +static void +iegInit(iegrec_t *iegp) +{ + iegp->checked = 0; + iegp->byteswap = 0; + iegp->dprec = 0; + iegp->refval = 0; + iegp->datasize = 0; + iegp->buffersize = 0; + iegp->buffer = NULL; +} + +void +iegInitMem(void *ieg) +{ + iegrec_t *iegp = (iegrec_t *) ieg; + memset(iegp->ipdb, 0, sizeof(iegp->ipdb)); + memset(iegp->igdb, 0, sizeof(iegp->igdb)); + memset(iegp->vct, 0, sizeof(iegp->vct)); +} + +void * +iegNew(void) +{ + if (!initIegLib) iegLibInit(); + + iegrec_t *iegp = (iegrec_t *) Malloc(sizeof(iegrec_t)); + iegInit(iegp); + iegInitMem(iegp); + + return (void *) iegp; +} + +void +iegDelete(void *ieg) +{ + iegrec_t *iegp = (iegrec_t *) ieg; + + if (iegp) + { + if (iegp->buffer) Free(iegp->buffer); + Free(iegp); + } +} + +int +iegCheckFiletype(int fileID, int *swap) +{ + size_t data = 0; + size_t dimx = 0, dimy = 0; + size_t fact = 0; + unsigned char buffer[1048], *pbuf; + + if (fileRead(fileID, buffer, 4) != 4) return 0; + + size_t blocklen = get_UINT32(buffer); + size_t sblocklen = get_SUINT32(buffer); + + if (IEG_Debug) Message("blocklen = %d sblocklen = %d", blocklen, sblocklen); + + // clang-format off + if (blocklen == 636 || blocklen == 640) + { + *swap = 0; + fact = 4; + if (fileRead(fileID, buffer, blocklen+8) != blocklen+8) return 0; + pbuf = buffer+(37+4)*4; dimx = (size_t) get_UINT32(pbuf); + pbuf = buffer+(37+5)*4; dimy = (size_t) get_UINT32(pbuf); + pbuf = buffer+blocklen+4; data = (size_t) get_UINT32(pbuf); + } + else if (blocklen == 1040 || blocklen == 1036) + { + *swap = 0; + fact = 8; + if (fileRead(fileID, buffer, blocklen+8) != blocklen+8) return 0; + pbuf = buffer+(37+4)*4; dimx = (size_t) get_UINT32(pbuf); + pbuf = buffer+(37+5)*4; dimy = (size_t) get_UINT32(pbuf); + pbuf = buffer+blocklen+4; data = (size_t) get_UINT32(pbuf); + } + else if (sblocklen == 636 || sblocklen == 640) + { + *swap = 1; + fact = 4; + if (fileRead(fileID, buffer, sblocklen+8) != sblocklen+8) return 0; + pbuf = buffer+(37+4)*4; dimx = (size_t) get_SUINT32(pbuf); + pbuf = buffer+(37+5)*4; dimy = (size_t) get_SUINT32(pbuf); + pbuf = buffer+sblocklen+4; data = (size_t) get_SUINT32(pbuf); + } + else if (sblocklen == 1040 || sblocklen == 1036) + { + *swap = 1; + fact = 8; + if (fileRead(fileID, buffer, sblocklen+8) != sblocklen+8) return 0; + pbuf = buffer+(37+4)*4; dimx = (size_t) get_SUINT32(pbuf); + pbuf = buffer+(37+5)*4; dimy = (size_t) get_SUINT32(pbuf); + pbuf = buffer+sblocklen+4; data = (size_t) get_SUINT32(pbuf); + } + // clang-format on + + fileRewind(fileID); + + if (IEG_Debug) Message("swap = %d fact = %d", *swap, fact); + if (IEG_Debug) Message("dimx = %lu dimy = %lu data = %lu", dimx, dimy, data); + + int found = data && (dimx * dimy * fact == data || dimx * dimy * 8 == data); + return found; +} + +void +iegCopyMeta(void *dieg, void *sieg) +{ + iegrec_t *diegp = (iegrec_t *) dieg; + iegrec_t *siegp = (iegrec_t *) sieg; + + // diegp->byteswap = siegp->byteswap; + diegp->dprec = siegp->dprec; + diegp->refval = siegp->refval; + + memcpy(diegp->ipdb, siegp->ipdb, sizeof(siegp->ipdb)); + memcpy(diegp->igdb, siegp->igdb, sizeof(siegp->igdb)); + memcpy(diegp->vct, siegp->vct, sizeof(siegp->vct)); +} + +static int +iegInqData(void *ieg, int prec, void *data) +{ + iegrec_t *iegp = (iegrec_t *) ieg; + int ierr = 0; + int byteswap = iegp->byteswap; + size_t datasize = iegp->datasize; + void *buffer = iegp->buffer; + int dprec = iegp->dprec; + + switch (dprec) + { + case EXSE_SINGLE_PRECISION: + { + if (sizeof(FLT32) == 4) + { + if (byteswap) swap4byte(buffer, datasize); + + if (dprec == prec) + memcpy(data, buffer, datasize * sizeof(FLT32)); + else + { + const float *restrict p = (float *) buffer; + double *restrict q = (double *) data; + for (size_t i = 0; i < datasize; i++) q[i] = p[i]; + } + } + else + { + Error("not implemented for %d byte float", sizeof(FLT32)); + } + break; + } + case EXSE_DOUBLE_PRECISION: + { + if (sizeof(FLT64) == 8) + { + if (byteswap) swap8byte(buffer, datasize); + + if (dprec == prec) + memcpy(data, buffer, datasize * sizeof(FLT64)); + else + { + const double *restrict p = (double *) buffer; + float *restrict q = (float *) data; + for (size_t i = 0; i < datasize; i++) q[i] = (float) p[i]; + } + } + else + { + Error("not implemented for %d byte float", sizeof(FLT64)); + } + break; + } + default: + { + Error("unexpected data precision %d", dprec); + break; + } + } + + return ierr; +} + +int +iegInqDataSP(void *ieg, float *data) +{ + return iegInqData(ieg, EXSE_SINGLE_PRECISION, (void *) data); +} + +int +iegInqDataDP(void *ieg, double *data) +{ + return iegInqData(ieg, EXSE_DOUBLE_PRECISION, (void *) data); +} + +static int +iegDefData(iegrec_t *iegp, int prec, const void *data) +{ + int dprec = iegDefaultDprec ? iegDefaultDprec : iegp->dprec; + iegp->dprec = dprec ? dprec : prec; + + size_t datasize = (size_t) IEG_G_NumLon(iegp->igdb) * (size_t) IEG_G_NumLat(iegp->igdb); + size_t blocklen = datasize * (size_t) dprec; + + iegp->datasize = datasize; + + if (iegp->buffersize != blocklen) + { + iegp->buffersize = blocklen; + iegp->buffer = Realloc(iegp->buffer, iegp->buffersize); + } + + switch (dprec) + { + case EXSE_SINGLE_PRECISION: + { + if (dprec == prec) + memcpy(iegp->buffer, data, datasize * sizeof(FLT32)); + else + { + const double *restrict p = (const double *) data; + float *restrict q = (float *) iegp->buffer; + for (size_t i = 0; i < datasize; i++) q[i] = (float) p[i]; + } + break; + } + case EXSE_DOUBLE_PRECISION: + { + if (dprec == prec) + memcpy(iegp->buffer, data, datasize * sizeof(FLT64)); + else + { + const float *restrict p = (const float *) data; + double *restrict q = (double *) iegp->buffer; + for (size_t i = 0; i < datasize; i++) q[i] = p[i]; + } + break; + } + default: + { + Error("unexpected data precision %d", dprec); + break; + } + } + + return 0; +} + +int +iegDefDataSP(void *ieg, const float *data) +{ + return iegDefData((iegrec_t *) ieg, EXSE_SINGLE_PRECISION, (void *) data); +} + +int +iegDefDataDP(void *ieg, const double *data) +{ + return iegDefData((iegrec_t *) ieg, EXSE_DOUBLE_PRECISION, (void *) data); +} + +int +iegRead(int fileID, void *ieg) +{ + iegrec_t *iegp = (iegrec_t *) ieg; + union + { + double d[200]; + float f[200]; + int32_t i32[200]; + } buf; + + if (!iegp->checked) + { + int status = iegCheckFiletype(fileID, &iegp->byteswap); + if (status == 0) Error("Not a IEG file!"); + iegp->checked = 1; + } + + int byteswap = iegp->byteswap; + + // read header record + size_t blocklen = binReadF77Block(fileID, byteswap); + + if (fileEOF(fileID)) return -1; + + if (IEG_Debug) Message("blocklen = %lu", blocklen); + + int dprec = 0; + if (blocklen == 636 || blocklen == 640) + dprec = 4; + else if (blocklen == 1040 || blocklen == 1036) + dprec = 8; + else + { + Warning("unexpecteted header size %d!", (int) blocklen); + return -1; + } + + iegp->dprec = dprec; + + binReadInt32(fileID, byteswap, 37, buf.i32); + for (int i = 0; i < 37; i++) iegp->ipdb[i] = (int) buf.i32[i]; + + binReadInt32(fileID, byteswap, 18, buf.i32); + for (int i = 0; i < 18; i++) iegp->igdb[i] = (int) buf.i32[i]; + + if (blocklen == 636 || blocklen == 1036) + { + fileRead(fileID, buf.f, 4); + if (byteswap) swap4byte(buf.f, 1); + iegp->refval = (double) buf.f[0]; + } + else + { + fileRead(fileID, buf.d, 8); + if (byteswap) swap8byte(buf.d, 1); + iegp->refval = (double) buf.d[0]; + } + + binReadInt32(fileID, byteswap, 3, buf.i32); + for (int i = 0; i < 3; i++) iegp->igdb[18 + i] = (int) buf.i32[i]; + + if (dprec == EXSE_SINGLE_PRECISION) + { + fileRead(fileID, buf.f, 400); + if (byteswap) swap4byte(buf.f, 100); + for (int i = 0; i < 100; i++) iegp->vct[i] = (double) buf.f[i]; + } + else + { + fileRead(fileID, buf.d, 800); + if (byteswap) swap8byte(buf.d, 100); + for (int i = 0; i < 100; i++) iegp->vct[i] = buf.d[i]; + } + + size_t blocklen2 = binReadF77Block(fileID, byteswap); + + if (blocklen2 != blocklen) + { + Warning("header blocklen differ!"); + return -1; + } + + iegp->datasize = (size_t) IEG_G_NumLon(iegp->igdb) * (size_t) IEG_G_NumLat(iegp->igdb); + + if (IEG_Debug) Message("datasize = %zu", iegp->datasize); + + blocklen = binReadF77Block(fileID, byteswap); + + if (iegp->buffersize < blocklen) + { + iegp->buffer = Realloc(iegp->buffer, blocklen); + iegp->buffersize = blocklen; + } + + if (dprec != (int) (blocklen / iegp->datasize)) + { + Warning("data precision differ! (h = %d; d = %d)", (int) dprec, (int) (blocklen / iegp->datasize)); + return -1; + } + + fileRead(fileID, iegp->buffer, blocklen); + + blocklen2 = binReadF77Block(fileID, byteswap); + + if (blocklen2 != blocklen) + { + Warning("data blocklen differ!"); + return -1; + } + + return 0; +} + +int +iegWrite(int fileID, void *ieg) +{ + iegrec_t *iegp = (iegrec_t *) ieg; + union + { + INT32 i32[200]; + float fvct[100]; + } buf; + int dprec = iegp->dprec; + int byteswap = iegp->byteswap; + + // write header record + size_t blocklen = (dprec == EXSE_SINGLE_PRECISION) ? 636 : 1040; + + binWriteF77Block(fileID, byteswap, blocklen); + + for (int i = 0; i < 37; i++) buf.i32[i] = (INT32) iegp->ipdb[i]; + binWriteInt32(fileID, byteswap, 37, buf.i32); + + for (int i = 0; i < 18; i++) buf.i32[i] = (INT32) iegp->igdb[i]; + binWriteInt32(fileID, byteswap, 18, buf.i32); + + FLT64 refval = (FLT64) iegp->refval; + FLT32 refvalf = (FLT32) iegp->refval; + if (dprec == EXSE_SINGLE_PRECISION) + binWriteFlt32(fileID, byteswap, 1, &refvalf); + else + binWriteFlt64(fileID, byteswap, 1, &refval); + + for (int i = 0; i < 3; i++) buf.i32[i] = (INT32) iegp->igdb[18 + i]; + binWriteInt32(fileID, byteswap, 3, buf.i32); + + if (dprec == EXSE_SINGLE_PRECISION) + { + for (int i = 0; i < 100; i++) buf.fvct[i] = (float) iegp->vct[i]; + binWriteFlt32(fileID, byteswap, 100, buf.fvct); + } + else + { + binWriteFlt64(fileID, byteswap, 100, iegp->vct); + } + + binWriteF77Block(fileID, byteswap, blocklen); + + iegp->datasize = (size_t) iegp->igdb[4] * (size_t) iegp->igdb[5]; + blocklen = iegp->datasize * (size_t) dprec; + + binWriteF77Block(fileID, byteswap, blocklen); + + switch (dprec) + { + case EXSE_SINGLE_PRECISION: + { + binWriteFlt32(fileID, byteswap, iegp->datasize, (FLT32 *) iegp->buffer); + break; + } + case EXSE_DOUBLE_PRECISION: + { + binWriteFlt64(fileID, byteswap, iegp->datasize, (FLT64 *) iegp->buffer); + break; + } + default: + { + Error("unexpected data precision %d", dprec); + break; + } + } + + binWriteF77Block(fileID, byteswap, blocklen); + + return 0; +} +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifndef INCLUDE_GUARD_CDI_REFERENCE_COUNTING +#define INCLUDE_GUARD_CDI_REFERENCE_COUNTING + + +#include <sys/types.h> +#include <stdlib.h> + +/* +This is a base class for all objects that need reference counting. +A CdiReferencedObject has a reference count of one when it is constructed, refObjectRetain() increments the reference count, +refObject Release() decrements it. When the reference count reaches zero, the destructor function is called before the memory of the +object is deallocated with Free(). + +>>> Warning <<< +This code is currently not thread-safe. + +We are currently using the C99 standard, which does not have atomic types. +Also, there are still tons of systems out there that have a gcc without wrong C11 atomics support +(__STDC_NO_ATOMICS__ not defined even though stdatomics.h is not even present). +Consequently, it is impossible to write preprocessor code to even check for the presence of atomic types. +So, we have two options: provide multithreading support by means of locks, or wait a year or two before doing this right. +I, for one, prefer doing things right. +*/ +typedef struct CdiReferencedObject CdiReferencedObject; +struct CdiReferencedObject +{ + // protected: + void (*destructor)(CdiReferencedObject *me); // Subclass constructors should set this to their own destructor. + + // private: //Subclasses may read it to determine whether there is only one reference, though. + size_t refCount; +}; + +void cdiRefObject_construct(CdiReferencedObject *me); +void cdiRefObject_retain(CdiReferencedObject *me); +void cdiRefObject_release(CdiReferencedObject *me); +void cdiRefObject_destruct(CdiReferencedObject *me); + +#endif + +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifndef INCLUDE_GUARD_CDI_GRIB_FILE_H +#define INCLUDE_GUARD_CDI_GRIB_FILE_H + + +/* +CdiInputFile is a file abstraction that allows accessing an input file through any number of channels: +It is reference counted, so that it is closed at the right place, +and it is stateless, so that accesses from different callers cannot interfere with each other. +Once the reference counting code is threadsafe, CdiInputFile will also be threadsafe. +*/ +typedef struct CdiInputFile +{ + // public: + CdiReferencedObject super; + + // private: + char *path; + int fileDescriptor; +} CdiInputFile; + +// Final class, the constructor is private and not defined here. +CdiInputFile * +cdiInputFile_make(const char *path); // The caller is responsible to call cdiRefObject_release() on the returned object. +int cdiInputFile_read(const CdiInputFile *me, off_t readPosition, size_t readSize, size_t *outActualReadSize, + void *buffer); // Returns one of CDI_EINVAL, CDI_ESYSTEM, CDI_EEOF, OR CDI_NOERR. +/* Returns path string, don't use after destruction of CdiInputFile + * object */ +const char *cdiInputFile_getPath(const CdiInputFile *me); +// Destructor is private as well. + +#endif + +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#define _XOPEN_SOURCE 600 + + +#include <errno.h> +#include <fcntl.h> +#include <pthread.h> +#include <string.h> +#include <unistd.h> + +static void cdiInputFile_destruct(CdiInputFile *me); + +// For an explanation of the condestruct() pattern, see the comment in iterator_grib.c +// path != NULL -> construction +// path = NULL -> destruction +static CdiInputFile * +cdiInputFile_condestruct(CdiInputFile *me, const char *path) +{ +#define super() (&me->super) + if (!path) goto destruct; + cdiRefObject_construct(super()); + me->path = strdup(path); + if (!me->path) goto destructSuper; + do + { + me->fileDescriptor = open(me->path, O_RDONLY); + } + while (me->fileDescriptor == -1 && (errno == EINTR || errno == EAGAIN)); + if (me->fileDescriptor == -1) goto freePath; + // construction successfull, now we can set our own destructor + super()->destructor = (void (*)(CdiReferencedObject *)) cdiInputFile_destruct; + goto success; + + // ^ constructor code ^ + // | | + // v destructor/error-cleanup code v + +destruct: + close(me->fileDescriptor); +freePath: + Free(me->path); +destructSuper: + cdiRefObject_destruct(super()); + me = NULL; + +success: + return me; +#undef super +} + +static CdiInputFile **openFileList = NULL; +static size_t openFileCount = 0, openFileListSize = 0; +static pthread_mutex_t openFileListLock = PTHREAD_MUTEX_INITIALIZER; + +// This either returns a new object, or retains and returns a preexisting open file. +CdiInputFile * +cdiInputFile_make(const char *path) +{ + CdiInputFile *result = NULL; + xassert(path); + int error = pthread_mutex_lock(&openFileListLock); + xassert(!error); + { + // Check the list of open files for the given path. + for (size_t i = openFileCount; i-- && !result;) + { + if (!strcmp(path, openFileList[i]->path)) result = openFileList[i]; + } + // If no open file was found, we open one, otherwise we just retain the existing one one more time. + if (result) + { + cdiRefObject_retain(&result->super); + } + else + { + result = (CdiInputFile *) Malloc(sizeof(*result)); + if (!cdiInputFile_condestruct(result, path)) + { + // An error occured during construction, avoid a memory leak. + Free(result); + result = NULL; + } + else + { + // Add the new file to the list of open files. + if (openFileCount == openFileListSize) + { + openFileListSize *= 2; + if (openFileListSize < 16) openFileListSize = 16; + openFileList = (CdiInputFile **) Realloc(openFileList, openFileListSize); + } + xassert(openFileCount < openFileListSize); + openFileList[openFileCount++] = result; + } + } + } + error = pthread_mutex_unlock(&openFileListLock); + xassert(!error); + return result; +} + +int +cdiInputFile_read(const CdiInputFile *me, off_t readPosition, size_t readSize, size_t *outActualReadSize, void *buffer) +{ + char *byteBuffer = (char *) buffer; + size_t trash; + if (!outActualReadSize) outActualReadSize = &trash; + *outActualReadSize = 0; + while (readSize) + { + ssize_t bytesRead = pread(me->fileDescriptor, byteBuffer, readSize, readPosition); + if (bytesRead == -1) return (errno == EINVAL) ? CDI_EINVAL : CDI_ESYSTEM; + if (bytesRead == 0) return CDI_EEOF; + byteBuffer += bytesRead; + readPosition += bytesRead; + readSize -= (size_t) bytesRead; + *outActualReadSize += (size_t) bytesRead; + } + return CDI_NOERR; +} + +const char * +cdiInputFile_getPath(const CdiInputFile *me) +{ + return me->path; +} + +void +cdiInputFile_destruct(CdiInputFile *me) +{ + int error = pthread_mutex_lock(&openFileListLock); + xassert(!error); + { + // Find the position of me in the list of open files. + ssize_t position = (ssize_t) openFileCount; + while (position > 0 && openFileList[--position] != me) + ; + // Remove me from the list + openFileList[position] = openFileList[--openFileCount]; + } + error = pthread_mutex_unlock(&openFileListLock); + xassert(!error); + cdiInputFile_condestruct(me, NULL); +} + +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifndef INSTITUTION_H +#define INSTITUTION_H + +int instituteUnpack(void *buf, int size, int *position, int originNamespace, void *context, int force_id); + +void instituteDefaultEntries(void); + +#endif + +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#include <assert.h> +#include <limits.h> + + +typedef struct +{ + int self; + int center; + int subcenter; + char *name; + char *longname; +} institute_t; + +static int instituteCompareKernel(institute_t *ip1, institute_t *ip2); +static void instituteDestroyP(institute_t *instituteptr); +static void institutePrintP(institute_t *instituteptr, FILE *fp); +static int instituteGetPackSize(institute_t *instituteptr, void *context); +static void institutePackP(void *instituteptr, void *buf, int size, int *position, void *context); +static int instituteTxCode(void *instituteptr); + +static const resOps instituteOps = { (int (*)(void *, void *)) instituteCompareKernel, + (void (*)(void *)) instituteDestroyP, + (void (*)(void *, FILE *)) institutePrintP, + (int (*)(void *, void *)) instituteGetPackSize, + institutePackP, + instituteTxCode }; + +static void +instituteDefaultValue(institute_t *instituteptr) +{ + instituteptr->self = CDI_UNDEFID; + instituteptr->center = CDI_UNDEFID; + instituteptr->subcenter = CDI_UNDEFID; + instituteptr->name = NULL; + instituteptr->longname = NULL; +} + +void +instituteDefaultEntries(void) +{ + // clang-format off + cdiResH resH[] + = { institutDef( 98, 0, "ECMWF", "European Centre for Medium-Range Weather Forecasts"), + institutDef(252, 1, "MPIMET", "Max Planck Institute for Meteorology"), + institutDef( 98, 232, "MPIMET", "Max Planck Institute for Meteorology"), + institutDef( 98, 255, "MPIMET", "Max-Planck-Institute for Meteorology"), + institutDef( 78, 255, "DWD", "Deutscher Wetterdienst"), + institutDef( 78, 0, "DWD", "Deutscher Wetterdienst"), + institutDef(215, 255, "MCH", "MeteoSwiss"), + institutDef( 7, 0, "NCEP", "National Centers for Environmental Prediction"), + institutDef( 7, 1, "NCEP", "National Centers for Environmental Prediction"), + institutDef( 60, 0, "NCAR", "National Center for Atmospheric Research"), + institutDef( 74, 0, "METOFFICE", "U.K. Met Office"), + institutDef( 97, 0, "ESA", "European Space Agency"), + institutDef( 99, 0, "KNMI", "Royal Netherlands Meteorological Institute"), + institutDef( 80, 0, "CNMC", "Reparto per la Meteorologia, Rome (REMET)"), + // institutDef( 0, 0, "IPSL", "IPSL (Institut Pierre Simon Laplace, Paris, France)"); + }; + // clang-format on + + const size_t n = sizeof(resH) / sizeof(*resH); + for (size_t i = 0; i < n; i++) reshSetStatus(resH[i], &instituteOps, RESH_IN_USE); +} + +static int +instituteCompareKernel(institute_t *ip1, institute_t *ip2) +{ + int differ = 0; + + if (ip1->name) + { + if (ip1->center > 0 && ip2->center != ip1->center) differ = 1; + if (ip1->subcenter > 0 && ip2->subcenter != ip1->subcenter) differ = 1; + + if (!differ) + { + if (ip2->name) + { + const size_t len1 = strlen(ip1->name); + const size_t len2 = strlen(ip2->name); + if ((len1 != len2) || memcmp(ip2->name, ip1->name, len2)) differ = 1; + } + } + } + else if (ip1->longname) + { + if (ip2->longname) + { + const size_t len1 = strlen(ip1->longname); + const size_t len2 = strlen(ip2->longname); + if ((len1 != len2) || memcmp(ip2->longname, ip1->longname, len2)) differ = 1; + } + } + else + { + if (!(ip2->center == ip1->center && ip2->subcenter == ip1->subcenter)) differ = 1; + if (ip1->subcenter > 0 && ip1->subcenter != 255 && ip2->subcenter != ip1->subcenter) differ = 1; + } + + return differ; +} + +struct instLoc +{ + institute_t *ip; + int id; +}; + +static enum cdiApplyRet +findInstitute(int id, void *res, void *data) +{ + institute_t *ip1 = ((struct instLoc *) data)->ip; + institute_t *ip2 = (institute_t *) res; + if (!instituteCompareKernel(ip1, ip2)) + { + ((struct instLoc *) data)->id = id; + return CDI_APPLY_STOP; + } + else + return CDI_APPLY_GO_ON; +} + +int +institutInq(int center, int subcenter, const char *name, const char *longname) +{ + institute_t ip_ref; + ip_ref.self = CDI_UNDEFID; + ip_ref.center = center; + ip_ref.subcenter = subcenter; + ip_ref.name = (name && name[0]) ? (char *) name : NULL; + ip_ref.longname = (longname && longname[0]) ? (char *) longname : NULL; + + struct instLoc state = { .ip = &ip_ref, .id = CDI_UNDEFID }; + cdiResHFilterApply(&instituteOps, findInstitute, &state); + + return state.id; +} + +static institute_t * +instituteNewEntry(cdiResH resH, int center, int subcenter, const char *name, const char *longname) +{ + institute_t *instituteptr = (institute_t *) Malloc(sizeof(institute_t)); + instituteDefaultValue(instituteptr); + if (resH == CDI_UNDEFID) + instituteptr->self = reshPut(instituteptr, &instituteOps); + else + { + instituteptr->self = resH; + reshReplace(resH, instituteptr, &instituteOps); + } + instituteptr->center = center; + instituteptr->subcenter = subcenter; + if (name && *name) instituteptr->name = strdupx(name); + if (longname && *longname) instituteptr->longname = strdupx(longname); + return instituteptr; +} + +int +institutDef(int center, int subcenter, const char *name, const char *longname) +{ + institute_t *instituteptr = instituteNewEntry(CDI_UNDEFID, center, subcenter, name, longname); + return instituteptr->self; +} + +int +institutInqCenter(int instID) +{ + return instID != CDI_UNDEFID ? ((institute_t *) (reshGetVal(instID, &instituteOps)))->center : CDI_UNDEFID; +} + +int +institutInqSubcenter(int instID) +{ + return instID != CDI_UNDEFID ? ((institute_t *) (reshGetVal(instID, &instituteOps)))->subcenter : CDI_UNDEFID; +} + +const char * +institutInqNamePtr(int instID) +{ + return instID != CDI_UNDEFID ? ((institute_t *) (reshGetVal(instID, &instituteOps)))->name : NULL; +} + +const char * +institutInqLongnamePtr(int instID) +{ + return instID != CDI_UNDEFID ? ((institute_t *) (reshGetVal(instID, &instituteOps)))->longname : NULL; +} + +int +institutInqNumber(void) +{ + int instNum = (int) (reshCountType(&instituteOps)); + return instNum; +} + +static void +instituteDestroyP(institute_t *instituteptr) +{ + xassert(instituteptr); + Free(instituteptr->name); + Free(instituteptr->longname); + Free(instituteptr); +} + +static void +institutePrintP(institute_t *ip, FILE *fp) +{ + if (ip) + fprintf(fp, + "#\n" + "# instituteID %d\n" + "#\n" + "self = %d\n" + "center = %d\n" + "subcenter = %d\n" + "name = %s\n" + "longname = %s\n", + ip->self, ip->self, ip->center, ip->subcenter, ip->name ? ip->name : "NN", ip->longname ? ip->longname : "NN"); +} + +static int +instituteTxCode(void *instituteptr) +{ + (void) instituteptr; + return INSTITUTE; +} + +enum +{ + INSTITUTE_PACK_INT_SELF, + INSTITUTE_PACK_INT_CENTER, + INSTITUTE_PACK_INT_SUBCENTER, + INSTITUTE_PACK_INT_NAMELEN, + INSTITUTE_PACK_INT_LNAMELEN, + institute_nints, +}; + +static int +instituteGetPackSize(institute_t *ip, void *context) +{ + size_t namelen = strlen(ip->name), longnamelen = strlen(ip->longname); + xassert(namelen < INT_MAX && longnamelen < INT_MAX); + size_t txsize = (size_t) serializeGetSize(institute_nints, CDI_DATATYPE_INT, context) + + (size_t) serializeGetSize((int) namelen + 1, CDI_DATATYPE_TXT, context) + + (size_t) serializeGetSize((int) longnamelen + 1, CDI_DATATYPE_TXT, context); + xassert(txsize <= INT_MAX); + return (int) txsize; +} + +static void +institutePackP(void *instituteptr, void *buf, int size, int *position, void *context) +{ + institute_t *p = (institute_t *) instituteptr; + int tempbuf[institute_nints]; + tempbuf[INSTITUTE_PACK_INT_SELF] = p->self; + tempbuf[INSTITUTE_PACK_INT_CENTER] = p->center; + tempbuf[INSTITUTE_PACK_INT_SUBCENTER] = p->subcenter; + tempbuf[INSTITUTE_PACK_INT_NAMELEN] = (int) strlen(p->name) + 1; + tempbuf[INSTITUTE_PACK_INT_LNAMELEN] = (int) strlen(p->longname) + 1; + serializePack(tempbuf, institute_nints, CDI_DATATYPE_INT, buf, size, position, context); + serializePack(p->name, tempbuf[INSTITUTE_PACK_INT_NAMELEN], CDI_DATATYPE_TXT, buf, size, position, context); + serializePack(p->longname, tempbuf[INSTITUTE_PACK_INT_LNAMELEN], CDI_DATATYPE_TXT, buf, size, position, context); +} + +int +instituteUnpack(void *buf, int size, int *position, int originNamespace, void *context, int force_id) +{ +#define adaptKey(key) (namespaceAdaptKey((key), originNamespace)) + int tempbuf[institute_nints]; + int instituteID; + serializeUnpack(buf, size, position, tempbuf, institute_nints, CDI_DATATYPE_INT, context); + char *name = (char *) Malloc((size_t) tempbuf[INSTITUTE_PACK_INT_NAMELEN] + (size_t) tempbuf[INSTITUTE_PACK_INT_LNAMELEN]), + *longname = name + tempbuf[INSTITUTE_PACK_INT_NAMELEN]; + serializeUnpack(buf, size, position, name, tempbuf[INSTITUTE_PACK_INT_NAMELEN], CDI_DATATYPE_TXT, context); + serializeUnpack(buf, size, position, longname, tempbuf[INSTITUTE_PACK_INT_LNAMELEN], CDI_DATATYPE_TXT, context); + int targetID = force_id ? adaptKey(tempbuf[INSTITUTE_PACK_INT_SELF]) : CDI_UNDEFID; + institute_t *ip + = instituteNewEntry(targetID, tempbuf[INSTITUTE_PACK_INT_CENTER], tempbuf[INSTITUTE_PACK_INT_SUBCENTER], name, longname); + instituteID = ip->self; + xassert(!force_id || instituteID == targetID); + Free(name); + reshSetStatus(instituteID, &instituteOps, reshGetStatus(instituteID, &instituteOps) & ~RESH_SYNC_BIT); +#undef adaptKey + return instituteID; +} + +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +/* + * This file is for the use of iterator.c and the CdiIterator subclasses only. + */ + +#ifndef INCLUDE_GUARD_CDI_ITERATOR_INT_H +#define INCLUDE_GUARD_CDI_ITERATOR_INT_H + + +#include <stdbool.h> + +/* +class CdiIterator + +An iterator is an object that identifies the position of one record in a file, where a record is defined as the data belonging to +one level, timestep, and variable. Using iterators to read a file can be significantly faster than using streams, because they can +avoid building an index of the file. For file formats like grib that do not provide an index within the file, this makes the +difference between reading the file once or reading the file twice. + +CdiIterator is an abstract base class. Which derived class is used depends on the type of the file. The class hierarchy currently +looks like this: + + CdiIterator <|--+-- CdiFallbackIterator + | + +-- CdiGribIterator + +The fallback implementation currently uses the stream interface of CDI under the hood to provide full functionality for all +filetypes for which no iterator implementation exists yet. +*/ +// TODO[NH]: Debug messages, print function. + +struct CdiIterator +{ + int filetype; // This is used to dispatch calls to the correct subclass. + bool isAdvanced; // Used to catch inquiries before the first call to CdiIteratorNextField(). //XXX: Advanced is probably not a + // good word (initialized?) + + // The metadata that can be accessed by the inquiry calls. + // While theoretically redundant, these fields allow the handling of most inquiry calls within the base class. + // Only the name is excempted because it needs an allocation. + // These fields are set by the subclasses in the xxxIterNextField() method. + int datatype, timesteptype; + int gridId; + CdiParam param; + + // The status information for reading/advancing is added in the subclasses. +}; + +void baseIterConstruct(CdiIterator *me, int filetype); +const char *baseIter_constructFromString( + CdiIterator *me, const char *description); // Returns a pointer past the end of the parsed portion of the description string. +void baseIterDestruct(CdiIterator *me); + +#endif + +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +/* + * A fallback implementation of the iterator interface that opens a stream under the hood. + * + * This implementation is mainly available to provide iterator access to file formats that don't support iterator access natively, + * nevertheless, it allows the file to dictate the order in which data is read, possibly providing performance benefits. + */ + +#ifndef INCLUDE_GUARD_CDI_ITERATOR_FALLBACK_H +#define INCLUDE_GUARD_CDI_ITERATOR_FALLBACK_H + +#ifdef HAVE_CONFIG_H +#endif + +#include <stdlib.h> + + +typedef struct CdiFallbackIterator CdiFallbackIterator; + +CdiIterator *cdiFallbackIterator_new(const char *path, int filetype); +CdiFallbackIterator *cdiFallbackIterator_clone(CdiIterator *me); +CdiIterator *cdiFallbackIterator_getSuper(CdiFallbackIterator *me); +char *cdiFallbackIterator_serialize(CdiIterator *me); +CdiFallbackIterator *cdiFallbackIterator_deserialize(const char *me); + +int cdiFallbackIterator_nextField(CdiIterator *me); + +char *cdiFallbackIterator_inqTime(CdiIterator *me, CdiTimeType timeType); +int cdiFallbackIterator_levelType(CdiIterator *me, int levelSelector, char **outName, char **outLongName, char **outStdName, + char **outUnit); +int cdiFallbackIterator_level(CdiIterator *me, int levelSelector, double *outValue1, double *outValue2); +int cdiFallbackIterator_zaxisUuid(CdiIterator *me, int *outVgridNumber, int *outLevelCount, unsigned char outUuid[CDI_UUID_SIZE]); +char *cdiFallbackIterator_copyVariableName(CdiIterator *me); +int cdiFallbackIterator_inqTile(CdiIterator *me, int *outTileIndex, int *outTileAttribute); +int cdiFallbackIterator_inqTileCount(CdiIterator *me, int *outTileCount, int *outTileAttributeCount); + +void cdiFallbackIterator_readField(CdiIterator *me, double *buffer, size_t *nmiss); +void cdiFallbackIterator_readFieldF(CdiIterator *me, float *buffer, size_t *nmiss); + +void cdiFallbackIterator_delete(CdiIterator *super); + +#endif + +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +/* + * An implementation of the iterator interface for GRIB files. + * Since GRIB files do not contain an index, this avoids scanning the entire file to generate an in-memory index as streamOpenRead() + * does. Consequently, using this interface is much more efficient for GRIB files. + */ + +#ifndef INCLUDE_GUARD_CDI_ITERATOR_GRIB_H +#define INCLUDE_GUARD_CDI_ITERATOR_GRIB_H + +#ifdef HAVE_CONFIG_H +#endif + + +#ifdef HAVE_LIBGRIB_API +#include <grib_api.h> +#endif + +typedef struct recordList recordList; + +CdiIterator *cdiGribIterator_new(const char *path, int filetype); +CdiGribIterator *cdiGribIterator_makeClone(CdiIterator *me); +CdiIterator *cdiGribIterator_getSuper(CdiGribIterator *me); +char *cdiGribIterator_serialize(CdiIterator *me); +CdiGribIterator *cdiGribIterator_deserialize(const char *me); + +int cdiGribIterator_nextField(CdiIterator *me); + +char *cdiGribIterator_inqTime(CdiIterator *me, CdiTimeType timeType); +int cdiGribIterator_levelType(CdiIterator *me, int levelSelector, char **outName, char **outLongName, char **outStdName, + char **outUnit); +int cdiGribIterator_level(CdiIterator *me, int levelSelector, double *outValue1, double *outValue2); +int cdiGribIterator_zaxisUuid(CdiIterator *me, int *outVgridNumber, int *outLevelCount, unsigned char outUuid[CDI_UUID_SIZE]); +int cdiGribIterator_inqTile(CdiIterator *me, int *outTileIndex, int *outTileAttribute); +int cdiGribIterator_inqTileCount(CdiIterator *me, int *outTileCount, int *outTileAttributeCount); +char *cdiGribIterator_copyVariableName(CdiIterator *me); + +void cdiGribIterator_readField(CdiIterator *me, double *buffer, size_t *nmiss); +void cdiGribIterator_readFieldF(CdiIterator *me, float *buffer, size_t *nmiss); + +#endif + +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ + +#include <assert.h> +#include <ctype.h> + +static const char kUnexpectedFileTypeMessage[] = "Internal error: Unexpected file type encountered in iterator.\n" + "This is either due to an illegal memory access by the application\n" + " or an internal logical error in CDI (unlikely, but possible)."; +static const char kAdvancedString[] = "advanced"; +static const char kUnadvancedString[] = "unadvanced"; + +// Returns a static string. +static const char * +fileType2String(int fileType) +{ + switch (fileType) + { +#ifdef HAVE_LIBGRIB_API + case CDI_FILETYPE_GRB: return "CDI::Iterator::GRIB1"; + case CDI_FILETYPE_GRB2: return "CDI::Iterator::GRIB2"; +#endif +#ifdef HAVE_LIBNETCDF + case CDI_FILETYPE_NC: return "CDI::Iterator::NetCDF"; + case CDI_FILETYPE_NC2: return "CDI::Iterator::NetCDF2"; + case CDI_FILETYPE_NC4: return "CDI::Iterator::NetCDF4"; + case CDI_FILETYPE_NC4C: return "CDI::Iterator::NetCDF4C"; + case CDI_FILETYPE_NC5: return "CDI::Iterator::NetCDF5"; + case CDI_FILETYPE_NCZARR: return "CDI::Iterator::NCZarr"; +#endif +#ifdef HAVE_LIBSERVICE + case CDI_FILETYPE_SRV: return "CDI::Iterator::SRV"; +#endif +#ifdef HAVE_LIBEXTRA + case CDI_FILETYPE_EXT: return "CDI::Iterator::EXT"; +#endif +#ifdef HAVE_LIBIEG + case CDI_FILETYPE_IEG: return "CDI::Iterator::IEG"; +#endif + + default: return NULL; + } +} + +static int +string2FileType(const char *fileType, const char **outRestString) +{ + // This first part unconditionally checks all known type strings, and only if the given string matches one of these strings, we + // use fileType2string() to check whether support for this type has been compiled in. This is to avoid throwing "invalid type + // string" errors when we just have a library version mismatch. +#define check(givenString, typeString, typeConstant) \ + do \ + { \ + if (givenString == strstr(givenString, typeString)) \ + { \ + if (outRestString) *outRestString = givenString + strlen(typeString); \ + if (fileType2String(typeConstant)) return typeConstant; \ + Error("Support for " typeString \ + " not compiled in. Please check that the result of `cdiIterator_serialize()` is only passed to a " \ + "`cdiIterator_deserialize()` implementation of the same CDI library version."); \ + return CDI_FILETYPE_UNDEF; \ + } \ + } \ + while (0) + check(fileType, "CDI::Iterator::GRIB1", CDI_FILETYPE_GRB); + check(fileType, "CDI::Iterator::GRIB2", CDI_FILETYPE_GRB2); + check(fileType, "CDI::Iterator::NetCDF", CDI_FILETYPE_NC); + check(fileType, "CDI::Iterator::NetCDF2", CDI_FILETYPE_NC2); + check(fileType, "CDI::Iterator::NetCDF4", CDI_FILETYPE_NC4); + check(fileType, "CDI::Iterator::NetCDF4C", CDI_FILETYPE_NC4C); + check(fileType, "CDI::Iterator::NetCDF5", CDI_FILETYPE_NC5); + check(fileType, "CDI::Iterator::NCZarr", CDI_FILETYPE_NCZARR); + check(fileType, "CDI::Iterator::SRV", CDI_FILETYPE_SRV); + check(fileType, "CDI::Iterator::EXT", CDI_FILETYPE_EXT); + check(fileType, "CDI::Iterator::IEG", CDI_FILETYPE_IEG); +#undef check + + // If this point is reached, the given string does not seem to be produced by a cdiIterator_serialize() call. + Error("The string \"%s\" does not start with a valid iterator type. Please check the source of this string.", fileType); + *outRestString = fileType; + return CDI_FILETYPE_UNDEF; +} + +/* +@Function cdiIterator_new +@Title Create an iterator for an input file + +@Prototype CdiIterator* cdiIterator_new(const char* path) +@Parameter + @item path Path to the file that is to be read. + +@Result An iterator for the given file. + +@Description + Combined allocator and constructor for CdiIterator. + + The returned iterator does not point to the first field yet, + it must first be advanced once before the first field can be introspected. + This design decision has two benefits: 1. Empty files require no special + cases, 2. Users can start a while(!cdiIterator_nextField(iterator)) loop + right after the call to cdiIterator_new(). +*/ +CdiIterator * +cdiIterator_new(const char *path) +{ + int trash; + const int filetype = cdiGetFiletype(path, &trash); + switch (cdiBaseFiletype(filetype)) + { + case CDI_FILETYPE_UNDEF: Warning("Can't open file \"%s\": unknown format\n", path); return NULL; + +#ifdef HAVE_LIBGRIB_API + case CDI_FILETYPE_GRB: + case CDI_FILETYPE_GRB2: return cdiGribIterator_new(path, filetype); +#endif + +#ifdef HAVE_LIBNETCDF + case CDI_FILETYPE_NETCDF: +#endif +#ifdef HAVE_LIBSERVICE + case CDI_FILETYPE_SRV: +#endif +#ifdef HAVE_LIBEXTRA + case CDI_FILETYPE_EXT: +#endif +#ifdef HAVE_LIBIEG + case CDI_FILETYPE_IEG: +#endif + return cdiFallbackIterator_new(path, filetype); + + default: + Warning("the file \"%s\" is of type %s, but support for this format is not compiled in!", path, strfiletype(filetype)); + return NULL; + } +} + +void +baseIterConstruct(CdiIterator *me, int filetype) +{ + me->filetype = filetype; + me->isAdvanced = false; +} + +const char * +baseIter_constructFromString(CdiIterator *me, const char *description) +{ + const char *result = description; + me->filetype = string2FileType(result, &result); + assert(me->filetype != CDI_FILETYPE_UNDEF + && "Please report this error."); // This condition should have been checked for in a calling function. + for (; *result && isspace(*result); result++) + ; + if (result == strstr(result, kAdvancedString)) + { + me->isAdvanced = true; + result += sizeof(kAdvancedString) - 1; + } + else if (result == strstr(result, kUnadvancedString)) + { + me->isAdvanced = false; + result += sizeof(kUnadvancedString) - 1; + } + else + { + Error("Invalid iterator description string \"%s\". Please check the origin of this string.", description); + return NULL; + } + return result; +} + +#define sanityCheck(me) \ + do \ + { \ + if (!me) xabort("NULL was passed to %s as an iterator. Please check the return value of cdiIterator_new().", __func__); \ + if (!me->isAdvanced) xabort("Calling %s is not allowed without calling cdiIterator_nextField() first.", __func__); \ + } \ + while (0) + +/* +@Function cdiIterator_clone +@Title Make a copy of an iterator + +@Prototype CdiIterator* cdiIterator_clone(CdiIterator* me) +@Parameter + @item iterator The iterator to copy. + +@Result The clone. + +@Description + Clones the given iterator. Make sure to call cdiIterator_delete() on both + the copy and the original. + + This is not a cheap operation: Depending on the type of the file, it will + either make a copy of the current field in memory (GRIB files), or reopen + the file (all other file types). Use it sparingly. And if you do, try to + avoid keeping too many clones around: their memory footprint is + significant. +*/ +CdiIterator * +cdiIterator_clone(CdiIterator *me) +{ + sanityCheck(me); + switch (cdiBaseFiletype(me->filetype)) + { +#ifdef HAVE_LIBGRIB_API + case CDI_FILETYPE_GRB: + case CDI_FILETYPE_GRB2: return cdiGribIterator_getSuper(cdiGribIterator_clone(me)); +#endif + +#ifdef HAVE_LIBNETCDF + case CDI_FILETYPE_NETCDF: +#endif +#ifdef HAVE_LIBSERVICE + case CDI_FILETYPE_SRV: +#endif +#ifdef HAVE_LIBEXTRA + case CDI_FILETYPE_EXT: +#endif +#ifdef HAVE_LIBIEG + case CDI_FILETYPE_IEG: +#endif + return cdiFallbackIterator_getSuper(cdiFallbackIterator_clone(me)); + + default: Error(kUnexpectedFileTypeMessage); return NULL; + } +} + +/* +@Function cdiGribIterator_clone +@Title Gain access to GRIB specific functionality + +@Prototype CdiGribIterator* cdiGribIterator_clone(CdiIterator* me) +@Parameter + @item iterator The iterator to operate on. + +@Result A clone that allows access to GRIB specific functionality, or NULL if the underlying file is not a GRIB file. + +@Description + Clones the given iterator iff the underlying file is a GRIB file, the returned iterator allows access to GRIB specific +functionality. Make sure to check that the return value is not NULL, and to call cdiGribIterator_delete() on the copy. + + This is not a cheap operation: It will make a copy of the current field in memory. Use it sparingly. And if you do, try to avoid +keeping too many clones around, their memory footprint is significant. +*/ +CdiGribIterator * +cdiGribIterator_clone(CdiIterator *me) +{ + sanityCheck(me); + switch (me->filetype) + { +#ifdef HAVE_LIBGRIB_API + case CDI_FILETYPE_GRB: + case CDI_FILETYPE_GRB2: return cdiGribIterator_makeClone(me); +#endif + + default: return NULL; + } +} + +/* +@Function cdiIterator_serialize +@Title Serialize an iterator for sending it to another process + +@Prototype char* cdiIterator_serialize(CdiIterator* me) +@Parameter + @item iterator The iterator to operate on. + +@Result A malloc'ed string that contains the full description of the iterator. + +@Description + Make sure to call Free() on the resulting string. +*/ +char * +cdiIterator_serialize(CdiIterator *me) +{ + if (!me) xabort("NULL was passed to %s as an iterator. Please check the return value of cdiIterator_new().", __func__); + char *subclassDescription = NULL; + switch (cdiBaseFiletype(me->filetype)) + { +#ifdef HAVE_LIBGRIB_API + case CDI_FILETYPE_GRB: + case CDI_FILETYPE_GRB2: subclassDescription = cdiGribIterator_serialize(me); break; +#endif + +#ifdef HAVE_LIBNETCDF + case CDI_FILETYPE_NETCDF: +#endif +#ifdef HAVE_LIBSERVICE + case CDI_FILETYPE_SRV: +#endif +#ifdef HAVE_LIBEXTRA + case CDI_FILETYPE_EXT: +#endif +#ifdef HAVE_LIBIEG + case CDI_FILETYPE_IEG: +#endif + subclassDescription = cdiFallbackIterator_serialize(me); + break; + + default: Error(kUnexpectedFileTypeMessage); return NULL; + } + + const char *ftypeStr = fileType2String(me->filetype), *advStr = me->isAdvanced ? kAdvancedString : kUnadvancedString; + char *result = (char *) Malloc(strlen(ftypeStr) + 1 + strlen(advStr) + 1 + strlen(subclassDescription) + 1); + sprintf(result, "%s %s %s", ftypeStr, advStr, subclassDescription); + Free(subclassDescription); + return result; +} + +/* +@Function cdiIterator_deserialize +@Title Recreate an iterator from its textual description + +@Prototype CdiIterator* cdiIterator_deserialize(const char* description) +@Parameter + @item description The result of a call to cdiIterator_serialize(). + +@Result A clone of the original iterator. + +@Description + A pair of cdiIterator_serialize() and cdiIterator_deserialize() is functionally equivalent to a call to cdiIterator_clone() + + This function will reread the current field from disk, so don't expect immediate return. +*/ +// This only checks the type of the iterator and calls the corresponding subclass function, +// the real deserialization is done in baseIter_constructFromString(). +CdiIterator * +cdiIterator_deserialize(const char *description) +{ + switch (cdiBaseFiletype(string2FileType(description, NULL))) + { +#ifdef HAVE_LIBGRIB_API + case CDI_FILETYPE_GRB: + case CDI_FILETYPE_GRB2: return cdiGribIterator_getSuper(cdiGribIterator_deserialize(description)); +#endif + +#ifdef HAVE_LIBNETCDF + case CDI_FILETYPE_NETCDF: +#endif +#ifdef HAVE_LIBSERVICE + case CDI_FILETYPE_SRV: +#endif +#ifdef HAVE_LIBEXTRA + case CDI_FILETYPE_EXT: +#endif +#ifdef HAVE_LIBIEG + case CDI_FILETYPE_IEG: +#endif + return cdiFallbackIterator_getSuper(cdiFallbackIterator_deserialize(description)); + + default: Error(kUnexpectedFileTypeMessage); return NULL; + } +} + +/* +@Function cdiIterator_print +@Title Print a textual description of the iterator to a stream + +@Prototype void cdiIterator_print(CdiIterator* iterator, FILE* stream); +@Parameter + @item iterator The iterator to print. + @item stream The stream to print to. + +@Description + Use for debugging output. +*/ +void +cdiIterator_print(CdiIterator *me, FILE *stream) +{ + char *description = cdiIterator_serialize(me); + fprintf(stream, "%s\n", description); + Free(description); +} + +/* +@Function cdiIterator_nextField +@Title Advance an iterator to the next field in the file + +@Prototype int cdiIterator_nextField(CdiIterator* iterator) +@Parameter + @item iterator The iterator to operate on. + +@Result An error code. May be one of: + * CDI_NOERR: The iterator has successfully been advanced to the next field. + * CDI_EEOF: No more fields to read in this file. + +@Description + One call to cdiIterator_nextField() is required before the metadata of the first field can be examined. + Usually, it will be used directly as the condition for a while() loop. +*/ +int +cdiIterator_nextField(CdiIterator *me) +{ + if (!me) xabort("NULL was passed in as an iterator. Please check the return value of cdiIterator_new()."); + me->isAdvanced = true; + switch (cdiBaseFiletype(me->filetype)) + { +#ifdef HAVE_LIBGRIB_API + case CDI_FILETYPE_GRB: + case CDI_FILETYPE_GRB2: return cdiGribIterator_nextField(me); +#endif + +#ifdef HAVE_LIBNETCDF + case CDI_FILETYPE_NETCDF: +#endif +#ifdef HAVE_LIBSERVICE + case CDI_FILETYPE_SRV: +#endif +#ifdef HAVE_LIBEXTRA + case CDI_FILETYPE_EXT: +#endif +#ifdef HAVE_LIBIEG + case CDI_FILETYPE_IEG: +#endif + return cdiFallbackIterator_nextField(me); + + default: Error(kUnexpectedFileTypeMessage); return CDI_EINVAL; + } +} + +static char * +cdiIterator_inqTime(CdiIterator *me, CdiTimeType timeType) +{ + sanityCheck(me); + switch (cdiBaseFiletype(me->filetype)) + { +#ifdef HAVE_LIBGRIB_API + case CDI_FILETYPE_GRB: + case CDI_FILETYPE_GRB2: return cdiGribIterator_inqTime(me, timeType); +#endif + +#ifdef HAVE_LIBNETCDF + case CDI_FILETYPE_NETCDF: +#endif +#ifdef HAVE_LIBSERVICE + case CDI_FILETYPE_SRV: +#endif +#ifdef HAVE_LIBEXTRA + case CDI_FILETYPE_EXT: +#endif +#ifdef HAVE_LIBIEG + case CDI_FILETYPE_IEG: +#endif + return cdiFallbackIterator_inqTime(me, timeType); + + default: Error(kUnexpectedFileTypeMessage); return NULL; + } +} + +/* +@Function cdiIterator_inqStartTime +@Title Get the start time of a measurement + +@Prototype char* cdiIterator_inqStartTime(CdiIterator* me) +@Parameter + @item iterator The iterator to operate on. + +@Result A malloc'ed string containing the (start) time of the current field in the format "YYYY-MM-DDTHH:MM:SS.mmm". + +@Description +The returned time is either the time of the data (fields defined at a time point), +or the start time of an integration time range (statistical fields). + +Converts the time to the ISO-8601 format and returns it in a newly allocated buffer. +The caller is responsible to Free() the resulting string. + +If the file is a GRIB file, the calendar that is used to resolve the relative times is the proleptic calendar +as it is implemented by the standard C mktime() function. +This is due to the fact that GRIB-API version 1.12.3 still does not implement the calendar identification fields. +*/ +char * +cdiIterator_inqStartTime(CdiIterator *me) +{ + return cdiIterator_inqTime(me, kCdiTimeType_startTime); +} + +/* +@Function cdiIterator_inqEndTime +@Title Get the end time of a measurement + +@Prototype char* cdiIterator_inqEndTime(CdiIterator* me) +@Parameter + @item iterator The iterator to operate on. + +@Result A malloc'ed string containing the end time of the current field in the format "YYYY-MM-DDTHH:MM:SS.mmm", or NULL if no such +time is defined. + +@Description +The returned time is the end time of an integration period if such a time exists (statistical fields). +Otherwise, NULL is returned. + +Converts the time to the ISO-8601 format and returns it in a newly allocated buffer. +The caller is responsible to Free() the resulting string. + +If the file is a GRIB file, the calendar that is used to resolve the relative times is the proleptic calendar +as it is implemented by the standard C mktime() function. +This is due to the fact that GRIB-API version 1.12.3 still does not implement the calendar identification fields. +*/ +char * +cdiIterator_inqEndTime(CdiIterator *me) +{ + return cdiIterator_inqTime(me, kCdiTimeType_endTime); +} + +/* +@Function cdiIterator_inqRTime +@Title Get the validity time of the current field + +@Prototype char* cdiIterator_inqRTime(CdiIterator* me) +@Parameter + @item iterator The iterator to operate on. + +@Result A malloc'ed string containing the validity time of the current field in the format "YYYY-MM-DDTHH:MM:SS.mmm". + +@Description +The returned time is the validity time as it is returned by taxisInqVtime(), only more precise. +That is, if the field is a time point, its time is returned, +if it is a statistical field with an integration period, the end time of the integration period is returned. + +Converts the time to the ISO-8601 format and returns it in a newly allocated buffer. +The caller is responsible to Free() the resulting string. + +If the file is a GRIB file, the calendar that is used to resolve the relative times is the proleptic calendar +as it is implemented by the standard C mktime() function. +This is due to the fact that GRIB-API version 1.12.3 still does not implement the calendar identification fields. +*/ +char * +cdiIterator_inqRTime(CdiIterator *me) +{ + return cdiIterator_inqTime(me, kCdiTimeType_referenceTime); +} + +/* +@Function cdiIterator_inqVTime +@Title Get the validity time of the current field + +@Prototype char* cdiIterator_inqVTime(CdiIterator* me) +@Parameter + @item iterator The iterator to operate on. + +@Result A malloc'ed string containing the validity time of the current field in the format "YYYY-MM-DDTHH:MM:SS.mmm". + +@Description +The returned time is the validity time as it is returned by taxisInqVtime(), only more precise. +That is, if the field is a time point, its time is returned, +if it is a statistical field with an integration period, the end time of the integration period is returned. + +Converts the time to the ISO-8601 format and returns it in a newly allocated buffer. +The caller is responsible to Free() the resulting string. + +If the file is a GRIB file, the calendar that is used to resolve the relative times is the proleptic calendar +as it is implemented by the standard C mktime() function. +This is due to the fact that GRIB-API version 1.12.3 still does not implement the calendar identification fields. +*/ +char * +cdiIterator_inqVTime(CdiIterator *me) +{ + char *result = cdiIterator_inqEndTime(me); + return (result) ? result : cdiIterator_inqStartTime(me); +} + +/* +@Function cdiIterator_inqLevelType +@Title Get the type of a level + +@Prototype int cdiIterator_inqLevelType(CdiIterator* me, int levelSelector, char **outName = NULL, char **outLongName = NULL, char +**outStdName = NULL, char **outUnit = NULL) +@Parameter + @item iterator The iterator to operate on. + @item levelSelector Zero for the top level, one for the bottom level + @item outName Will be set to a Malloc()'ed string with the name of the level if not NULL. + @item outLongName Will be set to a Malloc()'ed string with the long name of the level if not NULL. + @item outStdName Will be set to a Malloc()'ed string with the standard name of the level if not NULL. + @item outUnit Will be set to a Malloc()'ed string with the unit of the level if not NULL. + +@Result An integer indicating the type of the level. + +@Description +Find out some basic information about the given level, the levelSelector selects the function of the requested level. +If the requested level does not exist, this returns CDI_UNDEFID. +*/ +int +cdiIterator_inqLevelType(CdiIterator *me, int levelSelector, char **outName, char **outLongName, char **outStdName, char **outUnit) +{ + sanityCheck(me); + switch (cdiBaseFiletype(me->filetype)) + { +#ifdef HAVE_LIBGRIB_API + case CDI_FILETYPE_GRB: + case CDI_FILETYPE_GRB2: return cdiGribIterator_levelType(me, levelSelector, outName, outLongName, outStdName, outUnit); +#endif + +#ifdef HAVE_LIBNETCDF + case CDI_FILETYPE_NETCDF: +#endif +#ifdef HAVE_LIBSERVICE + case CDI_FILETYPE_SRV: +#endif +#ifdef HAVE_LIBEXTRA + case CDI_FILETYPE_EXT: +#endif +#ifdef HAVE_LIBIEG + case CDI_FILETYPE_IEG: +#endif + return cdiFallbackIterator_levelType(me, levelSelector, outName, outLongName, outStdName, outUnit); + + default: Error(kUnexpectedFileTypeMessage); return CDI_UNDEFID; + } +} + +/* +@Function cdiIterator_inqLevel +@Title Get the value of the z-coordinate + +@Prototype void cdiIterator_inqLevel(CdiIterator* me, int levelSelector, double* outValue1, double* outValue2 = NULL) +@Parameter + @item iterator The iterator to operate on. + @item levelSelector Zero for the top level, one for the bottom level + @item outValue1 For "normal" levels this returns the value, for hybrid levels the first coordinate, for generalized levels the +level number. + @item outValue2 Zero for "normal" levels, for hybrid levels, this returns the second coordinate, for generalized levels the +level count. + +@Result An error code. + +@Description +Returns the value of the z-coordinate, whatever that may be. +*/ +int +cdiIterator_inqLevel(CdiIterator *me, int levelSelector, double *outValue1, double *outValue2) +{ + sanityCheck(me); + switch (cdiBaseFiletype(me->filetype)) + { +#ifdef HAVE_LIBGRIB_API + case CDI_FILETYPE_GRB: + case CDI_FILETYPE_GRB2: return cdiGribIterator_level(me, levelSelector, outValue1, outValue2); +#endif + +#ifdef HAVE_LIBNETCDF + case CDI_FILETYPE_NETCDF: +#endif +#ifdef HAVE_LIBSERVICE + case CDI_FILETYPE_SRV: +#endif +#ifdef HAVE_LIBEXTRA + case CDI_FILETYPE_EXT: +#endif +#ifdef HAVE_LIBIEG + case CDI_FILETYPE_IEG: +#endif + return cdiFallbackIterator_level(me, levelSelector, outValue1, outValue2); + + default: Error(kUnexpectedFileTypeMessage); return CDI_EINVAL; + } +} + +/* +@Function cdiIterator_inqLevelUuid +@Title Get the UUID of the z-axis used by this field + +@Prototype int cdiIterator_inqLevelUuid(CdiIterator* me, int levelSelector, unsigned char (*outUuid)[16]) +@Parameter + @item iterator The iterator to operate on. + @item outVgridNumber The number of the associated vertical grid description. + @item outLevelCount The number of levels in the associated vertical grid description. + @item outUuid A pointer to a user supplied buffer of 16 bytes to store the UUID in. + +@Result An error code. + +@Description +Returns identifying information for the external z-axis description. May only be called for generalized levels. +*/ +int +cdiIterator_inqLevelUuid(CdiIterator *me, int *outVgridNumber, int *outLevelCount, unsigned char outUuid[CDI_UUID_SIZE]) +{ + sanityCheck(me); + switch (cdiBaseFiletype(me->filetype)) + { +#ifdef HAVE_LIBGRIB_API + case CDI_FILETYPE_GRB: + case CDI_FILETYPE_GRB2: return cdiGribIterator_zaxisUuid(me, outVgridNumber, outLevelCount, outUuid); +#endif + +#ifdef HAVE_LIBNETCDF + case CDI_FILETYPE_NETCDF: +#endif +#ifdef HAVE_LIBSERVICE + case CDI_FILETYPE_SRV: +#endif +#ifdef HAVE_LIBEXTRA + case CDI_FILETYPE_EXT: +#endif +#ifdef HAVE_LIBIEG + case CDI_FILETYPE_IEG: +#endif + return cdiFallbackIterator_zaxisUuid(me, outVgridNumber, outLevelCount, outUuid); + + default: Error(kUnexpectedFileTypeMessage); return CDI_ELIBNAVAIL; + } +} + +/* +@Function cdiIterator_inqTile +@Title Inquire the tile information for the current field + +@Prototype int cdiIterator_inqTile(CdiIterator* me, int* outTileIndex, int* outTileAttribute) +@Parameter + @item iterator The iterator to operate on. + @item outTileIndex The index of the current tile, -1 if no tile information is available. + @item outTileAttribute The attribute of the current tile, -1 if no tile information is available. + +@Result An error code. CDI_EINVAL if there is no tile information associated with the current field. + +@Description +Inquire the tile index and attribute for the current field. +*/ +int +cdiIterator_inqTile(CdiIterator *me, int *outTileIndex, int *outTileAttribute) +{ + sanityCheck(me); + switch (cdiBaseFiletype(me->filetype)) + { +#ifdef HAVE_LIBGRIB_API + case CDI_FILETYPE_GRB: + case CDI_FILETYPE_GRB2: return cdiGribIterator_inqTile(me, outTileIndex, outTileAttribute); +#endif + +#ifdef HAVE_LIBNETCDF + case CDI_FILETYPE_NETCDF: +#endif +#ifdef HAVE_LIBSERVICE + case CDI_FILETYPE_SRV: +#endif +#ifdef HAVE_LIBEXTRA + case CDI_FILETYPE_EXT: +#endif +#ifdef HAVE_LIBIEG + case CDI_FILETYPE_IEG: +#endif + return cdiFallbackIterator_inqTile(me, outTileIndex, outTileAttribute); + + default: Error(kUnexpectedFileTypeMessage); return CDI_ELIBNAVAIL; + } +} + +/** +@Function cdiIterator_inqTileCount +@Title Inquire the tile count and tile attribute counts for the current field + +@Prototype int cdiIterator_inqTileCount(CdiIterator* me, int* outTileCount, int* outTileAttributeCount) +@Parameter + @item iterator The iterator to operate on. + @item outTileCount The number of tiles used for this variable, zero if no tile information is available. + @item outTileAttributeCount The number of attributes available for the tile of this field, zero if no tile information is +available. Note: This is not the global attribute count, which would be impossible to infer without reading the entire file if it's +a GRIB file. + +@Result An error code. CDI_EINVAL if there is no tile information associated with the current field. + +@Description +Inquire the tile count and tile attribute counts for the current field. +*/ +int +cdiIterator_inqTileCount(CdiIterator *me, int *outTileCount, int *outTileAttributeCount) +{ + sanityCheck(me); + switch (cdiBaseFiletype(me->filetype)) + { +#ifdef HAVE_LIBGRIB_API + case CDI_FILETYPE_GRB: + case CDI_FILETYPE_GRB2: return cdiGribIterator_inqTileCount(me, outTileCount, outTileAttributeCount); +#endif + +#ifdef HAVE_LIBNETCDF + case CDI_FILETYPE_NETCDF: +#endif +#ifdef HAVE_LIBSERVICE + case CDI_FILETYPE_SRV: +#endif +#ifdef HAVE_LIBEXTRA + case CDI_FILETYPE_EXT: +#endif +#ifdef HAVE_LIBIEG + case CDI_FILETYPE_IEG: +#endif + return cdiFallbackIterator_inqTileCount(me, outTileCount, outTileAttributeCount); + + default: Error(kUnexpectedFileTypeMessage); return CDI_ELIBNAVAIL; + } +} + +/* +@Function cdiIterator_inqParam +@Title Get discipline, category, and number + +@Prototype CdiParam cdiIterator_inqParam(CdiIterator* iterator) +@Parameter + @item iterator The iterator to operate on. + +@Result A struct containing the requested information. + +@Description + Simple metadata inspection function. +*/ +CdiParam +cdiIterator_inqParam(CdiIterator *me) +{ + sanityCheck(me); + return me->param; +} + +/* +@Function cdiIterator_inqParamParts +@Title Get discipline, category, and number + +@Prototype void cdiIterator_inqParamParts(CdiIterator *me, int *outDiscipline, int *outCategory, int *outNumber) +@Parameter + @item iterator The iterator to operate on. + @item outDiscipline This is used to return the discipline. + @item outCategory This is used to return the category. + @item outNumber This is used to return the number. + +@Description + Simple metadata inspection function. + + Some FORTRAN compilers produce wrong code for the cdiIterator_inqParam()-wrapper, + rendering it unusable from FORTRAN. This function is the workaround. +*/ +void +cdiIterator_inqParamParts(CdiIterator *me, int *outDiscipline, int *outCategory, int *outNumber) +{ + CdiParam result = cdiIterator_inqParam(me); + if (outDiscipline) *outDiscipline = result.discipline; + if (outCategory) *outCategory = result.category; + if (outNumber) *outNumber = result.number; +} + +/* +@Function cdiIterator_inqDatatype +@Title Get the datatype of the current field + +@Prototype int cdiIterator_inqDatatype(CdiIterator* iterator) +@Parameter + @item iterator The iterator to operate on. + +@Result The datatype that is used to store this field on disk. + +@Description + Simple metadata inspection function. +*/ +int +cdiIterator_inqDatatype(CdiIterator *me) +{ + sanityCheck(me); + return me->datatype; +} + +/* +@Function cdiIterator_inqFiletype +@Title Get the filetype of the current field + +@Prototype int cdiIterator_inqFiletype(CdiIterator* iterator) +@Parameter + @item iterator The iterator to operate on. + +@Result The filetype that is used to store this field on disk. + +@Description + Simple metadata inspection function. +*/ +int +cdiIterator_inqFiletype(CdiIterator *me) +{ + return me->filetype; +} + +/* +@Function cdiIterator_inqTsteptype +@Title Get the timestep type + +@Prototype int cdiIterator_inqTsteptype(CdiIterator* iterator) +@Parameter + @item iterator The iterator to operate on. + +@Result The timestep type. + +@Description + Simple metadata inspection function. +*/ +int +cdiIterator_inqTsteptype(CdiIterator *me) +{ + sanityCheck(me); + return me->timesteptype; +} + +/* +@Function cdiIterator_inqVariableName +@Title Get the variable name of the current field + +@Prototype char* cdiIterator_inqVariableName(CdiIterator* iterator) +@Parameter + @item iterator The iterator to operate on. + +@Result A pointer to a C-string containing the name. The storage for this string is allocated with Malloc(), and it is the +responsibility of the caller to Free() it. + +@Description + Allocates a buffer to hold the string, copies the current variable name into this buffer, and returns the buffer. + The caller is responsible to make the corresponding Free() call. +*/ +char * +cdiIterator_inqVariableName(CdiIterator *me) +{ + sanityCheck(me); + switch (cdiBaseFiletype(me->filetype)) + { +#ifdef HAVE_LIBGRIB_API + case CDI_FILETYPE_GRB: + case CDI_FILETYPE_GRB2: return cdiGribIterator_copyVariableName(me); +#endif + +#ifdef HAVE_LIBNETCDF + case CDI_FILETYPE_NETCDF: +#endif +#ifdef HAVE_LIBSERVICE + case CDI_FILETYPE_SRV: +#endif +#ifdef HAVE_LIBEXTRA + case CDI_FILETYPE_EXT: +#endif +#ifdef HAVE_LIBIEG + case CDI_FILETYPE_IEG: +#endif + return cdiFallbackIterator_copyVariableName(me); + + default: Error(kUnexpectedFileTypeMessage); return NULL; + } +} + +/* +@Function cdiIterator_inqGridId +@Title Get the ID of the current grid + +@Prototype int cdiIterator_inqGridId(CdiIterator* iterator) +@Parameter + @item iterator The iterator to operate on. + +@Result A gridId that can be used for further introspection. + +@Description + This provides access to the grid related metadata. + The resulting ID is only valid until the next time cdiIterator_nextField() is called. +*/ +int +cdiIterator_inqGridId(CdiIterator *me) +{ + sanityCheck(me); + return me->gridId; +} + +/* +@Function cdiIterator_readField +@Title Read the whole field into a double buffer + +@Prototype void cdiIterator_readField(CdiIterator *me, double *buffer, SizeType *nmiss) +@Parameter + @item iterator The iterator to operate on. + @item buffer A pointer to the double array that the data should be written to. + @item nmiss A pointer to a variable where the count of missing values will be stored. May be NULL. + +@Description + It is assumed that the caller first analyses the return value of cdiIterator_inqGridId to determine the required size of the +buffer. Failing to do so results in undefined behavior. You have been warned. +*/ +void +cdiIterator_readField(CdiIterator *me, double *buffer, SizeType *nmiss) +{ + size_t numMiss = 0; + sanityCheck(me); + if (!buffer) xabort("NULL was passed in a buffer. Please provide a suitable buffer."); + switch (cdiBaseFiletype(me->filetype)) + { +#ifdef HAVE_LIBGRIB_API + case CDI_FILETYPE_GRB: + case CDI_FILETYPE_GRB2: cdiGribIterator_readField(me, buffer, &numMiss); return; +#endif + +#ifdef HAVE_LIBNETCDF + case CDI_FILETYPE_NETCDF: +#endif +#ifdef HAVE_LIBSERVICE + case CDI_FILETYPE_SRV: +#endif +#ifdef HAVE_LIBEXTRA + case CDI_FILETYPE_EXT: +#endif +#ifdef HAVE_LIBIEG + case CDI_FILETYPE_IEG: +#endif + cdiFallbackIterator_readField(me, buffer, &numMiss); + return; + default: Error(kUnexpectedFileTypeMessage); + } + + *nmiss = (SizeType) numMiss; +} + +/* +@Function cdiIterator_readFieldF +@Title Read the whole field into a double buffer + +@Prototype void cdiIterator_readFieldF(CdiIterator me, float *buffer, SizeType *nmiss) +@Parameter + @item iterator The iterator to operate on. + @item buffer A pointer to the double array that the data should be written to. + @item nmiss A pointer to a variable where the count of missing values will be stored. May be NULL. + +@Description + It is assumed that the caller first analyses the return value of cdiIterator_inqGridId to determine the required size of the +buffer. Failing to do so results in undefined behavior. You have been warned. +*/ +void +cdiIterator_readFieldF(CdiIterator *me, float *buffer, SizeType *nmiss) +{ + size_t numMiss = 0; + sanityCheck(me); + if (!buffer) xabort("NULL was passed in a buffer. Please provide a suitable buffer."); + switch (cdiBaseFiletype(me->filetype)) + { +#ifdef HAVE_LIBGRIB_API + case CDI_FILETYPE_GRB: + case CDI_FILETYPE_GRB2: cdiGribIterator_readFieldF(me, buffer, &numMiss); return; +#endif + +#ifdef HAVE_LIBNETCDF + case CDI_FILETYPE_NETCDF: +#endif +#ifdef HAVE_LIBSERVICE + case CDI_FILETYPE_SRV: +#endif +#ifdef HAVE_LIBEXTRA + case CDI_FILETYPE_EXT: +#endif +#ifdef HAVE_LIBIEG + case CDI_FILETYPE_IEG: +#endif + cdiFallbackIterator_readFieldF(me, buffer, &numMiss); + return; + default: Error(kUnexpectedFileTypeMessage); + } + + *nmiss = (SizeType) numMiss; +} + +/* +@Function cdiIterator_delete +@Title Destroy an iterator + +@Prototype void cdiIterator_delete(CdiIterator* iterator) +@Parameter + @item iterator The iterator to operate on. + +@Description + Combined destructor & deallocator. +*/ +void +cdiIterator_delete(CdiIterator *me) +{ + if (!me) xabort("NULL was passed in as an iterator. Please check the return value of cdiIterator_new()."); + switch (cdiBaseFiletype(me->filetype)) + { +#ifdef HAVE_LIBGRIB_API + case CDI_FILETYPE_GRB: + case CDI_FILETYPE_GRB2: cdiGribIterator_delete((CdiGribIterator *) me); break; +#endif + +#ifdef HAVE_LIBNETCDF + case CDI_FILETYPE_NETCDF: +#endif +#ifdef HAVE_LIBSERVICE + case CDI_FILETYPE_SRV: +#endif +#ifdef HAVE_LIBEXTRA + case CDI_FILETYPE_EXT: +#endif +#ifdef HAVE_LIBIEG + case CDI_FILETYPE_IEG: +#endif + cdiFallbackIterator_delete(me); + break; + + default: Error(kUnexpectedFileTypeMessage); + } +} + +void +baseIterDestruct(CdiIterator *me) +{ + /*currently empty, but that's no reason not to call it*/ + (void) me; +} + +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ + + +#include <assert.h> +#include <limits.h> +#include <stdlib.h> + +struct CdiFallbackIterator +{ + CdiIterator super; + char *path; // needed for clone() & serialize() + int streamId, vlistId, subtypeId; + + int variableCount, curVariable; + int curLevelCount, curLevel; + int curSubtypeCount, curSubtype; + int curTimestep; +}; + +CdiIterator * +cdiFallbackIterator_getSuper(CdiFallbackIterator *me) +{ + return &me->super; +} + +CdiIterator * +cdiFallbackIterator_new(const char *path, int filetype) +{ + CdiFallbackIterator *me = (CdiFallbackIterator *) Malloc(sizeof(*me)); + baseIterConstruct(&me->super, filetype); + me->subtypeId = CDI_UNDEFID; // Will be set in cdiFallbackIterator_nextField() + me->curSubtypeCount = -1; // Will be set in cdiFallbackIterator_nextField() + me->curLevelCount = -1; // Will be set in cdiFallbackIterator_nextField() + // These values are chosen so that the natural increment at the start of cdiFallbackIterator_nextField() will correctly position + // us at the first slice. + me->curTimestep = 0; + me->curVariable = -1; + me->curSubtype = -1; + me->curLevel = -1; + me->streamId = streamOpenRead(path); + if (me->streamId != CDI_UNDEFID) + { + me->vlistId = streamInqVlist(me->streamId); + if (me->vlistId != CDI_UNDEFID && (me->variableCount = vlistNvars(me->vlistId)) > 0 + && streamInqTimestep(me->streamId, me->curTimestep) > 0 && (me->path = strdup(path))) + { + return (CdiIterator *) me; + } + Free(me->path); + streamClose(me->streamId); + } + baseIterDestruct(&me->super); + Free(me); + return NULL; +} + +void +cdiFallbackIterator_delete(CdiIterator *super) +{ + CdiFallbackIterator *me = (CdiFallbackIterator *) (void *) super; + Free(me->path); + streamClose(me->streamId); + baseIterDestruct(super); + Free(me); +} + +// Fetches the info that is derived from the current variable. Most of this is published by the data members in the base class. +static void +fetchVariableInfo(CdiFallbackIterator *me) +{ + // Fetch data that's published via base class data members. + me->super.datatype = vlistInqVarDatatype(me->vlistId, me->curVariable); + me->super.timesteptype = vlistInqVarTsteptype(me->vlistId, me->curVariable); + me->super.gridId = vlistInqVarGrid(me->vlistId, me->curVariable); + int param = vlistInqVarParam(me->vlistId, me->curVariable); + cdiDecodeParam(param, &me->super.param.number, &me->super.param.category, &me->super.param.discipline); + + // Fetch the current level and subtype counts. + me->curLevelCount = zaxisInqSize(vlistInqVarZaxis(me->vlistId, me->curVariable)); + me->subtypeId = vlistInqVarSubtype(me->vlistId, me->curVariable); + me->curSubtypeCount = (me->subtypeId == CDI_UNDEFID) ? 1 : subtypeInqSize(me->subtypeId); +} + +CdiFallbackIterator * +cdiFallbackIterator_clone(CdiIterator *super) +{ + CdiFallbackIterator *me = (CdiFallbackIterator *) (void *) super; + + // Make another stream for this file. This yields an unadvanced iterator. + CdiFallbackIterator *clone = (CdiFallbackIterator *) (void *) cdiFallbackIterator_new(me->path, me->super.filetype); + if (clone) + { + // Point the clone to the same position in the file. + clone->variableCount = me->variableCount; + clone->curVariable = me->curVariable; + clone->curLevelCount = me->curLevelCount; + clone->curLevel = me->curLevel; + clone->curSubtypeCount = me->curSubtypeCount; + clone->curSubtype = me->curSubtype; + clone->curTimestep = me->curTimestep; + + clone->super.isAdvanced = super->isAdvanced; + if (super->isAdvanced) fetchVariableInfo(clone); + } + + return clone; +} + +char * +cdiFallbackIterator_serialize(CdiIterator *super) +{ + CdiFallbackIterator *me = (CdiFallbackIterator *) (void *) super; + + char *escapedPath = cdiEscapeSpaces(me->path); + char *result = (char *) Malloc(strlen(escapedPath) + 7 * (3 * sizeof(int) * CHAR_BIT / 8 + 1) + 1); + sprintf(result, "%s %d %d %d %d %d %d %d", escapedPath, me->variableCount, me->curVariable, me->curLevelCount, me->curLevel, + me->curSubtypeCount, me->curSubtype, me->curTimestep); + Free(escapedPath); + return result; +} + +CdiFallbackIterator * +cdiFallbackIterator_deserialize(const char *description) +{ + CdiFallbackIterator *me = (CdiFallbackIterator *) Malloc(sizeof(*me)); + if (!me) goto fail; + + description = baseIter_constructFromString(&me->super, description); + + while (*description == ' ') description++; + me->path = cdiUnescapeSpaces(description, &description); + if (!me->path) goto destructSuper; + + me->streamId = streamOpenRead(me->path); + if (me->streamId == CDI_UNDEFID) goto freePath; + me->vlistId = streamInqVlist(me->streamId); + if (me->vlistId == CDI_UNDEFID) goto closeStream; + + // This reads one variable from the description string, does error checking, and advances the given string pointer. +#define decodeValue(variable, description) \ + do \ + { \ + const char *savedStart = description; \ + long long decodedValue \ + = strtoll(description, (char **) &description, 0); /*The cast is a workaround for the wrong signature of strtoll().*/ \ + variable = (int) decodedValue; \ + if (savedStart == description) goto closeStream; \ + if ((long long) decodedValue != (long long) variable) goto closeStream; \ + } \ + while (0) + decodeValue(me->variableCount, description); + decodeValue(me->curVariable, description); + decodeValue(me->curLevelCount, description); + decodeValue(me->curLevel, description); + decodeValue(me->curSubtypeCount, description); + decodeValue(me->curSubtype, description); + decodeValue(me->curTimestep, description); +#undef decodeValue + + if (streamInqTimestep(me->streamId, me->curTimestep) <= 0) goto closeStream; + if (me->super.isAdvanced) fetchVariableInfo(me); + + return me; + +closeStream: + streamClose(me->streamId); +freePath: + Free(me->path); +destructSuper: + baseIterDestruct(&me->super); + Free(me); +fail: + return NULL; +} + +static int +advance(CdiFallbackIterator *me) +{ + me->curLevel++; + if (me->curLevel >= me->curLevelCount) + { + me->curLevel = 0; + me->curSubtype++; + if (me->curSubtype >= me->curSubtypeCount) + { + me->curSubtype = 0; + me->curVariable++; + if (me->curVariable >= me->variableCount) + { + me->curVariable = 0; + me->curTimestep++; + if (streamInqTimestep(me->streamId, me->curTimestep) <= 0) return CDI_EEOF; + } + } + } + return CDI_NOERR; +} + +int +cdiFallbackIterator_nextField(CdiIterator *super) +{ + CdiFallbackIterator *me = (CdiFallbackIterator *) (void *) super; + int result = advance(me); + if (result) return result; + + if (!me->curLevel && !me->curSubtype) + fetchVariableInfo(me); // Check whether we are processing a new variable/timestep and fetch the information that may have + // changed in this case. + return CDI_NOERR; +} + +char * +cdiFallbackIterator_inqTime(CdiIterator *super, CdiTimeType timeType) +{ + CdiFallbackIterator *me = (CdiFallbackIterator *) (void *) super; + + // retrieve the time information + int taxisId = vlistInqTaxis(me->vlistId); + int date = 0, time = 0; + switch (timeType) + { + case kCdiTimeType_referenceTime: + date = taxisInqRdate(taxisId); + time = taxisInqRtime(taxisId); + break; + + case kCdiTimeType_startTime: + date = taxisInqVdate(taxisId); + time = taxisInqVtime(taxisId); + break; + + case kCdiTimeType_endTime: + return NULL; // The stream interface does not export the start/end times of statistical fields, so we treat all data as point + // of time data, returning the validity time as the start time. + + default: assert(0 && "internal error, please report this bug"); + } + + // decode the time information and reencode it into an ISO-compliant string + int year, month, day, hour, minute, second; + cdiDecodeDate(date, &year, &month, &day); + cdiDecodeTime(time, &hour, &minute, &second); + char *result = (char *) Malloc(4 + 1 + 2 + 1 + 2 + 1 + 2 + 1 + 2 + 1 + 2 + 4 + 1); + sprintf(result, "%04d-%02d-%02dT%02d:%02d:%02d.000", year, month, day, hour, minute, second); + return result; +} + +int +cdiFallbackIterator_levelType(CdiIterator *super, int levelSelector, char **outName, char **outLongName, char **outStdName, + char **outUnit) +{ + CdiFallbackIterator *me = (CdiFallbackIterator *) (void *) super; + int zaxisId = vlistInqVarZaxis(me->vlistId, me->curVariable); + (void) levelSelector; +#define copyString(outPointer, key) \ + do \ + { \ + if (outPointer) \ + { \ + char tempBuffer[CDI_MAX_NAME]; \ + int length = CDI_MAX_NAME; \ + cdiInqKeyString(zaxisId, CDI_GLOBAL, key, tempBuffer, &length); \ + *outPointer = strdup(tempBuffer); \ + } \ + } \ + while (0) + copyString(outName, CDI_KEY_NAME); + copyString(outLongName, CDI_KEY_LONGNAME); + copyString(outStdName, CDI_KEY_STDNAME); + copyString(outUnit, CDI_KEY_UNITS); +#undef copyString + int ltype = 0; + cdiInqKeyInt(zaxisId, CDI_GLOBAL, CDI_KEY_TYPEOFFIRSTFIXEDSURFACE, <ype); + return ltype; +} + +int +cdiFallbackIterator_level(CdiIterator *super, int levelSelector, double *outValue1, double *outValue2) +{ + CdiFallbackIterator *me = (CdiFallbackIterator *) (void *) super; + int zaxisId = vlistInqVarZaxis(me->vlistId, me->curVariable); + + // handle NULL pointers once and for all + double trash; + if (!outValue1) outValue1 = &trash; + if (!outValue2) outValue2 = &trash; + + // get the level value + if (levelSelector) + { + *outValue1 = (zaxisInqLbounds(zaxisId, NULL)) ? zaxisInqLbound(zaxisId, me->curLevel) : zaxisInqLevel(zaxisId, me->curLevel); + } + else + { + *outValue1 = (zaxisInqUbounds(zaxisId, NULL)) ? zaxisInqUbound(zaxisId, me->curLevel) : zaxisInqLevel(zaxisId, me->curLevel); + } + *outValue2 = 0.0; + + // if this is a hybrid zaxis, lookup the coordinates in the vertical coordinate table + ssize_t intLevel = (ssize_t) (2 * *outValue1); + if (0 <= intLevel && intLevel < zaxisInqVctSize(zaxisId) - 1) + { + const double *coordinateTable = zaxisInqVctPtr(zaxisId); + *outValue1 = coordinateTable[intLevel]; + *outValue2 = coordinateTable[intLevel + 1]; + } + return CDI_NOERR; +} + +int +cdiFallbackIterator_zaxisUuid(CdiIterator *super, int *outVgridNumber, int *outLevelCount, unsigned char outUuid[CDI_UUID_SIZE]) +{ + CdiFallbackIterator *me = (CdiFallbackIterator *) (void *) super; + int zaxisId = vlistInqVarZaxis(me->vlistId, me->curVariable); + int ltype = 0; + cdiInqKeyInt(zaxisId, CDI_GLOBAL, CDI_KEY_TYPEOFFIRSTFIXEDSURFACE, <ype); + if (ltype != ZAXIS_HYBRID) return CDI_EINVAL; + if (outVgridNumber) + { + *outVgridNumber = 0; + cdiInqKeyInt(zaxisId, CDI_GLOBAL, CDI_KEY_NUMBEROFVGRIDUSED, outVgridNumber); + } + if (outLevelCount) + { + *outLevelCount = 0; + cdiInqKeyInt(zaxisId, CDI_GLOBAL, CDI_KEY_NLEV, outLevelCount); + } + if (outUuid) + { + int length = CDI_UUID_SIZE; + memset(outUuid, 0, length); + cdiInqKeyBytes(zaxisId, CDI_GLOBAL, CDI_KEY_UUID, outUuid, &length); + } + return CDI_NOERR; +} + +int +cdiFallbackIterator_inqTile(CdiIterator *super, int *outTileIndex, int *outTileAttribute) +{ + CdiFallbackIterator *me = (CdiFallbackIterator *) (void *) super; +#ifndef __cplusplus + if (!outTileIndex) outTileIndex = &(int){ 0 }; + if (!outTileAttribute) outTileAttribute = &(int){ 0 }; +#else + int dummy = 0; + if (!outTileIndex) outTileIndex = &dummy; + if (!outTileAttribute) outTileAttribute = &dummy; +#endif + + int error = CDI_NOERR; + if (me->subtypeId == CDI_UNDEFID) // must not call subtypeInqAttribute() with an invalid subtype ID, because it would abort the + // program instead of returning an error + { + error = CDI_EINVAL; + } + else + { + if (subtypeInqAttribute(me->subtypeId, me->curSubtype, "tileIndex", outTileIndex)) error = CDI_EINVAL; + if (subtypeInqAttribute(me->subtypeId, me->curSubtype, "tileAttribute", outTileAttribute)) error = CDI_EINVAL; + } + if (error) *outTileIndex = *outTileAttribute = -1; // Guarantee defined values in case of an error. + return error; +} + +int +cdiFallbackIterator_inqTileCount(CdiIterator *super, int *outTileCount, int *outTileAttributeCount) +{ + CdiFallbackIterator *me = (CdiFallbackIterator *) (void *) super; +#ifndef __cplusplus + if (!outTileCount) outTileCount = &(int){ 0 }; + if (!outTileAttributeCount) outTileAttributeCount = &(int){ 0 }; +#else + int temp = 0; + if (!outTileCount) outTileCount = &temp; + if (!outTileAttributeCount) outTileAttributeCount = &temp; +#endif + + int error = CDI_NOERR; + if (me->subtypeId == CDI_UNDEFID) // must not call subtypeInqAttribute() with an invalid subtype ID, because it would abort the + // program instead of returning an error + { + error = CDI_EINVAL; + } + else + { + if (subtypeInqAttribute(me->subtypeId, me->curSubtype, "numberOfTiles", outTileCount)) error = CDI_EINVAL; + if (subtypeInqAttribute(me->subtypeId, me->curSubtype, "numberOfTileAttributes", outTileAttributeCount)) error = CDI_EINVAL; + } + if (error) *outTileCount = *outTileAttributeCount = -1; // Guarantee defined values in case of an error. + return CDI_NOERR; +} + +char * +cdiFallbackIterator_copyVariableName(CdiIterator *super) +{ + CdiFallbackIterator *me = (CdiFallbackIterator *) (void *) super; + return vlistCopyVarName(me->vlistId, me->curVariable); +} + +void +cdiFallbackIterator_readField(CdiIterator *super, double *buffer, size_t *nmiss) +{ + CdiFallbackIterator *me = (CdiFallbackIterator *) (void *) super; + SizeType missingValues = 0; + streamReadVarSlice(me->streamId, me->curVariable, me->curLevel, buffer, &missingValues); + if (nmiss) *nmiss = (size_t) missingValues; +} + +void +cdiFallbackIterator_readFieldF(CdiIterator *super, float *buffer, size_t *nmiss) +{ + CdiFallbackIterator *me = (CdiFallbackIterator *) (void *) super; + SizeType missingValues = 0; + streamReadVarSliceF(me->streamId, me->curVariable, me->curLevel, buffer, &missingValues); + if (nmiss) *nmiss = (size_t) missingValues; +} + +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifndef STREAM_GRB_H +#define STREAM_GRB_H + +double zaxis_units_to_centimeter(int zaxisID); +double zaxis_units_to_meter(int zaxisID); +bool zaxis_units_is_Pa(int zaxisID); + +void ensureBufferSize(size_t requiredSize, size_t *curSize, void **buffer); +int grbDecompress(size_t recsize, size_t *buffersize, void **gribbuffer); + +static inline bool +gribbyte_get_bit(int number, int bit) +{ + return (bool) ((number >> (8 - bit)) & 1); +} +static inline void +gribbyte_set_bit(int *number, int bit) +{ + *number |= 1 << (8 - bit); +} +static inline void +gribbyte_clear_bit(int *number, int bit) +{ + *number &= ~(1 << (8 - bit)); +} + +int grbBitsPerValue(int datatype); + +int fdbInqContents(stream_t *streamptr); +int grbInqContents(stream_t *streamptr); +int fdbInqTimestep(stream_t *streamptr, int tsID); +int grbInqTimestep(stream_t *streamptr, int tsID); + +int grbInqRecord(stream_t *streamptr, int *varID, int *levelID); +void grbDefRecord(stream_t *streamptr); +void grb_read_record(stream_t *streamptr, int memtype, void *data, size_t *nmiss); +void grb_write_record(stream_t *streamptr, int memtype, const void *data, size_t nmiss); +void grbCopyRecord(stream_t *streamptr2, stream_t *streamptr1); + +void grb_read_var(stream_t *streamptr, int varID, int memtype, void *data, size_t *nmiss); +void grb_write_var(stream_t *streamptr, int varID, int memtype, const void *data, size_t nmiss); + +void grb_read_var_slice(stream_t *streamptr, int varID, int levelID, int memtype, void *data, size_t *nmiss); +void grb_write_var_slice(stream_t *streamptr, int varID, int levelID, int memtype, const void *data, size_t nmiss); + +int grib1ltypeToZaxisType(int grib_ltype); +int grib2ltypeToZaxisType(int grib_ltype); + +int zaxisTypeToGrib1ltype(int zaxistype); +int zaxisTypeToGrib2ltype(int zaxistype); + +int grbGetGridtype(int *gridID, size_t gridsize, bool *gridIsRotated, bool *gridIsCurvilinear); + +struct cdiGribParamChange +{ + int code, ltype, lev; + bool active; +}; + +struct cdiGribScanModeChange +{ + int value; + bool active; +}; + +extern struct cdiGribParamChange cdiGribChangeParameterID; +extern struct cdiGribScanModeChange cdiGribDataScanningMode; + +// Used in CDO +void streamGrbChangeParameterIdentification(int code, int ltype, int lev); +void streamGrbDefDataScanningMode(int scanmode); + +#endif /* STREAM_GRB_H */ +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifndef ZAXIS_H +#define ZAXIS_H + +#ifdef HAVE_CONFIG_H +#endif + + +// clang-format off +typedef struct +{ + double *vals; +#ifndef USE_MPI + char **cvals; + int clength; +#endif + double *lbounds; + double *ubounds; + double *weights; + int self; + int scalar; + int type; + int size; + int direction; + int vctsize; + unsigned positive; + double *vct; + cdi_keys_t keys; + cdi_atts_t atts; +} +zaxis_t; +// clang-format on + +void zaxisGetTypeDescription(int zaxisType, int *outPositive, const char **outName, const char **outLongName, + const char **outStdName, + const char **outUnit); // The returned const char* point to static storage. Don't free or modify them. + +unsigned cdiZaxisCount(void); + +zaxis_t *zaxis_to_pointer(int zaxisID); + +void cdiZaxisGetIndexList(unsigned numIDs, int *IDs); + +int zaxisUnpack(char *unpackBuffer, int unpackBufferSize, int *unpackBufferPos, int originNamespace, void *context, int force_id); + +const resOps *getZaxisOps(void); + +const char *zaxisInqNamePtr(int zaxisID); + +const double *zaxisInqLevelsPtr(int zaxisID); +#ifndef USE_MPI +char **zaxisInqCValsPtr(int zaxisID); +#endif +void zaxisResize(int zaxisID, int size); + +#endif + +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifdef HAVE_CONFIG_H +#endif + + + +#include <assert.h> +#include <limits.h> +#include <stdlib.h> +#include <string.h> + +#ifdef HAVE_LIBGRIB_API + +struct CdiGribIterator +{ + CdiIterator super; + + CdiInputFile *file; + off_t fileOffset; + unsigned char *gribBuffer; + size_t bufferSize, curRecordSize; + grib_handle *gribHandle; +}; + +CdiIterator * +cdiGribIterator_getSuper(CdiGribIterator *me) +{ + return &me->super; +} + +// Since the error handling in constructors is usually very closely related to the workings of a destructor, +// this function combines both functions in one, using a centralized exit. +// The mode of operation depends on whether me is a NULL pointer on entry: +// If it is NULL, a new object is allocated and constructed, which is returned if construction is successful. +// If a non-NULL pointer is passed in, the object is destructed and NULL is returned. In this case, the other arguments are ignored. +static CdiGribIterator * +cdiGribIterator_condestruct(CdiGribIterator *me, const char *path, int filetype) +{ +#define super() (&me->super) + if (me) goto destruct; + me = (CdiGribIterator *) Malloc(sizeof(*me)); + baseIterConstruct(super(), filetype); + + me->file = cdiInputFile_make(path); + if (!me->file) goto destructSuper; + me->fileOffset = 0; + me->gribHandle = NULL; + me->gribBuffer = NULL; + me->bufferSize = me->curRecordSize = 0; + me->super.gridId = CDI_UNDEFID; + + goto success; + + // ^ constructor code ^ + // | | + // v destructor/error-cleanup code v + +destruct: + if (me->super.gridId != CDI_UNDEFID) gridDestroy(me->super.gridId); + if (me->gribHandle) grib_handle_delete((struct grib_handle *) me->gribHandle); + Free(me->gribBuffer); + cdiRefObject_release(&me->file->super); +destructSuper: + baseIterDestruct(super()); + Free(me); + me = NULL; + +success: + return me; +#undef super +} + +CdiIterator * +cdiGribIterator_new(const char *path, int filetype) +{ + return &cdiGribIterator_condestruct(NULL, path, filetype)->super; +} + +CdiGribIterator * +cdiGribIterator_makeClone(CdiIterator *super) +{ + CdiGribIterator *me = (CdiGribIterator *) (void *) super; + + // Allocate memory and copy data. (operations that may fail) + CdiGribIterator *result = (struct CdiGribIterator *) Malloc(sizeof(*result)); + if (!result) goto fail; + + result->file = me->file; + result->fileOffset = me->fileOffset; + result->gribBuffer = NULL; + result->bufferSize = me->bufferSize; + result->curRecordSize = me->curRecordSize; + result->gribHandle = NULL; + + if (me->gribBuffer) + { + result->gribBuffer = (unsigned char *) Malloc(me->bufferSize); + if (!result->gribBuffer) goto freeResult; + memcpy(result->gribBuffer, me->gribBuffer, me->curRecordSize); + } + if (me->gribHandle) + { + result->gribHandle = grib_handle_new_from_message(NULL, result->gribBuffer, result->curRecordSize); + if (!result->gribHandle) goto freeBuffer; + } + if (super->gridId != CDI_UNDEFID) + { + result->super.gridId = gridDuplicate(super->gridId); + if (result->super.gridId == CDI_UNDEFID) goto deleteGribHandle; + } + + // Finish construction. (operations that cannot fail) + baseIterConstruct(&result->super, super->filetype); + result->super.datatype = super->datatype; + result->super.timesteptype = super->timesteptype; + result->super.param = super->param; + cdiRefObject_retain(&result->file->super); + + return result; + + // Error handling. +deleteGribHandle: + if (result->gribHandle) grib_handle_delete(result->gribHandle); +freeBuffer: + Free(result->gribBuffer); +freeResult: + Free(result); +fail: + return NULL; +} + +char * +cdiGribIterator_serialize(CdiIterator *super) +{ + CdiGribIterator *me = (CdiGribIterator *) (void *) super; + + const char *path = cdiInputFile_getPath(me->file); + char *escapedPath = cdiEscapeSpaces(path); + char *result = (char *) Malloc(strlen(escapedPath) + 3 * sizeof(int) * CHAR_BIT / 8); + sprintf(result, "%s %zu", escapedPath, (size_t) me->fileOffset); + Free(escapedPath); + return result; +} + +CdiGribIterator * +cdiGribIterator_deserialize(const char *description) +{ + char *path; + CdiGribIterator *me = (CdiGribIterator *) Malloc(sizeof(*me)); + if (!me) goto fail; + + description = baseIter_constructFromString(&me->super, description); + + while (*description == ' ') description++; + path = cdiUnescapeSpaces(description, &description); + if (!path) goto destructSuper; + + me->file = cdiInputFile_make(path); + Free(path); + if (!me->file) goto destructSuper; + + { + const char *savedStart = description; + char *description_ = (char *) description; + long long decodedOffset = strtoll(description, &description_, 0); + description = description_; + me->fileOffset = (off_t) decodedOffset; + if (savedStart == description) goto closeFile; + if ((unsigned long long) decodedOffset > (unsigned long long) me->fileOffset) goto closeFile; + } + + me->gribBuffer = NULL; + me->bufferSize = me->curRecordSize = 0; + me->gribHandle = NULL; + me->super.gridId = CDI_UNDEFID; + if (me->super.isAdvanced && cdiGribIterator_nextField(&me->super)) goto closeFile; + + return me; + +closeFile: + cdiRefObject_release(&me->file->super); +destructSuper: + baseIterDestruct(&me->super); + Free(me); +fail: + return NULL; +} + +static void +cdiGribIterator_ensureBuffer(CdiGribIterator *me, size_t requiredSize) +{ + if (me->bufferSize < requiredSize) + { + me->bufferSize *= 2; + if (me->bufferSize < requiredSize) me->bufferSize = requiredSize; + me->gribBuffer = (unsigned char *) Realloc(me->gribBuffer, me->bufferSize); + } +} + +static bool +isGrib1DualLevel(int levelType) +{ + switch (levelType) + { + case 101: + case 104: + case 106: + case 108: + case 110: + case 112: + case 114: + case 116: + case 120: + case 121: + case 128: + case 141: // This is the complete list after grib_api-1.12.3/definitions/grib1/sections.1.def:106-117:, the code in + // cdi/src/stream_gribapi.c:grib1GetLevel() seems to be incomplete. + return true; + default: return false; + } +} + +static const unsigned char * +positionOfGribMarker(const unsigned char *data, size_t size) +{ + for (const unsigned char *currentPosition = data, *end = data + size; currentPosition < end; currentPosition++) + { + currentPosition = (unsigned char *) memchr( + currentPosition, 'G', + size - (size_t) (currentPosition - data) - 3); //-3 to ensure that we don't overrun the buffer during the strncmp() call. + if (!currentPosition) return NULL; + if (!strncmp((const char *) currentPosition, "GRIB", 4)) return currentPosition; + } + return NULL; +} + +// This clobbers the contents of the gribBuffer! +// Returns the file offset of the next 'GRIB' marker. +static ssize_t +scanToGribMarker(CdiGribIterator *me) +{ + cdiGribIterator_ensureBuffer(me, 8 * 1024); + const size_t kMaxScanSize = 16 * 1024 * 1024; + for (size_t scannedBytes = 0, scanSize; scannedBytes < kMaxScanSize; scannedBytes += scanSize) + { + // Load a chunk of data into our buffer. + scanSize = me->bufferSize; + if (scannedBytes + scanSize > kMaxScanSize) scanSize = kMaxScanSize - scannedBytes; + assert(scanSize <= me->bufferSize); + int status = cdiInputFile_read(me->file, me->fileOffset + (off_t) scannedBytes, scanSize, &scanSize, me->gribBuffer); + if (status != CDI_NOERR && status != CDI_EEOF) return -1; + + const unsigned char *startPosition = positionOfGribMarker(me->gribBuffer, scanSize); + if (startPosition) + { + return (ssize_t) (me->fileOffset + (off_t) scannedBytes + (off_t) (startPosition - me->gribBuffer)); + } + + // Get the offset for the next iteration if there is a next iteration. + scanSize -= 3; // so that we won't miss a 'GRIB' sequence that happens to be cut off + scanSize &= ~(size_t) 0xf; // make 16 bytes aligned + if ((ssize_t) scanSize <= 0) return -1; // ensure that we make progress + } + return -1; +} + +static unsigned +decode24(void *beData) +{ + unsigned char *bytes = (unsigned char *) beData; + return ((unsigned) bytes[0] << 16) + ((unsigned) bytes[1] << 8) + (unsigned) bytes[2]; +} + +static uint64_t +decode64(void *beData) +{ + unsigned char *bytes = (unsigned char *) beData; + uint64_t result = 0; + for (size_t i = 0; i < 8; i++) result = (result << 8) + bytes[i]; + return result; +} + +// Determine the size of the GRIB record that begins at the given file offset. +static int +getRecordSize(CdiGribIterator *me, off_t gribFileOffset, size_t *outRecordSize) +{ + char buffer[16]; + size_t readSize; + int status = cdiInputFile_read(me->file, gribFileOffset, sizeof(buffer), &readSize, buffer); + if (status != CDI_NOERR && status != CDI_EEOF) return status; + if (readSize < sizeof(buffer)) return CDI_EEOF; + *outRecordSize = 0; + switch (buffer[7]) + { + case 1: + *outRecordSize = decode24(&buffer[4]); + if (*outRecordSize & (1 << 23)) + { + *outRecordSize = 120 * (*outRecordSize & ((1 << 23) - 1)); // Rescaling for long records. + // The corresponding code in cgribexlib.c:4532-4570: is much more complicated + // due to the fact that it subtracts the padding bytes that are inserted after section 4. + // However, we are only interested in the total size of data we need to read here, + // so we can ignore the presence of some padding bytes. + } + return CDI_NOERR; + + case 2: *outRecordSize = decode64(&buffer[8]); return CDI_NOERR; + + default: return CDI_EUFTYPE; + } +} + +#if 0 +static void hexdump(void *data, size_t size) +{ + unsigned char *charData = data; + for(size_t offset = 0; offset < size; ) + { + printf("%016zx:", offset); + for(size_t i = 0; i < 64 && offset < size; i++, offset++) + { + if((i & 63) && !(i & 15)) printf(" |"); + if((i & 15) && !(i & 3)) printf(" "); + printf(" %02x", charData[offset]); + } + printf("\n"); + } +} +#endif + +// Read a record into memory and wrap it in a grib_handle. +// XXX: I have omitted checking for szip compression as it is done in grbReadVarDP() & friends since that appears to be a +// non-standard extension of the GRIB1 standard: bit 1 in octet 14 of the binary data section which is used to signal szip +// compression is defined to be reserved in the standard. As such, it seems prudent not to support this and to encourage people with +// such szip compressed files to switch to the GRIB2/JPEG2000 format. However, in the case that this reasoning is wrong, this +// function is probably the place to add the check for zsip compression. +static int +readMessage(CdiGribIterator *me) +{ + // Destroy the old grib_handle. + if (me->gribHandle) grib_handle_delete(me->gribHandle), me->gribHandle = NULL; + me->fileOffset += (off_t) me->curRecordSize; + + // Find the next record and determine its size. + ssize_t gribFileOffset = scanToGribMarker(me); + int result = CDI_EEOF; + if (gribFileOffset < 0) goto fail; + result = getRecordSize(me, gribFileOffset, &me->curRecordSize); + if (result) goto fail; + + // Load the whole record into our buffer and create a grib_handle for it. + cdiGribIterator_ensureBuffer(me, me->curRecordSize); + result = cdiInputFile_read(me->file, gribFileOffset, me->curRecordSize, NULL, me->gribBuffer); + if (result) goto fail; + me->gribHandle = grib_handle_new_from_message(NULL, me->gribBuffer, me->curRecordSize); + result = CDI_EUFSTRUCT; + if (!me->gribHandle) goto fail; + + return CDI_NOERR; + +fail: + me->curRecordSize = 0; // This ensures that we won't jump to an uncontrolled file position if cdiGribIterator_nextField() is + // called another time after it has returned an error. + return result; +} + +int +cdiGribIterator_nextField(CdiIterator *super) +{ + CdiGribIterator *me = (CdiGribIterator *) (void *) super; + + if (super->gridId != CDI_UNDEFID) gridDestroy(super->gridId), super->gridId = CDI_UNDEFID; + + // Get the next GRIB message into our buffer. + int result = readMessage(me); + if (result) return result; + + // Get the metadata that's published as variables in the base class. + super->datatype = gribGetDatatype(me->gribHandle); + super->timesteptype = gribapiGetTsteptype(me->gribHandle); + cdiDecodeParam(gribapiGetParam(me->gribHandle), &super->param.number, &super->param.category, &super->param.discipline); + grid_t grid; + gribapiGetGrid(me->gribHandle, &grid); + super->gridId = gridGenerate(&grid); + + return CDI_NOERR; +} + +char * +cdiGribIterator_inqTime(CdiIterator *super, CdiTimeType timeType) +{ + CdiGribIterator *me = (CdiGribIterator *) (void *) super; + return gribMakeTimeString(me->gribHandle, timeType); +} + +int +cdiGribIterator_levelType(CdiIterator *super, int levelSelector, char **outName, char **outLongName, char **outStdName, + char **outUnit) +{ + CdiGribIterator *me = (CdiGribIterator *) (void *) super; + + // First determine the zaxis type corresponding to the given level. + int zaxisType = ZAXIS_GENERIC; + if (gribEditionNumber(me->gribHandle) <= 1) + { + int levelType = (int) gribGetLongDefault(me->gribHandle, "indicatorOfTypeOfLevel", 255); + if (levelSelector && !isGrib1DualLevel(levelType)) levelType = 255; + zaxisType = grib1ltypeToZaxisType(levelType); + } + else + { + int levelType + = (int) gribGetLongDefault(me->gribHandle, levelSelector ? "typeOfSecondFixedSurface" : "typeOfFirstFixedSurface", 255); + zaxisType = grib2ltypeToZaxisType(levelType); + } + + // Then lookup the requested names. + const char *name, *longName, *stdName, *unit; + zaxisGetTypeDescription(zaxisType, NULL, &name, &longName, &stdName, &unit); + if (outName) *outName = strdup(name); + if (outLongName) *outLongName = strdup(longName); + if (outStdName) *outStdName = strdup(stdName); + if (outUnit) *outUnit = strdup(unit); + + return zaxisType; +} + +static double +logicalLevelValue2(long gribType, long storedValue, long power) +{ + double factor = 1; + assert(power >= 0); + while (power--) factor *= 10; // this is precise up to factor == 22. + switch (gribType) + { + case GRIB2_LTYPE_LANDDEPTH: + case GRIB2_LTYPE_ISOBARIC: + case GRIB2_LTYPE_SIGMA: + return (double) storedValue + * (1000.0 / factor); // The evaluation order allows the factors of ten to cancel out before rounding. + + case 255: return 0; + + default: return (double) storedValue / factor; + } +} + +// The output values must be preinitialized, this function does not always write them. +static int +readLevel2(grib_handle *gribHandle, const char *levelTypeKey, const char *powerKey, const char *valueKey, double *outValue1, + double *outValue2) +{ + assert(levelTypeKey && powerKey && valueKey && outValue1 && outValue2); + + long levelType = gribGetLongDefault(gribHandle, levelTypeKey, 255); // 1 byte + switch (levelType) + { + case 255: break; + + case 105: + case 113: + { + unsigned long value = (unsigned long) gribGetLongDefault(gribHandle, valueKey, 0); + unsigned long coordinateCount = (unsigned long) gribGetLongDefault(gribHandle, "numberOfCoordinatesValues", 0); + if (value >= coordinateCount / 2) + { + Error("Invalid level coordinate: Level has the hybrid coordinate index %lu, but only %lu coordinate pairs are present.", + value, coordinateCount / 2); + return CDI_EUFSTRUCT; + } + int status; + // XXX: I'm not 100% sure about how the coordinate pairs are stored in the file. + // I'm assuming an array of pairs due to the example code in grib_api-1.12.3/examples/F90/set_pv.f90, but that may be + // wrong. + if ((status = grib_get_double_element(gribHandle, "pv", (int) value * 2, outValue1))) return status; + if ((status = grib_get_double_element(gribHandle, "pv", (int) value * 2 + 1, outValue2))) return status; + break; + } + + default: + { + long power = 255 & gribGetLongDefault(gribHandle, powerKey, 0); // 1 byte + if (power == 255) power = 0; + long value = gribGetLongDefault(gribHandle, valueKey, 0); // 4 bytes + *outValue1 = logicalLevelValue2(levelType, value, power); + } + } + return CDI_NOERR; +} + +int +cdiGribIterator_level(CdiIterator *super, int levelSelector, double *outValue1, double *outValue2) +{ + CdiGribIterator *me = (CdiGribIterator *) (void *) super; + double trash; + if (!outValue1) outValue1 = &trash; + if (!outValue2) outValue2 = &trash; + *outValue1 = *outValue2 = 0; + + if (gribEditionNumber(me->gribHandle) > 1) + { + if (levelSelector) + { + return readLevel2(me->gribHandle, "typeOfFirstFixedSurface", "scaleFactorOfFirstFixedSurface", + "scaledValueOfFirstFixedSurface", outValue1, outValue2); + } + else + { + return readLevel2(me->gribHandle, "typeOfSecondFixedSurface", "scaleFactorOfSecondFixedSurface", + "scaledValueOfSecondFixedSurface", outValue1, outValue2); + } + } + else + { + long levelType = (uint8_t) gribGetLongDefault(me->gribHandle, "indicatorOfTypeOfLevel", -1); // 1 byte + if (levelType == 255) + { + } + else if (isGrib1DualLevel((int) levelType)) + { + *outValue1 = (double) (gribGetLongDefault(me->gribHandle, (levelSelector ? "bottomLevel" : "topLevel"), 0)); + } + else if (levelType == 100) + { + *outValue1 = 100 * (double) (gribGetLongDefault(me->gribHandle, "level", 0)); // 2 bytes + } + else + { + *outValue1 = (double) (gribGetLongDefault(me->gribHandle, "level", 0)); // 2 bytes + } + } + return CDI_NOERR; +} + +int +cdiGribIterator_zaxisUuid(CdiIterator *super, int *outVgridNumber, int *outLevelCount, unsigned char outUuid[CDI_UUID_SIZE]) +{ + CdiGribIterator *me = (CdiGribIterator *) (void *) super; + + if (outVgridNumber) + { + long temp; + if (grib_get_long(me->gribHandle, "numberOfVGridUsed", &temp)) return CDI_EINVAL; + *outVgridNumber = (int) temp; + } + if (outLevelCount) + { + long temp; + if (grib_get_long(me->gribHandle, "nlev", &temp)) return CDI_EINVAL; + *outLevelCount = (int) temp; + } + if (outUuid) + { + size_t size = CDI_UUID_SIZE; + if (grib_get_bytes(me->gribHandle, "uuidOfVGrid", outUuid, &size)) return CDI_EINVAL; + if (size != CDI_UUID_SIZE) return CDI_EUFSTRUCT; + } + + return CDI_NOERR; +} + +int +cdiGribIterator_inqTile(CdiIterator *super, int *outTileIndex, int *outTileAttribute) +{ + CdiGribIterator *me = (CdiGribIterator *) (void *) super; + int trash; + if (!outTileIndex) outTileIndex = &trash; + if (!outTileAttribute) outTileAttribute = &trash; + + // Get the values if possible. + int error = CDI_NOERR; + long value; + if (grib_get_long(me->gribHandle, "tileIndex", &value)) error = CDI_EINVAL; + *outTileIndex = (int) value; + if (grib_get_long(me->gribHandle, "tileAttribute", &value)) error = CDI_EINVAL; + *outTileAttribute = (int) value; + + // Ensure defined return values in case of failure. + if (error) *outTileIndex = *outTileAttribute = -1; + return error; +} + +int +cdiGribIterator_inqTileCount(CdiIterator *super, int *outTileCount, int *outTileAttributeCount) +{ + CdiGribIterator *me = (CdiGribIterator *) (void *) super; + int trash; + if (!outTileCount) outTileCount = &trash; + if (!outTileAttributeCount) outTileAttributeCount = &trash; + + // Get the values if possible. + int error = CDI_NOERR; + long value; + if (grib_get_long(me->gribHandle, "numberOfTiles", &value)) error = CDI_EINVAL; + *outTileCount = (int) value; + if (grib_get_long(me->gribHandle, "numberOfTileAttributes", &value)) error = CDI_EINVAL; + *outTileAttributeCount = (int) value; + + // Ensure defined return values in case of failure. + if (error) *outTileCount = *outTileAttributeCount = 0; + return error; +} + +char * +cdiGribIterator_copyVariableName(CdiIterator *super) +{ + CdiGribIterator *me = (CdiGribIterator *) (void *) super; + return gribCopyString(me->gribHandle, "shortName"); +} + +void +cdiGribIterator_readField(CdiIterator *super, double *buffer, size_t *nmiss) +{ + CdiGribIterator *me = (CdiGribIterator *) (void *) super; + + GRIB_CHECK(my_grib_set_double(me->gribHandle, "missingValue", CDI_Default_Missval), 0); + gribGetDoubleArray(me->gribHandle, "values", buffer); + long gridType = gribGetLong(me->gribHandle, "gridDefinitionTemplateNumber"); + if (nmiss) + { + // The condition excludes harmonic data. + *nmiss = (gridType >= 50 && gridType <= 53) ? (size_t) 0 : (size_t) gribGetLong(me->gribHandle, "numberOfMissing"); + } +} + +void +cdiGribIterator_readFieldF(CdiIterator *super, float *buffer, size_t *nmiss) +{ + CdiGribIterator *me = (CdiGribIterator *) (void *) super; + + size_t valueCount = gribGetArraySize(me->gribHandle, "values"); + double *temp = (double *) Malloc(valueCount * sizeof(*temp)); + cdiGribIterator_readField(super, temp, nmiss); + for (size_t i = valueCount; i--;) buffer[i] = (float) temp[i]; + Free(temp); +} +#endif + +/* +@Function cdiGribIterator_delete +@Title Dispose off a CdiGribIterator instance. + +@Prototype void cdiGribIterator_delete(CdiGribIterator *me) +@Parameter + @item me The iterator to delete. + +@Description + Combined destructor and deallocator. Make sure to match every call to cdiGribIterator_clone() with a call to this function. +*/ +void +cdiGribIterator_delete(CdiGribIterator *me) +{ +#ifdef HAVE_LIBGRIB_API + if (me) cdiGribIterator_condestruct(me, NULL, 0); +#else + if (me) + xabort( + "CDI was compiled without GribAPI support, so you can't possibly have a valid CdiGribIterator* to call this function with"); +#endif +} + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// callthroughs to provide direct access to the grib keys ////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/* +@Function cdiGribIterator_inqEdition +@Title Get the version of the GRIB standard that is used + +@Prototype int cdiGribIterator_inqEdition(CdiGribIterator *me) +@Parameter + @item me The iterator to operate on. + +@Result The GRIB version. + +@Description + Returns the version of the file format. +*/ +int +cdiGribIterator_inqEdition(CdiGribIterator *me) +{ +#ifdef HAVE_LIBGRIB_API + return (int) gribEditionNumber(me->gribHandle); +#else + (void) me; + xabort( + "CDI was compiled without GribAPI support, so you can't possibly have a valid CdiGribIterator* to call this function with"); + return -4; +#endif +} + +/* +@Function cdiGribIterator_getLong +@Title Access to grib_get_long() + +@Prototype int cdiGribIterator_getLong(CdiGribIterator *me, const char *key, long *result) +@Parameter + @item me The iterator to operate on. + @item ... The arguments to the underlying GRIB-API function. + +@Result An error code. + +@Description + Callthrough to grib_get_long(). +*/ +int +cdiGribIterator_getLong(CdiGribIterator *me, const char *key, long *result) +{ +#ifdef HAVE_LIBGRIB_API + return grib_get_long(me->gribHandle, key, result); +#else + (void) me; + (void) key; + (void) result; + xabort( + "CDI was compiled without GribAPI support, so you can't possibly have a valid CdiGribIterator* to call this function with"); + return -4; +#endif +} + +/* +@Function cdiGribIterator_getLength +@Title Access to grib_get_length() + +@Prototype int cdiGribIterator_getLength(CdiGribIterator *me, const char *key, size_t *result) +@Parameter + @item me The iterator to operate on. + @item ... The arguments to the underlying GRIB-API function. + +@Result An error code. + +@Description + Callthrough to grib_get_length(). +*/ +int +cdiGribIterator_getLength(CdiGribIterator *me, const char *key, size_t *result) +{ +#ifdef HAVE_LIBGRIB_API +#ifdef HAVE_GRIB_GET_LENGTH + return grib_get_length(me->gribHandle, key, result); +#else + (void) me; + (void) key; + (void) result; + Error("grib_get_length() is not available, so cdiGribIterator_getLength() can't be used"); + return -1; +#endif +#else + (void) me; + (void) key; + (void) result; + xabort( + "CDI was compiled without GribAPI support, so you can't possibly have a valid CdiGribIterator* to call this function with"); + return -4; +#endif +} + +/* +@Function cdiGribIterator_getString +@Title Access to grib_get_string() + +@Prototype int cdiGribIterator_getString(CdiGribIterator *me, const char *key, char *result, size_t *length) +@Parameter + @item me The iterator to operate on. + @item ... The arguments to the underlying GRIB-API function. + +@Result An error code. + +@Description + Callthrough to grib_get_string(). +*/ +int +cdiGribIterator_getString(CdiGribIterator *me, const char *key, char *result, size_t *length) +{ +#ifdef HAVE_LIBGRIB_API + return grib_get_string(me->gribHandle, key, result, length); +#else + (void) me; + (void) key; + (void) result; + (void) length; + xabort( + "CDI was compiled without GribAPI support, so you can't possibly have a valid CdiGribIterator* to call this function with"); + return -4; +#endif +} + +/* +@Function cdiGribIterator_inqLongValue +@Title Get the value of a GRIB-API key as a long + +@Prototype long cdiGribIterator_inqLongValue(CdiGribIterator *me, const char *key) +@Parameter + @item me The iterator to operate on. + @item key The GRIB-API key to retrieve. + +@Result The value of the key. + +@Description + Use this to fetch a grib value if you are certain that the given key must be present. + This will abort the process if the key cannot be retrieved. +*/ +long +cdiGribIterator_inqLongValue(CdiGribIterator *me, const char *key) +{ +#ifdef HAVE_LIBGRIB_API + return gribGetLong(me->gribHandle, key); +#else + (void) me; + (void) key; + xabort( + "CDI was compiled without GribAPI support, so you can't possibly have a valid CdiGribIterator* to call this function with"); + return -4; +#endif +} + +/* +@Function cdiGribIterator_inqLongDefaultValue +@Title Get the value of a GRIB-API key as a long + +@Prototype long cdiGribIterator_inqLongDefaultValue(CdiGribIterator *me, const char *key, long defaultValue) +@Parameter + @item me The iterator to operate on. + @item key The GRIB-API key to retrieve. + @item defaultValue The value to return if the key is not present. + +@Result The value of the key or the given default value. + +@Description + Use this if you can handle failure to fetch the key by supplying a default value. + This function cannot fail. +*/ +long +cdiGribIterator_inqLongDefaultValue(CdiGribIterator *me, const char *key, long defaultValue) +{ +#ifdef HAVE_LIBGRIB_API + return gribGetLongDefault(me->gribHandle, key, defaultValue); +#else + (void) me; + (void) key; + (void) defaultValue; + xabort( + "CDI was compiled without GribAPI support, so you can't possibly have a valid CdiGribIterator* to call this function with"); + return -4; +#endif +} + +/* +@Function cdiGribIterator_inqStringValue +@Title Safely retrieve a GRIB-API key with a string value + +@Prototype char *cdiGribIterator_inqStringValue(CdiGribIterator *me, const char *key) +@Parameter + @item me The iterator to operate on. + @item key The GRIB-API key to retrieve. + +@Result A malloc'ed string or NULL. + +@Description + This will first call grib_get_length() to inquire the actual size of the string, + allocate memory accordingly, call grib_get_string(), and return the pointer to the new string. + Returns NULL on failure. +*/ +char * +cdiGribIterator_inqStringValue(CdiGribIterator *me, const char *key) +{ +#ifdef HAVE_LIBGRIB_API + return gribCopyString(me->gribHandle, key); +#else + (void) me; + (void) key; + xabort( + "CDI was compiled without GribAPI support, so you can't possibly have a valid CdiGribIterator* to call this function with"); + return NULL; +#endif +} + +/* +@Function cdiGribIterator_getDouble +@Title Access to grib_get_double() + +@Prototype int cdiGribIterator_getDouble(CdiGribIterator *me, const char *key, double *result) +@Parameter + @item me The iterator to operate on. + @item ... The arguments to the underlying GRIB-API function. + +@Result An error code. + +@Description + Callthrough to grib_get_double(). +*/ +int +cdiGribIterator_getDouble(CdiGribIterator *me, const char *key, double *result) +{ +#ifdef HAVE_LIBGRIB_API + return grib_get_double(me->gribHandle, key, result); +#else + (void) me; + (void) key; + (void) result; + xabort( + "CDI was compiled without GribAPI support, so you can't possibly have a valid CdiGribIterator* to call this function with"); + return -4; +#endif +} + +/* +@Function cdiGribIterator_getSize +@Title Access to grib_get_size() + +@Prototype int cdiGribIterator_getSize(CdiGribIterator *me, const char *key, size_t *result) +@Parameter + @item me The iterator to operate on. + @item ... The arguments to the underlying GRIB-API function. + +@Result An error code. + +@Description + Callthrough to grib_get_size(). +*/ +int +cdiGribIterator_getSize(CdiGribIterator *me, const char *key, size_t *result) +{ +#ifdef HAVE_LIBGRIB_API + return grib_get_size(me->gribHandle, key, result); +#else + (void) me; + (void) key; + (void) result; + xabort( + "CDI was compiled without GribAPI support, so you can't possibly have a valid CdiGribIterator* to call this function with"); + return -4; +#endif +} + +/* +@Function cdiGribIterator_getLongArray +@Title Access to grib_get_long_array() + +@Prototype int cdiGribIterator_getLongArray(CdiGribIterator *me, const char *key, long *result, size_t *size) +@Parameter + @item me The iterator to operate on. + @item ... The arguments to the underlying GRIB-API function. + +@Result An error code. + +@Description + Callthrough to grib_get_long_array(). +*/ +int +cdiGribIterator_getLongArray(CdiGribIterator *me, const char *key, long *result, size_t *size) +{ +#ifdef HAVE_LIBGRIB_API + return grib_get_long_array(me->gribHandle, key, result, size); +#else + (void) me; + (void) key; + (void) result; + (void) size; + xabort( + "CDI was compiled without GribAPI support, so you can't possibly have a valid CdiGribIterator* to call this function with"); + return -4; +#endif +} + +/* +@Function cdiGribIterator_getDoubleArray +@Title Access to grib_get_double_array() + +@Prototype int cdiGribIterator_getDoubleArray(CdiGribIterator *me, const char *key, double *result, size_t *size) +@Parameter + @item me The iterator to operate on. + @item ... The arguments to the underlying GRIB-API function. + +@Result An error code. + +@Description + Callthrough to grib_get_double_array(). +*/ +int +cdiGribIterator_getDoubleArray(CdiGribIterator *me, const char *key, double *result, size_t *size) +{ +#ifdef HAVE_LIBGRIB_API + return grib_get_double_array(me->gribHandle, key, result, size); +#else + (void) me; + (void) key; + (void) result; + (void) size; + xabort( + "CDI was compiled without GribAPI support, so you can't possibly have a valid CdiGribIterator* to call this function with"); + return -4; +#endif +} + +/* +@Function cdiGribIterator_inqDoubleValue +@Title Get the value of a GRIB-API key as a double + +@Prototype double cdiGribIterator_inqDoubleValue(CdiGribIterator *me, const char *key) +@Parameter + @item me The iterator to operate on. + @item key The GRIB-API key to retrieve. + +@Result The value of the key. + +@Description + Use this to fetch a grib value if you are certain that the given key must be present. + This will abort the process if the key cannot be retrieved. +*/ +double +cdiGribIterator_inqDoubleValue(CdiGribIterator *me, const char *key) +{ +#ifdef HAVE_LIBGRIB_API + return gribGetDouble(me->gribHandle, key); +#else + (void) me; + (void) key; + xabort( + "CDI was compiled without GribAPI support, so you can't possibly have a valid CdiGribIterator* to call this function with"); + return -4; +#endif +} + +/* +@Function cdiGribIterator_inqDoubleDefaultValue +@Title Get the value of a GRIB-API key as a double + +@Prototype double cdiGribIterator_inqDoubleDefaultValue(CdiGribIterator *me, const char *key, double defaultValue) +@Parameter + @item me The iterator to operate on. + @item key The GRIB-API key to retrieve. + @item defaultValue The value to return if the key is not present. + +@Result The value of the key or the given default value. + +@Description + Use this if you can handle failure to fetch the key by supplying a default value. + This function cannot fail. +*/ +double +cdiGribIterator_inqDoubleDefaultValue(CdiGribIterator *me, const char *key, double defaultValue) +{ +#ifdef HAVE_LIBGRIB_API + return gribGetDoubleDefault(me->gribHandle, key, defaultValue); +#else + (void) me; + (void) key; + (void) defaultValue; + xabort( + "CDI was compiled without GribAPI support, so you can't possibly have a valid CdiGribIterator* to call this function with"); + return -4; +#endif +} + +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#include <math.h> + +// convert Julian calendar day into year, months, day +static void +decode_julday(int calendar, int64_t julianDay, // Julian day number to convert + int *year, // Gregorian year (out) + int *mon, // Gregorian month (1-12) (out) + int *day) // Gregorian day (1-31) (out) +{ + const int64_t a = julianDay; + + const double b = floor((a - 1867216.25) / 36524.25); + double c = a + b - floor(b / 4) + 1525; + + if (calendar == CALENDAR_STANDARD || calendar == CALENDAR_GREGORIAN) + if (a < 2299161) c = a + 1524; + + const double d = floor((c - 122.1) / 365.25); + const double e = floor(365.25 * d); + const double f = floor((c - e) / 30.6001); + + *day = (int) (c - e - floor(30.6001 * f)); + *mon = (int) (f - 1 - 12 * floor(f / 14)); + *year = (int) (d - 4715 - floor((7 + *mon) / 10)); +} + +// convert year, month, day into Julian calendar day +static int64_t +encode_julday(int calendar, int year, int month, int day) +{ + const int iy = (month <= 2) ? year - 1 : year; + const int im = (month <= 2) ? month + 12 : month; + int ib = (iy < 0) ? ((iy + 1) / 400 - (iy + 1) / 100) : (iy / 400 - iy / 100); + + if (calendar == CALENDAR_STANDARD || calendar == CALENDAR_GREGORIAN) + { + if (year > 1582 || (year == 1582 && (month > 10 || (month == 10 && day >= 15)))) + { + // 15th October 1582 AD or later + } + else + { + // 4th October 1582 AD or earlier + ib = -2; + } + } + + int64_t julianDay = (int64_t) (floor(365.25 * iy) + (int64_t) (30.6001 * (im + 1)) + ib + 1720996.5 + day + 0.5); + + return julianDay; +} + +int64_t +date_to_julday(int calendar, int64_t date) +{ + int year, month, day; + cdiDecodeDate(date, &year, &month, &day); + + return encode_julday(calendar, year, month, day); +} + +int64_t +julday_to_date(int calendar, int64_t julianDay) +{ + int year, month, day; + decode_julday(calendar, julianDay, &year, &month, &day); + + return cdiEncodeDate(year, month, day); +} + +int +time_to_sec(int time) +{ + int hour, minute, second; + cdiDecodeTime(time, &hour, &minute, &second); + + const int seconds = hour * 3600 + minute * 60 + second; + + return seconds; +} + +int +sec_to_time(int secofday) +{ + const int hour = secofday / 3600; + const int minute = secofday / 60 - hour * 60; + const int second = secofday - hour * 3600 - minute * 60; + + return cdiEncodeTime(hour, minute, second); +} + +double +secofday_encode(CdiTime time) +{ + const int hour = time.hour; + const int minute = time.minute; + const int second = time.second; + return hour * 3600 + minute * 60 + second + time.ms / 1000.0; +} + +CdiTime +secofday_decode(double secondOfDay) +{ + CdiTime time; + + const int fullSeconds = (int) secondOfDay; + + time.ms = (int) lround((secondOfDay - fullSeconds) * 1000); + + const int hour = fullSeconds / 3600; + const int minute = fullSeconds / 60 - hour * 60; + const int second = fullSeconds - hour * 3600 - minute * 60; + + time.hour = hour; + time.minute = minute; + time.second = second; + + return time; +} + +static int64_t +calDay_encode(int calendar, CdiDate date) +{ + const int dpy = calendar_dpy(calendar); + + if (dpy == 360 || dpy == 365 || dpy == 366) + return encode_calday(dpy, date.year, date.month, date.day); + else + return encode_julday(calendar, date.year, date.month, date.day); +} + +static CdiDate +calDay_decode(int calendar, int64_t julday) +{ + int year, month, day; + const int dpy = calendar_dpy(calendar); + + if (dpy == 360 || dpy == 365 || dpy == 366) + decode_calday(dpy, julday, &year, &month, &day); + else + decode_julday(calendar, julday, &year, &month, &day); + + CdiDate date; + date.year = year; + date.month = month; + date.day = day; + + return date; +} + +JulianDate +julianDate_encode(int calendar, CdiDateTime dt) +{ + JulianDate julianDate; + + julianDate.julianDay = calDay_encode(calendar, dt.date); + julianDate.secondOfDay = secofday_encode(dt.time); + + return julianDate; +} + +CdiDateTime +julianDate_decode(int calendar, JulianDate julianDate) +{ + CdiDateTime dt; + + dt.date = calDay_decode(calendar, julianDate.julianDay); + dt.time = secofday_decode(julianDate.secondOfDay); + + return dt; +} + +static void +adjust_seconds(JulianDate *julianDate) +{ + const double SecondsPerDay = 86400.0; + + while (julianDate->secondOfDay >= SecondsPerDay) + { + julianDate->secondOfDay -= SecondsPerDay; + julianDate->julianDay++; + } + + while (julianDate->secondOfDay < 0.0) + { + julianDate->secondOfDay += SecondsPerDay; + julianDate->julianDay--; + } +} + +// add seconds to julianDate +JulianDate +julianDate_add_seconds(JulianDate julianDate, int64_t seconds) +{ + julianDate.secondOfDay += seconds; + + adjust_seconds(&julianDate); + + return julianDate; +} + +// add julianDate1 and julianDate2 +JulianDate +julianDate_add(JulianDate julianDate1, JulianDate julianDate2) +{ + JulianDate julianDate; + julianDate.julianDay = julianDate1.julianDay + julianDate2.julianDay; + julianDate.secondOfDay = julianDate1.secondOfDay + julianDate2.secondOfDay; + + adjust_seconds(&julianDate); + + return julianDate; +} + +// subtract julianDate2 from julianDate1 +JulianDate +julianDate_sub(JulianDate julianDate1, JulianDate julianDate2) +{ + JulianDate julianDate; + julianDate.julianDay = julianDate1.julianDay - julianDate2.julianDay; + julianDate.secondOfDay = julianDate1.secondOfDay - julianDate2.secondOfDay; + + adjust_seconds(&julianDate); + + return julianDate; +} + +double +julianDate_to_seconds(JulianDate julianDate) +{ + return julianDate.julianDay * 86400.0 + julianDate.secondOfDay; +} + +#ifdef TEST2 +int +main(void) +{ + int calendar = CALENDAR_STANDARD; + int factor = 86400; + int value = 30; + + int year = 1979; + int month = 1; + int day = 15; + int hour = 12; + int minute = 30; + int second = 17; + int ms = 0; + + CdiDateTime dt; + dt.date = cdiDate_encode(year, month, day); + dt.time = cdiTime_encode(hour, minute, second, ms); + printf("%d/%02d/%02d %02d:%02d:%02d.%03d\n", dt.date.year, dt.date.month, dt.date.day, dt.time.hour, dt.time.minute, + dt.time.second, dt.time.ms); + + JulianDate julianDate = julianDate_encode(calendar, dt); + + dt = julianDate_decode(calendar, julianDate); + printf("%d/%02d/%02d %02d:%02d:%02d.%03d %d %g\n", dt.date.year, dt.date.month, dt.date.day, dt.time.hour, dt.time.minute, + dt.time.second, dt.time.ms, (int) julianDate.julianDay, julianDate.secondOfDay); + + for (int i = 0; i < 420; i++) + { + dt = julianDate_decode(calendar, julianDate); + printf("%2d %d/%02d/%02d %02d:%02d:%02d.%03d\n", i, dt.date.year, dt.date.month, dt.date.day, dt.time.hour, dt.time.minute, + dt.time.second, dt.time.ms); + julianDate = julianDate_add_seconds(julianDate, value * factor); + } + + return 0; +} +#endif +#ifndef MODEL_H +#define MODEL_H + +int modelUnpack(void *buf, int size, int *position, int originNamespace, void *context, int force_id); + +void modelDefaultEntries(void); + +#endif +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#include <limits.h> + + +#undef CDI_UNDEFID +#define CDI_UNDEFID -1 + +typedef struct +{ + int self; + int instID; + int modelgribID; + char *name; +} model_t; + +static void modelInit(void); + +static int modelCompareP(void *modelptr1, void *modelptr2); +static void modelDestroyP(void *modelptr); +static void modelPrintP(void *modelptr, FILE *fp); +static int modelGetSizeP(void *modelptr, void *context); +static void modelPackP(void *modelptr, void *buff, int size, int *position, void *context); +static int modelTxCode(void *modelptr); + +static const resOps modelOps = { modelCompareP, modelDestroyP, modelPrintP, modelGetSizeP, modelPackP, modelTxCode }; + +static void +modelDefaultValue(model_t *modelptr) +{ + modelptr->self = CDI_UNDEFID; + modelptr->instID = CDI_UNDEFID; + modelptr->modelgribID = CDI_UNDEFID; + modelptr->name = NULL; +} + +static model_t * +modelNewEntry(cdiResH resH, int instID, int modelgribID, const char *name) +{ + model_t *modelptr = (model_t *) Malloc(sizeof(model_t)); + modelDefaultValue(modelptr); + if (resH == CDI_UNDEFID) + modelptr->self = reshPut(modelptr, &modelOps); + else + { + modelptr->self = resH; + reshReplace(resH, modelptr, &modelOps); + } + modelptr->instID = instID; + modelptr->modelgribID = modelgribID; + if (name && *name) modelptr->name = strdupx(name); + + return (modelptr); +} + +void +modelDefaultEntries(void) +{ + int instID; + enum + { + nDefModels = 10 + }; + cdiResH resH[nDefModels]; + + instID = institutInq(0, 0, "ECMWF", NULL); + /* (void) modelDef(instID, 131, "ERA15"); */ + /* (void) modelDef(instID, 199, "ERA40"); */ + + instID = institutInq(98, 232, "MPIMET", NULL); + resH[0] = modelDef(instID, 64, "ECHAM5.4"); + resH[1] = modelDef(instID, 63, "ECHAM5.3"); + resH[2] = modelDef(instID, 62, "ECHAM5.2"); + resH[3] = modelDef(instID, 61, "ECHAM5.1"); + + instID = institutInq(98, 255, "MPIMET", NULL); + resH[4] = modelDef(instID, 60, "ECHAM5.0"); + resH[5] = modelDef(instID, 50, "ECHAM4"); + resH[6] = modelDef(instID, 110, "MPIOM1"); + + instID = institutInq(0, 0, "DWD", NULL); + resH[7] = modelDef(instID, 149, "GME"); + + instID = institutInq(0, 0, "MCH", NULL); + //(void) = modelDef(instID, 137, "COSMO"); + resH[8] = modelDef(instID, 255, "COSMO"); + + instID = institutInq(0, 1, "NCEP", NULL); + resH[9] = modelDef(instID, 80, "T62L28MRF"); + + /* pre-defined models are not synchronized */ + for (int i = 0; i < nDefModels; i++) reshSetStatus(resH[i], &modelOps, RESH_IN_USE); +} + +static void +modelInit(void) +{ + static bool modelInitialized = false; + if (modelInitialized) return; +} + +struct modelLoc +{ + const char *name; + int instID, modelgribID, resID; +}; + +static enum cdiApplyRet +findModelByID(int resID, void *res, void *data) +{ + model_t *modelptr = (model_t *) res; + struct modelLoc *ret = (struct modelLoc *) data; + int instID = ret->instID, modelgribID = ret->modelgribID; + if (modelptr->instID == instID && modelptr->modelgribID == modelgribID) + { + ret->resID = resID; + return CDI_APPLY_STOP; + } + else + return CDI_APPLY_GO_ON; +} + +static enum cdiApplyRet +findModelByName(int resID, void *res, void *data) +{ + model_t *modelptr = (model_t *) res; + struct modelLoc *ret = (struct modelLoc *) data; + int instID = ret->instID, modelgribID = ret->modelgribID; + const char *name = ret->name; + if ((instID == -1 || modelptr->instID == instID) && (modelgribID == 0 || modelptr->modelgribID == modelgribID) && modelptr->name) + { + const char *p = name, *q = modelptr->name; + while (*p != '\0' && *p == *q) ++p, ++q; + if (*p == '\0' || *q == '\0') + { + ret->resID = resID; + return CDI_APPLY_STOP; + } + } + return CDI_APPLY_GO_ON; +} + +int +modelInq(int instID, int modelgribID, const char *name) +{ + modelInit(); + + struct modelLoc searchState = { .name = name, .instID = instID, .modelgribID = modelgribID, .resID = CDI_UNDEFID }; + if (name && *name) + cdiResHFilterApply(&modelOps, findModelByName, &searchState); + else + cdiResHFilterApply(&modelOps, findModelByID, &searchState); + return searchState.resID; +} + +int +modelDef(int instID, int modelgribID, const char *name) +{ + model_t *modelptr; + + modelInit(); + + modelptr = modelNewEntry(CDI_UNDEFID, instID, modelgribID, name); + + return modelptr->self; +} + +int +modelInqInstitut(int modelID) +{ + model_t *modelptr = NULL; + + modelInit(); + + if (modelID != CDI_UNDEFID) modelptr = (model_t *) reshGetVal(modelID, &modelOps); + + return modelptr ? modelptr->instID : CDI_UNDEFID; +} + +int +modelInqGribID(int modelID) +{ + model_t *modelptr = NULL; + + modelInit(); + + if (modelID != CDI_UNDEFID) modelptr = (model_t *) reshGetVal(modelID, &modelOps); + + return modelptr ? modelptr->modelgribID : CDI_UNDEFID; +} + +const char * +modelInqNamePtr(int modelID) +{ + model_t *modelptr = NULL; + + modelInit(); + + if (modelID != CDI_UNDEFID) modelptr = (model_t *) reshGetVal(modelID, &modelOps); + + return modelptr ? modelptr->name : NULL; +} + +static int +modelCompareP(void *modelptr1, void *modelptr2) +{ + model_t *model1 = (model_t *) modelptr1, *model2 = (model_t *) modelptr2; + int diff = (namespaceResHDecode(model1->instID).idx != namespaceResHDecode(model2->instID).idx) + | (model1->modelgribID != model2->modelgribID) | !str_is_equal(model1->name, model2->name); + return diff; +} + +void +modelDestroyP(void *modelptr) +{ + model_t *mp = (model_t *) modelptr; + if (mp->name) Free(mp->name); + Free(mp); +} + +void +modelPrintP(void *modelptr, FILE *fp) +{ + model_t *mp = (model_t *) modelptr; + fprintf(fp, + "#\n" + "# modelID %d\n" + "#\n" + "self = %d\n" + "instID = %d\n" + "modelgribID = %d\n" + "name = %s\n", + mp->self, mp->self, mp->instID, mp->modelgribID, mp->name ? mp->name : "NN"); +} + +static int +modelTxCode(void *modelptr) +{ + (void) modelptr; + return MODEL; +} + +enum +{ + MODEL_PACK_INT_SELF, + MODEL_PACK_INT_INSTID, + MODEL_PACK_INT_MODELGRIBID, + MODEL_PACK_INT_NAMELEN, + modelNints, +}; + +static int +modelGetSizeP(void *modelptr, void *context) +{ + model_t *p = (model_t *) modelptr; + size_t txsize = (size_t) serializeGetSize(modelNints, CDI_DATATYPE_INT, context) + + (size_t) serializeGetSize(p->name ? (int) strlen(p->name) : 0, CDI_DATATYPE_TXT, context); + xassert(txsize <= INT_MAX); + return (int) txsize; +} + +static void +modelPackP(void *modelptr, void *buf, int size, int *position, void *context) +{ + model_t *p = (model_t *) modelptr; + int tempbuf[modelNints]; + tempbuf[MODEL_PACK_INT_SELF] = p->self; + tempbuf[MODEL_PACK_INT_INSTID] = p->instID; + tempbuf[MODEL_PACK_INT_MODELGRIBID] = p->modelgribID; + tempbuf[MODEL_PACK_INT_NAMELEN] = p->name ? (int) strlen(p->name) : 0; + serializePack(tempbuf, modelNints, CDI_DATATYPE_INT, buf, size, position, context); + if (p->name) serializePack(p->name, tempbuf[MODEL_PACK_INT_NAMELEN], CDI_DATATYPE_TXT, buf, size, position, context); +} + +int +modelUnpack(void *buf, int size, int *position, int originNamespace, void *context, int force_id) +{ +#define adaptKey(key) (namespaceAdaptKey((key), originNamespace)) + int tempbuf[modelNints]; + char *name; + serializeUnpack(buf, size, position, tempbuf, modelNints, CDI_DATATYPE_INT, context); + if (tempbuf[MODEL_PACK_INT_NAMELEN] != 0) + { + size_t len = (size_t) tempbuf[MODEL_PACK_INT_NAMELEN]; + name = (char *) Malloc(len + 1); + serializeUnpack(buf, size, position, name, tempbuf[MODEL_PACK_INT_NAMELEN], CDI_DATATYPE_TXT, context); + name[len] = '\0'; + } + else + { + name = (char *) ""; + } + int targetID = adaptKey(tempbuf[MODEL_PACK_INT_SELF]); + model_t *mp = modelNewEntry(force_id ? targetID : CDI_UNDEFID, adaptKey(tempbuf[MODEL_PACK_INT_INSTID]), + tempbuf[MODEL_PACK_INT_MODELGRIBID], name); + if (tempbuf[MODEL_PACK_INT_NAMELEN] != 0) Free(name); + xassert(!force_id || (mp->self == adaptKey(tempbuf[0]))); + reshSetStatus(mp->self, &modelOps, reshGetStatus(mp->self, &modelOps) & ~RESH_SYNC_BIT); +#undef adaptKey + return mp->self; +} + +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifndef STREAM_CDF_POSTDEF_H +#define STREAM_CDF_POSTDEF_H + +#include <stdlib.h> + + +struct cdfPostDefAction +{ + void *data; + void (*action)(void *data); + void (*cleanup)(void *data); +}; + +struct cdfPostDefActionList +{ + size_t size, len; + struct cdfPostDefAction actions[]; +}; + +void cdfPostDefActionGridProp(stream_t *streamptr, int gridID, int ncvarid, enum gridPropInq gridProp, + struct cdfPostDefActionList **delayed); + +typedef void (*cdfFuncPtrPostDefActionGridProp)(stream_t *streamptr, int gridID, int ncvarid, enum gridPropInq gridProp, + struct cdfPostDefActionList **delayed); + +struct cdfPostDefActionList *cdfPostDefActionAdd(struct cdfPostDefActionList *list, struct cdfPostDefAction addendum); + +void cdfDelayedPutVarDeepCleanup(void *data); + +void cdfPostDefActionAddPutVal(struct cdfPostDefActionList **delayed, int fileID, int ncvarid, const double *values, + void (*cleanup)(void *)); + +#endif +#ifdef HAVE_CONFIG_H +#endif + +#ifndef _XOPEN_SOURCE +#define _XOPEN_SOURCE 600 /* PTHREAD_MUTEX_RECURSIVE */ +#endif + +#include <limits.h> +#include <stdio.h> + +#ifdef HAVE_LIBNETCDF +#endif + +static unsigned nNamespaces = 1; +static int activeNamespace = 0; + +#ifdef HAVE_LIBNETCDF +// clang-format off +#define CDI_NETCDF_SWITCHES \ + { .func = (void (*)(void)) nc__create }, \ + { .func = (void (*)(void)) cdf_def_var_serial }, \ + { .func = (void (*)(void)) cdi_nc_enddef_serial }, \ + { .func = (void (*)(void)) cdi_nc__enddef_serial }, \ + { .func = (void (*)(void)) cdfDefTimestep }, \ + { .func = (void (*)(void)) cdfDefCoordinateVars }, \ + { .func = (void (*)(void)) cdfPostDefActionGridProp } +// clang-format on +#else +#define CDI_NETCDF_SWITCHES +#endif + +// clang-format off +#define defaultSwitches { \ + { .func = (void (*)(void)) cdiAbortC_serial }, \ + { .func = (void (*)(void)) cdiWarning }, \ + { .func = (void (*)(void)) serializeGetSizeInCore }, \ + { .func = (void (*)(void)) serializePackInCore }, \ + { .func = (void (*)(void)) serializeUnpackInCore }, \ + { .func = (void (*)(void)) fileOpen_serial }, \ + { .func = (void (*)(void)) fileWrite }, \ + { .func = (void (*)(void)) fileClose_serial }, \ + { .func = (void (*)(void)) cdiStreamOpenDefaultDelegate }, \ + { .func = (void (*)(void)) cdiStreamDefVlist_ }, \ + { .func = (void (*)(void)) cdiStreamSetupVlist_ }, \ + { .func = (void (*)(void)) cdiStreamWriteVar_ }, \ + { .func = (void (*)(void)) cdiStreamWriteVarChunk_ }, \ + { .func = (void (*)(void)) 0 }, \ + { .func = (void (*)(void)) 0 }, \ + { .func = (void (*)(void)) cdiStreamCloseDefaultDelegate }, \ + { .func = (void (*)(void)) cdiStreamDefTimestep_ }, \ + { .func = (void (*)(void)) cdiStreamSync_ }, \ + { .func = (void (*)(void)) cdiVlistDestroy_ }, \ + CDI_NETCDF_SWITCHES \ + } +// clang-format on + +#if defined(SX) || defined(__cplusplus) +static const union namespaceSwitchValue defaultSwitches_[NUM_NAMESPACE_SWITCH] = defaultSwitches; +#endif + +enum namespaceStatus +{ + NAMESPACE_STATUS_INUSE, + NAMESPACE_STATUS_UNUSED, +}; + +static union namespaceSwitchValue initialSwitches[NUM_NAMESPACE_SWITCH] = defaultSwitches; + +static struct Namespace +{ + enum namespaceStatus resStage; + unsigned numSwitches; + union namespaceSwitchValue *switches; +} initialNamespace = { .resStage = NAMESPACE_STATUS_INUSE, .numSwitches = NUM_NAMESPACE_SWITCH, .switches = initialSwitches }; + +static struct Namespace *namespaces = &initialNamespace; + +static unsigned namespacesSize = 1; + +#if defined(HAVE_LIBPTHREAD) +#include <pthread.h> + +static pthread_once_t namespaceOnce = PTHREAD_ONCE_INIT; +static pthread_mutex_t namespaceMutex; + +static void +namespaceInitialize(void) +{ + pthread_mutexattr_t ma; + pthread_mutexattr_init(&ma); + pthread_mutexattr_settype(&ma, PTHREAD_MUTEX_RECURSIVE); + pthread_mutex_init(&namespaceMutex, &ma); + pthread_mutexattr_destroy(&ma); +} + +#define NAMESPACE_LOCK() pthread_mutex_lock(&namespaceMutex) +#define NAMESPACE_UNLOCK() pthread_mutex_unlock(&namespaceMutex) +#define NAMESPACE_INIT() pthread_once(&namespaceOnce, namespaceInitialize) + +#else + +#define NAMESPACE_INIT() \ + do \ + { \ + } \ + while (0) +#define NAMESPACE_LOCK() +#define NAMESPACE_UNLOCK() + +#endif + +enum +{ + intbits = sizeof(int) * CHAR_BIT, + nspbits = 4, + idxbits = intbits - nspbits, + nspmask = (int) ((((unsigned) 1 << nspbits) - 1) << idxbits), + idxmask = (1 << idxbits) - 1, +}; + +enum +{ + NUM_NAMESPACES = 1 << nspbits, + NUM_IDX = 1 << idxbits, +}; + +int +namespaceIdxEncode(namespaceTuple_t tin) +{ + xassert(tin.nsp < NUM_NAMESPACES && tin.idx < NUM_IDX); + return (tin.nsp << idxbits) + tin.idx; +} + +int +namespaceIdxEncode2(int nsp, int idx) +{ + xassert(nsp < NUM_NAMESPACES && idx < NUM_IDX); + return (nsp << idxbits) + idx; +} + +namespaceTuple_t +namespaceResHDecode(int resH) +{ + namespaceTuple_t tin; + + tin.idx = resH & idxmask; + tin.nsp = (int) (((unsigned) (resH & nspmask)) >> idxbits); + + return tin; +} + +int +namespaceNew() +{ + int newNamespaceID = -1; + NAMESPACE_INIT(); + NAMESPACE_LOCK(); + if (namespacesSize > nNamespaces) + { + /* namespace is already available and only needs reinitialization */ + for (unsigned i = 0; i < namespacesSize; ++i) + if (namespaces[i].resStage == NAMESPACE_STATUS_UNUSED) + { + newNamespaceID = (int) i; + break; + } + } + else if (namespacesSize == 1) + { + /* make room for additional namespace */ + struct Namespace *newNameSpaces = (struct Namespace *) Malloc(((size_t) namespacesSize + 1) * sizeof(namespaces[0])); + memcpy(newNameSpaces, namespaces, sizeof(namespaces[0])); + namespaces = newNameSpaces; + ++namespacesSize; + newNamespaceID = 1; + } + else if (namespacesSize < NUM_NAMESPACES) + { + /* make room for additional namespace */ + newNamespaceID = (int) namespacesSize; + namespaces = (struct Namespace *) Realloc(namespaces, ((size_t) namespacesSize + 1) * sizeof(namespaces[0])); + ++namespacesSize; + } + else /* implicit: namespacesSize >= NUM_NAMESPACES */ + { + NAMESPACE_UNLOCK(); + return -1; + } + xassert(newNamespaceID >= 0 && newNamespaceID < NUM_NAMESPACES); + ++nNamespaces; + namespaces[newNamespaceID].resStage = NAMESPACE_STATUS_INUSE; + namespaces[newNamespaceID].numSwitches = NUM_NAMESPACE_SWITCH; + enum + { + initialNSSWSize = sizeof(union namespaceSwitchValue) * NUM_NAMESPACE_SWITCH + }; + namespaces[newNamespaceID].switches = (union namespaceSwitchValue *) Malloc(initialNSSWSize); +#if defined(SX) || defined(__cplusplus) + memcpy(namespaces[newNamespaceID].switches, defaultSwitches_, initialNSSWSize); +#else + memcpy(namespaces[newNamespaceID].switches, (union namespaceSwitchValue[NUM_NAMESPACE_SWITCH]) defaultSwitches, initialNSSWSize); +#endif + reshListCreate(newNamespaceID); + NAMESPACE_UNLOCK(); + return newNamespaceID; +} + +void +namespaceDelete(int namespaceID) +{ + NAMESPACE_INIT(); + NAMESPACE_LOCK(); + xassert(namespaceID >= 0 && (unsigned) namespaceID < namespacesSize && nNamespaces); + reshListDestruct(namespaceID); + if (namespaces[namespaceID].switches != initialSwitches) Free(namespaces[namespaceID].switches); + namespaces[namespaceID].resStage = NAMESPACE_STATUS_UNUSED; + --nNamespaces; + NAMESPACE_UNLOCK(); +} + +int +namespaceGetNumber() +{ + return (int) nNamespaces; +} + +void +namespaceSetActive(int nId) +{ + xassert((unsigned) nId < namespacesSize && namespaces[nId].resStage != NAMESPACE_STATUS_UNUSED); + activeNamespace = nId; +} + +int +namespaceGetActive() +{ + return activeNamespace; +} + +int +namespaceAdaptKey(int originResH, int originNamespace) +{ + if (originResH == CDI_UNDEFID) return CDI_UNDEFID; + + namespaceTuple_t tin = { .idx = originResH & idxmask, .nsp = (int) (((unsigned) (originResH & nspmask)) >> idxbits) }; + xassert(tin.nsp == originNamespace); + + int nsp = namespaceGetActive(); + + return namespaceIdxEncode2(nsp, tin.idx); +} + +int +namespaceAdaptKey2(int originResH) +{ + + if (originResH == CDI_UNDEFID) return CDI_UNDEFID; + + namespaceTuple_t tin = { .idx = originResH & idxmask, .nsp = (int) (((unsigned) (originResH & nspmask)) >> idxbits) }; + int nsp = namespaceGetActive(); + return namespaceIdxEncode2(nsp, tin.idx); +} + +void +namespaceSwitchSet(int sw, union namespaceSwitchValue value) +{ + xassert(sw > NSSWITCH_NO_SUCH_SWITCH); + int nsp = namespaceGetActive(); + NAMESPACE_LOCK(); + if (namespaces[nsp].numSwitches <= (unsigned) sw) + { + if (namespaces[nsp].switches != initialSwitches) + namespaces[nsp].switches + = (union namespaceSwitchValue *) Realloc(namespaces[nsp].switches, ((unsigned) sw + 1) * sizeof value); + else + { + void *temp = Malloc(((unsigned) sw + 1) * sizeof value); + memcpy(temp, (void *) namespaces[nsp].switches, namespaces[nsp].numSwitches * sizeof value); + namespaces[nsp].switches = (union namespaceSwitchValue *) temp; + } + namespaces[nsp].numSwitches = (unsigned) sw + 1; + } + namespaces[nsp].switches[sw] = value; + NAMESPACE_UNLOCK(); +} + +union namespaceSwitchValue +namespaceSwitchGet(int sw) +{ + int nsp = namespaceGetActive(); + xassert(sw > NSSWITCH_NO_SUCH_SWITCH && (unsigned) sw < namespaces[nsp].numSwitches); + NAMESPACE_LOCK(); + union namespaceSwitchValue sw_val = namespaces[nsp].switches[sw]; + NAMESPACE_UNLOCK(); + return sw_val; +} + +int +cdiNamespaceSwitchNewKey(void) +{ + static unsigned reservedKeys = 0; +#if defined(HAVE_LIBPTHREAD) + static pthread_mutex_t keyMutex = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_lock(&keyMutex); +#endif + if (reservedKeys >= INT_MAX - NUM_NAMESPACE_SWITCH - 1) Error("pool of available namespace switch keys exhausted!"); + int newKey = (int) (reservedKeys++) + NUM_NAMESPACE_SWITCH; +#if defined(HAVE_LIBPTHREAD) + pthread_mutex_unlock(&keyMutex); +#endif + return newKey; +} + +void +cdiReset(void) +{ + NAMESPACE_INIT(); + NAMESPACE_LOCK(); + for (unsigned namespaceID = 0; namespaceID < namespacesSize; ++namespaceID) + if (namespaces[namespaceID].resStage != NAMESPACE_STATUS_UNUSED) namespaceDelete((int) namespaceID); + if (namespaces != &initialNamespace) + { + Free(namespaces); + namespaces = &initialNamespace; + namespaces[0].resStage = NAMESPACE_STATUS_UNUSED; + } + namespacesSize = 1; + nNamespaces = 0; + NAMESPACE_UNLOCK(); +} + +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ + + +void +cdiRefObject_construct(CdiReferencedObject *me) +{ + me->destructor = cdiRefObject_destruct; + me->refCount = 1; +} + +void +cdiRefObject_retain(CdiReferencedObject *me) +{ + size_t oldCount = me->refCount++; + xassert(oldCount && "A reference counted object was used after it was destructed."); +} + +void +cdiRefObject_release(CdiReferencedObject *me) +{ + size_t oldCount = me->refCount--; + xassert(oldCount && "A reference counted object was released too often."); + if (oldCount == 1) + { + me->destructor(me); + Free(me); + } +} + +void +cdiRefObject_destruct(CdiReferencedObject *me) +{ + (void) me; + /* Empty for now, but that's no reason not to call it! */ +} + +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifdef HAVE_CONFIG_H +#endif + +#ifndef _XOPEN_SOURCE +#define _XOPEN_SOURCE 600 /* PTHREAD_MUTEX_RECURSIVE */ +#endif + +#include <stdlib.h> +#include <stdio.h> +#include <assert.h> + +#if defined(HAVE_EXECINFO_H) +#include <execinfo.h> +#endif + +static void +show_stackframe() +{ +#if defined HAVE_EXECINFO_H && defined backtrace_size_t && defined HAVE_BACKTRACE + void *trace[16]; + backtrace_size_t trace_size = backtrace(trace, 16); + char **messages = backtrace_symbols(trace, trace_size); + + fprintf(stderr, "[bt] Execution path:\n"); + if (messages) + { + for (backtrace_size_t i = 0; i < trace_size; ++i) fprintf(stderr, "[bt] %s\n", messages[i]); + free(messages); + } +#endif +} + + +enum +{ + MIN_LIST_SIZE = 128 +}; + +static void listInitialize(void); + +typedef struct listElem +{ + union + { + /* free-list management data */ + struct + { + int next, prev; + } free; + /* holding an actual value */ + struct + { + const resOps *ops; + void *val; // ptr + } v; + } res; + int status; +} listElem_t; + +struct resHList_t +{ + int size, freeHead, hasDefaultRes; + listElem_t *resources; +}; + +static struct resHList_t *resHList; + +static int resHListSize = 0; + +#if defined(HAVE_LIBPTHREAD) +#include <pthread.h> + +static pthread_once_t listInitThread = PTHREAD_ONCE_INIT; +static pthread_mutex_t listMutex; + +#define LIST_LOCK() pthread_mutex_lock(&listMutex) +#define LIST_UNLOCK() pthread_mutex_unlock(&listMutex) +#define LIST_INIT(init0) \ + do \ + { \ + pthread_once(&listInitThread, listInitialize); \ + pthread_mutex_lock(&listMutex); \ + if ((init0) && (!resHList || !resHList[0].resources)) reshListCreate(0); \ + pthread_mutex_unlock(&listMutex); \ + } \ + while (0) + +#else + +static int listInit = 0; + +#define LIST_LOCK() +#define LIST_UNLOCK() +#define LIST_INIT(init0) \ + do \ + { \ + if (!listInit) \ + { \ + listInitialize(); \ + if ((init0) && (!resHList || !resHList[0].resources)) reshListCreate(0); \ + listInit = 1; \ + } \ + } \ + while (0) + +#endif + +#ifdef CDI_CHECK_RESOURCE_LISTS +static void +checkListLinear(const char *caller, int nsp) +{ + const listElem_t *restrict r = resHList[nsp].resources; + for (int i = 0; i < resHList[nsp].size; i++) + { + if (r[i].status != RESH_UNUSED) continue; + + int prev = r[i].res.free.prev; + int next = r[i].res.free.next; + + if (prev < -1 || prev >= resHList[nsp].size) xabortC(caller, "error: found invalid back-link in free-list!"); + if (prev != -1) + { + if (r[prev].res.free.next != i) xabortC(caller, "error: found incomplete back link in free-list!"); + if (r[prev].status & RESH_IN_USE_BIT) xabortC(caller, "error: found in-use back link element in free-list!"); + } + + if (next < -1 || next >= resHList[nsp].size) xabortC(caller, "error: found invalid forward-link in free-list!"); + if (next != -1) + { + if (r[next].res.free.prev != i) xabortC(caller, "error: found incomplete forward link in free-list!"); + if (r[next].status & RESH_IN_USE_BIT) xabortC(caller, "error: found in-use next element in free-list!"); + } + } +} + +static void +checkListFwdBwd(const char *caller, int nsp) +{ + const listElem_t *restrict r = resHList[nsp].resources; + + int next = resHList[nsp].freeHead, loopLimit = resHList[nsp].size + 1; + int i = 0, cur = -1; + while (next != -1) + { + if (next < 0 || next >= resHList[nsp].size) xabortC(caller, "error: found invalid index in free-list!"); + if (r[next].status & RESH_IN_USE_BIT) xabortC(caller, "error: found in-use next element in free-list!"); + + cur = next; + next = r[next].res.free.next; + + if (++i > loopLimit) xabortC(caller, "error: found loop in free-list!"); + } + + i = 0; + int prev = cur; + while (prev != -1) + { + if (prev < 0 || prev >= resHList[nsp].size) xabortC(caller, "error: found invalid index in free-list!"); + if (r[prev].status & RESH_IN_USE_BIT) xabortC(caller, "error: found in-use prev element in free-list!"); + + cur = prev; + prev = r[prev].res.free.prev; + + if (prev == -1) break; + + if (++i > loopLimit) xabortC(caller, "error: found loop in free-list!"); + } +} + +static void +checkList(const char *caller, int nsp) +{ + checkListLinear(caller, nsp); + checkListFwdBwd(caller, nsp); +} +#else +#define checkList(caller, nsp) +#endif + +/**************************************************************/ + +static void +listInitResources(int nsp) +{ + xassert(nsp < resHListSize && nsp >= 0); + int size = resHList[nsp].size = MIN_LIST_SIZE; + xassert(resHList[nsp].resources == NULL); + resHList[nsp].resources = (listElem_t *) Calloc(MIN_LIST_SIZE, sizeof(listElem_t)); + listElem_t *p = resHList[nsp].resources; + + for (int i = 0; i < size; i++) + { + p[i].res.free.next = i + 1; + p[i].res.free.prev = i - 1; + p[i].status = RESH_UNUSED; + } + p[size - 1].res.free.next = -1; + resHList[nsp].freeHead = 0; + + checkList(__func__, nsp); + + int oldNsp = namespaceGetActive(); + namespaceSetActive(nsp); + instituteDefaultEntries(); + modelDefaultEntries(); + namespaceSetActive(oldNsp); +} + +static inline void +reshListClearEntry(int i) +{ + resHList[i].size = 0; + resHList[i].resources = NULL; + resHList[i].freeHead = -1; +} + +void +reshListCreate(int namespaceID) +{ + LIST_INIT(namespaceID != 0); + LIST_LOCK(); + if (resHListSize <= namespaceID) + { + resHList = (struct resHList_t *) Realloc(resHList, (size_t) (namespaceID + 1) * sizeof(resHList[0])); + for (int i = resHListSize; i <= namespaceID; ++i) reshListClearEntry(i); + resHListSize = namespaceID + 1; + } + listInitResources(namespaceID); + LIST_UNLOCK(); +} + +/**************************************************************/ +static void reshRemove_(int nsp, int idx, const char *caller); + +void +reshListDestruct(int namespaceID) +{ + LIST_LOCK(); + xassert(resHList && namespaceID >= 0 && namespaceID < resHListSize); + int callerNamespaceID = namespaceGetActive(); + namespaceSetActive(namespaceID); + if (resHList[namespaceID].resources) + { + for (int j = 0; j < resHList[namespaceID].size; j++) + { + listElem_t *listElem = resHList[namespaceID].resources + j; + if (listElem->status & RESH_IN_USE_BIT) + { + listElem->res.v.ops->valDestroy(listElem->res.v.val); + reshRemove_(namespaceID, j, __func__); + } + } + Free(resHList[namespaceID].resources); + resHList[namespaceID].resources = NULL; + reshListClearEntry(namespaceID); + } + if (resHList[callerNamespaceID].resources) namespaceSetActive(callerNamespaceID); + LIST_UNLOCK(); +} + +static void +listDestroy(void) +{ + LIST_LOCK(); + for (int i = resHListSize; i > 0; --i) + if (resHList[i - 1].resources) namespaceDelete(i - 1); + resHListSize = 0; + Free(resHList); + resHList = NULL; + cdiReset(); + LIST_UNLOCK(); +} + +/**************************************************************/ + +static void +listInitialize(void) +{ +#if defined(HAVE_LIBPTHREAD) + pthread_mutexattr_t ma; + pthread_mutexattr_init(&ma); + pthread_mutexattr_settype(&ma, PTHREAD_MUTEX_RECURSIVE); + /* initialize global API mutex lock */ + pthread_mutex_init(&listMutex, &ma); + pthread_mutexattr_destroy(&ma); +#endif + /* file is special and has its own table, which needs to be + * created, before we register the listDestroy exit handler */ + { + int null_id; + null_id = fileOpen_serial("/dev/null", "r"); + if (null_id != -1) fileClose_serial(null_id); + } + atexit(listDestroy); +} + +/**************************************************************/ + +static void +listSizeExtend(void) +{ + int nsp = namespaceGetActive(); + checkList(__func__, nsp); + int oldSize = resHList[nsp].size; + size_t newListSize = (size_t) oldSize + MIN_LIST_SIZE; + + resHList[nsp].resources = (listElem_t *) Realloc(resHList[nsp].resources, newListSize * sizeof(listElem_t)); + + listElem_t *r = resHList[nsp].resources; + for (size_t i = (size_t) oldSize; i < newListSize; ++i) + { + r[i].res.free.next = (int) i + 1; + r[i].res.free.prev = (int) i - 1; + r[i].status = RESH_UNUSED; + } + + if (resHList[nsp].freeHead != -1) r[resHList[nsp].freeHead].res.free.prev = (int) newListSize - 1; + r[newListSize - 1].res.free.next = resHList[nsp].freeHead; + r[oldSize].res.free.prev = -1; + resHList[nsp].freeHead = oldSize; + resHList[nsp].size = (int) newListSize; + + checkList(__func__, nsp); +} + +/**************************************************************/ + +static void +reshPut_(int nsp, int entry, void *p, const resOps *ops) +{ + checkList(__func__, nsp); + + listElem_t *newListElem = resHList[nsp].resources + entry; + int next = newListElem->res.free.next, prev = newListElem->res.free.prev; + if (next != -1) resHList[nsp].resources[next].res.free.prev = prev; + if (prev != -1) + resHList[nsp].resources[prev].res.free.next = next; + else + resHList[nsp].freeHead = next; + newListElem->res.v.val = p; + newListElem->res.v.ops = ops; + newListElem->status = RESH_DESYNC_IN_USE; + + checkList(__func__, nsp); +} + +int +reshPut(void *p, const resOps *ops) +{ + xassert(p && ops); + + LIST_INIT(1); + + LIST_LOCK(); + + int nsp = namespaceGetActive(); + + if (resHList[nsp].freeHead == -1) listSizeExtend(); + int entry = resHList[nsp].freeHead; + cdiResH resH = namespaceIdxEncode2(nsp, entry); + reshPut_(nsp, entry, p, ops); + + LIST_UNLOCK(); + + return resH; +} + +/**************************************************************/ + +static void +reshRemove_(int nsp, int idx, const char *caller) +{ + checkList(__func__, nsp); + + int curFree = resHList[nsp].freeHead; + listElem_t *r = resHList[nsp].resources; + if (!(r[idx].status & RESH_IN_USE_BIT)) xabortC(caller, "Attempting to remove an item that is already removed."); + r[idx].res.free.next = curFree; + r[idx].res.free.prev = -1; + if (curFree != -1) r[curFree].res.free.prev = idx; + r[idx].status = RESH_DESYNC_DELETED; + resHList[nsp].freeHead = idx; + + checkList(__func__, nsp); +} + +void +reshDestroy(cdiResH resH) +{ + int nsp; + namespaceTuple_t nspT; + + LIST_LOCK(); + + nsp = namespaceGetActive(); + + nspT = namespaceResHDecode(resH); + + listElem_t *r = resHList[nsp].resources + nspT.idx; + + xassert(nspT.nsp == nsp && nspT.idx >= 0 && nspT.idx < resHList[nsp].size && r->res.v.ops); + + if (r->status & RESH_IN_USE_BIT) + { + r->res.v.ops->valDestroy(r->res.v.val); + reshRemove_(nsp, nspT.idx, __func__); + } + + LIST_UNLOCK(); +} + +void +reshRemove(cdiResH resH, const resOps *ops) +{ + int nsp; + namespaceTuple_t nspT; + + LIST_LOCK(); + + nsp = namespaceGetActive(); + + nspT = namespaceResHDecode(resH); + + xassert(nspT.nsp == nsp && nspT.idx >= 0 && nspT.idx < resHList[nsp].size + && (resHList[nsp].resources[nspT.idx].status & RESH_IN_USE_BIT) && resHList[nsp].resources[nspT.idx].res.v.ops + && resHList[nsp].resources[nspT.idx].res.v.ops == ops); + + reshRemove_(nsp, nspT.idx, __func__); + + LIST_UNLOCK(); +} + +/**************************************************************/ + +void +reshReplace(cdiResH resH, void *p, const resOps *ops) +{ + xassert(p && ops); + LIST_INIT(1); + LIST_LOCK(); + int nsp = namespaceGetActive(); + + checkList(__func__, nsp); + + namespaceTuple_t nspT = namespaceResHDecode(resH); + while (resHList[nsp].size <= nspT.idx) listSizeExtend(); + listElem_t *q = resHList[nsp].resources + nspT.idx; + if (q->status & RESH_IN_USE_BIT) + { + q->res.v.ops->valDestroy(q->res.v.val); + reshRemove_(nsp, nspT.idx, __func__); + } + reshPut_(nsp, nspT.idx, p, ops); + LIST_UNLOCK(); + + checkList(__func__, nsp); +} + +static listElem_t * +reshGetElem(const char *caller, const char *expressionString, cdiResH resH, const resOps *ops) +{ + listElem_t *listElem; + xassert(ops); + + LIST_INIT(1); + + LIST_LOCK(); + + int nsp = namespaceGetActive(); + + namespaceTuple_t nspT = namespaceResHDecode(resH); + assert(nspT.idx >= 0); + + if (nspT.nsp == nsp && nspT.idx < resHList[nsp].size) + { + listElem = resHList[nsp].resources + nspT.idx; + LIST_UNLOCK(); + } + else + { + LIST_UNLOCK(); + show_stackframe(); + + if (resH == CDI_UNDEFID) + { + xabortC(caller, + "Error while trying to resolve the ID \"%s\" in `%s()`: the value is CDI_UNDEFID (= %d).\n\tThis is most likely " + "the result of a failed earlier call. Please check the IDs returned by CDI.", + expressionString, caller, resH); + } + else + { + xabortC(caller, + "Error while trying to resolve the ID \"%s\" in `%s()`: the value is garbage (= %d, which resolves to namespace " + "= %d, index = %d).\n\tThis is either the result of using an uninitialized variable,\n\tof using a value as an " + "ID that is not an ID,\n\tor of using an ID after it has been invalidated.", + expressionString, caller, resH, nspT.nsp, nspT.idx); + } + } + + if (!(listElem && listElem->res.v.ops == ops)) + { + show_stackframe(); + + xabortC(caller, "Error while trying to resolve the ID \"%s\" in `%s()`: list element not found. The failed ID is %d", + expressionString, caller, (int) resH); + } + + return listElem; +} + +void * +reshGetValue(const char *caller, const char *expressionString, cdiResH resH, const resOps *ops) +{ + return reshGetElem(caller, expressionString, resH, ops)->res.v.val; +} + +/**************************************************************/ + +void +reshGetResHListOfType(unsigned numIDs, int resHs[], const resOps *ops) +{ + xassert(resHs && ops); + + LIST_INIT(1); + + LIST_LOCK(); + + int nsp = namespaceGetActive(); + unsigned j = 0; + for (int i = 0; i < resHList[nsp].size && j < numIDs; i++) + if ((resHList[nsp].resources[i].status & RESH_IN_USE_BIT) && resHList[nsp].resources[i].res.v.ops == ops) + resHs[j++] = namespaceIdxEncode2(nsp, i); + + LIST_UNLOCK(); +} + +enum cdiApplyRet +cdiResHApply(enum cdiApplyRet (*func)(int id, void *res, const resOps *p, void *data), void *data) +{ + xassert(func); + + LIST_INIT(1); + + LIST_LOCK(); + + int nsp = namespaceGetActive(); + enum cdiApplyRet ret = CDI_APPLY_GO_ON; + for (int i = 0; i < resHList[nsp].size && ret > 0; ++i) + if (resHList[nsp].resources[i].status & RESH_IN_USE_BIT) + ret = func(namespaceIdxEncode2(nsp, i), resHList[nsp].resources[i].res.v.val, resHList[nsp].resources[i].res.v.ops, data); + LIST_UNLOCK(); + return ret; +} + +enum cdiApplyRet +cdiResHFilterApply(const resOps *p, enum cdiApplyRet (*func)(int id, void *res, void *data), void *data) +{ + xassert(p && func); + + LIST_INIT(1); + + LIST_LOCK(); + + int nsp = namespaceGetActive(); + enum cdiApplyRet ret = CDI_APPLY_GO_ON; + listElem_t *r = resHList[nsp].resources; + for (int i = 0; i < resHList[nsp].size && ret > 0; ++i) + if ((r[i].status & RESH_IN_USE_BIT) && r[i].res.v.ops == p) ret = func(namespaceIdxEncode2(nsp, i), r[i].res.v.val, data); + LIST_UNLOCK(); + return ret; +} + +/**************************************************************/ + +unsigned +reshCountType(const resOps *ops) +{ + unsigned countType = 0; + + xassert(ops); + + LIST_INIT(1); + + LIST_LOCK(); + + int nsp = namespaceGetActive(); + + listElem_t *r = resHList[nsp].resources; + size_t len = (size_t) resHList[nsp].size; + for (size_t i = 0; i < len; i++) countType += ((r[i].status & RESH_IN_USE_BIT) && r[i].res.v.ops == ops); + + LIST_UNLOCK(); + + return countType; +} + +/**************************************************************/ + +int +reshResourceGetPackSize_intern(int resH, const resOps *ops, void *context, const char *caller, const char *expressionString) +{ + listElem_t *curr = reshGetElem(caller, expressionString, resH, ops); + return curr->res.v.ops->valGetPackSize(curr->res.v.val, context); +} + +void +reshPackResource_intern(int resH, const resOps *ops, void *buf, int buf_size, int *position, void *context, const char *caller, + const char *expressionString) +{ + listElem_t *curr = reshGetElem(caller, expressionString, resH, ops); + curr->res.v.ops->valPack(curr->res.v.val, buf, buf_size, position, context); +} + +enum +{ + resHPackHeaderNInt = 2, + resHDeleteNInt = 2, +}; + +static int +getPackBufferSize(void *context) +{ + int intpacksize, packBufferSize = 0; + + int nsp = namespaceGetActive(); + + /* pack start marker, namespace and sererator marker */ + packBufferSize += resHPackHeaderNInt * (intpacksize = serializeGetSize(1, CDI_DATATYPE_INT, context)); + + /* pack resources, type marker and seperator marker */ + listElem_t *r = resHList[nsp].resources; + for (int i = 0; i < resHList[nsp].size; i++) + if (r[i].status & RESH_SYNC_BIT) + { + if (r[i].status == RESH_DESYNC_DELETED) + { + packBufferSize += resHDeleteNInt * intpacksize; + } + else if (r[i].status == RESH_DESYNC_IN_USE) + { + xassert(r[i].res.v.ops); + /* packed resource plus 1 int for type */ + packBufferSize += r[i].res.v.ops->valGetPackSize(r[i].res.v.val, context) + intpacksize; + } + } + /* end marker */ + packBufferSize += intpacksize; + + return packBufferSize; +} + +/**************************************************************/ + +void +reshPackBufferDestroy(char **buffer) +{ + if (buffer) free(*buffer); +} + +/**************************************************************/ + +int +reshGetTxCode(cdiResH resH) +{ + int type = 0; + + LIST_LOCK(); + + int nsp = namespaceGetActive(); + + namespaceTuple_t nspT = namespaceResHDecode(resH); + assert(nspT.idx >= 0); + + if (nspT.nsp == nsp && nspT.idx < resHList[nsp].size) + { + listElem_t *listElem = resHList[nsp].resources + nspT.idx; + xassert(listElem->res.v.ops); + type = listElem->res.v.ops->valTxCode(listElem->res.v.val); + } + + LIST_UNLOCK(); + + return type; +} + +/**************************************************************/ + +int +reshPackBufferCreate(char **packBuffer, int *packBufferSize, void *context) +{ + int packBufferPos = 0; + int end = END; + + xassert(packBuffer); + + LIST_LOCK(); + + int nsp = namespaceGetActive(); + + int pBSize = *packBufferSize = getPackBufferSize(context); + char *pB = *packBuffer = (char *) Malloc((size_t) pBSize); + + { + int header[resHPackHeaderNInt] = { START, nsp }; + serializePack(header, resHPackHeaderNInt, CDI_DATATYPE_INT, pB, pBSize, &packBufferPos, context); + } + + listElem_t *r = resHList[nsp].resources; + for (int i = 0; i < resHList[nsp].size; i++) + if (r[i].status & RESH_SYNC_BIT) + { + if (r[i].status == RESH_DESYNC_DELETED) + { + int temp[resHDeleteNInt] = { RESH_DELETE, namespaceIdxEncode2(nsp, i) }; + serializePack(temp, resHDeleteNInt, CDI_DATATYPE_INT, pB, pBSize, &packBufferPos, context); + } + else + { + listElem_t *curr = r + i; + xassert(curr->res.v.ops); + int type = curr->res.v.ops->valTxCode(curr->res.v.val); + if (!type) continue; + serializePack(&type, 1, CDI_DATATYPE_INT, pB, pBSize, &packBufferPos, context); + curr->res.v.ops->valPack(curr->res.v.val, pB, pBSize, &packBufferPos, context); + } + r[i].status &= ~RESH_SYNC_BIT; + } + + LIST_UNLOCK(); + + serializePack(&end, 1, CDI_DATATYPE_INT, pB, pBSize, &packBufferPos, context); + + return packBufferPos; +} + +/**************************************************************/ + +/* for thread safety this feature would have to be integrated in reshPut */ + +void +reshSetStatus(cdiResH resH, const resOps *ops, int status) +{ + int nsp; + namespaceTuple_t nspT; + listElem_t *listElem; + + LIST_INIT(1); + + LIST_LOCK(); + + nsp = namespaceGetActive(); + + nspT = namespaceResHDecode(resH); + + xassert(nspT.nsp == nsp && nspT.idx >= 0 && nspT.idx < resHList[nsp].size); + + xassert(resHList[nsp].resources); + listElem = resHList[nsp].resources + nspT.idx; + + xassert((!ops || (listElem->res.v.ops == ops)) && (listElem->status & RESH_IN_USE_BIT) == (status & RESH_IN_USE_BIT)); + + listElem->status = status; + + LIST_UNLOCK(); +} + +/**************************************************************/ + +int +reshGetStatus(cdiResH resH, const resOps *ops) +{ + LIST_INIT(1); + + LIST_LOCK(); + + int nsp = namespaceGetActive(); + + namespaceTuple_t nspT = namespaceResHDecode(resH); + + xassert(nspT.nsp == nsp && nspT.idx >= 0); + + int status = RESH_UNUSED; + if (nspT.idx < resHList[nsp].size) + { + listElem_t *listElem = resHList[nsp].resources + nspT.idx; + const resOps *elemOps = listElem->res.v.ops; + xassert(listElem && (!(listElem->status & RESH_IN_USE_BIT) || elemOps == ops || !ops)); + status = listElem->status; + } + + LIST_UNLOCK(); + + return status; +} + +/**************************************************************/ + +void +reshLock() +{ + LIST_LOCK(); +} + +/**************************************************************/ + +void +reshUnlock() +{ + LIST_UNLOCK(); +} + +/**************************************************************/ + +int +reshListCompare(int nsp0, int nsp1) +{ + LIST_INIT(1); + LIST_LOCK(); + + xassert(resHListSize > nsp0 && resHListSize > nsp1 && nsp0 >= 0 && nsp1 >= 0); + + int valCompare = 0; + int i, listSizeMin = (resHList[nsp0].size <= resHList[nsp1].size) ? resHList[nsp0].size : resHList[nsp1].size; + listElem_t *resources0 = resHList[nsp0].resources, *resources1 = resHList[nsp1].resources; + for (i = 0; i < listSizeMin; i++) + { + int occupied0 = (resources0[i].status & RESH_IN_USE_BIT) != 0, occupied1 = (resources1[i].status & RESH_IN_USE_BIT) != 0; + /* occupation mismatch ? */ + int diff = occupied0 ^ occupied1; + valCompare |= (diff << cdiResHListOccupationMismatch); + if (!diff && occupied0) + { + /* both occupied, do resource types match? */ + diff = (resources0[i].res.v.ops != resources1[i].res.v.ops || resources0[i].res.v.ops == NULL); + valCompare |= (diff << cdiResHListResourceTypeMismatch); + if (!diff) + { + /* types match, does content match also? */ + diff = resources0[i].res.v.ops->valCompare(resources0[i].res.v.val, resources1[i].res.v.val); + valCompare |= (diff << cdiResHListResourceContentMismatch); + } + } + } + /* find resources in nsp 0 beyond end of nsp 1 */ + for (int j = listSizeMin; j < resHList[nsp0].size; ++j) + valCompare |= (((resources0[j].status & RESH_IN_USE_BIT) != 0) << cdiResHListOccupationMismatch); + /* find resources in nsp 1 beyond end of nsp 0 */ + for (; i < resHList[nsp1].size; ++i) + valCompare |= (((resources1[i].status & RESH_IN_USE_BIT) != 0) << cdiResHListOccupationMismatch); + + LIST_UNLOCK(); + + return valCompare; +} + +/**************************************************************/ + +void +reshListPrint(FILE *fp) +{ + int i, j, temp; + listElem_t *curr; + + LIST_INIT(1); + + temp = namespaceGetActive(); + + fprintf(fp, "\n\n##########################################\n#\n# print " + "global resource list \n#\n"); + + for (i = 0; i < namespaceGetNumber(); i++) + { + namespaceSetActive(i); + + fprintf(fp, "\n"); + fprintf(fp, "##################################\n"); + fprintf(fp, "#\n"); + fprintf(fp, "# namespace=%d\n", i); + fprintf(fp, "#\n"); + fprintf(fp, "##################################\n\n"); + + fprintf(fp, "resHList[%d].size=%d\n", i, resHList[i].size); + + for (j = 0; j < resHList[i].size; j++) + { + curr = resHList[i].resources + j; + if (!(curr->status & RESH_IN_USE_BIT)) + { + curr->res.v.ops->valPrint(curr->res.v.val, fp); + fprintf(fp, "\n"); + } + } + } + fprintf(fp, "#\n# end global resource list" + "\n#\n##########################################\n\n"); + + namespaceSetActive(temp); +} + +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#include <inttypes.h> +#include <limits.h> +#include <string.h> + + +int +serializeGetSize(int count, int datatype, void *context) +{ + int (*serialize_get_size_p)(int count, int datatype, void *context) + = (int (*)(int, int, void *)) namespaceSwitchGet(NSSWITCH_SERIALIZE_GET_SIZE).func; + return serialize_get_size_p(count, datatype, context); +} + +void +serializePack(const void *data, int count, int datatype, void *buf, int buf_size, int *position, void *context) +{ + void (*serialize_pack_p)(const void *data, int count, int datatype, void *buf, int buf_size, int *position, void *context) + = (void (*)(const void *, int, int, void *, int, int *, void *)) namespaceSwitchGet(NSSWITCH_SERIALIZE_PACK).func; + serialize_pack_p(data, count, datatype, buf, buf_size, position, context); +} + +void +serializeUnpack(const void *buf, int buf_size, int *position, void *data, int count, int datatype, void *context) +{ + void (*serialize_unpack_p)(const void *buf, int buf_size, int *position, void *data, int count, int datatype, void *context) + = (void (*)(const void *, int, int *, void *, int, int, void *)) namespaceSwitchGet(NSSWITCH_SERIALIZE_UNPACK).func; + serialize_unpack_p(buf, buf_size, position, data, count, datatype, context); +} + +int +serializeGetSizeInCore(int count, int datatype, void *context) +{ + int elemSize; + (void) context; + switch (datatype) + { + case CDI_DATATYPE_INT8: elemSize = sizeof(int8_t); break; + case CDI_DATATYPE_INT16: elemSize = sizeof(int16_t); break; + case CDI_DATATYPE_UINT32: elemSize = sizeof(uint32_t); break; + case CDI_DATATYPE_INT: elemSize = sizeof(int); break; + case CDI_DATATYPE_UINT: elemSize = sizeof(unsigned); break; + case CDI_DATATYPE_FLT: + case CDI_DATATYPE_FLT64: elemSize = sizeof(double); break; + case CDI_DATATYPE_TXT: + case CDI_DATATYPE_UCHAR: elemSize = 1; break; + case CDI_DATATYPE_LONG: elemSize = sizeof(long); break; + default: xabort("Unexpected datatype"); + } + return count * elemSize; +} + +void +serializePackInCore(const void *data, int count, int datatype, void *buf, int buf_size, int *position, void *context) +{ + int size = serializeGetSize(count, datatype, context); + int pos = *position; + xassert(INT_MAX - pos >= size && buf_size - pos >= size); + memcpy((unsigned char *) buf + pos, data, (size_t) size); + pos += size; + *position = pos; +} + +void +serializeUnpackInCore(const void *buf, int buf_size, int *position, void *data, int count, int datatype, void *context) +{ + int size = serializeGetSize(count, datatype, context); + int pos = *position; + xassert(INT_MAX - pos >= size && buf_size - pos >= size); + memcpy(data, (unsigned char *) buf + pos, (size_t) size); + pos += size; + *position = pos; +} + +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#include <stdio.h> +#include <stdlib.h> +#include <stdarg.h> +#include <string.h> +#include <ctype.h> + + +enum +{ + SRV_HEADER_LEN = 8, +}; + +union SRV_HEADER +{ + INT32 i32[SRV_HEADER_LEN]; + INT64 i64[SRV_HEADER_LEN]; +}; + +static int initSrvLib = 0; +static int srvDefaultHprec = 0; +static int srvDefaultDprec = 0; + +// A version string. +#undef LIBVERSION +#define LIBVERSION 1.5.0 +#define XSTRING(x) #x +#define STRING(x) XSTRING(x) +static const char srv_libvers[] = STRING(LIBVERSION); + +const char * +srvLibraryVersion(void) +{ + return srv_libvers; +} + +static int SRV_Debug = 0; // If set to 1, debugging + +void +srvDebug(int debug) +{ + if (debug) Message("debug level %d", debug); + SRV_Debug = debug; +} + +static void +srvLibInit() +{ + const char *envName = "SRV_PRECISION"; + + char *envString = getenv(envName); + if (envString) + { + int nrun = (strlen(envString) == 2) ? 1 : 2; + int pos = 0; + while (nrun--) + { + switch (tolower((int) envString[pos])) + { + case 'i': + { + switch ((int) envString[pos + 1]) + { + case '4': srvDefaultHprec = EXSE_SINGLE_PRECISION; break; + case '8': srvDefaultHprec = EXSE_DOUBLE_PRECISION; break; + default: Warning("Invalid digit in %s: %s", envName, envString); + } + break; + } + case 'r': + { + switch ((int) envString[pos + 1]) + { + case '4': srvDefaultDprec = EXSE_SINGLE_PRECISION; break; + case '8': srvDefaultDprec = EXSE_DOUBLE_PRECISION; break; + default: Warning("Invalid digit in %s: %s", envName, envString); + } + break; + } + default: + { + Warning("Invalid character in %s: %s", envName, envString); + break; + } + } + pos += 2; + } + } + + initSrvLib = 1; +} + +static void +srvInit(srvrec_t *srvp) +{ + srvp->checked = 0; + srvp->byteswap = 0; + srvp->hprec = 0; + srvp->dprec = 0; + srvp->datasize = 0; + srvp->buffersize = 0; + srvp->buffer = NULL; +} + +void * +srvNew(void) +{ + if (!initSrvLib) srvLibInit(); + + srvrec_t *srvp = (srvrec_t *) Malloc(sizeof(srvrec_t)); + srvInit(srvp); + + return (void *) srvp; +} + +void +srvDelete(void *srv) +{ + srvrec_t *srvp = (srvrec_t *) srv; + + if (srvp) + { + if (srvp->buffer) Free(srvp->buffer); + Free(srvp); + } +} + +int +srvCheckFiletype(int fileID, int *swap) +{ + size_t data = 0; + size_t dimx = 0, dimy = 0; + size_t fact = 0; + unsigned char buffer[72], *pbuf; + + if (fileRead(fileID, buffer, 4) != 4) return 0; + + size_t blocklen = (size_t) get_UINT32(buffer); + size_t sblocklen = (size_t) get_SUINT32(buffer); + + if (SRV_Debug) Message("blocklen = %d sblocklen = %d", blocklen, sblocklen); + + // clang-format off + if (blocklen == 32) + { + *swap = 0; + fact = blocklen>>3; + if (fileRead(fileID, buffer, blocklen+8) != blocklen+8) return 0; + pbuf = buffer+4*fact; dimx = (size_t) get_UINT32(pbuf); + pbuf = buffer+5*fact; dimy = (size_t) get_UINT32(pbuf); + pbuf = buffer+blocklen+4; data = (size_t) get_UINT32(pbuf); + } + else if (blocklen == 64) + { + *swap = 0; + fact = blocklen>>3; + if (fileRead(fileID, buffer, blocklen+8) != blocklen+8) return 0; + pbuf = buffer+4*fact; dimx = (size_t) get_UINT64(pbuf); + pbuf = buffer+5*fact; dimy = (size_t) get_UINT64(pbuf); + pbuf = buffer+blocklen+4; data = (size_t) get_UINT32(pbuf); + } + else if (sblocklen == 32) + { + *swap = 1; + fact = sblocklen>>3; + if (fileRead(fileID, buffer, sblocklen+8) != sblocklen+8) return 0; + pbuf = buffer+4*fact; dimx = (size_t) get_SUINT32(pbuf); + pbuf = buffer+5*fact; dimy = (size_t) get_SUINT32(pbuf); + pbuf = buffer+sblocklen+4; data = (size_t) get_SUINT32(pbuf); + } + else if (sblocklen == 64) + { + *swap = 1; + fact = sblocklen>>3; + if (fileRead(fileID, buffer, sblocklen+8) != sblocklen+8) return 0; + pbuf = buffer+4*fact; dimx = (size_t) get_SUINT64(pbuf); + pbuf = buffer+5*fact; dimy = (size_t) get_SUINT64(pbuf); + pbuf = buffer+sblocklen+4; data = (size_t) get_SUINT32(pbuf); + } + // clang-format on + + fileRewind(fileID); + + if (SRV_Debug) Message("swap = %d fact = %d", *swap, fact); + if (SRV_Debug) Message("dimx = %lu dimy = %lu data = %lu", dimx, dimy, data); + + int found = data && (dimx * dimy * fact == data || dimx * dimy * 8 == data); + return found; +} + +int +srvInqHeader(void *srv, int *header) +{ + srvrec_t *srvp = (srvrec_t *) srv; + + for (int i = 0; i < SRV_HEADER_LEN; i++) header[i] = srvp->header[i]; + + if (SRV_Debug) Message("datasize = %lu", srvp->datasize); + + return 0; +} + +int +srvDefHeader(void *srv, const int *header) +{ + srvrec_t *srvp = (srvrec_t *) srv; + + for (int i = 0; i < SRV_HEADER_LEN; i++) srvp->header[i] = header[i]; + + srvp->datasize = (size_t) header[4] * (size_t) header[5]; + + if (SRV_Debug) Message("datasize = %zu", srvp->datasize); + + return 0; +} + +static int +srvInqData(srvrec_t *srvp, int prec, void *data) +{ + int ierr = 0; + int byteswap = srvp->byteswap; + size_t datasize = srvp->datasize; + void *buffer = srvp->buffer; + int dprec = srvp->dprec; + + switch (dprec) + { + case EXSE_SINGLE_PRECISION: + { + if (sizeof(FLT32) == 4) + { + if (byteswap) swap4byte(buffer, datasize); + + if (dprec == prec) + memcpy(data, buffer, datasize * sizeof(FLT32)); + else + for (size_t i = 0; i < datasize; i++) ((double *) data)[i] = (double) ((float *) buffer)[i]; + } + else + { + Error("not implemented for %d byte float", sizeof(FLT32)); + } + break; + } + case EXSE_DOUBLE_PRECISION: + if (sizeof(FLT64) == 8) + { + if (byteswap) swap8byte(buffer, datasize); + + if (dprec == prec) + memcpy(data, buffer, datasize * sizeof(FLT64)); + else + for (size_t i = 0; i < datasize; i++) ((float *) data)[i] = (float) ((double *) buffer)[i]; + } + else + { + Error("not implemented for %d byte float", sizeof(FLT64)); + } + break; + default: + { + Error("unexpected data precision %d", dprec); + break; + } + } + + return ierr; +} + +int +srvInqDataSP(void *srv, float *data) +{ + return srvInqData((srvrec_t *) srv, EXSE_SINGLE_PRECISION, (void *) data); +} + +int +srvInqDataDP(void *srv, double *data) +{ + return srvInqData((srvrec_t *) srv, EXSE_DOUBLE_PRECISION, (void *) data); +} + +static int +srvDefData(void *srv, int prec, const void *data) +{ + srvrec_t *srvp = (srvrec_t *) srv; + + int dprec = srvDefaultDprec ? srvDefaultDprec : srvp->dprec; + srvp->dprec = dprec ? dprec : prec; + + int hprec = srvDefaultHprec ? srvDefaultHprec : srvp->hprec; + srvp->hprec = hprec ? hprec : dprec; + + int *header = srvp->header; + + size_t datasize = (size_t) header[4] * (size_t) header[5]; + size_t blocklen = datasize * (size_t) dprec; + + srvp->datasize = datasize; + + if (srvp->buffersize != blocklen) + { + srvp->buffersize = blocklen; + srvp->buffer = Realloc(srvp->buffer, srvp->buffersize); + } + + switch (dprec) + { + case EXSE_SINGLE_PRECISION: + { + if (dprec == prec) + memcpy(srvp->buffer, data, datasize * sizeof(FLT32)); + else + for (size_t i = 0; i < datasize; i++) ((float *) srvp->buffer)[i] = (float) ((double *) data)[i]; + + break; + } + case EXSE_DOUBLE_PRECISION: + { + if (dprec == prec) + memcpy(srvp->buffer, data, datasize * sizeof(FLT64)); + else + for (size_t i = 0; i < datasize; i++) ((double *) srvp->buffer)[i] = (double) ((float *) data)[i]; + + break; + } + default: + { + Error("unexpected data precision %d", dprec); + break; + } + } + + return 0; +} + +int +srvDefDataSP(void *srv, const float *data) +{ + return srvDefData(srv, EXSE_SINGLE_PRECISION, (void *) data); +} + +int +srvDefDataDP(void *srv, const double *data) +{ + return srvDefData(srv, EXSE_DOUBLE_PRECISION, (void *) data); +} + +int +srvRead(int fileID, void *srv) +{ + srvrec_t *srvp = (srvrec_t *) srv; + union SRV_HEADER tempheader; + + if (!srvp->checked) + { + int status = srvCheckFiletype(fileID, &srvp->byteswap); + if (status == 0) Error("Not a SERVICE file!"); + srvp->checked = 1; + } + + int byteswap = srvp->byteswap; + + // read header record + size_t blocklen = binReadF77Block(fileID, byteswap); + + if (fileEOF(fileID)) return -1; + + if (SRV_Debug) Message("blocklen = %lu", blocklen); + + size_t hprec = blocklen / SRV_HEADER_LEN; + + srvp->hprec = (int) hprec; + + switch (hprec) + { + case EXSE_SINGLE_PRECISION: + { + binReadInt32(fileID, byteswap, SRV_HEADER_LEN, tempheader.i32); + for (int i = 0; i < SRV_HEADER_LEN; i++) srvp->header[i] = (int) tempheader.i32[i]; + break; + } + case EXSE_DOUBLE_PRECISION: + { + binReadInt64(fileID, byteswap, SRV_HEADER_LEN, tempheader.i64); + for (int i = 0; i < SRV_HEADER_LEN; i++) srvp->header[i] = (int) tempheader.i64[i]; + break; + } + default: + { + Error("Unexpected header precision %d", hprec); + break; + } + } + + size_t blocklen2 = binReadF77Block(fileID, byteswap); + + if (blocklen2 != blocklen) + { + Warning("Header blocklen differ (blocklen1=%d; blocklen2=%d)!", blocklen, blocklen2); + if (blocklen2 != 0) return -1; + } + + srvp->datasize = (size_t) srvp->header[4] * (size_t) srvp->header[5]; + + if (SRV_Debug) Message("datasize = %zu", srvp->datasize); + + blocklen = binReadF77Block(fileID, byteswap); + + if (srvp->buffersize < blocklen) + { + srvp->buffersize = blocklen; + srvp->buffer = Realloc(srvp->buffer, srvp->buffersize); + } + + size_t dprec = blocklen / srvp->datasize; + + srvp->dprec = (int) dprec; + + if (dprec != EXSE_SINGLE_PRECISION && dprec != EXSE_DOUBLE_PRECISION) + { + Warning("Unexpected data precision %d", dprec); + return -1; + } + + fileRead(fileID, srvp->buffer, blocklen); + + blocklen2 = binReadF77Block(fileID, byteswap); + + if (blocklen2 != blocklen) + { + Warning("Data blocklen differ (blocklen1=%d; blocklen2=%d)!", blocklen, blocklen2); + if (blocklen2 != 0) return -1; + } + + return 0; +} + +void +srvWrite(int fileID, void *srv) +{ + srvrec_t *srvp = (srvrec_t *) srv; + union SRV_HEADER tempheader; + int byteswap = srvp->byteswap; + int dprec = srvp->dprec; + int hprec = srvp->hprec; + int *restrict header = srvp->header; + + // write header record + size_t blocklen = SRV_HEADER_LEN * (size_t) hprec; + + binWriteF77Block(fileID, byteswap, blocklen); + + switch (hprec) + { + case EXSE_SINGLE_PRECISION: + { + for (int i = 0; i < SRV_HEADER_LEN; i++) tempheader.i32[i] = (INT32) header[i]; + binWriteInt32(fileID, byteswap, SRV_HEADER_LEN, tempheader.i32); + break; + } + case EXSE_DOUBLE_PRECISION: + { + for (int i = 0; i < SRV_HEADER_LEN; i++) tempheader.i64[i] = (INT64) header[i]; + binWriteInt64(fileID, byteswap, SRV_HEADER_LEN, tempheader.i64); + break; + } + default: + { + Error("unexpected header precision %d", hprec); + break; + } + } + + binWriteF77Block(fileID, byteswap, blocklen); + + srvp->datasize = (size_t) header[4] * (size_t) header[5]; + blocklen = srvp->datasize * (size_t) dprec; + + binWriteF77Block(fileID, byteswap, blocklen); + + switch (dprec) + { + case EXSE_SINGLE_PRECISION: + { + binWriteFlt32(fileID, byteswap, srvp->datasize, (FLT32 *) srvp->buffer); + break; + } + case EXSE_DOUBLE_PRECISION: + { + binWriteFlt64(fileID, byteswap, srvp->datasize, (FLT64 *) srvp->buffer); + break; + } + default: + { + Error("unexpected data precision %d", dprec); + break; + } + } + + binWriteF77Block(fileID, byteswap, blocklen); +} +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifndef STREAM_SCAN_H +#define STREAM_SCAN_H + + +void streamScanResizeRecords1(stream_t *streamptr); +int streamScanInitRecords2(stream_t *streamptr); +int streamScanInitRecords(stream_t *streamptr, int tsID); +void streamScanTimeConstAdjust(stream_t *streamptr, const taxis_t *taxis); +void streamScanTsFixNtsteps(stream_t *streamptr, off_t recpos); + +#endif /* STREAM_SCAN_H */ + +void +streamScanResizeRecords1(stream_t *streamptr) +{ + const int nrecords = streamptr->tsteps[0].nallrecs; + if (nrecords < streamptr->tsteps[0].recordSize) + { + streamptr->tsteps[0].recordSize = nrecords; + streamptr->tsteps[0].records = (record_t *) Realloc(streamptr->tsteps[0].records, (size_t) nrecords * sizeof(record_t)); + } + + streamptr->tsteps[0].recIDs = (int *) Malloc((size_t) nrecords * sizeof(int)); + streamptr->tsteps[0].nrecs = nrecords; + for (int recID = 0; recID < nrecords; ++recID) streamptr->tsteps[0].recIDs[recID] = recID; +} + +int +streamScanInitRecords2(stream_t *streamptr) +{ + const int nrecords = streamptr->tsteps[1].nallrecs; + streamptr->tsteps[1].recIDs = (int *) Malloc((size_t) nrecords * sizeof(int)); + streamptr->tsteps[1].nrecs = 0; + + for (int recID = 0; recID < nrecords; ++recID) + { + streamptr->tsteps[1].recIDs[recID] = -1; + streamptr->tsteps[1].records[recID].position = streamptr->tsteps[0].records[recID].position; + streamptr->tsteps[1].records[recID].size = streamptr->tsteps[0].records[recID].size; + } + + return nrecords; +} + +int +streamScanInitRecords(stream_t *streamptr, int tsID) +{ + const int nrecs = streamptr->tsteps[1].nrecs; + + streamptr->tsteps[tsID].nrecs = nrecs; + streamptr->tsteps[tsID].recIDs = (int *) Malloc((size_t) nrecs * sizeof(int)); + + for (int recID = 0; recID < nrecs; ++recID) streamptr->tsteps[tsID].recIDs[recID] = streamptr->tsteps[1].recIDs[recID]; + + return nrecs; +} + +void +streamScanTimeConstAdjust(stream_t *streamptr, const taxis_t *taxis) +{ + const int vlistID = streamptr->vlistID; + if (streamptr->ntsteps == 1 && cdiDateTime_isNull(taxis->vDateTime)) + { + streamptr->ntsteps = 0; + for (int varID = 0; varID < streamptr->nvars; ++varID) vlistDefVarTimetype(vlistID, varID, TIME_CONSTANT); + } +} + +void +streamScanTsFixNtsteps(stream_t *streamptr, off_t recpos) +{ + if (streamptr->ntsteps == -1) + { + const int tsID = tstepsNewEntry(streamptr); + if (tsID != streamptr->rtsteps) Error("Internal error. tsID = %d", tsID); + + streamptr->tsteps[tsID - 1].next = true; + streamptr->tsteps[tsID].position = recpos; + } +} +#ifndef CDI_FDB_H +#define CDI_FDB_H + +#ifdef HAVE_CONFIG_H +#endif + +extern int cdi_fdb_dummy; + +#ifdef HAVE_LIBFDB5 + +#include <fdb5/api/fdb_c.h> + +typedef struct +{ + char *item; + char *keys[32]; + char *values[32]; + int numKeys; +} KeyValueEntry; + +typedef struct +{ + int date; + int time; + int param; + int levtype; + int ilevel; +} RecordInfoEntry; + +void decode_fdbitem(const char *fdbItem, KeyValueEntry *keyValue); +int fdb_fill_itemlist(fdb_handle_t *fdb, fdb_request_t *request, char ***itemList); +long fdb_read_record(fdb_handle_t *fdb, char *item, size_t *buffersize, void **gribbuffer); +int check_keyvalueList(int numItems, KeyValueEntry *keyValueList); +void record_info_entry_init(RecordInfoEntry *recordInfo); +int get_num_records(int numItems, RecordInfoEntry *recordInfoList); +void decode_keyvalue(KeyValueEntry *keyValue, RecordInfoEntry *recordInfo); +int remove_duplicate_timesteps(RecordInfoEntry *recordInfoList, int numRecords, int numTimesteps, int *timestepRecordOffset); +fdb_request_t *create_fdb_request(const char *filename); + +#endif + +#endif /* CDI_FDB_H */ +#ifndef CDI_ACROSS_H +#define CDI_ACROSS_H + +#ifdef HAVE_CONFIG_H +#endif + +#ifdef HAVE_ACROSS + + +#define ACROSS_DEFAULT_PORT "13859" + +typedef struct +{ + char *expid; + int expver; +} across_info_t; + +int across_connect(const char *path, char filemode, stream_t *streamptr); +void across_disconnect(int sock); +int across_write_grib_message(stream_t *streamptr, const void *gribbuffer, size_t nbytes); + +#endif + +#endif /* CDI_ACROSS_H */ +#ifndef STREAM_CGRIBEX_H +#define STREAM_CGRIBEX_H + +void *cgribexNew(); +void cgribexDelete(void *cgribexp); + +int cgribexScanTimestep1(stream_t *streamptr); +int cgribexScanTimestep2(stream_t *streamptr); +int cgribexScanTimestep(stream_t *streamptr); + +int cgribexDecode(int memtype, void *cgribexp, void *gribbuffer, size_t gribsize, void *data, size_t datasize, int unreduced, + size_t *nmiss, double missval); + +size_t cgribexEncode(int memtype, int varID, int levelID, int vlistID, int gridID, int zaxisID, CdiDateTime vDateTime, + int tsteptype, int numavg, size_t datasize, const void *data, size_t nmiss, void *gribbuffer, + size_t gribbuffersize); + +void *cgribex_handle_new_from_meassage(void *gribbuffer, size_t recsize); +void cgribex_handle_delete(void *gh); + +void cgribexChangeParameterIdentification(void *gh, int code, int ltype, int lev); + +#endif /* STREAM_CGRIBEX_H */ +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifndef _STREAM_SRV_H +#define _STREAM_SRV_H + +#ifndef _SERVICE_H +#endif + +int srvInqContents(stream_t *streamptr); +int srvInqTimestep(stream_t *streamptr, int tsID); + +int srvInqRecord(stream_t *streamptr, int *varID, int *levelID); +void srvDefRecord(stream_t *streamptr); +void srvCopyRecord(stream_t *streamptr2, stream_t *streamptr1); +void srv_read_record(stream_t *streamptr, int memtype, void *data, size_t *nmiss); +void srv_write_record(stream_t *streamptr, int memtype, const void *data); + +void srvReadVarDP(stream_t *streamptr, int varID, double *data, size_t *nmiss); +void srvWriteVarDP(stream_t *streamptr, int varID, const double *data); + +void srvReadVarSliceDP(stream_t *streamptr, int varID, int levelID, double *data, size_t *nmiss); +void srvWriteVarSliceDP(stream_t *streamptr, int varID, int levelID, const double *data); + +#endif /* _STREAM_SRV_H */ +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifndef _STREAM_EXT_H +#define _STREAM_EXT_H + +#ifndef _EXTRA_H +#endif + +int extInqContents(stream_t *streamptr); +int extInqTimestep(stream_t *streamptr, int tsID); + +int extInqRecord(stream_t *streamptr, int *varID, int *levelID); +void extDefRecord(stream_t *streamptr); +void extCopyRecord(stream_t *streamptr2, stream_t *streamptr1); +void ext_read_record(stream_t *streamptr, int memtype, void *data, size_t *nmiss); +void ext_write_record(stream_t *streamptr, int memtype, const void *data); + +void extReadVarDP(stream_t *streamptr, int varID, double *data, size_t *nmiss); +void extWriteVarDP(stream_t *streamptr, int varID, const double *data); + +void extReadVarSliceDP(stream_t *streamptr, int varID, int levelID, double *data, size_t *nmiss); +void extWriteVarSliceDP(stream_t *streamptr, int varID, int levelID, const double *data); + +#endif /* _STREAM_EXT_H */ +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifndef _STREAM_IEG_H +#define _STREAM_IEG_H + +#ifndef _IEG_H +#endif + +int iegInqContents(stream_t *streamptr); +int iegInqTimestep(stream_t *streamptr, int tsID); + +int iegInqRecord(stream_t *streamptr, int *varID, int *levelID); +void iegDefRecord(stream_t *streamptr); +void iegCopyRecord(stream_t *streamptr2, stream_t *streamptr1); +void ieg_read_record(stream_t *streamptr, int memtype, void *data, size_t *nmiss); +void ieg_write_record(stream_t *streamptr, int memtype, const void *data); + +void iegReadVarDP(stream_t *streamptr, int varID, double *data, size_t *nmiss); +void iegWriteVarDP(stream_t *streamptr, int varID, const double *data); + +void iegReadVarSliceDP(stream_t *streamptr, int varID, int levelID, double *data, size_t *nmiss); +void iegWriteVarSliceDP(stream_t *streamptr, int varID, int levelID, const double *data); + +#endif /* _STREAM_IEG_H */ +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifdef HAVE_CONFIG_H +#endif + +#ifndef _XOPEN_SOURCE +#define _XOPEN_SOURCE 600 +#endif + +#ifdef HAVE_LIBFDB5 +#endif + +#include <sys/stat.h> // struct stat +#include <ctype.h> +#include <string.h> + + +static stream_t *stream_new_entry(int resH); +static int streamCompareP(void *streamptr1, void *streamptr2); +static void streamDestroyP(void *streamptr); +static void streamPrintP(void *streamptr, FILE *fp); +static int streamGetPackSize(void *streamptr, void *context); +static void streamPack(void *streamptr, void *buff, int size, int *position, void *context); +static int streamTxCode(void *streamptr); + +const resOps streamOps = { streamCompareP, streamDestroyP, streamPrintP, streamGetPackSize, streamPack, streamTxCode }; + +static int +getByteorder(int byteswap) +{ + int byteorder = -1; + + switch (HOST_ENDIANNESS) + { + case CDI_BIGENDIAN: byteorder = byteswap ? CDI_LITTLEENDIAN : CDI_BIGENDIAN; break; + case CDI_LITTLEENDIAN: byteorder = byteswap ? CDI_BIGENDIAN : CDI_LITTLEENDIAN; break; + /* FIXME: does not currently adjust for PDP endianness */ + case CDI_PDPENDIAN: + default: Error("unhandled endianness"); + } + + return byteorder; +} + +// used also in CDO +int +cdiGetFiletype(const char *uri, int *byteorder) +{ + // clang-format off + int filetype = CDI_EUFTYPE; + int swap = 0; + int version; + long recpos; + + const char *filename; + int protocol = cdiGetProtocol(uri, &filename); + + switch (protocol) + { + case CDI_PROTOCOL_ACROSS: return CDI_FILETYPE_GRB2; + case CDI_PROTOCOL_FDB: return CDI_FILETYPE_UNDEF; + case CDI_PROTOCOL_OTHER: return CDI_FILETYPE_NC; // support for NetCDF remote types and ESDM + case CDI_PROTOCOL_FILE: + // handled below; + break; + } + + int fileID = fileOpen(filename, "r"); + + if (fileID == CDI_UNDEFID) return CDI_ESYSTEM; + else if (fileID == -2) return CDI_ETMOF; + + char buffer[8]; + if (fileRead(fileID, buffer, 8) != 8) + { + struct stat buf; + if (stat(filename, &buf) == 0) + { + if (buf.st_size == 0) return CDI_EISEMPTY; + if (buf.st_mode & S_IFDIR) return CDI_EISDIR; + } + + return CDI_EUFTYPE; + } + + fileRewind(fileID); + + if (memcmp(buffer, "GRIB", 4) == 0) + { + version = buffer[7]; + if (version <= 1) filetype = CDI_FILETYPE_GRB; + else if (version == 2) filetype = CDI_FILETYPE_GRB2; + } + else if (memcmp(buffer, "CDF\001", 4) == 0) { filetype = CDI_FILETYPE_NC; } + else if (memcmp(buffer, "CDF\002", 4) == 0) { filetype = CDI_FILETYPE_NC2; } + else if (memcmp(buffer, "CDF\005", 4) == 0) { filetype = CDI_FILETYPE_NC5; } + else if (memcmp(buffer + 1, "HDF", 3) == 0) { filetype = CDI_FILETYPE_NC4; } +#ifdef HAVE_LIBSERVICE + else if (srvCheckFiletype(fileID, &swap)) { filetype = CDI_FILETYPE_SRV; } +#endif +#ifdef HAVE_LIBEXTRA + else if (extCheckFiletype(fileID, &swap)) { filetype = CDI_FILETYPE_EXT; } +#endif +#ifdef HAVE_LIBIEG + else if (iegCheckFiletype(fileID, &swap)) { filetype = CDI_FILETYPE_IEG; } +#endif +#ifdef HAVE_LIBGRIB + else if (gribCheckSeek(fileID, &recpos, &version) == 0) + { + if (version <= 1) filetype = CDI_FILETYPE_GRB; + else if (version == 2) filetype = CDI_FILETYPE_GRB2; + } +#endif + // clang-format on + + if (CDI_Debug && filetype != CDI_EUFTYPE) Message("found %s file = %s", strfiletype(filetype), filename); + + fileClose(fileID); + + *byteorder = getByteorder(swap); + + return filetype; +} + +/* +@Function streamInqFiletype +@Title Get the filetype + +@Prototype int streamInqFiletype(int streamID) +@Parameter + @Item streamID Stream ID, from a previous call to @fref{streamOpenRead} or @fref{streamOpenWrite}. + +@Description +The function @func{streamInqFiletype} returns the filetype of a stream. + +@Result +@func{streamInqFiletype} returns the type of the file format, +one of the set of predefined CDI file format types. +The valid CDI file format types are @func{CDI_FILETYPE_GRB}, @func{CDI_FILETYPE_GRB2}, @func{CDI_FILETYPE_NC}, +@func{CDI_FILETYPE_NC2}, @func{CDI_FILETYPE_NC4}, @func{CDI_FILETYPE_NC4C}, @func{CDI_FILETYPE_NC5}, +@func{CDI_FILETYPE_NCZARR}, @func{CDI_FILETYPE_SRV}, @func{CDI_FILETYPE_EXT} and @func{CDI_FILETYPE_IEG}. +@EndFunction +*/ +int +streamInqFiletype(int streamID) +{ + stream_t *streamptr = stream_to_pointer(streamID); + return streamptr->filetype; +} + +int +getByteswap(int byteorder) +{ + int byteswap = -1; + + switch (byteorder) + { + case CDI_BIGENDIAN: + case CDI_LITTLEENDIAN: + case CDI_PDPENDIAN: byteswap = (HOST_ENDIANNESS != byteorder); break; + case -1: break; + default: Error("unexpected byteorder %d query!", byteorder); + } + + return byteswap; +} + +void +streamDefMaxSteps(int streamID, int maxSteps) +{ + if (maxSteps >= 0) + { + stream_t *streamptr = stream_to_pointer(streamID); + streamptr->maxSteps = maxSteps; + } +} + +static long +cdiInqTimeSize(int streamID) +{ + stream_t *streamptr = stream_to_pointer(streamID); + + long ntsteps = streamptr->ntsteps; + if (ntsteps == (long) CDI_UNDEFID) + { + int tsID = 0; + while (streamInqTimestep(streamID, tsID++)) ntsteps = streamptr->ntsteps; + } + + return ntsteps; +} + +void +streamDefNumWorker(int streamID, int numWorker) +{ + if (numWorker > 0) + { + stream_t *streamptr = stream_to_pointer(streamID); + streamptr->numWorker = numWorker; + + int filetype = streamptr->filetype; + bool filetypeIsGrib = (filetype == CDI_FILETYPE_GRB || filetype == CDI_FILETYPE_GRB2); + if (streamptr->filemode == 'r' && filetypeIsGrib) (void) cdiInqTimeSize(streamID); + } +} + +/* +@Function streamDefByteorder +@Title Define the byte order + +@Prototype void streamDefByteorder(int streamID, int byteorder) +@Parameter + @Item streamID Stream ID, from a previous call to @fref{streamOpenWrite}. + @Item byteorder The byte order of a dataset, one of the CDI constants @func{CDI_BIGENDIAN} and + @func{CDI_LITTLEENDIAN}. + +@Description +The function @func{streamDefByteorder} defines the byte order of a binary dataset +with the file format type @func{CDI_FILETYPE_SRV}, @func{CDI_FILETYPE_EXT} or @func{CDI_FILETYPE_IEG}. + +@EndFunction +*/ +void +streamDefByteorder(int streamID, int byteorder) +{ + stream_t *streamptr = stream_to_pointer(streamID); + streamptr->byteorder = byteorder; + int filetype = streamptr->filetype; + + switch (filetype) + { +#ifdef HAVE_LIBSERVICE + case CDI_FILETYPE_SRV: + { + srvrec_t *srvp = (srvrec_t *) streamptr->record->objectp; + srvp->byteswap = getByteswap(byteorder); + + break; + } +#endif +#ifdef HAVE_LIBEXTRA + case CDI_FILETYPE_EXT: + { + extrec_t *extp = (extrec_t *) streamptr->record->objectp; + extp->byteswap = getByteswap(byteorder); + + break; + } +#endif +#ifdef HAVE_LIBIEG + case CDI_FILETYPE_IEG: + { + iegrec_t *iegp = (iegrec_t *) streamptr->record->objectp; + iegp->byteswap = getByteswap(byteorder); + + break; + } +#endif + } + + reshSetStatus(streamID, &streamOps, RESH_DESYNC_IN_USE); +} + +/* +@Function streamInqByteorder +@Title Get the byte order + +@Prototype int streamInqByteorder(int streamID) +@Parameter + @Item streamID Stream ID, from a previous call to @fref{streamOpenRead} or @fref{streamOpenWrite}. + +@Description +The function @func{streamInqByteorder} returns the byte order of a binary dataset +with the file format type @func{CDI_FILETYPE_SRV}, @func{CDI_FILETYPE_EXT} or @func{CDI_FILETYPE_IEG}. + +@Result +@func{streamInqByteorder} returns the type of the byte order. +The valid CDI byte order types are @func{CDI_BIGENDIAN} and @func{CDI_LITTLEENDIAN} + +@EndFunction +*/ +int +streamInqByteorder(int streamID) +{ + stream_t *streamptr = stream_to_pointer(streamID); + return streamptr->byteorder; +} + +const char * +streamFilesuffix(int filetype) +{ + static const char *noSuffix = ""; + static const char *ncSuffix = ".nc"; + static const char *grbSuffix = ".grb"; + static const char *srvSuffix = ".srv"; + static const char *extSuffix = ".ext"; + static const char *iegSuffix = ".ieg"; + + switch (cdiBaseFiletype(filetype)) + { + case CDI_FILETYPE_GRB: + case CDI_FILETYPE_GRB2: return grbSuffix; + case CDI_FILETYPE_SRV: return srvSuffix; + case CDI_FILETYPE_EXT: return extSuffix; + case CDI_FILETYPE_IEG: return iegSuffix; + case CDI_FILETYPE_NETCDF: return ncSuffix; + default: return noSuffix; + } +} + +const char * +streamFilename(int streamID) +{ + stream_t *streamptr = stream_to_pointer(streamID); + return streamptr->filename; +} + +static int +cdiInqContents(stream_t *streamptr) +{ + int status = 0; + int filetype = streamptr->filetype; + + switch (cdiBaseFiletype(filetype)) + { +#ifdef HAVE_LIBGRIB + case CDI_FILETYPE_GRB: + case CDI_FILETYPE_GRB2: + { + switch (streamptr->protocol) + { + case CDI_PROTOCOL_FDB: status = fdbInqContents(streamptr); break; + + case CDI_PROTOCOL_ACROSS: // TODO read from ACROSS + case CDI_PROTOCOL_OTHER: + case CDI_PROTOCOL_FILE: status = grbInqContents(streamptr); break; + } + break; + } +#endif +#ifdef HAVE_LIBSERVICE + case CDI_FILETYPE_SRV: status = srvInqContents(streamptr); break; +#endif +#ifdef HAVE_LIBEXTRA + case CDI_FILETYPE_EXT: status = extInqContents(streamptr); break; +#endif +#ifdef HAVE_LIBIEG + case CDI_FILETYPE_IEG: status = iegInqContents(streamptr); break; +#endif +#ifdef HAVE_LIBNETCDF + case CDI_FILETYPE_NETCDF: status = cdfInqContents(streamptr); break; +#endif + default: + { + status = CDI_ELIBNAVAIL; + if (CDI_Debug) Message("%s support not compiled in!", strfiletype(filetype)); + } + } + + if (status == 0) + { + int taxisID = vlistInqTaxis(streamptr->vlistID); + if (taxisID != CDI_UNDEFID) + { + taxis_t *taxisptr1 = &streamptr->tsteps[0].taxis; + taxis_t *taxisptr2 = taxisPtr(taxisID); + ptaxisCopy(taxisptr2, taxisptr1); + } + } + + return status; +} + +int +cdiGetProtocol(const char *uri, const char **filename) +{ + const char *pos = strstr(uri, "://"); + if (pos == NULL) + { + *filename = uri; + return CDI_PROTOCOL_FILE; + } + + int protocollen = pos - uri; + *filename = pos + 3; + + // if (strncmp(uri, "file", protocollen) == 0) return CDI_PROTOCOL_FILE; // file is already used in NetCDF + if (strncmp(uri, "fdb", protocollen) == 0) return CDI_PROTOCOL_FDB; + if (strncmp(uri, "across", protocollen) == 0) return CDI_PROTOCOL_ACROSS; + + *filename = uri; + + return CDI_PROTOCOL_OTHER; +} + +int +cdiStreamOpenDefaultDelegate(const char *uri, char filemode, int filetype, stream_t *streamptr, int recordBufIsToBeCreated) +{ + int fileID; + char temp[2] = { filemode, 0 }; + + const char *filename; + streamptr->protocol = cdiGetProtocol(uri, &filename); + + switch (streamptr->protocol) + { + case CDI_PROTOCOL_ACROSS: +#if defined(HAVE_ACROSS) && defined(HAVE_LIBGRIB_API) + if (filetype != CDI_FILETYPE_GRB2) + { + Warning("ACROSS needs to be used with GRIB2"); + return CDI_EUFTYPE; + } + fileID = across_connect(filename, filemode, streamptr); + if (fileID >= 0) + { + streamptr->filetype = filetype; + if (recordBufIsToBeCreated) + { + streamptr->record = (Record *) Malloc(sizeof(Record)); + streamptr->record->buffer = NULL; + } + } + return fileID; +#else +#ifdef HAVE_ACROSS + Warning("ecCodes support not compiled in (Needed for ACROSS)!"); +#else + Warning("ACROSS support not compiled in!"); +#endif + return CDI_ELIBNAVAIL; +#endif + + case CDI_PROTOCOL_FDB: +#if defined(HAVE_FDB5) && defined(HAVE_LIBGRIB_API) + + if (filetype != CDI_FILETYPE_GRB && filetype != CDI_FILETYPE_GRB2) + { + Warning("FDB5 needs to be used with GRIB or GRIB2"); + return CDI_EUFTYPE; + } + + fdb_initialise(); + fdb_new_handle((fdb_handle_t **) &(streamptr->protocolData)); + streamptr->filetype = filetype; + if (recordBufIsToBeCreated) + { + streamptr->record = (Record *) Malloc(sizeof(Record)); + streamptr->record->buffer = NULL; + } + return 88; + +#else // !(defined(HAVE_FDB5) && defined(HAVE_LIBGRIB_API)) + +#ifdef HAVE_FDB5 + Warning("ecCodes support not compiled in (Needed for FDB5)!"); +#else + Warning("FDB5 support not compiled in!"); +#endif + + return CDI_ELIBNAVAIL; +#endif + + case CDI_PROTOCOL_OTHER: + case CDI_PROTOCOL_FILE: + // handled below; + break; + } + + switch (filetype) + { +#if defined(HAVE_LIBGRIB) && (defined(HAVE_LIBCGRIBEX) || defined(HAVE_LIBGRIB_API)) + case CDI_FILETYPE_GRB: + { + fileID = gribOpen(filename, temp); + if (fileID < 0) return CDI_ESYSTEM; + if (recordBufIsToBeCreated) + { + streamptr->record = (Record *) Malloc(sizeof(Record)); + streamptr->record->buffer = NULL; +#ifdef HAVE_LIBCGRIBEX + streamptr->record->objectp = cgribexNew(); +#else + streamptr->record->objectp = NULL; +#endif + } + break; + } +#ifdef HAVE_LIBGRIB_API + case CDI_FILETYPE_GRB2: + { + fileID = gribOpen(filename, temp); + if (fileID < 0) return CDI_ESYSTEM; + if (recordBufIsToBeCreated) + { + streamptr->record = (Record *) Malloc(sizeof(Record)); + streamptr->record->buffer = NULL; + } + break; + } +#endif +#endif +#ifdef HAVE_LIBSERVICE + case CDI_FILETYPE_SRV: + { + fileID = fileOpen(filename, temp); + if (fileID < 0) return CDI_ESYSTEM; + if (recordBufIsToBeCreated) + { + streamptr->record = (Record *) Malloc(sizeof(Record)); + streamptr->record->buffer = NULL; + streamptr->record->objectp = srvNew(); + } + break; + } +#endif +#ifdef HAVE_LIBEXTRA + case CDI_FILETYPE_EXT: + { + fileID = fileOpen(filename, temp); + if (fileID < 0) return CDI_ESYSTEM; + if (recordBufIsToBeCreated) + { + streamptr->record = (Record *) Malloc(sizeof(Record)); + streamptr->record->buffer = NULL; + streamptr->record->objectp = extNew(); + } + break; + } +#endif +#ifdef HAVE_LIBIEG + case CDI_FILETYPE_IEG: + { + fileID = fileOpen(filename, temp); + if (fileID < 0) return CDI_ESYSTEM; + if (recordBufIsToBeCreated) + { + streamptr->record = (Record *) Malloc(sizeof(Record)); + streamptr->record->buffer = NULL; + streamptr->record->objectp = iegNew(); + } + break; + } +#endif +#ifdef HAVE_LIBNETCDF + case CDI_FILETYPE_NC: + case CDI_FILETYPE_NC2: + case CDI_FILETYPE_NC5: + { + fileID = cdfOpen(filename, temp, filetype); + break; + } + case CDI_FILETYPE_NC4: + case CDI_FILETYPE_NC4C: + case CDI_FILETYPE_NCZARR: + { + fileID = cdf4Open(filename, temp, &filetype); + break; + } +#endif + default: + { + if (CDI_Debug) Message("%s support not compiled in!", strfiletype(filetype)); + return CDI_ELIBNAVAIL; + } + } + + streamptr->filetype = filetype; + + return fileID; +} + +static int +stream_create_vlist(stream_t *streamptr, CdiQuery *query) +{ + int vlistID = vlistCreate(); + if (vlistID < 0) return CDI_ELIMIT; + + cdiVlistMakeInternal(vlistID); + streamptr->vlistID = vlistID; + + if (query) streamptr->query = query; + + int status = cdiInqContents(streamptr); + if (status >= 0) + { + vlist_t *vlistptr = vlist_to_pointer(streamptr->vlistID); + vlistptr->ntsteps = streamptr->ntsteps; + cdiVlistMakeImmutable(vlistID); + } + + return status; +} + +int +streamOpenID(const char *filename, char filemode, int filetype, int resH) +{ + if (CDI_Debug) Message("Open %s mode %c file %s", strfiletype(filetype), filemode, filename ? filename : "(NUL)"); + + if (!filename || filetype < 0) return CDI_EINVAL; + + stream_t *streamptr = stream_new_entry(resH); + int streamID = CDI_ESYSTEM; + + int (*streamOpenDelegate)(const char *filename, char filemode, int filetype, stream_t *streamptr, int recordBufIsToBeCreated) + = (int (*)(const char *, char, int, stream_t *, int)) namespaceSwitchGet(NSSWITCH_STREAM_OPEN_BACKEND).func; + + int fileID = streamOpenDelegate(filename, filemode, filetype, streamptr, 1); + if (fileID < 0) + { + streamID = fileID; + if (streamptr->record) Free(streamptr->record); + reshRemove(streamptr->self, &streamOps); + Free(streamptr); + } + else + { + streamID = streamptr->self; + if (streamID < 0) return CDI_ELIMIT; + + streamptr->filemode = filemode; + streamptr->filename = strdupx(filename); + streamptr->fileID = fileID; + } + + return streamID; +} + +static int +streamOpen(const char *filename, const char *filemode, int filetype) +{ + if (!filemode || strlen(filemode) != 1) return CDI_EINVAL; + return streamOpenID(filename, (char) tolower(filemode[0]), filetype, CDI_UNDEFID); +} + +static int +streamOpenA(const char *filename, const char *filemode, int filetype) +{ + if (CDI_Debug) Message("Open %s file (mode=%c); filename: %s", strfiletype(filetype), (int) *filemode, filename); + if (CDI_Debug) printf("streamOpenA: %s\n", filename); // seg fault without this line on thunder/squall with "cdo cat x y" + + if (!filename || !filemode || filetype < 0) return CDI_EINVAL; + + stream_t *streamptr = stream_new_entry(CDI_UNDEFID); + int fileID = CDI_UNDEFID; + + { + int (*streamOpenDelegate)(const char *filename, char filemode, int filetype, stream_t *streamptr, int recordBufIsToBeCreated) + = (int (*)(const char *, char, int, stream_t *, int)) namespaceSwitchGet(NSSWITCH_STREAM_OPEN_BACKEND).func; + + fileID = streamOpenDelegate(filename, 'r', filetype, streamptr, 1); + } + + if (fileID == CDI_UNDEFID || fileID == CDI_ELIBNAVAIL || fileID == CDI_ESYSTEM) return fileID; + + int streamID = streamptr->self; + + streamptr->filemode = tolower(*filemode); + streamptr->filename = strdupx(filename); + streamptr->fileID = fileID; + + streamptr->vlistID = vlistCreate(); + cdiVlistMakeInternal(streamptr->vlistID); + // cdiReadByteorder(streamID); + int status = cdiInqContents(streamptr); + if (status < 0) return status; + vlist_t *vlistptr = vlist_to_pointer(streamptr->vlistID); + vlistptr->ntsteps = (int) cdiInqTimeSize(streamID); + + // Needed for NetCDF4 + for (int varID = 0; varID < vlistptr->nvars; ++varID) streamptr->vars[varID].defmiss = true; + + if (str_is_equal(filemode, "r")) cdiVlistMakeImmutable(streamptr->vlistID); + + { + void (*streamCloseDelegate)(stream_t * streamptr, int recordBufIsToBeDeleted) + = (void (*)(stream_t *, int)) namespaceSwitchGet(NSSWITCH_STREAM_CLOSE_BACKEND).func; + + streamCloseDelegate(streamptr, 0); + } + + switch (filetype) + { +#if defined(HAVE_LIBGRIB) && (defined(HAVE_LIBCGRIBEX) || defined(HAVE_LIBGRIB_API)) + case CDI_FILETYPE_GRB: +#ifdef HAVE_LIBGRIB_API + case CDI_FILETYPE_GRB2: +#endif + { + fileID = gribOpen(filename, filemode); + if (fileID != CDI_UNDEFID) gribContainersNew(streamptr); + break; + } +#endif +#ifdef HAVE_LIBSERVICE + case CDI_FILETYPE_SRV: + { + fileID = fileOpen(filename, filemode); + break; + } +#endif +#ifdef HAVE_LIBEXTRA + case CDI_FILETYPE_EXT: + { + fileID = fileOpen(filename, filemode); + break; + } +#endif +#ifdef HAVE_LIBIEG + case CDI_FILETYPE_IEG: + { + fileID = fileOpen(filename, filemode); + break; + } +#endif +#ifdef HAVE_LIBNETCDF + case CDI_FILETYPE_NC: + case CDI_FILETYPE_NC2: + case CDI_FILETYPE_NC5: + { + fileID = cdfOpen(filename, filemode, filetype); + streamptr->ncmode = 2; + break; + } + case CDI_FILETYPE_NC4: + case CDI_FILETYPE_NC4C: + { + fileID = cdf4Open(filename, filemode, &filetype); + streamptr->ncmode = 2; + break; + } + case CDI_FILETYPE_NCZARR: + { + Warning("%s not available in append mode!", strfiletype(filetype)); + return CDI_ELIBNAVAIL; + } +#endif + default: + { + if (CDI_Debug) Message("%s support not compiled in!", strfiletype(filetype)); + return CDI_ELIBNAVAIL; + } + } + + if (fileID == CDI_UNDEFID) + streamID = CDI_UNDEFID; + else + streamptr->fileID = fileID; + + return streamID; +} + +/* +@Function streamOpenRead +@Title Open a dataset for reading + +@Prototype int streamOpenRead(const char *path) +@Parameter + @Item path The name of the dataset to be read. + +@Description +The function @func{streamOpenRead} opens an existing dataset for reading. + +@Result +Upon successful completion @func{streamOpenRead} returns an identifier to the +open stream. Otherwise, a negative number with the error status is returned. + +@Errors +@List + @Item CDI_ESYSTEM Operating system error. + @Item CDI_EINVAL Invalid argument. + @Item CDI_EUFILETYPE Unsupported file type. + @Item CDI_ELIBNAVAIL Library support not compiled in. +@EndList + +@Example +Here is an example using @func{streamOpenRead} to open an existing NetCDF +file named @func{foo.nc} for reading: + +@Source + ... +int streamID; + ... +streamID = streamOpenRead("foo.nc"); +if ( streamID < 0 ) handle_error(streamID); + ... +@EndSource +@EndFunction +*/ +int +streamOpenRead(const char *filename) +{ + cdiInitialize(); + + int byteorder = 0; + int filetype = cdiGetFiletype(filename, &byteorder); + if (filetype < 0) return filetype; + + int streamID = streamOpen(filename, "r", filetype); + if (streamID >= 0) + { + stream_t *streamptr = stream_to_pointer(streamID); + streamptr->byteorder = byteorder; + + int status = stream_create_vlist(streamptr, NULL); + if (status < 0) + { + streamID = status; + if (streamptr->record) Free(streamptr->record); + reshRemove(streamptr->self, &streamOps); + } + } + + return streamID; +} + +int +streamOpenReadQuery(const char *filename, CdiQuery *query) +{ + cdiInitialize(); + + int byteorder = 0; + int filetype = cdiGetFiletype(filename, &byteorder); + if (filetype < 0) return filetype; + + if (cdiBaseFiletype(filetype) != CDI_FILETYPE_NETCDF && filetype != CDI_FILETYPE_GRB2) return CDI_EQNAVAIL; + + int streamID = streamOpen(filename, "r", filetype); + if (streamID >= 0) + { + stream_t *streamptr = stream_to_pointer(streamID); + streamptr->byteorder = byteorder; + + int status = stream_create_vlist(streamptr, query); + if (status < 0) + { + streamID = status; + if (streamptr->record) Free(streamptr->record); + reshRemove(streamptr->self, &streamOps); + } + } + + return streamID; +} + +int +streamOpenAppend(const char *filename) +{ + cdiInitialize(); + + int byteorder = 0; + int filetype = cdiGetFiletype(filename, &byteorder); + if (filetype < 0) return filetype; + + int streamID = streamOpenA(filename, "a", filetype); + if (streamID >= 0) + { + stream_t *streamptr = stream_to_pointer(streamID); + streamptr->byteorder = byteorder; + } + + return streamID; +} + +/* +@Function streamOpenWrite +@Title Create a new dataset + +@Prototype int streamOpenWrite(const char *path, int filetype) +@Parameter + @Item path The name of the new dataset. + @Item filetype The type of the file format, one of the set of predefined CDI file format types. + The valid CDI file format types are @func{CDI_FILETYPE_GRB}, @func{CDI_FILETYPE_GRB2}, @func{CDI_FILETYPE_NC}, + @func{CDI_FILETYPE_NC2}, @func{CDI_FILETYPE_NC4}, @func{CDI_FILETYPE_NC4C}, @func{CDI_FILETYPE_NC5}, + @func{CDI_FILETYPE_NCZARR}, @func{CDI_FILETYPE_SRV}, @func{CDI_FILETYPE_EXT} and @func{CDI_FILETYPE_IEG}. + +@Description +The function @func{streamOpenWrite} creates a new datset. +@Result +Upon successful completion @func{streamOpenWrite} returns an identifier to the +open stream. Otherwise, a negative number with the error status is returned. + +@Errors +@List + @Item CDI_ESYSTEM Operating system error. + @Item CDI_EINVAL Invalid argument. + @Item CDI_EUFILETYPE Unsupported file type. + @Item CDI_ELIBNAVAIL Library support not compiled in. +@EndList + +@Example +Here is an example using @func{streamOpenWrite} to create a new NetCDF file named @func{foo.nc} for writing: + +@Source + ... +int streamID; + ... +streamID = streamOpenWrite("foo.nc", CDI_FILETYPE_NC); +if ( streamID < 0 ) handle_error(streamID); + ... +@EndSource +@EndFunction +*/ +int +streamOpenWrite(const char *filename, int filetype) +{ + cdiInitialize(); + + return streamOpen(filename, "w", filetype); +} + +static void +streamDefaultValue(stream_t *streamptr) +{ + streamptr->self = CDI_UNDEFID; + streamptr->accesstype = CDI_UNDEFID; + streamptr->accessmode = 0; + streamptr->filetype = CDI_FILETYPE_UNDEF; + streamptr->byteorder = CDI_UNDEFID; + streamptr->fileID = 0; + streamptr->filemode = 0; + streamptr->numvals = 0; + streamptr->filename = NULL; + streamptr->record = NULL; + streamptr->query = NULL; + streamptr->varsAllocated = 0; + streamptr->nrecs = 0; + streamptr->nvars = 0; + streamptr->vars = NULL; + streamptr->ncmode = 0; + streamptr->curTsID = CDI_UNDEFID; + streamptr->rtsteps = 0; + streamptr->ntsteps = CDI_UNDEFID; + streamptr->maxSteps = CDI_UNDEFID; + streamptr->tsteps = NULL; + streamptr->tstepsTableSize = 0; + streamptr->tstepsNextID = 0; + streamptr->vlistID = CDI_UNDEFID; + streamptr->globalatts = 0; + streamptr->localatts = 0; + streamptr->unreduced = cdiDataUnreduced; + streamptr->sortname = cdiSortName > 0; + streamptr->sortparam = cdiSortParam > 0; + streamptr->have_missval = cdiHaveMissval; + streamptr->comptype = CDI_COMPRESS_NONE; + streamptr->complevel = 0; + // netcdf4/HDF5 filter + streamptr->filterId = 0; + streamptr->numParams = 0; + streamptr->maxParams = sizeof(streamptr->params) / sizeof(streamptr->params[0]); + + basetimeInit(&streamptr->basetime); + +#ifdef HAVE_LIBNETCDF + streamptr->nc_complex_float_id = CDI_UNDEFID; + streamptr->nc_complex_double_id = CDI_UNDEFID; + + for (int i = 0; i < MAX_ZAXES_PS; i++) streamptr->zaxisID[i] = CDI_UNDEFID; + for (int i = 0; i < MAX_ZAXES_PS; i++) streamptr->nczvarID[i] = CDI_UNDEFID; + + for (int i = 0; i < MAX_GRIDS_PS; i++) + { + streamptr->ncgrid[i].start = CDI_UNDEFID; + streamptr->ncgrid[i].count = CDI_UNDEFID; + streamptr->ncgrid[i].gridID = CDI_UNDEFID; + for (size_t j = 0; j < CDF_SIZE_ncIDs; ++j) streamptr->ncgrid[i].ncIDs[j] = CDI_UNDEFID; + } + + streamptr->ncNumDims = 0; + for (int i = 0; i < MAX_DIMS_PS; i++) streamptr->ncDimID[i] = CDI_UNDEFID; + for (int i = 0; i < MAX_DIMS_PS; i++) streamptr->ncDimLen[i] = 0; + + streamptr->vct.ilev = 0; + streamptr->vct.mlev = 0; + streamptr->vct.ilevID = CDI_UNDEFID; + streamptr->vct.mlevID = CDI_UNDEFID; +#endif + + streamptr->gribContainers = NULL; + + streamptr->numWorker = 0; + streamptr->nextGlobalRecId = 0; + streamptr->cachedTsID = -1; + streamptr->jobs = NULL; + streamptr->jobManager = NULL; + + streamptr->protocolData = NULL; +} + +static stream_t * +stream_new_entry(int resH) +{ + cdiInitialize(); /* ***************** make MT version !!! */ + + stream_t *streamptr = (stream_t *) Malloc(sizeof(stream_t)); + streamDefaultValue(streamptr); + + if (resH == CDI_UNDEFID) + streamptr->self = reshPut(streamptr, &streamOps); + else + { + streamptr->self = resH; + reshReplace(resH, streamptr, &streamOps); + } + + return streamptr; +} + +void +cdiStreamCloseDefaultDelegate(stream_t *streamptr, int recordBufIsToBeDeleted) +{ + int fileID = streamptr->fileID; + int filetype = streamptr->filetype; + + switch (streamptr->protocol) + { + case CDI_PROTOCOL_ACROSS: +#ifdef HAVE_ACROSS + if (fileID) across_disconnect(fileID); + if (streamptr->protocolData) + { + Free(((across_info_t *) streamptr->protocolData)->expid); + Free(streamptr->protocolData); + streamptr->protocolData = NULL; + } +#endif + return; + + case CDI_PROTOCOL_FDB: +#ifdef HAVE_LIBFDB5 + if (streamptr->protocolData) fdb_delete_handle(streamptr->protocolData); + streamptr->protocolData = NULL; +#endif + return; + + case CDI_PROTOCOL_OTHER: + case CDI_PROTOCOL_FILE: + // handled below; + break; + } + + if (fileID == CDI_UNDEFID) + { + Warning("File %s not open!", streamptr->filename); + return; + } + + switch (cdiBaseFiletype(filetype)) + { +#if defined(HAVE_LIBGRIB) && (defined(HAVE_LIBCGRIBEX) || defined(HAVE_LIBGRIB_API)) + case CDI_FILETYPE_GRB: + { + gribClose(fileID); + if (recordBufIsToBeDeleted) gribContainersDelete(streamptr); +#ifdef HAVE_LIBCGRIBEX + if (recordBufIsToBeDeleted) cgribexDelete(streamptr->record->objectp); +#endif + break; + } + case CDI_FILETYPE_GRB2: + { + gribClose(fileID); + if (recordBufIsToBeDeleted) gribContainersDelete(streamptr); + break; + } +#endif +#ifdef HAVE_LIBSERVICE + case CDI_FILETYPE_SRV: + { + fileClose(fileID); + if (recordBufIsToBeDeleted) srvDelete(streamptr->record->objectp); + break; + } +#endif +#ifdef HAVE_LIBEXTRA + case CDI_FILETYPE_EXT: + { + fileClose(fileID); + if (recordBufIsToBeDeleted) extDelete(streamptr->record->objectp); + break; + } +#endif +#ifdef HAVE_LIBIEG + case CDI_FILETYPE_IEG: + { + fileClose(fileID); + if (recordBufIsToBeDeleted) iegDelete(streamptr->record->objectp); + break; + } +#endif +#ifdef HAVE_LIBNETCDF + case CDI_FILETYPE_NETCDF: + { + cdfClose(fileID); + if (streamptr->ntsteps == 0 && streamptr->tsteps != NULL) + { + if (streamptr->tsteps[0].records) + { + Free(streamptr->tsteps[0].records); + streamptr->tsteps[0].records = NULL; + } + if (streamptr->tsteps[0].recIDs) + { + Free(streamptr->tsteps[0].recIDs); + streamptr->tsteps[0].recIDs = NULL; + } + } + break; + } +#endif + default: + { + Error("%s support not compiled in (fileID = %d)!", strfiletype(filetype), fileID); + break; + } + } +} + +static void +deallocate_sleveltable_t(sleveltable_t *entry) +{ + if (entry->recordID) Free(entry->recordID); + if (entry->lindex) Free(entry->lindex); + entry->recordID = NULL; + entry->lindex = NULL; +} + +static void +streamDestroy(stream_t *streamptr) +{ + xassert(streamptr); + int vlistID = streamptr->vlistID; + + void (*streamCloseDelegate)(stream_t * streamptr, int recordBufIsToBeDeleted) + = (void (*)(stream_t *, int)) namespaceSwitchGet(NSSWITCH_STREAM_CLOSE_BACKEND).func; + + if (streamptr->filetype != -1) streamCloseDelegate(streamptr, 1); + + if (streamptr->record) + { + if (streamptr->record->buffer) Free(streamptr->record->buffer); + Free(streamptr->record); + } + + streamptr->filetype = 0; + if (streamptr->filename) + { + Free(streamptr->filename); + streamptr->filename = NULL; + } + + for (int index = 0; index < streamptr->nvars; index++) + { + sleveltable_t *pslev = streamptr->vars[index].recordTable; + unsigned nsub = streamptr->vars[index].subtypeSize >= 0 ? (unsigned) streamptr->vars[index].subtypeSize : 0U; + for (size_t isub = 0; isub < nsub; isub++) deallocate_sleveltable_t(pslev + isub); + if (pslev) Free(pslev); + } + Free(streamptr->vars); + streamptr->vars = NULL; + + if (streamptr->tsteps) + { + int maxSteps = streamptr->tstepsNextID; + for (int index = 0; index < maxSteps; ++index) + { + tsteps_t *tstep = &(streamptr->tsteps[index]); +#ifdef HAVE_LIBFDB5 + if (tstep->records && tstep->records->fdbItem) free(tstep->records->fdbItem); +#endif + if (tstep->records) Free(tstep->records); + if (tstep->recIDs) Free(tstep->recIDs); + taxisDestroyKernel(&(tstep->taxis)); + } + + Free(streamptr->tsteps); + } + + if (vlistID != -1) + { + if (streamptr->filemode != 'w' && vlistInqTaxis(vlistID) != -1) taxisDestroy(vlistInqTaxis(vlistID)); + void (*mycdiVlistDestroy_)(int, bool) = (void (*)(int, bool)) namespaceSwitchGet(NSSWITCH_VLIST_DESTROY_).func; + mycdiVlistDestroy_(vlistID, true); + } + + if (streamptr->jobs) free(streamptr->jobs); + if (streamptr->jobManager) AsyncWorker_finalize((AsyncManager *) streamptr->jobManager); + + Free(streamptr); +} + +static void +streamDestroyP(void *streamptr) +{ + streamDestroy((stream_t *) streamptr); +} + +/* +@Function streamClose +@Title Close an open dataset + +@Prototype void streamClose(int streamID) +@Parameter + @Item streamID Stream ID, from a previous call to @fref{streamOpenRead} or @fref{streamOpenWrite}. + +@Description +The function @func{streamClose} closes an open dataset. + +@EndFunction +*/ +void +streamClose(int streamID) +{ + stream_t *streamptr = stream_to_pointer(streamID); + + if (CDI_Debug) Message("streamID = %d filename = %s", streamID, streamptr->filename); + streamDestroy(streamptr); + reshRemove(streamID, &streamOps); + if (CDI_Debug) Message("Removed stream %d from stream list", streamID); +} + +void +cdiStreamSync_(stream_t *streamptr) +{ + int fileID = streamptr->fileID; + int filetype = streamptr->filetype; + int vlistID = streamptr->vlistID; + int nvars = vlistNvars(vlistID); + + if (fileID == CDI_UNDEFID) + Warning("File %s not open!", streamptr->filename); + else if (vlistID == CDI_UNDEFID) + Warning("Vlist undefined for file %s!", streamptr->filename); + else if (nvars == 0) + Warning("No variables defined!"); + else + { + if (streamptr->filemode == 'w' || streamptr->filemode == 'a') + { + switch (cdiBaseFiletype(filetype)) + { +#ifdef HAVE_LIBNETCDF + case CDI_FILETYPE_NETCDF: + { + void cdf_sync(int ncid); + if (streamptr->ncmode == 2) cdf_sync(fileID); + break; + } +#endif + default: + { + fileFlush(fileID); + break; + } + } + } + } +} + +/* +@Function streamSync +@Title Synchronize an Open Dataset to Disk + +@Prototype void streamSync(int streamID) +@Parameter + @Item streamID Stream ID, from a previous call to @fref{streamOpenWrite}. + +@Description +The function @func{streamSync} offers a way to synchronize the disk copy of a dataset with in-memory buffers. + +@EndFunction +*/ +void +streamSync(int streamID) +{ + stream_t *streamptr = stream_to_pointer(streamID); + + void (*myStreamSync_)(stream_t * streamptr) = (void (*)(stream_t *)) namespaceSwitchGet(NSSWITCH_STREAM_SYNC).func; + myStreamSync_(streamptr); +} + +int +cdiStreamDefTimestep_(stream_t *streamptr, int tsID) +{ + stream_check_ptr(__func__, streamptr); + + if (CDI_Debug) Message("streamID = %d tsID = %d", streamptr->self, tsID); + + int vlistID = streamptr->vlistID; + if (vlistID == CDI_UNDEFID) + Error("Must not call streamDefTimestep for stream (ID=%d)" + " with (not yet) defined vlist", + streamptr->self); + + int timeIsVarying = vlistHasTime(vlistID); + int taxisID = vlistInqTaxis(vlistID); + + /* moved to cdiStreamSetupVlist + int taxisID = timeIsVarying ? vlistInqTaxis(vlistID) : CDI_UNDEFID; + if (timeIsVarying) + { + if (taxisID == CDI_UNDEFID) + { + Warning("taxisID undefined for fileID = %d! Using absolute time axis.", streamptr->self); + taxisID = taxisCreate(TAXIS_ABSOLUTE); + vlistDefTaxis(vlistID, taxisID); + } + } + */ + if (tsID > 0) + { + int newtsID = tstepsNewEntry(streamptr); + if (tsID != newtsID) Error("Internal problem: tsID = %d newtsID = %d", tsID, newtsID); + } + + if (timeIsVarying) ptaxisCopy(&streamptr->tsteps[tsID].taxis, taxisPtr(taxisID)); + + streamptr->curTsID = tsID; + streamptr->ntsteps = tsID + 1; + +#ifdef HAVE_LIBNETCDF + if (cdiBaseFiletype(streamptr->filetype) == CDI_FILETYPE_NETCDF && timeIsVarying) + { + /* usually points to cdfDefTimestep in serial mode but + * to cdiPioCdfDefTimestep on servers and to a null-op on + * clients in client/server mode */ + void (*myCdfDefTimestep)(stream_t * streamptr, int tsID, size_t) + = (void (*)(stream_t *, int, size_t)) namespaceSwitchGet(NSSWITCH_CDF_DEF_TIMESTEP).func; + myCdfDefTimestep(streamptr, tsID, 1); + } +#endif + + cdi_create_records(streamptr, tsID); + + return (int) streamptr->ntsteps; +} + +/* +@Function streamDefTimestep +@Title Define a timestep + +@Prototype int streamDefTimestep(int streamID, int tsID) +@Parameter + @Item streamID Stream ID, from a previous call to @fref{streamOpenWrite}. + @Item tsID Timestep identifier. + +@Description +The function @func{streamDefTimestep} defines a timestep of a stream by the identifier tsID. +The identifier tsID is the timestep index starting at 0 for the first timestep. +Before calling this function the functions @func{taxisDefVdate} and @func{taxisDefVtime} should be used +to define the timestamp for this timestep. All calls to write the data refer to this timestep. + +@Result +@func{streamDefTimestep} returns the number of expected records of the timestep. + +@EndFunction +*/ +int +streamDefTimestep(int streamID, int tsID) +{ + stream_t *streamptr = stream_to_pointer(streamID); + int (*myStreamDefTimestep_)(stream_t * streamptr, int tsID) + = (int (*)(stream_t *, int)) namespaceSwitchGet(NSSWITCH_STREAM_DEF_TIMESTEP_).func; + return myStreamDefTimestep_(streamptr, tsID); +} + +int +streamInqCurTimestepID(int streamID) +{ + stream_t *streamptr = stream_to_pointer(streamID); + return streamptr->curTsID; +} + +/* +@Function streamInqTimestep +@Title Get timestep information + +@Prototype int streamInqTimestep(int streamID, int tsID) +@Parameter + @Item streamID Stream ID, from a previous call to @fref{streamOpenRead} or @fref{streamOpenWrite}. + @Item tsID Timestep identifier. + +@Description +The function @func{streamInqTimestep} sets the next timestep to the identifier tsID. +The identifier tsID is the timestep index starting at 0 for the first timestep. +After a call to this function the functions @func{taxisInqVdate} and @func{taxisInqVtime} can be used +to read the timestamp for this timestep. All calls to read the data refer to this timestep. + +@Result +@func{streamInqTimestep} returns the number of records of the timestep or 0, if the end of the file is reached. + +@EndFunction +*/ +int +streamInqTimestep(int streamID, int tsID) +{ + int nrecs = 0; + stream_t *streamptr = stream_to_pointer(streamID); + int vlistID = streamptr->vlistID; + + if (tsID < streamptr->ntsteps) streamptr->tsteps[tsID].curRecID = CDI_UNDEFID; // fix for netCDF + if (tsID < streamptr->rtsteps) + { + streamptr->curTsID = tsID; + nrecs = streamptr->tsteps[tsID].nrecs; + streamptr->tsteps[tsID].curRecID = CDI_UNDEFID; + int taxisID = vlistInqTaxis(vlistID); + if (taxisID == -1) Error("Timestep undefined for fileID = %d", streamID); + ptaxisCopy(taxisPtr(taxisID), &streamptr->tsteps[tsID].taxis); + + return nrecs; + } + + if (tsID >= streamptr->ntsteps && streamptr->ntsteps != CDI_UNDEFID) return 0; + + int filetype = streamptr->filetype; + + if (CDI_Debug) Message("streamID = %d tsID = %d filetype = %d", streamID, tsID, filetype); + + switch (cdiBaseFiletype(filetype)) + { +#ifdef HAVE_LIBGRIB + case CDI_FILETYPE_GRB: + case CDI_FILETYPE_GRB2: + { + switch (streamptr->protocol) + { + case CDI_PROTOCOL_FDB: nrecs = fdbInqTimestep(streamptr, tsID); break; + + case CDI_PROTOCOL_ACROSS: // TODO read from ACROSS + case CDI_PROTOCOL_OTHER: + case CDI_PROTOCOL_FILE: nrecs = grbInqTimestep(streamptr, tsID); break; + } + break; + } +#endif +#ifdef HAVE_LIBSERVICE + case CDI_FILETYPE_SRV: + { + nrecs = srvInqTimestep(streamptr, tsID); + break; + } +#endif +#ifdef HAVE_LIBEXTRA + case CDI_FILETYPE_EXT: + { + nrecs = extInqTimestep(streamptr, tsID); + break; + } +#endif +#ifdef HAVE_LIBIEG + case CDI_FILETYPE_IEG: + { + nrecs = iegInqTimestep(streamptr, tsID); + break; + } +#endif +#ifdef HAVE_LIBNETCDF + case CDI_FILETYPE_NETCDF: + { + nrecs = cdfInqTimestep(streamptr, tsID); + break; + } +#endif + default: + { + Error("%s support not compiled in!", strfiletype(filetype)); + break; + } + } + + int taxisID = vlistInqTaxis(vlistID); + if (taxisID == -1) Error("Timestep undefined for fileID = %d", streamID); + + ptaxisCopy(taxisPtr(taxisID), &streamptr->tsteps[tsID].taxis); + + return nrecs; +} + +// This function is used in CDO! +SizeType +streamNvals(int streamID) +{ + stream_t *streamptr = stream_to_pointer(streamID); + return streamptr->numvals; +} + +/* +@Function streamDefVlist +@Title Define the variable list + +@Prototype void streamDefVlist(int streamID, int vlistID) +@Parameter + @Item streamID Stream ID, from a previous call to @fref{streamOpenWrite}. + @Item vlistID Variable list ID, from a previous call to @fref{vlistCreate}. + +@Description +The function @func{streamDefVlist} defines the variable list of a stream. + +To safeguard against errors by modifying the wrong vlist object, +this function makes the passed vlist object immutable. +All further vlist changes have to use the vlist object returned by streamInqVlist(). + +@EndFunction +*/ +void +streamDefVlist(int streamID, int vlistID) +{ + void (*myStreamDefVlist)(int streamID, int vlistID) = (void (*)(int, int)) namespaceSwitchGet(NSSWITCH_STREAM_DEF_VLIST_).func; + myStreamDefVlist(streamID, vlistID); +} + +// The single image implementation of streamDefVlist +void +cdiStreamDefVlist_(int streamID, int vlistID) +{ + stream_t *streamptr = stream_to_pointer(streamID); + + if (streamptr->vlistID == CDI_UNDEFID) + { + int vlistCopy = vlistDuplicate(vlistID); + cdiVlistMakeInternal(vlistCopy); + cdiVlistMakeImmutable(vlistID); + cdiStreamSetupVlist(streamptr, vlistCopy); + } + else + Warning("vlist already defined for %s!", streamptr->filename); +} + +/* +@Function streamInqVlist +@Title Get the variable list + +@Prototype int streamInqVlist(int streamID) +@Parameter + @Item streamID Stream ID, from a previous call to @fref{streamOpenRead} or @fref{streamOpenWrite}. + +@Description +The function @func{streamInqVlist} returns the variable list of a stream. + +@Result +@func{streamInqVlist} returns an identifier to the variable list. + +@EndFunction +*/ +int +streamInqVlist(int streamID) +{ + stream_t *s = stream_to_pointer(streamID); + return s->vlistID; +} + +void +streamDefFilter(int streamID, int filterId, int numParams, const int *params) +{ + stream_t *s = stream_to_pointer(streamID); + if ((int) s->filterId != filterId) + { + if (numParams > (int) s->maxParams) Error("Too many filter parameter %d (max=%zu)!", numParams, s->maxParams); + s->filterId = filterId; + s->numParams = numParams; + for (int i = 0; i < numParams; ++i) s->params[i] = params[i]; + reshSetStatus(streamID, &streamOps, RESH_DESYNC_IN_USE); + } +} + +void +streamDefCompType(int streamID, int comptype) +{ + stream_t *s = stream_to_pointer(streamID); + if (s->comptype != comptype) + { + s->comptype = comptype; + reshSetStatus(streamID, &streamOps, RESH_DESYNC_IN_USE); + } +} + +void +streamDefCompLevel(int streamID, int complevel) +{ + stream_t *s = stream_to_pointer(streamID); + if (s->complevel != complevel) + { + s->complevel = complevel; + reshSetStatus(streamID, &streamOps, RESH_DESYNC_IN_USE); + } +} + +int +streamInqCompType(int streamID) +{ + stream_t *s = stream_to_pointer(streamID); + return s->comptype; +} + +int +streamInqCompLevel(int streamID) +{ + stream_t *s = stream_to_pointer(streamID); + return s->complevel; +} + +int +streamInqFileID(int streamID) +{ + stream_t *s = (stream_t *) reshGetVal(streamID, &streamOps); + return s->fileID; +} + +void +cdiDefAccesstype(int streamID, int type) +{ + stream_t *s = (stream_t *) reshGetVal(streamID, &streamOps); + + if (s->accesstype == CDI_UNDEFID) + { + s->accesstype = type; + } + else if (s->accesstype != type) + Error("Changing access type from %s not allowed!", s->accesstype == TYPE_REC ? "REC to VAR" : "VAR to REC"); +} + +int +cdiInqAccesstype(int streamID) +{ + stream_t *s = (stream_t *) reshGetVal(streamID, &streamOps); + return s->accesstype; +} + +static int +streamTxCode(void *s) +{ + (void) s; + return STREAM; +} + +void +cdiStreamSetupVlist(stream_t *s, int vlistID) +{ + void (*myStreamSetupVlist)(stream_t * s, int vlistID) + = (void (*)(stream_t *, int)) namespaceSwitchGet(NSSWITCH_STREAM_SETUP_VLIST).func; + myStreamSetupVlist(s, vlistID); +} + +void +cdiStreamSetupVlist_(stream_t *streamptr, int vlistID) +{ + streamptr->vlistID = vlistID; + int nvars = vlistNvars(vlistID); + for (int varID = 0; varID < nvars; ++varID) + { + int gridID = vlistInqVarGrid(vlistID, varID); + int zaxisID = vlistInqVarZaxis(vlistID, varID); + int tilesetID = vlistInqVarSubtype(vlistID, varID); + stream_new_var(streamptr, gridID, zaxisID, tilesetID); + if (streamptr->have_missval) vlistDefVarMissval(vlistID, varID, vlistInqVarMissval(vlistID, varID)); + } + + if (streamptr->filemode == 'w') + { + tstepsNewEntry(streamptr); // timestep 0 + int vlistIDw = streamptr->vlistID; + int timeIsVarying = vlistHasTime(vlistIDw); + if (timeIsVarying) + { + int taxisID = vlistInqTaxis(vlistIDw); + if (taxisID == CDI_UNDEFID) + { + Warning("taxisID undefined for fileID = %d! Using absolute time axis.", streamptr->self); + taxisID = taxisCreate(TAXIS_ABSOLUTE); + vlistDefTaxis(vlistIDw, taxisID); + } + +#ifdef HAVE_LIBNETCDF + if (taxisInqType(taxisID) == TAXIS_RELATIVE) + if (cdiBaseFiletype(streamptr->filetype) == CDI_FILETYPE_NETCDF) + { + const taxis_t *taxisptr = taxisPtr(taxisID); + if (cdiDateTime_isNull(taxisptr->rDateTime)) + { + int vdate = taxisInqVdate(taxisID); + if (vdate == 0) vdate = 10101; + taxisDefRdate(taxisID, vdate); + } + } +#endif + ptaxisCopy(&streamptr->tsteps[0].taxis, taxisPtr(taxisID)); + } + + switch (cdiBaseFiletype(streamptr->filetype)) + { +#ifdef HAVE_LIBNETCDF + case CDI_FILETYPE_NETCDF: + { + /* calls cdfDefCoordinateVars in serial mode but + * cdiPioClientStreamNOP (i.e. nothing) on client ranks + * and cdiPioServerCdfDefVars on server ranks in parallel mode*/ + void (*myCdfDefVars)(stream_t * streamptr) = (void (*)(stream_t *)) namespaceSwitchGet(NSSWITCH_CDF_STREAM_SETUP).func; + myCdfDefVars(streamptr); + } + break; +#endif +#ifdef HAVE_LIBGRIB + case CDI_FILETYPE_GRB: + case CDI_FILETYPE_GRB2: gribContainersNew(streamptr); break; +#endif + default:; + } + } +} + +void +cdiStreamGetIndexList(unsigned numIDs, int *IDs) +{ + reshGetResHListOfType(numIDs, IDs, &streamOps); +} + +int +streamInqNvars(int streamID) +{ + stream_t *s = (stream_t *) reshGetVal(streamID, &streamOps); + return s->nvars; +} + +static int +streamCompareP(void *streamptr1, void *streamptr2) +{ + stream_t *s1 = (stream_t *) streamptr1; + stream_t *s2 = (stream_t *) streamptr2; + enum + { + differ = -1, + equal = 0, + }; + + xassert(s1); + xassert(s2); + + if (s1->filetype != s2->filetype) return differ; + if (s1->byteorder != s2->byteorder) return differ; + if (s1->comptype != s2->comptype) return differ; + if (s1->complevel != s2->complevel) return differ; + + if (s1->filename) + { + if (!str_is_equal(s1->filename, s2->filename)) return differ; + } + else if (s2->filename) + return differ; + + return equal; +} + +void +streamPrintP(void *streamptr, FILE *fp) +{ + stream_t *sp = (stream_t *) streamptr; + + if (!sp) return; + + fprintf(fp, + "#\n" + "# streamID %d\n" + "#\n" + "self = %d\n" + "accesstype = %d\n" + "accessmode = %d\n" + "filetype = %d\n" + "byteorder = %d\n" + "fileID = %d\n" + "filemode = %d\n" + "filename = %s\n" + "nrecs = %d\n" + "nvars = %d\n" + "varsAllocated = %d\n" + "curTsID = %d\n" + "rtsteps = %d\n" + "ntsteps = %ld\n" + "tstepsTableSize= %d\n" + "tstepsNextID = %d\n" + "ncmode = %d\n" + "vlistID = %d\n" + "globalatts = %d\n" + "localatts = %d\n" + "unreduced = %d\n" + "sortname = %d\n" + "have_missval = %d\n" + "ztype = %d\n" + "zlevel = %d\n", + sp->self, sp->self, sp->accesstype, sp->accessmode, sp->filetype, sp->byteorder, sp->fileID, sp->filemode, sp->filename, + sp->nrecs, sp->nvars, sp->varsAllocated, sp->curTsID, sp->rtsteps, sp->ntsteps, sp->tstepsTableSize, sp->tstepsNextID, + sp->ncmode, sp->vlistID, sp->globalatts, sp->localatts, sp->unreduced, sp->sortname, sp->have_missval, sp->comptype, + sp->complevel); +} + +enum +{ + streamNint = 10, +}; + +static int +streamGetPackSize(void *voidP, void *context) +{ + stream_t *streamP = (stream_t *) voidP; + int packBufferSize = serializeGetSize(streamNint, CDI_DATATYPE_INT, context) + serializeGetSize(2, CDI_DATATYPE_UINT32, context) + + serializeGetSize((int) strlen(streamP->filename) + 1, CDI_DATATYPE_TXT, context) + + serializeGetSize(1, CDI_DATATYPE_FLT64, context); + return packBufferSize; +} + +static void +streamPack(void *streamptr, void *packBuffer, int packBufferSize, int *packBufferPos, void *context) +{ + stream_t *streamP = (stream_t *) streamptr; + int intBuffer[streamNint]; + + intBuffer[0] = streamP->self; + intBuffer[1] = streamP->filetype; + intBuffer[2] = (int) strlen(streamP->filename) + 1; + intBuffer[3] = streamP->vlistID; + intBuffer[4] = streamP->byteorder; + intBuffer[5] = streamP->comptype; + intBuffer[6] = streamP->complevel; + intBuffer[7] = streamP->unreduced; + intBuffer[8] = streamP->sortname; + intBuffer[9] = streamP->have_missval; + + serializePack(intBuffer, streamNint, CDI_DATATYPE_INT, packBuffer, packBufferSize, packBufferPos, context); + uint32_t d = cdiCheckSum(CDI_DATATYPE_INT, streamNint, intBuffer); + serializePack(&d, 1, CDI_DATATYPE_UINT32, packBuffer, packBufferSize, packBufferPos, context); + + serializePack(&CDI_Default_Missval, 1, CDI_DATATYPE_FLT64, packBuffer, packBufferSize, packBufferPos, context); + serializePack(streamP->filename, intBuffer[2], CDI_DATATYPE_TXT, packBuffer, packBufferSize, packBufferPos, context); + d = cdiCheckSum(CDI_DATATYPE_TXT, intBuffer[2], streamP->filename); + serializePack(&d, 1, CDI_DATATYPE_UINT32, packBuffer, packBufferSize, packBufferPos, context); +} + +struct streamAssoc +streamUnpack(char *unpackBuffer, int unpackBufferSize, int *unpackBufferPos, int originNamespace, void *context) +{ + int intBuffer[streamNint]; + uint32_t d; + char filename[CDI_MAX_NAME]; + + serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, intBuffer, streamNint, CDI_DATATYPE_INT, context); + serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, &d, 1, CDI_DATATYPE_UINT32, context); + xassert(cdiCheckSum(CDI_DATATYPE_INT, streamNint, intBuffer) == d); + + serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, &CDI_Default_Missval, 1, CDI_DATATYPE_FLT64, context); + serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, &filename, intBuffer[2], CDI_DATATYPE_TXT, context); + serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, &d, 1, CDI_DATATYPE_UINT32, context); + xassert(d == cdiCheckSum(CDI_DATATYPE_TXT, intBuffer[2], filename)); + int targetStreamID = namespaceAdaptKey(intBuffer[0], originNamespace), + streamID = streamOpenID(filename, 'w', intBuffer[1], targetStreamID); + xassert(streamID >= 0 && targetStreamID == streamID); + streamDefByteorder(streamID, intBuffer[4]); + streamDefCompType(streamID, intBuffer[5]); + streamDefCompLevel(streamID, intBuffer[6]); + stream_t *streamptr = stream_to_pointer(streamID); + streamptr->unreduced = intBuffer[7]; + streamptr->sortname = intBuffer[8]; + streamptr->have_missval = intBuffer[9]; + struct streamAssoc retval = { streamID, intBuffer[3] }; + return retval; +} + +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifdef HAVE_CONFIG_H +#endif + + +// the single image implementation +int +cdiStreamWriteVar_(int streamID, int varID, int memtype, const void *data, SizeType nmiss) +{ + // May fail if memtype == MEMTYPE_FLOAT and the file format does not support single precision writing. + // A value > 0 is returned in this case, otherwise it returns zero. + int status = 0; + + if (CDI_Debug) Message("streamID = %d varID = %d", streamID, varID); + + check_parg(data); + + stream_t *streamptr = stream_to_pointer(streamID); + if (subtypeInqActiveIndex(streamptr->vars[varID].subtypeID) != 0) Error("Writing of non-trivial subtypes not yet implemented!"); + + // check taxis + if (streamptr->curTsID == CDI_UNDEFID) streamDefTimestep(streamID, 0); + + const int filetype = streamptr->filetype; + + if (memtype == MEMTYPE_FLOAT && cdiFiletypeIsExse(filetype)) return 1; + + switch (cdiBaseFiletype(filetype)) + { +#ifdef HAVE_LIBGRIB + case CDI_FILETYPE_GRB: + case CDI_FILETYPE_GRB2: grb_write_var(streamptr, varID, memtype, data, nmiss); break; +#endif +#ifdef HAVE_LIBSERVICE + case CDI_FILETYPE_SRV: srvWriteVarDP(streamptr, varID, (double *) data); break; +#endif +#ifdef HAVE_LIBEXTRA + case CDI_FILETYPE_EXT: extWriteVarDP(streamptr, varID, (double *) data); break; +#endif +#ifdef HAVE_LIBIEG + case CDI_FILETYPE_IEG: iegWriteVarDP(streamptr, varID, (double *) data); break; +#endif +#ifdef HAVE_LIBNETCDF + case CDI_FILETYPE_NETCDF: cdf_write_var(streamptr, varID, memtype, data, nmiss); break; +#endif + default: Error("%s support not compiled in!", strfiletype(filetype)); + } + + return status; +} + +/* +@Function streamWriteVar +@Title Write a variable + +@Prototype void streamWriteVar(int streamID, int varID, const double *data, SizeType nmiss) +@Parameter + @Item streamID Stream ID, from a previous call to @fref{streamOpenWrite}. + @Item varID Variable identifier. + @Item data Pointer to a block of double precision floating point data values to be written. + @Item nmiss Number of missing values. + +@Description +The function streamWriteVar writes the values of one time step of a variable to an open dataset. +The values are converted to the external data type of the variable, if necessary. +@EndFunction +*/ +void +streamWriteVar(int streamID, int varID, const double *data, SizeType nmiss) +{ + void (*myCdiStreamWriteVar_)(int streamID, int varID, int memtype, const void *data, SizeType nmiss) + = (void (*)(int, int, int, const void *, SizeType)) namespaceSwitchGet(NSSWITCH_STREAM_WRITE_VAR_).func; + + myCdiStreamWriteVar_(streamID, varID, MEMTYPE_DOUBLE, (const void *) data, nmiss); +} + +/* +@Function streamWriteVarF +@Title Write a variable + +@Prototype void streamWriteVarF(int streamID, int varID, const float *data, SizeType nmiss) +@Parameter + @Item streamID Stream ID, from a previous call to @fref{streamOpenWrite}. + @Item varID Variable identifier. + @Item data Pointer to a block of single precision floating point data values to be written. + @Item nmiss Number of missing values. + +@Description +The function streamWriteVarF writes the values of one time step of a variable to an open dataset. +The values are converted to the external data type of the variable, if necessary. +@EndFunction +*/ +void +streamWriteVarF(int streamID, int varID, const float *data, SizeType nmiss) +{ + int (*myCdiStreamWriteVar_)(int streamID, int varID, int memtype, const void *data, SizeType nmiss) + = (int (*)(int, int, int, const void *, SizeType)) namespaceSwitchGet(NSSWITCH_STREAM_WRITE_VAR_).func; + + if (myCdiStreamWriteVar_(streamID, varID, MEMTYPE_FLOAT, (const void *) data, nmiss)) + { + // In case the file format does not support single precision writing, + // we fall back to double precision writing, converting the data on the fly. + const int vlistID = streamInqVlist(streamID); + SizeType elementCount = gridInqSize(vlistInqVarGrid(vlistID, varID)); + elementCount *= (SizeType) zaxisInqSize(vlistInqVarZaxis(vlistID, varID)); + double *conversionBuffer = (double *) Malloc(elementCount * sizeof(*conversionBuffer)); + for (SizeType i = elementCount; i--;) conversionBuffer[i] = (double) data[i]; + myCdiStreamWriteVar_(streamID, varID, MEMTYPE_DOUBLE, (const void *) conversionBuffer, nmiss); + Free(conversionBuffer); + } +} + +static int +cdiStreamWriteVarSlice(int streamID, int varID, int levelID, int memtype, const void *data, SizeType nmiss) +{ + // May fail if memtype == MEMTYPE_FLOAT and the file format does not support single precision writing. + // A value > 0 is returned in this case, otherwise it returns zero. + int status = 0; + + if (CDI_Debug) Message("streamID = %d varID = %d", streamID, varID); + + check_parg(data); + + stream_t *streamptr = stream_to_pointer(streamID); + if (subtypeInqActiveIndex(streamptr->vars[varID].subtypeID) != 0) Error("Writing of non-trivial subtypes not yet implemented!"); + + // check taxis + if (streamptr->curTsID == CDI_UNDEFID) streamDefTimestep(streamID, 0); + + const int filetype = streamptr->filetype; + + if (memtype == MEMTYPE_FLOAT && cdiFiletypeIsExse(filetype)) return 1; + + switch (cdiBaseFiletype(filetype)) + { +#ifdef HAVE_LIBGRIB + case CDI_FILETYPE_GRB: + case CDI_FILETYPE_GRB2: grb_write_var_slice(streamptr, varID, levelID, memtype, data, nmiss); break; +#endif +#ifdef HAVE_LIBSERVICE + case CDI_FILETYPE_SRV: srvWriteVarSliceDP(streamptr, varID, levelID, (double *) data); break; +#endif +#ifdef HAVE_LIBEXTRA + case CDI_FILETYPE_EXT: extWriteVarSliceDP(streamptr, varID, levelID, (double *) data); break; +#endif +#ifdef HAVE_LIBIEG + case CDI_FILETYPE_IEG: iegWriteVarSliceDP(streamptr, varID, levelID, (double *) data); break; +#endif +#ifdef HAVE_LIBNETCDF + case CDI_FILETYPE_NETCDF: cdf_write_var_slice(streamptr, varID, levelID, memtype, data, nmiss); break; +#endif + default: Error("%s support not compiled in!", strfiletype(filetype)); + } + + return status; +} + +/* +@Function streamWriteVarSlice +@Title Write a horizontal slice of a variable + +@Prototype void streamWriteVarSlice(int streamID, int varID, int levelID, const double *data, SizeType nmiss) +@Parameter + @Item streamID Stream ID, from a previous call to @fref{streamOpenWrite}. + @Item varID Variable identifier. + @Item levelID Level identifier. + @Item data Pointer to a block of double precision floating point data values to be written. + @Item nmiss Number of missing values. + +@Description +The function streamWriteVarSlice writes the values of a horizontal slice of a variable to an open dataset. +The values are converted to the external data type of the variable, if necessary. +@EndFunction +*/ +void +streamWriteVarSlice(int streamID, int varID, int levelID, const double *data, SizeType nmiss) +{ + cdiStreamWriteVarSlice(streamID, varID, levelID, MEMTYPE_DOUBLE, (const void *) data, nmiss); +} + +/* +@Function streamWriteVarSliceF +@Title Write a horizontal slice of a variable + +@Prototype void streamWriteVarSliceF(int streamID, int varID, int levelID, const float *data, SizeType nmiss) +@Parameter + @Item streamID Stream ID, from a previous call to @fref{streamOpenWrite}. + @Item varID Variable identifier. + @Item levelID Level identifier. + @Item data Pointer to a block of single precision floating point data values to be written. + @Item nmiss Number of missing values. + +@Description +The function streamWriteVarSliceF writes the values of a horizontal slice of a variable to an open dataset. +The values are converted to the external data type of the variable, if necessary. +@EndFunction +*/ +void +streamWriteVarSliceF(int streamID, int varID, int levelID, const float *data, SizeType nmiss) +{ + if (cdiStreamWriteVarSlice(streamID, varID, levelID, MEMTYPE_FLOAT, (const void *) data, nmiss)) + { + // In case the file format does not support single precision writing, + // we fall back to double precision writing, converting the data on the fly. + const SizeType elementCount = gridInqSize(vlistInqVarGrid(streamInqVlist(streamID), varID)); + double *conversionBuffer = (double *) Malloc(elementCount * sizeof(*conversionBuffer)); + for (SizeType i = elementCount; i--;) conversionBuffer[i] = (double) data[i]; + streamWriteVarSlice(streamID, varID, levelID, conversionBuffer, nmiss); + Free(conversionBuffer); + } +} + +void +streamWriteVarChunk(int streamID, int varID, const int rect[][2], const double *data, SizeType nmiss) +{ + void (*myCdiStreamWriteVarChunk_)(int streamID, int varID, int memtype, const int rect[3][2], const void *data, SizeType nmiss) + = (void (*)(int, int, int, const int[3][2], const void *, SizeType)) namespaceSwitchGet(NSSWITCH_STREAM_WRITE_VAR_CHUNK_) + .func; + myCdiStreamWriteVarChunk_(streamID, varID, MEMTYPE_DOUBLE, rect, data, nmiss); +} + +void +streamWriteVarChunkF(int streamID, int varID, const int rect[][2], const float *data, SizeType nmiss) +{ + void (*myCdiStreamWriteVarChunk_)(int streamID, int varID, int memtype, const int rect[3][2], const void *data, SizeType nmiss) + = (void (*)(int, int, int, const int[3][2], const void *, SizeType)) namespaceSwitchGet(NSSWITCH_STREAM_WRITE_VAR_CHUNK_) + .func; + myCdiStreamWriteVarChunk_(streamID, varID, MEMTYPE_FLOAT, rect, data, nmiss); +} + +// single image implementation +void +cdiStreamWriteVarChunk_(int streamID, int varID, int memtype, const int rect[][2], const void *data, SizeType nmiss) +{ + if (CDI_Debug) Message("streamID = %d varID = %d", streamID, varID); + + stream_t *streamptr = stream_to_pointer(streamID); + + // streamDefineTaxis(streamID); + + const int filetype = streamptr->filetype; + + switch (cdiBaseFiletype(filetype)) + { +#if defined(HAVE_LIBGRIB) + case CDI_FILETYPE_GRB: + case CDI_FILETYPE_GRB2: +#endif +#if defined(HAVE_LIBSERVICE) + case CDI_FILETYPE_SRV: +#endif +#if defined(HAVE_LIBEXTRA) + case CDI_FILETYPE_EXT: +#endif +#if defined(HAVE_LIBIEG) + case CDI_FILETYPE_IEG: +#endif +#if defined(HAVE_LIBGRIB) || defined(HAVE_LIBSERVICE) || defined(HAVE_LIBEXTRA) || defined(HAVE_LIBIEG) + xabort("streamWriteVarChunk not implemented for filetype %s!", strfiletype(filetype)); + break; +#endif +#ifdef HAVE_LIBNETCDF + case CDI_FILETYPE_NETCDF: cdf_write_var_chunk(streamptr, varID, memtype, rect, data, nmiss); break; +#endif + default: Error("%s support not compiled in!", strfiletype(filetype)); break; + } +} + +static void +stream_write_record(int streamID, int memtype, const void *data, SizeType nmiss) +{ + check_parg(data); + + stream_t *streamptr = stream_to_pointer(streamID); + + switch (cdiBaseFiletype(streamptr->filetype)) + { +#ifdef HAVE_LIBGRIB + case CDI_FILETYPE_GRB: + case CDI_FILETYPE_GRB2: grb_write_record(streamptr, memtype, data, nmiss); break; +#endif +#ifdef HAVE_LIBSERVICE + case CDI_FILETYPE_SRV: srv_write_record(streamptr, memtype, data); break; +#endif +#ifdef HAVE_LIBEXTRA + case CDI_FILETYPE_EXT: ext_write_record(streamptr, memtype, data); break; +#endif +#ifdef HAVE_LIBIEG + case CDI_FILETYPE_IEG: ieg_write_record(streamptr, memtype, data); break; +#endif +#ifdef HAVE_LIBNETCDF + case CDI_FILETYPE_NETCDF: cdf_write_record(streamptr, memtype, data, nmiss); break; +#endif + default: Error("%s support not compiled in!", strfiletype(streamptr->filetype)); + } +} + +/* +@Function streamWriteRecord +@Title Write a horizontal slice of a variable + +@Prototype void streamWriteRecord(int streamID, const double *data, SizeType nmiss) +@Parameter + @Item streamID Stream ID, from a previous call to @fref{streamOpenWrite}. + @Item data Pointer to a block of double precision floating point data values to be written. + @Item nmiss Number of missing values. + +@Description +The function streamWriteRecord writes the values of a horizontal slice (record) of a variable to an open dataset. +The values are converted to the external data type of the variable, if necessary. +@EndFunction +*/ +void +streamWriteRecord(int streamID, const double *data, SizeType nmiss) +{ + stream_write_record(streamID, MEMTYPE_DOUBLE, (const void *) data, nmiss); +} + +void +streamWriteRecordF(int streamID, const float *data, SizeType nmiss) +{ + stream_write_record(streamID, MEMTYPE_FLOAT, (const void *) data, nmiss); +} +#ifdef HAVE_CONFIG_H +#endif + + +// the single image implementation +static int +cdiStreamReadVar(int streamID, int varID, int memtype, void *data, size_t *nmiss) +{ + // May fail if memtype == MEMTYPE_FLOAT and the file format does not support single precision reading. + // A value > 0 is returned in this case, otherwise it returns zero. + int status = 0; + + if (CDI_Debug) Message("streamID = %d varID = %d", streamID, varID); + + check_parg(data); + check_parg(nmiss); + + stream_t *streamptr = stream_to_pointer(streamID); + const int filetype = streamptr->filetype; + + *nmiss = 0; + + if (memtype == MEMTYPE_FLOAT && cdiFiletypeIsExse(filetype)) return 1; + + switch (cdiBaseFiletype(filetype)) + { +#ifdef HAVE_LIBGRIB + case CDI_FILETYPE_GRB: + case CDI_FILETYPE_GRB2: grb_read_var(streamptr, varID, memtype, data, nmiss); break; +#endif +#ifdef HAVE_LIBSERVICE + case CDI_FILETYPE_SRV: srvReadVarDP(streamptr, varID, (double *) data, nmiss); break; +#endif +#ifdef HAVE_LIBEXTRA + case CDI_FILETYPE_EXT: extReadVarDP(streamptr, varID, (double *) data, nmiss); break; +#endif +#ifdef HAVE_LIBIEG + case CDI_FILETYPE_IEG: iegReadVarDP(streamptr, varID, (double *) data, nmiss); break; +#endif +#ifdef HAVE_LIBNETCDF + case CDI_FILETYPE_NETCDF: cdf_read_var(streamptr, varID, memtype, data, nmiss); break; +#endif + default: Error("%s support not compiled in!", strfiletype(filetype)); + } + + return status; +} + +/* +@Function streamReadVar +@Title Read a variable + +@Prototype void streamReadVar(int streamID, int varID, double *data, SizeType *nmiss) +@Parameter + @Item streamID Stream ID, from a previous call to @fref{streamOpenRead}. + @Item varID Variable identifier. + @Item data Pointer to the location into which the data values are read. + The caller must allocate space for the returned values. + @Item nmiss Number of missing values. + +@Description +The function streamReadVar reads all the values of one time step of a variable +from an open dataset. +@EndFunction +*/ +void +streamReadVar(int streamID, int varID, double *data, SizeType *nmiss) +{ + size_t numMiss = 0; + cdiStreamReadVar(streamID, varID, MEMTYPE_DOUBLE, data, &numMiss); + *nmiss = (SizeType) numMiss; +} + +/* +@Function streamReadVarF +@Title Read a variable + +@Prototype void streamReadVar(int streamID, int varID, float *data, SizeType *nmiss) +@Parameter + @Item streamID Stream ID, from a previous call to @fref{streamOpenRead}. + @Item varID Variable identifier. + @Item data Pointer to the location into which the data values are read. + The caller must allocate space for the returned values. + @Item nmiss Number of missing values. + +@Description +The function streamReadVar reads all the values of one time step of a variable +from an open dataset. +@EndFunction +*/ +void +streamReadVarF(int streamID, int varID, float *data, SizeType *nmiss) +{ + size_t numMiss = 0; + if (cdiStreamReadVar(streamID, varID, MEMTYPE_FLOAT, data, &numMiss)) + { + // In case the file format does not support single precision reading, + // we fall back to double precision reading, converting the data on the fly. + size_t elementCount = gridInqSize(vlistInqVarGrid(streamInqVlist(streamID), varID)); + elementCount *= (size_t) zaxisInqSize(vlistInqVarZaxis(streamInqVlist(streamID), varID)); + double *conversionBuffer = (double *) Malloc(elementCount * sizeof(*conversionBuffer)); + streamReadVar(streamID, varID, conversionBuffer, nmiss); + for (size_t i = elementCount; i--;) data[i] = (float) conversionBuffer[i]; + Free(conversionBuffer); + } + *nmiss = (SizeType) numMiss; +} + +static int +cdiStreamReadVarSlice(int streamID, int varID, int levelID, int memtype, void *data, size_t *nmiss) +{ + // May fail if memtype == MEMTYPE_FLOAT and the file format does not support single precision reading. + // A value > 0 is returned in this case, otherwise it returns zero. + int status = 0; + + if (CDI_Debug) Message("streamID = %d varID = %d", streamID, varID); + + check_parg(data); + check_parg(nmiss); + + stream_t *streamptr = stream_to_pointer(streamID); + const int filetype = streamptr->filetype; + + *nmiss = 0; + + if (memtype == MEMTYPE_FLOAT && cdiFiletypeIsExse(filetype)) return 1; + + switch (cdiBaseFiletype(filetype)) + { +#ifdef HAVE_LIBGRIB + case CDI_FILETYPE_GRB: + case CDI_FILETYPE_GRB2: grb_read_var_slice(streamptr, varID, levelID, memtype, data, nmiss); break; +#endif +#ifdef HAVE_LIBSERVICE + case CDI_FILETYPE_SRV: srvReadVarSliceDP(streamptr, varID, levelID, (double *) data, nmiss); break; +#endif +#ifdef HAVE_LIBEXTRA + case CDI_FILETYPE_EXT: extReadVarSliceDP(streamptr, varID, levelID, (double *) data, nmiss); break; +#endif +#ifdef HAVE_LIBIEG + case CDI_FILETYPE_IEG: iegReadVarSliceDP(streamptr, varID, levelID, (double *) data, nmiss); break; +#endif +#ifdef HAVE_LIBNETCDF + case CDI_FILETYPE_NETCDF: cdf_read_var_slice(streamptr, varID, levelID, memtype, data, nmiss); break; +#endif + default: Error("%s support not compiled in!", strfiletype(filetype)); + } + + return status; +} + +/* +@Function streamReadVarSlice +@Title Read a horizontal slice of a variable + +@Prototype void streamReadVarSlice(int streamID, int varID, int levelID, double *data, SizeType *nmiss) +@Parameter + @Item streamID Stream ID, from a previous call to @fref{streamOpenRead}. + @Item varID Variable identifier. + @Item levelID Level identifier. + @Item data Pointer to the location into which the data values are read. + The caller must allocate space for the returned values. + @Item nmiss Number of missing values. + +@Description +The function streamReadVarSlice reads all the values of a horizontal slice of a variable +from an open dataset. +@EndFunction +*/ +void +streamReadVarSlice(int streamID, int varID, int levelID, double *data, SizeType *nmiss) +{ + size_t numMiss = 0; + if (cdiStreamReadVarSlice(streamID, varID, levelID, MEMTYPE_DOUBLE, data, &numMiss)) + { + Warning("Unexpected error returned from cdiStreamReadVarSlice()!"); + size_t elementCount = gridInqSize(vlistInqVarGrid(streamInqVlist(streamID), varID)); + memset(data, 0, elementCount * sizeof(*data)); + } + *nmiss = (SizeType) numMiss; +} + +/* +@Function streamReadVarSliceF +@Title Read a horizontal slice of a variable + +@Prototype void streamReadVarSliceF(int streamID, int varID, int levelID, float *data, SizeType *nmiss) +@Parameter + @Item streamID Stream ID, from a previous call to @fref{streamOpenRead}. + @Item varID Variable identifier. + @Item levelID Level identifier. + @Item data Pointer to the location into which the data values are read. + The caller must allocate space for the returned values. + @Item nmiss Number of missing values. + +@Description +The function streamReadVarSliceF reads all the values of a horizontal slice of a variable +from an open dataset. +@EndFunction +*/ +void +streamReadVarSliceF(int streamID, int varID, int levelID, float *data, SizeType *nmiss) +{ + size_t numMiss = 0; + if (cdiStreamReadVarSlice(streamID, varID, levelID, MEMTYPE_FLOAT, data, &numMiss)) + { + // In case the file format does not support single precision reading, + // we fall back to double precision reading, converting the data on the fly. + size_t elementCount = gridInqSize(vlistInqVarGrid(streamInqVlist(streamID), varID)); + double *conversionBuffer = (double *) Malloc(elementCount * sizeof(*conversionBuffer)); + streamReadVarSlice(streamID, varID, levelID, conversionBuffer, nmiss); + for (size_t i = elementCount; i--;) data[i] = (float) conversionBuffer[i]; + Free(conversionBuffer); + } + *nmiss = (SizeType) numMiss; +} + +static void +stream_read_record(int streamID, int memtype, void *data, size_t *nmiss) +{ + check_parg(data); + check_parg(nmiss); + + stream_t *streamptr = stream_to_pointer(streamID); + + *nmiss = 0; + + switch (cdiBaseFiletype(streamptr->filetype)) + { +#ifdef HAVE_LIBGRIB + case CDI_FILETYPE_GRB: + case CDI_FILETYPE_GRB2: grb_read_record(streamptr, memtype, data, nmiss); break; +#endif +#ifdef HAVE_LIBSERVICE + case CDI_FILETYPE_SRV: srv_read_record(streamptr, memtype, data, nmiss); break; +#endif +#ifdef HAVE_LIBEXTRA + case CDI_FILETYPE_EXT: ext_read_record(streamptr, memtype, data, nmiss); break; +#endif +#ifdef HAVE_LIBIEG + case CDI_FILETYPE_IEG: ieg_read_record(streamptr, memtype, data, nmiss); break; +#endif +#ifdef HAVE_LIBNETCDF + case CDI_FILETYPE_NETCDF: cdf_read_record(streamptr, memtype, data, nmiss); break; +#endif + default: Error("%s support not compiled in!", strfiletype(streamptr->filetype)); + } +} + +void +streamReadRecord(int streamID, double *data, SizeType *nmiss) +{ + size_t numMiss = 0; + stream_read_record(streamID, MEMTYPE_DOUBLE, (void *) data, &numMiss); + *nmiss = (SizeType) numMiss; +} + +void +streamReadRecordF(int streamID, float *data, SizeType *nmiss) +{ + size_t numMiss = 0; + stream_read_record(streamID, MEMTYPE_FLOAT, (void *) data, &numMiss); + *nmiss = (SizeType) numMiss; +} +#ifndef VARSCAN_H +#define VARSCAN_H + +#ifndef GRID_H +#endif + +void varAddRecord(int recID, int param, int gridID, int zaxistype, int lbounds, int level1, int level2, int level_sf, + int level_unit, int prec, int *pvarID, int *plevelID, int tsteptype, int ltype1, int ltype2, const char *name, + const VarScanKeys *scanKeys, const var_tile_t *tiles, int *tile_index); + +void varDefVCT(size_t vctsize, double *vctptr); +void varDefZAxisReference(int nlev, int nvgrid, unsigned char uuid[CDI_UUID_SIZE]); + +int varDefZaxis(int vlistID, int zaxistype, int nlevels, const double *levels, const char **cvals, size_t clength, bool lbounds, + const double *levels1, const double *levels2, int vctsize, const double *vct, char *name, const char *longname, + const char *units, int prec, int mode, int ltype1, int ltype2); + +void varDefMissval(int varID, double missval); +void varDefCompType(int varID, int comptype); +void varDefCompLevel(int varID, int complevel); +void varDefInst(int varID, int instID); +int varInqInst(int varID); +void varDefModel(int varID, int modelID); +int varInqModel(int varID); +void varDefTable(int varID, int tableID); +int varInqTable(int varID); + +void varDefKeyInt(int varID, int key, int value); +void varDefKeyBytes(int varID, int key, const unsigned char *bytes, int length); +void varDefKeyString(int varID, int key, const char *string); + +void varDefOptGribInt(int varID, int tile_index, long lval, const char *keyword); +void varDefOptGribDbl(int varID, int tile_index, double dval, const char *keyword); +int varOptGribNentries(int varID); + +bool zaxis_compare(int zaxisID, int zaxistype, int nlevels, const double *levels, const double *lbounds, const double *ubounds, + const char *longname, const char *units, int ltype1, int ltype2); + +#endif +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifdef HAVE_CONFIG_H +#endif + +#ifdef HAVE_LIBNETCDF + +#include <ctype.h> +#include <limits.h> + + +enum VarStatus +{ + UndefVar = -1, + CoordVar = 0, + DataVar = 1, +}; + +enum AxisType +{ + X_AXIS = 1, + Y_AXIS = 2, + Z_AXIS = 3, + E_AXIS = 4, + T_AXIS = 5, +}; + +typedef struct +{ + int dimid; + int ncvarid; + int dimtype; + size_t len; + char name[CDI_MAX_NAME]; +} ncdim_t; + +#define MAX_COORDVARS 5 +#define MAX_AUXVARS 4 +#define MAX_DIMS_CDF 8 + +typedef struct +{ + int ncid; + int varStatus; + bool ignoreVar; + bool isCubeSphere; + bool isCharAxis; + bool isXaxis; + bool isYaxis; + bool isZaxis; + bool isTaxis; + bool isLon; + bool isLat; + bool isClimatology; + bool hasCalendar; + bool hasFormulaterms; + bool printWarning; + int timetype; + int param; + int code; + int tabnum; + int bounds; + int gridID; + int zaxisID; + int gridtype; + int zaxistype; + int xdim; + int ydim; + int zdim; + int xvarid; + int yvarid; + int rpvarid; + int zvarid; + int tvarid; + int psvarid; + int p0varid; + int ncoordvars; + int cvarids[MAX_COORDVARS]; + int coordvarids[MAX_COORDVARS]; + int auxvarids[MAX_AUXVARS]; + int nauxvars; + int cellarea; + int tableID; + int truncation; + int position; + int numLPE; + bool missvalDefined; + bool fillvalDefined; + int xtype; + int gmapid; + int positive; + int ndims; + int dimids[MAX_DIMS_CDF]; + int dimtype[MAX_DIMS_CDF]; + size_t chunks[MAX_DIMS_CDF]; + bool isChunked; + int chunkType; + int chunkSize; + size_t chunkCacheSize; + size_t chunkCacheNelems; + float chunkCachePreemption; + size_t gridSize; + size_t numLevels; + int natts; + int *atts; + size_t vctsize; + double *vct; + double missval; + double fillval; + double addoffset; + double scalefactor; + bool hasFilter; + bool hasDeflate; + bool hasSzip; + bool isUnsigned; + bool validrangeDefined; + double validrange[2]; + int typeOfEnsembleForecast; + int numberOfForecastsInEnsemble; + int perturbationNumber; + int unitsLen; + char name[CDI_MAX_NAME]; + char longname[CDI_MAX_NAME]; + char stdname[CDI_MAX_NAME]; + char units[CDI_MAX_NAME]; + char extra[CDI_MAX_NAME]; +} ncvar_t; + +typedef struct +{ + char gridfile[8912]; + unsigned char uuid[CDI_UUID_SIZE]; + int number_of_grid_used; + int timedimid; +} GridInfo; + +static CdiDateTime +scan_time_string(const char *ptu) +{ + int year = 0, month = 0, day = 0; + int hour = 0, minute = 0; + double fseconds = 0.0; + char ch = ' '; + + if (*ptu) sscanf(ptu, "%d-%d-%d%c%d:%d:%lf", &year, &month, &day, &ch, &hour, &minute, &fseconds); + + if (day > 999 && year < 32) + { + int tmp = year; + year = day; + day = tmp; + } + + int second = (int) fseconds; + int ms = (fseconds - second) * 1000; + + CdiDateTime datetime; + datetime.date.year = year; + datetime.date.month = month; + datetime.date.day = day; + datetime.time.hour = hour; + datetime.time.minute = minute; + datetime.time.second = second; + datetime.time.ms = ms; + + return datetime; +} + +static int +scan_time_units(const char *unitstr) +{ + int timeunit = get_time_units(strlen(unitstr), unitstr); + if (timeunit == -1) Warning("Unsupported TIMEUNIT: %s!", unitstr); + return timeunit; +} + +static void +set_forecast_time(const char *timestr, taxis_t *taxis) +{ + if (strlen(timestr) != 0) + taxis->fDateTime = scan_time_string(timestr); + else + cdiDateTime_init(&(taxis->fDateTime)); +} + +static int +set_base_time(const char *timeUnitsStr, taxis_t *taxis) +{ + int taxisType = TAXIS_ABSOLUTE; + + size_t len = strlen(timeUnitsStr); + while (isspace(*timeUnitsStr) && len) + { + timeUnitsStr++; + len--; + } + + char *tu = (char *) malloc((len + 1) * sizeof(char)); + + for (size_t i = 0; i < len; i++) tu[i] = (char) tolower((int) timeUnitsStr[i]); + tu[len] = 0; + + int timeUnits = get_time_units(len, tu); + if (timeUnits == -1) + { + Warning("Unsupported TIMEUNIT: %s!", timeUnitsStr); + return 1; + } + + size_t pos = 0; + while (pos < len && !isspace(tu[pos])) ++pos; + if (tu[pos]) + { + while (isspace(tu[pos])) ++pos; + + if (strStartsWith(tu + pos, "since")) taxisType = TAXIS_RELATIVE; + + while (pos < len && !isspace(tu[pos])) ++pos; + if (tu[pos]) + { + while (isspace(tu[pos])) ++pos; + + if (taxisType == TAXIS_ABSOLUTE) + { + if (timeUnits == TUNIT_DAY) + { + if (!strStartsWith(tu + pos, "%y%m%d.%f")) + { + Warning("Unsupported format %s for TIMEUNIT day!", tu + pos); + timeUnits = -1; + } + } + else if (timeUnits == TUNIT_MONTH) + { + if (!strStartsWith(tu + pos, "%y%m.%f")) + { + Warning("Unsupported format %s for TIMEUNIT month!", tu + pos); + timeUnits = -1; + } + } + else if (timeUnits == TUNIT_YEAR) + { + if (!strStartsWith(tu + pos, "%y.%f")) + { + Warning("Unsupported format %s for TIMEUNIT year!", tu + pos); + timeUnits = -1; + } + } + else + { + Warning("Unsupported format for time units: %s!", tu); + } + } + else if (taxisType == TAXIS_RELATIVE) + { + taxis->rDateTime = scan_time_string(tu + pos); + if (CDI_Debug) + Message("rdate = %d rtime = %d", (int) cdiDate_get(taxis->rDateTime.date), cdiTime_get(taxis->rDateTime.time)); + } + } + } + + taxis->type = taxisType; + taxis->unit = timeUnits; + + free(tu); + + if (CDI_Debug) Message("taxisType = %d timeUnits = %d", taxisType, timeUnits); + + return 0; +} + +bool +xtypeIsText(int xtype) +{ + bool isText = (xtype == NC_CHAR) +#ifdef HAVE_NETCDF4 + || (xtype == NC_STRING) +#endif + ; + return isText; +} + +static bool +xtypeIsFloat(nc_type xtype) +{ + return (xtype == NC_FLOAT || xtype == NC_DOUBLE); +} + +static bool +xtypeIsInt(nc_type xtype) +{ + bool isInt = xtype == NC_SHORT || xtype == NC_INT || xtype == NC_BYTE +#ifdef HAVE_NETCDF4 + || xtype == NC_USHORT || xtype == NC_UINT || xtype == NC_UBYTE +#endif + ; + + return isInt; +} + +static int +cdfInqDatatype(stream_t *streamptr, int xtype, bool isUnsigned) +{ + int datatype = -1; + +#ifdef HAVE_NETCDF4 + if (xtype == NC_BYTE && isUnsigned) xtype = NC_UBYTE; +#endif + + // clang-format off + if (xtype == NC_BYTE ) datatype = CDI_DATATYPE_INT8; + else if (xtype == NC_CHAR ) datatype = CDI_DATATYPE_UINT8; + else if (xtype == NC_SHORT ) datatype = CDI_DATATYPE_INT16; + else if (xtype == NC_INT ) datatype = CDI_DATATYPE_INT32; + else if (xtype == NC_FLOAT ) datatype = CDI_DATATYPE_FLT32; + else if (xtype == NC_DOUBLE) datatype = CDI_DATATYPE_FLT64; +#ifdef HAVE_NETCDF4 + else if (xtype == NC_UBYTE ) datatype = CDI_DATATYPE_UINT8; + else if (xtype == NC_LONG ) datatype = CDI_DATATYPE_INT32; + else if (xtype == NC_USHORT) datatype = CDI_DATATYPE_UINT16; + else if (xtype == NC_UINT ) datatype = CDI_DATATYPE_UINT32; + else if (xtype == NC_INT64 ) datatype = CDI_DATATYPE_FLT64; + else if (xtype == NC_UINT64) datatype = CDI_DATATYPE_FLT64; + else + { + if (xtype != streamptr->nc_complex_float_id && xtype != streamptr->nc_complex_double_id) + { + bool isUserDefinedType = false; +#ifdef NC_FIRSTUSERTYPEID + isUserDefinedType = (xtype >= NC_FIRSTUSERTYPEID); +#endif + if (isUserDefinedType) + { + int fileID = streamptr->fileID; + size_t nfields = 0, compoundsize = 0; + int status = nc_inq_compound(fileID, xtype, NULL, &compoundsize, &nfields); + if (status == NC_NOERR && nfields == 2 && (compoundsize == 8 || compoundsize == 16)) + { + nc_type field_type1 = -1, field_type2 = -1; + int field_dims1 = 0, field_dims2 = 0; + nc_inq_compound_field(fileID, xtype, 0, NULL, NULL, &field_type1, &field_dims1, NULL); + nc_inq_compound_field(fileID, xtype, 1, NULL, NULL, &field_type2, &field_dims2, NULL); + if (field_type1 == field_type2 && field_dims1 == 0 && field_dims2 == 0) + { + if (field_type1 == NC_FLOAT) streamptr->nc_complex_float_id = xtype; + else if (field_type1 == NC_DOUBLE) streamptr->nc_complex_double_id = xtype; + } + } + } + } + if (xtype == streamptr->nc_complex_float_id ) datatype = CDI_DATATYPE_CPX32; + else if (xtype == streamptr->nc_complex_double_id) datatype = CDI_DATATYPE_CPX64; + } +#endif + // clang-format on + + return datatype; +} + +static void +cdfGetAttInt(int fileID, int ncvarid, const char *attname, size_t attlen, int *attint) +{ + *attint = 0; + + nc_type atttype; + size_t nc_attlen; + cdf_inq_atttype(fileID, ncvarid, attname, &atttype); + cdf_inq_attlen(fileID, ncvarid, attname, &nc_attlen); + + if (xtypeIsFloat(atttype) || xtypeIsInt(atttype)) + { + bool needAlloc = (nc_attlen > attlen); + int *pintatt = needAlloc ? (int *) (Malloc(nc_attlen * sizeof(int))) : attint; + cdf_get_att_int(fileID, ncvarid, attname, pintatt); + if (needAlloc) + { + memcpy(attint, pintatt, attlen * sizeof(int)); + Free(pintatt); + } + } +} + +static void +cdfGetAttDouble(int fileID, int ncvarid, char *attname, size_t attlen, double *attdouble) +{ + *attdouble = 0.0; + + nc_type atttype; + size_t nc_attlen; + cdf_inq_atttype(fileID, ncvarid, attname, &atttype); + cdf_inq_attlen(fileID, ncvarid, attname, &nc_attlen); + + if (xtypeIsFloat(atttype) || xtypeIsInt(atttype)) + { + bool needAlloc = (nc_attlen > attlen); + double *pdoubleatt = needAlloc ? (double *) Malloc(nc_attlen * sizeof(double)) : attdouble; + cdf_get_att_double(fileID, ncvarid, attname, pdoubleatt); + if (needAlloc) + { + memcpy(attdouble, pdoubleatt, attlen * sizeof(double)); + Free(pdoubleatt); + } + } +} + +static bool +cdfCheckAttText(int fileID, int ncvarid, const char *attname) +{ + nc_type atttype; + int status_nc = nc_inq_atttype(fileID, ncvarid, attname, &atttype); + + return (status_nc == NC_NOERR + && (atttype == NC_CHAR +#ifdef HAVE_NETCDF4 + || atttype == NC_STRING +#endif + )); +} + +static void +cdfGetAttText(int fileID, int ncvarid, const char *attname, size_t attlen, char *atttext) +{ + atttext[0] = 0; + + nc_type atttype; + size_t nc_attlen; + cdf_inq_atttype(fileID, ncvarid, attname, &atttype); + cdf_inq_attlen(fileID, ncvarid, attname, &nc_attlen); + + if (atttype == NC_CHAR) + { + char attbuf[65636]; + if (nc_attlen < sizeof(attbuf)) + { + cdf_get_att_text(fileID, ncvarid, attname, attbuf); + + if (nc_attlen > (attlen - 1)) nc_attlen = (attlen - 1); + + attbuf[nc_attlen++] = 0; + memcpy(atttext, attbuf, nc_attlen); + } + } +#ifdef HAVE_NETCDF4 + else if (atttype == NC_STRING) + { + if (nc_attlen == 1) + { + char *attbuf = NULL; + cdf_get_att_string(fileID, ncvarid, attname, &attbuf); + + size_t ssize = strlen(attbuf) + 1; + if (ssize > attlen) ssize = attlen; + memcpy(atttext, attbuf, ssize); + atttext[ssize - 1] = 0; + Free(attbuf); + } + } +#endif +} + +void +cdf_scale_add(size_t size, double *data, double addoffset, double scalefactor) +{ + bool haveAddoffset = IS_NOT_EQUAL(addoffset, 0.0); + bool haveScalefactor = IS_NOT_EQUAL(scalefactor, 1.0); + + if (haveAddoffset && haveScalefactor) + { + for (size_t i = 0; i < size; ++i) data[i] = data[i] * scalefactor + addoffset; + } + else if (haveScalefactor) + { + for (size_t i = 0; i < size; ++i) data[i] *= scalefactor; + } + else if (haveAddoffset) + { + for (size_t i = 0; i < size; ++i) data[i] += addoffset; + } +} + +static int +cdf_time_dimid(int fileID, int ndims, int nvars, ncdim_t *ncdims) +{ + char dimname[CDI_MAX_NAME]; + + for (int dimid = 0; dimid < ndims; ++dimid) + { + dimname[0] = 0; + cdf_inq_dimname(fileID, ncdims[dimid].dimid, dimname); + if ((dimname[0] = 'T' || dimname[0] == 't') && dimname[1] == 'i' && dimname[2] == 'm' && dimname[3] == 'e') return dimid; + } + + for (int varid = 0; varid < nvars; ++varid) + { + nc_type xtype; + int nvdims, nvatts, dimids[9]; + cdf_inq_var(fileID, varid, NULL, &xtype, &nvdims, dimids, &nvatts); + for (int i = 0; i < nvdims; ++i) + for (int dimid = 0; dimid < ndims; ++dimid) + if (ncdims[dimid].dimid == dimids[i]) + { + dimids[i] = dimid; + break; + } + + if (nvdims == 1) + { + char sbuf[CDI_MAX_NAME]; + for (int iatt = 0; iatt < nvatts; ++iatt) + { + sbuf[0] = 0; + cdf_inq_attname(fileID, varid, iatt, sbuf); + if (strStartsWith(sbuf, "units")) + { + cdfGetAttText(fileID, varid, "units", sizeof(sbuf), sbuf); + str_to_lower(sbuf); + + if (is_time_units(sbuf)) return dimids[0]; + } + } + } + } + + return CDI_UNDEFID; +} + +static void +init_ncdims(int ndims, ncdim_t *ncdims) +{ + for (int ncdimid = 0; ncdimid < ndims; ncdimid++) + { + ncdim_t *ncdim = &ncdims[ncdimid]; + ncdim->dimid = CDI_UNDEFID; + ncdim->ncvarid = CDI_UNDEFID; + ncdim->dimtype = CDI_UNDEFID; + ncdim->len = 0; + ncdim->name[0] = 0; + } +} + +static void +init_ncvars(int nvars, ncvar_t *ncvars, int ncid) +{ + for (int ncvarid = 0; ncvarid < nvars; ncvarid++) + { + ncvar_t *ncvar = &ncvars[ncvarid]; + ncvar->ncid = ncid; + ncvar->varStatus = UndefVar; + ncvar->ignoreVar = false; + ncvar->isCubeSphere = false; + ncvar->isCharAxis = false; + ncvar->isXaxis = false; + ncvar->isYaxis = false; + ncvar->isZaxis = false; + ncvar->isTaxis = false; + ncvar->isLon = false; + ncvar->isLat = false; + ncvar->isClimatology = false; + ncvar->hasCalendar = false; + ncvar->hasFormulaterms = false; + ncvar->printWarning = true; + ncvar->timetype = TIME_CONSTANT; + ncvar->param = CDI_UNDEFID; + ncvar->code = CDI_UNDEFID; + ncvar->tabnum = 0; + ncvar->bounds = CDI_UNDEFID; + ncvar->gridID = CDI_UNDEFID; + ncvar->zaxisID = CDI_UNDEFID; + ncvar->gridtype = CDI_UNDEFID; + ncvar->zaxistype = CDI_UNDEFID; + ncvar->xdim = CDI_UNDEFID; + ncvar->ydim = CDI_UNDEFID; + ncvar->zdim = CDI_UNDEFID; + ncvar->xvarid = CDI_UNDEFID; + ncvar->yvarid = CDI_UNDEFID; + ncvar->rpvarid = CDI_UNDEFID; + ncvar->zvarid = CDI_UNDEFID; + ncvar->tvarid = CDI_UNDEFID; + ncvar->psvarid = CDI_UNDEFID; + ncvar->p0varid = CDI_UNDEFID; + ncvar->ncoordvars = 0; + for (int i = 0; i < MAX_COORDVARS; ++i) ncvar->cvarids[i] = CDI_UNDEFID; + for (int i = 0; i < MAX_COORDVARS; ++i) ncvar->coordvarids[i] = CDI_UNDEFID; + for (int i = 0; i < MAX_AUXVARS; ++i) ncvar->auxvarids[i] = CDI_UNDEFID; + ncvar->nauxvars = 0; + ncvar->cellarea = CDI_UNDEFID; + ncvar->tableID = CDI_UNDEFID; + ncvar->truncation = 0; + ncvar->position = 0; + ncvar->numLPE = 0; + ncvar->missvalDefined = false; + ncvar->fillvalDefined = false; + ncvar->xtype = 0; + ncvar->gmapid = CDI_UNDEFID; + ncvar->positive = 0; + ncvar->ndims = 0; + for (int i = 0; i < MAX_DIMS_CDF; ++i) ncvar->dimids[i] = CDI_UNDEFID; + for (int i = 0; i < MAX_DIMS_CDF; ++i) ncvar->dimtype[i] = CDI_UNDEFID; + for (int i = 0; i < MAX_DIMS_CDF; ++i) ncvar->chunks[i] = 0; + ncvar->isChunked = false; + ncvar->chunkType = CDI_UNDEFID; + ncvar->chunkSize = CDI_UNDEFID; + ncvar->chunkCacheSize = 0; + ncvar->chunkCacheNelems = 0; + ncvar->chunkCachePreemption = 0.0; + ncvar->gridSize = 0; + ncvar->numLevels = 0; + ncvar->natts = 0; + ncvar->atts = NULL; + ncvar->vctsize = 0; + ncvar->vct = NULL; + ncvar->missval = 0; + ncvar->fillval = 0; + ncvar->addoffset = 0.0; + ncvar->scalefactor = 1.0; + ncvar->hasFilter = false; + ncvar->hasDeflate = false; + ncvar->hasSzip = false; + ncvar->isUnsigned = false; + ncvar->validrangeDefined = false; + ncvar->validrange[0] = VALIDMISS; + ncvar->validrange[1] = VALIDMISS; + ncvar->typeOfEnsembleForecast = -1; + ncvar->numberOfForecastsInEnsemble = -1; + ncvar->perturbationNumber = -1; + ncvar->unitsLen = 0; + memset(ncvar->name, 0, CDI_MAX_NAME); + memset(ncvar->longname, 0, CDI_MAX_NAME); + memset(ncvar->stdname, 0, CDI_MAX_NAME); + memset(ncvar->units, 0, CDI_MAX_NAME); + memset(ncvar->extra, 0, CDI_MAX_NAME); + } +} + +static void +cdf_set_var(ncvar_t *ncvar, int varStatus) +{ + if (ncvar->varStatus != UndefVar && ncvar->varStatus != varStatus && ncvar->printWarning) + { + if (!ncvar->ignoreVar) Warning("Inconsistent variable definition for %s!", ncvar->name); + + ncvar->printWarning = false; + varStatus = CoordVar; + } + + ncvar->varStatus = varStatus; +} + +static void +cdf_set_dim(ncvar_t *ncvar, int dimid, int dimtype) +{ + if (ncvar->dimtype[dimid] != CDI_UNDEFID && ncvar->dimtype[dimid] != dimtype) + { + Warning("Inconsistent dimension definition for %s! dimid = %d; type = %d; newtype = %d", ncvar->name, dimid, + ncvar->dimtype[dimid], dimtype); + } + + ncvar->dimtype[dimid] = dimtype; +} + +static void +scan_hybrid_formulaterms(int ncid, int ncfvarid, int *avarid, int *bvarid, int *psvarid, int *p0varid) +{ + *avarid = -1; + *bvarid = -1; + *psvarid = -1; + *p0varid = -1; + + char attstring[1024]; + cdfGetAttText(ncid, ncfvarid, "formula_terms", sizeof(attstring), attstring); + char *pstring = attstring; + + bool lstop = false; + for (int i = 0; i < 4; i++) + { + while (isspace((int) *pstring)) pstring++; + if (*pstring == 0) break; + char *tagname = pstring; + while (!isspace((int) *pstring) && *pstring != 0) pstring++; + if (*pstring == 0) lstop = true; + *pstring++ = 0; + + while (isspace((int) *pstring)) pstring++; + if (*pstring == 0) break; + char *varname = pstring; + while (!isspace((int) *pstring) && *pstring != 0) pstring++; + if (*pstring == 0) lstop = true; + *pstring++ = 0; + + int dimvarid; + int status_nc = nc_inq_varid(ncid, varname, &dimvarid); + if (status_nc == NC_NOERR) + { + // clang-format off + if (str_is_equal(tagname, "ap:")) *avarid = dimvarid; + else if (str_is_equal(tagname, "a:") ) *avarid = dimvarid; + else if (str_is_equal(tagname, "b:") ) *bvarid = dimvarid; + else if (str_is_equal(tagname, "ps:")) *psvarid = dimvarid; + else if (str_is_equal(tagname, "p0:")) *p0varid = dimvarid; + // clang-format on + } + else if (!str_is_equal(tagname, "ps:")) + { + Warning("%s - %s", nc_strerror(status_nc), varname); + } + + if (lstop) break; + } +} + +static void +readVCT(int ncid, int ndims2, size_t dimlen, size_t dimlen2, int avarid2, int bvarid2, double *vct) +{ + double *abuf = (double *) Malloc(dimlen * 2 * sizeof(double)); + double *bbuf = (double *) Malloc(dimlen * 2 * sizeof(double)); + cdf_get_var_double(ncid, avarid2, abuf); + cdf_get_var_double(ncid, bvarid2, bbuf); + + if (ndims2 == 2) + { + for (size_t i = 0; i < dimlen; ++i) + { + vct[i] = abuf[i * 2]; + vct[i + dimlen + 1] = bbuf[i * 2]; + } + vct[dimlen] = abuf[dimlen * 2 - 1]; + vct[dimlen * 2 + 1] = bbuf[dimlen * 2 - 1]; + } + else + { + for (size_t i = 0; i < dimlen2; ++i) + { + vct[i] = abuf[i]; + vct[i + dimlen + 1] = bbuf[i]; + } + } + + Free(abuf); + Free(bbuf); +} + +static bool +isHybridSigmaPressureCoordinate(int ncid, int ncvarid, ncvar_t *ncvars, const ncdim_t *ncdims) +{ + bool status = false; + ncvar_t *ncvar = &ncvars[ncvarid]; + + if (str_is_equal(ncvar->stdname, "atmosphere_hybrid_sigma_pressure_coordinate")) + { + CDI_Convention = CDI_CONVENTION_CF; + + status = true; + ncvar->zaxistype = ZAXIS_HYBRID; + // int ndims = ncvar->ndims; + int dimid = ncvar->dimids[0]; + size_t dimlen = ncdims[dimid].len; + int avarid1 = -1, bvarid1 = -1, psvarid1 = -1, p0varid1 = -1; + int ncfvarid = ncvarid; + if (ncvars[ncfvarid].hasFormulaterms) scan_hybrid_formulaterms(ncid, ncfvarid, &avarid1, &bvarid1, &psvarid1, &p0varid1); + // printf("avarid1, bvarid1, psvarid1, p0varid1 %d %d %d %d\n", avarid1, bvarid1, psvarid1, p0varid1); + if (avarid1 != -1) ncvars[avarid1].varStatus = CoordVar; + if (bvarid1 != -1) ncvars[bvarid1].varStatus = CoordVar; + if (psvarid1 != -1) ncvar->psvarid = psvarid1; + if (p0varid1 != -1) ncvar->p0varid = p0varid1; + + if (ncvar->bounds != CDI_UNDEFID && ncvars[ncvar->bounds].hasFormulaterms) + { + ncfvarid = ncvar->bounds; + int avarid2 = -1, bvarid2 = -1, psvarid2 = -1, p0varid2 = -1; + if (ncvars[ncfvarid].hasFormulaterms) scan_hybrid_formulaterms(ncid, ncfvarid, &avarid2, &bvarid2, &psvarid2, &p0varid2); + // printf("avarid2, bvarid2, psvarid2, p0varid2 %d %d %d %d\n", avarid2, bvarid2, psvarid2, p0varid2); + if (avarid2 != -1 && bvarid2 != -1) + { + ncvars[avarid2].varStatus = CoordVar; + ncvars[bvarid2].varStatus = CoordVar; + + int ndims2 = ncvars[avarid2].ndims; + int dimid2 = ncvars[avarid2].dimids[0]; + size_t dimlen2 = ncdims[dimid2].len; + + if ((ndims2 == 2 && dimid == ncvars[avarid2].dimids[0]) || (ndims2 == 1 && dimlen == dimlen2 - 1)) + { + double px = 1; + if (p0varid1 != -1 && p0varid1 == p0varid2) cdf_get_var_double(ncid, p0varid2, &px); + + size_t vctsize = (dimlen + 1) * 2; + double *vct = (double *) Malloc(vctsize * sizeof(double)); + + readVCT(ncid, ndims2, dimlen, dimlen2, avarid2, bvarid2, vct); + + if (p0varid1 != -1 && IS_NOT_EQUAL(px, 1)) + for (size_t i = 0; i < dimlen + 1; ++i) vct[i] *= px; + + ncvar->vct = vct; + ncvar->vctsize = vctsize; + } + } + } + } + + return status; +} + +static void +cdf_set_cdi_attr(int ncid, int ncvarid, int attnum, int cdiID, int varID, bool removeFillValue) +{ + nc_type atttype; + size_t attlen; + char attname[CDI_MAX_NAME]; + + cdf_inq_attname(ncid, ncvarid, attnum, attname); + cdf_inq_attlen(ncid, ncvarid, attname, &attlen); + cdf_inq_atttype(ncid, ncvarid, attname, &atttype); + + if (removeFillValue && str_is_equal("_FillValue", attname)) return; + + if (xtypeIsInt(atttype)) + { + int attint; + int *pattint = (attlen > 1) ? (int *) malloc(attlen * sizeof(int)) : &attint; + cdfGetAttInt(ncid, ncvarid, attname, attlen, pattint); + // clang-format off + int datatype = (atttype == NC_SHORT) ? CDI_DATATYPE_INT16 : + (atttype == NC_BYTE) ? CDI_DATATYPE_INT8 : +#ifdef HAVE_NETCDF4 + (atttype == NC_UBYTE) ? CDI_DATATYPE_UINT8 : + (atttype == NC_USHORT) ? CDI_DATATYPE_UINT16 : + (atttype == NC_UINT) ? CDI_DATATYPE_UINT32 : +#endif + CDI_DATATYPE_INT32; + // clang-format on + cdiDefAttInt(cdiID, varID, attname, datatype, (int) attlen, pattint); + if (attlen > 1) free(pattint); + } + else if (xtypeIsFloat(atttype)) + { + double attflt; + double *pattflt = (attlen > 1) ? (double *) malloc(attlen * sizeof(double)) : &attflt; + cdfGetAttDouble(ncid, ncvarid, attname, attlen, pattflt); + int datatype = (atttype == NC_FLOAT) ? CDI_DATATYPE_FLT32 : CDI_DATATYPE_FLT64; + cdiDefAttFlt(cdiID, varID, attname, datatype, (int) attlen, pattflt); + if (attlen > 1) free(pattflt); + } + else if (xtypeIsText(atttype)) + { + char attstring[8192]; + cdfGetAttText(ncid, ncvarid, attname, sizeof(attstring), attstring); + cdiDefAttTxt(cdiID, varID, attname, strlen(attstring), attstring); + } +} + +static void +cdf_print_vars(const ncvar_t *ncvars, int nvars, const char *oname) +{ + // clang-format off + char axis[7]; + enum { TAXIS = 't', ZAXIS = 'z', EAXIS = 'e', YAXIS = 'y', XAXIS = 'x' }; + + fprintf(stderr, "%s:\n", oname); + + for (int ncvarid = 0; ncvarid < nvars; ncvarid++) + { + const ncvar_t *ncvar = &ncvars[ncvarid]; + int ndim = 0; + if (ncvar->varStatus == DataVar) + { + axis[ndim++] = 'v'; + axis[ndim++] = ':'; + for (int i = 0; i < ncvar->ndims; i++) + { + if (ncvar->dimtype[i] == T_AXIS) axis[ndim++] = TAXIS; + else if (ncvar->dimtype[i] == Z_AXIS) axis[ndim++] = ZAXIS; + else if (ncvar->dimtype[i] == E_AXIS) axis[ndim++] = EAXIS; + else if (ncvar->dimtype[i] == Y_AXIS) axis[ndim++] = YAXIS; + else if (ncvar->dimtype[i] == X_AXIS) axis[ndim++] = XAXIS; + else axis[ndim++] = '?'; + } + } + else + { + axis[ndim++] = 'c'; + axis[ndim++] = ':'; + if (ncvar->isTaxis) axis[ndim++] = TAXIS; + else if (ncvar->isZaxis) axis[ndim++] = ZAXIS; + else if (ncvar->isLat ) axis[ndim++] = YAXIS; + else if (ncvar->isYaxis) axis[ndim++] = YAXIS; + else if (ncvar->isLon ) axis[ndim++] = XAXIS; + else if (ncvar->isXaxis) axis[ndim++] = XAXIS; + else axis[ndim++] = '?'; + } + + axis[ndim++] = 0; + + fprintf(stderr, "%3d %3d %-6s %s\n", ncvarid, ndim-3, axis, ncvar->name); + } + // clang-format on +} + +static void +cdfScanAttrAxis(ncvar_t *ncvars, ncdim_t *ncdims, int ncvarid, const char *attstring, int nvdims, const int *dimidsp) +{ + ncvar_t *ncvar = &ncvars[ncvarid]; + int attlen = (int) strlen(attstring); + + if (nvdims == 0 && attlen == 1) + { + if (attstring[0] == 'z') + { + cdf_set_var(ncvar, CoordVar); + ncvar->isZaxis = true; + return; + } + } + + if (attlen != nvdims) return; + + static const char accept[] = "-tTzZyYxX"; + if ((int) strspn(attstring, accept) != attlen) return; + + while (attlen--) + { + int dimtype; + bool setVar = false; + switch (attstring[attlen]) + { + case 't': + case 'T': + if (attlen != 0) Warning("axis attribute 't' not on first position"); + dimtype = T_AXIS; + break; + case 'z': + case 'Z': + ncvar->zdim = dimidsp[attlen]; + dimtype = Z_AXIS; + + setVar = ncvar->ndims == 1; + break; + case 'y': + case 'Y': + ncvar->ydim = dimidsp[attlen]; + dimtype = Y_AXIS; + + setVar = ncvar->ndims == 1; + break; + case 'x': + case 'X': + ncvar->xdim = dimidsp[attlen]; + dimtype = X_AXIS; + + setVar = ncvar->ndims == 1; + break; + default: continue; + } + cdf_set_dim(ncvar, attlen, dimtype); + if (setVar) + { + cdf_set_var(ncvar, CoordVar); + ncdims[ncvar->dimids[0]].dimtype = dimtype; + } + } +} + +static int +cdf_get_cell_varid(char *attstring, int ncid) +{ + int nc_cell_id = CDI_UNDEFID; + + char *pstring = attstring; + while (isspace((int) *pstring)) pstring++; + char *cell_measures = pstring; + while (isalnum((int) *pstring)) pstring++; + *pstring++ = 0; + while (isspace((int) *pstring)) pstring++; + char *cell_var = pstring; + while (!isspace((int) *pstring) && *pstring != 0) pstring++; + *pstring++ = 0; + /* + printf("cell_measures >%s<\n", cell_measures); + printf("cell_var >%s<\n", cell_var); + */ + if (strStartsWith(cell_measures, "area")) + { + int nc_var_id; + int status = nc_inq_varid(ncid, cell_var, &nc_var_id); + if (status == NC_NOERR) nc_cell_id = nc_var_id; + /* + else + Warning("%s - %s", nc_strerror(status), cell_var); + */ + } + + return nc_cell_id; +} + +static void +set_extra_attr(char *buf, int nvdims, const size_t *chunks) +{ + size_t pos = strlen(buf); + static const char prefix[] = "chunks="; + memcpy(buf + pos, prefix, sizeof(prefix)); + pos += sizeof(prefix) - 1; + for (int i = nvdims - 1; i >= 0; --i) + { + pos += (size_t) (sprintf(buf + pos, "%zu%s", chunks[i], i > 0 ? "x" : "")); + } + buf[pos] = ' '; + buf[pos + 1] = 0; +} + +static void +cdfScanVarAttr(int nvars, ncvar_t *ncvars, int ndims, ncdim_t *ncdims, int timedimid, int modelID, int format) +{ + int nvdims, nvatts; + nc_type xtype, atttype; + size_t attlen; + char name[CDI_MAX_NAME]; + char attname[CDI_MAX_NAME]; + char attstring[8192]; + + int nchecked_vars = 0; + enum + { + max_check_vars = 9 + }; + char *checked_vars[max_check_vars]; + for (int i = 0; i < max_check_vars; ++i) checked_vars[i] = NULL; + + for (int ncvarid = 0; ncvarid < nvars; ncvarid++) + { + ncvar_t *ncvar = &ncvars[ncvarid]; + int ncid = ncvar->ncid; + int *dimidsp = ncvar->dimids; + + cdf_inq_var(ncid, ncvarid, name, &xtype, &nvdims, dimidsp, &nvatts); + for (int i = 0; i < nvdims; ++i) + for (int dimid = 0; dimid < ndims; ++dimid) + if (ncdims[dimid].dimid == dimidsp[i]) + { + dimidsp[i] = dimid; + break; + } + strcpy(ncvar->name, name); + + for (int ncdimid = 0; ncdimid < nvdims; ncdimid++) ncvar->dimtype[ncdimid] = -1; + + ncvar->xtype = xtype; + ncvar->ndims = nvdims; + +#ifdef HAVE_NETCDF4 + if (format == NC_FORMAT_NETCDF4_CLASSIC || format == NC_FORMAT_NETCDF4) + { + int shuffle = 0, deflate = 0, deflateLevel = 0; + nc_inq_var_deflate(ncid, ncvarid, &shuffle, &deflate, &deflateLevel); + if (deflate > 0) ncvar->hasDeflate = true; + +#ifdef HAVE_NC_DEF_VAR_SZIP + int options_mask = 0, pixels_per_block = 0; + nc_inq_var_szip(ncid, ncvarid, &options_mask, &pixels_per_block); + if (options_mask && pixels_per_block) ncvar->hasSzip = true; +#endif + unsigned filterId; + size_t numParams; + nc_inq_var_filter(ncid, ncvarid, &filterId, &numParams, NULL); + if (filterId > 0) ncvar->hasFilter = true; + if (filterId > 0 && numParams <= 16 && CDI_Debug) + { + unsigned int params[16]; + nc_inq_var_filter(ncid, ncvarid, &filterId, &numParams, params); + fprintf(stderr, "%s: filterId=%d params=", ncvar->name, filterId); + for (int i = 0; i < (int) numParams; ++i) fprintf(stderr, " %u", params[i]); + fprintf(stderr, "\n"); + } + + size_t chunks[nvdims]; + int storageIn; + if (nc_inq_var_chunking(ncid, ncvarid, &storageIn, chunks) == NC_NOERR) + { + if (storageIn == NC_CHUNKED) + { + ncvar->isChunked = true; + for (int i = 0; i < nvdims; ++i) ncvar->chunks[i] = chunks[i]; + if (CDI_Debug) + { + fprintf(stderr, "%s: chunking %d %d %d chunks ", name, storageIn, NC_CONTIGUOUS, NC_CHUNKED); + for (int i = 0; i < nvdims; ++i) fprintf(stderr, "%zu ", chunks[i]); + fprintf(stderr, "\n"); + } + + set_extra_attr(ncvar->extra, nvdims, chunks); + } + } + + size_t size; + size_t nelems; + float preemption; + if (nc_get_var_chunk_cache(ncid, ncvarid, &size, &nelems, &preemption) == NC_NOERR) + { + ncvar->chunkCacheSize = size; + ncvar->chunkCacheNelems = nelems; + ncvar->chunkCachePreemption = preemption; + if (CDI_Debug) fprintf(stderr, "%s: chunkCacheSize=%zu nelems=%zu preemption=%g\n", name, size, nelems, preemption); + } + } +#endif + + if (nvdims > 0) + { + if (timedimid == dimidsp[0]) + { + ncvar->timetype = TIME_VARYING; + cdf_set_dim(ncvar, 0, T_AXIS); + } + else + { + for (int ncdimid = 1; ncdimid < nvdims; ncdimid++) + { + if (timedimid == dimidsp[ncdimid]) + { + Warning("Time must be the first dimension! Unsupported array structure, skipped variable %s!", ncvar->name); + ncvar->varStatus = CoordVar; + } + } + } + } + + if (ncvar->natts == 0 && nvatts > 0) ncvar->atts = (int *) Malloc((size_t) nvatts * sizeof(int)); + + for (int iatt = 0; iatt < nvatts; ++iatt) + { + int nc_cell_id = CDI_UNDEFID; + + cdf_inq_attname(ncid, ncvarid, iatt, attname); + cdf_inq_atttype(ncid, ncvarid, attname, &atttype); + cdf_inq_attlen(ncid, ncvarid, attname, &attlen); + + size_t attstringsize = sizeof(attstring); + bool isText = xtypeIsText(atttype), isNumber = xtypeIsFloat(atttype) || xtypeIsInt(atttype); + bool isRealization = false, isEnsembleMembers = false, isForecastInitType = false; + if (isText) + { + cdfGetAttText(ncid, ncvarid, attname, sizeof(attstring), attstring); + attstringsize = strlen(attstring) + 1; + if (attstringsize > CDI_MAX_NAME) attstringsize = CDI_MAX_NAME; + } + + if (isText && str_is_equal(attname, "long_name")) + { + memcpy(ncvar->longname, attstring, attstringsize); + } + else if (isText && str_is_equal(attname, "standard_name")) + { + memcpy(ncvar->stdname, attstring, attstringsize); + } + else if (isText && str_is_equal(attname, "units")) + { + ncvar->unitsLen = attstringsize; + memcpy(ncvar->units, attstring, attstringsize); + } + else if (isText && str_is_equal(attname, "calendar")) + { + ncvar->hasCalendar = true; + } + else if (isText && str_is_equal(attname, "param")) + { + int pnum = 0, pcat = 255, pdis = 255; + sscanf(attstring, "%d.%d.%d", &pnum, &pcat, &pdis); + ncvar->param = cdiEncodeParam(pnum, pcat, pdis); + cdf_set_var(ncvar, DataVar); + } + else if (isNumber && str_is_equal(attname, "code")) + { + cdfGetAttInt(ncid, ncvarid, attname, 1, &ncvar->code); + cdf_set_var(ncvar, DataVar); + } + else if (isNumber && str_is_equal(attname, "table")) + { + int tablenum; + cdfGetAttInt(ncid, ncvarid, attname, 1, &tablenum); + if (tablenum > 0) + { + ncvar->tabnum = tablenum; + ncvar->tableID = tableInq(modelID, tablenum, NULL); + if (ncvar->tableID == CDI_UNDEFID) ncvar->tableID = tableDef(modelID, tablenum, NULL); + } + cdf_set_var(ncvar, DataVar); + } + else if (isText && str_is_equal(attname, "trunc_type")) + { + if (str_is_equal(attstring, "Triangular")) ncvar->gridtype = GRID_SPECTRAL; + } + else if (isText && (str_is_equal(attname, "grid_type") || str_is_equal(attname, "CDI_grid_type"))) + { + str_to_lower(attstring); + cdf_set_gridtype(attstring, &ncvar->gridtype); + cdf_set_var(ncvar, DataVar); + } + else if (isText && str_is_equal(attname, "CDI_grid_latitudes")) + { + int nc_yvar_id; + int status = nc_inq_varid(ncid, attstring, &nc_yvar_id); + if (status == NC_NOERR) + { + ncvar->yvarid = nc_yvar_id; + cdf_set_var(&ncvars[ncvar->yvarid], CoordVar); + } + else + Warning("%s - %s", nc_strerror(status), attstring); + + cdf_set_var(ncvar, DataVar); + } + else if (isText && str_is_equal(attname, "CDI_grid_reduced_points")) + { + int nc_rpvar_id; + int status = nc_inq_varid(ncid, attstring, &nc_rpvar_id); + if (status == NC_NOERR) + { + ncvar->rpvarid = nc_rpvar_id; + cdf_set_var(&ncvars[ncvar->rpvarid], CoordVar); + } + else + Warning("%s - %s", nc_strerror(status), attstring); + + cdf_set_var(ncvar, DataVar); + } + else if (isNumber && str_is_equal(attname, "CDI_grid_num_LPE")) + { + cdfGetAttInt(ncid, ncvarid, attname, 1, &ncvar->numLPE); + } + else if (isText && str_is_equal(attname, "level_type")) + { + str_to_lower(attstring); + cdf_set_zaxistype(attstring, &ncvar->zaxistype); + cdf_set_var(ncvar, DataVar); + } + else if (isNumber && str_is_equal(attname, "trunc_count")) + { + cdfGetAttInt(ncid, ncvarid, attname, 1, &ncvar->truncation); + } + else if (isNumber && str_is_equal(attname, "truncation")) + { + cdfGetAttInt(ncid, ncvarid, attname, 1, &ncvar->truncation); + } + else if (isNumber && str_is_equal(attname, "number_of_grid_in_reference")) + { + cdfGetAttInt(ncid, ncvarid, attname, 1, &ncvar->position); + } + else if (isNumber && str_is_equal(attname, "add_offset")) + { + cdfGetAttDouble(ncid, ncvarid, attname, 1, &ncvar->addoffset); + /* + if ( atttype != NC_BYTE && atttype != NC_SHORT && atttype != NC_INT ) + if ( ncvar->addoffset != 0 ) + Warning("attribute add_offset not supported for atttype %d", atttype); + */ + // (also used for lon/lat) cdf_set_var(ncvar, DataVar); + } + else if (isNumber && str_is_equal(attname, "scale_factor")) + { + cdfGetAttDouble(ncid, ncvarid, attname, 1, &ncvar->scalefactor); + /* + if ( atttype != NC_BYTE && atttype != NC_SHORT && atttype != NC_INT ) + if ( ncvar->scalefactor != 1 ) + Warning("attribute scale_factor not supported for atttype %d", atttype); + */ + // (also used for lon/lat) cdf_set_var(ncvar, DataVar); + } + else if (isText && str_is_equal(attname, "climatology")) + { + int ncboundsid; + int status = nc_inq_varid(ncid, attstring, &ncboundsid); + if (status == NC_NOERR) + { + ncvar->isClimatology = true; + ncvar->bounds = ncboundsid; + cdf_set_var(&ncvars[ncvar->bounds], CoordVar); + cdf_set_var(ncvar, CoordVar); + } + else + Warning("%s - %s", nc_strerror(status), attstring); + } + else if (isText && str_is_equal(attname, "bounds")) + { + int ncboundsid; + int status = nc_inq_varid(ncid, attstring, &ncboundsid); + if (status == NC_NOERR) + { + ncvar->bounds = ncboundsid; + cdf_set_var(&ncvars[ncvar->bounds], CoordVar); + cdf_set_var(ncvar, CoordVar); + } + else + Warning("%s - %s", nc_strerror(status), attstring); + } + else if (isText && str_is_equal(attname, "formula_terms")) + { + ncvar->hasFormulaterms = true; + } + else if (isText && str_is_equal(attname, "cell_measures") + && (nc_cell_id = cdf_get_cell_varid(attstring, ncid)) != CDI_UNDEFID) + { + ncvar->cellarea = nc_cell_id; + ncvars[nc_cell_id].varStatus = CoordVar; + cdf_set_var(ncvar, DataVar); + } + else if (isText && (str_is_equal(attname, "associate") || str_is_equal(attname, "coordinates"))) + { + bool lstop = false; + char *pstring = attstring; + + for (int i = 0; i < MAX_COORDVARS && !lstop; i++) + { + while (isspace((int) *pstring)) pstring++; + if (*pstring == 0) break; + char *varname = pstring; + while (!isspace((int) *pstring) && *pstring != 0) pstring++; + if (*pstring == 0) lstop = true; + if (*(pstring - 1) == ',') *(pstring - 1) = 0; + *pstring++ = 0; + + int dimvarid; + int status = nc_inq_varid(ncid, varname, &dimvarid); + if (status == NC_NOERR) + { + cdf_set_var(&ncvars[dimvarid], CoordVar); + if (!CDI_Ignore_Att_Coordinates) + { + ncvar->coordvarids[i] = dimvarid; + ncvar->ncoordvars++; + } + } + else + { + if (!CDI_Ignore_Att_Coordinates) ncvar->ncoordvars++; + + int k; + for (k = 0; k < nchecked_vars; ++k) + if (str_is_equal(checked_vars[k], varname)) break; + + if (k == nchecked_vars) + { + if (nchecked_vars < max_check_vars) checked_vars[nchecked_vars++] = strdup(varname); + Warning("%s - >%s<", nc_strerror(status), varname); + } + } + } + + cdf_set_var(ncvar, DataVar); + } + else if (isText && str_is_equal(attname, "auxiliary_variable")) + { + bool lstop = false; + char *pstring = attstring; + + for (int i = 0; i < MAX_AUXVARS; i++) + { + while (isspace((int) *pstring)) pstring++; + if (*pstring == 0) break; + char *varname = pstring; + while (!isspace((int) *pstring) && *pstring != 0) pstring++; + if (*pstring == 0) lstop = true; + *pstring++ = 0; + + int dimvarid; + int status = nc_inq_varid(ncid, varname, &dimvarid); + if (status == NC_NOERR) + { + cdf_set_var(&ncvars[dimvarid], CoordVar); + // if ( !CDI_Ignore_Att_Coordinates ) + { + ncvar->auxvarids[i] = dimvarid; + ncvar->nauxvars++; + } + } + else + Warning("%s - %s", nc_strerror(status), varname); + + if (lstop) break; + } + + cdf_set_var(ncvar, DataVar); + } + else if (isText && str_is_equal(attname, "grid_mapping")) + { + int nc_gmap_id; + int status = nc_inq_varid(ncid, attstring, &nc_gmap_id); + if (status == NC_NOERR) + { + ncvar->gmapid = nc_gmap_id; + cdf_set_var(&ncvars[ncvar->gmapid], CoordVar); + } + else + Warning("%s - %s", nc_strerror(status), attstring); + + cdf_set_var(ncvar, DataVar); + } + else if (isText && str_is_equal(attname, "positive")) + { + str_to_lower(attstring); + + if (str_is_equal(attstring, "down")) + ncvar->positive = POSITIVE_DOWN; + else if (str_is_equal(attstring, "up")) + ncvar->positive = POSITIVE_UP; + + if (ncvar->ndims == 1) + { + cdf_set_var(ncvar, CoordVar); + cdf_set_dim(ncvar, 0, Z_AXIS); + ncdims[ncvar->dimids[0]].dimtype = Z_AXIS; + } + else if (ncvar->ndims == 0) + { + cdf_set_var(ncvar, CoordVar); + ncvar->isZaxis = true; + } + else + { + ncvar->atts[ncvar->natts++] = iatt; + } + } + else if (isNumber && str_is_equal(attname, "_FillValue")) + { + cdfGetAttDouble(ncid, ncvarid, attname, 1, &ncvar->fillval); + ncvar->fillvalDefined = true; + // cdf_set_var(ncvar, DataVar); + } + else if (isNumber && str_is_equal(attname, "missing_value")) + { + cdfGetAttDouble(ncid, ncvarid, attname, 1, &ncvar->missval); + ncvar->missvalDefined = true; + // cdf_set_var(ncvar, DataVar); + } + else if (isNumber && str_is_equal(attname, "valid_range") && attlen == 2) + { + if (ncvar->validrangeDefined == false) + { + bool ignoreDatatype = (xtypeIsFloat(atttype) != xtypeIsFloat(xtype)); + if (!CDI_Ignore_Valid_Range && ignoreDatatype == false) + { + cdfGetAttDouble(ncid, ncvarid, attname, 2, ncvar->validrange); + ncvar->validrangeDefined = (ncvar->validrange[0] <= ncvar->validrange[1]); + if (((int) ncvar->validrange[0]) == 0 && ((int) ncvar->validrange[1]) == 255) ncvar->isUnsigned = true; + // cdf_set_var(ncvar, DataVar); + } + else if (ignoreDatatype) + { + Warning("Inconsistent data type for attribute %s:valid_range, ignored!", name); + } + } + } + else if (isNumber && str_is_equal(attname, "valid_min") && attlen == 1) + { + bool ignoreDatatype = (xtypeIsFloat(atttype) != xtypeIsFloat(xtype)); + if (!CDI_Ignore_Valid_Range && ignoreDatatype == false) + { + cdfGetAttDouble(ncid, ncvarid, attname, 1, &(ncvar->validrange)[0]); + ncvar->validrangeDefined = true; + } + else if (ignoreDatatype) + { + Warning("Inconsistent data type for attribute %s:valid_min, ignored!", name); + } + } + else if (isNumber && str_is_equal(attname, "valid_max") && attlen == 1) + { + bool ignoreDatatype = (xtypeIsFloat(atttype) != xtypeIsFloat(xtype)); + if (!CDI_Ignore_Valid_Range && ignoreDatatype == false) + { + cdfGetAttDouble(ncid, ncvarid, attname, 1, &(ncvar->validrange)[1]); + ncvar->validrangeDefined = true; + } + else if (ignoreDatatype) + { + Warning("Inconsistent data type for attribute %s:valid_max, ignored!", name); + } + } + else if (isText && str_is_equal(attname, "_Unsigned")) + { + str_to_lower(attstring); + if (str_is_equal(attstring, "true")) + { + ncvar->isUnsigned = true; + /* + ncvar->validrangeDefined = true; + ncvar->validrange[0] = 0; + ncvar->validrange[1] = 255; + */ + } + // cdf_set_var(ncvar, DataVar); + } + else if (isText && str_is_equal(attname, "cdi")) + { + str_to_lower(attstring); + + if (str_is_equal(attstring, "ignore")) + { + ncvar->ignoreVar = true; + cdf_set_var(ncvar, CoordVar); + } + } + else if (isNumber + && ((isRealization = str_is_equal(attname, "realization")) + || (isEnsembleMembers = str_is_equal(attname, "ensemble_members")) + || (isForecastInitType = str_is_equal(attname, "forecast_init_type")))) + { + int temp; + cdfGetAttInt(ncid, ncvarid, attname, 1, &temp); + + // clang-format off + if (isRealization) ncvar->perturbationNumber = temp; + else if (isEnsembleMembers) ncvar->numberOfForecastsInEnsemble = temp; + else if (isForecastInitType) ncvar->typeOfEnsembleForecast = temp; + // clang-format on + + cdf_set_var(ncvar, DataVar); + } + else + { + ncvar->atts[ncvar->natts++] = iatt; + } + } + } + + for (int i = 0; i < max_check_vars; ++i) + if (checked_vars[i]) Free(checked_vars[i]); +} + +static void +cdfVerifyVarAttr(int nvars, ncvar_t *ncvars, ncdim_t *ncdims) +{ + nc_type atttype; + size_t attlen; + char attname[CDI_MAX_NAME]; + char attstring[8192]; + + for (int ncvarid = 0; ncvarid < nvars; ncvarid++) + { + ncvar_t *ncvar = &ncvars[ncvarid]; + int ncid = ncvar->ncid; + const int *dimidsp = ncvar->dimids; + int nvdims = ncvar->ndims; + int nvatts = ncvar->natts; + + for (int i = 0; i < nvatts; i++) + { + int attnum = ncvar->atts[i]; + cdf_inq_attname(ncid, ncvarid, attnum, attname); + cdf_inq_attlen(ncid, ncvarid, attname, &attlen); + cdf_inq_atttype(ncid, ncvarid, attname, &atttype); + + size_t attstringsize = sizeof(attstring); + bool isText = xtypeIsText(atttype); + // bool isNumber = (xtypeIsFloat(atttype) || xtypeIsInt(atttype)); + + if (isText) + { + cdfGetAttText(ncid, ncvarid, attname, sizeof(attstring), attstring); + attstringsize = strlen(attstring) + 1; + if (attstringsize > CDI_MAX_NAME) attstringsize = CDI_MAX_NAME; + + if (str_is_equal(attname, "axis")) + { + cdfScanAttrAxis(ncvars, ncdims, ncvarid, attstring, nvdims, dimidsp); + } + /* + else if (str_is_equal(attname, "standard_name")) + { + memcpy(ncvar->stdname, attstring, attstringsize); + } + */ + } + } + } +} + +static void +cdf_set_dimtype(int nvars, ncvar_t *ncvars, ncdim_t *ncdims) +{ + for (int ncvarid = 0; ncvarid < nvars; ncvarid++) + { + ncvar_t *ncvar = &ncvars[ncvarid]; + if (ncvar->varStatus == DataVar) + { + int ndims = ncvar->ndims; + for (int i = 0; i < ndims; i++) + { + int ncdimid = ncvar->dimids[i]; + int dimtype = ncdims[ncdimid].dimtype; + if (dimtype >= X_AXIS && dimtype <= T_AXIS) cdf_set_dim(ncvar, i, dimtype); + } + + if (CDI_Debug) + { + Message("var %d %s", ncvarid, ncvar->name); + for (int i = 0; i < ndims; i++) printf(" dim%d type=%d ", i, ncvar->dimtype[i]); + printf("\n"); + } + } + } + + for (int ncvarid = 0; ncvarid < nvars; ncvarid++) + { + ncvar_t *ncvar = &ncvars[ncvarid]; + if (ncvar->varStatus == DataVar) + { + bool lxdim = false, lydim = false, lzdim = false /* , ltdim = false */; + int lcdim = 0; + int ndims = ncvar->ndims; + for (int i = 0; i < ndims; i++) + { + int dimtype = ncvar->dimtype[i]; + lxdim |= (dimtype == X_AXIS); + lydim |= (dimtype == Y_AXIS); + lzdim |= (dimtype == Z_AXIS); + if (ncvar->cvarids[i] != CDI_UNDEFID) lcdim++; + // ltdim |= (dimtype == T_AXIS); + } + + int allcdims = lcdim; + + if (!lxdim && ncvar->xvarid != CDI_UNDEFID && ncvars[ncvar->xvarid].ndims == 0) lxdim = true; + if (!lydim && ncvar->yvarid != CDI_UNDEFID && ncvars[ncvar->yvarid].ndims == 0) lydim = true; + + if (lxdim && (lydim || ncvar->gridtype == GRID_UNSTRUCTURED)) + for (int i = ndims - 1; i >= 0; i--) + { + if (ncvar->dimtype[i] == -1 && !lzdim) + { + if (lcdim) + { + int cdimvar = ncvar->cvarids[allcdims - lcdim]; + ncvar->zvarid = cdimvar; + lcdim--; + ncvars[cdimvar].zaxistype = ZAXIS_CHAR; + } + cdf_set_dim(ncvar, i, Z_AXIS); + lzdim = true; + int ncdimid = ncvar->dimids[i]; + if (ncdims[ncdimid].dimtype == CDI_UNDEFID) ncdims[ncdimid].dimtype = Z_AXIS; + } + } + } + } + + for (int ncvarid = 0; ncvarid < nvars; ncvarid++) + { + ncvar_t *ncvar = &ncvars[ncvarid]; + int ndims = ncvar->ndims; + for (int i = 0; i < ndims; i++) + { + if (ncvar->dimtype[i] == CDI_UNDEFID) + { + int ncdimid = ncvar->dimids[i]; + if (ncdims[ncdimid].dimtype == Z_AXIS) + { + ncvar->isZaxis = true; + cdf_set_dim(ncvar, i, Z_AXIS); + } + } + } + } + + for (int ncvarid = 0; ncvarid < nvars; ncvarid++) + { + ncvar_t *ncvar = &ncvars[ncvarid]; + if (ncvar->varStatus == DataVar) + { + bool lxdim = false, lydim = false, lzdim = false /*, ltdim = false */; + int lcdim = 0; + int ndims = ncvar->ndims; + for (int i = 0; i < ndims; i++) + { + int dimtype = ncvar->dimtype[i]; + lxdim |= (dimtype == X_AXIS); + lydim |= (dimtype == Y_AXIS); + lzdim |= (dimtype == Z_AXIS); + if (ncvar->cvarids[i] != CDI_UNDEFID) lcdim++; + // ltdim |= (dimtype == T_AXIS); + } + + int allcdims = lcdim; + + if (!lxdim && ncvar->xvarid != CDI_UNDEFID && ncvars[ncvar->xvarid].ndims == 0) lxdim = true; + if (!lydim && ncvar->yvarid != CDI_UNDEFID && ncvars[ncvar->yvarid].ndims == 0) lydim = true; + + // if ( ndims > 1 ) + for (int i = ndims - 1; i >= 0; i--) + { + if (ncvar->dimtype[i] == -1) + { + int dimtype; + if (!lxdim) + { + if (lcdim && ncvar->xvarid == CDI_UNDEFID) + { + int cdimvar = ncvar->cvarids[allcdims - lcdim]; + ncvar->xvarid = cdimvar; + lcdim--; + } + dimtype = X_AXIS; + lxdim = true; + } + else if (!lydim && ncvar->gridtype != GRID_UNSTRUCTURED) + // else if ( !lydim && ! (ncvars[ncvar->xvarid].dimids[0] == ncvars[ncvar->yvarid].dimids[0] && + // ncvars[ncvar->xvarid].ndims == 1 && ncvars[ncvar->yvarid].ndims == 1)) + { + if (lcdim && ncvar->yvarid == CDI_UNDEFID) + { + int cdimvar = ncvar->cvarids[allcdims - lcdim]; + ncvar->yvarid = cdimvar; + lcdim--; + } + dimtype = Y_AXIS; + lydim = true; + } + else if (!lzdim) + { + if (lcdim > 0) + { + int cdimvar = ncvar->cvarids[allcdims - lcdim]; + ncvar->zvarid = cdimvar; + lcdim--; + ncvars[cdimvar].zaxistype = ZAXIS_CHAR; + } + dimtype = Z_AXIS; + lzdim = true; + } + else + continue; + cdf_set_dim(ncvar, i, dimtype); + } + } + if (lcdim > 0) Warning("Could not assign all character coordinates to data variable!"); + } + } +} + +// verify coordinates vars - first scan (dimname == varname) +static void +verify_coordinates_vars_1(int ncid, int ndims, ncdim_t *ncdims, ncvar_t *ncvars, int timedimid, bool *isHybridCF) +{ + for (int ncdimid = 0; ncdimid < ndims; ncdimid++) + { + int ncvarid = ncdims[ncdimid].ncvarid; + if (ncvarid != -1) + { + ncvar_t *ncvar = &ncvars[ncvarid]; + if (ncvar->dimids[0] == timedimid) + { + ncvar->isTaxis = true; + ncdims[ncdimid].dimtype = T_AXIS; + continue; + } + + if (isHybridSigmaPressureCoordinate(ncid, ncvarid, ncvars, ncdims)) + { + *isHybridCF = true; + continue; + } + + if (ncvar->units[0] != 0) + { + if (is_lon_axis(ncvar->units, ncvar->stdname)) + { + ncvar->isLon = true; + cdf_set_var(ncvar, CoordVar); + cdf_set_dim(ncvar, 0, X_AXIS); + ncdims[ncdimid].dimtype = X_AXIS; + } + else if (is_lat_axis(ncvar->units, ncvar->stdname)) + { + ncvar->isLat = true; + cdf_set_var(ncvar, CoordVar); + cdf_set_dim(ncvar, 0, Y_AXIS); + ncdims[ncdimid].dimtype = Y_AXIS; + } + else if (is_x_axis(ncvar->units, ncvar->stdname)) + { + ncvar->isXaxis = true; + cdf_set_var(ncvar, CoordVar); + cdf_set_dim(ncvar, 0, X_AXIS); + ncdims[ncdimid].dimtype = X_AXIS; + } + else if (is_y_axis(ncvar->units, ncvar->stdname)) + { + ncvar->isYaxis = true; + cdf_set_var(ncvar, CoordVar); + cdf_set_dim(ncvar, 0, Y_AXIS); + ncdims[ncdimid].dimtype = Y_AXIS; + } + else if (is_pressure_units(ncvar->units)) + { + ncvar->zaxistype = ZAXIS_PRESSURE; + } + else if (str_is_equal(ncvar->units, "level") || str_is_equal(ncvar->units, "1")) + { + if (str_is_equal(ncvar->longname, "hybrid level at layer midpoints")) + ncvar->zaxistype = ZAXIS_HYBRID; + else if (strStartsWith(ncvar->longname, "hybrid level at midpoints")) + ncvar->zaxistype = ZAXIS_HYBRID; + else if (str_is_equal(ncvar->longname, "hybrid level at layer interfaces")) + ncvar->zaxistype = ZAXIS_HYBRID_HALF; + else if (strStartsWith(ncvar->longname, "hybrid level at interfaces")) + ncvar->zaxistype = ZAXIS_HYBRID_HALF; + else if (str_is_equal(ncvar->units, "level")) + ncvar->zaxistype = ZAXIS_GENERIC; + } + else if (is_DBL_axis(ncvar->longname)) + { + ncvar->zaxistype = ZAXIS_DEPTH_BELOW_LAND; + } + else if (is_height_units(ncvar->units)) + { + // clang-format off + if (is_depth_axis(ncvar->stdname, ncvar->longname)) ncvar->zaxistype = ZAXIS_DEPTH_BELOW_SEA; + else if (is_height_axis(ncvar->stdname, ncvar->longname)) ncvar->zaxistype = ZAXIS_HEIGHT; + else if (is_altitude_axis(ncvar->stdname, ncvar->longname)) ncvar->zaxistype = ZAXIS_ALTITUDE; + // clang-format on + } + } + else + { + // clang-format off + if (is_reference_axis(ncvar->stdname, ncvar->longname)) ncvar->zaxistype = ZAXIS_REFERENCE; + else if (str_is_equal(ncvar->stdname, "air_pressure")) ncvar->zaxistype = ZAXIS_PRESSURE; + // clang-format on + } + + if (!ncvar->isLon && (ncvar->longname[0] != 0) && !ncvar->isLat && (ncvar->longname[1] != 0)) + { + if (strStartsWith(ncvar->longname + 1, "ongitude")) + { + ncvar->isLon = true; + cdf_set_var(ncvar, CoordVar); + cdf_set_dim(ncvar, 0, X_AXIS); + ncdims[ncdimid].dimtype = X_AXIS; + continue; + } + else if (strStartsWith(ncvar->longname + 1, "atitude")) + { + ncvar->isLat = true; + cdf_set_var(ncvar, CoordVar); + cdf_set_dim(ncvar, 0, Y_AXIS); + ncdims[ncdimid].dimtype = Y_AXIS; + continue; + } + } + + if (ncvar->zaxistype != CDI_UNDEFID) + { + ncvar->isZaxis = true; + cdf_set_var(ncvar, CoordVar); + cdf_set_dim(ncvar, 0, Z_AXIS); + ncdims[ncdimid].dimtype = Z_AXIS; + } + } + } +} + +// verify coordinates vars - second scan (all other variables) +static void +verify_coordinates_vars_2(stream_t *streamptr, int nvars, ncvar_t *ncvars) +{ + for (int ncvarid = 0; ncvarid < nvars; ncvarid++) + { + ncvar_t *ncvar = &ncvars[ncvarid]; + if (ncvar->varStatus == CoordVar) + { + if (ncvar->units[0] != 0) + { + if (is_lon_axis(ncvar->units, ncvar->stdname)) + { + ncvar->isLon = true; + continue; + } + else if (is_lat_axis(ncvar->units, ncvar->stdname)) + { + ncvar->isLat = true; + continue; + } + else if (is_x_axis(ncvar->units, ncvar->stdname)) + { + ncvar->isXaxis = true; + continue; + } + else if (is_y_axis(ncvar->units, ncvar->stdname)) + { + ncvar->isYaxis = true; + continue; + } + else if (ncvar->zaxistype == CDI_UNDEFID && (str_is_equal(ncvar->units, "level") || str_is_equal(ncvar->units, "1"))) + { + // clang-format off + if (str_is_equal(ncvar->longname, "hybrid level at layer midpoints")) ncvar->zaxistype = ZAXIS_HYBRID; + else if (strStartsWith(ncvar->longname, "hybrid level at midpoints")) ncvar->zaxistype = ZAXIS_HYBRID; + else if (str_is_equal(ncvar->longname, "hybrid level at layer interfaces")) ncvar->zaxistype = ZAXIS_HYBRID_HALF; + else if (strStartsWith(ncvar->longname, "hybrid level at interfaces")) ncvar->zaxistype = ZAXIS_HYBRID_HALF; + else if (str_is_equal(ncvar->units, "level")) ncvar->zaxistype = ZAXIS_GENERIC; + // clang-format on + continue; + } + else if (ncvar->zaxistype == CDI_UNDEFID && is_pressure_units(ncvar->units)) + { + ncvar->zaxistype = ZAXIS_PRESSURE; + continue; + } + else if (is_DBL_axis(ncvar->longname)) + { + ncvar->zaxistype = ZAXIS_DEPTH_BELOW_LAND; + continue; + } + else if (is_height_units(ncvar->units)) + { + // clang-format off + if (is_depth_axis(ncvar->stdname, ncvar->longname)) ncvar->zaxistype = ZAXIS_DEPTH_BELOW_SEA; + else if (is_height_axis(ncvar->stdname, ncvar->longname)) ncvar->zaxistype = ZAXIS_HEIGHT; + // clang-format on + continue; + } + } + else if (str_is_equal(ncvar->stdname, "region") || str_is_equal(ncvar->stdname, "area_type") + || cdfInqDatatype(streamptr, ncvar->xtype, ncvar->isUnsigned) == CDI_DATATYPE_UINT8) + { + ncvar->isCharAxis = true; + } + else if (str_is_equal(ncvar->stdname, "air_pressure")) + ncvar->zaxistype = ZAXIS_PRESSURE; + + // not needed anymore for rotated grids + if (!ncvar->isLon && (ncvar->longname[0] != 0) && !ncvar->isLat && (ncvar->longname[1] != 0)) + { + if (strStartsWith(ncvar->longname + 1, "ongitude")) + { + ncvar->isLon = true; + continue; + } + else if (strStartsWith(ncvar->longname + 1, "atitude")) + { + ncvar->isLat = true; + continue; + } + } + } + } +} + +static void +grid_set_chunktype(grid_t *grid, ncvar_t *ncvar) +{ + if (ncvar->isChunked) + { + int ndims = ncvar->ndims; + + if (grid->type == GRID_UNSTRUCTURED) + { + size_t chunkSize = ncvar->chunks[ndims - 1]; + ncvar->chunkType = (chunkSize == grid->size) ? CDI_CHUNK_GRID : CDI_CHUNK_AUTO; + if (ncvar->chunkType == CDI_CHUNK_AUTO && ncvar->chunks[ndims - 1] > 1) ncvar->chunkSize = chunkSize; + } + else + { + if (grid->x.size > 1 && grid->y.size > 1 && ndims > 1 && grid->x.size == ncvar->chunks[ndims - 1] + && grid->y.size == ncvar->chunks[ndims - 2]) + ncvar->chunkType = CDI_CHUNK_GRID; + else if (grid->x.size > 1 && grid->x.size == ncvar->chunks[ndims - 1]) + ncvar->chunkType = CDI_CHUNK_LINES; + else + ncvar->chunkType = CDI_CHUNK_AUTO; + } + } +} + +// define all input grids +static void +cdf_load_vals(size_t size, int ndims, int varid, ncvar_t *ncvar, double **gridvals, struct xyValGet *valsGet, bool hasTimeDim, + bool readPart, size_t *start, size_t *count) +{ + if (CDI_Netcdf_Lazy_Grid_Load) + { + *valsGet = (struct xyValGet){ + .scalefactor = ncvar->scalefactor, + .addoffset = ncvar->addoffset, + .start = { start[0], start[1], start[2] }, + .count = { count[0], count[1], count[2] }, + .size = size, + .datasetNCId = ncvar->ncid, + .varNCId = varid, + .ndims = (short) ndims, + }; + *gridvals = cdfPendingLoad; + } + else + { + *gridvals = (double *) Malloc(size * sizeof(double)); + if (hasTimeDim || readPart) + cdf_get_vara_double(ncvar->ncid, varid, start, count, *gridvals); + else + cdf_get_var_double(ncvar->ncid, varid, *gridvals); + cdf_scale_add(size, *gridvals, ncvar->addoffset, ncvar->scalefactor); + } +} + +#ifndef USE_MPI +static void +cdf_load_cvals(size_t size, int varid, ncvar_t *ncvar, char ***gridvals, size_t dimlength) +{ + size_t startc[] = { 0, 0 }; + size_t countc[] = { 1, size / dimlength }; + *gridvals = (char **) Malloc(dimlength * sizeof(char *)); + for (size_t i = 0; i < dimlength; i++) + { + (*gridvals)[i] = (char *) Malloc((size / dimlength) * sizeof(char)); + cdf_get_vara_text(ncvar->ncid, varid, startc, countc, (*gridvals)[i]); + startc[0] = i + 1; + } +} +#endif + +static void +cdf_load_bounds(size_t size, ncvar_t *ncvar, double **gridbounds, struct cdfLazyGridIds *cellBoundsGet, bool readPart, + size_t *start, size_t *count) +{ + if (CDI_Netcdf_Lazy_Grid_Load) + { + cellBoundsGet->datasetNCId = ncvar->ncid; + cellBoundsGet->varNCId = ncvar->bounds; + *gridbounds = cdfPendingLoad; + } + else + { + *gridbounds = (double *) Malloc(size * sizeof(double)); + if (readPart) + cdf_get_vara_double(ncvar->ncid, ncvar->bounds, start, count, *gridbounds); + else + cdf_get_var_double(ncvar->ncid, ncvar->bounds, *gridbounds); + } +} + +static void +cdf_load_bounds_cube_sphere(size_t bxsize, size_t bysize, size_t size, ncvar_t *ncvar, double **gridbounds, + struct cdfLazyGridIds *cellBoundsGet) +{ + if (CDI_Netcdf_Lazy_Grid_Load) + { + cellBoundsGet->datasetNCId = ncvar->ncid; + cellBoundsGet->varNCId = ncvar->bounds; + *gridbounds = cdfPendingLoad; + } + else + { + float *bounds = (float *) Malloc(6 * bxsize * bysize * sizeof(float)); + cdf_get_var_float(ncvar->ncid, ncvar->bounds, bounds); + + *gridbounds = (double *) Malloc(size * sizeof(double)); + double *pbounds = *gridbounds; + + size_t m = 0; + for (size_t k = 0; k < 6; ++k) + for (size_t j = 0; j < (bysize - 1); ++j) + for (size_t i = 0; i < (bxsize - 1); ++i) + { + size_t offset = k * bysize * bxsize; + pbounds[m + 0] = bounds[offset + (j + 1) * bxsize + i]; + pbounds[m + 1] = bounds[offset + j * bxsize + i]; + pbounds[m + 2] = bounds[offset + j * bxsize + (i + 1)]; + pbounds[m + 3] = bounds[offset + (j + 1) * bxsize + (i + 1)]; + m += 4; + } + + Free(bounds); + } +} + +static void +cdf_load_cellarea(size_t size, ncvar_t *ncvar, double **gridarea, struct cdfLazyGridIds *cellAreaGet) +{ + if (CDI_Netcdf_Lazy_Grid_Load) + { + cellAreaGet->datasetNCId = ncvar->ncid; + cellAreaGet->varNCId = ncvar->cellarea; + *gridarea = cdfPendingLoad; + } + else + { + *gridarea = (double *) Malloc(size * sizeof(double)); + cdf_get_var_double(ncvar->ncid, ncvar->cellarea, *gridarea); + } +} + +static void +cdf_copy_grid_axis_attr(ncvar_t *ncvar, struct gridaxis_t *gridaxis) +{ + cdiDefVarKeyBytes(&gridaxis->keys, CDI_KEY_NAME, (const unsigned char *) ncvar->name, (int) strlen(ncvar->name) + 1); + if (ncvar->longname[0]) + cdiDefVarKeyBytes(&gridaxis->keys, CDI_KEY_LONGNAME, (const unsigned char *) ncvar->longname, + (int) strlen(ncvar->longname) + 1); + if (ncvar->units[0]) + cdiDefVarKeyBytes(&gridaxis->keys, CDI_KEY_UNITS, (const unsigned char *) ncvar->units, (int) strlen(ncvar->units) + 1); +#ifndef USE_MPI + if (gridaxis->cvals) + if (ncvar->stdname[0]) + cdiDefVarKeyBytes(&gridaxis->keys, CDI_KEY_STDNAME, (const unsigned char *) ncvar->stdname, (int) strlen(ncvar->stdname) + 1); +#endif +} + +static int +cdf_get_xydimid(int ndims, int *dimids, int *dimtype, int *xdimid, int *ydimid) +{ + int nxdims = 0, nydims = 0; + int xdimids[2] = { -1, -1 }, ydimids[2] = { -1, -1 }; + + for (int i = 0; i < ndims; i++) + { + if (dimtype[i] == X_AXIS && nxdims < 2) + { + xdimids[nxdims] = dimids[i]; + nxdims++; + } + else if (dimtype[i] == Y_AXIS && nydims < 2) + { + ydimids[nydims] = dimids[i]; + nydims++; + } + } + + if (nxdims == 2) + { + *xdimid = xdimids[1]; + *ydimid = xdimids[0]; + } + else if (nydims == 2) + { + *xdimid = ydimids[1]; + *ydimid = ydimids[0]; + } + else + { + *xdimid = xdimids[0]; + *ydimid = ydimids[0]; + } + + return nydims; +} + +static void +cdf_check_gridtype(int *gridtype, bool isLon, bool isLat, size_t xsize, size_t ysize, grid_t *grid) +{ + if (isLat && (isLon || xsize == 0)) + { + double yinc = 0.0; + if (isLon && ysize > 1) + { + yinc = fabs(grid->y.vals[0] - grid->y.vals[1]); + for (size_t i = 2; i < ysize; i++) + if ((fabs(grid->y.vals[i - 1] - grid->y.vals[i]) - yinc) > (yinc / 1000)) + { + yinc = 0; + break; + } + } + if (ysize < 10000 && IS_EQUAL(yinc, 0.0) && isGaussianLatitudes(ysize, grid->y.vals)) + { + *gridtype = GRID_GAUSSIAN; + grid->np = (int) (ysize / 2); + } + else + { + *gridtype = GRID_LONLAT; + } + } + else + { + *gridtype = (isLon && !isLat && ysize == 0) ? GRID_LONLAT : GRID_GENERIC; + } +} + +static bool +cdf_read_xcoord(stream_t *streamptr, struct cdfLazyGrid *lazyGrid, ncdim_t *ncdims, ncvar_t *ncvar, int xvarid, ncvar_t *axisvar, + size_t *xsize, size_t ysize, bool hasTimeDim, bool readPart, size_t *start, size_t *count, bool *isLon) +{ + grid_t *grid = &lazyGrid->base; + bool skipvar = true; + *isLon = axisvar->isLon; + int ndims = axisvar->ndims; + size_t size = 0; + + if (ndims == 1 && xtypeIsText(axisvar->xtype)) + { + ncvar->varStatus = CoordVar; + Warning("Unsupported x-coordinate type (char/string), skipped variable %s!", ncvar->name); + return true; + } + + int datatype = cdfInqDatatype(streamptr, axisvar->xtype, axisvar->isUnsigned); + + if ((ndims - hasTimeDim) == 2) + { + // Check size of 2 dimensional coordinates variables + int dimid = axisvar->dimids[ndims - 2]; + size_t dimsize1 = ncdims[dimid].len; + dimid = axisvar->dimids[ndims - 1]; + size_t dimsize2 = ncdims[dimid].len; + + if (datatype == CDI_DATATYPE_UINT8) + { + ncvar->gridtype = GRID_CHARXY; + size = dimsize1 * dimsize2; + skipvar = (dimsize1 != *xsize); + } + else + { + ncvar->gridtype = GRID_CURVILINEAR; + size = (*xsize) * ysize; + skipvar = (dimsize1 * dimsize2 != size); + } + } + else if ((ndims - hasTimeDim) == 1) + { + size = *xsize; + // Check size of 1 dimensional coordinates variables + int dimid = axisvar->dimids[ndims - 1]; + size_t dimsize = ncdims[dimid].len; + skipvar = readPart ? false : (dimsize != size); + } + else if (ndims == 0 && *xsize == 0) + { + size = *xsize = 1; + skipvar = false; + } + else if (ncvar->isCubeSphere) + { + size = *xsize; + skipvar = false; + } + + if (skipvar) + { + Warning("Unsupported array structure, skipped variable %s!", ncvar->name); + ncvar->varStatus = UndefVar; + return true; + } + + if (datatype != -1) grid->datatype = datatype; + + if (datatype == CDI_DATATYPE_UINT8 && !CDI_Netcdf_Lazy_Grid_Load) + { +#ifndef USE_MPI + cdf_load_cvals(size, xvarid, axisvar, &grid->x.cvals, *xsize); + grid->x.clength = size / (*xsize); +#endif + } + else + cdf_load_vals(size, ndims, xvarid, axisvar, &grid->x.vals, &lazyGrid->xValsGet, hasTimeDim, readPart, start, count); + + cdf_copy_grid_axis_attr(axisvar, &grid->x); + + return false; +} + +static bool +cdf_read_ycoord(stream_t *streamptr, struct cdfLazyGrid *lazyGrid, ncdim_t *ncdims, ncvar_t *ncvar, int yvarid, ncvar_t *axisvar, + size_t xsize, size_t *ysize, bool hasTimeDim, bool readPart, size_t *start, size_t *count, bool *isLat) +{ + grid_t *grid = &lazyGrid->base; + bool skipvar = true; + *isLat = axisvar->isLat; + int ndims = axisvar->ndims; + size_t size = 0; + + if (ndims == 1 && xtypeIsText(axisvar->xtype)) + { + ncvar->varStatus = CoordVar; + Warning("Unsupported y-coordinate type (char/string), skipped variable %s!", ncvar->name); + return true; + } + + int datatype = cdfInqDatatype(streamptr, axisvar->xtype, axisvar->isUnsigned); + + if ((ndims - hasTimeDim) == 2) + { + // Check size of 2 dimensional coordinates variables + int dimid = axisvar->dimids[ndims - 2]; + size_t dimsize1 = ncdims[dimid].len; + dimid = axisvar->dimids[ndims - 1]; + size_t dimsize2 = ncdims[dimid].len; + + if (datatype == CDI_DATATYPE_UINT8) + { + ncvar->gridtype = GRID_CHARXY; + size = dimsize1 * dimsize2; + skipvar = (dimsize1 != *ysize); + } + else + { + ncvar->gridtype = GRID_CURVILINEAR; + size = xsize * (*ysize); + skipvar = (dimsize1 * dimsize2 != size); + } + } + else if ((ndims - hasTimeDim) == 1) + { + size = (*ysize) ? *ysize : xsize; + int dimid = axisvar->dimids[ndims - 1]; + size_t dimsize = ncdims[dimid].len; + skipvar = readPart ? false : (dimsize != size); + } + else if (ndims == 0 && *ysize == 0) + { + size = *ysize = 1; + skipvar = false; + } + else if (ncvar->isCubeSphere) + { + size = *ysize; + skipvar = false; + } + + if (skipvar) + { + Warning("Unsupported array structure, skipped variable %s!", ncvar->name); + ncvar->varStatus = UndefVar; + return true; + } + + if (datatype != -1) grid->datatype = datatype; + + if (datatype == CDI_DATATYPE_UINT8 && !CDI_Netcdf_Lazy_Grid_Load) + { +#ifndef USE_MPI + cdf_load_cvals(size, yvarid, axisvar, &grid->y.cvals, *ysize); + grid->y.clength = size / (*ysize); +#endif + } + else + cdf_load_vals(size, ndims, yvarid, axisvar, &grid->y.vals, &lazyGrid->yValsGet, hasTimeDim, readPart, start, count); + + cdf_copy_grid_axis_attr(axisvar, &grid->y); + + return false; +} + +typedef struct +{ + long start; + long count; + bool readPart; +} GridPart; + +static void +gridpart_init(GridPart *gridPart) +{ + gridPart->start = -1; + gridPart->count = -1; + gridPart->readPart = false; +} + +static bool +cdf_read_coordinates(stream_t *streamptr, struct cdfLazyGrid *lazyGrid, ncvar_t *ncvar, ncvar_t *ncvars, ncdim_t *ncdims, + int timedimid, int xvarid, int yvarid, size_t xsize, size_t ysize, int *vdimid, const GridPart *gridPart) +{ + grid_t *grid = &lazyGrid->base; + size_t size = 0; + size_t start[3] = { 0, 0, 0 }, count[3] = { 1, 1, 1 }; + bool readPart = false; + + grid->datatype = CDI_DATATYPE_FLT64; + + if (ncvar->gridtype == GRID_TRAJECTORY) + { + if (ncvar->xvarid == CDI_UNDEFID) Error("Longitude coordinates undefined for %s!", ncvar->name); + if (ncvar->yvarid == CDI_UNDEFID) Error("Latitude coordinates undefined for %s!", ncvar->name); + } + else + { + bool hasTimeDim = false; + + if (xvarid != CDI_UNDEFID && yvarid != CDI_UNDEFID) + { + int ndims = ncvars[xvarid].ndims; + if (ndims != ncvars[yvarid].ndims && !ncvars[xvarid].isCharAxis && !ncvars[yvarid].isCharAxis) + { + Warning("Inconsistent grid structure for variable %s!", ncvar->name); + ncvar->xvarid = xvarid = CDI_UNDEFID; + ncvar->yvarid = yvarid = CDI_UNDEFID; + } + if (ndims > 1) + { + if (ndims <= 3) + { + if (ncvars[xvarid].dimids[0] == timedimid && ncvars[yvarid].dimids[0] == timedimid) + { + static bool ltwarn = true; + size_t ntsteps = 0; + cdf_inq_dimlen(ncvar->ncid, ncdims[timedimid].dimid, &ntsteps); + if (ltwarn && ntsteps > 1) Warning("Time varying grids unsupported, using grid at time step 1!"); + ltwarn = false; + hasTimeDim = true; + count[1] = ysize; + count[2] = xsize; + } + } + else + { + Warning("Unsupported grid structure for variable %s (grid dims > 2)!", ncvar->name); + ncvar->xvarid = xvarid = CDI_UNDEFID; + ncvar->yvarid = yvarid = CDI_UNDEFID; + } + } + else if (gridPart && gridPart->readPart) + { + start[0] = gridPart->start; + count[0] = gridPart->count; + readPart = true; + } + } + + if (xvarid != CDI_UNDEFID) + { + if (!ncvar->isCubeSphere && (ncvars[xvarid].ndims - hasTimeDim) > 2) + { + Warning("Coordinates variable %s has too many dimensions (%d), skipped!", ncvars[xvarid].name, ncvars[xvarid].ndims); + // ncvar->xvarid = CDI_UNDEFID; + xvarid = CDI_UNDEFID; + } + } + + if (yvarid != CDI_UNDEFID) + { + if (!ncvar->isCubeSphere && (ncvars[yvarid].ndims - hasTimeDim) > 2) + { + Warning("Coordinates variable %s has too many dimensions (%d), skipped!", ncvars[yvarid].name, ncvars[yvarid].ndims); + // ncvar->yvarid = CDI_UNDEFID; + yvarid = CDI_UNDEFID; + } + } + + bool isLon = false, isLat = false; + + if (xvarid != CDI_UNDEFID) + if (cdf_read_xcoord(streamptr, lazyGrid, ncdims, ncvar, xvarid, &ncvars[xvarid], &xsize, ysize, hasTimeDim, readPart, start, + count, &isLon)) + return true; + + if (yvarid != CDI_UNDEFID) + if (cdf_read_ycoord(streamptr, lazyGrid, ncdims, ncvar, yvarid, &ncvars[yvarid], xsize, &ysize, hasTimeDim, readPart, start, + count, &isLat)) + return true; + + // clang-format off + if (ncvar->gridtype == GRID_UNSTRUCTURED) size = xsize; + else if (ncvar->gridtype == GRID_GAUSSIAN_REDUCED) size = xsize; + else if (ysize == 0) size = xsize; + else if (xsize == 0) size = ysize; + else size = xsize * ysize; + // clang-format on + + if (ncvar->gridtype == CDI_UNDEFID || ncvar->gridtype == GRID_GENERIC) + cdf_check_gridtype(&ncvar->gridtype, isLon, isLat, xsize, ysize, grid); + } + + int gridtype = grid->type; + if (gridtype != GRID_PROJECTION) + { + gridtype = ncvar->gridtype; + } + else if (gridtype == GRID_PROJECTION && ncvar->gridtype == GRID_LONLAT) + { + int gmapvarid = ncvar->gmapid; + if (gmapvarid != CDI_UNDEFID && cdfCheckAttText(ncvar->ncid, gmapvarid, "grid_mapping_name")) + { + char attstring[CDI_MAX_NAME]; + cdfGetAttText(ncvar->ncid, gmapvarid, "grid_mapping_name", CDI_MAX_NAME, attstring); + if (str_is_equal(attstring, "latitude_longitude")) gridtype = ncvar->gridtype; + } + } + + switch (gridtype) + { + case GRID_GENERIC: + case GRID_LONLAT: + case GRID_GAUSSIAN: + case GRID_UNSTRUCTURED: + case GRID_CURVILINEAR: + case GRID_PROJECTION: + { + grid->size = size; + grid->x.size = xsize; + grid->y.size = ysize; + if (xvarid != CDI_UNDEFID && CDI_Read_Cell_Corners) + { + grid->x.flag = 1; + int bvarid = ncvars[xvarid].bounds; + if (bvarid != CDI_UNDEFID) + { + int ndims = ncvars[xvarid].ndims; + int nbdims = ncvars[bvarid].ndims; + if (nbdims == 2 || nbdims == 3) + { + if (ncvars[bvarid].dimids[0] == timedimid) + { + static bool ltwarn = true; + if (ltwarn) Warning("Time varying grid x-bounds unsupported, skipped!"); + ltwarn = false; + } + else if (ncvar->isCubeSphere) + { + grid->nvertex = 4; + size_t bxsize = ncdims[ncvars[bvarid].dimids[2]].len; + size_t bysize = ncdims[ncvars[bvarid].dimids[1]].len; + cdf_load_bounds_cube_sphere(bxsize, bysize, size * (size_t) grid->nvertex, &ncvars[xvarid], &grid->x.bounds, + &lazyGrid->xBoundsGet); + } + else if (nbdims == ndims + 1) + { + *vdimid = ncvars[bvarid].dimids[nbdims - 1]; + grid->nvertex = (int) ncdims[*vdimid].len; + if (readPart) + { + start[1] = 0; + count[1] = grid->nvertex; + } + cdf_load_bounds(size * (size_t) grid->nvertex, &ncvars[xvarid], &grid->x.bounds, &lazyGrid->xBoundsGet, + readPart, start, count); + } + else + { + static bool lwarn = true; + if (lwarn) Warning("x-bounds doesn't follow the CF-Convention, skipped!"); + lwarn = false; + } + } + } + } + if (yvarid != CDI_UNDEFID && CDI_Read_Cell_Corners) + { + grid->y.flag = 1; + int bvarid = ncvars[yvarid].bounds; + if (bvarid != CDI_UNDEFID) + { + int ndims = ncvars[yvarid].ndims; + int nbdims = ncvars[bvarid].ndims; + if (nbdims == 2 || nbdims == 3) + { + if (ncvars[bvarid].dimids[0] == timedimid) + { + static bool ltwarn = true; + if (ltwarn) Warning("Time varying grid y-bounds unsupported, skipped!"); + ltwarn = false; + } + else if (ncvar->isCubeSphere) + { + grid->nvertex = 4; + size_t bxsize = ncdims[ncvars[bvarid].dimids[2]].len; + size_t bysize = ncdims[ncvars[bvarid].dimids[1]].len; + cdf_load_bounds_cube_sphere(bxsize, bysize, size * (size_t) grid->nvertex, &ncvars[yvarid], &grid->y.bounds, + &lazyGrid->yBoundsGet); + } + else if (nbdims == ndims + 1) + { + if (*vdimid == CDI_UNDEFID) + { + *vdimid = ncvars[bvarid].dimids[nbdims - 1]; + grid->nvertex = (int) ncdims[*vdimid].len; + } + if (readPart) + { + start[1] = 0; + count[1] = grid->nvertex; + } + cdf_load_bounds(size * (size_t) grid->nvertex, &ncvars[yvarid], &grid->y.bounds, &lazyGrid->yBoundsGet, + readPart, start, count); + } + else + { + static bool lwarn = true; + if (lwarn) Warning("y-bounds doesn't follow the CF-Convention, skipped!"); + lwarn = false; + } + } + } + } + + if (ncvar->cellarea != CDI_UNDEFID) cdf_load_cellarea(size, ncvar, &grid->area, &lazyGrid->cellAreaGet); + + if (gridtype == GRID_GAUSSIAN) + { + if (ncvar->numLPE > 0) grid->np = ncvar->numLPE; + } + + break; + } + case GRID_GAUSSIAN_REDUCED: + { + if (ncvar->numLPE > 0 && ncvar->rpvarid != CDI_UNDEFID) + { + if (ncvars[ncvar->rpvarid].ndims == 1) + { + grid->size = size; + int dimid = ncvars[ncvar->rpvarid].dimids[0]; + size_t len = ncdims[dimid].len; + grid->y.size = len; + grid->reducedPointsSize = len; + grid->reducedPoints = (int *) Malloc(len * sizeof(int)); + cdf_get_var_int(ncvar->ncid, ncvar->rpvarid, grid->reducedPoints); + grid->np = ncvar->numLPE; + + int bvarid = (yvarid == CDI_UNDEFID) ? CDI_UNDEFID : ncvars[yvarid].bounds; + if (bvarid != CDI_UNDEFID) + { + int nbdims = ncvars[bvarid].ndims; + if (nbdims == 2 || nbdims == 3) + { + if (*vdimid == CDI_UNDEFID) + { + *vdimid = ncvars[bvarid].dimids[nbdims - 1]; + grid->nvertex = (int) ncdims[*vdimid].len; + } + cdf_load_bounds(size * (size_t) grid->nvertex, &ncvars[yvarid], &grid->y.bounds, &lazyGrid->yBoundsGet, + false, NULL, NULL); + } + } + } + } + break; + } + case GRID_SPECTRAL: + { + grid->size = size; + grid->lcomplex = 1; + grid->trunc = ncvar->truncation; + break; + } + case GRID_FOURIER: + { + grid->size = size; + grid->trunc = ncvar->truncation; + break; + } + case GRID_TRAJECTORY: + { + grid->size = 1; + break; + } + case GRID_CHARXY: + { + grid->size = size; + grid->x.size = xsize; + grid->y.size = ysize; + break; + } + } + + // if ( grid->type != GRID_PROJECTION && grid->type != ncvar->gridtype ) + if (grid->type != gridtype) + { + // int gridtype = ncvar->gridtype; + grid->type = gridtype; + cdiGridTypeInit(grid, gridtype, grid->size); + } + + if (grid->size == 0) + { + int ndims = ncvar->ndims; + int *dimtype = ncvar->dimtype; + if (ndims == 0 || (ndims == 1 && dimtype[0] == T_AXIS) || (ndims == 1 && dimtype[0] == Z_AXIS) + || (ndims == 2 && dimtype[0] == T_AXIS && dimtype[1] == Z_AXIS)) + { + grid->type = GRID_GENERIC; + grid->size = 1; + grid->x.size = 0; + grid->y.size = 0; + } + else + { + Warning("Unsupported grid, skipped variable %s!", ncvar->name); + ncvar->varStatus = UndefVar; + return true; + } + } + + return false; +} + +static bool +cdf_set_unstructured_par(ncvar_t *ncvar, grid_t *grid, int *xdimid, int *ydimid, GridInfo *gridInfo, bool readPart) +{ + int ndims = ncvar->ndims; + int *dimtype = ncvar->dimtype; + + int zdimid = CDI_UNDEFID; + int xdimidx = CDI_UNDEFID, ydimidx = CDI_UNDEFID; + + for (int i = 0; i < ndims; i++) + { + // clang-format off + if (dimtype[i] == X_AXIS) xdimidx = i; + else if (dimtype[i] == Y_AXIS) ydimidx = i; + else if (dimtype[i] == Z_AXIS) zdimid = ncvar->dimids[i]; + // clang-format on + } + + if (*xdimid != CDI_UNDEFID && *ydimid != CDI_UNDEFID && zdimid == CDI_UNDEFID) + { + if (grid->x.size > grid->y.size && grid->y.size < 1000) + { + dimtype[ydimidx] = Z_AXIS; + *ydimid = CDI_UNDEFID; + grid->size = grid->x.size; + grid->y.size = 0; + } + else if (grid->y.size > grid->x.size && grid->x.size < 1000) + { + dimtype[xdimidx] = Z_AXIS; + *xdimid = *ydimid; + *ydimid = CDI_UNDEFID; + grid->size = grid->y.size; + grid->x.size = grid->y.size; + grid->y.size = 0; + } + } + + if (grid->size != grid->x.size) + { + Warning("Unsupported array structure, skipped variable %s!", ncvar->name); + ncvar->varStatus = UndefVar; + return true; + } + + if (!readPart) + { + if (gridInfo->number_of_grid_used != CDI_UNDEFID) + cdiDefVarKeyInt(&grid->keys, CDI_KEY_NUMBEROFGRIDUSED, gridInfo->number_of_grid_used); + if (ncvar->position > 0) cdiDefVarKeyInt(&grid->keys, CDI_KEY_NUMBEROFGRIDINREFERENCE, ncvar->position); + if (!cdiUUIDIsNull(gridInfo->uuid)) cdiDefVarKeyBytes(&grid->keys, CDI_KEY_UUID, gridInfo->uuid, CDI_UUID_SIZE); + } + + return false; +} + +static void +cdf_read_mapping_atts(int ncid, int gmapvarid, int projID) +{ + if (cdfCheckAttText(ncid, gmapvarid, "grid_mapping_name")) + { + char attstring[CDI_MAX_NAME]; + cdfGetAttText(ncid, gmapvarid, "grid_mapping_name", CDI_MAX_NAME, attstring); + cdiDefKeyString(projID, CDI_GLOBAL, CDI_KEY_GRIDMAP_NAME, attstring); + } + + int nvatts; + cdf_inq_varnatts(ncid, gmapvarid, &nvatts); + bool removeFillValue = true; + for (int attnum = 0; attnum < nvatts; ++attnum) cdf_set_cdi_attr(ncid, gmapvarid, attnum, projID, CDI_GLOBAL, removeFillValue); +} + +static void +cdf_set_grid_to_similar_vars(ncvar_t *ncvar1, ncvar_t *ncvar2, int gridtype, int xdimid, int ydimid) +{ + if (ncvar2->varStatus == DataVar && ncvar2->gridID == CDI_UNDEFID) + { + int xdimid2 = CDI_UNDEFID, ydimid2 = CDI_UNDEFID, zdimid2 = CDI_UNDEFID; + int xdimidx = CDI_UNDEFID, ydimidx = CDI_UNDEFID; + + const int *dimtype2 = ncvar2->dimtype; + const int *dimids2 = ncvar2->dimids; + int ndims2 = ncvar2->ndims; + for (int i = 0; i < ndims2; i++) + { + if (dimtype2[i] == X_AXIS) + { + xdimid2 = dimids2[i]; + xdimidx = i; + } + else if (dimtype2[i] == Y_AXIS) + { + ydimid2 = dimids2[i]; + ydimidx = i; + } + else if (dimtype2[i] == Z_AXIS) + { + zdimid2 = dimids2[i]; + } + } + + if (!ncvar2->isCubeSphere) + { + if (ncvar2->gridtype == CDI_UNDEFID && gridtype == GRID_UNSTRUCTURED) + { + if (xdimid == xdimid2 && ydimid2 != CDI_UNDEFID && zdimid2 == CDI_UNDEFID) + { + ncvar2->dimtype[ydimidx] = Z_AXIS; + ydimid2 = CDI_UNDEFID; + } + + if (xdimid == ydimid2 && xdimid2 != CDI_UNDEFID && zdimid2 == CDI_UNDEFID) + { + ncvar2->dimtype[xdimidx] = Z_AXIS; + xdimid2 = ydimid2; + ydimid2 = CDI_UNDEFID; + } + } + else if (ncvar2->gridtype == GRID_GAUSSIAN_REDUCED && gridtype == GRID_GAUSSIAN_REDUCED) + { + ydimid = CDI_UNDEFID; + } + } + + if (xdimid == xdimid2 && (ydimid == ydimid2 || (xdimid == ydimid && ydimid2 == CDI_UNDEFID))) + { + bool isSameGrid + = (ncvar1->xvarid == ncvar2->xvarid && ncvar1->yvarid == ncvar2->yvarid && ncvar1->position == ncvar2->position); + + // if (xvarid != -1 && ncvar2->xvarid != CDI_UNDEFID && xvarid != ncvar2->xvarid) isSameGrid = false; + // if (yvarid != -1 && ncvar2->yvarid != CDI_UNDEFID && yvarid != ncvar2->yvarid) isSameGrid = false; + + if (isSameGrid) + { + if (CDI_Debug) Message("Same gridID %d %s", ncvar1->gridID, ncvar2->name); + ncvar2->gridID = ncvar1->gridID; + ncvar2->chunkType = ncvar1->chunkType; + ncvar2->chunkSize = ncvar1->chunkSize; + ncvar2->gridSize = ncvar1->gridSize; + } + } + } +} + +static void +destroy_grid(struct cdfLazyGrid *lazyGrid, grid_t *grid) +{ + if (lazyGrid) + { + if (CDI_Netcdf_Lazy_Grid_Load) cdfLazyGridDestroy(lazyGrid); + if (grid) + { + grid_free(grid); + Free(grid); + } + } +} + +static int +cdf_define_all_grids(stream_t *streamptr, ncgrid_t *ncgrid, int vlistID, ncdim_t *ncdims, int nvars, ncvar_t *ncvars, + GridInfo *gridInfo) +{ + for (int ncvarid = 0; ncvarid < nvars; ++ncvarid) + { + ncvar_t *ncvar = &ncvars[ncvarid]; + if (ncvar->varStatus == DataVar && ncvar->gridID == CDI_UNDEFID) + { + GridPart gridPart; + gridpart_init(&gridPart); + int ndims = ncvar->ndims; + int *dimtype = ncvar->dimtype; + int vdimid = CDI_UNDEFID; + struct addIfNewRes projAdded = { .Id = CDI_UNDEFID, .isNew = 0 }, gridAdded = { .Id = CDI_UNDEFID, .isNew = 0 }; + int xdimid = CDI_UNDEFID, ydimid = CDI_UNDEFID; + int nydims = cdf_get_xydimid(ndims, ncvar->dimids, dimtype, &xdimid, &ydimid); + + int xaxisid = (xdimid != CDI_UNDEFID) ? ncdims[xdimid].ncvarid : CDI_UNDEFID; + int yaxisid = (ydimid != CDI_UNDEFID) ? ncdims[ydimid].ncvarid : CDI_UNDEFID; + int xvarid = (ncvar->xvarid != CDI_UNDEFID) ? ncvar->xvarid : xaxisid; + int yvarid = (ncvar->yvarid != CDI_UNDEFID) ? ncvar->yvarid : yaxisid; + + size_t xsize = (xdimid != CDI_UNDEFID) ? ncdims[xdimid].len : 0; + size_t ysize = (ydimid != CDI_UNDEFID) ? ncdims[ydimid].len : 0; + + if (ydimid == CDI_UNDEFID && yvarid != CDI_UNDEFID) + { + if (ncvars[yvarid].ndims == 1) + { + ydimid = ncvars[yvarid].dimids[0]; + ysize = ncdims[ydimid].len; + } + } + + int gmapvarid = ncvar->gmapid; + bool lproj = (gmapvarid != CDI_UNDEFID); + + if (!lproj && xaxisid != CDI_UNDEFID && xaxisid != xvarid && yaxisid != CDI_UNDEFID && yaxisid != yvarid) lproj = true; + + if (ncvar->isCubeSphere && lproj && xvarid != CDI_UNDEFID && yvarid != CDI_UNDEFID && ncvars[xvarid].ndims == 3 + && ncvars[yvarid].ndims == 3) + { + lproj = false; + ncvar->gridtype = GRID_UNSTRUCTURED; + xsize = xsize * ysize * 6; + ysize = xsize; + } + + bool lgrid = !(lproj && ncvar->xvarid == CDI_UNDEFID); + + bool isUnstructured = (xdimid != CDI_UNDEFID && xdimid == ydimid && nydims == 0); + if ((ncvar->gridtype == CDI_UNDEFID || ncvar->gridtype == GRID_GENERIC) && isUnstructured) + ncvar->gridtype = GRID_UNSTRUCTURED; + + struct cdfLazyGrid *lazyGrid = NULL, *lazyProj = NULL; + + { + int gridtype = (!lgrid) ? GRID_PROJECTION : ncvar->gridtype; + if (CDI_Netcdf_Lazy_Grid_Load) + { + cdfLazyGridRenew(&lazyGrid, gridtype); + if (lgrid && lproj) cdfLazyGridRenew(&lazyProj, GRID_PROJECTION); + } + else + { + cdfBaseGridRenew(&lazyGrid, gridtype); + if (lgrid && lproj) cdfBaseGridRenew(&lazyProj, GRID_PROJECTION); + } + } + grid_t *grid = &lazyGrid->base; + grid_t *proj = (lgrid && lproj) ? &lazyProj->base : NULL; + + xaxisid = (xdimid != CDI_UNDEFID) ? ncdims[xdimid].ncvarid : CDI_UNDEFID; + yaxisid = (ydimid != CDI_UNDEFID) ? ncdims[ydimid].ncvarid : CDI_UNDEFID; + + // process query information if available + CdiQuery *query = streamptr->query; + if (query) + { + if (ncvar->gridtype != GRID_UNSTRUCTURED) + { + Warning("Query parameter cell is only available for unstructured grids, skipped variable %s!", ncvar->name); + ncvar->varStatus = UndefVar; + continue; + } + + int numCellidx = cdiQueryNumCellidx(query); + if (numCellidx > 0) + { + size_t start = cdiQueryGetCellidx(query, 0); + size_t count = (numCellidx == 2) ? cdiQueryGetCellidx(query, 1) : 1; + if ((start + count) <= xsize) + { + cdiQueryCellidx(query, start); + if (numCellidx == 2) cdiQueryCellidx(query, count); + xsize = count; + ysize = count; + gridPart.start = start - 1; + gridPart.count = count; + gridPart.readPart = true; + } + } + } + + if (cdf_read_coordinates(streamptr, lazyGrid, ncvar, ncvars, ncdims, gridInfo->timedimid, xvarid, yvarid, xsize, ysize, + &vdimid, &gridPart)) + continue; + + if (gridInfo->number_of_grid_used != CDI_UNDEFID && (grid->type == CDI_UNDEFID || grid->type == GRID_GENERIC) + && xdimid != CDI_UNDEFID && xsize > 999) + grid->type = GRID_UNSTRUCTURED; + + if (!ncvar->isCubeSphere && grid->type == GRID_UNSTRUCTURED) + if (cdf_set_unstructured_par(ncvar, grid, &xdimid, &ydimid, gridInfo, gridPart.readPart)) continue; + + if (lgrid && lproj) + { + int dimid; + cdf_read_coordinates(streamptr, lazyProj, ncvar, ncvars, ncdims, gridInfo->timedimid, xaxisid, yaxisid, xsize, ysize, + &dimid, NULL); + } + + if (CDI_Debug) + { + Message("grid: type = %d, size = %zu, nx = %zu, ny = %zu", grid->type, grid->size, grid->x.size, grid->y.size); + if (proj) + Message("proj: type = %d, size = %zu, nx = %zu, ny = %zu", proj->type, proj->size, proj->x.size, proj->y.size); + } + + if (lgrid && lproj) + { + projAdded = cdiVlistAddGridIfNew(vlistID, proj, 2); + grid->proj = projAdded.Id; + } + + gridAdded = cdiVlistAddGridIfNew(vlistID, grid, 1); + ncvar->gridID = gridAdded.Id; + ncvar->gridSize = grid->size; + + int gridID = ncvar->gridID; + + if (lproj && gmapvarid != CDI_UNDEFID) + { + bool gridIsNew = lgrid ? projAdded.isNew : gridAdded.isNew; + if (gridIsNew) + { + int projID = lgrid ? grid->proj : gridID; + int ncid = ncvars[gmapvarid].ncid; + int gmapvartype = ncvars[gmapvarid].xtype; + cdiDefKeyInt(projID, CDI_GLOBAL, CDI_KEY_GRIDMAP_VARTYPE, gmapvartype); + const char *gmapvarname = ncvars[gmapvarid].name; + cdf_read_mapping_atts(ncid, gmapvarid, projID); + cdiDefKeyString(projID, CDI_GLOBAL, CDI_KEY_GRIDMAP_VARNAME, gmapvarname); + gridVerifyProj(projID); + } + } + + if (grid->type == GRID_UNSTRUCTURED && gridInfo->gridfile[0] != 0 && !gridPart.readPart) + gridDefReference(gridID, gridInfo->gridfile); + + if (ncvar->isChunked) grid_set_chunktype(grid, ncvar); + + int gridindex = vlistGridIndex(vlistID, gridID); + if (gridPart.readPart) + { + ncgrid[gridindex].start = gridPart.start; + ncgrid[gridindex].count = gridPart.count; + } + ncgrid[gridindex].gridID = gridID; + if (grid->type == GRID_TRAJECTORY) + { + ncgrid[gridindex].ncIDs[CDF_VARID_X] = xvarid; + ncgrid[gridindex].ncIDs[CDF_VARID_Y] = yvarid; + } + else + { + if (xdimid != CDI_UNDEFID) ncgrid[gridindex].ncIDs[CDF_DIMID_X] = ncdims[xdimid].dimid; + if (ydimid != CDI_UNDEFID) ncgrid[gridindex].ncIDs[CDF_DIMID_Y] = ncdims[ydimid].dimid; + if (ncvar->isCubeSphere) ncgrid[gridindex].ncIDs[CDF_DIMID_E] = ncdims[ncvar->dimids[ndims - 3]].dimid; + } + + if (xdimid == CDI_UNDEFID && ydimid == CDI_UNDEFID && grid->size == 1) gridDefHasDims(gridID, CoordVar); + + if (xdimid != CDI_UNDEFID) cdiDefKeyString(gridID, CDI_XAXIS, CDI_KEY_DIMNAME, ncdims[xdimid].name); + if (ydimid != CDI_UNDEFID) cdiDefKeyString(gridID, CDI_YAXIS, CDI_KEY_DIMNAME, ncdims[ydimid].name); + if (vdimid != CDI_UNDEFID) cdiDefKeyString(gridID, CDI_GLOBAL, CDI_KEY_VDIMNAME, ncdims[vdimid].name); + + if (CDI_Debug) Message("gridID %d %d %s", gridID, ncvarid, ncvar->name); + + for (int ncvarid2 = ncvarid + 1; ncvarid2 < nvars; ncvarid2++) + cdf_set_grid_to_similar_vars(ncvar, &ncvars[ncvarid2], grid->type, xdimid, ydimid); + + if (gridAdded.isNew) lazyGrid = NULL; + if (projAdded.isNew) lazyProj = NULL; + + if (lazyGrid) destroy_grid(lazyGrid, grid); + if (lazyProj) destroy_grid(lazyProj, proj); + } + } + + return 0; +} + +// define all input zaxes +static int +cdf_define_all_zaxes(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int nvars, ncvar_t *ncvars, size_t vctsize_echam, + double *vct_echam, unsigned char *uuidOfVGrid) +{ + char *pname, *plongname, *punits, *pstdname; + size_t vctsize = vctsize_echam; + double *vct = vct_echam; + + for (int ncvarid = 0; ncvarid < nvars; ncvarid++) + { + ncvar_t *ncvar = &ncvars[ncvarid]; + if (ncvar->varStatus == DataVar && ncvar->zaxisID == CDI_UNDEFID) + { + bool isScalar = false; + bool withBounds = false; + int zdimid = CDI_UNDEFID; + int zvarid = CDI_UNDEFID; + size_t zsize = 1; + int psvarid = -1; + int p0varid = -1; + + int positive = 0; + int ndims = ncvar->ndims; + + if (ncvar->zvarid != -1 && ncvars[ncvar->zvarid].ndims == 0) + { + zvarid = ncvar->zvarid; + isScalar = true; + } + else + { + for (int i = 0; i < ndims; i++) + { + if (ncvar->dimtype[i] == Z_AXIS) zdimid = ncvar->dimids[i]; + } + + if (zdimid != CDI_UNDEFID) + { + // zvarid = ncdims[zdimid].ncvarid; + zvarid = (ncvar->zvarid != CDI_UNDEFID) ? ncvar->zvarid : ncdims[zdimid].ncvarid; + zsize = ncdims[zdimid].len; + } + } + + if (CDI_Debug) Message("nlevs = %zu", zsize); + + double *zvar = NULL; + char **zcvals = NULL; + size_t zclength = 0; + + int zaxisType = CDI_UNDEFID; + if (zvarid != CDI_UNDEFID) zaxisType = ncvars[zvarid].zaxistype; + if (zaxisType == CDI_UNDEFID) zaxisType = ZAXIS_GENERIC; + + int zdatatype = CDI_DATATYPE_FLT64; + double *lbounds = NULL; + double *ubounds = NULL; + + if (zvarid != CDI_UNDEFID) + { + positive = ncvars[zvarid].positive; + pname = ncvars[zvarid].name; + plongname = ncvars[zvarid].longname; + punits = ncvars[zvarid].units; + pstdname = ncvars[zvarid].stdname; + // clang-format off + if (ncvars[zvarid].xtype == NC_FLOAT) zdatatype = CDI_DATATYPE_FLT32; + else if (ncvars[zvarid].xtype == NC_INT) zdatatype = CDI_DATATYPE_INT32; + else if (ncvars[zvarid].xtype == NC_SHORT) zdatatype = CDI_DATATYPE_INT16; + // clang-format on + // don't change the name !!! + /* + if ((len = strlen(pname)) > 2) + if (pname[len-2] == '_' && isdigit((int) pname[len-1])) pname[len-2] = 0; + */ +#ifndef USE_MPI + if (zaxisType == ZAXIS_CHAR && ncvars[zvarid].ndims == 2) + { + zdatatype = CDI_DATATYPE_UINT8; + zclength = ncdims[ncvars[zvarid].dimids[1]].len; + cdf_load_cvals(zsize * zclength, zvarid, ncvar, &zcvals, zsize); + } +#endif + + if (zaxisType == ZAXIS_HYBRID && ncvars[zvarid].vct) + { + vct = ncvars[zvarid].vct; + vctsize = ncvars[zvarid].vctsize; + + if (ncvars[zvarid].psvarid != -1) psvarid = ncvars[zvarid].psvarid; + if (ncvars[zvarid].p0varid != -1) p0varid = ncvars[zvarid].p0varid; + } + + if (zaxisType != ZAXIS_CHAR) + { + zvar = (double *) Malloc(zsize * sizeof(double)); + cdf_get_var_double(ncvars[zvarid].ncid, zvarid, zvar); + } + + if (ncvars[zvarid].bounds != CDI_UNDEFID) + { + int nbdims = ncvars[ncvars[zvarid].bounds].ndims; + if (nbdims == 2 || isScalar) + { + size_t nlevel = isScalar ? 1 : ncdims[ncvars[ncvars[zvarid].bounds].dimids[0]].len; + int nvertex = (int) ncdims[ncvars[ncvars[zvarid].bounds].dimids[1 - isScalar]].len; + if (nlevel == zsize && nvertex == 2) + { + withBounds = true; + lbounds = (double *) Malloc(4 * nlevel * sizeof(double)); + ubounds = lbounds + nlevel; + double *zbounds = lbounds + 2 * nlevel; + cdf_get_var_double(ncvars[zvarid].ncid, ncvars[zvarid].bounds, zbounds); + for (size_t i = 0; i < nlevel; ++i) + { + lbounds[i] = zbounds[i * 2]; + ubounds[i] = zbounds[i * 2 + 1]; + } + } + } + } + } + else + { + pname = (zdimid != CDI_UNDEFID) ? ncdims[zdimid].name : NULL; + plongname = NULL; + punits = NULL; + pstdname = NULL; + + if (zsize == 1 && zdimid == CDI_UNDEFID) + { + zaxisType = (ncvar->zaxistype != CDI_UNDEFID) ? ncvar->zaxistype : ZAXIS_SURFACE; + // if ( pname ) + { + zvar = (double *) Malloc(sizeof(double)); + zvar[0] = 0; + } + } + } + + if (zsize > INT_MAX) + { + Warning("Size limit exceeded for z-axis dimension (limit=%d)!", INT_MAX); + return CDI_EDIMSIZE; + } + + ncvar->numLevels = zsize; + ncvar->zaxisID = varDefZaxis(vlistID, zaxisType, (int) zsize, zvar, (const char **) zcvals, zclength, withBounds, lbounds, + ubounds, (int) vctsize, vct, pname, plongname, punits, zdatatype, 1, 0, -1); + + int zaxisID = ncvar->zaxisID; + + if (CDI_CMOR_Mode && zsize == 1 && zaxisType != ZAXIS_HYBRID) zaxisDefScalar(zaxisID); + + if (pstdname && *pstdname) + cdiDefKeyBytes(zaxisID, CDI_GLOBAL, CDI_KEY_STDNAME, (const unsigned char *) pstdname, (int) strlen(pstdname) + 1); + + if (!cdiUUIDIsNull(uuidOfVGrid)) cdiDefKeyBytes(zaxisID, CDI_GLOBAL, CDI_KEY_UUID, uuidOfVGrid, CDI_UUID_SIZE); + + if (zaxisType == ZAXIS_HYBRID) + { + if (psvarid != -1) cdiDefKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_PSNAME, ncvars[psvarid].name); + if (p0varid != -1) + { + double px = 1; + cdf_get_var_double(ncvars[p0varid].ncid, p0varid, &px); + cdiDefKeyFloat(zaxisID, CDI_GLOBAL, CDI_KEY_P0VALUE, px); + cdiDefKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_P0NAME, ncvars[p0varid].name); + } + } + + if (positive > 0) zaxisDefPositive(zaxisID, positive); + if (isScalar) zaxisDefScalar(zaxisID); + + if (zdimid != CDI_UNDEFID) cdiDefKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_DIMNAME, ncdims[zdimid].name); + + if (zvar) Free(zvar); + if (zcvals) + { + for (size_t i = 0; i < zsize; i++) Free(zcvals[i]); + Free(zcvals); + } + if (lbounds) Free(lbounds); + + if (zvarid != CDI_UNDEFID) + { + int ncid = ncvars[zvarid].ncid; + int nvatts = ncvars[zvarid].natts; + for (int iatt = 0; iatt < nvatts; ++iatt) + { + int attnum = ncvars[zvarid].atts[iatt]; + cdf_set_cdi_attr(ncid, zvarid, attnum, zaxisID, CDI_GLOBAL, false); + } + } + + int zaxisindex = vlistZaxisIndex(vlistID, zaxisID); + streamptr->zaxisID[zaxisindex] = zdimid >= 0 ? ncdims[zdimid].dimid : zdimid; + + if (CDI_Debug) Message("zaxisID %d %d %s", zaxisID, ncvarid, ncvar->name); + + for (int ncvarid2 = ncvarid + 1; ncvarid2 < nvars; ncvarid2++) + if (ncvars[ncvarid2].varStatus == DataVar + && ncvars[ncvarid2].zaxisID == CDI_UNDEFID /*&& ncvars[ncvarid2].zaxistype == CDI_UNDEFID*/) + { + int zvarid2 = CDI_UNDEFID; + if (ncvars[ncvarid2].zvarid != CDI_UNDEFID && ncvars[ncvars[ncvarid2].zvarid].ndims == 0) + zvarid2 = ncvars[ncvarid2].zvarid; + + int zdimid2 = CDI_UNDEFID; + ndims = ncvars[ncvarid2].ndims; + for (int i = 0; i < ndims; i++) + { + if (ncvars[ncvarid2].dimtype[i] == Z_AXIS) zdimid2 = ncvars[ncvarid2].dimids[i]; + } + + if (zdimid == zdimid2 /* && zvarid == zvarid2 */) + { + if ((zdimid != CDI_UNDEFID && ncvars[ncvarid2].zaxistype == CDI_UNDEFID) + || (zdimid == CDI_UNDEFID && zvarid != CDI_UNDEFID && zvarid == zvarid2) + || (zdimid == CDI_UNDEFID && zaxisType == ncvars[ncvarid2].zaxistype) + || (zdimid == CDI_UNDEFID && zvarid2 == CDI_UNDEFID && ncvars[ncvarid2].zaxistype == CDI_UNDEFID)) + { + if (CDI_Debug) Message("zaxisID %d %d %s", zaxisID, ncvarid2, ncvars[ncvarid2].name); + ncvars[ncvarid2].zaxisID = zaxisID; + } + } + } + } + } + + return 0; +} + +struct cdf_varinfo +{ + int varid; + const char *name; +}; + +static int +cdf_cmp_varname(const void *s1, const void *s2) +{ + const struct cdf_varinfo *x = (const struct cdf_varinfo *) s1, *y = (const struct cdf_varinfo *) s2; + return strcmp(x->name, y->name); +} + +static void +cdf_sort_varnames(int *varids, int nvars, const ncvar_t *ncvars) +{ + struct cdf_varinfo *varInfo = (struct cdf_varinfo *) Malloc((size_t) nvars * sizeof(struct cdf_varinfo)); + + for (int varID = 0; varID < nvars; varID++) + { + int ncvarid = varids[varID]; + varInfo[varID].varid = ncvarid; + varInfo[varID].name = ncvars[ncvarid].name; + } + qsort(varInfo, (size_t) nvars, sizeof(varInfo[0]), cdf_cmp_varname); + for (int varID = 0; varID < nvars; varID++) + { + varids[varID] = varInfo[varID].varid; + } + Free(varInfo); + if (CDI_Debug) + for (int i = 0; i < nvars; i++) Message("sorted varids[%d] = %d", i, varids[i]); +} + +static void +cdf_define_code_and_param(int vlistID, int varID) +{ + if (vlistInqVarCode(vlistID, varID) == -varID - 1) + { + char name[CDI_MAX_NAME]; + name[0] = 0; + vlistInqVarName(vlistID, varID, name); + size_t len = strlen(name); + if (len > 3 && isdigit((int) name[3])) + { + if (strStartsWith(name, "var")) vlistDefVarCode(vlistID, varID, atoi(name + 3)); + } + else if (len > 4 && isdigit((int) name[4])) + { + if (strStartsWith(name, "code")) vlistDefVarCode(vlistID, varID, atoi(name + 4)); + } + else if (len > 5 && isdigit((int) name[5])) + { + if (strStartsWith(name, "param")) + { + int pnum = -1, pcat = 255, pdis = 255; + sscanf(name + 5, "%d.%d.%d", &pnum, &pcat, &pdis); + vlistDefVarParam(vlistID, varID, cdiEncodeParam(pnum, pcat, pdis)); + } + } + } +} + +static void +cdf_define_institut_and_model_id(int vlistID, int varID) +{ + int varInstID = vlistInqVarInstitut(vlistID, varID); + int varModelID = vlistInqVarModel(vlistID, varID); + int varTableID = vlistInqVarTable(vlistID, varID); + int code = vlistInqVarCode(vlistID, varID); + if (CDI_Default_TableID != CDI_UNDEFID) + { + char name[CDI_MAX_NAME]; + name[0] = 0; + char longname[CDI_MAX_NAME]; + longname[0] = 0; + char units[CDI_MAX_NAME]; + units[0] = 0; + tableInqEntry(CDI_Default_TableID, code, -1, name, longname, units); + if (name[0]) + { + cdiDeleteKey(vlistID, varID, CDI_KEY_NAME); + cdiDeleteKey(vlistID, varID, CDI_KEY_LONGNAME); + cdiDeleteKey(vlistID, varID, CDI_KEY_UNITS); + + if (varTableID != CDI_UNDEFID) + { + cdiDefKeyString(vlistID, varID, CDI_KEY_NAME, name); + if (longname[0]) cdiDefKeyString(vlistID, varID, CDI_KEY_LONGNAME, longname); + if (units[0]) cdiDefKeyString(vlistID, varID, CDI_KEY_UNITS, units); + } + else + { + varTableID = CDI_Default_TableID; + } + } + + if (CDI_Default_ModelID != CDI_UNDEFID) varModelID = CDI_Default_ModelID; + if (CDI_Default_InstID != CDI_UNDEFID) varInstID = CDI_Default_InstID; + } + if (varInstID != CDI_UNDEFID) vlistDefVarInstitut(vlistID, varID, varInstID); + if (varModelID != CDI_UNDEFID) vlistDefVarModel(vlistID, varID, varModelID); + if (varTableID != CDI_UNDEFID) vlistDefVarTable(vlistID, varID, varTableID); +} + +static int +cdf_xtype_to_numbytes(int xtype) +{ + int numBytes = 8; + + // clang-format off + if (xtype == NC_BYTE ) numBytes = 1; + else if (xtype == NC_CHAR ) numBytes = 1; + else if (xtype == NC_SHORT ) numBytes = 2; + else if (xtype == NC_INT ) numBytes = 4; + else if (xtype == NC_FLOAT ) numBytes = 4; +#ifdef HAVE_NETCDF4 + else if (xtype == NC_UBYTE ) numBytes = 1; + else if (xtype == NC_LONG ) numBytes = 4; + else if (xtype == NC_USHORT) numBytes = 2; + else if (xtype == NC_UINT ) numBytes = 4; +#endif + // clang-format on + + return numBytes; +} + +static size_t +calc_chunk_cache_size(int timedimid, ncvar_t *ncvar) +{ + size_t chunkCacheSize = ncvar->gridSize; + + chunkCacheSize *= (ncvar->dimids[0] == timedimid) ? ncvar->chunks[0] : 1; + + int zdimid = CDI_UNDEFID; + for (int i = 0; i < ncvar->ndims; i++) + { + if (ncvar->dimtype[i] == Z_AXIS) zdimid = ncvar->dimids[i]; + } + if (zdimid != CDI_UNDEFID) chunkCacheSize *= ncvar->chunks[zdimid]; + + chunkCacheSize *= cdf_xtype_to_numbytes(ncvar->xtype); + + if (CDI_Chunk_Cache_Max > 0 && chunkCacheSize > CDI_Chunk_Cache_Max) chunkCacheSize = CDI_Chunk_Cache_Max; + + return chunkCacheSize; +} + +static void +cdf_set_var_chunk_cache(ncvar_t *ncvar, int ncvarid, size_t chunckCacheSize) +{ + if (CDI_Debug) Message("%s: chunckCacheSize=%zu", ncvar->name, chunckCacheSize); + nc_set_var_chunk_cache(ncvar->ncid, ncvarid, chunckCacheSize, ncvar->chunkCacheNelems, ncvar->chunkCachePreemption); +} + +// define all input data variables +static void +cdf_define_all_vars(stream_t *streamptr, int vlistID, int instID, int modelID, int nvars, int num_ncvars, ncvar_t *ncvars, + ncdim_t *ncdims, int timedimid) +{ + int *varids = (int *) Malloc((size_t) nvars * sizeof(int)); + int n = 0; + for (int ncvarid = 0; ncvarid < num_ncvars; ncvarid++) + if (ncvars[ncvarid].varStatus == DataVar) varids[n++] = ncvarid; + + if (CDI_Debug) + for (int i = 0; i < nvars; i++) Message("varids[%d] = %d", i, varids[i]); + + if (streamptr->sortname) cdf_sort_varnames(varids, nvars, ncvars); + + for (int varID1 = 0; varID1 < nvars; varID1++) + { + int ncvarid = varids[varID1]; + ncvar_t *ncvar = &ncvars[ncvarid]; + int gridID = ncvar->gridID; + int zaxisID = ncvar->zaxisID; + + stream_new_var(streamptr, gridID, zaxisID, CDI_UNDEFID); + int varID = vlistDefVar(vlistID, gridID, zaxisID, ncvar->timetype); + +#ifdef HAVE_NETCDF4 + if (ncvar->hasFilter) vlistDefVarCompType(vlistID, varID, CDI_COMPRESS_FILTER); + if (ncvar->hasDeflate) vlistDefVarCompType(vlistID, varID, CDI_COMPRESS_ZIP); + if (ncvar->hasSzip) vlistDefVarCompType(vlistID, varID, CDI_COMPRESS_SZIP); + if (ncvar->isChunked) + { + if (ncvar->chunkType != CDI_UNDEFID) cdiDefKeyInt(vlistID, varID, CDI_KEY_CHUNKTYPE, ncvar->chunkType); + if (ncvar->chunkSize > 1) cdiDefKeyInt(vlistID, varID, CDI_KEY_CHUNKSIZE, ncvar->chunkSize); + + size_t varChunkCacheSize = calc_chunk_cache_size(timedimid, ncvar); + if (CDI_Chunk_Cache > 0) + cdf_set_var_chunk_cache(ncvar, ncvarid, CDI_Chunk_Cache); + else if (varChunkCacheSize > ncvar->chunkCacheSize) + cdf_set_var_chunk_cache(ncvar, ncvarid, varChunkCacheSize); + } +#endif + + streamptr->vars[varID1].defmiss = false; + streamptr->vars[varID1].ncvarid = ncvarid; + + cdiDefKeyString(vlistID, varID, CDI_KEY_NAME, ncvar->name); + if (ncvar->param != CDI_UNDEFID) vlistDefVarParam(vlistID, varID, ncvar->param); + if (ncvar->code != CDI_UNDEFID) vlistDefVarCode(vlistID, varID, ncvar->code); + if (ncvar->code != CDI_UNDEFID) vlistDefVarParam(vlistID, varID, cdiEncodeParam(ncvar->code, ncvar->tabnum, 255)); + if (ncvar->longname[0]) cdiDefKeyString(vlistID, varID, CDI_KEY_LONGNAME, ncvar->longname); + if (ncvar->stdname[0]) cdiDefKeyString(vlistID, varID, CDI_KEY_STDNAME, ncvar->stdname); + if (ncvar->unitsLen > 0) cdiDefKeyString(vlistID, varID, CDI_KEY_UNITS, ncvar->units); + + if (ncvar->validrangeDefined) vlistDefVarValidrange(vlistID, varID, ncvar->validrange); + + if (IS_NOT_EQUAL(ncvar->addoffset, 0.0)) cdiDefKeyFloat(vlistID, varID, CDI_KEY_ADDOFFSET, ncvar->addoffset); + if (IS_NOT_EQUAL(ncvar->scalefactor, 1.0)) cdiDefKeyFloat(vlistID, varID, CDI_KEY_SCALEFACTOR, ncvar->scalefactor); + + vlistDefVarDatatype(vlistID, varID, cdfInqDatatype(streamptr, ncvar->xtype, ncvar->isUnsigned)); + + vlistDefVarInstitut(vlistID, varID, instID); + vlistDefVarModel(vlistID, varID, modelID); + if (ncvar->tableID != CDI_UNDEFID) vlistDefVarTable(vlistID, varID, ncvar->tableID); + + if (ncvar->fillvalDefined == false && ncvar->missvalDefined) + { + ncvar->fillvalDefined = true; + ncvar->fillval = ncvar->missval; + } + + if (ncvar->fillvalDefined) vlistDefVarMissval(vlistID, varID, ncvar->fillval); + + if (CDI_Debug) + Message("varID = %d gridID = %d zaxisID = %d", varID, vlistInqVarGrid(vlistID, varID), vlistInqVarZaxis(vlistID, varID)); + + int gridindex = vlistGridIndex(vlistID, gridID); + int xdimid = streamptr->ncgrid[gridindex].ncIDs[CDF_DIMID_X]; + int ydimid = streamptr->ncgrid[gridindex].ncIDs[CDF_DIMID_Y]; + + int zaxisindex = vlistZaxisIndex(vlistID, zaxisID); + int zdimid = streamptr->zaxisID[zaxisindex]; + + int ndims = ncvar->ndims; + static const int ipow10[4] = { 1, 10, 100, 1000 }; + + int iodim = (ncvar->timetype != TIME_CONSTANT); + + const int *dimids = ncvar->dimids; + + int ixyz = 0; + if (gridInqType(gridID) == GRID_UNSTRUCTURED && ndims - iodim <= 2 && (ydimid == xdimid || ydimid == CDI_UNDEFID)) + { + ixyz = (xdimid == ncdims[dimids[ndims - 1]].dimid) ? 321 : 213; + } + else + { + for (int idim = iodim; idim < ndims; idim++) + { + int dimid = ncdims[dimids[idim]].dimid; + // clang-format off + if (xdimid == dimid) ixyz += 1*ipow10[ndims-idim-1]; + else if (ydimid == dimid) ixyz += 2*ipow10[ndims-idim-1]; + else if (zdimid == dimid) ixyz += 3*ipow10[ndims-idim-1]; + // clang-format on + } + } + + if (ncvar->isCubeSphere) ixyz = 0; + vlistDefVarXYZ(vlistID, varID, ixyz); + /* + printf("ixyz %d\n", ixyz); + printf("ndims %d\n", ncvar->ndims); + for (int i = 0; i < ncvar->ndims; ++i) + printf("dimids: %d %d\n", i, dimids[i]); + printf("xdimid, ydimid %d %d\n", xdimid, ydimid); + */ + if (ncvar->numberOfForecastsInEnsemble != -1) + { + cdiDefKeyInt(vlistID, varID, CDI_KEY_TYPEOFENSEMBLEFORECAST, ncvar->typeOfEnsembleForecast); + cdiDefKeyInt(vlistID, varID, CDI_KEY_NUMBEROFFORECASTSINENSEMBLE, ncvar->numberOfForecastsInEnsemble); + cdiDefKeyInt(vlistID, varID, CDI_KEY_PERTURBATIONNUMBER, ncvar->perturbationNumber); + } + + if (ncvar->extra[0] != 0) cdiDefKeyString(vlistID, varID, CDI_KEY_CHUNKS, ncvar->extra); + } + + for (int varID = 0; varID < nvars; varID++) + { + int ncvarid = varids[varID]; + ncvar_t *ncvar = &ncvars[ncvarid]; + int ncid = ncvar->ncid; + int nvatts = ncvar->natts; + for (int iatt = 0; iatt < nvatts; ++iatt) cdf_set_cdi_attr(ncid, ncvarid, ncvar->atts[iatt], vlistID, varID, false); + + if (ncvar->atts) Free(ncvar->atts); + if (ncvar->vct) Free(ncvar->vct); + + ncvar->atts = NULL; + ncvar->vct = NULL; + } + + // release mem of not freed attributes + for (int ncvarid = 0; ncvarid < num_ncvars; ncvarid++) + if (ncvars[ncvarid].atts) Free(ncvars[ncvarid].atts); + + if (varids) Free(varids); + + for (int varID = 0; varID < nvars; varID++) cdf_define_code_and_param(vlistID, varID); + for (int varID = 0; varID < nvars; varID++) cdf_define_institut_and_model_id(vlistID, varID); +} + +static void +cdf_copy_attint(int fileID, int vlistID, nc_type xtype, size_t attlen, char *attname) +{ + int attint[8]; + int *pattint = (attlen > 8) ? (int *) malloc(attlen * sizeof(int)) : attint; + cdfGetAttInt(fileID, NC_GLOBAL, attname, attlen, pattint); + int datatype = (xtype == NC_SHORT) ? CDI_DATATYPE_INT16 : CDI_DATATYPE_INT32; + cdiDefAttInt(vlistID, CDI_GLOBAL, attname, datatype, (int) attlen, pattint); + if (attlen > 8) free(pattint); +} + +static void +cdf_copy_attflt(int fileID, int vlistID, nc_type xtype, size_t attlen, char *attname) +{ + double attflt[8]; + double *pattflt = (attlen > 8) ? (double *) malloc(attlen * sizeof(double)) : attflt; + cdfGetAttDouble(fileID, NC_GLOBAL, attname, attlen, pattflt); + int datatype = (xtype == NC_FLOAT) ? CDI_DATATYPE_FLT32 : CDI_DATATYPE_FLT64; + cdiDefAttFlt(vlistID, CDI_GLOBAL, attname, datatype, (int) attlen, pattflt); + if (attlen > 8) free(pattflt); +} + +static bool +check_cube_sphere(int vlistID, int nvars, ncvar_t *ncvars, ncdim_t *ncdims) +{ + bool isGeosData = false; + int numNames = 4; + const char *attnames[] = { "additional_vars", "file_format_version", "gridspec_file", "grid_mapping_name" }; + const char *grid_mapping = "gnomonic cubed-sphere"; + char attstring[256]; + int nf_dimid = -1, ncontact_dimid = -1; + + int numFound = 0; + for (int i = 0; i < numNames; ++i) + if (0 == cdiInqAttTxt(vlistID, CDI_GLOBAL, attnames[i], (int) sizeof(attstring), attstring)) numFound++; + + if (numFound == numNames && strStartsWith(attstring, grid_mapping)) + { + for (int i = 0; i < numNames; ++i) cdiDelAtt(vlistID, CDI_GLOBAL, attnames[i]); + + const char *nf_name = "nf"; + const char *ncontact_name = "ncontact"; + for (int varid = 0; varid < nvars; ++varid) + { + ncvar_t *ncvar = &ncvars[varid]; + if (ncvar->ndims == 1) + { + int dimid = ncvar->dimids[0]; + if (ncdims[dimid].len == 6 && str_is_equal(nf_name, ncvar->name)) + { + isGeosData = true; + nf_dimid = ncvar->dimids[0]; + } + if (ncdims[dimid].len == 4 && str_is_equal(ncontact_name, ncvar->name)) ncontact_dimid = ncvar->dimids[0]; + } + if (isGeosData && ncontact_dimid != -1) break; + } + } + + if (isGeosData) + { + ncdims[nf_dimid].dimtype = E_AXIS; + for (int varid = 0; varid < nvars; ++varid) + { + ncvar_t *ncvar = &ncvars[varid]; + if (str_is_equal("orientation", ncvar->name) || str_is_equal("anchor", ncvar->name) + || str_is_equal("contacts", ncvar->name)) + cdf_set_var(ncvar, CoordVar); + } + + for (int varid = 0; varid < nvars; ++varid) + { + ncvar_t *ncvar = &ncvars[varid]; + int ndims = ncvar->ndims; + if (ndims >= 3 && ncvar->dimids[ndims - 3] == nf_dimid && ncvar->ncoordvars == 2 && ncvar->gmapid != -1) + ncvar->isCubeSphere = true; + } + + int xvarid = -1, yvarid = -1; + int xboundsid = -1, yboundsid = -1; + for (int varid = 0; varid < nvars; ++varid) + { + ncvar_t *ncvar = &ncvars[varid]; + int ndims = ncvar->ndims; + if (ndims == 3) + { + // clang-format off + if (str_is_equal("lons", ncvar->name)) xvarid = varid; + else if (str_is_equal("lats", ncvar->name)) yvarid = varid; + else if (str_is_equal("corner_lons", ncvar->name)) xboundsid = varid; + else if (str_is_equal("corner_lats", ncvar->name)) yboundsid = varid; + // clang-format on + } + if (xvarid != -1 && xboundsid != -1 && yvarid != -1 && yboundsid != -1) + { + cdf_set_var(&ncvars[xboundsid], CoordVar); + cdf_set_var(&ncvars[yboundsid], CoordVar); + ncvars[xvarid].bounds = xboundsid; + ncvars[yvarid].bounds = yboundsid; + break; + } + } + } + + return isGeosData; +} + +static void +cdf_scan_global_attr(int fileID, int vlistID, int ngatts, int *instID, int *modelID, bool *ucla_les, unsigned char *uuidOfVGrid, + GridInfo *gridInfo) +{ + nc_type xtype = 0; + size_t attlen = 0; + char attname[CDI_MAX_NAME] = { 0 }; + + for (int iatt = 0; iatt < ngatts; iatt++) + { + cdf_inq_attname(fileID, NC_GLOBAL, iatt, attname); + cdf_inq_atttype(fileID, NC_GLOBAL, attname, &xtype); + cdf_inq_attlen(fileID, NC_GLOBAL, attname, &attlen); + + if (xtypeIsText(xtype)) + { + enum + { + attstringsize = 65636 + }; + char attstring[attstringsize] = { 0 }; + + cdfGetAttText(fileID, NC_GLOBAL, attname, attstringsize, attstring); + + size_t attstrlen = strlen(attstring); + + if (attlen > 0 && attstring[0] != 0) + { + if (str_is_equal(attname, "institution")) + { + *instID = institutInq(0, 0, NULL, attstring); + if (*instID == CDI_UNDEFID) *instID = institutDef(0, 0, NULL, attstring); + + cdiDefAttTxt(vlistID, CDI_GLOBAL, attname, (int) attstrlen, attstring); + } + else if (str_is_equal(attname, "source")) + { + *modelID = modelInq(-1, 0, attstring); + if (*modelID == CDI_UNDEFID) *modelID = modelDef(-1, 0, attstring); + + cdiDefAttTxt(vlistID, CDI_GLOBAL, attname, (int) attstrlen, attstring); + } + else if (str_is_equal(attname, "Source") && strStartsWith(attstring, "UCLA-LES")) + { + *ucla_les = true; + cdiDefAttTxt(vlistID, CDI_GLOBAL, attname, (int) attstrlen, attstring); + } + /* + else if ( str_is_equal(attname, "Conventions") ) + { + } + */ + else if (str_is_equal(attname, "_NCProperties")) + { + } + else if (str_is_equal(attname, "CDI")) + { + } + else if (str_is_equal(attname, "CDO")) + { + } + /* + else if ( str_is_equal(attname, "forecast_reference_time") ) + { + memcpy(fcreftime, attstring, attstrlen+1); + } + */ + else if (str_is_equal(attname, "grid_file_uri")) + { + memcpy(gridInfo->gridfile, attstring, attstrlen + 1); + } + else if (attstrlen == 36 && str_is_equal(attname, "uuidOfHGrid")) + { + cdiStr2UUID(attstring, gridInfo->uuid); + } + else if (attstrlen == 36 && str_is_equal(attname, "uuidOfVGrid")) + { + cdiStr2UUID(attstring, uuidOfVGrid); + } + else + { + if (str_is_equal(attname, "ICON_grid_file_uri") && gridInfo->gridfile[0] == 0) + memcpy(gridInfo->gridfile, attstring, attstrlen + 1); + + cdiDefAttTxt(vlistID, CDI_GLOBAL, attname, (int) attstrlen, attstring); + } + } + else + { + cdiDefAttTxt(vlistID, CDI_GLOBAL, attname, (int) attstrlen, attstring); + } + } + else if (xtype == NC_SHORT || xtype == NC_INT) + { + if (str_is_equal(attname, "number_of_grid_used")) + { + gridInfo->number_of_grid_used = CDI_UNDEFID; + cdfGetAttInt(fileID, NC_GLOBAL, attname, 1, &gridInfo->number_of_grid_used); + } + else + { + cdf_copy_attint(fileID, vlistID, xtype, attlen, attname); + } + } + else if (xtype == NC_FLOAT || xtype == NC_DOUBLE) + { + cdf_copy_attflt(fileID, vlistID, xtype, attlen, attname); + } + } +} + +static int +find_leadtime(int nvars, ncvar_t *ncvars, int timedimid) +{ + int leadtime_id = CDI_UNDEFID; + + for (int ncvarid = 0; ncvarid < nvars; ncvarid++) + { + ncvar_t *ncvar = &ncvars[ncvarid]; + if (ncvar->ndims == 1 && timedimid == ncvar->dimids[0]) + if (ncvar->stdname[0] && str_is_equal(ncvar->stdname, "forecast_period")) + { + leadtime_id = ncvarid; + break; + } + } + + return leadtime_id; +} + +static void +find_time_vars(int nvars, ncvar_t *ncvars, ncdim_t *ncdims, int timedimid, stream_t *streamptr, bool *timeHasUnits, + bool *timeHasBounds, bool *timeClimatology) +{ + int ncvarid; + + if (timedimid == CDI_UNDEFID) + { + char timeUnitsStr[CDI_MAX_NAME]; + + for (ncvarid = 0; ncvarid < nvars; ncvarid++) + { + ncvar_t *ncvar = &ncvars[ncvarid]; + if (ncvar->ndims == 0 && ncvar->units[0] && str_is_equal(ncvar->name, "time")) + { + strcpy(timeUnitsStr, ncvar->units); + str_to_lower(timeUnitsStr); + + if (is_time_units(timeUnitsStr)) + { + streamptr->basetime.ncvarid = ncvarid; + break; + } + } + } + } + else + { + bool hasTimeVar = false; + + if (ncdims[timedimid].ncvarid != CDI_UNDEFID) + { + streamptr->basetime.ncvarid = ncdims[timedimid].ncvarid; + hasTimeVar = true; + } + + for (ncvarid = 0; ncvarid < nvars; ncvarid++) + { + ncvar_t *ncvar = &ncvars[ncvarid]; + if (ncvarid != streamptr->basetime.ncvarid && ncvar->ndims == 1 && timedimid == ncvar->dimids[0] + && !xtypeIsText(ncvar->xtype) && is_timeaxis_units(ncvar->units)) + { + ncvar->varStatus = CoordVar; + + if (!hasTimeVar) + { + hasTimeVar = true; + streamptr->basetime.ncvarid = ncvarid; + } + else + { + Warning("Found more than one time variable, skipped variable %s!", ncvar->name); + } + } + } + + if (hasTimeVar == false) // search for WRF time description + { + for (ncvarid = 0; ncvarid < nvars; ncvarid++) + { + ncvar_t *ncvar = &ncvars[ncvarid]; + if (ncvarid != streamptr->basetime.ncvarid && ncvar->ndims == 2 && timedimid == ncvar->dimids[0] + && xtypeIsText(ncvar->xtype) && (ncdims[ncvar->dimids[1]].len == 19 || ncdims[ncvar->dimids[1]].len == 64)) + { + ncvar->isTaxis = true; + streamptr->basetime.ncvarid = ncvarid; + streamptr->basetime.isWRF = true; + break; + } + } + } + + // time varID + ncvarid = streamptr->basetime.ncvarid; + + if (ncvarid == CDI_UNDEFID && ncdims[timedimid].len > 0) Warning("Time variable >%s< not found!", ncdims[timedimid].name); + } + + // time varID + ncvarid = streamptr->basetime.ncvarid; + + if (ncvarid != CDI_UNDEFID && streamptr->basetime.isWRF == false) + { + ncvar_t *ncvar = &ncvars[ncvarid]; + if (ncvar->units[0] != 0) *timeHasUnits = true; + + if (ncvar->bounds != CDI_UNDEFID) + { + int nbdims = ncvars[ncvar->bounds].ndims; + if (nbdims == 2) + { + int len = (int) ncdims[ncvars[ncvar->bounds].dimids[nbdims - 1]].len; + if (len == 2 && timedimid == ncvars[ncvar->bounds].dimids[0]) + { + *timeHasBounds = true; + streamptr->basetime.ncvarboundsid = ncvar->bounds; + if (ncvar->isClimatology) *timeClimatology = true; + } + } + } + } +} + +static void +read_vct_echam(int fileID, int nvars, ncvar_t *ncvars, ncdim_t *ncdims, double **vct, size_t *pvctsize) +{ + // find ECHAM VCT + int nvcth_id = CDI_UNDEFID, vcta_id = CDI_UNDEFID, vctb_id = CDI_UNDEFID; + // int p0_id = CDI_UNDEFID; + + for (int ncvarid = 0; ncvarid < nvars; ncvarid++) + { + ncvar_t *ncvar = &ncvars[ncvarid]; + const char *name = ncvar->name; + if (ncvar->ndims == 1) + { + size_t len = strlen(name); + if (len == 4 && name[0] == 'h' && name[1] == 'y') + { + if (name[2] == 'a' && name[3] == 'i') // hyai + { + vcta_id = ncvarid; + nvcth_id = ncvar->dimids[0]; + ncvar->varStatus = CoordVar; + } + else if (name[2] == 'b' && name[3] == 'i') // hybi + { + vctb_id = ncvarid; + nvcth_id = ncvar->dimids[0]; + ncvar->varStatus = CoordVar; + } + else if ((name[2] == 'a' || name[2] == 'b') && name[3] == 'm') + { + ncvar->varStatus = CoordVar; // hyam or hybm + } + } + } + /* + else if (ncvar->ndims == 0) + { + size_t len = strlen(name); + if (len == 2 && name[0] == 'P' && name[1] == '0') p0_id = ncvarid; + } + */ + } + + // read VCT + if (nvcth_id != CDI_UNDEFID && vcta_id != CDI_UNDEFID && vctb_id != CDI_UNDEFID) + { + size_t vctsize = 2 * ncdims[nvcth_id].len; + *vct = (double *) Malloc(vctsize * sizeof(double)); + cdf_get_var_double(fileID, vcta_id, *vct); + cdf_get_var_double(fileID, vctb_id, *vct + vctsize / 2); + *pvctsize = vctsize; + /* + if (p0_id != CDI_UNDEFID) + { + double p0; + cdf_get_var_double(fileID, p0_id, &p0); + } + */ + } +} + +static void +cdf_set_ucla_dimtype(int ndims, ncdim_t *ncdims, ncvar_t *ncvars) +{ + for (int ncdimid = 0; ncdimid < ndims; ncdimid++) + { + int ncvarid = ncdims[ncdimid].ncvarid; + if (ncvarid != -1) + { + ncvar_t *ncvar = &ncvars[ncvarid]; + if (ncdims[ncdimid].dimtype == CDI_UNDEFID && ncvar->units[0] == 'm') + { + // clang-format off + if ( ncvar->name[0] == 'x' ) ncdims[ncdimid].dimtype = X_AXIS; + else if ( ncvar->name[0] == 'y' ) ncdims[ncdimid].dimtype = Y_AXIS; + else if ( ncvar->name[0] == 'z' ) ncdims[ncdimid].dimtype = Z_AXIS; + // clang-format on + } + } + } +} + +static int +cdf_check_variables(stream_t *streamptr, int nvars, ncvar_t *ncvars, size_t ntsteps, int timedimid) +{ + for (int ncvarid = 0; ncvarid < nvars; ncvarid++) + { + ncvar_t *ncvar = &ncvars[ncvarid]; + if (ncvar->isTaxis && ncvar->ndims == 2) + { + ncvar->varStatus = CoordVar; + continue; + } + + if (ncvar->varStatus == UndefVar && ncvar->ndims > 1 && timedimid != CDI_UNDEFID && timedimid == ncvar->dimids[0]) + cdf_set_var(ncvar, DataVar); + + if (ncvar->varStatus == UndefVar) + { + if (ncvar->ndims == 0) + cdf_set_var(ncvar, nvars == 1 ? DataVar : CoordVar); + else if (ncvar->ndims > 0) + cdf_set_var(ncvar, DataVar); + else + { + ncvar->varStatus = CoordVar; + Warning("Variable %s has an unknown type, skipped!", ncvar->name); + } + } + + if (ncvar->varStatus == CoordVar) continue; + + if ((ncvar->ndims > 4 && !ncvar->isCubeSphere) || ncvar->ndims > 5) + { + ncvar->varStatus = CoordVar; + Warning("%d dimensional variables are not supported, skipped variable %s!", ncvar->ndims, ncvar->name); + continue; + } + + if (((ncvar->ndims == 4 && !ncvar->isCubeSphere) || ncvar->ndims == 5) && timedimid == CDI_UNDEFID) + { + ncvar->varStatus = CoordVar; + Warning("%d dimensional variables without time dimension are not supported, skipped variable %s!", ncvar->ndims, + ncvar->name); + continue; + } + + if (xtypeIsText(ncvar->xtype)) + { + ncvar->varStatus = CoordVar; + Warning("Unsupported data type (char/string), skipped variable %s!", ncvar->name); + continue; + } + + if (cdfInqDatatype(streamptr, ncvar->xtype, ncvar->isUnsigned) == -1) + { + ncvar->varStatus = CoordVar; + Warning("Unsupported data type, skipped variable %s!", ncvar->name); + continue; + } + + if (timedimid != CDI_UNDEFID && ntsteps == 0 && ncvar->ndims > 0) + { + if (timedimid == ncvar->dimids[0]) + { + ncvar->varStatus = CoordVar; + Warning("Number of time steps undefined, skipped variable %s!", ncvar->name); + continue; + } + } + } + + return timedimid; +} + +static void +cdfVerifyVars(int nvars, ncvar_t *ncvars, ncdim_t *ncdims) +{ + for (int ncvarid = 0; ncvarid < nvars; ncvarid++) + { + ncvar_t *ncvar = &ncvars[ncvarid]; + if (ncvar->varStatus == DataVar && ncvar->ndims > 0) + { + int ndims = 0; + for (int i = 0; i < ncvar->ndims; ++i) + { + // clang-format off + if (ncvar->dimtype[i] == T_AXIS) ndims++; + else if (ncvar->dimtype[i] == E_AXIS) ndims++; + else if (ncvar->dimtype[i] == Z_AXIS) ndims++; + else if (ncvar->dimtype[i] == Y_AXIS) ndims++; + else if (ncvar->dimtype[i] == X_AXIS) ndims++; + // clang-format on + } + + if (ncvar->ndims != ndims) + { + ncvar->varStatus = CoordVar; + Warning("Inconsistent number of dimensions, skipped variable %s!", ncvar->name); + } + + int zdimid = -1; + for (int i = 0; i < ncvar->ndims; ++i) + { + if (ncvar->dimtype[i] == Z_AXIS) zdimid = ncvar->dimids[i]; + } + + int zaxisID = ncvar->zaxisID; + if (zaxisInqScalar(zaxisID) && zdimid != -1) + { + ncvar->varStatus = CoordVar; + Warning("Unsupported dimension >%s<, skipped variable %s!", ncdims[zdimid].name, ncvar->name); + } + } + } +} + +static CdiDateTime +wrf_read_timestep(int fileID, int nctimevarid, int tsID) +{ + enum + { + // position of terminator separating date and time from rest of + dateTimeSepPos = 19, + dateTimeStrSize = 128, + }; + const size_t start[2] = { (size_t) tsID, 0 }, count[2] = { 1, dateTimeSepPos }; + char stvalue[dateTimeStrSize]; + stvalue[0] = 0; + cdf_get_vara_text(fileID, nctimevarid, start, count, stvalue); + stvalue[dateTimeSepPos] = 0; + + int year = 1, month = 1, day = 1, hour = 0, minute = 0, second = 0; + if (strlen(stvalue) == dateTimeSepPos) sscanf(stvalue, "%d-%d-%d_%d:%d:%d", &year, &month, &day, &hour, &minute, &second); + return cdiDateTime_set(cdiEncodeDate(year, month, day), cdiEncodeTime(hour, minute, second)); +} + +static double +get_timevalue(int fileID, int nctimevarid, size_t ncStepIndex) +{ + double timevalue = 0.0; + + cdf_get_var1_double(fileID, nctimevarid, &ncStepIndex, &timevalue); + + if (timevalue >= NC_FILL_DOUBLE || timevalue < -NC_FILL_DOUBLE) timevalue = 0.0; + + return timevalue; +} + +static void +cdf_read_timesteps(int numTimesteps, stream_t *streamptr, taxis_t *taxis0) +{ + streamptr->curTsID = 0; + streamptr->rtsteps = 1; + + if (numTimesteps == 0) + { + cdi_create_timesteps(numTimesteps, streamptr); + cdf_create_records(streamptr, 0); + } + else if (numTimesteps < 0) + { + } + else + { + int fileID = streamptr->fileID; + int nctimevarid = streamptr->basetime.ncvarid; + int nctimeboundsid = streamptr->basetime.ncvarboundsid; + bool hasTimesteps = (nctimevarid != CDI_UNDEFID && streamptr->basetime.hasUnits); + + int *ncStepIndices = (int *) malloc(numTimesteps * sizeof(int)); + for (int tsID = 0; tsID < numTimesteps; ++tsID) ncStepIndices[tsID] = tsID; + + CdiDateTime *vDateTimeList = NULL; + + if (hasTimesteps) + { + vDateTimeList = (CdiDateTime *) malloc(numTimesteps * sizeof(CdiDateTime)); + + if (streamptr->basetime.isWRF) + { + for (int tsID = 0; tsID < numTimesteps; ++tsID) vDateTimeList[tsID] = wrf_read_timestep(fileID, nctimevarid, tsID); + } + else + { + for (int tsID = 0; tsID < numTimesteps; ++tsID) + vDateTimeList[tsID] = cdi_decode_timeval(get_timevalue(fileID, nctimevarid, tsID), taxis0); + } + } + + // process query information if available + CdiQuery *query = streamptr->query; + if (query && cdiQueryNumStepidx(query) > 0) + { + for (int tsID = 0; tsID < numTimesteps; ++tsID) + { + if (cdiQueryStepidx(query, tsID + 1) < 0) ncStepIndices[tsID] = -1; + } + } + + int numSteps = 0; + for (int tsID = 0; tsID < numTimesteps; ++tsID) + if (ncStepIndices[tsID] >= 0) numSteps++; + + cdi_create_timesteps(numSteps, streamptr); + + for (int tsID = 0, stepID = 0; tsID < numTimesteps; ++tsID) + { + if (ncStepIndices[tsID] >= 0) + { + streamptr->tsteps[stepID].ncStepIndex = ncStepIndices[tsID]; + cdf_create_records(streamptr, stepID); + + taxis_t *taxis = &streamptr->tsteps[stepID].taxis; + ptaxisCopy(taxis, taxis0); + + if (hasTimesteps) taxis->vDateTime = vDateTimeList[tsID]; + + stepID++; + } + } + + if (ncStepIndices) free(ncStepIndices); + + if (hasTimesteps) + { + if (nctimeboundsid != CDI_UNDEFID) + { + enum + { + numBnds = 2, + tbNdims = 2 + }; + + for (int tsID = 0; tsID < numSteps; ++tsID) + { + size_t ncStepIndex = streamptr->tsteps[tsID].ncStepIndex; + taxis_t *taxis = &streamptr->tsteps[tsID].taxis; + const size_t start[tbNdims] = { ncStepIndex, 0 }; + static const size_t count[tbNdims] = { 1, numBnds }; + double timeBnds[numBnds]; + cdf_get_vara_double(fileID, nctimeboundsid, start, count, timeBnds); + for (size_t i = 0; i < numBnds; ++i) + if (timeBnds[i] >= NC_FILL_DOUBLE || timeBnds[i] < -NC_FILL_DOUBLE) timeBnds[i] = 0.0; + + taxis->vDateTime_lb = cdi_decode_timeval(timeBnds[0], taxis); + taxis->vDateTime_ub = cdi_decode_timeval(timeBnds[1], taxis); + } + } + + int leadtimeid = streamptr->basetime.leadtimeid; + if (leadtimeid != CDI_UNDEFID) + { + for (int tsID = 0; tsID < numSteps; ++tsID) + { + size_t ncStepIndex = streamptr->tsteps[tsID].ncStepIndex; + taxis_t *taxis = &streamptr->tsteps[tsID].taxis; + cdi_set_forecast_period(get_timevalue(fileID, leadtimeid, ncStepIndex), taxis); + } + } + } + + if (vDateTimeList) free(vDateTimeList); + } +} + +static void +stream_set_ncdims(stream_t *streamptr, int ndims, ncdim_t *ncdims) +{ + int n = (ndims > MAX_DIMS_PS) ? MAX_DIMS_PS : ndims; + streamptr->ncNumDims = n; + for (int i = 0; i < n; i++) streamptr->ncDimID[i] = ncdims[i].dimid; + for (int i = 0; i < n; i++) streamptr->ncDimLen[i] = ncdims[i].len; +} + +int +cdfInqContents(stream_t *streamptr) +{ + bool timeHasUnits = false; + bool timeHasBounds = false; + bool timeClimatology = false; + int leadtime_id = CDI_UNDEFID; + int format = 0; + char fcreftime[CDI_MAX_NAME]; + GridInfo gridInfo; + gridInfo.gridfile[0] = 0; + memset(gridInfo.uuid, 0, CDI_UUID_SIZE); + gridInfo.number_of_grid_used = CDI_UNDEFID; + gridInfo.timedimid = CDI_UNDEFID; + + fcreftime[0] = 0; + + int vlistID = streamptr->vlistID; + int fileID = streamptr->fileID; + + if (CDI_Debug) Message("streamID = %d, fileID = %d", streamptr->self, fileID); + +#ifdef HAVE_NETCDF4 + nc_inq_format(fileID, &format); +#endif + + int ndims = 0, nvars = 0, ngatts = 0, unlimdimid = 0; + cdf_inq(fileID, &ndims, &nvars, &ngatts, &unlimdimid); + + if (CDI_Debug) Message("root: ndims %d, nvars %d, ngatts %d", ndims, nvars, ngatts); + /* + if ( ndims == 0 ) + { + Warning("No dimensions found!"); + return CDI_EUFSTRUCT; + } + */ + // alloc ncdims + ncdim_t *ncdims = ndims ? (ncdim_t *) Malloc((size_t) ndims * sizeof(ncdim_t)) : NULL; + init_ncdims(ndims, ncdims); + + if (ndims) + { + int ncdimid = 0; + for (int dimid = 0; dimid < NC_MAX_DIMS; ++dimid) + { + if (nc_inq_dimlen(fileID, dimid, NULL) == NC_NOERR) + { + ncdims[ncdimid++].dimid = dimid; + if (ncdimid == ndims) break; + } + } + } + +#ifdef HAVE_NETCDF4 + if (format == NC_FORMAT_NETCDF4) + { + int numgrps = 0; + int ncids[NC_MAX_VARS]; + char gname[CDI_MAX_NAME]; + nc_inq_grps(fileID, &numgrps, ncids); + for (int i = 0; i < numgrps; ++i) + { + int ncid = ncids[i]; + nc_inq_grpname(ncid, gname); + int gndims, gnvars, gngatts, gunlimdimid; + cdf_inq(ncid, &gndims, &gnvars, &gngatts, &gunlimdimid); + + if (CDI_Debug) Message("%s: ndims %d, nvars %d, ngatts %d", gname, gndims, gnvars, gngatts); + + if (gndims == 0) + { + } + } + if (numgrps) Warning("NetCDF4 groups not supported! Found %d root group%s.", numgrps, (numgrps > 1) ? "s" : ""); + } +#endif + + if (nvars == 0) + { + Warning("No arrays found!"); + return CDI_EUFSTRUCT; + } + + // alloc ncvars + ncvar_t *ncvars = (ncvar_t *) Malloc((size_t) nvars * sizeof(ncvar_t)); + init_ncvars(nvars, ncvars, fileID); + + // scan global attributes + int instID = CDI_UNDEFID; + int modelID = CDI_UNDEFID; + bool ucla_les = false; + unsigned char uuidOfVGrid[CDI_UUID_SIZE] = { 0 }; + cdf_scan_global_attr(fileID, vlistID, ngatts, &instID, &modelID, &ucla_les, uuidOfVGrid, &gridInfo); + + // find time dim + int timedimid = (unlimdimid >= 0) ? unlimdimid : cdf_time_dimid(fileID, ndims, nvars, ncdims); + + streamptr->basetime.ncdimid = timedimid; + + size_t ntsteps = 0; + if (timedimid != CDI_UNDEFID) cdf_inq_dimlen(fileID, ncdims[timedimid].dimid, &ntsteps); + if (ntsteps > INT_MAX) + { + Warning("Size limit exceeded for time dimension (limit=%d)!", INT_MAX); + return CDI_EDIMSIZE; + } + + if (CDI_Debug) Message("Number of timesteps = %zu", ntsteps); + if (CDI_Debug) Message("Time dimid = %d", streamptr->basetime.ncdimid); + + // read ncdims + for (int ncdimid = 0; ncdimid < ndims; ncdimid++) + { + cdf_inq_dimlen(fileID, ncdims[ncdimid].dimid, &ncdims[ncdimid].len); + cdf_inq_dimname(fileID, ncdims[ncdimid].dimid, ncdims[ncdimid].name); + if (timedimid == ncdimid) ncdims[ncdimid].dimtype = T_AXIS; + } + + stream_set_ncdims(streamptr, ndims, ncdims); + + if (CDI_Debug) cdf_print_vars(ncvars, nvars, "cdfScanVarAttr"); + + // scan attributes of all variables + cdfScanVarAttr(nvars, ncvars, ndims, ncdims, timedimid, modelID, format); + + cdfVerifyVarAttr(nvars, ncvars, ncdims); + + if (CDI_Convert_Cubesphere) + { + bool isGeosData = check_cube_sphere(vlistID, nvars, ncvars, ncdims); + if (CDI_Debug) Message("isGeosData %d", isGeosData); + } + + if (CDI_Debug) cdf_print_vars(ncvars, nvars, "find coordinates vars"); + + // find coordinates vars + for (int ncdimid = 0; ncdimid < ndims; ncdimid++) + { + for (int ncvarid = 0; ncvarid < nvars; ncvarid++) + { + ncvar_t *ncvar = &ncvars[ncvarid]; + if (ncvar->ndims == 1) + { + if (timedimid != CDI_UNDEFID && timedimid == ncvar->dimids[0]) + { + if (ncvar->varStatus != CoordVar) cdf_set_var(ncvar, DataVar); + } + else + { + // if ( ncvar->varStatus != DataVar ) cdf_set_var(ncvar, CoordVar); + } + // if ( ncvar->varStatus != DataVar ) cdf_set_var(ncvar, CoordVar); + + if (ncdimid == ncvar->dimids[0] && ncdims[ncdimid].ncvarid == CDI_UNDEFID) + if (str_is_equal(ncvar->name, ncdims[ncdimid].name)) + { + ncdims[ncdimid].ncvarid = ncvarid; + ncvar->varStatus = CoordVar; + } + } + } + } + + // find time vars + find_time_vars(nvars, ncvars, ncdims, timedimid, streamptr, &timeHasUnits, &timeHasBounds, &timeClimatology); + + leadtime_id = find_leadtime(nvars, ncvars, timedimid); + if (leadtime_id != CDI_UNDEFID) ncvars[leadtime_id].varStatus = CoordVar; + + // check ncvars + timedimid = cdf_check_variables(streamptr, nvars, ncvars, ntsteps, timedimid); + + // verify coordinates vars - first scan (dimname == varname) + bool isHybridCF = false; + verify_coordinates_vars_1(fileID, ndims, ncdims, ncvars, timedimid, &isHybridCF); + + // verify coordinates vars - second scan (all other variables) + verify_coordinates_vars_2(streamptr, nvars, ncvars); + + if (CDI_Debug) cdf_print_vars(ncvars, nvars, "verify_coordinate_vars"); + + if (ucla_les) cdf_set_ucla_dimtype(ndims, ncdims, ncvars); + + /* + for (int ncdimid = 0; ncdimid < ndims; ncdimid++) + { + int ncvarid = ncdims[ncdimid].ncvarid; + if ( ncvarid != -1 ) + { + printf("coord var %d %s %s\n", ncvarid, ncvar->name, ncvar->units); + if ( ncdims[ncdimid].dimtype == X_AXIS ) + printf("coord var %d %s is x dim\n", ncvarid, ncvar->name); + if ( ncdims[ncdimid].dimtype == Y_AXIS ) + printf("coord var %d %s is y dim\n", ncvarid, ncvar->name); + if ( ncdims[ncdimid].dimtype == Z_AXIS ) + printf("coord var %d %s is z dim\n", ncvarid, ncvar->name); + if ( ncdims[ncdimid].dimtype == T_AXIS ) + printf("coord var %d %s is t dim\n", ncvarid, ncvar->name); + + if ( ncvar->isLon ) + printf("coord var %d %s is lon\n", ncvarid, ncvar->name); + if ( ncvar->isLat ) + printf("coord var %d %s is lat\n", ncvarid, ncvar->name); + if ( ncvar->isZaxis ) + printf("coord var %d %s is lev\n", ncvarid, ncvar->name); + } + } + */ + + // Set coordinates varids (att: associate) + for (int ncvarid = 0; ncvarid < nvars; ncvarid++) + { + ncvar_t *ncvar = &ncvars[ncvarid]; + if (ncvar->varStatus == DataVar && ncvar->ncoordvars) + { + for (int i = 0; i < ncvar->ncoordvars; i++) + { + int ncvaridc = ncvar->coordvarids[i]; + if (ncvaridc != CDI_UNDEFID) + { + ncvar_t *ncvarc = &ncvars[ncvaridc]; + // clang-format off + if (ncvarc->isLon || ncvarc->isXaxis) ncvar->xvarid = ncvaridc; + else if (ncvarc->isLat || ncvarc->isYaxis) ncvar->yvarid = ncvaridc; + else if (ncvarc->isZaxis) ncvar->zvarid = ncvaridc; + else if (ncvarc->isTaxis) ncvar->tvarid = ncvaridc; + else if (ncvarc->isCharAxis) ncvar->cvarids[i] = ncvaridc; + else if (ncvarc->printWarning) + { + Warning("Coordinates variable %s can't be assigned!", ncvarc->name); + ncvarc->printWarning = false; + } + // clang-format on + } + } + } + } + + // set dim type + cdf_set_dimtype(nvars, ncvars, ncdims); + + // read ECHAM VCT if present + size_t vctsize = 0; + double *vct = NULL; + if (!isHybridCF) read_vct_echam(fileID, nvars, ncvars, ncdims, &vct, &vctsize); + + // process query information if available + CdiQuery *query = streamptr->query; + if (query && cdiQueryNumNames(query) > 0) + { + for (int ncvarid = 0; ncvarid < nvars; ++ncvarid) + { + ncvar_t *ncvar = &ncvars[ncvarid]; + if (ncvar->varStatus == DataVar && cdiQueryName(query, ncvar->name) < 0) ncvar->varStatus = CoordVar; + } + } + + if (CDI_Debug) cdf_print_vars(ncvars, nvars, "cdf_define_all_grids"); + + // define all grids + gridInfo.timedimid = timedimid; + int status = cdf_define_all_grids(streamptr, streamptr->ncgrid, vlistID, ncdims, nvars, ncvars, &gridInfo); + if (status < 0) return status; + + // define all zaxes + status = cdf_define_all_zaxes(streamptr, vlistID, ncdims, nvars, ncvars, vctsize, vct, uuidOfVGrid); + if (vct) Free(vct); + if (status < 0) return status; + + // verify vars + cdfVerifyVars(nvars, ncvars, ncdims); + + // select vars + int nvars_data = 0; + for (int ncvarid = 0; ncvarid < nvars; ncvarid++) + if (ncvars[ncvarid].varStatus == DataVar) nvars_data++; + + if (CDI_Debug) Message("time varid = %d", streamptr->basetime.ncvarid); + if (CDI_Debug) Message("ntsteps = %zu", ntsteps); + if (CDI_Debug) Message("nvars_data = %d", nvars_data); + + if (nvars_data == 0) + { + streamptr->ntsteps = 0; + Warning("No data arrays found!"); + return CDI_EUFSTRUCT; + } + + if (ntsteps == 0 && streamptr->basetime.ncdimid == CDI_UNDEFID && streamptr->basetime.ncvarid != CDI_UNDEFID) ntsteps = 1; + + // define all data variables + cdf_define_all_vars(streamptr, vlistID, instID, modelID, nvars_data, nvars, ncvars, ncdims, timedimid); + + // time varID + int nctimevarid = streamptr->basetime.ncvarid; + + if (nctimevarid != CDI_UNDEFID && (!timeHasUnits || streamptr->basetime.isWRF)) ncvars[nctimevarid].units[0] = 0; + if (nctimevarid != CDI_UNDEFID && timeHasUnits) streamptr->basetime.hasUnits = true; + + taxis_t taxis0; + ptaxisInit(&taxis0); + + if (timeHasUnits) + { + if (set_base_time(ncvars[nctimevarid].units, &taxis0) == 1) + { + nctimevarid = CDI_UNDEFID; + streamptr->basetime.ncvarid = CDI_UNDEFID; + streamptr->basetime.hasUnits = false; + } + + if (leadtime_id != CDI_UNDEFID && taxis0.type == TAXIS_RELATIVE) + { + streamptr->basetime.leadtimeid = leadtime_id; + taxis0.type = TAXIS_FORECAST; + + int timeunit = -1; + if (ncvars[leadtime_id].units[0] != 0) timeunit = scan_time_units(ncvars[leadtime_id].units); + if (timeunit == -1) timeunit = taxis0.unit; + taxis0.fc_unit = timeunit; + + set_forecast_time(fcreftime, &taxis0); + } + } + + if (timeHasBounds) + { + taxis0.hasBounds = true; + if (timeClimatology) taxis0.climatology = true; + } + + if (nctimevarid != CDI_UNDEFID) + { + ptaxisDefName(&taxis0, ncvars[nctimevarid].name); + if (ncvars[nctimevarid].longname[0]) ptaxisDefLongname(&taxis0, ncvars[nctimevarid].longname); + if (ncvars[nctimevarid].units[0]) ptaxisDefUnits(&taxis0, ncvars[nctimevarid].units); + + int xtype = ncvars[nctimevarid].xtype; + int datatype = (xtype == NC_INT) ? CDI_DATATYPE_INT32 : ((xtype == NC_FLOAT) ? CDI_DATATYPE_FLT32 : CDI_DATATYPE_FLT64); + ptaxisDefDatatype(&taxis0, datatype); + } + + int calendar = CDI_UNDEFID; + if (nctimevarid != CDI_UNDEFID && ncvars[nctimevarid].hasCalendar) + { + char attstring[1024]; + cdfGetAttText(fileID, nctimevarid, "calendar", sizeof(attstring), attstring); + str_to_lower(attstring); + calendar = attribute_to_calendar(attstring); + } + + if (streamptr->basetime.isWRF) taxis0.type = TAXIS_ABSOLUTE; + + int taxisID; + if (taxis0.type == TAXIS_FORECAST) + { + taxisID = taxisCreate(TAXIS_FORECAST); + } + else if (taxis0.type == TAXIS_RELATIVE) + { + taxisID = taxisCreate(TAXIS_RELATIVE); + } + else + { + taxisID = taxisCreate(TAXIS_ABSOLUTE); + if (!timeHasUnits) + { + taxisDefTunit(taxisID, TUNIT_DAY); + taxis0.unit = TUNIT_DAY; + } + } + + if (calendar == CDI_UNDEFID && taxis0.type != TAXIS_ABSOLUTE) calendar = CALENDAR_STANDARD; + +#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 5) +#pragma GCC diagnostic push +#pragma GCC diagnostic warning "-Wstrict-overflow" +#endif + if (calendar != CDI_UNDEFID) + { + taxis0.calendar = calendar; + taxisDefCalendar(taxisID, calendar); + } +#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 5) +#pragma GCC diagnostic pop +#endif + + vlistDefTaxis(vlistID, taxisID); + + cdf_read_timesteps(ntsteps, streamptr, &taxis0); + taxisDestroyKernel(&taxis0); + + // free ncdims + if (ncdims) Free(ncdims); + + // free ncvars + if (ncvars) Free(ncvars); + + return 0; +} + +int +cdfInqTimestep(stream_t *streamptr, int tsID) +{ + if (tsID < 0 || tsID >= streamptr->ntsteps) Error("tsID=%d out of range (0-%d)!", tsID, streamptr->ntsteps - 1); + + streamptr->curTsID = tsID; + int numRecs = streamptr->tsteps[tsID].nrecs; + + return numRecs; +} + +#endif +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifdef HAVE_CONFIG_H +#endif + +#ifdef HAVE_LIBNETCDF + + +static const char bndsName[] = "bnds"; + +void +cdfCopyRecord(stream_t *streamptr2, stream_t *streamptr1) +{ + int vlistID1 = streamptr1->vlistID; + int tsID = streamptr1->curTsID; + int vrecID = streamptr1->tsteps[tsID].curRecID; + int recID = streamptr1->tsteps[tsID].recIDs[vrecID]; + int ivarID = streamptr1->tsteps[tsID].records[recID].varID; + int gridID = vlistInqVarGrid(vlistID1, ivarID); + size_t datasize = gridInqSize(gridID); + int datatype = vlistInqVarDatatype(vlistID1, ivarID); + int memtype = (datatype != CDI_DATATYPE_FLT32) ? MEMTYPE_DOUBLE : MEMTYPE_FLOAT; + + void *data = Malloc(datasize * ((memtype == MEMTYPE_DOUBLE) ? sizeof(double) : sizeof(float))); + + size_t nmiss; + cdf_read_record(streamptr1, memtype, data, &nmiss); + cdf_write_record(streamptr2, memtype, data, nmiss); + + Free(data); +} + +void +cdfDefRecord(stream_t *streamptr) +{ + (void) streamptr; +} + +static void +cdfDefComplex(stream_t *streamptr, int gridID, int gridIndex) +{ + int dimID; + ncgrid_t *ncgrid = streamptr->ncgrid; + + for (int index = 0; index < gridIndex; ++index) + { + if (ncgrid[index].ncIDs[CDF_DIMID_X] != CDI_UNDEFID) + { + int gridID0 = ncgrid[index].gridID; + int gridtype0 = gridInqType(gridID0); + if (gridtype0 == GRID_SPECTRAL || gridtype0 == GRID_FOURIER) + { + dimID = ncgrid[index].ncIDs[CDF_DIMID_X]; + goto dimIDEstablished; + } + } + } + + { + static const char axisname[] = "nc2"; + size_t dimlen = 2; + int fileID = streamptr->fileID; + + bool switchNCMode = streamptr->ncmode == 2; + if (switchNCMode) + { + streamptr->ncmode = 1; + cdf_redef(fileID); + } + + cdf_def_dim(fileID, axisname, dimlen, &dimID); + + if (switchNCMode) + { + cdf_enddef(fileID, streamptr->self); + streamptr->ncmode = 2; + } + } + +dimIDEstablished: + ncgrid[gridIndex].gridID = gridID; + ncgrid[gridIndex].ncIDs[CDF_DIMID_X] = dimID; +} + +struct idSearch +{ + int numNonMatching, foundID; + size_t foundIdx; +}; + +static inline struct idSearch +cdfSearchIDBySize(size_t startIdx, size_t numIDs, const ncgrid_t ncgrid[/*numIDs*/], int ncIDType, int searchType, int searchSize, + int (*typeInq)(int id), SizeType (*sizeInq)(int id)) +{ + int numNonMatching = 0, foundID = CDI_UNDEFID; + size_t foundIdx = SIZE_MAX; + for (size_t index = startIdx; index < numIDs; index++) + { + if (ncgrid[index].ncIDs[ncIDType] != CDI_UNDEFID) + { + int id0 = ncgrid[index].gridID, id0Type = typeInq(id0); + if (id0Type == searchType) + { + int size0 = sizeInq(id0); + if (searchSize == size0) + { + foundID = ncgrid[index].ncIDs[ncIDType]; + foundIdx = index; + break; + } + numNonMatching++; + } + } + } + return (struct idSearch){ .numNonMatching = numNonMatching, .foundID = foundID, .foundIdx = foundIdx }; +} + +static SizeType +cdfGridInqHalfSize(int gridID) +{ + return gridInqSize(gridID) / 2; +} + +static void +cdfDefSPorFC(stream_t *streamptr, int gridID, int gridIndex, char *restrict axisname, int gridRefType) +{ + ncgrid_t *ncgrid = streamptr->ncgrid; + + size_t dimlen = gridInqSize(gridID) / 2; + + struct idSearch search + = cdfSearchIDBySize(0, (size_t) gridIndex, ncgrid, CDF_DIMID_Y, gridRefType, (int) dimlen, gridInqType, cdfGridInqHalfSize); + int dimID = search.foundID; + int iz = search.numNonMatching; + + if (dimID == CDI_UNDEFID) + { + int fileID = streamptr->fileID; + if (iz == 0) + axisname[3] = '\0'; + else + sprintf(&axisname[3], "%1d", iz + 1); + + bool switchNCMode = streamptr->ncmode == 2; + if (switchNCMode) + { + streamptr->ncmode = 1; + cdf_redef(fileID); + } + + cdf_def_dim(fileID, axisname, dimlen, &dimID); + + if (switchNCMode) + { + cdf_enddef(fileID, streamptr->self); + streamptr->ncmode = 2; + } + } + + ncgrid[gridIndex].gridID = gridID; + ncgrid[gridIndex].ncIDs[CDF_DIMID_Y] = dimID; +} + +static void +cdfDefSP(stream_t *streamptr, int gridID, int gridIndex) +{ + // char longname[] = "Spherical harmonic coefficient"; + char axisname[5] = "nspX"; + cdfDefSPorFC(streamptr, gridID, gridIndex, axisname, GRID_SPECTRAL); +} + +static void +cdfDefFC(stream_t *streamptr, int gridID, int gridIndex) +{ + char axisname[5] = "nfcX"; + cdfDefSPorFC(streamptr, gridID, gridIndex, axisname, GRID_FOURIER); +} + +static const struct cdfDefGridAxisInqs +{ + SizeType (*axisSize)(int gridID); + double (*axisVal)(int gridID, SizeType index); + const double *(*axisValsPtr)(int gridID); + const double *(*axisBoundsPtr)(int gridID); + enum cdfIDIdx dimIdx, varIdx; + char axisSym; + enum gridPropInq valsQueryKey, bndsQueryKey; + char axisPanoplyName[4]; +} gridInqsX = { + .axisSize = gridInqXsize, + .axisVal = gridInqXval, + .axisValsPtr = gridInqXvalsPtr, + .axisBoundsPtr = gridInqXboundsPtr, + .dimIdx = CDF_DIMID_X, + .varIdx = CDF_VARID_X, + .axisSym = 'X', + .valsQueryKey = GRID_PROP_XVALS, + .bndsQueryKey = GRID_PROP_XBOUNDS, + .axisPanoplyName = "Lon", +}, gridInqsY = { + .axisSize = gridInqYsize, + .axisVal = gridInqYval, + .axisValsPtr = gridInqYvalsPtr, + .axisBoundsPtr = gridInqYboundsPtr, + .dimIdx = CDF_DIMID_Y, + .varIdx = CDF_VARID_Y, + .axisSym = 'Y', + .valsQueryKey = GRID_PROP_YVALS, + .bndsQueryKey = GRID_PROP_YBOUNDS, + .axisPanoplyName = "Lat", +}; + +static void +cdfPutGridStdAtts(int fileID, int ncvarid, int gridID, int dimtype) +{ + size_t len; + + int axisKey = (dimtype == 'Z') ? CDI_GLOBAL : ((dimtype == 'X') ? CDI_XAXIS : CDI_YAXIS); + + { + char stdname[CDI_MAX_NAME]; + int length = CDI_MAX_NAME; + cdiInqKeyString(gridID, axisKey, CDI_KEY_STDNAME, stdname, &length); + if (stdname[0] && (len = strlen(stdname))) cdf_put_att_text(fileID, ncvarid, "standard_name", len, stdname); + } + { + char longname[CDI_MAX_NAME]; + int length = CDI_MAX_NAME; + cdiInqKeyString(gridID, axisKey, CDI_KEY_LONGNAME, longname, &length); + if (longname[0] && (len = strlen(longname))) cdf_put_att_text(fileID, ncvarid, "long_name", len, longname); + } + { + char units[CDI_MAX_NAME]; + int length = CDI_MAX_NAME; + cdiInqKeyString(gridID, axisKey, CDI_KEY_UNITS, units, &length); + if (units[0] && (len = strlen(units))) cdf_put_att_text(fileID, ncvarid, "units", len, units); + } +} + +static int +grid_inq_xtype(int gridID) +{ + int datatype = CDI_UNDEFID; + cdiInqKeyInt(gridID, CDI_GLOBAL, CDI_KEY_DATATYPE, &datatype); + return (datatype == CDI_DATATYPE_FLT32) ? NC_FLOAT : NC_DOUBLE; +} + +static void +cdfDefTrajLatLon(stream_t *streamptr, int gridID, int gridIndex, const struct cdfDefGridAxisInqs *inqs) +{ + nc_type xtype = grid_inq_xtype(gridID); + ncgrid_t *ncgrid = streamptr->ncgrid; + + size_t dimlen = inqs->axisSize(gridID); + if (dimlen != 1) Error("%c size isn't 1 for %s grid!", inqs->axisSym, gridNamePtr(gridInqType(gridID))); + + int ncvarid = ncgrid[gridIndex].ncIDs[inqs->dimIdx]; + if (ncvarid == CDI_UNDEFID) + { + int dimNcID = streamptr->basetime.ncvarid; + int fileID = streamptr->fileID; + bool switchNCMode = streamptr->ncmode == 2; + if (switchNCMode) + { + cdf_redef(fileID); + switchNCMode = true; + streamptr->ncmode = 1; + } + + char axisname[CDI_MAX_NAME]; + int axistype = (inqs->axisSym == 'X') ? CDI_XAXIS : CDI_YAXIS; + int length = CDI_MAX_NAME; + cdiInqKeyString(gridID, axistype, CDI_KEY_NAME, axisname, &length); + cdf_def_var(fileID, axisname, xtype, 1, &dimNcID, &ncvarid); + cdfPutGridStdAtts(fileID, ncvarid, gridID, inqs->axisSym); + if (switchNCMode) + { + cdf_enddef(fileID, streamptr->self); + streamptr->ncmode = 2; + } + } + + ncgrid[gridIndex].gridID = gridID; + // var ID for trajectory !!! + ncgrid[gridIndex].ncIDs[inqs->dimIdx] = ncvarid; +} + +static void +cdfDefTrajLon(stream_t *streamptr, int gridID, int gridIndex) +{ + cdfDefTrajLatLon(streamptr, gridID, gridIndex, &gridInqsX); +} + +static void +cdfDefTrajLat(stream_t *streamptr, int gridID, int gridIndex) +{ + cdfDefTrajLatLon(streamptr, gridID, gridIndex, &gridInqsY); +} + +static int +checkDimName(int fileID, size_t dimlen, char *dimname) +{ + // check whether the dimenion name is already defined with the same length + unsigned iz = 0; + int dimid = CDI_UNDEFID; + char name[CDI_MAX_NAME]; + + size_t len = strlen(dimname); + memcpy(name, dimname, len + 1); + + do + { + if (iz) sprintf(name + len, "_%u", iz + 1); + + int dimid0; + int status = nc_inq_dimid(fileID, name, &dimid0); + if (status != NC_NOERR) break; + size_t dimlen0; + cdf_inq_dimlen(fileID, dimid0, &dimlen0); + if (dimlen0 == dimlen) + { + dimid = dimid0; + break; + } + iz++; + } + while (iz <= 99); + + if (iz) sprintf(dimname + len, "_%u", iz + 1); + + return dimid; +} + +static void +checkGridName(char *axisname, int fileID) +{ + int ncdimid; + char axisname2[CDI_MAX_NAME]; + + // check that the name is not already defined + unsigned iz = 0; + + size_t axisnameLen = strlen(axisname); + memcpy(axisname2, axisname, axisnameLen + 1); + + do + { + if (iz) sprintf(axisname2 + axisnameLen, "_%u", iz + 1); + + if (nc_inq_varid(fileID, axisname2, &ncdimid) != NC_NOERR) break; + + ++iz; + } + while (iz <= 99); + + if (iz) sprintf(axisname + axisnameLen, "_%u", iz + 1); +} + +static int +checkZaxisName(char *axisname, int fileID, int vlistID, int zaxisID, int nzaxis) +{ + char axisname2[CDI_MAX_NAME]; + + // check that the name is not already defined + unsigned iz = 0; + + size_t axisnameLen = strlen(axisname); + memcpy(axisname2, axisname, axisnameLen + 1); + do + { + if (iz) sprintf(axisname2 + axisnameLen, "_%u", iz + 1); + + int ncdimid; + int status = nc_inq_varid(fileID, axisname2, &ncdimid); + if (status != NC_NOERR) + { + if (iz) + { + // check that the name does not exist for other zaxes + for (int index = 0; index < nzaxis; index++) + { + int zaxisID0 = vlistZaxis(vlistID, index); + if (zaxisID != zaxisID0) + { + const char *axisname0 = zaxisInqNamePtr(zaxisID0); + if (str_is_equal(axisname0, axisname2)) goto nextSuffix; + } + } + } + break; + } + nextSuffix: + ++iz; + } + while (iz <= 99); + + if (iz) sprintf(axisname + axisnameLen, "_%u", iz + 1); + + return (int) iz; +} + +struct cdfPostDefPutVar +{ + int fileID, ncvarid; + union + { + const void *array; + int int1; + } values; +}; + +static void +cdfDelayedPutVarDouble(void *data) +{ + struct cdfPostDefPutVar *put = (struct cdfPostDefPutVar *) data; + cdf_put_var_double(put->fileID, put->ncvarid, (const double *) put->values.array); +} + +static void +cdfDelayedPutVarInt1(void *data) +{ + struct cdfPostDefPutVar *put = (struct cdfPostDefPutVar *) data; + cdf_put_var_int(put->fileID, put->ncvarid, &put->values.int1); +} + +void +cdfDelayedPutVarDeepCleanup(void *data) +{ + struct cdfPostDefPutVar *what = (struct cdfPostDefPutVar *) data; + Free((void *) what->values.array); + Free(what); +} + +static void +cdfPostDefActionApply(size_t numActions, struct cdfPostDefAction *actions) +{ + for (size_t i = 0; i < numActions; ++i) actions[i].action(actions[i].data); +} + +static void +cdfPostDefActionListDelete(struct cdfPostDefActionList *list) +{ + struct cdfPostDefAction *actions = list->actions; + for (size_t i = 0, len = list->len; i < len; ++i) + { + void (*cleanup)(void *) = actions[i].cleanup; + void *data = actions[i].data; + if (cleanup == (void (*)(void *))(void (*)(void)) memFree) + Free(data); + else + cleanup(data); + } + Free(list); +} + +struct cdfPostDefActionList * +cdfPostDefActionAdd(struct cdfPostDefActionList *list, struct cdfPostDefAction addendum) +{ + size_t appendPos = list ? list->len : 0; + if (!list || list->size == list->len) + { + enum + { + initialListSize = 1 + }; + size_t newSize = list ? (list->size * 2) : initialListSize, newLen = list ? list->len + 1 : 1, + newAllocSize = sizeof(struct cdfPostDefActionList) + newSize * sizeof(struct cdfPostDefAction); + list = (struct cdfPostDefActionList *) Realloc(list, newAllocSize); + list->size = newSize; + list->len = newLen; + } + else + ++(list->len); + list->actions[appendPos] = addendum; + return list; +} + +static struct cdfPostDefActionList * +cdfPostDefActionConcat(struct cdfPostDefActionList *listA, const struct cdfPostDefActionList *listB) +{ + size_t appendPos = listA ? listA->len : 0, appendLen = listB ? listB->len : 0; + if (appendLen) + { + size_t newLen = appendPos + appendLen; + if (!listA || listA->size < newLen) + { + enum + { + initialListSize = 1 + }; + size_t newSize = listA ? listA->size : initialListSize; + while (newSize < newLen) newSize *= 2; + size_t newAllocSize = sizeof(struct cdfPostDefActionList) + newSize * sizeof(struct cdfPostDefAction); + listA = (struct cdfPostDefActionList *) Realloc(listA, newAllocSize); + listA->size = newSize; + listA->len = newLen; + } + else + listA->len = newLen; + struct cdfPostDefAction *restrict actionsA = listA->actions; + const struct cdfPostDefAction *restrict actionsB = listB->actions; + for (size_t i = 0; i < appendLen; ++i) actionsA[appendPos + i] = actionsB[i]; + } + return listA; +} + +void +cdfPostDefActionAddPutVal(struct cdfPostDefActionList **list_, int fileID, int ncvarid, const double *values, + void (*cleanup)(void *)) +{ + struct cdfPostDefPutVar *delayedPutVals = (struct cdfPostDefPutVar *) Malloc(sizeof(*delayedPutVals)); + delayedPutVals->values.array = values; + delayedPutVals->fileID = fileID; + delayedPutVals->ncvarid = ncvarid; + *list_ = cdfPostDefActionAdd( + *list_, (struct cdfPostDefAction){ .data = (void *) delayedPutVals, .action = cdfDelayedPutVarDouble, .cleanup = cleanup }); +} + +static inline void +cdfPostDefActionAddPut1Int(struct cdfPostDefActionList **list_, int fileID, int ncvarid, int iVal, void (*cleanup)(void *)) +{ + struct cdfPostDefPutVar *delayedPutVals = (struct cdfPostDefPutVar *) Malloc(sizeof(*delayedPutVals)); + delayedPutVals->values.int1 = iVal; + delayedPutVals->fileID = fileID; + delayedPutVals->ncvarid = ncvarid; + *list_ = cdfPostDefActionAdd( + *list_, (struct cdfPostDefAction){ .data = (void *) delayedPutVals, .action = cdfDelayedPutVarInt1, .cleanup = cleanup }); +} + +static void +cdfGridCompress(int fileID, int ncvarid, size_t gridsize, int filetype, int comptype, size_t *chunks) +{ +#ifdef HAVE_NETCDF4 + if (gridsize >= 32 && comptype == CDI_COMPRESS_ZIP + && (filetype == CDI_FILETYPE_NC4 || filetype == CDI_FILETYPE_NC4C || filetype == CDI_FILETYPE_NCZARR)) + { + cdf_def_var_chunking(fileID, ncvarid, NC_CHUNKED, chunks); + cdfDefVarDeflate(fileID, ncvarid, 1); + } +#endif +} + +static struct cdfPostDefActionList * +cdfDefAxisCommon(stream_t *streamptr, int gridID, int gridIndex, int ndims, bool addVarToGrid, + const struct cdfDefGridAxisInqs *gridAxisInq, int axisKey, char axisLetter, + void (*finishCyclicBounds)(double *pbounds, size_t dimlen, const double *pvals)) +{ + int dimID = CDI_UNDEFID; + size_t dimlen = gridAxisInq->axisSize(gridID); + nc_type xtype = grid_inq_xtype(gridID); + + ncgrid_t *ncgrid = streamptr->ncgrid; + + bool hasVals = gridInqPropPresence(gridID, gridAxisInq->valsQueryKey); + char dimname[CDI_MAX_NAME + 3]; + dimname[0] = 0; + int length = sizeof(dimname); + if (ndims && hasVals) cdiInqKeyString(gridID, axisKey, CDI_KEY_DIMNAME, dimname, &length); + + for (int index = 0; index < gridIndex; ++index) + { + int gridID0 = ncgrid[index].gridID; + assert(gridID0 != CDI_UNDEFID); + int gridtype0 = gridInqType(gridID0); + if (gridtype0 == GRID_GAUSSIAN || gridtype0 == GRID_LONLAT || gridtype0 == GRID_PROJECTION || gridtype0 == GRID_GENERIC) + { + size_t dimlen0 = gridAxisInq->axisSize(gridID0); + char dimname0[CDI_MAX_NAME]; + dimname0[0] = 0; + length = sizeof(dimname0); + if (dimname[0]) cdiInqKeyString(gridID0, axisKey, CDI_KEY_DIMNAME, dimname0, &length); + bool lname = dimname0[0] ? str_is_equal(dimname, dimname0) : true; + if (dimlen == dimlen0 && lname) + { + double (*inqVal)(int gridID, SizeType index) = gridAxisInq->axisVal; + if (IS_EQUAL(inqVal(gridID0, 0), inqVal(gridID, 0)) + && IS_EQUAL(inqVal(gridID0, dimlen - 1), inqVal(gridID, dimlen - 1))) + { + dimID = ncgrid[index].ncIDs[(axisLetter == 'X') ? CDF_DIMID_X : CDF_DIMID_Y]; + break; + } + } + } + } + + struct cdfPostDefActionList *delayed = NULL; + if (dimID == CDI_UNDEFID) + { + int ncvarid = CDI_UNDEFID; + char axisname[CDI_MAX_NAME]; + length = CDI_MAX_NAME; + cdiInqKeyString(gridID, axisKey, CDI_KEY_NAME, axisname, &length); + int fileID = streamptr->fileID; + if (axisname[0] == 0) Error("axis name undefined!"); + + checkGridName(axisname, fileID); + size_t axisnameLen = strlen(axisname); + + bool switchNCMode = streamptr->ncmode == 2 && (hasVals || ndims); + if (switchNCMode) + { + cdf_redef(fileID); + streamptr->ncmode = 1; + } + + if (ndims) + { + if (dimname[0] == 0) strcpy(dimname, axisname); + dimID = checkDimName(fileID, dimlen, dimname); + + if (dimID == CDI_UNDEFID) cdf_def_dim(fileID, dimname, dimlen, &dimID); + } + + if (hasVals) + { + cdf_def_var(fileID, axisname, xtype, ndims, &dimID, &ncvarid); + + int chunkSize = 0; + int chunkType = CDI_CHUNK_GRID; + cdiInqKeyInt(gridID, CDI_GLOBAL, CDI_KEY_CHUNKTYPE, &chunkType); + cdiInqKeyInt(gridID, CDI_GLOBAL, CDI_KEY_CHUNKSIZE, &chunkSize); + if (chunkSize > 0) chunkType = CDI_CHUNK_AUTO; + + if (chunkType == CDI_CHUNK_GRID && dimlen > ChunkSizeLim) chunkType = CDI_CHUNK_LINES; + + size_t chunk = calc_chunksize_x(chunkType, chunkSize, dimlen, true); + cdfGridCompress(fileID, ncvarid, dimlen, streamptr->filetype, streamptr->comptype, &chunk); + + cdfPutGridStdAtts(fileID, ncvarid, gridID, axisLetter); + { + char axisStr[2] = { axisLetter, '\0' }; + cdf_put_att_text(fileID, ncvarid, "axis", 1, axisStr); + } + cdfFuncPtrPostDefActionGridProp mycdfPostDefActionGridProp + = (cdfFuncPtrPostDefActionGridProp) namespaceSwitchGet(NSSWITCH_CDF_POSTDEFACTION_GRID_PROP).func; + mycdfPostDefActionGridProp(streamptr, gridID, ncvarid, gridAxisInq->valsQueryKey, &delayed); + + bool genBounds = false, hasBounds = gridInqPropPresence(gridID, gridAxisInq->bndsQueryKey); + bool grid_is_cyclic = gridIsCircular(gridID) > 0; + double *restrict pbounds; + size_t nvertex = gridInqNvertex(gridID); + if (CDI_CMOR_Mode && grid_is_cyclic && !hasBounds) + { + const double *pvals = gridAxisInq->axisValsPtr(gridID); + genBounds = true; + nvertex = 2; + pbounds = (double *) Malloc(2 * dimlen * sizeof(double)); + for (size_t i = 0; i < dimlen - 1; ++i) + { + pbounds[i * 2 + 1] = (pvals[i] + pvals[i + 1]) * 0.5; + pbounds[i * 2 + 2] = (pvals[i] + pvals[i + 1]) * 0.5; + } + finishCyclicBounds(pbounds, dimlen, pvals); + } + else + pbounds = (double *) gridAxisInq->axisBoundsPtr(gridID); + + int nvdimID = CDI_UNDEFID; + if (pbounds) + { + if (nc_inq_dimid(fileID, bndsName, &nvdimID) != NC_NOERR) cdf_def_dim(fileID, bndsName, nvertex, &nvdimID); + } + if ((hasBounds || genBounds) && nvdimID != CDI_UNDEFID) + { + char boundsname[CDI_MAX_NAME]; + memcpy(boundsname, axisname, axisnameLen); + boundsname[axisnameLen] = '_'; + memcpy(boundsname + axisnameLen + 1, bndsName, sizeof(bndsName)); + int dimIDs[2] = { dimID, nvdimID }; + int ncbvarid; + cdf_def_var(fileID, boundsname, xtype, 2, dimIDs, &ncbvarid); + cdf_put_att_text(fileID, ncvarid, "bounds", axisnameLen + sizeof(bndsName), boundsname); + cdfPostDefActionAddPutVal(&delayed, fileID, ncbvarid, pbounds, + genBounds ? cdfDelayedPutVarDeepCleanup : (void (*)(void *))(void (*)(void)) memFree); + } + } + + if (switchNCMode) + { + cdf_enddef(fileID, streamptr->self); + streamptr->ncmode = 2; + } + + if (ndims == 0 || addVarToGrid) ncgrid[gridIndex].ncIDs[(axisLetter == 'X') ? CDF_VARID_X : CDF_VARID_Y] = ncvarid; + } + + ncgrid[gridIndex].gridID = gridID; + ncgrid[gridIndex].ncIDs[(axisLetter == 'X') ? CDF_DIMID_X : CDF_DIMID_Y] = dimID; + return delayed; +} + +static void +finishCyclicXBounds(double *pbounds, size_t dimlen, const double *pvals) +{ + pbounds[0] = (pvals[0] + pvals[dimlen - 1] - 360) * 0.5; + pbounds[2 * dimlen - 1] = (pvals[dimlen - 1] + pvals[0] + 360) * 0.5; +} + +static void +finishCyclicYBounds(double *pbounds, size_t dimlen, const double *pvals) +{ + pbounds[0] = copysign(90.0, pvals[0]); + pbounds[2 * dimlen - 1] = copysign(90.0, pvals[dimlen - 1]); +} + +static struct cdfPostDefActionList * +cdfDefXaxis(stream_t *streamptr, int gridID, int gridIndex, int ndims, bool addVarToGrid) +{ + return cdfDefAxisCommon(streamptr, gridID, gridIndex, ndims, addVarToGrid, &gridInqsX, CDI_XAXIS, 'X', finishCyclicXBounds); +} + +static struct cdfPostDefActionList * +cdfDefYaxis(stream_t *streamptr, int gridID, int gridIndex, int ndims, bool addVarToGrid) +{ + return cdfDefAxisCommon(streamptr, gridID, gridIndex, ndims, addVarToGrid, &gridInqsY, CDI_YAXIS, 'Y', finishCyclicYBounds); +} + +static void +cdfDefGridReference(stream_t *streamptr, int gridID) +{ + int fileID = streamptr->fileID; + + int number = 0; + cdiInqKeyInt(gridID, CDI_GLOBAL, CDI_KEY_NUMBEROFGRIDUSED, &number); + if (number > 0) cdf_put_att_int(fileID, NC_GLOBAL, "number_of_grid_used", NC_INT, 1, &number); + + grid_t *gridptr = grid_to_pointer(gridID); + const char *gridfile = cdiInqVarKeyStringPtr(&gridptr->keys, CDI_KEY_REFERENCEURI); + if (gridfile && gridfile[0] != 0) cdf_put_att_text(fileID, NC_GLOBAL, "grid_file_uri", strlen(gridfile), gridfile); +} + +static void +cdfDefGridUUID(stream_t *streamptr, int gridID) +{ + unsigned char uuid[CDI_UUID_SIZE] = { 0 }; + int length = CDI_UUID_SIZE; + cdiInqKeyBytes(gridID, CDI_GLOBAL, CDI_KEY_UUID, uuid, &length); + if (!cdiUUIDIsNull(uuid)) + { + char uuidStr[uuidNumHexChars + 1] = { 0 }; + if (cdiUUID2Str(uuid, uuidStr) == uuidNumHexChars) + { + int fileID = streamptr->fileID; + // if (streamptr->ncmode == 2) cdf_redef(fileID); + cdf_put_att_text(fileID, NC_GLOBAL, "uuidOfHGrid", uuidNumHexChars, uuidStr); + // if (streamptr->ncmode == 2 cdf_enddef(fileID, streamptr->self); + } + } +} + +void +cdfPostDefActionGridProp(stream_t *streamptr, int gridID, int ncvarid, enum gridPropInq gridProp, + struct cdfPostDefActionList **delayed) +{ + const void *valsPtr = NULL; + switch (gridProp) + { + case GRID_PROP_MASK: + case GRID_PROP_MASK_GME: Error("unsupported key: %d", (int) gridProp); break; + case GRID_PROP_XVALS: valsPtr = gridInqXvalsPtr(gridID); break; + case GRID_PROP_YVALS: valsPtr = gridInqYvalsPtr(gridID); break; + case GRID_PROP_AREA: valsPtr = gridInqAreaPtr(gridID); break; + case GRID_PROP_XBOUNDS: valsPtr = gridInqXboundsPtr(gridID); break; + case GRID_PROP_YBOUNDS: valsPtr = gridInqYboundsPtr(gridID); break; + } + cdfPostDefActionAddPutVal(delayed, streamptr->fileID, ncvarid, (const double *) valsPtr, + (void (*)(void *))(void (*)(void)) memFree); +} + +static int +cdfDefIrregularGridAxisSetup(stream_t *streamptr, int gridID, nc_type xtype, int varID, size_t dimlens, int ndims, int dimIDs[], + size_t *chunks, const struct cdfDefGridAxisInqs *inqs, struct cdfPostDefActionList **delayed) +{ + int ncvarid = CDI_UNDEFID; + int fileID = streamptr->fileID; + if (gridInqPropPresence(gridID, inqs->valsQueryKey)) + { + char axisname[CDI_MAX_NAME]; + int length = CDI_MAX_NAME; + cdiInqKeyString(gridID, varID, CDI_KEY_NAME, axisname, &length); + checkGridName(axisname, fileID); + cdf_def_var(fileID, axisname, xtype, ndims - 1, dimIDs, &ncvarid); + cdfGridCompress(fileID, ncvarid, dimlens, streamptr->filetype, streamptr->comptype, chunks); + + cdfPutGridStdAtts(fileID, ncvarid, gridID, inqs->axisSym); + cdfFuncPtrPostDefActionGridProp mycdfPostDefActionGridProp + = (cdfFuncPtrPostDefActionGridProp) namespaceSwitchGet(NSSWITCH_CDF_POSTDEFACTION_GRID_PROP).func; + mycdfPostDefActionGridProp(streamptr, gridID, ncvarid, inqs->valsQueryKey, delayed); + + // attribute for Panoply + if (!CDI_CMOR_Mode && ndims == 3) cdf_put_att_text(fileID, ncvarid, "_CoordinateAxisType", 3, inqs->axisPanoplyName); + + if (gridInqPropPresence(gridID, inqs->bndsQueryKey) && dimIDs[ndims - 1] != CDI_UNDEFID) + { + size_t axisnameLen = strlen(axisname); + axisname[axisnameLen] = '_'; + memcpy(axisname + axisnameLen + 1, bndsName, sizeof(bndsName)); + int ncbvarid; + cdf_def_var(fileID, axisname, xtype, ndims, dimIDs, &ncbvarid); + cdfGridCompress(fileID, ncbvarid, dimlens, streamptr->filetype, streamptr->comptype, chunks); + + cdf_put_att_text(fileID, ncvarid, "bounds", axisnameLen + sizeof(bndsName), axisname); + mycdfPostDefActionGridProp(streamptr, gridID, ncbvarid, inqs->bndsQueryKey, delayed); + } + } + return ncvarid; +} + +struct cdfDefIrregularGridCommonIDs +{ + int xdimID, ydimID, ncxvarid, ncyvarid, ncavarid; + struct cdfPostDefActionList *delayed; +}; + +static struct cdfDefIrregularGridCommonIDs +cdfDefIrregularGridCommon(stream_t *streamptr, int gridID, size_t xsize, size_t ysize, int ndims, const char *xdimname_default, + size_t nvertex, const char *vdimname_default, bool setVdimname) +{ + nc_type xtype = grid_inq_xtype(gridID); + int xdimID = CDI_UNDEFID; + int ydimID = CDI_UNDEFID; + int fileID = streamptr->fileID; + bool switchNCMode = streamptr->ncmode == 2; + if (switchNCMode) + { + cdf_redef(fileID); + streamptr->ncmode = 1; + } + + { + char xdimname[CDI_MAX_NAME + 3]; + int length = sizeof(xdimname); + cdiInqKeyString(gridID, CDI_XAXIS, CDI_KEY_DIMNAME, xdimname, &length); + if (xdimname[0] == 0) strcpy(xdimname, xdimname_default); + xdimID = checkDimName(fileID, xsize, xdimname); + if (xdimID == CDI_UNDEFID) cdf_def_dim(fileID, xdimname, xsize, &xdimID); + } + + if (ndims == 3) + { + char ydimname[CDI_MAX_NAME + 3]; + int length = sizeof(ydimname); + cdiInqKeyString(gridID, CDI_YAXIS, CDI_KEY_DIMNAME, ydimname, &length); + if (ydimname[0] == 0) + { + ydimname[0] = 'y'; + ydimname[1] = 0; + } + ydimID = checkDimName(fileID, ysize, ydimname); + if (ydimID == CDI_UNDEFID) cdf_def_dim(fileID, ydimname, ysize, &ydimID); + } + + int nvdimID = CDI_UNDEFID; + int dimIDs[3]; + dimIDs[ndims - 1] = CDI_UNDEFID; + if (setVdimname) + { + char vdimname[CDI_MAX_NAME + 3]; + int length = CDI_MAX_NAME; + cdiInqKeyString(gridID, CDI_GLOBAL, CDI_KEY_VDIMNAME, vdimname, &length); + if (vdimname[0] == 0) strcpy(vdimname, vdimname_default); + nvdimID = dimIDs[ndims - 1] = checkDimName(fileID, nvertex, vdimname); + if (nvdimID == CDI_UNDEFID) + { + cdf_def_dim(fileID, vdimname, nvertex, dimIDs + ndims - 1); + nvdimID = dimIDs[ndims - 1]; + } + } + + size_t gridsize = xsize * ysize; + size_t chunks[3] = { 1, 1, 1 }; + int chunkSize = 0; + int chunkType = CDI_CHUNK_GRID; + cdiInqKeyInt(gridID, CDI_GLOBAL, CDI_KEY_CHUNKTYPE, &chunkType); + cdiInqKeyInt(gridID, CDI_GLOBAL, CDI_KEY_CHUNKSIZE, &chunkSize); + if (chunkSize > 0 && ydimID == CDI_UNDEFID) chunkType = CDI_CHUNK_AUTO; + + if (chunkType == CDI_CHUNK_GRID && gridsize > ChunkSizeLim) chunkType = CDI_CHUNK_LINES; + + if (ndims == 3) + { + chunks[0] = calc_chunksize_y(chunkType, gridsize, xsize, ysize); + chunks[1] = calc_chunksize_x(chunkType, chunkSize, xsize, (ydimID == CDI_UNDEFID)); + dimIDs[0] = ydimID; + dimIDs[1] = xdimID; + } + else // ndims == 2 + { + chunks[0] = calc_chunksize_x(chunkType, chunkSize, xsize, (ydimID == CDI_UNDEFID)); + dimIDs[0] = xdimID; + cdfDefGridReference(streamptr, gridID); + cdfDefGridUUID(streamptr, gridID); + } + + struct cdfPostDefActionList *delayed = NULL; + int ncxvarid + = cdfDefIrregularGridAxisSetup(streamptr, gridID, xtype, CDI_XAXIS, gridsize, ndims, dimIDs, chunks, &gridInqsX, &delayed); + int ncyvarid + = cdfDefIrregularGridAxisSetup(streamptr, gridID, xtype, CDI_YAXIS, gridsize, ndims, dimIDs, chunks, &gridInqsY, &delayed); + + int ncavarid = CDI_UNDEFID; + if (gridInqPropPresence(gridID, GRID_PROP_AREA)) + { + static const char yaxisname_[] = "cell_area"; + static const char units[] = "m2"; + static const char longname[] = "area of grid cell"; + static const char stdname[] = "cell_area"; + + cdf_def_var(fileID, yaxisname_, xtype, ndims - 1, dimIDs, &ncavarid); + + cdf_put_att_text(fileID, ncavarid, "standard_name", sizeof(stdname) - 1, stdname); + cdf_put_att_text(fileID, ncavarid, "long_name", sizeof(longname) - 1, longname); + cdf_put_att_text(fileID, ncavarid, "units", sizeof(units) - 1, units); + cdfFuncPtrPostDefActionGridProp mycdfPostDefActionGridProp + = (cdfFuncPtrPostDefActionGridProp) namespaceSwitchGet(NSSWITCH_CDF_POSTDEFACTION_GRID_PROP).func; + mycdfPostDefActionGridProp(streamptr, gridID, ncavarid, GRID_PROP_AREA, &delayed); + } + + if (switchNCMode) + { + cdf_enddef(fileID, streamptr->self); + streamptr->ncmode = 2; + } + + return (struct cdfDefIrregularGridCommonIDs){ + .xdimID = xdimID, .ydimID = ydimID, .ncxvarid = ncxvarid, .ncyvarid = ncyvarid, .ncavarid = ncavarid, .delayed = delayed + }; +} + +static struct cdfPostDefActionList * +cdfDefCurvilinear(stream_t *streamptr, int gridID, int gridIndex) +{ + ncgrid_t *ncgrid = streamptr->ncgrid; + + size_t dimlen = gridInqSize(gridID); + size_t xdimlen = gridInqXsize(gridID); + size_t ydimlen = gridInqYsize(gridID); + + int xdimID = CDI_UNDEFID, ydimID = CDI_UNDEFID; + int ncxvarid = CDI_UNDEFID, ncyvarid = CDI_UNDEFID, ncavarid = CDI_UNDEFID; + + size_t ofs = 0; + do + { + struct idSearch search = cdfSearchIDBySize(ofs, (size_t) gridIndex, ncgrid, CDF_DIMID_X, GRID_CURVILINEAR, (int) dimlen, + gridInqType, gridInqSize); + size_t index = search.foundIdx; + if (index != SIZE_MAX) + { + int gridID0 = ncgrid[index].gridID; + if (IS_EQUAL(gridInqXval(gridID0, 0), gridInqXval(gridID, 0)) + && IS_EQUAL(gridInqXval(gridID0, dimlen - 1), gridInqXval(gridID, dimlen - 1)) + && IS_EQUAL(gridInqYval(gridID0, 0), gridInqYval(gridID, 0)) + && IS_EQUAL(gridInqYval(gridID0, dimlen - 1), gridInqYval(gridID, dimlen - 1))) + { + xdimID = ncgrid[index].ncIDs[CDF_DIMID_X]; + ydimID = ncgrid[index].ncIDs[CDF_DIMID_Y]; + ncxvarid = ncgrid[index].ncIDs[CDF_VARID_X]; + ncyvarid = ncgrid[index].ncIDs[CDF_VARID_Y]; + break; + } + ofs = search.foundIdx; + if (ofs < (size_t) gridIndex) continue; + } + } + while (false); + + struct cdfPostDefActionList *delayed = NULL; + if (xdimID == CDI_UNDEFID || ydimID == CDI_UNDEFID) + { + struct cdfDefIrregularGridCommonIDs createdIDs = cdfDefIrregularGridCommon( + streamptr, gridID, xdimlen, ydimlen, 3, "x", 4, "nv4", + gridInqPropPresence(gridID, GRID_PROP_XBOUNDS) || gridInqPropPresence(gridID, GRID_PROP_YBOUNDS)); + xdimID = createdIDs.xdimID; + ydimID = createdIDs.ydimID; + ncxvarid = createdIDs.ncxvarid; + ncyvarid = createdIDs.ncyvarid; + ncavarid = createdIDs.ncavarid; + delayed = createdIDs.delayed; + } + + ncgrid[gridIndex].gridID = gridID; + ncgrid[gridIndex].ncIDs[CDF_DIMID_X] = xdimID; + ncgrid[gridIndex].ncIDs[CDF_DIMID_Y] = ydimID; + ncgrid[gridIndex].ncIDs[CDF_VARID_X] = ncxvarid; + ncgrid[gridIndex].ncIDs[CDF_VARID_Y] = ncyvarid; + ncgrid[gridIndex].ncIDs[CDF_VARID_A] = ncavarid; + return delayed; +} + +static struct cdfPostDefActionList * +cdfDefUnstructured(stream_t *streamptr, int gridID, int gridIndex) +{ + ncgrid_t *ncgrid = streamptr->ncgrid; + + size_t dimlen = gridInqSize(gridID); + + int dimID = CDI_UNDEFID; + int ncxvarid = CDI_UNDEFID, ncyvarid = CDI_UNDEFID, ncavarid = CDI_UNDEFID; + + size_t ofs = 0; + do + { + struct idSearch search = cdfSearchIDBySize(ofs, (size_t) gridIndex, ncgrid, CDF_DIMID_X, GRID_UNSTRUCTURED, (int) dimlen, + gridInqType, gridInqSize); + size_t index = search.foundIdx; + if (index != SIZE_MAX) + { + int gridID0 = ncgrid[index].gridID; + if (gridInqNvertex(gridID0) == gridInqNvertex(gridID) && IS_EQUAL(gridInqXval(gridID0, 0), gridInqXval(gridID, 0)) + && IS_EQUAL(gridInqXval(gridID0, dimlen - 1), gridInqXval(gridID, dimlen - 1)) + && IS_EQUAL(gridInqYval(gridID0, 0), gridInqYval(gridID, 0)) + && IS_EQUAL(gridInqYval(gridID0, dimlen - 1), gridInqYval(gridID, dimlen - 1))) + { + dimID = ncgrid[index].ncIDs[CDF_DIMID_X]; + ncxvarid = ncgrid[index].ncIDs[CDF_VARID_X]; + ncyvarid = ncgrid[index].ncIDs[CDF_VARID_Y]; + ncavarid = ncgrid[index].ncIDs[CDF_VARID_A]; + break; + } + ofs = search.foundIdx; + if (ofs < (size_t) gridIndex) continue; + } + } + while (false); + + struct cdfPostDefActionList *delayed = NULL; + if (dimID == CDI_UNDEFID) + { + size_t nvertex = (size_t) gridInqNvertex(gridID); + struct cdfDefIrregularGridCommonIDs createdIDs + = cdfDefIrregularGridCommon(streamptr, gridID, dimlen, 1, 2, "ncells", nvertex, "vertices", nvertex > 0); + dimID = createdIDs.xdimID; + ncxvarid = createdIDs.ncxvarid; + ncyvarid = createdIDs.ncyvarid; + ncavarid = createdIDs.ncavarid; + delayed = createdIDs.delayed; + } + + ncgrid[gridIndex].gridID = gridID; + ncgrid[gridIndex].ncIDs[CDF_DIMID_X] = dimID; + ncgrid[gridIndex].ncIDs[CDF_VARID_X] = ncxvarid; + ncgrid[gridIndex].ncIDs[CDF_VARID_Y] = ncyvarid; + ncgrid[gridIndex].ncIDs[CDF_VARID_A] = ncavarid; + return delayed; +} + +struct attTxtTab +{ + const char *txt; + size_t txtLen; +}; + +struct attTxtTab2 +{ + const char *attName, *attVal; + size_t valLen; +}; + +static struct cdfPostDefActionList * +cdf_def_vct_echam(stream_t *streamptr, int zaxisID) +{ + int type = zaxisInqType(zaxisID); + + int ilev; + struct cdfPostDefActionList *delayed = NULL; + if ((type == ZAXIS_HYBRID || type == ZAXIS_HYBRID_HALF) && (ilev = zaxisInqVctSize(zaxisID) / 2) != 0) + { + int mlev = ilev - 1; + + if (streamptr->vct.ilev > 0) + { + if (streamptr->vct.ilev != ilev) Error("More than one VCT for each file unsupported!"); + return delayed; + } + + int fileID = streamptr->fileID; + + bool switchNCMode = streamptr->ncmode == 2; + if (switchNCMode) + { + streamptr->ncmode = 1; + cdf_redef(fileID); + } + + int ncdimid = -1, ncdimid2 = -1; + int hyaiid, hybiid, hyamid = -1, hybmid = -1; + + cdf_def_dim(fileID, "nhyi", (size_t) ilev, &ncdimid2); + cdf_def_var(fileID, "hyai", NC_DOUBLE, 1, &ncdimid2, &hyaiid); + cdf_def_var(fileID, "hybi", NC_DOUBLE, 1, &ncdimid2, &hybiid); + if (mlev > 0) + { + cdf_def_dim(fileID, "nhym", (size_t) mlev, &ncdimid); + cdf_def_var(fileID, "hyam", NC_DOUBLE, 1, &ncdimid, &hyamid); + cdf_def_var(fileID, "hybm", NC_DOUBLE, 1, &ncdimid, &hybmid); + } + + streamptr->vct.ilev = ilev; + streamptr->vct.mlev = mlev; + streamptr->vct.mlevID = ncdimid; + streamptr->vct.ilevID = ncdimid2; + + { + static const char lname_n[] = "long_name", units_n[] = "units", lname_v_ai[] = "hybrid A coefficient at layer interfaces", + units_v_ai[] = "Pa", lname_v_bi[] = "hybrid B coefficient at layer interfaces", units_v_bi[] = "1"; + static const struct attTxtTab2 tab[] = { + { lname_n, lname_v_ai, sizeof(lname_v_ai) - 1 }, + { units_n, units_v_ai, sizeof(units_v_ai) - 1 }, + { lname_n, lname_v_bi, sizeof(lname_v_bi) - 1 }, + { units_n, units_v_bi, sizeof(units_v_bi) - 1 }, + }; + enum + { + tabLen = sizeof(tab) / sizeof(tab[0]) + }; + int ids[tabLen] = { hyaiid, hyaiid, hybiid, hybiid }; + for (size_t i = 0; i < tabLen; ++i) cdf_put_att_text(fileID, ids[i], tab[i].attName, tab[i].valLen, tab[i].attVal); + } + + { + static const char lname_n[] = "long_name", units_n[] = "units", lname_v_am[] = "hybrid A coefficient at layer midpoints", + units_v_am[] = "Pa", lname_v_bm[] = "hybrid B coefficient at layer midpoints", units_v_bm[] = "1"; + static const struct attTxtTab2 tab[] = { + { lname_n, lname_v_am, sizeof(lname_v_am) - 1 }, + { units_n, units_v_am, sizeof(units_v_am) - 1 }, + { lname_n, lname_v_bm, sizeof(lname_v_bm) - 1 }, + { units_n, units_v_bm, sizeof(units_v_bm) - 1 }, + }; + enum + { + tabLen = sizeof(tab) / sizeof(tab[0]) + }; + int ids[tabLen] = { hyamid, hyamid, hybmid, hybmid }; + for (size_t i = 0; i < tabLen; ++i) cdf_put_att_text(fileID, ids[i], tab[i].attName, tab[i].valLen, tab[i].attVal); + } + + if (switchNCMode) + { + cdf_enddef(fileID, streamptr->self); + streamptr->ncmode = 2; + } + + const double *vctptr = zaxisInqVctPtr(zaxisID); + + cdfPostDefActionAddPutVal(&delayed, fileID, hyaiid, vctptr, (void (*)(void *))(void (*)(void)) memFree); + cdfPostDefActionAddPutVal(&delayed, fileID, hybiid, vctptr + ilev, (void (*)(void *))(void (*)(void)) memFree); + { + double *restrict amidVal = (double *) Malloc((size_t) mlev * sizeof(*amidVal)); + for (size_t i = 0; i < (size_t) mlev; ++i) amidVal[i] = (vctptr[i] + vctptr[i + 1]) * 0.5; + cdfPostDefActionAddPutVal(&delayed, fileID, hyamid, amidVal, cdfDelayedPutVarDeepCleanup); + } + { + double *restrict bmidVal = (double *) Malloc((size_t) mlev * sizeof(*bmidVal)); + for (size_t i = 0; i < (size_t) mlev; ++i) bmidVal[i] = (vctptr[(size_t) ilev + i] + vctptr[(size_t) ilev + i + 1]) * 0.5; + cdfPostDefActionAddPutVal(&delayed, fileID, hybmid, bmidVal, cdfDelayedPutVarDeepCleanup); + } + } + return delayed; +} + +static struct cdfPostDefActionList * +cdf_def_vct_cf(stream_t *streamptr, int zaxisID, int nclevID, int ncbndsID, int p0status, double p0value) +{ + int type = zaxisInqType(zaxisID); + + struct cdfPostDefActionList *delayed = NULL; + int ilev; + if ((type == ZAXIS_HYBRID || type == ZAXIS_HYBRID_HALF) && (ilev = zaxisInqVctSize(zaxisID) / 2) != 0) + { + int mlev = ilev - 1; + + if (streamptr->vct.ilev > 0) + { + if (streamptr->vct.ilev != ilev) Error("more than one VCT for each file unsupported!"); + return delayed; + } + + int fileID = streamptr->fileID; + + bool switchNCMode = streamptr->ncmode == 2; + if (switchNCMode) + { + cdf_redef(fileID); + streamptr->ncmode = 1; + } + + int dimIDs[2] = { nclevID, ncbndsID }; + + streamptr->vct.mlev = mlev; + streamptr->vct.ilev = ilev; + streamptr->vct.mlevID = nclevID; + streamptr->vct.ilevID = nclevID; + + int hyamid, hybmid; + cdf_def_var(fileID, (p0status == 0) ? "a" : "ap", NC_DOUBLE, 1, dimIDs, &hyamid); + cdf_def_var(fileID, "b", NC_DOUBLE, 1, dimIDs, &hybmid); + + { + static const char anametab[][10] = { "long_name", "units" }; + static const char lname_v_a[] = "vertical coordinate formula term: ap(k)", + lname_v_b[] = "vertical coordinate formula term: b(k)", units_v_a[] = "Pa", units_v_b[] = "1"; + static struct attTxtTab attvtab[][2] = { { { lname_v_a, sizeof(lname_v_a) - 1 }, { units_v_a, sizeof(units_v_a) - 1 } }, + { { lname_v_b, sizeof(lname_v_b) - 1 }, { units_v_b, sizeof(units_v_b) - 1 } } }; + int termid[] = { hyamid, hybmid }; + enum + { + numTerms = sizeof(termid) / sizeof(termid[0]), + numAtts = sizeof(anametab) / sizeof(anametab[0]), + }; + for (size_t termIdx = 0; termIdx < numTerms; ++termIdx) + for (size_t attIdx = 0; attIdx < numAtts; ++attIdx) + cdf_put_att_text(fileID, termid[termIdx], anametab[attIdx], attvtab[termIdx][attIdx].txtLen, + attvtab[termIdx][attIdx].txt); + } + double *restrict vctptr = (double *) zaxisInqVctPtr(zaxisID); + if (p0status == 0 && IS_NOT_EQUAL(p0value, 0)) + { + double *restrict temp = (double *) Malloc((size_t) ilev * sizeof(*temp)); + for (size_t i = 0; i < (size_t) ilev; ++i) temp[i] = vctptr[i] / p0value; + vctptr = temp; + } + + { + double *restrict mlevValA = (double *) Malloc((size_t) mlev * sizeof(*mlevValA)); + for (size_t i = 0; i < (size_t) mlev; ++i) mlevValA[i] = (vctptr[i] + vctptr[i + 1]) * 0.5; + cdfPostDefActionAddPutVal(&delayed, fileID, hyamid, mlevValA, cdfDelayedPutVarDeepCleanup); + } + { + double *restrict mlevValB = (double *) Malloc((size_t) mlev * sizeof(*mlevValB)); + for (size_t i = 0; i < (size_t) mlev; ++i) mlevValB[i] = (vctptr[(size_t) ilev + i] + vctptr[(size_t) ilev + i + 1]) * 0.5; + cdfPostDefActionAddPutVal(&delayed, fileID, hybmid, mlevValB, cdfDelayedPutVarDeepCleanup); + } + + if (ncbndsID != -1) + { + int hyaiid, hybiid; + cdf_def_var(fileID, (p0status == 0) ? "a_bnds" : "ap_bnds", NC_DOUBLE, 2, dimIDs, &hyaiid); + cdf_def_var(fileID, "b_bnds", NC_DOUBLE, 2, dimIDs, &hybiid); + static const char anametab[][10] = { "long_name", "units" }; + static const char lname_v_a[] = "vertical coordinate formula term: ap(k+1/2)", + lname_v_b[] = "vertical coordinate formula term: b(k+1/2)", units_v_a[] = "Pa", units_v_b[] = "1"; + static struct attTxtTab attvtab[][2] = { { { lname_v_a, sizeof(lname_v_a) - 1 }, { units_v_a, sizeof(units_v_a) - 1 } }, + { { lname_v_b, sizeof(lname_v_b) - 1 }, { units_v_b, sizeof(units_v_b) - 1 } } }; + int termid[] = { hyaiid, hybiid }; + enum + { + numTerms = sizeof(termid) / sizeof(termid[0]), + numAtts = sizeof(anametab) / sizeof(anametab[0]), + }; + for (size_t termIdx = 0; termIdx < numTerms; ++termIdx) + for (size_t attIdx = 0; attIdx < numAtts; ++attIdx) + cdf_put_att_text(fileID, termid[termIdx], anametab[attIdx], attvtab[termIdx][attIdx].txtLen, + attvtab[termIdx][attIdx].txt); + + { + double *restrict ilevValA = (double *) Malloc((size_t) mlev * 2 * sizeof(*ilevValA)); + for (size_t i = 0; i < (size_t) mlev; ++i) + { + ilevValA[2 * i] = vctptr[i]; + ilevValA[2 * i + 1] = vctptr[i + 1]; + } + cdfPostDefActionAddPutVal(&delayed, fileID, hyaiid, ilevValA, cdfDelayedPutVarDeepCleanup); + } + { + double *restrict ilevValB = (double *) Malloc((size_t) mlev * 2 * sizeof(*ilevValB)); + for (size_t i = 0; i < (size_t) mlev; ++i) + { + ilevValB[2 * i] = vctptr[(size_t) ilev + i]; + ilevValB[2 * i + 1] = vctptr[(size_t) ilev + i + 1]; + } + cdfPostDefActionAddPutVal(&delayed, fileID, hybiid, ilevValB, cdfDelayedPutVarDeepCleanup); + } + } + if (p0status == 0 && IS_NOT_EQUAL(p0value, 0)) Free(vctptr); + + if (switchNCMode) + { + cdf_enddef(fileID, streamptr->self); + streamptr->ncmode = 2; + } + } + return delayed; +} + +static struct cdfPostDefActionList * +cdf_def_zaxis_hybrid_echam(stream_t *streamptr, int type, int *ncvaridp, int zaxisID, int zaxisindex, int xtype, size_t dimlen, + int *dimID, char *axisname) +{ + int fileID = streamptr->fileID; + struct cdfPostDefActionList *delayed = NULL; + bool switchNCMode = streamptr->ncmode == 2; + if (switchNCMode) + { + streamptr->ncmode = 1; + cdf_redef(fileID); + } + + cdf_def_dim(fileID, axisname, dimlen, dimID); + cdf_def_var(fileID, axisname, (nc_type) xtype, 1, dimID, ncvaridp); + int ncvarid = *ncvaridp; + + { + static const char sname[] = "hybrid_sigma_pressure"; + cdf_put_att_text(fileID, ncvarid, "standard_name", sizeof(sname) - 1, sname); + } + { + static const char *attName[] = { "long_name", "formula", "formula_terms" }; + enum + { + nAtt = sizeof(attName) / sizeof(attName[0]) + }; + static const char lname_m[] = "hybrid level at layer midpoints", formula_m[] = "hyam hybm (mlev=hyam+hybm*aps)", + fterms_m[] = "ap: hyam b: hybm ps: aps", lname_i[] = "hybrid level at layer interfaces", + formula_i[] = "hyai hybi (ilev=hyai+hybi*aps)", fterms_i[] = "ap: hyai b: hybi ps: aps"; + static const struct attTxtTab tab[2][nAtt] + = { { { lname_i, sizeof(lname_i) - 1 }, { formula_i, sizeof(formula_i) - 1 }, { fterms_i, sizeof(fterms_i) - 1 } }, + { { lname_m, sizeof(lname_m) - 1 }, { formula_m, sizeof(formula_m) - 1 }, { fterms_m, sizeof(fterms_m) - 1 } } }; + + size_t tabSelect = type == ZAXIS_HYBRID; + for (size_t i = 0; i < nAtt; ++i) + cdf_put_att_text(fileID, ncvarid, attName[i], tab[tabSelect][i].txtLen, tab[tabSelect][i].txt); + } + + { + static const char units[] = "level"; + cdf_put_att_text(fileID, ncvarid, "units", sizeof(units) - 1, units); + } + { + static const char direction[] = "down"; + cdf_put_att_text(fileID, ncvarid, "positive", sizeof(direction) - 1, direction); + } + + if (zaxisInqLevels(zaxisID, NULL)) + cdfPostDefActionAddPutVal(&delayed, fileID, ncvarid, zaxisInqLevelsPtr(zaxisID), (void (*)(void *))(void (*)(void)) memFree); + + { + struct cdfPostDefActionList *delayedVct = cdf_def_vct_echam(streamptr, zaxisID); + delayed = cdfPostDefActionConcat(delayed, delayedVct); + Free(delayedVct); + } + + if (*dimID == CDI_UNDEFID) streamptr->zaxisID[zaxisindex] = type == ZAXIS_HYBRID ? streamptr->vct.mlevID : streamptr->vct.ilevID; + + if (switchNCMode) + { + cdf_enddef(fileID, streamptr->self); + streamptr->ncmode = 2; + } + + return delayed; +} + +static struct cdfPostDefActionList * +cdf_def_zaxis_hybrid_cf(stream_t *streamptr, int type, int *ncvaridp, int zaxisID, int zaxisindex, int xtype, size_t dimlen, + int *dimID, char *axisname) +{ + char psname[CDI_MAX_NAME]; + int length = CDI_MAX_NAME; + cdiInqKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_PSNAME, psname, &length); + if (psname[0] == 0) strcpy(psname, "ps"); + + int fileID = streamptr->fileID; + bool switchNCMode = streamptr->ncmode == 2; + if (switchNCMode) + { + streamptr->ncmode = 1; + cdf_redef(fileID); + } + + char p0name[CDI_MAX_NAME]; + p0name[0] = 0; + double p0value = 1; + int p0varid = CDI_UNDEFID; + int p0status = cdiInqKeyFloat(zaxisID, CDI_GLOBAL, CDI_KEY_P0VALUE, &p0value); + if (p0status == CDI_NOERR) + { + length = CDI_MAX_NAME; + cdiInqKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_P0NAME, p0name, &length); + if (p0name[0] == 0) strcpy(p0name, "p0"); + cdf_def_var(fileID, p0name, NC_DOUBLE, 0, 0, &p0varid); + static const char longname[] = "reference pressure"; + cdf_put_att_text(fileID, p0varid, "long_name", sizeof(longname) - 1, longname); + static const char units[] = "Pa"; + cdf_put_att_text(fileID, p0varid, "units", sizeof(units) - 1, units); + } + + char zname[CDI_MAX_NAME]; + char zlongname[CDI_MAX_NAME]; + char zunits[CDI_MAX_NAME]; + length = CDI_MAX_NAME; + cdiInqKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_NAME, zname, &length); + if (zname[0]) strcpy(axisname, zname); + zlongname[0] = 0; + size_t zlongnameLen; + if (zlongname[0] == 0) + { + static const char default_zlongname[] = "hybrid sigma pressure coordinate"; + memcpy(zlongname, default_zlongname, sizeof(default_zlongname)); + zlongnameLen = sizeof(default_zlongname) - 1; + } + else + zlongnameLen = strlen(zlongname); + length = CDI_MAX_NAME; + cdiInqKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_UNITS, zunits, &length); + size_t zunitsLen; + if (zunits[0] == 0) + { + zunits[0] = '1'; + zunits[1] = '\0'; + zunitsLen = 1; + } + else + zunitsLen = strlen(zunits); + + cdf_def_dim(fileID, axisname, dimlen, dimID); + cdf_def_var(fileID, axisname, (nc_type) xtype, 1, dimID, ncvaridp); + int ncvarid = *ncvaridp; + + { + static const char sname[] = "standard_name", lname[] = "long_name", sname_v[] = "atmosphere_hybrid_sigma_pressure_coordinate", + axis[] = "axis", axis_v[] = "Z", direction[] = "positive", direction_v[] = "down", units[] = "units"; + struct attTxtTab2 tab[] = { + { sname, sname_v, sizeof(sname_v) - 1 }, + { axis, axis_v, sizeof(axis_v) - 1 }, + { direction, direction_v, sizeof(direction_v) - 1 }, + { units, zunits, zunitsLen }, + { lname, zlongname, zlongnameLen }, + }; + enum + { + nAtt = sizeof(tab) / sizeof(tab[0]) + }; + for (size_t i = 0; i < nAtt; ++i) cdf_put_att_text(fileID, ncvarid, tab[i].attName, tab[i].valLen, tab[i].attVal); + } + + size_t len = 0; + char txt[CDI_MAX_NAME * 2 + 30]; + if (p0status == 0) + len = (size_t) (snprintf(txt, sizeof(txt), "%s%s %s%s", "a: a b: b p0: ", p0name, "ps: ", psname)); + else + len = (size_t) (snprintf(txt, sizeof(txt), "%s%s", "ap: ap b: b ps: ", psname)); + cdf_put_att_text(fileID, ncvarid, "formula_terms", len, txt); + + int ncbvarid = CDI_UNDEFID; + int nvdimID = CDI_UNDEFID; + + double *buffer = (double *) malloc(2 * dimlen * sizeof(double)); + double *lbounds = buffer; + double *ubounds = buffer + dimlen; + double *restrict levels; + + bool hasLevels = zaxisInqLevels(zaxisID, NULL) != 0; + if (hasLevels) + levels = (double *) zaxisInqLevelsPtr(zaxisID); + else + { + levels = (double *) Malloc(sizeof(*levels) * dimlen); + for (size_t i = 0; i < dimlen; ++i) levels[i] = (double) (i + 1); + } + + if (zaxisInqLbounds(zaxisID, NULL) && zaxisInqUbounds(zaxisID, NULL)) + { + zaxisInqLbounds(zaxisID, lbounds); + zaxisInqUbounds(zaxisID, ubounds); + } + else + { + for (size_t i = 0; i < dimlen; ++i) lbounds[i] = levels[i]; + for (size_t i = 0; i < dimlen - 1; ++i) ubounds[i] = levels[i + 1]; + ubounds[dimlen - 1] = levels[dimlen - 1] + 1; + } + + // if ( zaxisInqLbounds(zaxisID, NULL) && zaxisInqUbounds(zaxisID, NULL) ) + { + size_t nvertex = 2; + if (dimlen > 1 && nc_inq_dimid(fileID, bndsName, &nvdimID) != NC_NOERR) cdf_def_dim(fileID, bndsName, nvertex, &nvdimID); + + if (nvdimID != CDI_UNDEFID) + { + size_t axisnameLen = strlen(axisname); + axisname[axisnameLen] = '_'; + memcpy(axisname + axisnameLen + 1, bndsName, sizeof(bndsName)); + axisnameLen += sizeof(bndsName); + int dimIDs[2] = { *dimID, nvdimID }; + cdf_def_var(fileID, axisname, (nc_type) xtype, 2, dimIDs, &ncbvarid); + cdf_put_att_text(fileID, ncvarid, "bounds", axisnameLen, axisname); + size_t formulatermsLen; + if (p0status == 0) + formulatermsLen = (size_t) (sprintf(txt, "%s%s %s%s", "a: a_bnds b: b_bnds p0: ", p0name, "ps: ", psname)); + else + formulatermsLen = (size_t) (sprintf(txt, "%s%s", "ap: ap_bnds b: b_bnds ps: ", psname)); + { + static const char sname[] = "standard_name", sname_v[] = "atmosphere_hybrid_sigma_pressure_coordinate", + formulaterms[] = "formula_terms", units[] = "units"; + struct attTxtTab2 tab[] = { + { sname, sname_v, sizeof(sname_v) - 1 }, + { units, zunits, zunitsLen }, + { formulaterms, txt, formulatermsLen }, + }; + enum + { + nAtt = sizeof(tab) / sizeof(tab[0]) + }; + for (size_t i = 0; i < nAtt; ++i) cdf_put_att_text(fileID, ncbvarid, tab[i].attName, tab[i].valLen, tab[i].attVal); + } + } + } + + if (switchNCMode) + { + cdf_enddef(fileID, streamptr->self); + streamptr->ncmode = 2; + } + + if (p0varid != CDI_UNDEFID) cdf_put_var_double(fileID, p0varid, &p0value); + + struct cdfPostDefActionList *delayed = NULL; + cdfPostDefActionAddPutVal(&delayed, fileID, ncvarid, levels, + hasLevels ? (void (*)(void *))(void (*)(void)) memFree : cdfDelayedPutVarDeepCleanup); + + if (ncbvarid != CDI_UNDEFID) + { + double *restrict zbounds = (double *) Malloc(2 * dimlen * sizeof(*zbounds)); + for (size_t i = 0; i < dimlen; ++i) + { + zbounds[2 * i] = lbounds[i]; + zbounds[2 * i + 1] = ubounds[i]; + } + cdfPostDefActionAddPutVal(&delayed, fileID, ncbvarid, zbounds, cdfDelayedPutVarDeepCleanup); + } + + { + struct cdfPostDefActionList *delayedVct = cdf_def_vct_cf(streamptr, zaxisID, *dimID, nvdimID, p0status, p0value); + delayed = cdfPostDefActionConcat(delayed, delayedVct); + Free(delayedVct); + } + + if (*dimID == CDI_UNDEFID) streamptr->zaxisID[zaxisindex] = type == ZAXIS_HYBRID ? streamptr->vct.mlevID : streamptr->vct.ilevID; + + free(buffer); + return delayed; +} + +static struct cdfPostDefActionList * +cdf_def_zaxis_hybrid(stream_t *streamptr, int type, int *ncvarid, int zaxisID, int zaxisindex, int xtype, size_t dimlen, int *dimID, + char *axisname) +{ + struct cdfPostDefActionList *(*def_zaxis_hybrid_delegate)(stream_t * streamptr, int type, int *ncvarid, int zaxisID, + int zaxisindex, int xtype, size_t dimlen, int *dimID, char *axisname) + = ((!CDI_CMOR_Mode && CDI_Convention == CDI_CONVENTION_ECHAM) || type == ZAXIS_HYBRID_HALF) ? cdf_def_zaxis_hybrid_echam + : cdf_def_zaxis_hybrid_cf; + return def_zaxis_hybrid_delegate(streamptr, type, ncvarid, zaxisID, zaxisindex, xtype, dimlen, dimID, axisname); +} + +static void +cdfDefZaxisUUID(stream_t *streamptr, int zaxisID) +{ + unsigned char uuid[CDI_UUID_SIZE] = { 0 }; + int length = CDI_UUID_SIZE; + cdiInqKeyBytes(zaxisID, CDI_GLOBAL, CDI_KEY_UUID, uuid, &length); + if (!cdiUUIDIsNull(uuid)) + { + char uuidStr[uuidNumHexChars + 1] = { 0 }; + if (cdiUUID2Str(uuid, uuidStr) == uuidNumHexChars) + { + int fileID = streamptr->fileID; + bool switchNCMode = streamptr->ncmode == 2; + if (switchNCMode) + { + streamptr->ncmode = 1; + cdf_redef(fileID); + } + + cdf_put_att_text(fileID, NC_GLOBAL, "uuidOfVGrid", uuidNumHexChars, uuidStr); + if (switchNCMode) + { + cdf_enddef(fileID, streamptr->self); + streamptr->ncmode = 2; + } + } + } +} + +#ifndef USE_MPI +static void +cdfDefZaxisChar(stream_t *streamptr, int zaxisID, char *axisname, int *dimID, size_t dimlen, int zaxisindex) +{ + int fileID = streamptr->fileID; + int ncvarID = CDI_UNDEFID; + if (streamptr->ncmode == 2) cdf_redef(fileID); + + // Check StrlenID + char strlen[8] = "strlen\0"; + size_t clen = (size_t) zaxisInqCLen(zaxisID); + if (clen == 0) + Error("Maximal string length value is 0.\nA given character axis requires a dimension to save the maximal string length."); + int strlenID = CDI_UNDEFID; + strlenID = checkDimName(fileID, clen, strlen); + + if (strlenID == CDI_UNDEFID) cdf_def_dim(fileID, strlen, clen, &strlenID); + + // Check 'areatype'dimID + char dimname[CDI_MAX_NAME + 3]; + int length = sizeof(dimname); + cdiInqKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_DIMNAME, dimname, &length); + *dimID = checkDimName(fileID, dimlen, dimname); + if (dimlen <= 0) Error("No strings delivered for a character axis."); + if (dimname[0] == 0) + { + memcpy(dimname, "area_type", 10); + dimname[10] = 0; + } + + if (*dimID == CDI_UNDEFID) cdf_def_dim(fileID, dimname, dimlen, dimID); + + int dimIDs[2]; + dimIDs[0] = *dimID; + dimIDs[1] = strlenID; + + // Get Stringvalues + char **cvals = zaxisInqCValsPtr(zaxisID); + + if (cvals) + { + // Define variable and its attributes + cdf_def_var(fileID, axisname, NC_CHAR, 2, dimIDs, &ncvarID); + + cdfPutGridStdAtts(fileID, ncvarID, zaxisID, 'Z'); + cdf_put_att_text(fileID, ncvarID, "axis", 1, "Z"); + cdfDefineAttributes(zaxisID, CDI_GLOBAL, fileID, ncvarID); + + streamptr->nczvarID[zaxisindex] = ncvarID; + cdf_enddef(fileID, streamptr->self); + + // Write Stringvalues + size_t start[2], count[2]; + start[1] = 0; + count[0] = 1; + count[1] = clen; + for (size_t i = 0; i < dimlen; i++) + { + start[0] = i; + nc_put_vara_text(fileID, ncvarID, start, count, cvals[i]); + } + } + + streamptr->ncmode = 2; +} +#endif + +static int +zaxis_inq_xtype(int zaxisID) +{ + int datatype = CDI_UNDEFID; + cdiInqKeyInt(zaxisID, CDI_GLOBAL, CDI_KEY_DATATYPE, &datatype); + int xtype = NC_DOUBLE; + // clang-format off + if (datatype == CDI_DATATYPE_FLT32) xtype = NC_FLOAT; + else if (datatype == CDI_DATATYPE_INT32) xtype = NC_INT; + else if (datatype == CDI_DATATYPE_INT16) xtype = NC_SHORT; + // clang-format on + return xtype; +} + +static struct cdfPostDefActionList * +cdfDefZaxis(stream_t *streamptr, int zaxisID) +{ + // char zaxisname0[CDI_MAX_NAME]; + int ncvarid = CDI_UNDEFID, ncbvarid = CDI_UNDEFID; + int xtype = zaxis_inq_xtype(zaxisID); + + size_t dimlen = (size_t) zaxisInqSize(zaxisID); + int type = zaxisInqType(zaxisID); + + int ndims = 1; + struct cdfPostDefActionList *delayed = NULL; + + if (dimlen == 1) + { + bool isScalar = zaxisInqScalar(zaxisID) > 0; + if (!isScalar && CDI_CMOR_Mode) + { + isScalar = true; + zaxisDefScalar(zaxisID); + } + + if (isScalar) ndims = 0; + if (CDI_Reduce_Dim) return delayed; + + switch (type) + { + case ZAXIS_SURFACE: + case ZAXIS_CLOUD_BASE: + case ZAXIS_CLOUD_TOP: + case ZAXIS_ISOTHERM_ZERO: + case ZAXIS_TROPOPAUSE: + case ZAXIS_TOA: + case ZAXIS_SEA_BOTTOM: + case ZAXIS_ATMOSPHERE: + case ZAXIS_MEANSEA: + case ZAXIS_LAKE_BOTTOM: + case ZAXIS_SEDIMENT_BOTTOM: + case ZAXIS_SEDIMENT_BOTTOM_TA: + case ZAXIS_SEDIMENT_BOTTOM_TW: + case ZAXIS_MIX_LAYER: return delayed; + } + } + + int vlistID = streamptr->vlistID; + char axisname[CDI_MAX_NAME]; + int length = CDI_MAX_NAME; + cdiInqKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_NAME, axisname, &length); + int zaxisindex = vlistZaxisIndex(vlistID, zaxisID); + int nzaxis = vlistNzaxis(vlistID); + int fileID = streamptr->fileID; + + checkZaxisName(axisname, fileID, vlistID, zaxisID, nzaxis); + + char dimname[CDI_MAX_NAME + 3]; + dimname[0] = 0; + if (dimname[0] == 0) strcpy(dimname, axisname); + + if (type == ZAXIS_REFERENCE) cdfDefZaxisUUID(streamptr, zaxisID); + + int dimID; + if (type == ZAXIS_HYBRID || type == ZAXIS_HYBRID_HALF) + { + delayed = cdf_def_zaxis_hybrid(streamptr, type, &ncvarid, zaxisID, zaxisindex, xtype, dimlen, &dimID, axisname); + + int natts; + cdiInqNatts(zaxisID, CDI_GLOBAL, &natts); + cdfDefineAttributes(zaxisID, CDI_GLOBAL, fileID, ncvarid); + } +#ifndef USE_MPI + else if (type == ZAXIS_CHAR) + cdfDefZaxisChar(streamptr, zaxisID, axisname, &dimID, dimlen, zaxisindex); +#endif + else + { + dimID = checkDimName(fileID, dimlen, dimname); + + bool switchNCMode = streamptr->ncmode == 2; + if (switchNCMode) + { + streamptr->ncmode = 1; + cdf_redef(fileID); + } + + if (ndims && dimID == CDI_UNDEFID) cdf_def_dim(fileID, dimname, dimlen, &dimID); + + if (zaxisInqLevels(zaxisID, NULL)) + { + cdf_def_var(fileID, axisname, (nc_type) xtype, ndims, &dimID, &ncvarid); + + cdfPutGridStdAtts(fileID, ncvarid, zaxisID, 'Z'); + + { + int positive = zaxisInqPositive(zaxisID); + static const char positive_up[] = "up", positive_down[] = "down"; + static const struct attTxtTab tab[2] = { + { positive_up, sizeof(positive_up) - 1 }, + { positive_down, sizeof(positive_down) - 1 }, + }; + if (positive == POSITIVE_UP || positive == POSITIVE_DOWN) + { + size_t select = (positive == POSITIVE_DOWN); + cdf_put_att_text(fileID, ncvarid, "positive", tab[select].txtLen, tab[select].txt); + } + } + cdf_put_att_text(fileID, ncvarid, "axis", 1, "Z"); + cdfPostDefActionAddPutVal(&delayed, fileID, ncvarid, zaxisInqLevelsPtr(zaxisID), + (void (*)(void *))(void (*)(void)) memFree); + + if (zaxisInqLbounds(zaxisID, NULL) && zaxisInqUbounds(zaxisID, NULL)) + { + int nvdimID = CDI_UNDEFID; + size_t nvertex = 2; + if (nc_inq_dimid(fileID, bndsName, &nvdimID) != NC_NOERR) cdf_def_dim(fileID, bndsName, nvertex, &nvdimID); + + if (nvdimID != CDI_UNDEFID) + { + { + size_t axisnameLen = strlen(axisname); + axisname[axisnameLen] = '_'; + memcpy(axisname + axisnameLen + 1, bndsName, sizeof(bndsName)); + int dimIDs[2]; + dimIDs[0] = dimID; + dimIDs[ndims] = nvdimID; + cdf_def_var(fileID, axisname, (nc_type) xtype, ndims + 1, dimIDs, &ncbvarid); + cdf_put_att_text(fileID, ncvarid, "bounds", axisnameLen + sizeof(bndsName), axisname); + } + { + double *restrict zbounds = (double *) Malloc(4 * dimlen * sizeof(*zbounds)), + *restrict lbounds = zbounds + 2 * dimlen, *restrict ubounds = zbounds + 3 * dimlen; + zaxisInqLbounds(zaxisID, lbounds); + zaxisInqUbounds(zaxisID, ubounds); + for (size_t i = 0; i < dimlen; ++i) + { + zbounds[2 * i] = lbounds[i]; + zbounds[2 * i + 1] = ubounds[i]; + } + zbounds = (double *) Realloc(zbounds, 2 * dimlen * sizeof(*zbounds)); + cdfPostDefActionAddPutVal(&delayed, fileID, ncbvarid, zbounds, cdfDelayedPutVarDeepCleanup); + } + } + } + cdfDefineAttributes(zaxisID, CDI_GLOBAL, fileID, ncvarid); + } + + if (switchNCMode) + { + cdf_enddef(fileID, streamptr->self); + streamptr->ncmode = 2; + } + + if (zaxisInqLevels(zaxisID, NULL) && ndims == 0) streamptr->nczvarID[zaxisindex] = ncvarid; + } + + if (dimID != CDI_UNDEFID) streamptr->zaxisID[zaxisindex] = dimID; + return delayed; +} + +static struct cdfPostDefActionList * +cdf_def_mapping(stream_t *streamptr, int gridID) +{ + struct cdfPostDefActionList *delayed = NULL; + + int natts; + cdiInqNatts(gridID, CDI_GLOBAL, &natts); + if (natts == 0) return delayed; + + int datatype = -1; + int status = cdiInqKeyInt(gridID, CDI_GLOBAL, CDI_KEY_GRIDMAP_VARTYPE, &datatype); + nc_type gmapvartype = (status == CDI_NOERR) ? (nc_type) datatype : NC_INT; + char gmapvarname[CDI_MAX_NAME]; + int length = CDI_MAX_NAME; + cdiInqKeyString(gridID, CDI_GLOBAL, CDI_KEY_GRIDMAP_VARNAME, gmapvarname, &length); + if (!gmapvarname[0]) strcpy(gmapvarname, "crs"); + + int fileID = streamptr->fileID; + bool switchNCMode = streamptr->ncmode == 2; + if (switchNCMode) + { + streamptr->ncmode = 1; + cdf_redef(fileID); + } + + int ncvarid; + int ncerrcode = nc_def_var(fileID, gmapvarname, gmapvartype, 0, NULL, &ncvarid); + if (ncerrcode == NC_NOERR) cdfDefineAttributes(gridID, CDI_GLOBAL, fileID, ncvarid); + + if (switchNCMode) + { + cdf_enddef(fileID, streamptr->self); + streamptr->ncmode = 2; + } + + if (ncerrcode == NC_NOERR && !xtypeIsText(gmapvartype)) + { + cdfPostDefActionAddPut1Int(&delayed, fileID, ncvarid, 1, (void (*)(void *))(void (*)(void)) memFree); + } + return delayed; +} + +static void +cdfDefCharacter(stream_t *streamptr, int gridID, int gridIndex, int cdiAxisID, int strlen) +{ + if (streamptr->ncgrid[gridIndex].ncIDs[CDF_DIMID_X] != CDI_UNDEFID) return; + + bool isXaxis = (cdiAxisID == CDI_XAXIS); + + size_t dimlen = isXaxis ? gridInqXsize(gridID) : gridInqYsize(gridID); + ncgrid_t *ncgrid = streamptr->ncgrid; + + // Check for all grids up to gridIndex whether it already is defined + + for (int index = 0; index < gridIndex; index++) + { + int gridID0 = ncgrid[index].gridID; + int gridtype0 = gridInqType(gridID0); + if (gridtype0 == GRID_CHARXY) + { + if (gridInqXIsc(gridID0) == strlen && (size_t) gridInqXsize(gridID0) == dimlen) + return; + else if (gridInqYIsc(gridID0) == strlen && (size_t) gridInqYsize(gridID0) == dimlen) + return; + } + } + + int fileID = streamptr->fileID; + + if (streamptr->ncmode == 2) cdf_redef(fileID); + + // Define Dims + + char dimname[CDI_MAX_NAME + 3]; + int length = sizeof(dimname); + cdiInqKeyString(gridID, cdiAxisID, CDI_KEY_DIMNAME, dimname, &length); + if (dimname[0] == 0) + { + memcpy(dimname, "region", 7); + dimname[6] = 0; + } + int dimID = checkDimName(fileID, dimlen, dimname); + if (dimID == CDI_UNDEFID) cdf_def_dim(fileID, dimname, dimlen, &dimID); + + // Define strlength dim + + strcpy(dimname, "strlen"); + int strlenID = checkDimName(fileID, strlen, dimname); + if (strlenID == CDI_UNDEFID) cdf_def_dim(fileID, dimname, strlen, &strlenID); + + // Define Variable + + int dimIDs[2]; + dimIDs[0] = dimID; + dimIDs[1] = strlenID; + + char axisname[CDI_MAX_NAME]; + char **cvals = (char **) Malloc(dimlen * sizeof(char *)); + for (size_t i = 0; i < dimlen; i++) cvals[i] = (char *) Malloc(strlen * sizeof(char)); + int ncaxisid; + length = CDI_MAX_NAME; + cdiInqKeyString(gridID, cdiAxisID, CDI_KEY_NAME, axisname, &length); + gridInqXCvals(gridID, cvals); + + int status = nc_inq_varid(fileID, axisname, &ncaxisid); + if (status == NC_NOERR) return; + + cdf_def_var(fileID, axisname, NC_CHAR, 2, dimIDs, &ncaxisid); + cdfPutGridStdAtts(fileID, ncaxisid, gridID, isXaxis ? 'X' : 'Y'); + + cdf_enddef(fileID, streamptr->self); + + // Write Var + + size_t start[2], count[2]; + start[1] = 0; + count[0] = 1; + count[1] = strlen; + for (size_t i = 0; i < dimlen; i++) + { + start[0] = i; + status = nc_put_vara_text(fileID, ncaxisid, start, count, cvals[i]); + } + + ncgrid[gridIndex].gridID = gridID; + ncgrid[gridIndex].ncIDs[isXaxis ? CDF_DIMID_X : CDF_DIMID_Y] = dimID; + ncgrid[gridIndex].ncIDs[isXaxis ? CDF_VARID_X : CDF_VARID_Y] = ncaxisid; + + streamptr->ncmode = 2; +} + +static void +cdfDefRgrid(stream_t *streamptr, int gridID, int gridIndex) +{ + ncgrid_t *ncgrid = streamptr->ncgrid; + + ncgrid[gridIndex].gridID = gridID; + + { + size_t dimlen = gridInqSize(gridID); + + struct idSearch search = cdfSearchIDBySize(0, (size_t) gridIndex, ncgrid, CDF_DIMID_X, GRID_GAUSSIAN_REDUCED, (int) dimlen, + gridInqType, gridInqSize); + int iz = search.numNonMatching; + int dimID = search.foundID; + + if (dimID == CDI_UNDEFID) + { + int fileID = streamptr->fileID; + + char axisname[16] = "rgridX"; + if (iz == 0) + axisname[5] = '\0'; + else + sprintf(&axisname[5], "%1d", iz + 1); + + bool switchNCMode = streamptr->ncmode == 2; + if (switchNCMode) + { + streamptr->ncmode = 1; + cdf_redef(fileID); + } + + cdf_def_dim(fileID, axisname, dimlen, &dimID); + + if (switchNCMode) + { + cdf_enddef(fileID, streamptr->self); + streamptr->ncmode = 2; + } + } + + ncgrid[gridIndex].ncIDs[CDF_DIMID_X] = dimID; + } + + { + size_t dimlen = gridInqYsize(gridID); + + struct idSearch search = cdfSearchIDBySize(0, (size_t) gridIndex, ncgrid, CDF_DIMID_RP, GRID_GAUSSIAN_REDUCED, (int) dimlen, + gridInqType, gridInqSize); + int iz = search.numNonMatching; + int dimID = search.foundID; + + if (dimID == CDI_UNDEFID) + { + int fileID = streamptr->fileID; + + char axisname[32] = "reduced_pointsX"; + if (iz == 0) + axisname[14] = '\0'; + else + sprintf(&axisname[14], "%1d", iz + 1); + + bool switchNCMode = streamptr->ncmode == 2; + if (switchNCMode) + { + streamptr->ncmode = 1; + cdf_redef(fileID); + } + + cdf_def_dim(fileID, axisname, dimlen, &dimID); + + int ncvarid = CDI_UNDEFID; + + int ndims = 1; + nc_type xtype = NC_INT; + cdf_def_var(fileID, axisname, xtype, ndims, &dimID, &ncvarid); + + if (switchNCMode) + { + cdf_enddef(fileID, streamptr->self); + streamptr->ncmode = 2; + } + + int *reducedPoints = (int *) Malloc(dimlen * sizeof(int)); + gridInqReducedPoints(gridID, reducedPoints); + cdf_put_var_int(fileID, ncvarid, reducedPoints); + Free(reducedPoints); + + ncgrid[gridIndex].ncIDs[CDF_VARID_RP] = ncvarid; + } + + ncgrid[gridIndex].ncIDs[CDF_DIMID_RP] = dimID; + } +} + +static void +cdf_define_generic_dim(stream_t *streamptr, int gridID, int gridIndex) +{ + ncgrid_t *ncgrid = streamptr->ncgrid; + int dimID = CDI_UNDEFID; + + size_t dimlen = gridInqSize(gridID); + + if (gridInqYsize(gridID) == 0) + { + struct idSearch search + = cdfSearchIDBySize(0, (size_t) gridIndex, ncgrid, CDF_DIMID_X, GRID_GENERIC, (int) dimlen, gridInqType, gridInqSize); + dimID = search.foundID; + } + + if (gridInqXsize(gridID) == 0) + { + struct idSearch search + = cdfSearchIDBySize(0, (size_t) gridIndex, ncgrid, CDF_DIMID_Y, GRID_GENERIC, (int) dimlen, gridInqType, gridInqSize); + dimID = search.foundID; + } + + if (dimID == CDI_UNDEFID) + { + int fileID = streamptr->fileID; + char dimname[CDI_MAX_NAME]; + int length = sizeof(dimname); + cdiInqKeyString(gridID, CDI_GLOBAL, CDI_KEY_DIMNAME, dimname, &length); + if (dimname[0] == 0) strcpy(dimname, "gsize"); + + dimID = checkDimName(fileID, dimlen, dimname); + + if (dimID == CDI_UNDEFID) + { + bool switchNCMode = streamptr->ncmode == 2; + if (switchNCMode) + { + streamptr->ncmode = 1; + cdf_redef(fileID); + } + + cdf_def_dim(fileID, dimname, dimlen, &dimID); + + if (switchNCMode) + { + cdf_enddef(fileID, streamptr->self); + streamptr->ncmode = 2; + } + } + } + + ncgrid[gridIndex].gridID = gridID; + ncgrid[gridIndex].ncIDs[CDF_DIMID_X] = dimID; +} + +static struct cdfPostDefActionList * +cdf_define_grid(stream_t *streamptr, int gridID, int gridIndex) +{ + struct cdfPostDefActionList *delayed = NULL; + + if (streamptr->ncgrid[gridIndex].ncIDs[CDF_DIMID_X] != CDI_UNDEFID) return delayed; + + int gridtype = gridInqType(gridID); + size_t size = gridInqSize(gridID); + + if (CDI_Debug) Message("gridtype = %d size = %zu", gridtype, size); + + if (CDI_Reduce_Dim && size == 1) // no grid information + { + streamptr->ncgrid[gridIndex].gridID = gridID; + return delayed; + } + + if (gridtype == GRID_GAUSSIAN || gridtype == GRID_LONLAT || gridtype == GRID_PROJECTION) + { + int ndims = !(gridtype == GRID_LONLAT && size == 1 && !gridInqHasDims(gridID)); + size_t xsize = gridInqXsize(gridID); + size_t ysize = gridInqYsize(gridID); + + if (xsize) + { + struct cdfPostDefActionList *xdelayed = cdfDefXaxis(streamptr, gridID, gridIndex, ndims, false); + delayed = cdfPostDefActionConcat(delayed, xdelayed); + Free(xdelayed); + } + if (ysize) + { + struct cdfPostDefActionList *ydelayed = cdfDefYaxis(streamptr, gridID, gridIndex, ndims, false); + delayed = cdfPostDefActionConcat(delayed, ydelayed); + Free(ydelayed); + } + + if (ndims == 1 && xsize == 0 && ysize == 0 && gridtype == GRID_PROJECTION) + cdf_define_generic_dim(streamptr, gridID, gridIndex); + + struct cdfPostDefActionList *mdelayed = cdf_def_mapping(streamptr, gridID); + delayed = cdfPostDefActionConcat(delayed, mdelayed); + Free(mdelayed); + } + else if (gridtype == GRID_GENERIC) + { + if (size == 1 && gridInqXsize(gridID) == 0 && gridInqYsize(gridID) == 0) + { + // no grid information + streamptr->ncgrid[gridIndex].gridID = gridID; + } + else + { + size_t xsize = gridInqXsize(gridID); + size_t ysize = gridInqYsize(gridID); + + if (xsize > 0) + { + struct cdfPostDefActionList *xdelayed = cdfDefXaxis(streamptr, gridID, gridIndex, 1, false); + delayed = cdfPostDefActionConcat(delayed, xdelayed); + Free(xdelayed); + } + if (ysize > 0) + { + struct cdfPostDefActionList *ydelayed = cdfDefYaxis(streamptr, gridID, gridIndex, 1, false); + delayed = cdfPostDefActionConcat(delayed, ydelayed); + Free(ydelayed); + } + + if (xsize == 0 && ysize == 0) cdf_define_generic_dim(streamptr, gridID, gridIndex); + } + } + else if (gridtype == GRID_CURVILINEAR) + { + delayed = cdfDefCurvilinear(streamptr, gridID, gridIndex); + } + else if (gridtype == GRID_UNSTRUCTURED) + { + delayed = cdfDefUnstructured(streamptr, gridID, gridIndex); + } + else if (gridtype == GRID_GAUSSIAN_REDUCED) + { + cdfDefRgrid(streamptr, gridID, gridIndex); + if (gridInqYsize(gridID)) cdfDefYaxis(streamptr, gridID, gridIndex, 1, true); + } + else if (gridtype == GRID_SPECTRAL) + { + cdfDefComplex(streamptr, gridID, gridIndex); + cdfDefSP(streamptr, gridID, gridIndex); + } + else if (gridtype == GRID_FOURIER) + { + cdfDefComplex(streamptr, gridID, gridIndex); + cdfDefFC(streamptr, gridID, gridIndex); + } + else if (gridtype == GRID_TRAJECTORY) + { + cdfDefTrajLon(streamptr, gridID, gridIndex); + cdfDefTrajLat(streamptr, gridID, gridIndex); + } + else if (gridtype == GRID_CHARXY) + { + int strlen = 0; + if ((strlen = gridInqXIsc(gridID))) + cdfDefCharacter(streamptr, gridID, gridIndex, CDI_XAXIS, strlen); + else if (gridInqXsize(gridID)) + cdfDefXaxis(streamptr, gridID, gridIndex, 1, false); + + if ((strlen = gridInqYIsc(gridID))) + cdfDefCharacter(streamptr, gridID, gridIndex, CDI_YAXIS, strlen); + else if (gridInqYsize(gridID)) + cdfDefYaxis(streamptr, gridID, gridIndex, 1, false); + } + else + { + Error("Unsupported grid type: %s", gridNamePtr(gridtype)); + } + return delayed; +} + +void +cdfDefCoordinateVars(stream_t *streamptr) +{ + int vlistID = streamptr->vlistID; + if (vlistID == CDI_UNDEFID) Error("Internal problem! vlist undefined for streamptr %p", streamptr); + + if (vlistHasTime(vlistID)) cdfDefTime(streamptr); + + int ngrids = vlistNgrids(vlistID); + if (2 * ngrids > MAX_GRIDS_PS) Error("Internal problem! Too many grids per stream (max=%d)\n", MAX_GRIDS_PS); + + struct cdfPostDefActionList *delayed = NULL; + + ncgrid_t *restrict ncgrid = streamptr->ncgrid; + for (int index = 0; index < 2 * ngrids; ++index) + { + ncgrid[index].gridID = CDI_UNDEFID; + for (size_t i = 0; i < CDF_SIZE_ncIDs; ++i) ncgrid[index].ncIDs[i] = CDI_UNDEFID; + } + + for (int index = 0; index < ngrids; ++index) + { + int gridID = vlistGrid(vlistID, index); + struct cdfPostDefActionList *griddelayed = cdf_define_grid(streamptr, gridID, index); + delayed = cdfPostDefActionConcat(delayed, griddelayed); + Free(griddelayed); + } + { + int index = ngrids - 1; + for (int i = 0; i < ngrids; ++i) + { + int gridID = vlistGrid(vlistID, i); + int projID = gridInqProj(gridID); + if (projID != CDI_UNDEFID) + { + struct cdfPostDefActionList *griddelayed = cdf_define_grid(streamptr, projID, ++index); + delayed = cdfPostDefActionConcat(delayed, griddelayed); + Free(griddelayed); + } + } + } + + int nzaxis = vlistNzaxis(vlistID); + for (int index = 0; index < nzaxis; ++index) + { + int zaxisID = vlistZaxis(vlistID, index); + if (streamptr->zaxisID[index] == CDI_UNDEFID) + { + struct cdfPostDefActionList *zaxisdelayed = cdfDefZaxis(streamptr, zaxisID); + delayed = cdfPostDefActionConcat(delayed, zaxisdelayed); + Free(zaxisdelayed); + } + } + + if (streamptr->ncmode != 2) + { + cdf_enddef(streamptr->fileID, streamptr->self); + streamptr->ncmode = 2; + } + + int nvars = vlistNvars(vlistID); + for (int varID = 0; varID < nvars; varID++) cdfDefVar(streamptr, varID); + + cdfEndDef(streamptr); + if (delayed) + { + cdfPostDefActionApply(delayed->len, delayed->actions); + cdfPostDefActionListDelete(delayed); + } +} + +#endif + +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifdef HAVE_CONFIG_H +#endif + +#ifdef HAVE_LIBNETCDF + +#include <stdio.h> +#include <string.h> + + +static int +cdfDefTimeBounds(int fileID, int nctimevarid, int nctimedimid, const char *taxis_name, taxis_t *taxis) +{ + int dims[2]; + + dims[0] = nctimedimid; + + static const char bndsName[] = "bnds"; + if (nc_inq_dimid(fileID, bndsName, &dims[1]) != NC_NOERR) cdf_def_dim(fileID, bndsName, 2, &dims[1]); + + const char *bndsAttName, *bndsAttVal; + size_t bndsAttValLen; + char tmpstr[CDI_MAX_NAME]; + if (taxis->climatology) + { + static const char climatology_bndsName[] = "climatology_bnds", climatology_bndsAttName[] = "climatology"; + bndsAttName = climatology_bndsAttName; + bndsAttValLen = sizeof(climatology_bndsName) - 1; + bndsAttVal = climatology_bndsName; + } + else + { + size_t taxisnameLen = strlen(taxis_name); + memcpy(tmpstr, taxis_name, taxisnameLen); + tmpstr[taxisnameLen] = '_'; + memcpy(tmpstr + taxisnameLen + 1, bndsName, sizeof(bndsName)); + size_t tmpstrLen = taxisnameLen + sizeof(bndsName); + static const char generic_bndsAttName[] = "bounds"; + bndsAttName = generic_bndsAttName; + bndsAttValLen = tmpstrLen; + bndsAttVal = tmpstr; + } + + int time_bndsid = -1; + cdf_def_var(fileID, bndsAttVal, NC_DOUBLE, 2, dims, &time_bndsid); + cdf_put_att_text(fileID, nctimevarid, bndsAttName, bndsAttValLen, bndsAttVal); + + return time_bndsid; +} + +static const char * +cdfGetTimeUnits(taxis_t *taxis) +{ + const char *unitstr; + if (taxis->units && taxis->units[0]) + { + unitstr = taxis->units; + } + else + { + if (taxis->type == TAXIS_ABSOLUTE) + { + static const char *const unitstrfmt[3] = { "year as %Y.%f", "month as %Y%m.%f", "day as %Y%m%d.%f" }; + size_t fmtidx = (taxis->unit == TUNIT_YEAR ? 0 : (taxis->unit == TUNIT_MONTH ? 1 : 2)); + unitstr = unitstrfmt[fmtidx]; + } + else + { + const int year = taxis->rDateTime.date.year; + const int month = taxis->rDateTime.date.month; + const int day = taxis->rDateTime.date.day; + const int hour = taxis->rDateTime.time.hour; + const int minute = taxis->rDateTime.time.minute; + const int second = taxis->rDateTime.time.second; + + int timeunit = (taxis->unit != -1) ? taxis->unit : TUNIT_HOUR; + if (timeunit == TUNIT_QUARTER) + timeunit = TUNIT_MINUTE; + else if (timeunit == TUNIT_30MINUTES) + timeunit = TUNIT_MINUTE; + else if (timeunit == TUNIT_3HOURS || timeunit == TUNIT_6HOURS || timeunit == TUNIT_12HOURS) + timeunit = TUNIT_HOUR; + + char *unitstr_ = ptaxisAllocUnits(taxis, CDF_MAX_TIME_UNIT_STR); + sprintf(unitstr_, "%s since %d-%d-%d %02d:%02d:%02d", tunitNamePtr(timeunit), year, month, day, hour, minute, second); + unitstr = unitstr_; + } + } + return unitstr; +} + +static const char * +cdfGetForecastTimeUnits(int timeunit) +{ + if (timeunit == -1) + timeunit = TUNIT_HOUR; + else if (timeunit == TUNIT_QUARTER) + timeunit = TUNIT_MINUTE; + else if (timeunit == TUNIT_30MINUTES) + timeunit = TUNIT_MINUTE; + else if (timeunit == TUNIT_3HOURS || timeunit == TUNIT_6HOURS || timeunit == TUNIT_12HOURS) + timeunit = TUNIT_HOUR; + + return tunitNamePtr(timeunit); +} + +static void +cdfDefCalendar(int fileID, int ncvarid, int calendar) +{ + static const struct + { + int calCode; + const char *calStr; + } calTab[] = { + { CALENDAR_STANDARD, "standard" }, { CALENDAR_GREGORIAN, "gregorian" }, { CALENDAR_PROLEPTIC, "proleptic_gregorian" }, + { CALENDAR_NONE, "none" }, { CALENDAR_360DAYS, "360_day" }, { CALENDAR_365DAYS, "365_day" }, + { CALENDAR_366DAYS, "366_day" }, + }; + enum + { + calTabSize = sizeof calTab / sizeof calTab[0] + }; + + for (size_t i = 0; i < calTabSize; ++i) + if (calTab[i].calCode == calendar) + { + const char *calstr = calTab[i].calStr; + size_t len = strlen(calstr); + cdf_put_att_text(fileID, ncvarid, "calendar", len, calstr); + break; + } +} + +void +cdfDefTime(stream_t *streamptr) +{ + static const char defaultTimeAxisName[] = "time"; + + if (streamptr->basetime.ncvarid != CDI_UNDEFID) return; + + const int fileID = streamptr->fileID; + + if (streamptr->ncmode == 0) streamptr->ncmode = 1; + if (streamptr->ncmode == 2) cdf_redef(fileID); + + taxis_t *taxis = taxisPtr(vlistInqTaxis(streamptr->vlistID)); + + const char *taxisName = (taxis->name && taxis->name[0]) ? taxis->name : defaultTimeAxisName; + + size_t timeDimLen = NC_UNLIMITED; + if (streamptr->filetype == CDI_FILETYPE_NCZARR) + { + if (streamptr->maxSteps == CDI_UNDEFID) + fprintf(stderr, "Max. number of timesteps undefined for NCZarr!\n"); + else + timeDimLen = streamptr->maxSteps; + } + + int timeDimId; + cdf_def_dim(fileID, taxisName, timeDimLen, &timeDimId); + streamptr->basetime.ncdimid = timeDimId; + + const int datatype = taxis->datatype; + const nc_type xtype = (datatype == CDI_DATATYPE_INT32) ? NC_INT : ((datatype == CDI_DATATYPE_FLT32) ? NC_FLOAT : NC_DOUBLE); + + int timeVarId; + cdf_def_var(fileID, taxisName, xtype, 1, &timeDimId, &timeVarId); + streamptr->basetime.ncvarid = timeVarId; + +#ifdef HAVE_NETCDF4 + if (timeDimLen == NC_UNLIMITED && (streamptr->filetype == CDI_FILETYPE_NC4 || streamptr->filetype == CDI_FILETYPE_NC4C)) + { + static const size_t chunk = 512; + cdf_def_var_chunking(fileID, timeVarId, NC_CHUNKED, &chunk); + } +#endif + + static const char timeStr[] = "time"; + cdf_put_att_text(fileID, timeVarId, "standard_name", sizeof(timeStr) - 1, timeStr); + + if (taxis->longname && taxis->longname[0]) + cdf_put_att_text(fileID, timeVarId, "long_name", strlen(taxis->longname), taxis->longname); + + if (taxis->hasBounds) streamptr->basetime.ncvarboundsid = cdfDefTimeBounds(fileID, timeVarId, timeDimId, taxisName, taxis); + + char unitsStr_[CDF_MAX_TIME_UNIT_STR]; + const char *unitsStr; + size_t unitsStrLen; + if (taxis->units && taxis->units[0]) + { + unitsStr = taxis->units; + unitsStrLen = strlen(taxis->units); + } + else + { + /* define bogus value since at this time, streamDefTimestep has + * not been called yet + * but since taxis->units is not set, it clearly will not + * exceed the size of unitstr_, i.e. when defining the units + * attribute to this value, a later redefinition will not + * cause a recreation of on-disk data + */ + for (size_t i = 0; i < CDF_MAX_TIME_UNIT_STR; ++i) unitsStr_[i] = 'a'; + unitsStr_[CDF_MAX_TIME_UNIT_STR - 1] = '\0'; + unitsStr = unitsStr_; + unitsStrLen = CDF_MAX_TIME_UNIT_STR - 1; + } + cdf_put_att_text(fileID, timeVarId, "units", unitsStrLen, unitsStr); + + if (taxis->calendar != -1) cdfDefCalendar(fileID, timeVarId, taxis->calendar); + + if (taxis->type == TAXIS_FORECAST) + { + int leadtimeid; + cdf_def_var(fileID, "leadtime", xtype, 1, &timeDimId, &leadtimeid); + streamptr->basetime.leadtimeid = leadtimeid; + + static const char stdName[] = "forecast_period"; + cdf_put_att_text(fileID, leadtimeid, "standard_name", sizeof(stdName) - 1, stdName); + + static const char longName[] = "Time elapsed since the start of the forecast"; + cdf_put_att_text(fileID, leadtimeid, "long_name", sizeof(longName) - 1, longName); + + unitsStr = cdfGetForecastTimeUnits(taxis->fc_unit); + size_t len = strlen(unitsStr); + if (len) cdf_put_att_text(fileID, leadtimeid, "units", len, unitsStr); + } + + cdf_put_att_text(fileID, timeVarId, "axis", 1, "T"); + + if (streamptr->ncmode == 2) cdf_enddef(fileID, streamptr->self); +} + +void +cdfDefTimestep(stream_t *streamptr, int tsID, size_t valCount) +{ + const int time_varid = streamptr->basetime.ncvarid; + if (time_varid != CDI_UNDEFID && tsID == 0) + { + taxis_t *taxis = taxisPtr(vlistInqTaxis(streamptr->vlistID)); + const int fileID = streamptr->fileID; + const char *unitstr = cdfGetTimeUnits(taxis); + const size_t len = strlen(unitstr); + if (len) cdf_put_att_text(fileID, time_varid, "units", len, unitstr); + } + + const int fileID = streamptr->fileID; + + if (CDI_Debug) Message("streamID = %d, fileID = %d, tsID = %d", streamptr->self, fileID, tsID); + + taxis_t *taxis = &streamptr->tsteps[tsID].taxis; + + if (streamptr->ncmode == 1) + { + cdf_enddef(fileID, streamptr->self); + streamptr->ncmode = 2; + } + + if (streamptr->accessmode == 0) + { + cdfEndDef(streamptr); + } + + const size_t start[2] = { [0] = (size_t) tsID, [1] = 0 }, count[2] = { [0] = valCount, [1] = 2 * valCount }; + + double timeValue[2] = { cdi_encode_timeval(taxis->vDateTime, &streamptr->tsteps[0].taxis) }; + if (CDI_Debug) Message("tsID = %d timeValue = %f", tsID, timeValue); + + int ncvarid = streamptr->basetime.ncvarid; + cdf_put_vara_double(fileID, ncvarid, start, count, timeValue); + + if (taxis->hasBounds) + { + ncvarid = streamptr->basetime.ncvarboundsid; + if (ncvarid == CDI_UNDEFID) Error("Call to taxisWithBounds() missing!"); + + timeValue[0] = cdi_encode_timeval(taxis->vDateTime_lb, &streamptr->tsteps[0].taxis); + timeValue[1] = cdi_encode_timeval(taxis->vDateTime_ub, &streamptr->tsteps[0].taxis); + cdf_put_vara_double(fileID, ncvarid, start, count, timeValue); + } + + ncvarid = streamptr->basetime.leadtimeid; + if (taxis->type == TAXIS_FORECAST && ncvarid != CDI_UNDEFID) + cdf_put_vara_double(fileID, ncvarid, start, count, &taxis->fc_period); +} + +#endif +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#if HAVE_CONFIG_H +#endif + +#include <limits.h> +#include <stdio.h> + + +#ifdef HAVE_LIBCGRIBEX + + +typedef struct +{ + int sec0[2]; + int sec1[1024]; + size_t sec2len; + int *sec2; + int sec3[2]; + int sec4[512]; + double fsec2[512]; + double fsec3[2]; +} cgribexrec_t; + +typedef struct +{ + int param; + int level1; + int level2; + int ltype; + int tsteptype; +} compvar_t; + +typedef struct +{ + void *gribbuffer; + size_t gribbuffersize; + unsigned char *pds; + unsigned char *gds; + unsigned char *bms; + unsigned char *bds; +} cgribex_handle; + +static void +fill_intarr(int *iarr, int val, int n) +{ + for (int i = 0; i < n; ++i) iarr[i] = val; +} + +static void +cgribexInit(cgribexrec_t *cgribexp) +{ + cgribexp->sec2len = 4096; + cgribexp->sec2 = (int *) Malloc(cgribexp->sec2len * sizeof(int)); +} + +void * +cgribexNew() +{ + cgribexrec_t *cgribexp = (cgribexrec_t *) Malloc(sizeof(cgribexrec_t)); + cgribexInit(cgribexp); + return (void *) cgribexp; +} + +void +cgribexDelete(void *cgribex) +{ + cgribexrec_t *cgribexp = (cgribexrec_t *) cgribex; + if (cgribexp) + { + if (cgribexp->sec2) Free(cgribexp->sec2); + Free(cgribexp); + } +} + +#ifdef __cplusplus +extern "C" +{ +#endif + int grib1Sections(unsigned char *gribbuffer, long gribbufsize, unsigned char **pdsp, unsigned char **gdsp, unsigned char **bmsp, + unsigned char **bdsp, long *gribrecsize); +#ifdef __cplusplus +} +#endif + +static size_t +cgribexSection2Length(void *gribbuffer, size_t gribbuffersize) +{ + long sec2len = 0; + + if (gribbuffersize && gribbuffer) + { + unsigned char *pds = NULL, *gds = NULL, *bms = NULL, *bds = NULL; + long gribrecsize; + int status = grib1Sections((unsigned char *) gribbuffer, (long) gribbuffersize, &pds, &gds, &bms, &bds, &gribrecsize); + if (status >= 0 && gds != NULL) sec2len = (unsigned) ((gds[0] << 16) + (gds[1] << 8) + (gds[3])); + } + + return sec2len; +} + +void * +cgribex_handle_new_from_meassage(void *gribbuffer, size_t gribbuffersize) +{ + cgribex_handle *gh = (cgribex_handle *) Malloc(sizeof(cgribex_handle)); + gh->gribbuffer = NULL; + gh->gribbuffersize = 0; + gh->pds = NULL; + + if (gribbuffersize && gribbuffer) + { + unsigned char *pds = NULL, *gds = NULL, *bms = NULL, *bds = NULL; + long gribrecsize; + int status = grib1Sections((unsigned char *) gribbuffer, (long) gribbuffersize, &pds, &gds, &bms, &bds, &gribrecsize); + if (status >= 0) + { + gh->gribbuffer = gribbuffer; + gh->gribbuffersize = gribbuffersize; + gh->pds = pds; + gh->gds = gds; + gh->bms = bms; + gh->bds = bds; + } + } + + return (void *) gh; +} + +void +cgribex_handle_delete(void *gh) +{ + if (gh) Free(gh); +} + +static int +cgribexGetGridType(int *isec2) +{ + int gridtype = GRID_GENERIC; + + // clang-format off + switch (ISEC2_GridType) + { + case GRIB1_GTYPE_LATLON: { gridtype = GRID_LONLAT; break; } + case GRIB1_GTYPE_LATLON_ROT: { gridtype = GRID_PROJECTION; break; } + case GRIB1_GTYPE_LCC: { gridtype = CDI_PROJ_LCC; break; } + case GRIB1_GTYPE_GAUSSIAN: { gridtype = ISEC2_Reduced ? GRID_GAUSSIAN_REDUCED : GRID_GAUSSIAN; break; } + case GRIB1_GTYPE_SPECTRAL: { gridtype = GRID_SPECTRAL; break; } + case GRIB1_GTYPE_GME: { gridtype = GRID_GME; break; } + } + // clang-format on + + return gridtype; +} + +static bool +cgribexGetIsRotated(int *isec2) +{ + return (ISEC2_GridType == GRIB1_GTYPE_LATLON_ROT); +} + +static bool +cgribexGetZaxisHasBounds(int grb_ltype) +{ + // clang-format off + switch (grb_ltype) + { + case GRIB1_LTYPE_SIGMA_LAYER: + case GRIB1_LTYPE_HYBRID_LAYER: + case GRIB1_LTYPE_LANDDEPTH_LAYER: return true; + } + // clang-format on + + return false; +} + +static int +cgribexGetTimeUnit(int *isec1) +{ + int timeunit = TUNIT_HOUR; + static bool lprint = true; + + // clang-format off + switch ( ISEC1_TimeUnit ) + { + case ISEC1_TABLE4_MINUTE: timeunit = TUNIT_MINUTE; break; + case ISEC1_TABLE4_QUARTER: timeunit = TUNIT_QUARTER; break; + case ISEC1_TABLE4_30MINUTES: timeunit = TUNIT_30MINUTES; break; + case ISEC1_TABLE4_HOUR: timeunit = TUNIT_HOUR; break; + case ISEC1_TABLE4_3HOURS: timeunit = TUNIT_3HOURS; break; + case ISEC1_TABLE4_6HOURS: timeunit = TUNIT_6HOURS; break; + case ISEC1_TABLE4_12HOURS: timeunit = TUNIT_12HOURS; break; + case ISEC1_TABLE4_DAY: timeunit = TUNIT_DAY; break; + default: + if (lprint) + { + Warning("GRIB time unit %d unsupported!", ISEC1_TimeUnit); + lprint = false; + } + break; + } + // clang-format on + + return timeunit; +} + +static bool +cgribexTimeIsFC(int *isec1) +{ + bool isFC = (ISEC1_TimeRange == 10 && ISEC1_TimePeriod1 == 0 && ISEC1_TimePeriod2 == 0) ? false : true; + return isFC; +} + +static int +cgribexGetTsteptype(int timerange) +{ + static bool lprint = true; + + // clang-format off + int tsteptype = TSTEP_INSTANT; + switch ( timerange ) + { + case 0: tsteptype = TSTEP_INSTANT; break; + case 1: tsteptype = TSTEP_INSTANT2; break; + case 2: tsteptype = TSTEP_RANGE; break; + case 3: tsteptype = TSTEP_AVG; break; + case 4: tsteptype = TSTEP_ACCUM; break; + case 5: tsteptype = TSTEP_DIFF; break; + case 10: tsteptype = TSTEP_INSTANT3; break; + default: + if (lprint) + { + Warning("Time range indicator %d unsupported, set to 0!", timerange); + lprint = false; + } + break; + } + // clang-format on + + return tsteptype; +} + +static bool +cgribexGetGridRegular(int *isec2, int *isec4, grid_t *grid, int gridtype, bool compyinc) +{ + const bool ijDirectionIncrementGiven = gribbyte_get_bit(ISEC2_ResFlag, 1); + const bool uvRelativeToGrid = gribbyte_get_bit(ISEC2_ResFlag, 5); + + const size_t nvalues = (size_t) ISEC4_NumValues; + const size_t nlon = (size_t) ISEC2_NumLon; + const size_t nlat = (size_t) ISEC2_NumLat; + if (nvalues != nlon * nlat) Error("numberOfPoints (%zu) and gridSize (%zu) differ!", nvalues, nlon * nlat); + + grid->size = nvalues; + grid->x.size = nlon; + grid->y.size = nlat; + + if (gridtype == GRID_GAUSSIAN) grid->np = ISEC2_NumPar; + grid->x.inc = 0; + grid->y.inc = 0; + grid->x.flag = 0; + // if ( ISEC2_FirstLon != 0 || ISEC2_LastLon != 0 ) + { + if (grid->x.size > 1) + { + bool recompinc = true; + + if (ISEC2_LastLon < ISEC2_FirstLon) + { + if (ISEC2_FirstLon >= 180000) + ISEC2_FirstLon -= 360000; + else + ISEC2_LastLon += 360000; + } + + if (ijDirectionIncrementGiven && ISEC2_LonIncr > 0) + { + if (labs(ISEC2_LastLon - (ISEC2_FirstLon + ISEC2_LonIncr * ((long) grid->x.size - 1))) <= 2) + { + recompinc = false; + grid->x.inc = ISEC2_LonIncr * 0.001; + } + } + + // recompute xinc if necessary + if (recompinc) grid->x.inc = (ISEC2_LastLon - ISEC2_FirstLon) * 0.001 / (grid->x.size - 1); + + // correct xinc if necessary + if (ISEC2_FirstLon == 0 && ISEC2_LastLon > 354000 && ISEC2_LastLon < 360000) + { + double xinc = 360. / grid->x.size; + if (fabs(grid->x.inc - xinc) > 0.0) + { + grid->x.inc = xinc; + if (CDI_Debug) Message("set xinc to %g", grid->x.inc); + } + } + } + grid->x.first = ISEC2_FirstLon * 0.001; + grid->x.last = ISEC2_LastLon * 0.001; + grid->x.flag = 2; + } + grid->y.flag = 0; + // if ( ISEC2_FirstLat != 0 || ISEC2_LastLat != 0 ) + { + if (grid->y.size > 1 && compyinc) + { + bool recompinc = true; + if (ijDirectionIncrementGiven && ISEC2_LatIncr > 0) + { + if (labs(ISEC2_LastLat - (ISEC2_FirstLat + ISEC2_LatIncr * ((long) grid->y.size - 1))) <= 2) + { + recompinc = false; + grid->y.inc = ISEC2_LatIncr * 0.001; + } + } + + // recompute yinc if necessary + if (recompinc) grid->y.inc = (ISEC2_LastLat - ISEC2_FirstLat) * 0.001 / (grid->y.size - 1); + } + grid->y.first = ISEC2_FirstLat * 0.001; + grid->y.last = ISEC2_LastLat * 0.001; + grid->y.flag = 2; + } + + return uvRelativeToGrid; +} + +static bool +cgribexGetGridReduced(int *isec2, int *isec4, grid_t *grid) +{ + const bool ijDirectionIncrementGiven = gribbyte_get_bit(ISEC2_ResFlag, 1); + const bool uvRelativeToGrid = gribbyte_get_bit(ISEC2_ResFlag, 5); + grid->np = ISEC2_NumPar; + grid->size = (size_t) ISEC4_NumValues; + grid->reducedPoints = ISEC2_ReducedPointsPtr; + grid->reducedPointsSize = (size_t) ISEC2_NumLat; + grid->y.size = (size_t) ISEC2_NumLat; + grid->x.inc = 0; + grid->y.inc = 0; + grid->x.flag = 0; + // if ( ISEC2_FirstLon != 0 || ISEC2_LastLon != 0 ) + { + if (ISEC2_LastLon < ISEC2_FirstLon) + { + if (ISEC2_FirstLon >= 180000) + ISEC2_FirstLon -= 360000; + else + ISEC2_LastLon += 360000; + } + + grid->x.first = ISEC2_FirstLon * 0.001; + grid->x.last = ISEC2_LastLon * 0.001; + grid->x.flag = 2; + } + grid->y.flag = 0; + // if ( ISEC2_FirstLat != 0 || ISEC2_LastLat != 0 ) + { + if (grid->y.size > 1) + { + if (ijDirectionIncrementGiven && ISEC2_LatIncr > 0) + grid->y.inc = ISEC2_LatIncr * 0.001; + else + grid->y.inc = (ISEC2_LastLat - ISEC2_FirstLat) * 0.001 / (grid->y.size - 1); + } + grid->y.first = ISEC2_FirstLat * 0.001; + grid->y.last = ISEC2_LastLat * 0.001; + grid->y.flag = 2; + } + + return uvRelativeToGrid; +} + +static bool +cgribexGetGridLCC(int *isec2, int *isec4, grid_t *grid) +{ + const bool uvRelativeToGrid = gribbyte_get_bit(ISEC2_ResFlag, 5); + + const size_t nvalues = (size_t) ISEC4_NumValues; + const size_t nlon = (size_t) ISEC2_NumLon; + const size_t nlat = (size_t) ISEC2_NumLat; + if (nvalues != nlon * nlat) Error("numberOfPoints (%zu) and gridSize (%zu) differ!", nvalues, nlon * nlat); + + grid->size = nvalues; + grid->x.size = nlon; + grid->y.size = nlat; + + grid->x.first = 0; + grid->x.last = 0; + grid->x.inc = ISEC2_Lambert_dx; + grid->y.first = 0; + grid->y.last = 0; + grid->y.inc = ISEC2_Lambert_dy; + grid->x.flag = 2; + grid->y.flag = 2; + + return uvRelativeToGrid; +} + +static bool +cgribexGetGrid(stream_t *streamptr, int *isec2, int *isec4, grid_t *grid, int iret) +{ + bool uvRelativeToGrid = false; + bool compyinc = true; + int gridtype = cgribexGetGridType(isec2); + int projtype = (gridtype == GRID_PROJECTION && cgribexGetIsRotated(isec2)) ? CDI_PROJ_RLL : CDI_UNDEFID; + if (gridtype == CDI_PROJ_LCC) + { + projtype = gridtype; + gridtype = GRID_PROJECTION; + } + + if (streamptr->unreduced && gridtype == GRID_GAUSSIAN_REDUCED && iret != -801) + { + int nlon = 0; + for (int ilat = 0; ilat < ISEC2_NumLat; ++ilat) + if (ISEC2_ReducedPoints(ilat) > nlon) nlon = ISEC2_ReducedPoints(ilat); + gridtype = GRID_GAUSSIAN; + ISEC2_NumLon = nlon; + ISEC4_NumValues = nlon * ISEC2_NumLat; + compyinc = false; + } + + grid_init(grid); + cdiGridTypeInit(grid, gridtype, 0); + + if (gridtype == GRID_LONLAT || gridtype == GRID_GAUSSIAN || projtype == CDI_PROJ_RLL) + { + uvRelativeToGrid = cgribexGetGridRegular(isec2, isec4, grid, gridtype, compyinc); + } + else if (gridtype == GRID_GAUSSIAN_REDUCED) + { + uvRelativeToGrid = cgribexGetGridReduced(isec2, isec4, grid); + } + else if (projtype == CDI_PROJ_LCC) + { + uvRelativeToGrid = cgribexGetGridLCC(isec2, isec4, grid); + } + else if (gridtype == GRID_SPECTRAL) + { + grid->size = (size_t) ISEC4_NumValues; + grid->trunc = ISEC2_PentaJ; + grid->lcomplex = (ISEC2_RepMode == 2) ? 1 : 0; + } + else if (gridtype == GRID_GME) + { + grid->size = (size_t) ISEC4_NumValues; + grid->gme.nd = ISEC2_GME_ND; + grid->gme.ni = ISEC2_GME_NI; + grid->gme.ni2 = ISEC2_GME_NI2; + grid->gme.ni3 = ISEC2_GME_NI3; + } + else if (gridtype == GRID_GENERIC) + { + grid->size = (size_t) ISEC4_NumValues; + grid->x.size = 0; + grid->y.size = 0; + } + else + { + Error("Unsupported grid type: %s", gridNamePtr(gridtype)); + } + + grid->type = gridtype; + grid->projtype = projtype; + + return uvRelativeToGrid; +} + +static void +cgribexGetLevel(int *isec1, int *leveltype, int *level1, int *level2) +{ + *leveltype = ISEC1_LevelType; + *level1 = ISEC1_Level1; + *level2 = ISEC1_Level2; + if (*leveltype == GRIB1_LTYPE_ISOBARIC) + *level1 *= 100; + else if (*leveltype == GRIB1_LTYPE_99 || *leveltype == GRIB1_LTYPE_ISOBARIC_PA) + *leveltype = GRIB1_LTYPE_ISOBARIC; +} + +static void +cgribexDefProjLCC(int *isec2, int gridID) +{ + struct CDI_GridProjParams gpp; + gridProjParamsInit(&gpp); + + const bool earthIsOblate = gribbyte_get_bit(ISEC2_ResFlag, 2); + if (earthIsOblate) + { + gpp.a = 6378160.0; + gpp.b = 6356775.0; + gpp.rf = 297.0; + } + else + { + gpp.a = 6367470.0; + } + + gpp.xval_0 = ISEC2_FirstLon * 0.001; + gpp.yval_0 = ISEC2_FirstLat * 0.001; + gpp.lon_0 = ISEC2_Lambert_Lov * 0.001; + gpp.lat_1 = ISEC2_Lambert_LatS1 * 0.001; + gpp.lat_2 = ISEC2_Lambert_LatS2 * 0.001; + const bool lsouth = gribbyte_get_bit(ISEC2_Lambert_ProjFlag, 1); + if (lsouth) + { + gpp.lat_1 = -gpp.lat_1; + gpp.lat_2 = -gpp.lat_2; + } + + gpp.lat_0 = gpp.lat_2; + + if (proj_lonlat_to_lcc_func) + { + double x_0 = gpp.xval_0, y_0 = gpp.yval_0; + proj_lonlat_to_lcc_func(gpp, (size_t) 1, &x_0, &y_0); + if (IS_NOT_EQUAL(x_0, gpp.mv) && IS_NOT_EQUAL(y_0, gpp.mv)) + { + gpp.x_0 = -x_0; + gpp.y_0 = -y_0; + } + } + + gridDefParamsLCC(gridID, gpp); +} + +static void +cgribexAddRecord(stream_t *streamptr, cgribexrec_t *cgribexp, int param, size_t recsize, off_t position, int comptype, int lmv, + int iret) +{ + int *isec1 = cgribexp->sec1; + int *isec2 = cgribexp->sec2; + int *isec4 = cgribexp->sec4; + double *fsec2 = cgribexp->fsec2; + double *fsec3 = cgribexp->fsec3; + + int datatype = (ISEC4_NumBits > 0 && ISEC4_NumBits <= 32) ? ISEC4_NumBits : CDI_DATATYPE_PACK; + if (datatype > 32) datatype = CDI_DATATYPE_PACK32; + if (datatype < 0) datatype = CDI_DATATYPE_PACK; + + const int vlistID = streamptr->vlistID; + const int tsID = streamptr->curTsID; + const int recID = recordNewEntry(streamptr, tsID); + record_t *record = &streamptr->tsteps[tsID].records[recID]; + + const int tsteptype = cgribexGetTsteptype(ISEC1_TimeRange); + + int leveltype, level1, level2; + cgribexGetLevel(isec1, &leveltype, &level1, &level2); + + // fprintf(stderr, "param %d %d %d %d\n", param, level1, level2, leveltype); + + record->size = recsize; + record->position = position; + record->param = param; + record->ilevel = level1; + record->ilevel2 = level2; + record->ltype = leveltype; + record->tsteptype = (short) tsteptype; + + grid_t *gridptr = (grid_t *) Malloc(sizeof(*gridptr)); + const bool uvRelativeToGrid = cgribexGetGrid(streamptr, isec2, isec4, gridptr, iret); + + struct addIfNewRes gridAdded = cdiVlistAddGridIfNew(vlistID, gridptr, 0); + int gridID = gridAdded.Id; + if (gridAdded.isNew) + { + if (gridptr->reducedPointsSize) + { + const size_t reducedPointsSize = (size_t) gridptr->reducedPointsSize; + int *reducedPoints = gridptr->reducedPoints; + gridptr->reducedPoints = (int *) Malloc(reducedPointsSize * sizeof(int)); + memcpy(gridptr->reducedPoints, reducedPoints, reducedPointsSize * sizeof(int)); + } + else if (gridptr->projtype == CDI_PROJ_RLL) + { + const double xpole = ISEC2_LonSP * 0.001 - 180; + const double ypole = -ISEC2_LatSP * 0.001; + const double angle = -FSEC2_RotAngle; + gridDefParamRLL(gridID, xpole, ypole, angle); + } + else if (gridptr->projtype == CDI_PROJ_LCC) + { + cgribexDefProjLCC(isec2, gridID); + } + } + else + { + grid_free(gridptr); + Free(gridptr); + } + + const int zaxistype = grib1ltypeToZaxisType(leveltype); + if (zaxistype == ZAXIS_HYBRID || zaxistype == ZAXIS_HYBRID_HALF) + { + const size_t vctsize = (size_t) ISEC2_NumVCP; + double *vctptr = &fsec2[10]; + varDefVCT(vctsize, vctptr); + } + + const bool lbounds = cgribexGetZaxisHasBounds(leveltype); + + int varID = 0, levelID = 0; + varAddRecord(recID, param, gridID, zaxistype, lbounds, level1, level2, 0, 0, datatype, &varID, &levelID, tsteptype, leveltype, -1, + NULL, NULL, NULL, NULL); + + record->varID = (short) varID; + record->levelID = levelID; + + varDefCompType(varID, comptype); + + if (uvRelativeToGrid) varDefKeyInt(varID, CDI_KEY_UVRELATIVETOGRID, 1); + + if (ISEC1_LocalFLag) + { + if (ISEC1_CenterID == 78 && isec1[36] == 253) // DWD local extension + { + varDefKeyInt(varID, CDI_KEY_TYPEOFENSEMBLEFORECAST, isec1[52]); + varDefKeyInt(varID, CDI_KEY_NUMBEROFFORECASTSINENSEMBLE, isec1[53]); + varDefKeyInt(varID, CDI_KEY_PERTURBATIONNUMBER, isec1[54]); + } + else if (ISEC1_CenterID == 252 && isec1[36] == 1) // MPIM local extension + { + varDefKeyInt(varID, CDI_KEY_TYPEOFENSEMBLEFORECAST, isec1[37]); + varDefKeyInt(varID, CDI_KEY_NUMBEROFFORECASTSINENSEMBLE, isec1[39]); + varDefKeyInt(varID, CDI_KEY_PERTURBATIONNUMBER, isec1[38]); + } + } + + if (lmv) varDefMissval(varID, FSEC3_MissVal); + + if (varInqInst(varID) == CDI_UNDEFID) + { + const int center = ISEC1_CenterID; + const int subcenter = ISEC1_SubCenterID; + int instID = institutInq(center, subcenter, NULL, NULL); + if (instID == CDI_UNDEFID) instID = institutDef(center, subcenter, NULL, NULL); + varDefInst(varID, instID); + } + + if (varInqModel(varID) == CDI_UNDEFID) + { + int modelID = modelInq(varInqInst(varID), ISEC1_ModelID, NULL); + if (modelID == CDI_UNDEFID) modelID = modelDef(varInqInst(varID), ISEC1_ModelID, NULL); + varDefModel(varID, modelID); + } + + if (varInqTable(varID) == CDI_UNDEFID) + { + int tableID = tableInq(varInqModel(varID), ISEC1_CodeTable, NULL); + if (tableID == CDI_UNDEFID) tableID = tableDef(varInqModel(varID), ISEC1_CodeTable, NULL); + varDefTable(varID, tableID); + } + + streamptr->tsteps[tsID].nallrecs++; + streamptr->nrecs++; +} + +static void +MCH_get_undef(int *isec1, double *undef_pds, double *undef_eps) +{ + /* 2010-01-13: Oliver Fuhrer */ + if (ISEC1_CenterID == 215) + { + if (isec1[34] != 0 && isec1[34] != 255) + { + if (isec1[34] & 2) + { + *undef_pds = ((isec1[34] & 1) ? -0.99 : +0.99) * pow(10.0, -isec1[35]); + *undef_eps = pow(10.0, -isec1[35] - 1); + } + else + { + *undef_pds = ((isec1[34] & 1) ? -0.99 : +0.99) * pow(10.0, +isec1[35]); + *undef_eps = pow(10.0, isec1[35] - 1); + } + } + } +} + +static void +cgribexDecodeHeader(cgribexrec_t *cgribexp, int *gribbuffer, int recsize, int *lmv, int *iret) +{ + int *isec0 = cgribexp->sec0; + int *isec1 = cgribexp->sec1; + int *isec2 = cgribexp->sec2; + int *isec3 = cgribexp->sec3; + int *isec4 = cgribexp->sec4; + double *fsec2 = cgribexp->fsec2; + double *fsec3 = cgribexp->fsec3; + + int ipunp = 0, iword = 0; + + fill_intarr(isec1, 0, 256); + fill_intarr(isec2, 0, 32); + + double *fsec4 = NULL; + gribExDP(isec0, isec1, isec2, fsec2, isec3, fsec3, isec4, fsec4, ipunp, (int *) gribbuffer, recsize, &iword, "J", iret); + + if (!(ISEC1_Sec2Or3Flag & 128)) isec2[0] = -1; // default generic grid + + *lmv = 0; + + if (ISEC1_CenterID == 215 && (isec1[34] != 0 && isec1[34] != 255)) + { + double undef_pds, undef_eps; + MCH_get_undef(isec1, &undef_pds, &undef_eps); + FSEC3_MissVal = undef_pds; + *lmv = 1; + } +} + +static compvar_t +cgribexVarSet(int param, int level1, int level2, int leveltype, int trange) +{ + int tsteptype = cgribexGetTsteptype(trange); + + compvar_t compVar; + compVar.param = param; + compVar.level1 = level1; + compVar.level2 = level2; + compVar.ltype = leveltype; + compVar.tsteptype = tsteptype; + + return compVar; +} + +static inline int +cgribexVarCompare(compvar_t compVar, record_t record, int flag) +{ + bool vinst = compVar.tsteptype == TSTEP_INSTANT || compVar.tsteptype == TSTEP_INSTANT2 || compVar.tsteptype == TSTEP_INSTANT3; + bool rinst = record.tsteptype == TSTEP_INSTANT || record.tsteptype == TSTEP_INSTANT2 || record.tsteptype == TSTEP_INSTANT3; + int tstepDiff = (!((flag == 0) & (vinst && rinst))) & (compVar.tsteptype != record.tsteptype); + int rstatus = (compVar.param != record.param) | (compVar.level1 != record.ilevel) | (compVar.level2 != record.ilevel2) + | (compVar.ltype != record.ltype) | tstepDiff; + return rstatus; +} + +#define gribWarning(text, nrecs, timestep, paramstr, level1, level2) \ + Warning("Record %2d (id=%s lev1=%d lev2=%d) timestep %d: %s", nrecs, paramstr, level1, level2, timestep, text) + +static void +cgribexSkipRecords(const int fileID) +{ + int nskip = CDI_Skip_Records; + while (nskip-- > 0) + { + const size_t recsize = gribGetSize(fileID); + if (recsize == 0) Error("Skipping of %d records failed!", CDI_Skip_Records); + + const off_t recpos = fileGetPos(fileID); + fileSetPos(fileID, recpos, SEEK_CUR); + } +} + +static CdiDateTime +cgribexDateTimeX(int *isec1, CdiDateTime *sDateTime) +{ + int vdate = 0, sdate = 0, vtime = 0, stime = 0; + gribDateTimeX(isec1, &vdate, &vtime, &sdate, &stime); + + sDateTime->date = cdiDate_set(sdate); + sDateTime->time = cdiTime_set(stime); + + return cdiDateTime_set(vdate, vtime); +} + +int +cgribexScanTimestep1(stream_t *streamptr) +{ + CdiDateTime vDateTime0; + cdiDateTime_init(&vDateTime0); + int lmv = 0, iret = 0; + off_t recpos = 0; + void *gribbuffer = NULL; + size_t buffersize = 0; + int leveltype = 0, level1 = 0, level2 = 0; + unsigned recID; + int nrecsScanned = 0; + bool warn_time = true; + bool warn_numavg = true; + bool fcast = false; + char paramstr[32]; + + streamptr->curTsID = 0; + + cgribexrec_t *cgribexp = (cgribexrec_t *) streamptr->record->objectp; + + const int tsID = tstepsNewEntry(streamptr); + if (tsID != 0) Error("Internal problem! tstepsNewEntry returns %d", tsID); + + taxis_t *taxis = &streamptr->tsteps[tsID].taxis; + + const int fileID = streamptr->fileID; + + if (CDI_Skip_Records) cgribexSkipRecords(fileID); + + unsigned nrecs = 0; + while (true) + { + const size_t recsize = gribGetSize(fileID); + recpos = fileGetPos(fileID); + + if (recsize == 0) + { + if (nrecs == 0) Error("No GRIB records found!"); + streamptr->ntsteps = 1; + break; + } + + ensureBufferSize(recsize, &buffersize, &gribbuffer); + + size_t readsize = recsize; + // Search for next 'GRIB', read the following record, and position file offset after it. + if (gribRead(fileID, gribbuffer, &readsize)) break; + + const int comptype = grbDecompress(recsize, &buffersize, &gribbuffer); + + const size_t sec2len = cgribexSection2Length(gribbuffer, buffersize); + if (sec2len > cgribexp->sec2len) + { + cgribexp->sec2len = sec2len; + cgribexp->sec2 = (int *) Realloc(cgribexp->sec2, sec2len * sizeof(int)); + } + + int *isec1 = cgribexp->sec1; + + nrecsScanned++; + cgribexDecodeHeader(cgribexp, (int *) gribbuffer, (int) recsize, &lmv, &iret); + + const int param = cdiEncodeParam(ISEC1_Parameter, ISEC1_CodeTable, 255); + cdiParamToString(param, paramstr, sizeof(paramstr)); + + cgribexGetLevel(isec1, &leveltype, &level1, &level2); + + CdiDateTime sDateTime; + const CdiDateTime vDateTime = cgribexDateTimeX(isec1, &sDateTime); + + if (nrecs == 0) + { + vDateTime0 = vDateTime; + fcast = cgribexTimeIsFC(isec1); + taxis->unit = cgribexGetTimeUnit(isec1); + taxis->rDateTime = cdiDateTime_set(gribRefDate(isec1), gribRefTime(isec1)); + taxis->sDateTime = sDateTime; + taxis->vDateTime = vDateTime; + } + else + { + if (cdiDateTime_isLT(sDateTime, taxis->sDateTime)) taxis->sDateTime = sDateTime; + + compvar_t compVar = cgribexVarSet(param, level1, level2, leveltype, ISEC1_TimeRange); + record_t *records = streamptr->tsteps[tsID].records; + for (recID = 0; recID < nrecs; recID++) + { + if (cgribexVarCompare(compVar, records[recID], 0) == 0) break; + } + + if (CDI_Inventory_Mode == 1) + { + if (recID < nrecs) break; + if (warn_time) + if (cdiDateTime_isNE(vDateTime, vDateTime0)) + { + gribWarning("Inconsistent verification time!", nrecsScanned, tsID + 1, paramstr, level1, level2); + warn_time = false; + } + } + else + { + if (cdiDateTime_isNE(vDateTime, vDateTime0)) break; + + if (recID < nrecs) + { + gribWarning("Parameter already exist, skipped!", nrecsScanned, tsID + 1, paramstr, level1, level2); + continue; + } + } + } + + if (ISEC1_AvgNum) + { + if (taxis->numavg && warn_numavg && (taxis->numavg != ISEC1_AvgNum)) + { + Warning("Changing numavg from %d to %d not supported!", taxis->numavg, ISEC1_AvgNum); + warn_numavg = false; + } + else + { + taxis->numavg = ISEC1_AvgNum; + } + } + + nrecs++; + + if (CDI_Debug) + Message("Read record %2d (id=%s lev1=%d lev2=%d) %s", nrecsScanned, paramstr, level1, level2, + CdiDateTime_string(vDateTime)); + + cgribexAddRecord(streamptr, cgribexp, param, recsize, recpos, comptype, lmv, iret); + } + + streamptr->rtsteps = 1; + + if (nrecs == 0) return CDI_EUFSTRUCT; + + cdi_generate_vars(streamptr); + + taxis->type = fcast ? TAXIS_RELATIVE : TAXIS_ABSOLUTE; + const int taxisID = taxisCreate(taxis->type); + + const int vlistID = streamptr->vlistID; + vlistDefTaxis(vlistID, taxisID); + + streamScanResizeRecords1(streamptr); + + streamptr->record->buffer = gribbuffer; + streamptr->record->buffersize = buffersize; + + streamScanTsFixNtsteps(streamptr, recpos); + streamScanTimeConstAdjust(streamptr, taxis); + + return 0; +} + +int +cgribexScanTimestep2(stream_t *streamptr) +{ + CdiDateTime vDateTime0; + cdiDateTime_init(&vDateTime0); + int lmv = 0, iret = 0; + off_t recpos = 0; + int leveltype = 0, level1 = 0, level2 = 0; + int recID = 0; + bool warn_numavg = true; + char paramstr[32]; + + streamptr->curTsID = 1; + + cgribexrec_t *cgribexp = (cgribexrec_t *) streamptr->record->objectp; + int *isec1 = cgribexp->sec1; + int *isec2 = cgribexp->sec2; + + const int fileID = streamptr->fileID; + const int vlistID = streamptr->vlistID; + + void *gribbuffer = streamptr->record->buffer; + size_t buffersize = streamptr->record->buffersize; + + int tsID = streamptr->rtsteps; + if (tsID != 1) Error("Internal problem! unexpected timestep %d", tsID + 1); + + taxis_t *taxis = &streamptr->tsteps[tsID].taxis; + + fileSetPos(fileID, streamptr->tsteps[tsID].position, SEEK_SET); + + cdi_create_records(streamptr, tsID); + record_t *records = streamptr->tsteps[tsID].records; + + const int nrecords = streamScanInitRecords2(streamptr); + + int nrecsScanned = nrecords; + int rindex = 0; + while (true) + { + if (rindex > nrecords) break; + + const size_t recsize = gribGetSize(fileID); + recpos = fileGetPos(fileID); + if (recsize == 0) + { + streamptr->ntsteps = 2; + break; + } + + ensureBufferSize(recsize, &buffersize, &gribbuffer); + + size_t readsize = recsize; + if (gribRead(fileID, gribbuffer, &readsize)) break; + + grbDecompress(recsize, &buffersize, &gribbuffer); + + nrecsScanned++; + cgribexDecodeHeader(cgribexp, (int *) gribbuffer, (int) recsize, &lmv, &iret); + + const int param = cdiEncodeParam(ISEC1_Parameter, ISEC1_CodeTable, 255); + cdiParamToString(param, paramstr, sizeof(paramstr)); + + cgribexGetLevel(isec1, &leveltype, &level1, &level2); + + CdiDateTime sDateTime; + const CdiDateTime vDateTime = cgribexDateTimeX(isec1, &sDateTime); + + if (rindex == 0) + { + vDateTime0 = vDateTime; + const int taxisID = vlistInqTaxis(vlistID); + if (taxisInqType(taxisID) == TAXIS_RELATIVE) + { + taxis->type = TAXIS_RELATIVE; + taxis->rDateTime = cdiDateTime_set(gribRefDate(isec1), gribRefTime(isec1)); + } + else + { + taxis->type = TAXIS_ABSOLUTE; + } + taxis->unit = cgribexGetTimeUnit(isec1); + taxis->vDateTime = vDateTime; + taxis->sDateTime = sDateTime; + } + else + { + if (cdiDateTime_isLT(sDateTime, taxis->sDateTime)) taxis->sDateTime = sDateTime; + } + + const int tsteptype = cgribexGetTsteptype(ISEC1_TimeRange); + + if (ISEC1_AvgNum) + { + if (taxis->numavg && warn_numavg && (taxis->numavg != ISEC1_AvgNum)) + warn_numavg = false; + else + taxis->numavg = ISEC1_AvgNum; + } + + compvar_t compVar = cgribexVarSet(param, level1, level2, leveltype, ISEC1_TimeRange); + + for (recID = 0; recID < nrecords; recID++) + { + if (cgribexVarCompare(compVar, records[recID], 0) == 0) break; + } + + if (recID == nrecords) + { + gribWarning("Parameter not defined at timestep 1!", nrecsScanned, tsID + 1, paramstr, level1, level2); + return CDI_EUFSTRUCT; + } + + if (CDI_Inventory_Mode == 1) + { + if (records[recID].used) + { + break; + } + else + { + records[recID].used = true; + streamptr->tsteps[tsID].recIDs[rindex] = recID; + } + } + else + { + if (records[recID].used) + { + if (cdiDateTime_isNE(vDateTime, vDateTime0)) break; + + gribWarning("Parameter already exist, skipped!", nrecsScanned, tsID + 1, paramstr, level1, level2); + continue; + } + else + { + records[recID].used = true; + streamptr->tsteps[tsID].recIDs[rindex] = recID; + } + } + + if (CDI_Debug) + Message("Read record %2d (id=%s lev1=%d lev2=%d) %s", nrecsScanned, paramstr, level1, level2, + CdiDateTime_string(vDateTime)); + + if (cgribexVarCompare(compVar, streamptr->tsteps[tsID].records[recID], 0) != 0) + { + Message("tsID = %d recID = %d param = %3d new %3d level = %3d new %3d", tsID, recID, records[recID].param, param, + records[recID].ilevel, level1); + return CDI_EUFSTRUCT; + } + + records[recID].position = recpos; + records[recID].size = recsize; + + const int varID = records[recID].varID; + const int gridID = vlistInqVarGrid(vlistID, varID); + if (gridInqSize(gridID) == 1 && gridInqType(gridID) == GRID_LONLAT) + { + if (IS_NOT_EQUAL(gridInqXval(gridID, 0), ISEC2_FirstLon * 0.001) + || IS_NOT_EQUAL(gridInqYval(gridID, 0), ISEC2_FirstLat * 0.001)) + gridChangeType(gridID, GRID_TRAJECTORY); + } + + if (tsteptype != TSTEP_INSTANT2 && tsteptype != vlistInqVarTsteptype(vlistID, varID)) + vlistDefVarTsteptype(vlistID, varID, tsteptype); + + rindex++; + } + + int nrecs = 0; + for (recID = 0; recID < nrecords; recID++) + { + if (records[recID].used) + nrecs++; + else + vlistDefVarTimetype(vlistID, records[recID].varID, TIME_CONSTANT); + } + streamptr->tsteps[tsID].nrecs = nrecs; + + streamptr->rtsteps = 2; + + streamScanTsFixNtsteps(streamptr, recpos); + + streamptr->record->buffer = gribbuffer; + streamptr->record->buffersize = buffersize; + + return 0; +} + +int +cgribexScanTimestep(stream_t *streamptr) +{ + CdiDateTime vDateTime0; + cdiDateTime_init(&vDateTime0); + int lmv = 0, iret = 0; + off_t recpos = 0; + int leveltype = 0, level1 = 0, level2 = 0; + int vrecID, recID = 0; + bool warn_numavg = true; + int nrecs = 0; + char paramstr[32]; + + cgribexrec_t *cgribexp = (cgribexrec_t *) streamptr->record->objectp; + int *isec1 = cgribexp->sec1; + + int tsID = streamptr->rtsteps; + taxis_t *taxis = &streamptr->tsteps[tsID].taxis; + + if (streamptr->tsteps[tsID].recordSize == 0) + { + void *gribbuffer = streamptr->record->buffer; + size_t buffersize = streamptr->record->buffersize; + + cdi_create_records(streamptr, tsID); + record_t *records = streamptr->tsteps[tsID].records; + + nrecs = streamScanInitRecords(streamptr, tsID); + + const int fileID = streamptr->fileID; + + fileSetPos(fileID, streamptr->tsteps[tsID].position, SEEK_SET); + + int nrecsScanned = streamptr->tsteps[0].nallrecs + streamptr->tsteps[1].nrecs * (tsID - 1); + int rindex = 0; + while (true) + { + if (rindex > nrecs) break; + + const size_t recsize = gribGetSize(fileID); + recpos = fileGetPos(fileID); + if (recsize == 0) + { + streamptr->ntsteps = streamptr->rtsteps + 1; + break; + } + + ensureBufferSize(recsize, &buffersize, &gribbuffer); + + size_t readsize = recsize; + if (gribRead(fileID, gribbuffer, &readsize)) + { + Warning("Inconsistent timestep %d (GRIB record %d/%d)!", tsID + 1, rindex + 1, streamptr->tsteps[tsID].recordSize); + break; + } + + grbDecompress(recsize, &buffersize, &gribbuffer); + + nrecsScanned++; + cgribexDecodeHeader(cgribexp, (int *) gribbuffer, (int) recsize, &lmv, &iret); + + const int param = cdiEncodeParam(ISEC1_Parameter, ISEC1_CodeTable, 255); + cdiParamToString(param, paramstr, sizeof(paramstr)); + + cgribexGetLevel(isec1, &leveltype, &level1, &level2); + + CdiDateTime sDateTime; + const CdiDateTime vDateTime = cgribexDateTimeX(isec1, &sDateTime); + + if (rindex == nrecs) break; + + if (rindex == 0) + { + vDateTime0 = vDateTime; + const int vlistID = streamptr->vlistID; + const int taxisID = vlistInqTaxis(vlistID); + if (taxisInqType(taxisID) == TAXIS_RELATIVE) + { + taxis->type = TAXIS_RELATIVE; + taxis->rDateTime = cdiDateTime_set(gribRefDate(isec1), gribRefTime(isec1)); + } + else + { + taxis->type = TAXIS_ABSOLUTE; + } + taxis->unit = cgribexGetTimeUnit(isec1); + taxis->vDateTime = vDateTime; + taxis->sDateTime = sDateTime; + } + else + { + if (cdiDateTime_isLT(sDateTime, taxis->sDateTime)) taxis->sDateTime = sDateTime; + } + + if (ISEC1_AvgNum) + { + if (taxis->numavg && warn_numavg && (taxis->numavg != ISEC1_AvgNum)) + warn_numavg = false; + else + taxis->numavg = ISEC1_AvgNum; + } + + compvar_t compVar = cgribexVarSet(param, level1, level2, leveltype, ISEC1_TimeRange); + + for (vrecID = 0; vrecID < nrecs; vrecID++) + { + recID = streamptr->tsteps[1].recIDs[vrecID]; + if (cgribexVarCompare(compVar, records[recID], 0) == 0) break; + } + + if (vrecID == nrecs) + { + gribWarning("Parameter not defined at timestep 1!", nrecsScanned, tsID + 1, paramstr, level1, level2); + + if (CDI_Inventory_Mode == 1) + return CDI_EUFSTRUCT; + else + continue; + } + + if (CDI_Inventory_Mode == 1) + { + records[recID].used = true; + streamptr->tsteps[tsID].recIDs[rindex] = recID; + } + else + { + if (records[recID].used) + { + char paramstr_[32]; + cdiParamToString(param, paramstr_, sizeof(paramstr_)); + + if (cdiDateTime_isNE(vDateTime, vDateTime0)) break; + + if (CDI_Debug) + gribWarning("Parameter already exist, skipped!", nrecsScanned, tsID + 1, paramstr_, level1, level2); + + continue; + } + else + { + records[recID].used = true; + streamptr->tsteps[tsID].recIDs[rindex] = recID; + } + } + + if (CDI_Debug) + Message("Read record %2d (id=%s lev1=%d lev2=%d) %s", nrecsScanned, paramstr, level1, level2, + CdiDateTime_string(vDateTime)); + + if (cgribexVarCompare(compVar, records[recID], 0) != 0) + { + Message("tsID = %d recID = %d param = %3d new %3d level = %3d new %3d", tsID, recID, records[recID].param, param, + records[recID].ilevel, level1); + Error("Invalid, unsupported or inconsistent record structure"); + } + + records[recID].position = recpos; + records[recID].size = recsize; + + rindex++; + } + + for (vrecID = 0; vrecID < nrecs; vrecID++) + { + recID = streamptr->tsteps[tsID].recIDs[vrecID]; + if (!records[recID].used) break; + } + + if (vrecID < nrecs) + { + cdiParamToString(records[recID].param, paramstr, sizeof(paramstr)); + gribWarning("Parameter not found!", nrecsScanned, tsID + 1, paramstr, records[recID].ilevel, records[recID].ilevel2); + return CDI_EUFSTRUCT; + } + + streamptr->rtsteps++; + + if (streamptr->ntsteps != streamptr->rtsteps) + { + tsID = tstepsNewEntry(streamptr); + if (tsID != streamptr->rtsteps) Error("Internal error. tsID = %d", tsID); + + streamptr->tsteps[tsID - 1].next = true; + streamptr->tsteps[tsID].position = recpos; + } + + fileSetPos(fileID, streamptr->tsteps[tsID].position, SEEK_SET); + streamptr->tsteps[tsID].position = recpos; + + streamptr->record->buffer = gribbuffer; + streamptr->record->buffersize = buffersize; + } + + if (nrecs > 0 && nrecs < streamptr->tsteps[tsID].nrecs) + { + Warning("Incomplete timestep. Stop scanning at timestep %d.", tsID); + streamptr->ntsteps = tsID; + } + + return streamptr->ntsteps; +} + +#ifdef gribWarning +#undef gribWarning +#endif + +int +cgribexDecode(int memtype, void *cgribex, void *gribbuffer, size_t gribsize, void *data, size_t datasize, int unreduced, + size_t *nmiss, double missval) +{ + int status = 0; + + bool lalloc = cgribex == NULL; + cgribexrec_t *cgribexp = (cgribexrec_t *) (lalloc ? cgribexNew() : cgribex); + + int *isec0 = cgribexp->sec0; + int *isec1 = cgribexp->sec1; + int *isec2 = cgribexp->sec2; + int *isec3 = cgribexp->sec3; + int *isec4 = cgribexp->sec4; + double *fsec2 = cgribexp->fsec2; + double *fsec3 = cgribexp->fsec3; + float fsec2f[sizeof(cgribexp->fsec2) / sizeof(double)]; + float fsec3f[sizeof(cgribexp->fsec3) / sizeof(double)]; + + char hoper[2]; + strcpy(hoper, unreduced ? "R" : "D"); + + FSEC3_MissVal = missval; + + int iret = 0, iword = 0; + if (memtype == MEMTYPE_FLOAT) + gribExSP(isec0, isec1, isec2, fsec2f, isec3, fsec3f, isec4, (float *) data, (int) datasize, (int *) gribbuffer, (int) gribsize, + &iword, hoper, &iret); + else + gribExDP(isec0, isec1, isec2, fsec2, isec3, fsec3, isec4, (double *) data, (int) datasize, (int *) gribbuffer, (int) gribsize, + &iword, hoper, &iret); + + *nmiss = (ISEC1_Sec2Or3Flag & 64) ? ISEC4_NumValues - ISEC4_NumNonMissValues : 0; + + if (ISEC1_CenterID == 215 && (isec1[34] != 0 && isec1[34] != 255)) + { + double undef_pds, undef_eps; + MCH_get_undef(isec1, &undef_pds, &undef_eps); + + *nmiss = 0; + if (memtype == MEMTYPE_FLOAT) + { + float *restrict dataf = (float *) data; + for (size_t i = 0; i < datasize; i++) + if ((fabs(dataf[i] - undef_pds) < undef_eps) || IS_EQUAL(dataf[i], FSEC3_MissVal)) + { + dataf[i] = (float) missval; + (*nmiss)++; + } + } + else + { + double *restrict datad = (double *) data; + for (size_t i = 0; i < datasize; i++) + if ((fabs(datad[i] - undef_pds) < undef_eps) || IS_EQUAL(datad[i], FSEC3_MissVal)) + { + datad[i] = missval; + (*nmiss)++; + } + } + } + + if (lalloc) cgribexDelete(cgribexp); + + return status; +} + +static void +cgribexDefInstitut(int *isec1, int vlistID, int varID) +{ + int instID = (vlistInqInstitut(vlistID) != CDI_UNDEFID) ? vlistInqInstitut(vlistID) : vlistInqVarInstitut(vlistID, varID); + if (instID != CDI_UNDEFID) + { + ISEC1_CenterID = institutInqCenter(instID); + ISEC1_SubCenterID = institutInqSubcenter(instID); + } +} + +static void +cgribexDefModel(int *isec1, int vlistID, int varID) +{ + int modelID = (vlistInqModel(vlistID) != CDI_UNDEFID) ? vlistInqModel(vlistID) : vlistInqVarModel(vlistID, varID); + if (modelID != CDI_UNDEFID) ISEC1_ModelID = modelInqGribID(modelID); +} + +static void +cgribexDefParam(int *isec1, int param) +{ + int pdis, pcat, pnum; + cdiDecodeParam(param, &pnum, &pcat, &pdis); + if (pnum < 0) pnum = -pnum; + + static bool lwarn_pdis = true; + if (pdis != 255 && lwarn_pdis) + { + char paramstr[32]; + cdiParamToString(param, paramstr, sizeof(paramstr)); + Warning("Can't convert GRIB2 parameter ID (%s) to GRIB1, set to %d.%d!", paramstr, pnum, pcat); + lwarn_pdis = false; + } + + static bool lwarn_pnum = true; + if (pnum > 255 && lwarn_pnum) + { + Warning("Parameter number %d out of range (1-255), set to %d!", pnum, pnum % 256); + lwarn_pnum = false; + pnum = pnum % 256; + } + + ISEC1_CodeTable = pcat; + ISEC1_Parameter = pnum; +} + +static int +cgribexDefTimerange(int tsteptype, int factor, int calendar, CdiDateTime rDateTime, CdiDateTime vDateTime, CdiDateTime sDateTime, + int *pip1, int *pip2) +{ + JulianDate julianDate1 = julianDate_encode(calendar, rDateTime); + JulianDate julianDate2 = julianDate_encode(calendar, vDateTime); + const JulianDate julianDate = julianDate_sub(julianDate2, julianDate1); + + int timerange = -1; + int ip1 = 0, ip2 = 0; + if (!(int) (fmod(julianDate_to_seconds(julianDate), factor))) + { + const int ip = (int) lround(julianDate_to_seconds(julianDate) / factor); + if ((ip > 255) && (tsteptype == TSTEP_INSTANT)) tsteptype = TSTEP_INSTANT3; + + int ipx = 0; + if (!cdiDateTime_isNull(sDateTime) + && (tsteptype == TSTEP_RANGE || tsteptype == TSTEP_AVG || tsteptype == TSTEP_ACCUM || tsteptype == TSTEP_DIFF)) + { + julianDate2 = julianDate_encode(calendar, sDateTime); + ipx = (int) lround(julianDate_to_seconds(julianDate_sub(julianDate2, julianDate1)) / factor); + } + + // clang-format off + switch (tsteptype) + { + case TSTEP_INSTANT: timerange = 0; ip1 = ip; ip2 = 0; break; + case TSTEP_INSTANT2: timerange = 1; ip1 = 0; ip2 = 0; break; + case TSTEP_RANGE: timerange = 2; ip1 = 0; ip2 = ip; break; + case TSTEP_AVG: timerange = 3; ip1 = 0; ip2 = ip; break; + case TSTEP_ACCUM: timerange = 4; ip1 = ipx; ip2 = ip; break; + case TSTEP_DIFF: timerange = 5; ip1 = 0; ip2 = ip; break; + case TSTEP_INSTANT3: + default: timerange = 10; ip1 = ip/256; ip2 = ip%256; break; + } + // clang-format on + } + + *pip1 = ip1; + *pip2 = ip2; + + return timerange; +} + +static int +cgribexDefDateTime(int *isec1, int timeunit, CdiDateTime dt) +{ + int year, month, day, hour, minute, second, ms; + cdiDate_decode(dt.date, &year, &month, &day); + cdiTime_decode(dt.time, &hour, &minute, &second, &ms); + + int century = year / 100; + + ISEC1_Year = year - century * 100; + + if (year < 0) + { + century = -century; + ISEC1_Year = -ISEC1_Year; + } + + if (ISEC1_Year == 0) + { + century -= 1; + ISEC1_Year = 100; + } + + century += 1; + if (year < 0) century = -century; + + ISEC1_Month = month; + ISEC1_Day = day; + ISEC1_Hour = hour; + ISEC1_Minute = minute; + + ISEC1_Century = century; + + int factor = 1; + // clang-format off + switch (timeunit) + { + case TUNIT_MINUTE: factor = 60; ISEC1_TimeUnit = ISEC1_TABLE4_MINUTE; break; + case TUNIT_QUARTER: factor = 900; ISEC1_TimeUnit = ISEC1_TABLE4_QUARTER; break; + case TUNIT_30MINUTES: factor = 1800; ISEC1_TimeUnit = ISEC1_TABLE4_30MINUTES; break; + case TUNIT_HOUR: factor = 3600; ISEC1_TimeUnit = ISEC1_TABLE4_HOUR; break; + case TUNIT_3HOURS: factor = 10800; ISEC1_TimeUnit = ISEC1_TABLE4_3HOURS; break; + case TUNIT_6HOURS: factor = 21600; ISEC1_TimeUnit = ISEC1_TABLE4_6HOURS; break; + case TUNIT_12HOURS: factor = 43200; ISEC1_TimeUnit = ISEC1_TABLE4_12HOURS; break; + case TUNIT_DAY: factor = 86400; ISEC1_TimeUnit = ISEC1_TABLE4_DAY; break; + default: factor = 3600; ISEC1_TimeUnit = ISEC1_TABLE4_HOUR; break; + } + // clang-format on + + return factor; +} + +static void +cgribexDefTime(int *isec1, CdiDateTime vDateTime, int tsteptype, int numavg, int taxisID) +{ + int timetype = TAXIS_ABSOLUTE; + int timeunit = TUNIT_HOUR; + + if (taxisID != -1) + { + timetype = taxisInqType(taxisID); + timeunit = taxisInqTunit(taxisID); + } + + if (timetype == TAXIS_RELATIVE) + { + const int calendar = taxisInqCalendar(taxisID); + + CdiDateTime rDateTime = taxisInqRdatetime(taxisID); + if (cdiDateTime_isLT(vDateTime, rDateTime)) rDateTime = vDateTime; + + CdiDateTime sDateTime = taxisInqSdatetime(taxisID); + + int factor = cgribexDefDateTime(isec1, timeunit, rDateTime); + int ip1 = 0, ip2 = 0; + int timerange = cgribexDefTimerange(tsteptype, factor, calendar, rDateTime, vDateTime, sDateTime, &ip1, &ip2); + + if (ip2 > 0xFF && timeunit < TUNIT_YEAR) + { + timeunit++; + factor = cgribexDefDateTime(isec1, timeunit, rDateTime); + timerange = cgribexDefTimerange(tsteptype, factor, calendar, rDateTime, vDateTime, sDateTime, &ip1, &ip2); + } + + if (timerange == -1 || timerange == 1 || timerange == 3) timetype = TAXIS_ABSOLUTE; + /* + else if ( timerange == 10 ) + { + if ( ip1 < 0 || ip1 > 0xFFFF ) timetype = TAXIS_ABSOLUTE; + if ( ip2 < 0 || ip2 > 0xFFFF ) timetype = TAXIS_ABSOLUTE; + } + */ + else + { + if (ip1 < 0 || ip1 > 0xFF) timetype = TAXIS_ABSOLUTE; + if (ip2 < 0 || ip2 > 0xFF) timetype = TAXIS_ABSOLUTE; + } + /* + static bool lwarn = true; + if ( lwarn && timetype == TAXIS_ABSOLUTE ) + { + lwarn = false; + Warning("Can't store forecast time %d %d relative to %d %d, converted to absolute time!", vdate, vtime, rdate, rtime); + } + */ + ISEC1_TimeRange = timerange; + ISEC1_TimePeriod1 = ip1; + ISEC1_TimePeriod2 = ip2; + } + + if (timetype == TAXIS_ABSOLUTE) + { + (void) cgribexDefDateTime(isec1, timeunit, vDateTime); + + /* + if ( numavg > 0 ) + ISEC1_TimeRange = 0; + else + */ + if (ISEC1_TimeRange != 3) ISEC1_TimeRange = 10; + + ISEC1_TimePeriod1 = 0; + ISEC1_TimePeriod2 = 0; + } + + ISEC1_AvgNum = numavg; + ISEC1_AvgMiss = 0; + ISEC1_DecScaleFactor = 0; +} + +static void +cgribexDefGridRegular(int *isec2, double *fsec2, int gridID, int gridtype, bool gridIsRotated, bool gridIsCurvilinear, + int uvRelativeToGrid) +{ + if (gridtype == GRID_GAUSSIAN || gridtype == GRID_GAUSSIAN_REDUCED) + ISEC2_GridType = GRIB1_GTYPE_GAUSSIAN; + else if (gridtype == GRID_LONLAT && gridIsRotated) + ISEC2_GridType = GRIB1_GTYPE_LATLON_ROT; + else + ISEC2_GridType = GRIB1_GTYPE_LATLON; + + double xfirst = 0.0, xlast = 0.0, xinc = 0.0; + double yfirst = 0.0, ylast = 0.0, yinc = 0.0; + + int nlon = (int) gridInqXsize(gridID); + int nlat = (int) gridInqYsize(gridID); + + if (gridtype == GRID_GAUSSIAN_REDUCED) + { + ISEC2_Reduced = true; + if (nlon == 2) + { + xfirst = gridInqXval(gridID, 0); + xlast = gridInqXval(gridID, 1); + } + else + { + xlast = 360.0 - 360.0 / (nlat * 2); + } + + nlon = 0; + gridInqReducedPoints(gridID, ISEC2_ReducedPointsPtr); + } + else + { + if (nlon == 0) + nlon = 1; + else + { + xfirst = gridInqXval(gridID, 0); + xlast = gridInqXval(gridID, (gridIsCurvilinear ? nlon * nlat : nlon) - 1); + xinc = fabs(gridInqXinc(gridID)); + } + } + + if (nlat == 0) + nlat = 1; + else + { + yfirst = gridInqYval(gridID, 0); + ylast = gridInqYval(gridID, (gridIsCurvilinear ? nlon * nlat : nlat) - 1); + yinc = fabs(gridInqYinc(gridID)); + } + + ISEC2_NumLon = nlon; + ISEC2_NumLat = nlat; + ISEC2_FirstLat = (int) lround(yfirst * 1000); + ISEC2_LastLat = (int) lround(ylast * 1000); + ISEC2_FirstLon = (int) lround(xfirst * 1000); + ISEC2_LastLon = (int) lround(xlast * 1000); + // gribapi gridType detector doesn't like lonIncr for Gaussian reduced longitides + if (gridtype != GRID_GAUSSIAN_REDUCED) ISEC2_LonIncr = (int) lround(xinc * 1000); + + if (gridtype == GRID_GAUSSIAN || gridtype == GRID_GAUSSIAN_REDUCED) + { + int np = gridInqNP(gridID); + if (np == 0) np = nlat / 2; + ISEC2_NumPar = np; + } + else + { + ISEC2_LatIncr = (int) lround(yinc * 1000); + } + + if (ISEC2_NumLon > 1 && ISEC2_NumLat == 1) + if (ISEC2_LonIncr != 0 && ISEC2_LatIncr == 0) ISEC2_LatIncr = ISEC2_LonIncr; + + if (ISEC2_NumLon == 1 && ISEC2_NumLat > 1) + if (ISEC2_LonIncr == 0 && ISEC2_LatIncr != 0) ISEC2_LonIncr = ISEC2_LatIncr; + + ISEC2_ResFlag = 0; + if (ISEC2_LatIncr && ISEC2_LonIncr) gribbyte_set_bit(&ISEC2_ResFlag, 1); + if (uvRelativeToGrid > 0) gribbyte_set_bit(&ISEC2_ResFlag, 5); + + if (gridIsRotated) + { + double xpole = 0, ypole = 0, angle = 0; + gridInqParamRLL(gridID, &xpole, &ypole, &angle); + + ISEC2_LatSP = -(int) lround(ypole * 1000); + ISEC2_LonSP = (int) lround((xpole + 180) * 1000); + if (fabs(angle) > 0) angle = -angle; + FSEC2_RotAngle = angle; + } + + ISEC2_ScanFlag = 0; + if (ISEC2_LastLon < ISEC2_FirstLon) gribbyte_set_bit(&ISEC2_ScanFlag, 1); // East -> West + if (ISEC2_LastLat > ISEC2_FirstLat) gribbyte_set_bit(&ISEC2_ScanFlag, 2); // South -> North +} + +static void +cgribexDefGridLambert(int *isec2, int gridID, int uvRelativeToGrid) +{ + const int xsize = (int) gridInqXsize(gridID); + const int ysize = (int) gridInqYsize(gridID); + + struct CDI_GridProjParams gpp; + gridInqParamsLCC(gridID, &gpp); + if (IS_EQUAL(gpp.x_0, gpp.mv) && IS_EQUAL(gpp.y_0, gpp.mv) && (IS_EQUAL(gpp.xval_0, gpp.mv) || IS_EQUAL(gpp.yval_0, gpp.mv))) + { + gpp.x_0 = gridInqXval(gridID, 0); + gpp.y_0 = gridInqYval(gridID, 0); + } + gridVerifyProjParamsLCC(&gpp); + + const bool lsouth = (gpp.lat_1 < 0); + if (lsouth) + { + gpp.lat_1 = -gpp.lat_2; + gpp.lat_2 = -gpp.lat_2; + } + + double xinc = gridInqXinc(gridID); + double yinc = gridInqYinc(gridID); + if (IS_EQUAL(xinc, 0.0)) xinc = gridInqXincInMeter(gridID); + if (IS_EQUAL(yinc, 0.0)) yinc = gridInqYincInMeter(gridID); + + ISEC2_GridType = GRIB1_GTYPE_LCC; + ISEC2_NumLon = xsize; + ISEC2_NumLat = ysize; + ISEC2_FirstLon = (int) lround(gpp.xval_0 * 1000); + ISEC2_FirstLat = (int) lround(gpp.yval_0 * 1000); + ISEC2_Lambert_Lov = (int) lround(gpp.lon_0 * 1000); + ISEC2_Lambert_LatS1 = (int) lround(gpp.lat_1 * 1000); + ISEC2_Lambert_LatS2 = (int) lround(gpp.lat_2 * 1000); + ISEC2_Lambert_dx = (int) lround(xinc); + ISEC2_Lambert_dy = (int) lround(yinc); + ISEC2_Lambert_LatSP = 0; + ISEC2_Lambert_LonSP = 0; + ISEC2_Lambert_ProjFlag = 0; + if (lsouth) gribbyte_set_bit(&ISEC2_Lambert_ProjFlag, 1); + + const bool earthIsOblate = (IS_EQUAL(gpp.a, 6378160.0) && IS_EQUAL(gpp.rf, 297.0)); + ISEC2_ResFlag = 0; + if (ISEC2_Lambert_dx && ISEC2_Lambert_dy) gribbyte_set_bit(&ISEC2_ResFlag, 1); + if (earthIsOblate) gribbyte_set_bit(&ISEC2_ResFlag, 2); + if (uvRelativeToGrid > 0) gribbyte_set_bit(&ISEC2_ResFlag, 5); + + ISEC2_ScanFlag = 0; + gribbyte_set_bit(&ISEC2_ScanFlag, 2); // South -> North +} + +static void +cgribexDefGridSpectal(int *isec2, int *isec4, int gridID) +{ + ISEC2_GridType = GRIB1_GTYPE_SPECTRAL; + ISEC2_PentaJ = gridInqTrunc(gridID); + ISEC2_PentaK = ISEC2_PentaJ; + ISEC2_PentaM = ISEC2_PentaJ; + ISEC2_RepType = 1; + isec4[2] = 128; + if (gridInqComplexPacking(gridID) && ISEC2_PentaJ >= 21) + { + ISEC2_RepMode = 2; + isec4[3] = 64; + isec4[16] = 0; + isec4[17] = 20; + isec4[18] = 20; + isec4[19] = 20; + } + else + { + ISEC2_RepMode = 1; + isec4[3] = 0; + } +} + +static void +cgribexDefGridGME(int *isec2, int gridID) +{ + ISEC2_GridType = GRIB1_GTYPE_GME; + int nd = 0, ni = 0, ni2 = 0, ni3 = 0; + gridInqParamGME(gridID, &nd, &ni, &ni2, &ni3); + ISEC2_GME_ND = nd; + ISEC2_GME_NI = ni; + ISEC2_GME_NI2 = ni2; + ISEC2_GME_NI3 = ni3; + ISEC2_GME_AFlag = 0; + ISEC2_GME_LatPP = 90000; + ISEC2_GME_LonPP = 0; + ISEC2_GME_LonMPL = 0; + ISEC2_GME_BFlag = 0; +} + +static void +cgribexDefGrid(int *isec1, int *isec2, double *fsec2, int *isec4, int gridID, int uvRelativeToGrid) +{ + fill_intarr(isec2, 0, 16); + ISEC1_Sec2Or3Flag = 128; + ISEC1_GridDefinition = 255; + ISEC2_Reduced = false; + ISEC2_ScanFlag = 0; + + const int gridsize = (int) gridInqSize(gridID); + bool gridIsRotated = false; + bool gridIsCurvilinear = false; + const int gridtype = grbGetGridtype(&gridID, gridsize, &gridIsRotated, &gridIsCurvilinear); + + switch (gridtype) + { + case GRID_LONLAT: + case GRID_GAUSSIAN: + case GRID_GAUSSIAN_REDUCED: + case GRID_TRAJECTORY: + { + cgribexDefGridRegular(isec2, fsec2, gridID, gridtype, gridIsRotated, gridIsCurvilinear, uvRelativeToGrid); + break; + } + case CDI_PROJ_LCC: + { + cgribexDefGridLambert(isec2, gridID, uvRelativeToGrid); + break; + } + case GRID_SPECTRAL: + { + cgribexDefGridSpectal(isec2, isec4, gridID); + break; + } + case GRID_GME: + { + cgribexDefGridGME(isec2, gridID); + break; + } + case GRID_GENERIC: + { + ISEC1_Sec2Or3Flag = 0; + break; + } + default: + { + static bool lwarn = true; + ISEC1_Sec2Or3Flag = 0; + if (lwarn) Warning("CGRIBEX library doesn't support %s grids, grid information will be lost!", gridNamePtr(gridtype)); + lwarn = false; + break; + } + } +} + +static int +level2int(double level) +{ + return (int) round(level); +} + +static void +isec1DefLevel(int *isec1, int leveltype, int level1, int level2) +{ + ISEC1_LevelType = leveltype; + ISEC1_Level1 = level1; + ISEC1_Level2 = level2; +} + +static void +cgribexDefLevel(int *isec1, int *isec2, double *fsec2, int zaxisID, int levelID) +{ + int zaxistype = zaxisInqType(zaxisID); + int ltype = 0; + cdiInqKeyInt(zaxisID, CDI_GLOBAL, CDI_KEY_TYPEOFFIRSTFIXEDSURFACE, <ype); + + const bool hasBounds = (zaxisInqLbounds(zaxisID, NULL) && zaxisInqUbounds(zaxisID, NULL)); + double level = zaxisInqLevels(zaxisID, NULL) ? zaxisInqLevel(zaxisID, levelID) : levelID + 1; + const double dlevel1 = hasBounds ? zaxisInqLbound(zaxisID, levelID) : level; + const double dlevel2 = hasBounds ? zaxisInqUbound(zaxisID, levelID) : 0.0; + + if (zaxistype == ZAXIS_GENERIC && ltype == 0) + { + Warning("Changed zaxis type from %s to %s", zaxisNamePtr(zaxistype), zaxisNamePtr(ZAXIS_PRESSURE)); + zaxistype = ZAXIS_PRESSURE; + zaxisChangeType(zaxisID, zaxistype); + cdiDefKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_UNITS, "Pa"); + } + + ISEC2_NumVCP = 0; + + int grib_ltype = zaxisTypeToGrib1ltype(zaxistype); + + switch (zaxistype) + { + case ZAXIS_SURFACE: + case ZAXIS_MEANSEA: + case ZAXIS_ALTITUDE: + case ZAXIS_DEPTH_BELOW_SEA: + case ZAXIS_ISENTROPIC: + { + isec1DefLevel(isec1, grib_ltype, level2int(level), 0); + break; + } + case ZAXIS_CLOUD_BASE: + case ZAXIS_CLOUD_TOP: + case ZAXIS_ISOTHERM_ZERO: + case ZAXIS_TROPOPAUSE: + case ZAXIS_TOA: + case ZAXIS_SEA_BOTTOM: + case ZAXIS_ATMOSPHERE: + { + isec1DefLevel(isec1, grib_ltype, 0, 0); + break; + } + case ZAXIS_HYBRID: + case ZAXIS_HYBRID_HALF: + { + grib_ltype = hasBounds ? GRIB1_LTYPE_HYBRID_LAYER : GRIB1_LTYPE_HYBRID; + isec1DefLevel(isec1, grib_ltype, level2int(dlevel1), level2int(dlevel2)); + + int vctsize = zaxisInqVctSize(zaxisID); + if (vctsize > 255) + { + static bool lwarning_vct = true; + ISEC2_NumVCP = 0; + if (lwarning_vct) + { + Warning("VCT size of %d is too large (maximum is 255). Set to 0!", vctsize); + lwarning_vct = false; + } + } + else + { + ISEC2_NumVCP = vctsize; + zaxisInqVct(zaxisID, &fsec2[10]); + } + break; + } + case ZAXIS_PRESSURE: + { + if (level < 0) Warning("Pressure level of %f Pa is below zero!", level); + + if (!zaxis_units_is_Pa(zaxisID)) level *= 100.0; + + double dum; + if (level < 32768 && (level < 100 || modf(level / 100, &dum) > 0)) + grib_ltype = GRIB1_LTYPE_ISOBARIC_PA; + else + level = level / 100; + + isec1DefLevel(isec1, grib_ltype, level2int(level), 0); + break; + } + case ZAXIS_HEIGHT: + { + double sf = zaxis_units_to_meter(zaxisID); + isec1DefLevel(isec1, grib_ltype, level2int(level * sf), 0); + break; + } + case ZAXIS_SIGMA: + { + grib_ltype = hasBounds ? GRIB1_LTYPE_SIGMA_LAYER : GRIB1_LTYPE_SIGMA; + isec1DefLevel(isec1, grib_ltype, level2int(dlevel1), level2int(dlevel2)); + break; + } + case ZAXIS_DEPTH_BELOW_LAND: + { + grib_ltype = hasBounds ? GRIB1_LTYPE_LANDDEPTH_LAYER : GRIB1_LTYPE_LANDDEPTH; + double sf = zaxis_units_to_centimeter(zaxisID); + isec1DefLevel(isec1, grib_ltype, level2int(sf * dlevel1), level2int(sf * dlevel2)); + break; + } + case ZAXIS_GENERIC: + { + isec1DefLevel(isec1, ltype, level2int(level), 0); + break; + } + default: + { + Error("Unsupported zaxis type: %s", zaxisNamePtr(zaxistype)); + break; + } + } +} + +static void +cgribexDefaultSec0(int *isec0) +{ + ISEC0_GRIB_Len = 0; + ISEC0_GRIB_Version = 0; +} + +static void +cgribexDefaultSec1(int *isec1) +{ + ISEC1_CenterID = 0; + ISEC1_SubCenterID = 0; + ISEC1_LocalFLag = 0; +} + +static void +cgribexDefaultSec4(int *isec4) +{ + for (int i = 2; i <= 10; ++i) isec4[i] = 0; +} + +static void +cgribexDefEnsembleVar(int *isec1, int vlistID, int varID) +{ + // For Ensemble info + + // Put1Byte(isec1[36]); // MPIM local GRIB use definition identifier (extension identifier) + // Put1Byte(isec1[37]); // type of ensemble forecast + // Put2Byte(isec1[38]); // individual ensemble member + // Put2Byte(isec1[39]); // number of forecasts in ensemble + + int perturbationNumber, numberOfForecastsInEnsemble, typeOfEnsembleForecast; + const int r1 = cdiInqKeyInt(vlistID, varID, CDI_KEY_PERTURBATIONNUMBER, &perturbationNumber); + const int r2 = cdiInqKeyInt(vlistID, varID, CDI_KEY_NUMBEROFFORECASTSINENSEMBLE, &numberOfForecastsInEnsemble); + const int r3 = cdiInqKeyInt(vlistID, varID, CDI_KEY_TYPEOFENSEMBLEFORECAST, &typeOfEnsembleForecast); + + if (r1 == 0 && r2 == 0 && r3 == 0) + { + if (ISEC1_CenterID == 252) + { + ISEC1_LocalFLag = 1; + isec1[36] = 1; + isec1[37] = typeOfEnsembleForecast; + isec1[38] = perturbationNumber; + isec1[39] = numberOfForecastsInEnsemble; + } + } +} + +size_t +cgribexEncode(int memtype, int varID, int levelID, int vlistID, int gridID, int zaxisID, CdiDateTime vDateTime, int tsteptype, + int numavg, size_t datasize, const void *data, size_t nmiss, void *gribbuffer, size_t gribbuffersize) +{ + cgribexrec_t *cgribexp = (cgribexrec_t *) cgribexNew(); + + const size_t sec2len = 1024 + 2 * gridInqYsize(gridID); // Gaussian reduced grid + if (sec2len > cgribexp->sec2len) + { + cgribexp->sec2len = sec2len; + cgribexp->sec2 = (int *) Realloc(cgribexp->sec2, sec2len * sizeof(int)); + } + + int *isec0 = cgribexp->sec0; + int *isec1 = cgribexp->sec1; + int *isec2 = cgribexp->sec2; + int *isec3 = cgribexp->sec3; + int *isec4 = cgribexp->sec4; + double *fsec2 = cgribexp->fsec2; + double *fsec3 = cgribexp->fsec3; + float fsec2f[sizeof(cgribexp->fsec2) / sizeof(double)]; + float fsec3f[sizeof(cgribexp->fsec3) / sizeof(double)]; + + fill_intarr(isec1, 0, 256); + fsec2[0] = 0; + fsec2[1] = 0; + fsec2f[0] = 0; + fsec2f[1] = 0; + + const int gribsize = (int) (gribbuffersize / sizeof(int)); + const int param = vlistInqVarParam(vlistID, varID); + + cgribexDefaultSec0(isec0); + cgribexDefaultSec1(isec1); + cgribexDefaultSec4(isec4); + + cgribexDefInstitut(isec1, vlistID, varID); + cgribexDefModel(isec1, vlistID, varID); + + const int datatype = vlistInqVarDatatype(vlistID, varID); + + int uvRelativeToGrid = -1; + cdiInqKeyInt(vlistID, varID, CDI_KEY_UVRELATIVETOGRID, &uvRelativeToGrid); + + cgribexDefParam(isec1, param); + cgribexDefTime(isec1, vDateTime, tsteptype, numavg, vlistInqTaxis(vlistID)); + cgribexDefGrid(isec1, isec2, fsec2, isec4, gridID, uvRelativeToGrid); + cgribexDefLevel(isec1, isec2, fsec2, zaxisID, levelID); + + cgribexDefEnsembleVar(isec1, vlistID, varID); + + cdi_check_gridsize_int_limit("GRIB1", datasize); + + ISEC4_NumValues = (int) datasize; + ISEC4_NumBits = grbBitsPerValue(datatype); + + if (nmiss > 0) + { + FSEC3_MissVal = vlistInqVarMissval(vlistID, varID); + ISEC1_Sec2Or3Flag |= 64; + } + + if (isec4[2] == 128 && isec4[3] == 64) + { + if (memtype == MEMTYPE_FLOAT) + isec4[16] = (int) (1000 * calculate_pfactor_float((const float *) data, ISEC2_PentaJ, isec4[17])); + else + isec4[16] = (int) (1000 * calculate_pfactor_double((const double *) data, ISEC2_PentaJ, isec4[17])); + if (isec4[16] < -10000) isec4[16] = -10000; + if (isec4[16] > 10000) isec4[16] = 10000; + } + // printf("isec4[16] %d\n", isec4[16]); + + if (memtype == MEMTYPE_FLOAT) + { + int numVCP = (ISEC2_NumVCP > 0) ? ISEC2_NumVCP : 0; + for (int i = 0; i < numVCP; ++i) fsec2f[10 + i] = (float) fsec2[10 + i]; + fsec3f[1] = (float) fsec3[1]; + } + + int iret = 0, iword = 0; + if (memtype == MEMTYPE_FLOAT) + gribExSP(isec0, isec1, isec2, fsec2f, isec3, fsec3f, isec4, (float *) data, (int) datasize, (int *) gribbuffer, gribsize, + &iword, "C", &iret); + else + gribExDP(isec0, isec1, isec2, fsec2, isec3, fsec3, isec4, (double *) data, (int) datasize, (int *) gribbuffer, gribsize, &iword, + "C", &iret); + + cgribexDelete(cgribexp); + + if (iret) Error("Problem during GRIB encode (errno = %d)!", iret); + + const size_t nbytes = (size_t) iword * sizeof(int); + return nbytes; +} + +void +cgribexChangeParameterIdentification(void *gh, int code, int ltype, int lev) +{ + if (!gh) return; + + unsigned char *pds = ((cgribex_handle *) gh)->pds; + if (!pds) return; + + pds[8] = (unsigned char) code; + pds[9] = (unsigned char) ltype; + pds[10] = (unsigned char) lev; +} + +#endif +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifdef HAVE_CONFIG_H +#endif + + + +#ifdef HAVE_LIBEXTRA + +static int +extInqDatatype(int prec, int number) +{ + if (number == 2) + return (prec == EXSE_DOUBLE_PRECISION) ? CDI_DATATYPE_CPX64 : CDI_DATATYPE_CPX32; + else + return (prec == EXSE_DOUBLE_PRECISION) ? CDI_DATATYPE_FLT64 : CDI_DATATYPE_FLT32; +} + +static void +extDefDatatype(int datatype, int *prec, int *number) +{ + if (datatype != CDI_DATATYPE_FLT32 && datatype != CDI_DATATYPE_FLT64 && datatype != CDI_DATATYPE_CPX32 + && datatype != CDI_DATATYPE_CPX64) + datatype = CDI_DATATYPE_FLT32; + + *number = (datatype == CDI_DATATYPE_CPX32 || datatype == CDI_DATATYPE_CPX64) ? 2 : 1; + + *prec = (datatype == CDI_DATATYPE_FLT64 || datatype == CDI_DATATYPE_CPX64) ? EXSE_DOUBLE_PRECISION : EXSE_SINGLE_PRECISION; +} + +/* not used +int extInqRecord(stream_t *streamptr, int *varID, int *levelID) +{ + int status; + int fileID; + int icode, ilevel; + int zaxisID = -1; + int header[4]; + int vlistID; + void *extp = streamptr->record->objectp; + + vlistID = streamptr->vlistID; + fileID = streamptr->fileID; + + *varID = -1; + *levelID = -1; + + status = extRead(fileID, extp); + if ( status != 0 ) return 0; + + extInqHeader(extp, header); + + icode = header[1]; + ilevel = header[2]; + + *varID = vlistInqVarID(vlistID, icode); + + if ( *varID == CDI_UNDEFID ) Error("Code %d undefined", icode); + + zaxisID = vlistInqVarZaxis(vlistID, *varID); + + *levelID = zaxisInqLevelID(zaxisID, (double) ilevel); + + return 1; +} +*/ + +static void +ext_read_recordSP(stream_t *streamptr, float *data, size_t *nmiss) +{ + int vlistID = streamptr->vlistID; + int fileID = streamptr->fileID; + int tsID = streamptr->curTsID; + + int vrecID = streamptr->tsteps[tsID].curRecID; + int recID = streamptr->tsteps[tsID].recIDs[vrecID]; + int varID = streamptr->tsteps[tsID].records[recID].varID; + off_t recpos = streamptr->tsteps[tsID].records[recID].position; + + fileSetPos(fileID, recpos, SEEK_SET); + + void *extp = streamptr->record->objectp; + if (extRead(fileID, extp) < 0) Error("Failed to read EXTRA record"); + + int header[4]; + extInqHeader(extp, header); + extInqDataSP(extp, data); + + double missval = vlistInqVarMissval(vlistID, varID); + size_t size = gridInqSize(vlistInqVarGrid(vlistID, varID)); + + if (vlistInqVarNumber(vlistID, varID) == CDI_REAL) + *nmiss = get_num_missvalsSP(size, data, missval); + else + *nmiss = get_cplx_num_missvalsSP(size, data, missval); + + streamptr->numvals += size; +} + +static void +ext_read_recordDP(stream_t *streamptr, double *data, size_t *nmiss) +{ + int vlistID = streamptr->vlistID; + int fileID = streamptr->fileID; + int tsID = streamptr->curTsID; + + int vrecID = streamptr->tsteps[tsID].curRecID; + int recID = streamptr->tsteps[tsID].recIDs[vrecID]; + int varID = streamptr->tsteps[tsID].records[recID].varID; + off_t recpos = streamptr->tsteps[tsID].records[recID].position; + + fileSetPos(fileID, recpos, SEEK_SET); + + void *extp = streamptr->record->objectp; + if (extRead(fileID, extp) < 0) Error("Failed to read EXTRA record"); + + int header[4]; + extInqHeader(extp, header); + extInqDataDP(extp, data); + + double missval = vlistInqVarMissval(vlistID, varID); + size_t size = gridInqSize(vlistInqVarGrid(vlistID, varID)); + + if (vlistInqVarNumber(vlistID, varID) == CDI_REAL) + *nmiss = get_num_missvalsDP(size, data, missval); + else + *nmiss = get_cplx_num_missvalsDP(size, data, missval); + + streamptr->numvals += size; +} + +void +ext_read_record(stream_t *streamptr, int memtype, void *data, size_t *nmiss) +{ + if (memtype == MEMTYPE_DOUBLE) + ext_read_recordDP(streamptr, (double *) data, nmiss); + else + ext_read_recordSP(streamptr, (float *) data, nmiss); +} + +void +extCopyRecord(stream_t *streamptr2, stream_t *streamptr1) +{ + streamFCopyRecord(streamptr2, streamptr1, "EXTRA"); +} + +void +extDefRecord(stream_t *streamptr) +{ + Record *record = streamptr->record; + + int pdis, pcat, pnum; + cdiDecodeParam(record->param, &pnum, &pcat, &pdis); + + int header[4]; + header[0] = record->vdate; + header[1] = pnum; + header[2] = record->ilevel; + int gridID = record->gridID; + cdi_check_gridsize_int_limit("EXTRA", gridInqSize(gridID)); + header[3] = (int) gridInqSize(gridID); + + extrec_t *extp = (extrec_t *) record->objectp; + extDefDatatype(record->prec, &extp->prec, &extp->number); + extDefHeader(extp, header); +} + +static void +ext_write_recordSP(stream_t *streamptr, const float *data) +{ + void *extp = streamptr->record->objectp; + extDefDataSP(extp, data); + extWrite(streamptr->fileID, extp); +} + +static void +ext_write_recordDP(stream_t *streamptr, const double *data) +{ + void *extp = streamptr->record->objectp; + extDefDataDP(extp, data); + extWrite(streamptr->fileID, extp); +} + +void +ext_write_record(stream_t *streamptr, int memtype, const void *data) +{ + if (memtype == MEMTYPE_DOUBLE) + ext_write_recordDP(streamptr, (const double *) data); + else + ext_write_recordSP(streamptr, (const float *) data); +} + +static void +extAddRecord(stream_t *streamptr, int param, int level, size_t xysize, size_t recsize, off_t position, int prec, int number) +{ + int vlistID = streamptr->vlistID; + int tsID = streamptr->curTsID; + int recID = recordNewEntry(streamptr, tsID); + record_t *record = &streamptr->tsteps[tsID].records[recID]; + + record->size = recsize; + record->position = position; + record->param = param; + record->ilevel = level; + + grid_t *grid = (grid_t *) Malloc(sizeof(*grid)); + grid_init(grid); + cdiGridTypeInit(grid, GRID_GENERIC, xysize); + grid->x.size = xysize; + grid->y.size = 0; + struct addIfNewRes gridAdded = cdiVlistAddGridIfNew(vlistID, grid, 0); + int gridID = gridAdded.Id; + if (!gridAdded.isNew) + { + grid_free(grid); + Free(grid); + } + + int leveltype = ZAXIS_GENERIC; + int datatype = extInqDatatype(prec, number); + + int varID, levelID = 0; + varAddRecord(recID, param, gridID, leveltype, 0, level, 0, 0, 0, datatype, &varID, &levelID, TSTEP_INSTANT, 0, -1, NULL, NULL, + NULL, NULL); + + record->varID = (short) varID; + record->levelID = levelID; + + streamptr->tsteps[tsID].nallrecs++; + streamptr->nrecs++; + + if (CDI_Debug) Message("varID = %d gridID = %d levelID = %d", varID, gridID, levelID); +} + +static void +extScanTimestep1(stream_t *streamptr) +{ + CdiDateTime datetime0; + cdiDateTime_init(&datetime0); + int header[4]; + off_t recpos = 0; + extrec_t *extp = (extrec_t *) streamptr->record->objectp; + + streamptr->curTsID = 0; + + int tsID = tstepsNewEntry(streamptr); + if (tsID != 0) Error("Internal problem! tstepsNewEntry returns %d", tsID); + taxis_t *taxis = &streamptr->tsteps[tsID].taxis; + + int fileID = streamptr->fileID; + + int nrecs = 0; + while (true) + { + recpos = fileGetPos(fileID); + if (extRead(fileID, extp) != 0) + { + streamptr->ntsteps = 1; + break; + } + + size_t recsize = (size_t) (fileGetPos(fileID) - recpos); + + extInqHeader(extp, header); + + int vdate = header[0]; + int vtime = 0; + int rcode = header[1]; + int rlevel = header[2]; + int rxysize = header[3]; + int param = cdiEncodeParam(rcode, 255, 255); + CdiDateTime datetime = cdiDateTime_set(vdate, vtime); + + if (nrecs == 0) + { + datetime0 = datetime; + taxis->vDateTime = datetime; + } + else + { + record_t *records = streamptr->tsteps[tsID].records; + for (int recID = 0; recID < nrecs; recID++) + if (param == records[recID].param && rlevel == records[recID].ilevel) goto tstepScanLoopFinished; + + if (cdiDateTime_isNE(datetime, datetime0)) Warning("Inconsistent verification time for code %d level %d", rcode, rlevel); + } + + nrecs++; + + if (CDI_Debug) Message("%4d%8d%4d%8d%8d%6d", nrecs, (int) recpos, rcode, rlevel, vdate, vtime); + + extAddRecord(streamptr, param, rlevel, rxysize, recsize, recpos, extp->prec, extp->number); + } + +tstepScanLoopFinished: + streamptr->rtsteps = 1; + + cdi_generate_vars(streamptr); + + int taxisID = taxisCreate(TAXIS_ABSOLUTE); + taxis->type = TAXIS_ABSOLUTE; + taxis->rDateTime = taxis->vDateTime; + + int vlistID = streamptr->vlistID; + vlistDefTaxis(vlistID, taxisID); + + vlist_check_contents(vlistID); + + streamScanResizeRecords1(streamptr); + + streamScanTsFixNtsteps(streamptr, recpos); + streamScanTimeConstAdjust(streamptr, taxis); +} + +static int +extScanTimestep2(stream_t *streamptr) +{ + int header[4]; + off_t recpos = 0; + void *extp = streamptr->record->objectp; + + streamptr->curTsID = 1; + + int fileID = streamptr->fileID; + int vlistID = streamptr->vlistID; + + int tsID = streamptr->rtsteps; + if (tsID != 1) Error("Internal problem! unexpected timestep %d", tsID + 1); + + taxis_t *taxis = &streamptr->tsteps[tsID].taxis; + + fileSetPos(fileID, streamptr->tsteps[tsID].position, SEEK_SET); + + cdi_create_records(streamptr, tsID); + record_t *records = streamptr->tsteps[tsID].records; + + int nrecords = streamScanInitRecords2(streamptr); + + for (int rindex = 0; rindex <= nrecords; rindex++) + { + recpos = fileGetPos(fileID); + if (extRead(fileID, extp) != 0) + { + streamptr->ntsteps = 2; + break; + } + + size_t recsize = (size_t) (fileGetPos(fileID) - recpos); + + extInqHeader(extp, header); + + int vdate = header[0]; + int vtime = 0; + int rcode = header[1]; + int rlevel = header[2]; + int param = cdiEncodeParam(rcode, 255, 255); + + if (rindex == 0) + { + taxis->type = TAXIS_ABSOLUTE; + taxis->vDateTime = cdiDateTime_set(vdate, vtime); + } + + bool nextstep = false; + int recID; + for (recID = 0; recID < nrecords; recID++) + { + if (param == records[recID].param && rlevel == records[recID].ilevel) + { + if (records[recID].used) + { + nextstep = true; + } + else + { + records[recID].used = true; + streamptr->tsteps[tsID].recIDs[rindex] = recID; + } + break; + } + } + if (recID == nrecords) + { + Warning("Code %d level %d not found at timestep %d", rcode, rlevel, tsID + 1); + return CDI_EUFSTRUCT; + } + + if (nextstep) break; + + if (CDI_Debug) Message("%4d%8d%4d%8d%8d%6d", rindex + 1, (int) recpos, rcode, rlevel, vdate, vtime); + + if (param != records[recID].param || rlevel != records[recID].ilevel) + { + Message("tsID = %d recID = %d param = %3d new %3d level = %3d new %3d", tsID, recID, records[recID].param, param, + records[recID].ilevel, rlevel); + return CDI_EUFSTRUCT; + } + + records[recID].position = recpos; + records[recID].size = recsize; + } + + int nrecs = 0; + for (int recID = 0; recID < nrecords; recID++) + { + if (records[recID].used) + nrecs++; + else + vlistDefVarTimetype(vlistID, records[recID].varID, TIME_CONSTANT); + } + streamptr->tsteps[tsID].nrecs = nrecs; + + streamptr->rtsteps = 2; + + streamScanTsFixNtsteps(streamptr, recpos); + + return 0; +} + +int +extInqContents(stream_t *streamptr) +{ + streamptr->curTsID = 0; + + extScanTimestep1(streamptr); + + int status = (streamptr->ntsteps == -1) ? extScanTimestep2(streamptr) : 0; + + fileSetPos(streamptr->fileID, 0, SEEK_SET); + + return status; +} + +static long +extScanTimestep(stream_t *streamptr) +{ + int header[4]; + off_t recpos = 0; + int nrecs = 0; + void *extp = streamptr->record->objectp; + + int tsID = streamptr->rtsteps; + taxis_t *taxis = &streamptr->tsteps[tsID].taxis; + + if (streamptr->tsteps[tsID].recordSize == 0) + { + cdi_create_records(streamptr, tsID); + record_t *records = streamptr->tsteps[tsID].records; + + nrecs = streamScanInitRecords(streamptr, tsID); + + int fileID = streamptr->fileID; + + fileSetPos(fileID, streamptr->tsteps[tsID].position, SEEK_SET); + + for (int rindex = 0; rindex <= nrecs; rindex++) + { + recpos = fileGetPos(fileID); + if (extRead(fileID, extp) != 0) + { + streamptr->ntsteps = streamptr->rtsteps + 1; + break; + } + + size_t recsize = (size_t) (fileGetPos(fileID) - recpos); + + extInqHeader(extp, header); + + int vdate = header[0]; + int vtime = 0; + int rcode = header[1]; + int rlevel = header[2]; + int param = cdiEncodeParam(rcode, 255, 255); + + // if ( rindex == nrecs ) break; gcc-4.5 internal compiler error + if (rindex == nrecs) continue; + int recID = streamptr->tsteps[tsID].recIDs[rindex]; + + if (rindex == 0) + { + taxis->type = TAXIS_ABSOLUTE; + taxis->vDateTime = cdiDateTime_set(vdate, vtime); + } + + if (param != records[recID].param || rlevel != records[recID].ilevel) + { + Message("tsID = %d recID = %d param = %3d new %3d level = %3d new %3d", tsID, recID, records[recID].param, param, + records[recID].ilevel, rlevel); + Error("Invalid, unsupported or inconsistent record structure!"); + } + + records[recID].position = recpos; + records[recID].size = recsize; + + if (CDI_Debug) Message("%4d%8d%4d%8d%8d%6d", rindex, (int) recpos, rcode, rlevel, vdate, vtime); + } + + streamptr->rtsteps++; + + if (streamptr->ntsteps != streamptr->rtsteps) + { + tsID = tstepsNewEntry(streamptr); + if (tsID != streamptr->rtsteps) Error("Internal error. tsID = %d", tsID); + + streamptr->tsteps[tsID - 1].next = true; + streamptr->tsteps[tsID].position = recpos; + } + + fileSetPos(fileID, streamptr->tsteps[tsID].position, SEEK_SET); + streamptr->tsteps[tsID].position = recpos; + } + + if (nrecs > 0 && nrecs < streamptr->tsteps[tsID].nrecs) + { + Warning("Incomplete timestep. Stop scanning at timestep %d.", tsID); + streamptr->ntsteps = tsID; + } + + return streamptr->ntsteps; +} + +int +extInqTimestep(stream_t *streamptr, int tsID) +{ + if (tsID == 0 && streamptr->rtsteps == 0) Error("Call to cdiInqContents missing!"); + + if (CDI_Debug) Message("tsID = %d rtsteps = %d", tsID, streamptr->rtsteps); + + long ntsteps = CDI_UNDEFID; + while ((tsID + 1) > streamptr->rtsteps && ntsteps == CDI_UNDEFID) ntsteps = extScanTimestep(streamptr); + + int nrecs = 0; + if (!(tsID >= streamptr->ntsteps && streamptr->ntsteps != CDI_UNDEFID)) + { + streamptr->curTsID = tsID; + nrecs = streamptr->tsteps[tsID].nrecs; + } + + return nrecs; +} + +void +extReadVarSliceDP(stream_t *streamptr, int varID, int levID, double *data, size_t *nmiss) +{ + if (CDI_Debug) Message("streamID = %d varID = %d levID = %d", streamptr->self, varID, levID); + + void *extp = streamptr->record->objectp; + + int vlistID = streamptr->vlistID; + int fileID = streamptr->fileID; + + double missval = vlistInqVarMissval(vlistID, varID); + size_t gridsize = gridInqSize(vlistInqVarGrid(vlistID, varID)); + int tsid = streamptr->curTsID; + + off_t currentfilepos = fileGetPos(fileID); + + int recID = streamptr->vars[varID].recordTable[0].recordID[levID]; + off_t recpos = streamptr->tsteps[tsid].records[recID].position; + fileSetPos(fileID, recpos, SEEK_SET); + extRead(fileID, extp); + int header[4]; + extInqHeader(extp, header); + extInqDataDP(extp, data); + + fileSetPos(fileID, currentfilepos, SEEK_SET); + + if (vlistInqVarNumber(vlistID, varID) == CDI_REAL) + *nmiss = get_num_missvalsDP(gridsize, data, missval); + else + *nmiss = get_cplx_num_missvalsDP(gridsize, data, missval); +} + +void +extReadVarDP(stream_t *streamptr, int varID, double *data, size_t *nmiss) +{ + if (CDI_Debug) Message("streamID = %d varID = %d", streamptr->self, varID); + + int vlistID = streamptr->vlistID; + size_t gridsize = gridInqSize(vlistInqVarGrid(vlistID, varID)); + size_t nlevs = (size_t) streamptr->vars[varID].recordTable[0].nlevs; + + for (size_t levID = 0; levID < nlevs; levID++) extReadVarSliceDP(streamptr, varID, (int) levID, &data[levID * gridsize], nmiss); +} + +void +extWriteVarSliceDP(stream_t *streamptr, int varID, int levID, const double *data) +{ + if (CDI_Debug) Message("streamID = %d varID = %d levID = %d", streamptr->self, varID, levID); + + int vlistID = streamptr->vlistID; + int fileID = streamptr->fileID; + int tsID = streamptr->curTsID; + CdiDateTime vDateTime = streamptr->tsteps[tsID].taxis.vDateTime; + + int pdis, pcat, pnum; + cdiDecodeParam(vlistInqVarParam(vlistID, varID), &pnum, &pcat, &pdis); + + int header[4]; + header[0] = (int) cdiDate_get(vDateTime.date); + header[1] = pnum; + header[2] = (int) lround(zaxisInqLevel(vlistInqVarZaxis(vlistID, varID), levID)); + int gridID = vlistInqVarGrid(vlistID, varID); + cdi_check_gridsize_int_limit("EXTRA", gridInqSize(gridID)); + header[3] = (int) gridInqSize(gridID); + + extrec_t *extp = (extrec_t *) streamptr->record->objectp; + extDefDatatype(vlistInqVarDatatype(vlistID, varID), &extp->prec, &extp->number); + extDefHeader(extp, header); + + extDefDataDP(extp, data); + extWrite(fileID, extp); +} + +void +extWriteVarDP(stream_t *streamptr, int varID, const double *data) +{ + if (CDI_Debug) Message("streamID = %d varID = %d", streamptr->self, varID); + + int vlistID = streamptr->vlistID; + size_t gridsize = gridInqSize(vlistInqVarGrid(vlistID, varID)); + size_t nlevs = (size_t) zaxisInqSize(vlistInqVarZaxis(vlistID, varID)); + + for (size_t levID = 0; levID < nlevs; levID++) extWriteVarSliceDP(streamptr, varID, (int) levID, &data[levID * gridsize]); +} + +#endif /* HAVE_LIBEXTRA */ + +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifndef STREAM_GRIBAPI_H +#define STREAM_GRIBAPI_H + +#ifdef HAVE_LIBGRIB_API + + +int fdbScanTimesteps(stream_t *streamptr); + +int gribapiScanTimestep1(stream_t *streamptr); +int gribapiScanTimestep2(stream_t *streamptr); +int gribapiScanTimestep(stream_t *streamptr); + +int gribapiDecode(void *gribbuffer, size_t gribsize, void *data, size_t datasize, int unreduced, size_t *nmiss, double missval); + +size_t gribapiEncode(int varID, int levelID, int vlistID, int gridID, int zaxisID, CdiDateTime vDateTime, int tsteptype, int numavg, + size_t datasize, const void *data, size_t nmiss, void **gribbuffer, size_t *gribbuffersize, int ljpeg, + void *gribContainer); + +int gribapiGetScanningMode(grib_handle *gh); +void gribapiSetScanningMode(grib_handle *gh, int scanningMode); + +void gribapiChangeParameterIdentification(grib_handle *gh, int code, int ltype, int lev); + +#endif + +#endif /* STREAM_GRIBAPI_H */ +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifdef HAVE_CONFIG_H +#endif + + +int cdiDebugExt = 0; // Debug level for the KNMI extensions +#ifdef HIRLAM_EXTENSIONS +// *** RELATED to GRIB only *** +int cdiGribUseTimeRangeIndicator = 0; // normaly cdo looks in grib for attribute called "stepType" + // but NWP models such as Harmonie 37h1.2, use "timeRangeIndicator" + // where: 0: for instanteneous fields; 4: for accumulated fields +#endif // HIRLAM_EXTENSIONS + +double +zaxis_units_to_centimeter(int zaxisID) +{ + char units[CDI_MAX_NAME]; + int length = CDI_MAX_NAME; + cdiInqKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_UNITS, units, &length); + + double sf = 100.0; // default: meter + // clang-format off + if (units[1] == 'm' && !units[2]) + { + if (units[0] == 'm') sf = 0.1; + else if (units[0] == 'c') sf = 1; + else if (units[0] == 'd') sf = 10; + } + // clang-format on + + return sf; +} + +double +zaxis_units_to_meter(int zaxisID) +{ + char units[CDI_MAX_NAME]; + int length = CDI_MAX_NAME; + cdiInqKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_UNITS, units, &length); + + double sf = 1.0; // default: meter + // clang-format off + if (units[1] == 'm' && !units[2]) + { + if (units[0] == 'm') sf /= 1000.0; + else if (units[0] == 'c') sf /= 100.0; + else if (units[0] == 'd') sf /= 10.0; + else if (units[0] == 'k') sf *= 1000.0; + } + // clang-format on + + return sf; +} + +bool +zaxis_units_is_Pa(int zaxisID) +{ + char units[CDI_MAX_NAME]; + int length = CDI_MAX_NAME; + cdiInqKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_UNITS, units, &length); + + return (units[0] && (units[0] == 'P') && (units[1] == 'a')); +} + +void +ensureBufferSize(size_t requiredSize, size_t *curSize, void **buffer) +{ + if (*curSize < requiredSize) + { + *curSize = requiredSize; + *buffer = Realloc(*buffer, *curSize); + } +} + +int +grbDecompress(size_t recsize, size_t *buffersize, void **gribbuffer) +{ + int comptype = CDI_COMPRESS_NONE; + + size_t unzipsize; + if (gribGetZip(recsize, (unsigned char *) *gribbuffer, &unzipsize) > 0) + { + comptype = CDI_COMPRESS_SZIP; + unzipsize += 100; /* need 0 to 1 bytes for rounding of bds */ + ensureBufferSize(unzipsize, buffersize, gribbuffer); + } + + return comptype; +} + +// Regarding operation to change parameter identification: +// change if cdiGribChangeParameterID.active +struct cdiGribParamChange cdiGribChangeParameterID; + +// Used only for CDO module Selmulti +void +streamGrbChangeParameterIdentification(int code, int ltype, int lev) +{ + // NOTE this is a "PROXY" function for gribapiChangeParameterIdentification(); + // This just sets the globals. There are probably better solutions to this. + // The parameter change is done by function gribapiChangeParameterIdentification() in stream_gribapi.c + // Setting this control variable to true will cause calling fnc. gribapiChangeParameterIdentification later. + // After grib attributes have been changed this variable goes to false. + cdiGribChangeParameterID.active = true; + cdiGribChangeParameterID.code = code; + cdiGribChangeParameterID.ltype = ltype; + cdiGribChangeParameterID.lev = lev; +} + +struct cdiGribScanModeChange cdiGribDataScanningMode; + +void +streamGrbDefDataScanningMode(int scanmode) +{ + cdiGribDataScanningMode.active = true; + cdiGribDataScanningMode.value = scanmode; +} + +enum +{ + MapKey = 0, + MapValue = 1 +}; + +static const int grib1ltypeMap[][2] = { + // clang-format off + { GRIB1_LTYPE_SURFACE, ZAXIS_SURFACE }, + { GRIB1_LTYPE_CLOUD_BASE, ZAXIS_CLOUD_BASE }, + { GRIB1_LTYPE_CLOUD_TOP, ZAXIS_CLOUD_TOP }, + { GRIB1_LTYPE_ISOTHERM0, ZAXIS_ISOTHERM_ZERO }, + { GRIB1_LTYPE_TROPOPAUSE, ZAXIS_TROPOPAUSE }, + { GRIB1_LTYPE_TOA, ZAXIS_TOA }, + { GRIB1_LTYPE_SEA_BOTTOM, ZAXIS_SEA_BOTTOM }, + { GRIB1_LTYPE_ATMOSPHERE, ZAXIS_ATMOSPHERE }, + { GRIB1_LTYPE_ISOBARIC, ZAXIS_PRESSURE }, + { GRIB1_LTYPE_99, ZAXIS_PRESSURE }, + { GRIB1_LTYPE_ISOBARIC_PA, ZAXIS_PRESSURE }, + { GRIB1_LTYPE_MEANSEA, ZAXIS_MEANSEA }, + { GRIB1_LTYPE_ALTITUDE, ZAXIS_ALTITUDE }, + { GRIB1_LTYPE_HEIGHT, ZAXIS_HEIGHT }, + { GRIB1_LTYPE_SIGMA, ZAXIS_SIGMA }, + { GRIB1_LTYPE_SIGMA_LAYER, ZAXIS_SIGMA }, + { GRIB1_LTYPE_HYBRID, ZAXIS_HYBRID }, + { GRIB1_LTYPE_HYBRID_LAYER, ZAXIS_HYBRID }, + { GRIB1_LTYPE_LANDDEPTH, ZAXIS_DEPTH_BELOW_LAND }, + { GRIB1_LTYPE_LANDDEPTH_LAYER, ZAXIS_DEPTH_BELOW_LAND }, + { GRIB1_LTYPE_ISENTROPIC, ZAXIS_ISENTROPIC }, + { GRIB1_LTYPE_SEADEPTH, ZAXIS_DEPTH_BELOW_SEA }, + { GRIB1_LTYPE_LAKE_BOTTOM, ZAXIS_LAKE_BOTTOM }, + { GRIB1_LTYPE_SEDIMENT_BOTTOM, ZAXIS_SEDIMENT_BOTTOM }, + { GRIB1_LTYPE_SEDIMENT_BOTTOM_TA, ZAXIS_SEDIMENT_BOTTOM_TA }, + { GRIB1_LTYPE_SEDIMENT_BOTTOM_TW, ZAXIS_SEDIMENT_BOTTOM_TW }, + { GRIB1_LTYPE_MIX_LAYER, ZAXIS_MIX_LAYER }, + // clang-format on +}; + +static const size_t grib1ltypeMapSize = sizeof(grib1ltypeMap) / (2 * sizeof(int)); + +static const int grib2ltypeMap[][2] = { + // clang-format off + { GRIB2_LTYPE_SURFACE, ZAXIS_SURFACE }, + { GRIB2_LTYPE_CLOUD_BASE, ZAXIS_CLOUD_BASE }, + { GRIB2_LTYPE_CLOUD_TOP, ZAXIS_CLOUD_TOP }, + { GRIB2_LTYPE_ISOTHERM0, ZAXIS_ISOTHERM_ZERO }, + { GRIB2_LTYPE_TROPOPAUSE, ZAXIS_TROPOPAUSE }, + { GRIB2_LTYPE_TOA, ZAXIS_TOA }, + { GRIB2_LTYPE_SEA_BOTTOM, ZAXIS_SEA_BOTTOM }, + { GRIB2_LTYPE_ATMOSPHERE, ZAXIS_ATMOSPHERE }, + { GRIB2_LTYPE_ISOBARIC, ZAXIS_PRESSURE }, + { GRIB2_LTYPE_MEANSEA, ZAXIS_MEANSEA }, + { GRIB2_LTYPE_ALTITUDE, ZAXIS_ALTITUDE }, + { GRIB2_LTYPE_HEIGHT, ZAXIS_HEIGHT }, + { GRIB2_LTYPE_SIGMA, ZAXIS_SIGMA }, + { GRIB2_LTYPE_HYBRID, ZAXIS_HYBRID }, + { GRIB2_LTYPE_HYBRID, ZAXIS_HYBRID_HALF }, + { GRIB2_LTYPE_LANDDEPTH, ZAXIS_DEPTH_BELOW_LAND }, + { GRIB2_LTYPE_ISENTROPIC, ZAXIS_ISENTROPIC }, + { GRIB2_LTYPE_SEADEPTH, ZAXIS_DEPTH_BELOW_SEA }, + { GRIB2_LTYPE_LAKE_BOTTOM, ZAXIS_LAKE_BOTTOM }, + { GRIB2_LTYPE_SEDIMENT_BOTTOM, ZAXIS_SEDIMENT_BOTTOM }, + { GRIB2_LTYPE_SEDIMENT_BOTTOM_TA, ZAXIS_SEDIMENT_BOTTOM_TA }, + { GRIB2_LTYPE_SEDIMENT_BOTTOM_TW, ZAXIS_SEDIMENT_BOTTOM_TW }, + { GRIB2_LTYPE_MIX_LAYER, ZAXIS_MIX_LAYER }, + { GRIB2_LTYPE_SNOW, ZAXIS_SNOW }, + { GRIB2_LTYPE_REFERENCE, ZAXIS_REFERENCE }, + // clang-format on +}; + +static const size_t grib2ltypeMapSize = sizeof(grib2ltypeMap) / (2 * sizeof(int)); + +static int +getInt2IntMap(int searchKey, bool keyValue, size_t mapSize, const int gribltypeMap[][2], int defaultValue) +{ + for (size_t i = 0; i < mapSize; ++i) + if (gribltypeMap[i][keyValue] == searchKey) return gribltypeMap[i][!keyValue]; + + return defaultValue; +} + +int +grib1ltypeToZaxisType(int grib_ltype) +{ + return getInt2IntMap(grib_ltype, MapKey, grib1ltypeMapSize, grib1ltypeMap, ZAXIS_GENERIC); +} + +int +zaxisTypeToGrib1ltype(int zaxistype) +{ + return getInt2IntMap(zaxistype, MapValue, grib1ltypeMapSize, grib1ltypeMap, -1); +} + +int +grib2ltypeToZaxisType(int grib_ltype) +{ + return getInt2IntMap(grib_ltype, MapKey, grib2ltypeMapSize, grib2ltypeMap, ZAXIS_GENERIC); +} + +int +zaxisTypeToGrib2ltype(int zaxistype) +{ + return getInt2IntMap(zaxistype, MapValue, grib2ltypeMapSize, grib2ltypeMap, -1); +} + +int +grbBitsPerValue(int datatype) +{ + int bitsPerValue = 16; + + if (datatype == CDI_DATATYPE_CPX32 || datatype == CDI_DATATYPE_CPX64) Error("CDI/GRIB library does not support complex numbers!"); + + if (datatype != CDI_UNDEFID) + { + if (datatype > 0 && datatype <= 32) + bitsPerValue = datatype; + else if (datatype == CDI_DATATYPE_FLT64) + bitsPerValue = 24; + else + bitsPerValue = 16; + } + + return bitsPerValue; +} + +/* +int grbInqRecord(stream_t * streamptr, int *varID, int *levelID) +{ + int status; + + status = cgribexInqRecord(streamptr, varID, levelID); + + return (status); +} +*/ + +void +grbDefRecord(stream_t *streamptr) +{ + UNUSED(streamptr); +} + +static int +grbScanTimestep1(stream_t *streamptr) +{ + int status = CDI_EUFTYPE; + +#ifdef HAVE_LIBCGRIBEX + const int filetype = streamptr->filetype; + + if (filetype == CDI_FILETYPE_GRB && !CDI_gribapi_grib1) + status = cgribexScanTimestep1(streamptr); + else +#endif +#ifdef HAVE_LIBGRIB_API + status = gribapiScanTimestep1(streamptr); +#else + Error("GRIB_API support unavailable!"); +#endif + + return status; +} + +static int +grbScanTimestep2(stream_t *streamptr) +{ + int status = CDI_EUFTYPE; + +#ifdef HAVE_LIBCGRIBEX + const int filetype = streamptr->filetype; + + if (filetype == CDI_FILETYPE_GRB && !CDI_gribapi_grib1) + status = cgribexScanTimestep2(streamptr); + else +#endif +#ifdef HAVE_LIBGRIB_API + status = gribapiScanTimestep2(streamptr); +#else + Error("GRIB_API support unavailable!"); +#endif + + return status; +} + +static int +grbScanTimestep(stream_t *streamptr) +{ + int status = CDI_EUFTYPE; + +#ifdef HAVE_LIBCGRIBEX + const int filetype = streamptr->filetype; + + if (filetype == CDI_FILETYPE_GRB && !CDI_gribapi_grib1) + status = cgribexScanTimestep(streamptr); + else +#endif +#ifdef HAVE_LIBGRIB_API + status = gribapiScanTimestep(streamptr); +#else + Error("GRIB_API support unavailable!"); +#endif + + return status; +} + +#ifdef HAVE_LIBGRIB +int +grbInqContents(stream_t *streamptr) +{ + streamptr->curTsID = 0; + + int status = grbScanTimestep1(streamptr); + if (status == 0 && streamptr->ntsteps == -1) status = grbScanTimestep2(streamptr); + + const int fileID = streamptr->fileID; + fileSetPos(fileID, 0, SEEK_SET); + + return status; +} + +int +fdbInqContents(stream_t *streamptr) +{ + streamptr->curTsID = 0; +#ifdef HAVE_LIBGRIB_API + int status = fdbScanTimesteps(streamptr); + return status; +#else + return -1; +#endif +} +#endif + +int +fdbInqTimestep(stream_t *streamptr, int tsID) +{ + if (tsID == 0 && streamptr->rtsteps == 0) Error("Call to cdiInqContents missing!"); + + if (CDI_Debug) Message("tsid = %d rtsteps = %d", tsID, streamptr->rtsteps); + + int nrecs; + if (tsID >= streamptr->ntsteps && streamptr->ntsteps != CDI_UNDEFID) + { + nrecs = 0; + } + else + { + streamptr->curTsID = tsID; + nrecs = streamptr->tsteps[tsID].nrecs; + } + + return nrecs; +} + +int +grbInqTimestep(stream_t *streamptr, int tsID) +{ + if (tsID == 0 && streamptr->rtsteps == 0) Error("Call to cdiInqContents missing!"); + + if (CDI_Debug) Message("tsid = %d rtsteps = %d", tsID, streamptr->rtsteps); + + int ntsteps = CDI_UNDEFID; + while ((tsID + 1) > streamptr->rtsteps && ntsteps == CDI_UNDEFID) + { + ntsteps = grbScanTimestep(streamptr); + if (ntsteps == CDI_EUFSTRUCT) + { + streamptr->ntsteps = streamptr->rtsteps; + break; + } + } + + int nrecs; + if (tsID >= streamptr->ntsteps && streamptr->ntsteps != CDI_UNDEFID) + { + nrecs = 0; + } + else + { + streamptr->curTsID = tsID; + nrecs = streamptr->tsteps[tsID].nrecs; + } + + return nrecs; +} + +// used in CDO!!! +void +streamInqGRIBinfo(int streamID, int *intnum, float *fltnum, off_t *bignum) +{ + stream_t *streamptr = stream_to_pointer(streamID); + + int filetype = streamptr->filetype; + + if (filetype == CDI_FILETYPE_GRB) + { + int tsID = streamptr->curTsID; + int vrecID = streamptr->tsteps[tsID].curRecID; + int recID = streamptr->tsteps[tsID].recIDs[vrecID]; + off_t recpos = streamptr->tsteps[tsID].records[recID].position; + int zip = streamptr->tsteps[tsID].records[recID].zip; + + void *gribbuffer = streamptr->record->buffer; + size_t gribbuffersize = streamptr->record->buffersize; + + if (zip > 0) + Error("Compressed GRIB records unsupported!"); + else + grib_info_for_grads(recpos, (long) gribbuffersize, (unsigned char *) gribbuffer, intnum, fltnum, bignum); + } +} + +int +grbGetGridtype(int *gridID, size_t gridsize, bool *gridIsRotated, bool *gridIsCurvilinear) +{ + int gridtype = gridInqType(*gridID); + + if (gridtype == GRID_GENERIC) + { + int xsize = (int) gridInqXsize(*gridID); + int ysize = (int) gridInqYsize(*gridID); + + if ((ysize == 32 || ysize == 48 || ysize == 64 || ysize == 96 || ysize == 160 || ysize == 192 || ysize == 240 || ysize == 320 + || ysize == 384 || ysize == 480 || ysize == 768) + && (xsize == 2 * ysize || xsize == 1)) + { + gridtype = GRID_GAUSSIAN; + } + else if (gridsize == 1) + { + gridtype = GRID_LONLAT; + } + else if (gridInqXvals(*gridID, NULL) && gridInqYvals(*gridID, NULL)) + { + gridtype = GRID_LONLAT; + } + } + else if (gridtype == GRID_CURVILINEAR) + { + int projID = gridInqProj(*gridID); + if (projID != CDI_UNDEFID && gridInqType(projID) == GRID_PROJECTION) + { + *gridID = projID; + gridtype = GRID_PROJECTION; + } + else + { + static bool lwarning = true; + if (lwarning && gridsize > 1) + { + lwarning = false; + Warning("Curvilinear grid is unsupported in GRIB format! Created wrong Grid Description Section!"); + } + *gridIsCurvilinear = true; + gridtype = GRID_LONLAT; + } + } + + if (gridtype == GRID_PROJECTION) + { + int projtype = gridInqProjType(*gridID); + if (projtype == CDI_PROJ_RLL) + { + gridtype = GRID_LONLAT; + *gridIsRotated = true; + } + else if (projtype == CDI_PROJ_LCC) + { + gridtype = CDI_PROJ_LCC; + } + else if (projtype == CDI_PROJ_STERE) + { + gridtype = CDI_PROJ_STERE; + } + } + + return gridtype; +} + +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifndef _SUBTYPE_H +#define _SUBTYPE_H + +enum +{ + /* subtype attributes wrt. TILES */ + SUBTYPE_ATT_TILEINDEX = 0, + SUBTYPE_ATT_TOTALNO_OF_TILEATTR_PAIRS = 1, + SUBTYPE_ATT_TILE_CLASSIFICATION = 2, + SUBTYPE_ATT_NUMBER_OF_TILES = 3, + SUBTYPE_ATT_NUMBER_OF_ATTR = 4, + SUBTYPE_ATT_TILEATTRIBUTE = 5, + /* No. of different constants in the enumeration + "subtype_attributes" */ + nSubtypeAttributes +}; + +/* Literal constants corresponding to the different constants of the + enumeration "subtype_attributes". */ +extern const char *const cdiSubtypeAttributeName[]; + +/* Data type specifying an attribute of a subtype (for example an + attribute of a set of TILES) or an attribute of a subtype entry + (for example an attribute of a single TILE). This data type is part + of a linked list. */ +struct subtype_attr_t +{ + int key, val; /* key/value pair */ + struct subtype_attr_t *next; /* next element in linked list */ +}; + +/* Data type specifying a single entry of a subtype, for example a + single TILE in a set of TILES. */ +struct subtype_entry_t +{ + int self; /* list entry index (0,...,nentries-1) */ + struct subtype_entry_t *next; /* next node in linked list */ + + /* linked list with attributes for this subtype entry, ordered by its key values*/ + struct subtype_attr_t *atts; +}; + +/* Data type specifying a variable subtype, for example a list of + TILES. This can be interpreted as an additional axis like the + vertical axis. */ +typedef struct +{ + int self; /* resource handler ID */ + int subtype; /* subtype kind: TILES, ... */ + int nentries; /* counter: total no. of entries in list */ + + /* currently active subtype, e.g. GRIB2 tile index (for example for + stream/vlist accesses): */ + int active_subtype_index; + struct subtype_entry_t globals; /* global attributes */ + + /* list of subtype entries, e.g. the list of tiles, ordered by entry->self. */ + struct subtype_entry_t *entries; +} subtype_t; + +/* prototypes: allocation and destruction */ +void subtypeAllocate(subtype_t **subtype_ptr2, int subtype); +int subtypePush(subtype_t *subtype_ptr); +void subtypeDestroyPtr(void *ptr); +void subtypeDuplicate(subtype_t *subtype_ptr, subtype_t **dst); +struct subtype_entry_t *subtypeEntryInsert(subtype_t *head); + +/* prototypes: accessing global attributes */ +void subtypePrint(int subtypeID); +void subtypePrintPtr(subtype_t *subtype_ptr); +void subtypeDefGlobalDataP(subtype_t *subtype_ptr, int key, int val); +void subtypeDefGlobalData(int subtypeID, int key, int val); +int subtypeGetGlobalData(int subtypeID, int key); +int subtypeGetGlobalDataP(subtype_t *subtype_ptr, int key); +int subtypeComparePtr(int s1_ID, subtype_t *s2); + +/* prototypes: accessing subtype entries */ +void subtypeDefEntryDataP(struct subtype_entry_t *subtype_entry_ptr, int key, int val); + +/* prototypes: tile implementations */ +void tilesetInsertP(subtype_t *s1, subtype_t *s2); + +/* Construct a new subtype for a tile set. If a corresponding subtype + * already exists, then we return this subtype ID instead. */ +int vlistDefTileSubtype(int vlistID, subtype_t *tiles); + +/* Insert a trivial one-tile-subtype */ +int vlistInsertTrivialTileSubtype(int vlistID); + +#endif + +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifdef HAVE_CONFIG_H +#endif + +#ifdef HAVE_LIBGRIB_API + + + +#include <grib_api.h> + +extern int CDI_Inventory_Mode; + +static const var_tile_t dummy_tiles = { 0, -1, -1, -1, -1, -1 }; + +typedef struct +{ + int param; + int level1; + int level2; + int ltype; + int tsteptype; + size_t gridsize; + char name[32]; + VarScanKeys scanKeys; + var_tile_t tiles; +} compvar2_t; + +static int +gribapiGetZaxisType(long editionNumber, int grib_ltype) +{ + return (editionNumber <= 1) ? grib1ltypeToZaxisType(grib_ltype) : grib2ltypeToZaxisType(grib_ltype); +} + +static int +getTimeunits(long unitsOfTime) +{ + switch (unitsOfTime) + { + case 13: return TUNIT_SECOND; + case 0: return TUNIT_MINUTE; + case 1: return TUNIT_HOUR; + case 10: return TUNIT_3HOURS; + case 11: return TUNIT_6HOURS; + case 12: return TUNIT_12HOURS; + case 2: return TUNIT_DAY; + } + + return TUNIT_HOUR; +} + +static double +timeunit_factor(int tu1, int tu2) +{ + if (tu2 == TUNIT_HOUR) + { + switch (tu1) + { + case TUNIT_SECOND: return 3600; + case TUNIT_MINUTE: return 60; + case TUNIT_HOUR: return 1; + case TUNIT_3HOURS: return 1. / 3; + case TUNIT_6HOURS: return 1. / 6; + case TUNIT_12HOURS: return 1. / 12; + case TUNIT_DAY: return 1. / 24; + } + } + + return 1; +} + +static int +gribapiGetTimeUnits(grib_handle *gh) +{ + long unitsOfTime = -1; + grib_get_long(gh, "indicatorOfUnitOfTimeRange", &unitsOfTime); + + GRIB_CHECK(my_grib_set_long(gh, "stepUnits", unitsOfTime), 0); + + return getTimeunits(unitsOfTime); +} + +static void +gribapiGetSteps(grib_handle *gh, int timeunits, int *startStep, int *endStep) +{ + long unitsOfTime; + int status = grib_get_long(gh, "stepUnits", &unitsOfTime); + int timeunits2 = (status == 0) ? getTimeunits(unitsOfTime) : timeunits; + // timeunits2 = gribapiGetTimeUnits(gh); + + long lpar; + status = grib_get_long(gh, "forecastTime", &lpar); + if (status == 0) + *startStep = (int) lpar; + else + { + status = grib_get_long(gh, "startStep", &lpar); + if (status == 0) *startStep = (int) (((double) lpar * timeunit_factor(timeunits, timeunits2)) + 0.5); + } + + *endStep = *startStep; + status = grib_get_long(gh, "endStep", &lpar); + if (status == 0) *endStep = (int) (((double) lpar * timeunit_factor(timeunits, timeunits2)) + 0.5); + // printf("%d %d %d %d %d %g\n", *startStep, *endStep, lpar, timeunits, timeunits2, timeunit_factor(timeunits, timeunits2)); +} + +static CdiDateTime +gribapiGetDataDateTime(grib_handle *gh) +{ + long date; + GRIB_CHECK(grib_get_long(gh, "dataDate", &date), 0); + + long hour, minute, second; + GRIB_CHECK(grib_get_long(gh, "hour", &hour), 0); + GRIB_CHECK(grib_get_long(gh, "minute", &minute), 0); + GRIB_CHECK(grib_get_long(gh, "second", &second), 0); + + CdiDateTime dt; + dt.date = cdiDate_set(date); + dt.time.hour = hour; + dt.time.minute = minute; + dt.time.second = second; + dt.time.ms = 0; + + return dt; +} + +static void +gribapiSetDataDateTime(grib_handle *gh, CdiDateTime dataDateTime) +{ + long dataDate = (long) cdiDate_get(dataDateTime.date); + GRIB_CHECK(my_grib_set_long(gh, "dataDate", (long) dataDate), 0); + + int hour, minute, second, ms; + cdiTime_decode(dataDateTime.time, &hour, &minute, &second, &ms); + GRIB_CHECK(my_grib_set_long(gh, "hour", hour), 0); + GRIB_CHECK(my_grib_set_long(gh, "minute", minute), 0); + GRIB_CHECK(my_grib_set_long(gh, "second", second), 0); +} + +static int +gribapiGetTimeUnitFactor(int timeUnits) +{ + static bool lprint = true; + switch (timeUnits) + { + case TUNIT_SECOND: return 1; + case TUNIT_MINUTE: return 60; + case TUNIT_HOUR: return 3600; + case TUNIT_3HOURS: return 10800; + case TUNIT_6HOURS: return 21600; + case TUNIT_12HOURS: return 43200; + case TUNIT_DAY: return 86400; + default: + if (lprint) + { + Warning("Time unit %d unsupported", timeUnits); + lprint = false; + } + } + + return 0; +} + +static CdiDateTime +gribapiGetValidityDateTime(grib_handle *gh, CdiDateTime *sDateTime) +{ + CdiDateTime vDateTime; + cdiDateTime_init(sDateTime); + + long sigofrtime = 3; + if (gribEditionNumber(gh) > 1) + GRIB_CHECK(grib_get_long(gh, "significanceOfReferenceTime", &sigofrtime), 0); + else + GRIB_CHECK(grib_get_long(gh, "timeRangeIndicator", &sigofrtime), 0); + + if (sigofrtime + == 3) // XXX: This looks like a bug to me, because timeRangeIndicator == 3 does not seem to have the same meaning as + // significanceOfReferenceTime == 3. I would recommend replacing this condition with `if(!gribapiTimeIsFC())`. + { + vDateTime = gribapiGetDataDateTime(gh); + } + else + { + CdiDateTime rDateTime = gribapiGetDataDateTime(gh); + + int timeUnits = gribapiGetTimeUnits(gh); + int startStep = 0, endStep = 0; + gribapiGetSteps(gh, timeUnits, &startStep, &endStep); + + if (rDateTime.date.day > 0) + { + extern int CGRIBEX_grib_calendar; + JulianDate julianDate = julianDate_encode(CGRIBEX_grib_calendar, rDateTime); + + int64_t timeUnitFactor = gribapiGetTimeUnitFactor(timeUnits); + + // if (startStep > 0) + { + JulianDate julianDate2 = julianDate_add_seconds(julianDate, timeUnitFactor * startStep); + *sDateTime = julianDate_decode(CGRIBEX_grib_calendar, julianDate2); + } + + rDateTime = julianDate_decode(CGRIBEX_grib_calendar, julianDate_add_seconds(julianDate, timeUnitFactor * endStep)); + } + + vDateTime = rDateTime; + } + + return vDateTime; +} + +static void +grib1GetLevel(grib_handle *gh, int *leveltype, int *lbounds, int *level1, int *level2) +{ + *leveltype = 0; + *lbounds = 0; + *level1 = 0; + *level2 = 0; + + long lpar; + if (!grib_get_long(gh, "indicatorOfTypeOfLevel", &lpar)) // 1 byte + { + *leveltype = (int) lpar; + + switch (*leveltype) + { + case GRIB1_LTYPE_SIGMA_LAYER: + case GRIB1_LTYPE_HYBRID_LAYER: + case GRIB1_LTYPE_LANDDEPTH_LAYER: + { + *lbounds = 1; + break; + } + } + + if (*lbounds) + { + GRIB_CHECK(grib_get_long(gh, "topLevel", &lpar), 0); // 1 byte + if (lpar == GRIB_MISSING_LONG) lpar = 0; + *level1 = (int) lpar; + GRIB_CHECK(grib_get_long(gh, "bottomLevel", &lpar), 0); // 1 byte + if (lpar == GRIB_MISSING_LONG) lpar = 0; + *level2 = (int) lpar; + } + else + { + double dlevel; + GRIB_CHECK(grib_get_double(gh, "level", &dlevel), 0); // 2 byte + if (*leveltype == GRIB1_LTYPE_ISOBARIC) dlevel *= 100; + if (dlevel < -2.e9 || dlevel > 2.e9) dlevel = 0; + if (*leveltype == GRIB1_LTYPE_99 || *leveltype == GRIB1_LTYPE_ISOBARIC_PA) *leveltype = GRIB1_LTYPE_ISOBARIC; + + *level1 = (int) dlevel; + *level2 = 0; + } + } +} + +static double +grib2ScaleFactor(long factor) +{ + switch (factor) + { + case GRIB_MISSING_LONG: return 1; + case -9: return 1000000000; + case -8: return 100000000; + case -7: return 10000000; + case -6: return 1000000; + case -5: return 100000; + case -4: return 10000; + case -3: return 1000; + case -2: return 100; + case -1: return 10; + case 0: return 1; + case 1: return 0.1; + case 2: return 0.01; + case 3: return 0.001; + case 4: return 0.0001; + case 5: return 0.00001; + case 6: return 0.000001; + case 7: return 0.0000001; + case 8: return 0.00000001; + case 9: return 0.000000001; + default: return 0; + } +} + +static int +calcLevel(int level_sf, long factor, long level) +{ + double result = 0; + if (level != GRIB_MISSING_LONG) result = (double) level * grib2ScaleFactor(factor); + if (level_sf) result *= level_sf; + return (int) result; +} + +static void +grib2GetLevel(grib_handle *gh, int *leveltype1, int *leveltype2, int *lbounds, int *level1, int *level2, int *level_sf, + int *level_unit) +{ + *leveltype1 = 0; + *leveltype2 = -1; + *lbounds = 0; + *level1 = 0; + *level2 = 0; + *level_sf = 0; + *level_unit = 0; + + long lpar; + int status = grib_get_long(gh, "typeOfFirstFixedSurface", &lpar); // 1 byte + if (status == 0) + { + *leveltype1 = (int) lpar; + + status = grib_get_long(gh, "typeOfSecondFixedSurface", &lpar); // 1 byte + /* FIXME: assert(lpar >= INT_MIN && lpar <= INT_MAX) */ + if (status == 0) *leveltype2 = (int) lpar; + + if (*leveltype1 != 255 && *leveltype2 != 255 && *leveltype2 > 0) *lbounds = 1; + switch (*leveltype1) + { + case GRIB2_LTYPE_REFERENCE: + if (*leveltype2 == 1) *lbounds = 0; + break; + case GRIB2_LTYPE_LANDDEPTH: + *level_sf = 1000; + *level_unit = CDI_UNIT_M; + break; + case GRIB2_LTYPE_ISOBARIC: + *level_sf = 1000; + *level_unit = CDI_UNIT_PA; + break; + case GRIB2_LTYPE_SIGMA: + *level_sf = 1000; + *level_unit = 0; + break; + } + + long factor, llevel; + GRIB_CHECK(grib_get_long(gh, "scaleFactorOfFirstFixedSurface", &factor), 0); // 1 byte + GRIB_CHECK(grib_get_long(gh, "scaledValueOfFirstFixedSurface", &llevel), 0); // 4 byte + *level1 = calcLevel(*level_sf, factor, llevel); + + if (*lbounds) + { + GRIB_CHECK(grib_get_long(gh, "scaleFactorOfSecondFixedSurface", &factor), 0); // 1 byte + GRIB_CHECK(grib_get_long(gh, "scaledValueOfSecondFixedSurface", &llevel), 0); // 4 byte + *level2 = calcLevel(*level_sf, factor, llevel); + } + } +} + +static void +gribGetLevel(grib_handle *gh, int *leveltype1, int *leveltype2, int *lbounds, int *level1, int *level2, int *level_sf, + int *level_unit, var_tile_t *tiles) +{ + if (gribEditionNumber(gh) <= 1) + { + grib1GetLevel(gh, leveltype1, lbounds, level1, level2); + *leveltype2 = -1; + *level_sf = 0; + *level_unit = 0; + } + else + { + grib2GetLevel(gh, leveltype1, leveltype2, lbounds, level1, level2, level_sf, level_unit); + + // read in tiles attributes (if there are any) + tiles->tileindex = (int) gribGetLongDefault(gh, cdiSubtypeAttributeName[SUBTYPE_ATT_TILEINDEX], 0); + tiles->totalno_of_tileattr_pairs + = (int) gribGetLongDefault(gh, cdiSubtypeAttributeName[SUBTYPE_ATT_TOTALNO_OF_TILEATTR_PAIRS], -1); + tiles->tileClassification = (int) gribGetLongDefault(gh, cdiSubtypeAttributeName[SUBTYPE_ATT_TILE_CLASSIFICATION], -1); + tiles->numberOfTiles = (int) gribGetLongDefault(gh, cdiSubtypeAttributeName[SUBTYPE_ATT_NUMBER_OF_TILES], -1); + tiles->numberOfAttributes = (int) gribGetLongDefault(gh, cdiSubtypeAttributeName[SUBTYPE_ATT_NUMBER_OF_ATTR], -1); + tiles->attribute = (int) gribGetLongDefault(gh, cdiSubtypeAttributeName[SUBTYPE_ATT_TILEATTRIBUTE], -1); + } +} + +static void +gribapiGetString(grib_handle *gh, const char *key, char *string, size_t length) +{ + string[0] = 0; + + int ret = grib_get_string(gh, key, string, &length); + if (ret != 0) + { + fprintf(stderr, "grib_get_string(gh, \"%s\", ...) failed!\n", key); + GRIB_CHECK(ret, 0); + } + // clang-format off + if (length == 8 && memcmp(string, "unknown", length) == 0) string[0] = 0; + else if (length == 2 && memcmp(string, "~", length) == 0) string[0] = 0; + // clang-format on +} + +static void +param_to_name(int param, char *name) +{ + int pdis, pcat, pnum; + cdiDecodeParam(param, &pnum, &pcat, &pdis); + if (pdis == 255) + { + sprintf(name, "code%d", pnum); + } + else + { + sprintf(name, "param%d.%d.%d", pnum, pcat, pdis); + } +} + +static int +gribapiGetEnsembleInfo(grib_handle *gh, long *typeOfEnsembleForecast, long *numberOfForecastsInEnsemble, long *perturbationNumber) +{ + int status = 0; + if (grib_get_long(gh, "typeOfEnsembleForecast", typeOfEnsembleForecast) == 0) + { + GRIB_CHECK(grib_get_long(gh, "numberOfForecastsInEnsemble", numberOfForecastsInEnsemble), 0); + GRIB_CHECK(grib_get_long(gh, "perturbationNumber", perturbationNumber), 0); + if (*perturbationNumber > 0) status = 1; + } + + if (status == 0) + { + *typeOfEnsembleForecast = 0; + *perturbationNumber = 0; + *numberOfForecastsInEnsemble = 0; + } + + return status; +} + +static VarScanKeys +gribapiGetScanKeys(grib_handle *gh) +{ + VarScanKeys scanKeys; + varScanKeysInit(&scanKeys); + + long typeOfEnsembleForecast = 0, numberOfForecastsInEnsemble = 0, perturbationNumber = 0; + gribapiGetEnsembleInfo(gh, &typeOfEnsembleForecast, &numberOfForecastsInEnsemble, &perturbationNumber); + scanKeys.perturbationNumber = (short) perturbationNumber; + + long typeOfGeneratingProcess = 0; + if (grib_get_long(gh, "typeOfGeneratingProcess", &typeOfGeneratingProcess) == 0) + scanKeys.typeOfGeneratingProcess = (short) typeOfGeneratingProcess; + + return scanKeys; +} + +static void +gribapiGetNameKeys(grib_handle *gh, int varID) +{ + char string[CDI_MAX_NAME]; + + size_t vlen = CDI_MAX_NAME; + gribapiGetString(gh, "name", string, vlen); // longname + if (string[0]) varDefKeyString(varID, CDI_KEY_LONGNAME, string); + + gribapiGetString(gh, "units", string, vlen); + if (string[0]) varDefKeyString(varID, CDI_KEY_UNITS, string); + + string[0] = 0; + int status = grib_get_string(gh, "cfName", string, &vlen); + if (status != 0 || vlen <= 1 || strncmp(string, "unknown", 7) == 0) string[0] = 0; + if (string[0]) varDefKeyString(varID, CDI_KEY_STDNAME, string); +} + +static void +gribapiGetKeys(grib_handle *gh, int varID) +{ + long tablesVersion = 0; + if (grib_get_long(gh, "tablesVersion", &tablesVersion) == 0) varDefKeyInt(varID, CDI_KEY_TABLESVERSION, (int) tablesVersion); + + long localTablesVersion = 0; + if (grib_get_long(gh, "localTablesVersion", &localTablesVersion) == 0) + varDefKeyInt(varID, CDI_KEY_LOCALTABLESVERSION, (int) localTablesVersion); + + long typeOfGeneratingProcess = 0; + if (grib_get_long(gh, "typeOfGeneratingProcess", &typeOfGeneratingProcess) == 0) + varDefKeyInt(varID, CDI_KEY_TYPEOFGENERATINGPROCESS, (int) typeOfGeneratingProcess); + + long productDefinitionTemplate = 0; + if (grib_get_long(gh, "productDefinitionTemplateNumber", &productDefinitionTemplate) == 0) + varDefKeyInt(varID, CDI_KEY_PRODUCTDEFINITIONTEMPLATE, (int) productDefinitionTemplate); + + long typeOfProcessedData = 0; + if (grib_get_long(gh, "typeOfProcessedData", &typeOfProcessedData) == 0) + varDefKeyInt(varID, CDI_KEY_TYPEOFPROCESSEDDATA, (int) typeOfProcessedData); + + long shapeOfTheEarth = 0; + if (grib_get_long(gh, "shapeOfTheEarth", &shapeOfTheEarth) == 0) + varDefKeyInt(varID, CDI_KEY_SHAPEOFTHEEARTH, (int) shapeOfTheEarth); + + long backgroundProcess = 0; + if (grib_get_long(gh, "backgroundProcess", &backgroundProcess) == 0) + varDefKeyInt(varID, CDI_KEY_BACKGROUNDPROCESS, (int) backgroundProcess); + + long typeOfTimeIncrement = 0; + if (grib_get_long(gh, "typeOfTimeIncrement", &typeOfTimeIncrement) == 0) + varDefKeyInt(varID, CDI_KEY_TYPEOFTIMEINCREMENT, (int) typeOfTimeIncrement); + /* + long constituentType = 0; + if ( grib_get_long(gh, "constituentType", &constituentType) == 0 ) + varDefKeyInt(varID, CDI_KEY_CONSTITUENTTYPE, (int) constituentType); + */ + + /* + Get the ensemble Info from the grib-2 Tables and update the intermediate datastructure. + Further update to the "vlist" is handled in the same way as for GRIB-1 by "cdi_generate_vars" + */ + long typeOfEnsembleForecast = 0, numberOfForecastsInEnsemble = 0, perturbationNumber = 0; + gribapiGetEnsembleInfo(gh, &typeOfEnsembleForecast, &numberOfForecastsInEnsemble, &perturbationNumber); + if (perturbationNumber > 0) + { + varDefKeyInt(varID, CDI_KEY_TYPEOFENSEMBLEFORECAST, (int) typeOfEnsembleForecast); + varDefKeyInt(varID, CDI_KEY_NUMBEROFFORECASTSINENSEMBLE, (int) numberOfForecastsInEnsemble); + varDefKeyInt(varID, CDI_KEY_PERTURBATIONNUMBER, (int) perturbationNumber); + } + + long section2Length = 0; + int status = grib_get_long(gh, "section2Length", §ion2Length); + if (status == 0 && section2Length > 0) + { + long grib2LocalSectionNumber; + long mpimType, mpimClass, mpimUser; + status = grib_get_long(gh, "grib2LocalSectionNumber", &grib2LocalSectionNumber); + if (status == 0) + { + size_t section2PaddingLength = 0; + status = grib_get_size(gh, "section2Padding", §ion2PaddingLength); + if (status == 0 && section2PaddingLength > 0) + { + varDefKeyInt(varID, CDI_KEY_GRIB2LOCALSECTIONNUMBER, (int) grib2LocalSectionNumber); + varDefKeyInt(varID, CDI_KEY_SECTION2PADDINGLENGTH, (int) section2PaddingLength); + unsigned char *section2Padding = (unsigned char *) Malloc(section2PaddingLength); + grib_get_bytes(gh, "section2Padding", section2Padding, §ion2PaddingLength); + varDefKeyBytes(varID, CDI_KEY_SECTION2PADDING, section2Padding, (int) section2PaddingLength); + Free(section2Padding); + } + else if (grib_get_long(gh, "mpimType", &mpimType) == 0 && grib_get_long(gh, "mpimClass", &mpimClass) == 0 + && grib_get_long(gh, "mpimUser", &mpimUser) == 0) + { + varDefKeyInt(varID, CDI_KEY_MPIMTYPE, mpimType); + varDefKeyInt(varID, CDI_KEY_MPIMCLASS, mpimClass); + varDefKeyInt(varID, CDI_KEY_MPIMUSER, mpimUser); + + size_t revNumLen = 20; + unsigned char revNumber[revNumLen]; + if (grib_get_bytes(gh, "revNumber", revNumber, &revNumLen) == 0) + varDefKeyBytes(varID, CDI_KEY_REVNUMBER, revNumber, (int) revNumLen); + + long revStatus; + grib_get_long(gh, "revStatus", &revStatus); + varDefKeyInt(varID, CDI_KEY_REVSTATUS, revStatus); + } + } + } +} + +static void +gribapiDefProjRLL(grib_handle *gh, int gridID) +{ + double xpole = 0, ypole = 0, angle = 0; + grib_get_double(gh, "latitudeOfSouthernPoleInDegrees", &ypole); + grib_get_double(gh, "longitudeOfSouthernPoleInDegrees", &xpole); + grib_get_double(gh, "angleOfRotation", &angle); + xpole -= 180; + if (fabs(ypole) > 0) ypole = -ypole; // change from south to north pole + if (fabs(angle) > 0) angle = -angle; + + gridDefParamRLL(gridID, xpole, ypole, angle); +} + +static void +shapeOfTheEarthToRadius(long shapeOfTheEarth, double *a, double *b, double *rf) +{ + // clang-format off + switch (shapeOfTheEarth) + { + case 2: *a = 6378160.0; *b = 6356775.0; *rf = 297.0; break; + case 4: *a = 6378137.0; *b = 6356752.314; *rf = 298.257222101; break; + case 6: *a = 6371229.0; break; + case 8: *a = 6371200.0; break; + case 0: *a = 6367470.0; break; + default: *a = 6367470.0; + } + // clang-format on +} + +static void +gribapiDefProjLCC(grib_handle *gh, int gridID) +{ + struct CDI_GridProjParams gpp; + gridProjParamsInit(&gpp); + + long shapeOfTheEarth; + grib_get_long(gh, "shapeOfTheEarth", &shapeOfTheEarth); + shapeOfTheEarthToRadius(shapeOfTheEarth, &gpp.a, &gpp.b, &gpp.rf); + + long projflag = 0; + grib_get_double(gh, "longitudeOfFirstGridPointInDegrees", &gpp.xval_0); + grib_get_double(gh, "latitudeOfFirstGridPointInDegrees", &gpp.yval_0); + grib_get_double(gh, "LoVInDegrees", &gpp.lon_0); + grib_get_double(gh, "Latin1InDegrees", &gpp.lat_1); + grib_get_double(gh, "Latin2InDegrees", &gpp.lat_2); + grib_get_long(gh, "projectionCentreFlag", &projflag); + bool lsouth = gribbyte_get_bit((int) projflag, 1); + if (lsouth) + { + gpp.lat_1 = -gpp.lat_1; + gpp.lat_2 = -gpp.lat_2; + } + + gpp.lat_0 = gpp.lat_2; + + if (proj_lonlat_to_lcc_func) + { + double x_0 = gpp.xval_0, y_0 = gpp.yval_0; + proj_lonlat_to_lcc_func(gpp, (size_t) 1, &x_0, &y_0); + if (IS_NOT_EQUAL(x_0, gpp.mv) && IS_NOT_EQUAL(y_0, gpp.mv)) + { + gpp.x_0 = -x_0; + gpp.y_0 = -y_0; + } + } + + gridDefParamsLCC(gridID, gpp); +} + +static void +gribapiDefProjSTERE(grib_handle *gh, int gridID) +{ + struct CDI_GridProjParams gpp; + gridProjParamsInit(&gpp); + + long shapeOfTheEarth; + grib_get_long(gh, "shapeOfTheEarth", &shapeOfTheEarth); + shapeOfTheEarthToRadius(shapeOfTheEarth, &gpp.a, &gpp.b, &gpp.rf); + + grib_get_double(gh, "longitudeOfFirstGridPointInDegrees", &gpp.xval_0); + grib_get_double(gh, "latitudeOfFirstGridPointInDegrees", &gpp.yval_0); + grib_get_double(gh, "LaDInDegrees", &gpp.lat_1); + grib_get_double(gh, "orientationOfTheGridInDegrees", &gpp.lon_0); + + long southPoleOnProjectionPlane; + grib_get_long(gh, "southPoleOnProjectionPlane", &southPoleOnProjectionPlane); + gpp.lat_0 = southPoleOnProjectionPlane ? -90.0 : 90.0; + + if (proj_lonlat_to_stere_func) + { + double x_0 = gpp.xval_0, y_0 = gpp.yval_0; + proj_lonlat_to_stere_func(gpp, (size_t) 1, &x_0, &y_0); + if (IS_NOT_EQUAL(x_0, gpp.mv) && IS_NOT_EQUAL(y_0, gpp.mv)) + { + gpp.x_0 = -x_0; + gpp.y_0 = -y_0; + } + } + + gridDefParamsSTERE(gridID, gpp); +} + +static void +gribapiAddRecord(stream_t *streamptr, int param, grib_handle *gh, size_t recsize, off_t position, int datatype, int comptype, + const char *varname, int leveltype1, int leveltype2, int lbounds, int level1, int level2, int level_sf, + int level_unit, VarScanKeys *scanKeys, const var_tile_t *tiles, bool lread_additional_keys, void *fdbItem) +{ + int vlistID = streamptr->vlistID; + int tsID = streamptr->curTsID; + int recID = recordNewEntry(streamptr, tsID); + record_t *record = &streamptr->tsteps[tsID].records[recID]; + + int tsteptype = gribapiGetTsteptype(gh); + + // fprintf(stderr, "param %d %d %d %d\n", param, level1, level2, leveltype1); + + record->size = recsize; + record->position = position; + record->param = param; + record->ilevel = level1; + record->ilevel2 = level2; + record->ltype = leveltype1; + record->tsteptype = (short) tsteptype; + record->gridsize = gribapiGetGridsize(gh); + record->scanKeys = *scanKeys; + record->tiles = tiles ? *tiles : dummy_tiles; +#ifdef HAVE_LIBFDB5 + record->fdbItem = fdbItem; +#endif + + strncpy(record->varname, varname, sizeof(record->varname) - 1); + record->varname[sizeof(record->varname) - 1] = 0; + + streamptr->tsteps[tsID].nallrecs++; + streamptr->nrecs++; + + // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> + + CdiQuery *query = streamptr->query; + if (query && cdiQueryName(query, varname) < 0) + { + record->used = false; + return; + } + + // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> + + grid_t *grid = (grid_t *) Malloc(sizeof(*grid)); + bool uvRelativeToGrid = gribapiGetGrid(gh, grid); + + struct addIfNewRes gridAdded = cdiVlistAddGridIfNew(vlistID, grid, 0); + int gridID = gridAdded.Id; + // clang-format off + if (!gridAdded.isNew) + { + grid_free(grid); + Free(grid); + } + else if (grid->projtype == CDI_PROJ_RLL) gribapiDefProjRLL(gh, gridID); + else if (grid->projtype == CDI_PROJ_LCC) gribapiDefProjLCC(gh, gridID); + else if (grid->projtype == CDI_PROJ_STERE) gribapiDefProjSTERE(gh, gridID); + // clang-format on + + int zaxistype = gribapiGetZaxisType(gribEditionNumber(gh), leveltype1); + + switch (zaxistype) + { + case ZAXIS_HYBRID: + case ZAXIS_HYBRID_HALF: + { + long lpar; + GRIB_CHECK(grib_get_long(gh, "NV", &lpar), 0); + /* FIXME: assert(lpar >= 0) */ + size_t vctsize = (size_t) lpar; + if (vctsize > 0) + { + double *vctptr = (double *) Malloc(vctsize * sizeof(double)); + size_t dummy = vctsize; + GRIB_CHECK(grib_get_double_array(gh, "pv", vctptr, &dummy), 0); + varDefVCT(vctsize, vctptr); + Free(vctptr); + } + break; + } + case ZAXIS_REFERENCE: + { + unsigned char uuid[CDI_UUID_SIZE]; + long lpar; + GRIB_CHECK(grib_get_long(gh, "NV", &lpar), 0); + if (lpar != 6) fprintf(stderr, "Warning ...\n"); + GRIB_CHECK(grib_get_long(gh, "nlev", &lpar), 0); + int nhlev = (int) lpar; + GRIB_CHECK(grib_get_long(gh, "numberOfVGridUsed", &lpar), 0); + int nvgrid = (int) lpar; + size_t len = (size_t) CDI_UUID_SIZE; + memset(uuid, 0, CDI_UUID_SIZE); + GRIB_CHECK(grib_get_bytes(gh, "uuidOfVGrid", uuid, &len), 0); + varDefZAxisReference(nhlev, nvgrid, uuid); + break; + } + } + + // if ( datatype > 32 ) datatype = CDI_DATATYPE_PACK32; + if (datatype < 0) datatype = CDI_DATATYPE_PACK; + + // add the previously read record data to the (intermediate) list of records + int tile_index = 0; + int varID = 0, levelID = 0; + varAddRecord(recID, param, gridID, zaxistype, lbounds, level1, level2, level_sf, level_unit, datatype, &varID, &levelID, + tsteptype, leveltype1, leveltype2, varname, scanKeys, tiles, &tile_index); + + record->varID = (short) varID; + record->levelID = levelID; + + varDefCompType(varID, comptype); + + if (uvRelativeToGrid) varDefKeyInt(varID, CDI_KEY_UVRELATIVETOGRID, 1); + + if (varname[0]) gribapiGetNameKeys(gh, varID); + gribapiGetKeys(gh, varID); + + if (lread_additional_keys) + { + long lval; + double dval; + for (int i = 0; i < cdiNAdditionalGRIBKeys; i++) + { + // note: if the key is not defined, we do not throw an error! + if (grib_get_long(gh, cdiAdditionalGRIBKeys[i], &lval) == 0) + varDefOptGribInt(varID, tile_index, lval, cdiAdditionalGRIBKeys[i]); + if (grib_get_double(gh, cdiAdditionalGRIBKeys[i], &dval) == 0) + varDefOptGribDbl(varID, tile_index, dval, cdiAdditionalGRIBKeys[i]); + } + } + + if (varInqInst(varID) == CDI_UNDEFID) + { + long center, subcenter; + GRIB_CHECK(grib_get_long(gh, "centre", ¢er), 0); + GRIB_CHECK(grib_get_long(gh, "subCentre", &subcenter), 0); + int instID = institutInq((int) center, (int) subcenter, NULL, NULL); + if (instID == CDI_UNDEFID) instID = institutDef((int) center, (int) subcenter, NULL, NULL); + varDefInst(varID, instID); + } + + if (varInqModel(varID) == CDI_UNDEFID) + { + long processID; + if (grib_get_long(gh, "generatingProcessIdentifier", &processID) == 0) + { + /* FIXME: assert(processID >= INT_MIN && processID <= INT_MAX) */ + int modelID = modelInq(varInqInst(varID), (int) processID, NULL); + if (modelID == CDI_UNDEFID) modelID = modelDef(varInqInst(varID), (int) processID, NULL); + varDefModel(varID, modelID); + } + } + + if (varInqTable(varID) == CDI_UNDEFID) + { + int pdis, pcat, pnum; + cdiDecodeParam(param, &pnum, &pcat, &pdis); + + if (pdis == 255) + { + int tabnum = pcat; + int tableID = tableInq(varInqModel(varID), tabnum, NULL); + if (tableID == CDI_UNDEFID) tableID = tableDef(varInqModel(varID), tabnum, NULL); + varDefTable(varID, tableID); + } + } + + if (CDI_Debug) + Message("varID = %d param = %d zaxistype = %d gridID = %d levelID = %d", varID, param, zaxistype, gridID, levelID); +} + +static compvar2_t +gribapiVarSet(int param, int level1, int level2, int leveltype, int tsteptype, size_t gridsize, char *name, VarScanKeys scanKeys, + var_tile_t tiles_data) +{ + compvar2_t compVar; + memset(&compVar, 0, sizeof(compvar2_t)); + size_t maxlen = sizeof(compVar.name); + size_t len = strlen(name); + if (len > maxlen) len = maxlen; + + compVar.param = param; + compVar.level1 = level1; + compVar.level2 = level2; + compVar.ltype = leveltype; + compVar.tsteptype = tsteptype; + compVar.gridsize = gridsize; + // memset(compVar.name, 0, maxlen); + memcpy(compVar.name, name, len); + compVar.scanKeys = scanKeys; + compVar.tiles = tiles_data; + + return compVar; +} + +static int +gribapiVarCompare(compvar2_t compVar, record_t record, int flag) +{ + compvar2_t compVar0; + memset(&compVar0, 0, sizeof(compvar2_t)); + compVar0.param = record.param; + compVar0.level1 = record.ilevel; + compVar0.level2 = record.ilevel2; + compVar0.ltype = record.ltype; + compVar0.tsteptype = record.tsteptype; + compVar0.gridsize = record.gridsize; + memcpy(compVar0.name, record.varname, sizeof(compVar.name)); + + if (flag == 0) + { + if (compVar0.tsteptype == TSTEP_INSTANT && compVar.tsteptype == TSTEP_INSTANT3) compVar0.tsteptype = TSTEP_INSTANT3; + if (compVar0.tsteptype == TSTEP_INSTANT3 && compVar.tsteptype == TSTEP_INSTANT) compVar0.tsteptype = TSTEP_INSTANT; + } + + compVar0.scanKeys = record.scanKeys; + compVar0.tiles = record.tiles; + + // printf("var1: level1=%d level2=%d\n", compVar.level1, compVar.level2); + // printf("var2: level1=%d level2=%d\n", compVar0.level1, compVar0.level2); + + return memcmp(&compVar0, &compVar, sizeof(compvar2_t)); +} + +static grib_handle * +gribapiGetDiskRepresentation(size_t recsize, size_t *buffersize, void **gribbuffer, int *outDatatype, int *outCompressionType) +{ + int gribversion = (int) ((char *) *gribbuffer)[7]; + + if (gribversion <= 1) *outCompressionType = grbDecompress(recsize, buffersize, gribbuffer); + + grib_handle *gh = grib_handle_new_from_message(NULL, *gribbuffer, recsize); + + bool lieee = false; + + if (gribversion > 1) + { + size_t len = 256; + char typeOfPacking[256]; + if (grib_get_string(gh, "packingType", typeOfPacking, &len) == 0) + { + // fprintf(stderr, "packingType %zu %s\n", len, typeOfPacking); + if (strncmp(typeOfPacking, "grid_jpeg", len) == 0) + *outCompressionType = CDI_COMPRESS_JPEG; + else if (strncmp(typeOfPacking, "grid_ccsds", len) == 0) + *outCompressionType = CDI_COMPRESS_AEC; + else if (strncmp(typeOfPacking, "grid_ieee", len) == 0) + lieee = true; + } + } + + if (lieee) + { + long precision; + int status = grib_get_long(gh, "precision", &precision); + *outDatatype = (status == 0 && precision == 1) ? CDI_DATATYPE_FLT32 : CDI_DATATYPE_FLT64; + } + else + { + *outDatatype = CDI_DATATYPE_PACK; + long bitsPerValue; + if (grib_get_long(gh, "bitsPerValue", &bitsPerValue) == 0) + { + if (bitsPerValue > 0 && bitsPerValue <= 32) *outDatatype = (int) bitsPerValue; + } + } + + return gh; +} + +typedef enum +{ + CHECKTIME_OK, + CHECKTIME_SKIP, + CHECKTIME_STOP, + CHECKTIME_INCONSISTENT +} checkTimeResult; + +static checkTimeResult +checkTime(stream_t *streamptr, compvar2_t compVar, CdiDateTime verificationTime, CdiDateTime expectedVTime) +{ + // First determine whether the current record exists already. + int recID = 0; + for (; recID < streamptr->nrecs; recID++) + { + if (gribapiVarCompare(compVar, streamptr->tsteps[0].records[recID], 1) == 0) break; + } + bool recordExists = (recID < streamptr->nrecs); + + // Then we need to know whether the verification time is consistent. + bool consistentTime = cdiDateTime_isEQ(verificationTime, expectedVTime); + + // Finally, we make a decision. + if (CDI_Inventory_Mode == 1) + { + if (recordExists) return CHECKTIME_STOP; + if (!consistentTime) return CHECKTIME_INCONSISTENT; + } + else + { + if (!consistentTime) return CHECKTIME_STOP; + if (recordExists) return CHECKTIME_SKIP; + } + + return CHECKTIME_OK; +} + +#define gribWarning(text, nrecs, timestep, varname, param, level1, level2) \ + do \ + { \ + char paramstr[32]; \ + cdiParamToString(param, paramstr, sizeof(paramstr)); \ + Warning("Record %2d (name=%s id=%s lev1=%d lev2=%d) timestep %d: %s", nrecs, varname, paramstr, level1, level2, timestep, \ + text); \ + } \ + while (0) + +#ifdef HAVE_LIBFDB5 +#endif + +int +fdbScanTimesteps(stream_t *streamptr) +{ +#ifdef HAVE_LIBFDB5 + void *gribbuffer = NULL; + size_t buffersize = 0; + grib_handle *gh = NULL; + + fdb_handle_t *fdbHandle = streamptr->protocolData; + + char **fdbItemList = NULL; + fdb_request_t *request = create_fdb_request(streamptr->filename); + int numItems = fdb_fill_itemlist(fdbHandle, request, &fdbItemList); + fdb_delete_request(request); + if (numItems == 0) Error("FDB request does not find any database entries!"); + if (CDI_Debug) + for (int i = 0; i < numItems; ++i) printf("item[%d] = %s\n", i + 1, fdbItemList[i]); + + KeyValueEntry *keyValueList = (KeyValueEntry *) malloc(numItems * sizeof(KeyValueEntry)); + for (int i = 0; i < numItems; ++i) keyValueList[i].item = NULL; + + RecordInfoEntry *recordInfoList = (RecordInfoEntry *) malloc(numItems * sizeof(RecordInfoEntry)); + for (int i = 0; i < numItems; ++i) record_info_entry_init(&recordInfoList[i]); + + for (int i = 0; i < numItems; ++i) decode_fdbitem(fdbItemList[i], &keyValueList[i]); + if (check_keyvalueList(numItems, keyValueList) != 0) return 1; + for (int i = 0; i < numItems; ++i) decode_keyvalue(&keyValueList[i], &recordInfoList[i]); + + int numRecords = get_num_records(numItems, recordInfoList); + int numTimesteps = numItems / numRecords; + if (CDI_Debug) Message("numRecords=%d numTimesteps=%d", numRecords, numTimesteps); + + for (int i = 0; i < numItems; ++i) + if (keyValueList[i].item) free(keyValueList[i].item); + free(keyValueList); + + if (numRecords == 0) return CDI_EUFSTRUCT; + + int *timestepRecordOffset = (int *) malloc(numTimesteps * sizeof(int)); + for (int i = 0; i < numTimesteps; i++) timestepRecordOffset[i] = i * numRecords; + numTimesteps = remove_duplicate_timesteps(recordInfoList, numRecords, numTimesteps, timestepRecordOffset); + if (CDI_Debug) Message("numRecords=%d numTimesteps=%d", numRecords, numTimesteps); + + CdiDateTime vDateTime0; + cdiDateTime_init(&vDateTime0); + int fcast = 0; + + streamptr->curTsID = 0; + + int tsIDnew = tstepsNewEntry(streamptr); + if (tsIDnew != 0) Error("Internal problem! tstepsNewEntry returns %d", tsIDnew); + + taxis_t *taxis = &streamptr->tsteps[tsIDnew].taxis; + + for (int recID = 0; recID < numRecords; recID++) + { + long recsize = fdb_read_record(fdbHandle, fdbItemList[recID], &buffersize, &gribbuffer); + + int datatype, comptype = 0; + gh = gribapiGetDiskRepresentation(recsize, &buffersize, &gribbuffer, &datatype, &comptype); + + GRIB_CHECK(my_grib_set_double(gh, "missingValue", CDI_Default_Missval), 0); + + int leveltype1 = -1, leveltype2 = -1, lbounds, level_sf, level_unit; + var_tile_t tiles = dummy_tiles; + int level1 = 0, level2 = 0; + gribGetLevel(gh, &leveltype1, &leveltype2, &lbounds, &level1, &level2, &level_sf, &level_unit, &tiles); + + char varname[256]; + gribapiGetString(gh, "shortName", varname, sizeof(varname)); + + int param = gribapiGetParam(gh); + + CdiDateTime sDateTime; + CdiDateTime vDateTime = gribapiGetValidityDateTime(gh, &sDateTime); + + VarScanKeys scanKeys = gribapiGetScanKeys(gh); + + if (recID == 0) + { + vDateTime0 = vDateTime; + taxis->rDateTime = gribapiGetDataDateTime(gh); + fcast = gribapiTimeIsFC(gh); + if (fcast) taxis->unit = gribapiGetTimeUnits(gh); + taxis->fDateTime = taxis->rDateTime; + taxis->sDateTime = sDateTime; + taxis->vDateTime = vDateTime; + } + + if (CDI_Debug) + { + char paramstr[32]; + cdiParamToString(param, paramstr, sizeof(paramstr)); + Message("%4d name=%s id=%s ltype=%d lev1=%d lev2=%d vDateTime=%s", recID + 1, varname, paramstr, leveltype1, level1, + level2, CdiDateTime_string(vDateTime)); + } + + var_tile_t *ptiles = memcmp(&tiles, &dummy_tiles, sizeof(var_tile_t)) ? &tiles : NULL; + int recpos = 0; + gribapiAddRecord(streamptr, param, gh, recsize, recpos, datatype, comptype, varname, leveltype1, leveltype2, lbounds, level1, + level2, level_sf, level_unit, &scanKeys, ptiles, true, fdbItemList[recID]); + fdbItemList[recID] = NULL; + + grib_handle_delete(gh); + gh = NULL; + } + + if (gh) grib_handle_delete(gh); + + cdi_generate_vars(streamptr); + + taxis->type = fcast ? TAXIS_RELATIVE : TAXIS_ABSOLUTE; + int taxisID = taxisCreate(taxis->type); + + vlistDefTaxis(streamptr->vlistID, taxisID); + + streamScanResizeRecords1(streamptr); + + streamptr->record->buffer = gribbuffer; + streamptr->record->buffersize = buffersize; + + if (numTimesteps == 1) streamptr->ntsteps = 1; + streamScanTimeConstAdjust(streamptr, taxis); + + for (int tsID = 1; tsID < numTimesteps; tsID++) + { + int recordOffset = timestepRecordOffset[tsID]; + int vdate = recordInfoList[recordOffset].date; + int vtime = recordInfoList[recordOffset].time * 100; + // printf("timestep=%d recOffset=%d date=%d time=%d\n", tsID + 1, recordOffset, vdate, vtime); + + int tsIDnext = tstepsNewEntry(streamptr); + if (tsIDnext != tsID) Error("Internal error. tsID = %d", tsID); + + streamptr->tsteps[tsID - 1].next = true; + streamptr->tsteps[tsID].position = 0; + + taxis = &streamptr->tsteps[tsID].taxis; + + cdi_create_records(streamptr, tsID); + record_t *records = streamptr->tsteps[tsID].records; + + int nrecs = (tsID == 1) ? streamScanInitRecords2(streamptr) : streamScanInitRecords(streamptr, tsID); + if (nrecs != numRecords) Error("Internal error. nrecs = %d", nrecs); + + taxis->vDateTime = cdiDateTime_set(vdate, vtime); + + int rindex = 0; + for (int recID = 0; recID < numRecords; recID++) + { + records[recID].used = true; + streamptr->tsteps[tsID].recIDs[rindex] = recID; + rindex++; + + records[recID].position = 0; + records[recID].size = 0; + records[recID].fdbItem = fdbItemList[recordOffset + recID]; + fdbItemList[recordOffset + recID] = NULL; + } + + if (tsID == 1) streamptr->tsteps[1].nrecs = numRecords; + } + + streamptr->rtsteps = numTimesteps; + streamptr->ntsteps = numTimesteps; + + for (int i = 0; i < numItems; ++i) + if (fdbItemList[i]) free(fdbItemList[i]); + + if (fdbItemList) free(fdbItemList); + if (recordInfoList) free(recordInfoList); + if (timestepRecordOffset) free(timestepRecordOffset); +#endif + + return 0; +} + +int +gribapiScanTimestep1(stream_t *streamptr) +{ + CdiDateTime vDateTime0; + cdiDateTime_init(&vDateTime0); + off_t recpos = 0; + void *gribbuffer = NULL; + size_t buffersize = 0; + int nrecsScanned = 0; // Only used for debug output. + bool warn_time = true; + int fcast = 0; + grib_handle *gh = NULL; + + streamptr->curTsID = 0; + + int tsID = tstepsNewEntry(streamptr); + if (tsID != 0) Error("Internal problem! tstepsNewEntry returns %d", tsID); + + taxis_t *taxis = &streamptr->tsteps[tsID].taxis; + + int fileID = streamptr->fileID; + + unsigned nrecs = 0; + while (true) + { + size_t recsize = gribGetSize(fileID); + recpos = fileGetPos(fileID); + + if (recsize == 0) + { + streamptr->ntsteps = 1; + break; + } + + ensureBufferSize(recsize, &buffersize, &gribbuffer); + + size_t readsize = recsize; + // Search for next 'GRIB', read the following record, and position file offset after it. + if (gribRead(fileID, gribbuffer, &readsize)) break; + + nrecsScanned++; + + int datatype, comptype = 0; + gh = gribapiGetDiskRepresentation(recsize, &buffersize, &gribbuffer, &datatype, &comptype); + + GRIB_CHECK(my_grib_set_double(gh, "missingValue", CDI_Default_Missval), 0); + + int leveltype1 = -1, leveltype2 = -1, lbounds, level_sf, level_unit; + var_tile_t tiles = dummy_tiles; + int level1 = 0, level2 = 0; + gribGetLevel(gh, &leveltype1, &leveltype2, &lbounds, &level1, &level2, &level_sf, &level_unit, &tiles); + + char varname[256]; + gribapiGetString(gh, "shortName", varname, sizeof(varname)); + + int param = gribapiGetParam(gh); + + if (!varname[0]) param_to_name(param, varname); + + CdiDateTime sDateTime; + CdiDateTime vDateTime = gribapiGetValidityDateTime(gh, &sDateTime); + + VarScanKeys scanKeys = gribapiGetScanKeys(gh); + + if (nrecs == 0) + { + vDateTime0 = vDateTime; + taxis->rDateTime = gribapiGetDataDateTime(gh); + fcast = gribapiTimeIsFC(gh); + if (fcast) taxis->unit = gribapiGetTimeUnits(gh); + taxis->fDateTime = taxis->rDateTime; + taxis->sDateTime = sDateTime; + taxis->vDateTime = vDateTime; + } + else + { + if (cdiDateTime_isLT(sDateTime, taxis->sDateTime)) taxis->sDateTime = sDateTime; + + int tsteptype = gribapiGetTsteptype(gh); + size_t gridsize = gribapiGetGridsize(gh); + checkTimeResult result = checkTime( + streamptr, gribapiVarSet(param, level1, level2, leveltype1, tsteptype, gridsize, varname, scanKeys, tiles), vDateTime, + vDateTime0); + if (result == CHECKTIME_STOP) + { + nrecsScanned--; + break; + } + else if (result == CHECKTIME_SKIP) + { + gribWarning("Parameter already exist, skipped!", nrecsScanned, tsID + 1, varname, param, level1, level2); + continue; + } + else if (result == CHECKTIME_INCONSISTENT && warn_time) + { + gribWarning("Inconsistent verification time!", nrecsScanned, tsID + 1, varname, param, level1, level2); + warn_time = false; + } + assert(result == CHECKTIME_OK || result == CHECKTIME_INCONSISTENT); + } + + nrecs++; + + if (CDI_Debug) + { + char paramstr[32]; + cdiParamToString(param, paramstr, sizeof(paramstr)); + Message("%4u %8d name=%s id=%s ltype=%d lev1=%d lev2=%d vDateTime=%s", nrecs, (int) recpos, varname, paramstr, leveltype1, + level1, level2, CdiDateTime_string(vDateTime)); + } + + var_tile_t *ptiles = memcmp(&tiles, &dummy_tiles, sizeof(var_tile_t)) ? &tiles : NULL; + gribapiAddRecord(streamptr, param, gh, recsize, recpos, datatype, comptype, varname, leveltype1, leveltype2, lbounds, level1, + level2, level_sf, level_unit, &scanKeys, ptiles, true, NULL); + + grib_handle_delete(gh); + gh = NULL; + } + + if (gh) grib_handle_delete(gh); + + streamptr->rtsteps = 1; + + if (nrecs == 0) return CDI_EUFSTRUCT; + + if (streamptr->query) + { + int numEntries = cdiQueryNumEntries(streamptr->query); + int numEntriesFound = cdiQueryNumEntriesFound(streamptr->query); + cdiQueryPrintEntriesNotFound(streamptr->query); + if (numEntriesFound == 0 || (CDI_Query_Abort && numEntries != numEntriesFound)) return CDI_EQENF; + } + + cdi_generate_vars(streamptr); + + taxis->type = fcast ? TAXIS_RELATIVE : TAXIS_ABSOLUTE; + int taxisID = taxisCreate(taxis->type); + + int vlistID = streamptr->vlistID; + vlistDefTaxis(vlistID, taxisID); + + streamScanResizeRecords1(streamptr); + + streamptr->record->buffer = gribbuffer; + streamptr->record->buffersize = buffersize; + + streamScanTsFixNtsteps(streamptr, recpos); + streamScanTimeConstAdjust(streamptr, taxis); + + return 0; +} + +int +gribapiScanTimestep2(stream_t *streamptr) +{ + CdiDateTime vDateTime0; + cdiDateTime_init(&vDateTime0); + int rstatus = 0; + off_t recpos = 0; + // int gridID; + int recID; + grib_handle *gh = NULL; + + streamptr->curTsID = 1; + + int fileID = streamptr->fileID; + int vlistID = streamptr->vlistID; + + void *gribbuffer = streamptr->record->buffer; + size_t buffersize = streamptr->record->buffersize; + + int tsID = streamptr->rtsteps; + if (tsID != 1) Error("Internal problem! unexpected timestep %d", tsID + 1); + + taxis_t *taxis = &streamptr->tsteps[tsID].taxis; + + fileSetPos(fileID, streamptr->tsteps[tsID].position, SEEK_SET); + + cdi_create_records(streamptr, tsID); + record_t *records = streamptr->tsteps[tsID].records; + + int nrecords = streamScanInitRecords2(streamptr); + + int nrecsScanned = nrecords; // Only used for debug output + for (int rindex = 0; rindex <= nrecords; ++rindex) + { + size_t recsize = gribGetSize(fileID); + recpos = fileGetPos(fileID); + if (recsize == 0) + { + streamptr->ntsteps = 2; + break; + } + + ensureBufferSize(recsize, &buffersize, &gribbuffer); + + size_t readsize = recsize; + if (gribRead(fileID, gribbuffer, &readsize)) break; + + grbDecompress(recsize, &buffersize, &gribbuffer); + + nrecsScanned++; + gh = grib_handle_new_from_message(NULL, gribbuffer, recsize); + GRIB_CHECK(my_grib_set_double(gh, "missingValue", CDI_Default_Missval), 0); + + int level1 = 0, level2 = 0, leveltype1, leveltype2, lbounds, level_sf, level_unit; + var_tile_t tiles = dummy_tiles; + gribGetLevel(gh, &leveltype1, &leveltype2, &lbounds, &level1, &level2, &level_sf, &level_unit, &tiles); + + char varname[256]; + gribapiGetString(gh, "shortName", varname, sizeof(varname)); + + int param = gribapiGetParam(gh); + + if (!varname[0]) param_to_name(param, varname); + + CdiDateTime sDateTime; + CdiDateTime vDateTime = gribapiGetValidityDateTime(gh, &sDateTime); + + if (rindex == 0) + { + vDateTime0 = vDateTime; + int taxisID = vlistInqTaxis(vlistID); + if (taxisInqType(taxisID) == TAXIS_RELATIVE) + { + taxis->type = TAXIS_RELATIVE; + taxis->unit = gribapiGetTimeUnits(gh); + taxis->rDateTime = gribapiGetDataDateTime(gh); + } + else + { + taxis->type = TAXIS_ABSOLUTE; + } + taxis->fDateTime = taxis->rDateTime; + taxis->vDateTime = vDateTime; + taxis->sDateTime = sDateTime; + } + else + { + if (cdiDateTime_isLT(sDateTime, taxis->sDateTime)) taxis->sDateTime = sDateTime; + } + + VarScanKeys scanKeys = gribapiGetScanKeys(gh); + + int tsteptype = gribapiGetTsteptype(gh); + size_t gridsize = gribapiGetGridsize(gh); + compvar2_t compVar = gribapiVarSet(param, level1, level2, leveltype1, tsteptype, gridsize, varname, scanKeys, tiles); + + for (recID = 0; recID < nrecords; recID++) + if (gribapiVarCompare(compVar, records[recID], 0) == 0) break; + + if (recID == nrecords) + { + if (CDI_Inventory_Mode == 1) + { + gribWarning("Parameter not defined at timestep 1!", nrecsScanned, tsID + 1, varname, param, level1, level2); + return CDI_EUFSTRUCT; + } + else + { + gribWarning("Parameter not defined at timestep 1, skipped!", nrecsScanned, tsID + 1, varname, param, level1, level2); + continue; + } + } + + if (records[recID].used) + { + if (CDI_Inventory_Mode == 1) + break; + else + { + if (cdiDateTime_isNE(vDateTime, vDateTime0)) break; + + gribWarning("Parameter already exist, skipped!", nrecsScanned, tsID + 1, varname, param, level1, level2); + continue; + } + } + + records[recID].used = true; + streamptr->tsteps[tsID].recIDs[rindex] = recID; + + if (CDI_Debug) + { + char paramstr[32]; + cdiParamToString(param, paramstr, sizeof(paramstr)); + Message("%4d %8lld name=%s id=%s ltype=%d lev1=%d lev2=%d vDateTime=%s", nrecsScanned, (long long) recpos, varname, + paramstr, leveltype1, level1, level2, CdiDateTime_string(vDateTime)); + } + + if (gribapiVarCompare(compVar, records[recID], 0) != 0) + { + Message("tsID = %d recID = %d param = %3d new %3d level = %3d new %3d", tsID, recID, records[recID].param, param, + records[recID].ilevel, level1); + return CDI_EUFSTRUCT; + } + + records[recID].position = recpos; + records[recID].size = recsize; + + int varID = records[recID].varID; + + if (tsteptype != vlistInqVarTsteptype(vlistID, varID)) vlistDefVarTsteptype(vlistID, varID, tsteptype); + + grib_handle_delete(gh); + gh = NULL; + } + + if (gh) grib_handle_delete(gh); + + int nrecs = 0; + for (recID = 0; recID < nrecords; recID++) + { + if (records[recID].used) + nrecs++; + else + vlistDefVarTimetype(vlistID, records[recID].varID, TIME_CONSTANT); + } + streamptr->tsteps[tsID].nrecs = nrecs; + + streamptr->rtsteps = 2; + + streamScanTsFixNtsteps(streamptr, recpos); + + streamptr->record->buffer = gribbuffer; + streamptr->record->buffersize = buffersize; + + return rstatus; +} + +int +gribapiScanTimestep(stream_t *streamptr) +{ + int vrecID, recID = -1; + int nrecs = 0; + int vlistID = streamptr->vlistID; + int tsID = streamptr->rtsteps; + taxis_t *taxis = &streamptr->tsteps[tsID].taxis; + + if (streamptr->tsteps[tsID].recordSize == 0) + { + void *gribbuffer = streamptr->record->buffer; + size_t buffersize = streamptr->record->buffersize; + + cdi_create_records(streamptr, tsID); + record_t *records = streamptr->tsteps[tsID].records; + + nrecs = streamScanInitRecords(streamptr, tsID); + + int fileID = streamptr->fileID; + + fileSetPos(fileID, streamptr->tsteps[tsID].position, SEEK_SET); + + int nrecsScanned = streamptr->tsteps[0].nallrecs + streamptr->tsteps[1].nrecs * (tsID - 1); // Only used for debug output. + off_t recpos = 0; + CdiDateTime vDateTime0; + cdiDateTime_init(&vDateTime0); + grib_handle *gh = NULL; + char varname[256]; + for (int rindex = 0; rindex <= nrecs; ++rindex) + { + varname[0] = 0; + size_t recsize = gribGetSize(fileID); + recpos = fileGetPos(fileID); + if (recsize == 0) + { + streamptr->ntsteps = streamptr->rtsteps + 1; + break; + } + + ensureBufferSize(recsize, &buffersize, &gribbuffer); + + size_t readsize = recsize; + if (gribRead(fileID, gribbuffer, &readsize)) + { + Warning("Inconsistent timestep %d (GRIB record %d/%d)!", tsID + 1, rindex + 1, streamptr->tsteps[tsID].recordSize); + break; + } + + grbDecompress(recsize, &buffersize, &gribbuffer); + + nrecsScanned++; + gh = grib_handle_new_from_message(NULL, gribbuffer, recsize); + GRIB_CHECK(my_grib_set_double(gh, "missingValue", CDI_Default_Missval), 0); + + int level1 = 0, level2 = 0, leveltype1, leveltype2 = -1, lbounds, level_sf, level_unit; + var_tile_t tiles = dummy_tiles; + gribGetLevel(gh, &leveltype1, &leveltype2, &lbounds, &level1, &level2, &level_sf, &level_unit, &tiles); + + CdiDateTime sDateTime; + CdiDateTime vDateTime = gribapiGetValidityDateTime(gh, &sDateTime); + + if (rindex == nrecs) break; + + gribapiGetString(gh, "shortName", varname, sizeof(varname)); + + int param = gribapiGetParam(gh); + + if (!varname[0]) param_to_name(param, varname); + + if (rindex == 0) + { + vDateTime0 = vDateTime; + int taxisID = vlistInqTaxis(vlistID); + if (taxisInqType(taxisID) == TAXIS_RELATIVE) + { + taxis->type = TAXIS_RELATIVE; + taxis->unit = gribapiGetTimeUnits(gh); + taxis->rDateTime = gribapiGetDataDateTime(gh); + } + else + { + taxis->type = TAXIS_ABSOLUTE; + } + taxis->fDateTime = taxis->rDateTime; + taxis->vDateTime = vDateTime; + taxis->sDateTime = sDateTime; + } + else + { + if (cdiDateTime_isLT(sDateTime, taxis->sDateTime)) taxis->sDateTime = sDateTime; + } + + VarScanKeys scanKeys = gribapiGetScanKeys(gh); + + int tsteptype = gribapiGetTsteptype(gh); + size_t gridsize = gribapiGetGridsize(gh); + compvar2_t compVar = gribapiVarSet(param, level1, level2, leveltype1, tsteptype, gridsize, varname, scanKeys, tiles); + + for (vrecID = 0; vrecID < nrecs; vrecID++) + { + recID = streamptr->tsteps[1].recIDs[vrecID]; + if (gribapiVarCompare(compVar, records[recID], 0) == 0) break; + } + + if (vrecID == nrecs) + { + if (CDI_Inventory_Mode == 1) + { + gribWarning("Parameter not defined at timestep 1!", nrecsScanned, tsID + 1, varname, param, level1, level2); + return CDI_EUFSTRUCT; + } + else + { + gribWarning("Parameter not defined at timestep 1, skipped!", nrecsScanned, tsID + 1, varname, param, level1, + level2); + continue; + } + } + + if (CDI_Inventory_Mode != 1) + { + if (records[recID].used) + { + if (cdiDateTime_isNE(vDateTime, vDateTime0)) break; + + if (CDI_Debug) + gribWarning("Parameter already exist, skipped!", nrecsScanned, tsID + 1, varname, param, level1, level2); + + continue; + } + } + + records[recID].used = true; + streamptr->tsteps[tsID].recIDs[rindex] = recID; + + if (CDI_Debug) + Message("%4d %8lld %4d %8d %8s", rindex + 1, (long long) recpos, param, level1, CdiDateTime_string(vDateTime)); + + if (gribapiVarCompare(compVar, records[recID], 0) != 0) + { + Message("tsID = %d recID = %d param = %3d new %3d level = %3d new %3d", tsID, recID, records[recID].param, param, + records[recID].ilevel, level1); + Error("Invalid, unsupported or inconsistent record structure"); + } + + records[recID].position = recpos; + records[recID].size = recsize; + + if (CDI_Debug) Message("%4d %8lld %4d %8d %s", rindex, (long long) recpos, param, level1, CdiDateTime_string(vDateTime)); + + grib_handle_delete(gh); + gh = NULL; + } + + if (gh) grib_handle_delete(gh); + + for (vrecID = 0; vrecID < nrecs; vrecID++) + { + recID = streamptr->tsteps[tsID].recIDs[vrecID]; + if (!records[recID].used) break; + } + + if (vrecID < nrecs) + { + gribWarning("Parameter not found!", nrecsScanned, tsID + 1, varname, records[recID].param, records[recID].ilevel, + records[recID].ilevel2); + return CDI_EUFSTRUCT; + } + + streamptr->rtsteps++; + + if (streamptr->ntsteps != streamptr->rtsteps) + { + tsID = tstepsNewEntry(streamptr); + if (tsID != streamptr->rtsteps) Error("Internal error. tsID = %d", tsID); + + streamptr->tsteps[tsID - 1].next = true; + streamptr->tsteps[tsID].position = recpos; + } + + fileSetPos(fileID, streamptr->tsteps[tsID].position, SEEK_SET); + streamptr->tsteps[tsID].position = recpos; + + streamptr->record->buffer = gribbuffer; + streamptr->record->buffersize = buffersize; + } + + if (nrecs > 0 && nrecs < streamptr->tsteps[tsID].nrecs) + { + Warning("Incomplete timestep. Stop scanning at timestep %d.", tsID); + streamptr->ntsteps = tsID; + } + + return streamptr->ntsteps; +} + +#ifdef gribWarning +#undef gribWarning +#endif + +int +gribapiDecode(void *gribbuffer, size_t gribsize, void *data, size_t gridsize, int unreduced, size_t *nmiss, double missval) +{ + int status = 0; + + if (unreduced) + { + static bool lwarn = true; + if (lwarn) + { + lwarn = false; + Warning("Conversion of gaussian reduced grids unsupported!"); + } + } + + size_t recsize = (size_t) gribsize; + grib_handle *gh = grib_handle_new_from_message(NULL, gribbuffer, recsize); + GRIB_CHECK(my_grib_set_double(gh, "missingValue", missval), 0); + + // get the size of the values array + size_t datasize; + GRIB_CHECK(grib_get_size(gh, "values", &datasize), 0); + // long numberOfPoints; + // GRIB_CHECK(grib_get_long(gh, "numberOfPoints", &numberOfPoints), 0); + // printf("values_size = %d numberOfPoints = %ld\n", datasize, numberOfPoints); + + if (gridsize != datasize) Error("Internal problem: gridsize(%zu) != datasize(%zu)!", gridsize, datasize); + size_t dummy = datasize; + GRIB_CHECK(grib_get_double_array(gh, "values", (double *) data, &dummy), 0); + + long lpar; + GRIB_CHECK(grib_get_long(gh, "gridDefinitionTemplateNumber", &lpar), 0); + int gridtype = (int) lpar; + + *nmiss = 0; + if (gridtype < 50 || gridtype > 53) + { + GRIB_CHECK(grib_get_long(gh, "numberOfMissing", &lpar), 0); + *nmiss = (int) lpar; + // printf("gridtype %d, nmiss %d\n", gridtype, nmiss); + } + + grib_handle_delete(gh); + + return status; +} + +static void +gribapiDefInstitut(grib_handle *gh, int vlistID, int varID) +{ + int instID = vlistInqInstitut(vlistID); + + if (instID == CDI_UNDEFID) instID = vlistInqVarInstitut(vlistID, varID); + + if (instID != CDI_UNDEFID) + { + long center = institutInqCenter(instID); + long subcenter = institutInqSubcenter(instID); + + long center0, subcenter0; + GRIB_CHECK(grib_get_long(gh, "centre", ¢er0), 0); + GRIB_CHECK(grib_get_long(gh, "subCentre", &subcenter0), 0); + + if (center != center0) GRIB_CHECK(my_grib_set_long(gh, "centre", center), 0); + if (subcenter != subcenter0) GRIB_CHECK(my_grib_set_long(gh, "subCentre", subcenter), 0); + } + + int status; + int centre, subCentre; + status = cdiInqKeyInt(vlistID, CDI_GLOBAL, CDI_KEY_CENTRE, ¢re); + if (status == 0) grib_set_long(gh, "centre", centre); + status = cdiInqKeyInt(vlistID, CDI_GLOBAL, CDI_KEY_SUBCENTRE, &subCentre); + if (status == 0) grib_set_long(gh, "subCentre", subCentre); + + status = cdiInqKeyInt(vlistID, varID, CDI_KEY_CENTRE, ¢re); + if (status == 0) grib_set_long(gh, "centre", centre); + status = cdiInqKeyInt(vlistID, varID, CDI_KEY_SUBCENTRE, &subCentre); + if (status == 0) grib_set_long(gh, "subCentre", subCentre); +} + +static void +gribapiDefModel(grib_handle *gh, int vlistID, int varID) +{ + int modelID = vlistInqModel(vlistID); + if (modelID == CDI_UNDEFID) modelID = vlistInqVarModel(vlistID, varID); + + if (modelID != CDI_UNDEFID) GRIB_CHECK(my_grib_set_long(gh, "generatingProcessIdentifier", modelInqGribID(modelID)), 0); +} + +static void +gribapiDefParam(int editionNumber, grib_handle *gh, int param, const char *name, const char *stdname) +{ + bool ldefined = false; + + int pdis, pcat, pnum; + cdiDecodeParam(param, &pnum, &pcat, &pdis); + + if (pnum < 0) + { + size_t len = strlen(stdname); + if (len) + { + int status = my_grib_set_string(gh, "cfName", stdname, &len); + if (status == 0) + ldefined = true; + else + Warning("grib_api: No match for cfName=%s", stdname); + } + + if (ldefined == false) + { + len = strlen(name); + int status = my_grib_set_string(gh, "shortName", name, &len); + if (status == 0) + ldefined = true; + else + Warning("grib_api: No match for shortName=%s", name); + } + } + + if (ldefined == false) + { + if (pnum < 0) pnum = -pnum; + + if (pnum > 255) + { + static bool lwarn_pnum = true; + if (lwarn_pnum) + { + Warning("Parameter number %d out of range (1-255), set to %d!", pnum, pnum % 256); + lwarn_pnum = false; + } + pnum = pnum % 256; + } + + if (editionNumber <= 1) + { + static bool lwarn_pdis = true; + if (pdis != 255 && lwarn_pdis) + { + char paramstr[32]; + cdiParamToString(param, paramstr, sizeof(paramstr)); + Warning("Can't convert GRIB2 parameter ID (%s) to GRIB1, set to %d.%d!", paramstr, pnum, pcat); + lwarn_pdis = false; + } + + GRIB_CHECK(my_grib_set_long(gh, "table2Version", pcat), 0); + GRIB_CHECK(my_grib_set_long(gh, "indicatorOfParameter", pnum), 0); + } + else + { + GRIB_CHECK(my_grib_set_long(gh, "discipline", pdis), 0); + GRIB_CHECK(my_grib_set_long(gh, "parameterCategory", pcat), 0); + GRIB_CHECK(my_grib_set_long(gh, "parameterNumber", pnum), 0); + } + } + + // printf("param: %d.%d.%d %s\n", pnum, pcat, pdis, name); +} + +static int +getTimeunitFactor(int timeunit) +{ + switch (timeunit) + { + case TUNIT_SECOND: return 1; + case TUNIT_MINUTE: return 60; + case TUNIT_HOUR: return 3600; + case TUNIT_3HOURS: return 10800; + case TUNIT_6HOURS: return 21600; + case TUNIT_12HOURS: return 43200; + case TUNIT_DAY: return 86400; + } + + return 3600; +} + +static int +grib2ProDefTempHasStatisticalDef(int proDefTempNum) +{ + switch (proDefTempNum) + { + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + case 14: + case 34: + case 42: + case 43: + case 46: + case 47: + case 61: + case 91: + case 1001: + case 1101: + case 40034: return 1; + } + + return 0; +} + +static int +getUnitsOfTime(int timeunit) +{ + switch (timeunit) + { + case TUNIT_SECOND: return 13; + case TUNIT_MINUTE: return 0; + case TUNIT_HOUR: return 1; + case TUNIT_3HOURS: return 10; + case TUNIT_6HOURS: return 11; + case TUNIT_12HOURS: return 12; + case TUNIT_DAY: return 2; + } + + return 1; +} + +static void +gribapiDefStepUnits(int editionNumber, grib_handle *gh, int timeunit, int proDefTempNum, int gcinit) +{ + if (!gcinit) + { + long unitsOfTime = getUnitsOfTime(timeunit); + + grib_set_long(gh, "stepUnits", unitsOfTime); + if (editionNumber == 1) + { + grib_set_long(gh, "unitOfTimeRange", unitsOfTime); + } + else if (grib2ProDefTempHasStatisticalDef(proDefTempNum)) + { + grib_set_long(gh, "indicatorOfUnitForTimeRange", unitsOfTime); + grib_set_long(gh, "indicatorOfUnitOfTimeRange", unitsOfTime); + } + else + { + // NOTE KNMI: HIRLAM model files LAMH_D11 are in grib1 and do NOT have key indicatorOfUnitForTimeRange + // Watch out for compatibility issues. + grib_set_long(gh, "indicatorOfUnitOfTimeRange", unitsOfTime); + } + } +} + +static int +gribapiDefSteptype(int editionNumber, grib_handle *gh, int productDefinitionTemplate, int typeOfGeneratingProcess, int tsteptype, + int gcinit) +{ + const char *stepType = "instant"; + long proDefTempNum = 0; + + if (tsteptype >= TSTEP_INSTANT && tsteptype <= TSTEP_SUM) + { + stepType = cdiGribAPI_ts_str_map[tsteptype].sname; + proDefTempNum = cdiGribAPI_ts_str_map[tsteptype].productionTemplate; + } + + if (productDefinitionTemplate != -1) + proDefTempNum = productDefinitionTemplate; + else if (typeOfGeneratingProcess == 4) + proDefTempNum = (proDefTempNum == 8) ? 11 : 1; + + if (!gcinit) + { + if (editionNumber > 1) GRIB_CHECK(my_grib_set_long(gh, "productDefinitionTemplateNumber", proDefTempNum), 0); + size_t len = strlen(stepType); + int status = my_grib_set_string(gh, "stepType", stepType, &len); + if (status != 0) GRIB_CHECK(my_grib_set_long(gh, "productDefinitionTemplateNumber", 0), 0); + } + + return (int) proDefTempNum; +} + +static void +gribapiDefDateTimeAbs(int editionNumber, grib_handle *gh, CdiDateTime dateTime, int productDefinitionTemplate, + int typeOfGeneratingProcess, int tsteptype, int gcinit) +{ + (void) gribapiDefSteptype(editionNumber, gh, productDefinitionTemplate, typeOfGeneratingProcess, tsteptype, gcinit); + + if (editionNumber > 1) GRIB_CHECK(my_grib_set_long(gh, "significanceOfReferenceTime", 0), 0); + if (editionNumber > 1) GRIB_CHECK(my_grib_set_long(gh, "stepRange", 0), 0); + + if (cdiDateTime_isNull(dateTime)) dateTime.date = cdiDate_set(10101); + gribapiSetDataDateTime(gh, dateTime); +} + +static int +gribapiDefDateTimeRel(int editionNumber, grib_handle *gh, CdiDateTime fDateTime, CdiDateTime vDateTime, CdiDateTime sDateTime, + int productDefinitionTemplate, int typeOfGeneratingProcess, int tsteptype, int timeunit, int calendar, + int gcinit) +{ + int status = -1; + + JulianDate julianDate1 = julianDate_encode(calendar, fDateTime); + + if (cdiDateTime_isNull(vDateTime)) vDateTime = fDateTime; + + JulianDate julianDate2 = julianDate_encode(calendar, vDateTime); + JulianDate julianDate = julianDate_sub(julianDate2, julianDate1); + + int factor = getTimeunitFactor(timeunit); + + if (!(int) (fmod(julianDate_to_seconds(julianDate), factor))) + { + int proDefTempNum + = gribapiDefSteptype(editionNumber, gh, productDefinitionTemplate, typeOfGeneratingProcess, tsteptype, gcinit); + gribapiDefStepUnits(editionNumber, gh, timeunit, proDefTempNum, gcinit); + + long startStep = 0; + double endStepF = julianDate_to_seconds(julianDate) / factor; + long maxStep = (editionNumber > 1) ? INT_MAX : 65000; + if (endStepF > maxStep) return status; + long endStep = lround(endStepF); + + bool hasStartDate = (tsteptype == TSTEP_RANGE || tsteptype == TSTEP_AVG || tsteptype == TSTEP_ACCUM || tsteptype == TSTEP_DIFF + || tsteptype == TSTEP_MIN || tsteptype == TSTEP_MAX || tsteptype == TSTEP_RMS || tsteptype == TSTEP_SD + || tsteptype == TSTEP_COV || tsteptype == TSTEP_RATIO || tsteptype == TSTEP_SUM); + if (!cdiDateTime_isNull(sDateTime) && hasStartDate) + { + julianDate2 = julianDate_encode(calendar, sDateTime); + startStep = lround(julianDate_to_seconds(julianDate_sub(julianDate2, julianDate1)) / factor); + } + + if (editionNumber > 1) GRIB_CHECK(my_grib_set_long(gh, "significanceOfReferenceTime", 1), 0); + if (editionNumber > 1) GRIB_CHECK(my_grib_set_long(gh, "stepRange", 0), 0); + + if (cdiDateTime_isNull(fDateTime)) fDateTime.date = cdiDate_set(10101); + gribapiSetDataDateTime(gh, fDateTime); + + // printf(">>>>> tsteptype %d startStep %ld endStep %ld\n", tsteptype, startStep, endStep); + + // Product Definition Template Number: defined in GRIB_API file 4.0.table point in time products: + if ((proDefTempNum >= 0 && proDefTempNum <= 7) || proDefTempNum == 55 || proDefTempNum == 40055) // Tile + startStep = endStep; + + if (endStep < startStep) return status; + + if (editionNumber == 1 && (startStep > 255 || endStep > 255)) + { + startStep = 0; + endStep = 0; + } + else + { + status = 0; + } + + if (editionNumber > 1) GRIB_CHECK(my_grib_set_long(gh, "forecastTime", startStep), 0); + // if ( editionNumber == 1 && startStep > 0) GRIB_CHECK(my_grib_set_long(gh, "startStep", startStep), 0); + if (editionNumber == 1) GRIB_CHECK(my_grib_set_long(gh, "startStep", startStep), 0); + GRIB_CHECK(my_grib_set_long(gh, "endStep", endStep), 0); + } + + return status; +} + +static void +gribapiDefTime(int editionNumber, int productDefinitionTemplate, int typeOfGeneratingProcess, grib_handle *gh, + CdiDateTime vDateTime, int tsteptype, int numavg, int taxisID, int gcinit) +{ + UNUSED(numavg); + + int taxistype = (taxisID == -1) ? -1 : taxisInqType(taxisID); + + if (typeOfGeneratingProcess == 196) + { + vDateTime = cdiDateTime_set(10101, 0); + taxistype = TAXIS_ABSOLUTE; + } + + if (taxistype == TAXIS_RELATIVE) + { + int timeunit = taxisInqTunit(taxisID); + int calendar = taxisInqCalendar(taxisID); + + CdiDateTime fDateTime = taxisInqFdatetime(taxisID); + if (cdiDateTime_isNull(fDateTime)) fDateTime = taxisInqRdatetime(taxisID); + if (cdiDateTime_isLT(vDateTime, fDateTime)) fDateTime = vDateTime; + + CdiDateTime sDateTime = taxisInqSdatetime(taxisID); + + int status = gribapiDefDateTimeRel(editionNumber, gh, fDateTime, vDateTime, sDateTime, productDefinitionTemplate, + typeOfGeneratingProcess, tsteptype, timeunit, calendar, gcinit); + if (status != 0) taxistype = TAXIS_ABSOLUTE; + } + + if (taxistype == TAXIS_ABSOLUTE) + gribapiDefDateTimeAbs(editionNumber, gh, vDateTime, productDefinitionTemplate, typeOfGeneratingProcess, tsteptype, gcinit); +} + +static void +gribapiDefGridRegular(grib_handle *gh, int gridID, int gridtype, bool gridIsRotated, bool gridIsCurvilinear, int uvRelativeToGrid) +{ + const char *mesg; + // clang-format off + if (gridtype == GRID_GAUSSIAN) mesg = "regular_gg"; + else if (gridtype == GRID_GAUSSIAN_REDUCED) mesg = "reduced_gg"; + else if (gridIsRotated) mesg = "rotated_ll"; + else mesg = "regular_ll"; + // clang-format on + size_t len = strlen(mesg); + GRIB_CHECK(my_grib_set_string(gh, "gridType", mesg, &len), 0); + + double xfirst = 0.0, xlast = 0.0, xinc = 0.0; + double yfirst = 0.0, ylast = 0.0, yinc = 0.0; + + size_t nlon = gridInqXsize(gridID); + size_t nlat = gridInqYsize(gridID); + + if (gridtype == GRID_GAUSSIAN_REDUCED) + { + xfirst = (nlon == 2) ? gridInqXval(gridID, 0) : 0.0; + xlast = (nlon == 2) ? gridInqXval(gridID, 1) : 360.0 - 360.0 * 0.5 / (double) nlat; + + nlon = 0; + + int *reducedPoints = (int *) Malloc(nlat * sizeof(int)); + long *pl = (long *) Malloc(nlat * sizeof(long)); + gridInqReducedPoints(gridID, reducedPoints); + for (size_t i = 0; i < nlat; ++i) pl[i] = reducedPoints[i]; + + GRIB_CHECK(grib_set_long_array(gh, "pl", pl, nlat), 0); + + Free(pl); + Free(reducedPoints); + } + else + { + if (nlon == 0) + nlon = 1; + else + { + xfirst = gridInqXval(gridID, 0); + xlast = gridInqXval(gridID, (gridIsCurvilinear ? nlon * nlat : nlon) - 1); + xinc = fabs(gridInqXinc(gridID)); + } + } + + if (nlat == 0) + nlat = 1; + else + { + yfirst = gridInqYval(gridID, 0); + ylast = gridInqYval(gridID, (gridIsCurvilinear ? nlon * nlat : nlat) - 1); + yinc = fabs(gridInqYinc(gridID)); + } + + double xfirsto = xfirst; + double xlasto = xlast; + while (xfirsto > 360.0) xfirsto -= 360.0; + while (xlasto > 360.0) xlasto -= 360.0; + + if (gridtype != GRID_GAUSSIAN_REDUCED) GRIB_CHECK(my_grib_set_long(gh, "Ni", nlon), 0); + GRIB_CHECK(my_grib_set_double(gh, "longitudeOfFirstGridPointInDegrees", xfirsto), 0); + GRIB_CHECK(my_grib_set_double(gh, "longitudeOfLastGridPointInDegrees", xlasto), 0); + if (gridtype != GRID_GAUSSIAN_REDUCED) GRIB_CHECK(my_grib_set_double(gh, "iDirectionIncrementInDegrees", xinc), 0); + + GRIB_CHECK(my_grib_set_long(gh, "Nj", (long) nlat), 0); + GRIB_CHECK(my_grib_set_double(gh, "latitudeOfFirstGridPointInDegrees", yfirst), 0); + GRIB_CHECK(my_grib_set_double(gh, "latitudeOfLastGridPointInDegrees", ylast), 0); + + long xscan = xfirst > xlast; + GRIB_CHECK(my_grib_set_long(gh, "iScansNegatively", xscan), 0); + xscan = yfirst < ylast; + GRIB_CHECK(my_grib_set_long(gh, "jScansPositively", xscan), 0); + + if (gridtype == GRID_GAUSSIAN || gridtype == GRID_GAUSSIAN_REDUCED) + { + int np = gridInqNP(gridID); + if (np == 0) np = nlat / 2; + GRIB_CHECK(my_grib_set_long(gh, "numberOfParallelsBetweenAPoleAndTheEquator", np), 0); + } + else + { + GRIB_CHECK(my_grib_set_double(gh, "jDirectionIncrementInDegrees", yinc), 0); + } + + if (gridIsRotated) + { + double xpole = 0.0, ypole = 0.0, angle = 0.0; + gridInqParamRLL(gridID, &xpole, &ypole, &angle); + + xpole += 180.0; + if (fabs(ypole) > 0.0) ypole = -ypole; // change from north to south pole + if (fabs(angle) > 0.0) angle = -angle; + GRIB_CHECK(my_grib_set_double(gh, "latitudeOfSouthernPoleInDegrees", ypole), 0); + GRIB_CHECK(my_grib_set_double(gh, "longitudeOfSouthernPoleInDegrees", xpole), 0); + GRIB_CHECK(my_grib_set_double(gh, "angleOfRotation", angle), 0); + } + + if (uvRelativeToGrid >= 0) GRIB_CHECK(my_grib_set_long(gh, "uvRelativeToGrid", uvRelativeToGrid), 0); +} + +static long +radiusToShapeOfTheEarth(double radius) +{ + long shapeOfTheEarth = 0; + + // clang-format off + if (IS_EQUAL(radius, 6367470.0)) shapeOfTheEarth = 0; + else if (IS_EQUAL(radius, 6378160.0)) shapeOfTheEarth = 2; + else if (IS_EQUAL(radius, 6371229.0)) shapeOfTheEarth = 6; + else if (IS_EQUAL(radius, 6371200.0)) shapeOfTheEarth = 8; + // clang-format on + + return shapeOfTheEarth; +} + +static void +gribapiDefGridLCC(grib_handle *gh, int editionNumber, int gridID, int uvRelativeToGrid) +{ + long xsize = (long) gridInqXsize(gridID); + long ysize = (long) gridInqYsize(gridID); + + struct CDI_GridProjParams gpp; + gridInqParamsLCC(gridID, &gpp); + if (IS_EQUAL(gpp.x_0, gpp.mv) && IS_EQUAL(gpp.y_0, gpp.mv) && (IS_EQUAL(gpp.xval_0, gpp.mv) || IS_EQUAL(gpp.yval_0, gpp.mv))) + { + gpp.x_0 = gridInqXval(gridID, 0); + gpp.y_0 = gridInqYval(gridID, 0); + } + gridVerifyProjParamsLCC(&gpp); + if (gpp.xval_0 < 0.0) gpp.xval_0 += 360.0; + if (gpp.lon_0 < 0.0) gpp.lon_0 += 360.0; + + bool lsouth = (gpp.lat_1 < 0.0); + if (lsouth) + { + gpp.lat_1 = -gpp.lat_2; + gpp.lat_2 = -gpp.lat_2; + } + int projflag = 0; + if (lsouth) gribbyte_set_bit(&projflag, 1); + + double xinc = gridInqXinc(gridID); + double yinc = gridInqYinc(gridID); + if (IS_EQUAL(xinc, 0.0)) xinc = gridInqXincInMeter(gridID); + if (IS_EQUAL(yinc, 0.0)) yinc = gridInqYincInMeter(gridID); + + static const char mesg[] = "lambert"; + size_t len = sizeof(mesg) - 1; + GRIB_CHECK(my_grib_set_string(gh, "gridType", mesg, &len), 0); + + GRIB_CHECK(my_grib_set_long(gh, "Nx", xsize), 0); + GRIB_CHECK(my_grib_set_long(gh, "Ny", ysize), 0); + GRIB_CHECK(my_grib_set_long(gh, "DxInMetres", lround(fabs(xinc))), 0); + GRIB_CHECK(my_grib_set_long(gh, "DyInMetres", lround(fabs(yinc))), 0); + GRIB_CHECK(my_grib_set_double(gh, "longitudeOfFirstGridPointInDegrees", gpp.xval_0), 0); + GRIB_CHECK(my_grib_set_double(gh, "latitudeOfFirstGridPointInDegrees", gpp.yval_0), 0); + GRIB_CHECK(my_grib_set_double(gh, "LoVInDegrees", gpp.lon_0), 0); + GRIB_CHECK(my_grib_set_double(gh, "Latin1InDegrees", gpp.lat_1), 0); + GRIB_CHECK(my_grib_set_double(gh, "Latin2InDegrees", gpp.lat_2), 0); + GRIB_CHECK(my_grib_set_long(gh, "projectionCentreFlag", projflag), 0); + + long shapeOfTheEarth = radiusToShapeOfTheEarth(gpp.a); + if (shapeOfTheEarth) GRIB_CHECK(my_grib_set_long(gh, "shapeOfTheEarth", shapeOfTheEarth), 0); + + if (uvRelativeToGrid >= 0) GRIB_CHECK(my_grib_set_long(gh, "uvRelativeToGrid", uvRelativeToGrid), 0); + + long earthIsOblate = (IS_EQUAL(gpp.a, 6378160.0) && IS_EQUAL(gpp.rf, 297.0)); + if (earthIsOblate) GRIB_CHECK(my_grib_set_long(gh, "earthIsOblate", earthIsOblate), 0); + + int scanflag = 0; + gribbyte_set_bit(&scanflag, 2); + if (editionNumber <= 1) GRIB_CHECK(my_grib_set_long(gh, "scanningMode", (long) scanflag), 0); +} + +static void +gribapiDefGridSTERE(grib_handle *gh, int gridID) +{ + long xsize = (long) gridInqXsize(gridID); + long ysize = (long) gridInqYsize(gridID); + + struct CDI_GridProjParams gpp; + gridInqParamsSTERE(gridID, &gpp); + gridVerifyProjParamsSTERE(&gpp); + if (gpp.xval_0 < 0.0) gpp.xval_0 += 360.0; + int projflag = 0; + + double xinc = gridInqXinc(gridID); + double yinc = gridInqYinc(gridID); + + static const char mesg[] = "polar_stereographic"; + size_t len = sizeof(mesg) - 1; + GRIB_CHECK(my_grib_set_string(gh, "gridType", mesg, &len), 0); + + GRIB_CHECK(my_grib_set_long(gh, "Nx", xsize), 0); + GRIB_CHECK(my_grib_set_long(gh, "Ny", ysize), 0); + GRIB_CHECK(my_grib_set_long(gh, "DxInMetres", lround(xinc)), 0); + GRIB_CHECK(my_grib_set_long(gh, "DyInMetres", lround(yinc)), 0); + GRIB_CHECK(my_grib_set_double(gh, "longitudeOfFirstGridPointInDegrees", gpp.xval_0), 0); + GRIB_CHECK(my_grib_set_double(gh, "latitudeOfFirstGridPointInDegrees", gpp.yval_0), 0); + GRIB_CHECK(my_grib_set_double(gh, "LaDInDegrees", gpp.lat_1), 0); + GRIB_CHECK(my_grib_set_double(gh, "orientationOfTheGridInDegrees", gpp.lon_0), 0); + long southPoleOnProjectionPlane = IS_EQUAL(gpp.lat_0, -90.0); + GRIB_CHECK(my_grib_set_double(gh, "southPoleOnProjectionPlane", southPoleOnProjectionPlane), 0); + GRIB_CHECK(my_grib_set_long(gh, "projectionCentreFlag", projflag), 0); + + long shapeOfTheEarth = radiusToShapeOfTheEarth(gpp.a); + if (shapeOfTheEarth) GRIB_CHECK(my_grib_set_long(gh, "shapeOfTheEarth", shapeOfTheEarth), 0); + + GRIB_CHECK(my_grib_set_long(gh, "resolutionAndComponentFlags", 8), 0); + GRIB_CHECK(my_grib_set_long(gh, "iScansNegatively", 0), 0); + GRIB_CHECK(my_grib_set_long(gh, "jScansPositively", 1), 0); +} + +static void +gribapiDefGridGME(grib_handle *gh, int gridID, long gridsize) +{ + GRIB_CHECK(my_grib_set_long(gh, "gridDefinitionTemplateNumber", GRIB2_GTYPE_GME), 0); + + int nd = 0, ni = 0, ni2 = 0, ni3 = 0; + gridInqParamGME(gridID, &nd, &ni, &ni2, &ni3); + GRIB_CHECK(my_grib_set_long(gh, "nd", nd), 0); + GRIB_CHECK(my_grib_set_long(gh, "Ni", ni), 0); + GRIB_CHECK(my_grib_set_long(gh, "n2", ni2), 0); + GRIB_CHECK(my_grib_set_long(gh, "n3", ni3), 0); + GRIB_CHECK(my_grib_set_long(gh, "latitudeOfThePolePoint", 90000000), 0); + GRIB_CHECK(my_grib_set_long(gh, "longitudeOfThePolePoint", 0), 0); + + GRIB_CHECK(my_grib_set_long(gh, "numberOfDataPoints", gridsize), 0); + GRIB_CHECK(my_grib_set_long(gh, "totalNumberOfGridPoints", gridsize), 0); +} + +static void +gribapiDefGridUnstructured(grib_handle *gh, int gridID) +{ + static bool warning = true; + + int status = my_grib_set_long(gh, "gridDefinitionTemplateNumber", GRIB2_GTYPE_UNSTRUCTURED); + if (status != 0 && warning) + { + warning = false; + Warning("Can't write reference grid!"); + Warning("gridDefinitionTemplateNumber %d not found (grib2/template.3.%d.def)!", GRIB2_GTYPE_UNSTRUCTURED, + GRIB2_GTYPE_UNSTRUCTURED); + } + else + { + int errCount = 0; + int number = 0; + status = cdiInqKeyInt(gridID, CDI_GLOBAL, CDI_KEY_NUMBEROFGRIDUSED, &number); + if (status < 0) errCount++; + if (number < 0) number = 0; + GRIB_CHECK(my_grib_set_long(gh, "numberOfGridUsed", number), 0); + + int position = 0; + status = cdiInqKeyInt(gridID, CDI_GLOBAL, CDI_KEY_NUMBEROFGRIDINREFERENCE, &position); + if (status < 0) errCount++; + if (position < 0) position = 0; + GRIB_CHECK(my_grib_set_long(gh, "numberOfGridInReference", position), 0); + + unsigned char uuid[CDI_UUID_SIZE]; + size_t len = CDI_UUID_SIZE; + memset(uuid, 0, len); + int length = CDI_UUID_SIZE; + status = cdiInqKeyBytes(gridID, CDI_GLOBAL, CDI_KEY_UUID, uuid, &length); + if (status < 0) errCount++; + if (grib_set_bytes(gh, "uuidOfHGrid", uuid, &len) != 0) Warning("Can't write UUID!"); + + if (warning && errCount > 0) + { + warning = false; + Warning("GRIB library doesn't support unstructured grids, grid information will be lost!"); + } + } +} + +static void +gribapiDefGridSpectral(grib_handle *gh, int gridID) +{ + int trunc = gridInqTrunc(gridID); + enum + { + numTruncAtt = 3 + }; + static const char truncAttNames[numTruncAtt][2] = { "J", "K", "M" }; + for (size_t i = 0; i < numTruncAtt; ++i) GRIB_CHECK(my_grib_set_long(gh, truncAttNames[i], trunc), 0); + + if (gridInqComplexPacking(gridID)) + { + static const char truncAttNames2[numTruncAtt][3] = { "JS", "KS", "MS" }; + for (size_t i = 0; i < numTruncAtt; ++i) GRIB_CHECK(my_grib_set_long(gh, truncAttNames2[i], 20), 0); + } +} + +static void +gribapiDefPackingType(grib_handle *gh, bool lieee, bool lspectral, bool lcomplex, int comptype, size_t gridsize) +{ + static const char mesg_spectral_complex[] = "spectral_complex"; + static const char mesg_spectral_simple[] = "spectral_simple"; + static const char mesg_grid_jpeg[] = "grid_jpeg"; + static const char mesg_grid_ccsds[] = "grid_ccsds"; + static const char mesg_ieee[] = "grid_ieee"; + static const char mesg_simple[] = "grid_simple"; + const char *mesg = mesg_simple; + + if (lspectral) + { + mesg = lcomplex ? mesg_spectral_complex : mesg_spectral_simple; + } + else if (comptype == CDI_COMPRESS_JPEG && gridsize > 1) + { + mesg = mesg_grid_jpeg; + } + else if ((comptype == CDI_COMPRESS_SZIP || comptype == CDI_COMPRESS_AEC) && gridsize > 1) + { + mesg = mesg_grid_ccsds; + } + else if (lieee) + { + mesg = mesg_ieee; + } + + size_t len = strlen(mesg); + GRIB_CHECK(my_grib_set_string(gh, "packingType", mesg, &len), 0); +} + +static void +gribapiDefGrid(int editionNumber, grib_handle *gh, int gridID, int comptype, int datatype, int uvRelativeToGrid) +{ + size_t gridsize = gridInqSize(gridID); + bool gridIsRotated = false; + bool gridIsCurvilinear = false; + int gridtype = grbGetGridtype(&gridID, gridsize, &gridIsRotated, &gridIsCurvilinear); + + bool lieee = (editionNumber == 2 && (datatype == CDI_DATATYPE_FLT32 || datatype == CDI_DATATYPE_FLT64)); + bool lspectral = (gridtype == GRID_SPECTRAL); + bool lcomplex = (lspectral && gridInqComplexPacking(gridID)); + + if (lieee) comptype = 0; + if (lspectral) lieee = false; + + if (lspectral) // gridType needs to be defined before packingType !!! + { + static const char mesg[] = "sh"; + size_t len = sizeof(mesg) - 1; + GRIB_CHECK(my_grib_set_string(gh, "gridType", mesg, &len), 0); + } + + gribapiDefPackingType(gh, lieee, lspectral, lcomplex, comptype, gridsize); + + if (lieee) GRIB_CHECK(my_grib_set_long(gh, "precision", datatype == CDI_DATATYPE_FLT64 ? 2 : 1), 0); + + if (editionNumber == 2) GRIB_CHECK(my_grib_set_long(gh, "numberOfValues", (long) gridsize), 0); + + switch (gridtype) + { + case GRID_LONLAT: + case GRID_GAUSSIAN: + case GRID_GAUSSIAN_REDUCED: + case GRID_TRAJECTORY: + { + gribapiDefGridRegular(gh, gridID, gridtype, gridIsRotated, gridIsCurvilinear, uvRelativeToGrid); + break; + } + case CDI_PROJ_LCC: + { + gribapiDefGridLCC(gh, editionNumber, gridID, uvRelativeToGrid); + break; + } + case CDI_PROJ_STERE: + { + gribapiDefGridSTERE(gh, gridID); + break; + } + case GRID_SPECTRAL: + { + gribapiDefGridSpectral(gh, gridID); + break; + } + case GRID_GME: + { + if (editionNumber <= 1) Error("GME grid can't be stored in GRIB edition %d!", editionNumber); + gribapiDefGridGME(gh, gridID, (long) gridsize); + break; + } + case GRID_UNSTRUCTURED: + { + if (editionNumber <= 1) Error("Unstructured grid can't be stored in GRIB edition %d!", editionNumber); + gribapiDefGridUnstructured(gh, gridID); + break; + } + default: + { + Error("Unsupported grid type: %s", gridNamePtr(gridtype)); + break; + } + } +} + +static void +getLevelFactor(double level, long *factor, long *out_scaled_value) +{ + const double eps = 1.0e-7; + + double scaled_value = level; + long iscaled_value = lround(scaled_value); + + long i; + for (i = 0; (iscaled_value < (4294967295 / 10)) && (fabs(scaled_value - (double) iscaled_value) >= eps) && i < 7; i++) + { + scaled_value *= 10.0; + iscaled_value = lround(scaled_value); + } + + (*factor) = i; + (*out_scaled_value) = iscaled_value; +} + +static void +gribapiDefLevelType(grib_handle *gh, int gcinit, const char *keyname, long leveltype) +{ + bool lset = false; + if ((leveltype == GRIB1_LTYPE_ISOBARIC_PA || leveltype == 99 || leveltype == 100) && gribEditionNumber(gh) == 1) + { + if (gribGetLong(gh, "indicatorOfTypeOfLevel") != leveltype) lset = true; + } + + if (!gcinit || lset) GRIB_CHECK(my_grib_set_long(gh, keyname, leveltype), 0); +} + +static void +grib1DefLevel(grib_handle *gh, int gcinit, long leveltype1, long leveltype2, bool hasBounds, double level, double dlevel1, + double dlevel2) +{ + (void) leveltype2; + gribapiDefLevelType(gh, gcinit, "indicatorOfTypeOfLevel", leveltype1); + + if (hasBounds) + { + GRIB_CHECK(my_grib_set_long(gh, "topLevel", lround(dlevel1)), 0); + GRIB_CHECK(my_grib_set_long(gh, "bottomLevel", lround(dlevel2)), 0); + } + else + { + GRIB_CHECK(my_grib_set_long(gh, "level", lround(level)), 0); + } +} + +static void +grib2DefLevel(grib_handle *gh, int gcinit, long leveltype1, long leveltype2, bool hasBounds, double level, double dlevel1, + double dlevel2) +{ + gribapiDefLevelType(gh, gcinit, "typeOfFirstFixedSurface", leveltype1); + if (hasBounds) gribapiDefLevelType(gh, gcinit, "typeOfSecondFixedSurface", leveltype2); + + if (!hasBounds) dlevel1 = level; + + long scaled_level, factor; + getLevelFactor(dlevel1, &factor, &scaled_level); + GRIB_CHECK(my_grib_set_long(gh, "scaleFactorOfFirstFixedSurface", factor), 0); + GRIB_CHECK(my_grib_set_long(gh, "scaledValueOfFirstFixedSurface", scaled_level), 0); + + if (hasBounds) + { + getLevelFactor(dlevel2, &factor, &scaled_level); + GRIB_CHECK(my_grib_set_long(gh, "scaleFactorOfSecondFixedSurface", factor), 0); + GRIB_CHECK(my_grib_set_long(gh, "scaledValueOfSecondFixedSurface", scaled_level), 0); + } +} + +static void +gribapiDefLevel(int editionNumber, grib_handle *gh, int zaxisID, int levelID, int gcinit, int proddef_template_num) +{ + int zaxistype = zaxisInqType(zaxisID); + int ltype = 0, ltype2 = -1; + cdiInqKeyInt(zaxisID, CDI_GLOBAL, CDI_KEY_TYPEOFFIRSTFIXEDSURFACE, <ype); + cdiInqKeyInt(zaxisID, CDI_GLOBAL, CDI_KEY_TYPEOFSECONDFIXEDSURFACE, <ype2); + + bool hasBounds = (zaxisInqLbounds(zaxisID, NULL) && zaxisInqUbounds(zaxisID, NULL)); + double level = zaxisInqLevels(zaxisID, NULL) ? zaxisInqLevel(zaxisID, levelID) : levelID + 1; + double dlevel1 = hasBounds ? zaxisInqLbound(zaxisID, levelID) : level; + double dlevel2 = hasBounds ? zaxisInqUbound(zaxisID, levelID) : 0.0; + + if (zaxistype == ZAXIS_GENERIC && ltype == 0) + { + Warning("Changed zaxis type from %s to %s", zaxisNamePtr(zaxistype), zaxisNamePtr(ZAXIS_PRESSURE)); + zaxistype = ZAXIS_PRESSURE; + zaxisChangeType(zaxisID, zaxistype); + cdiDefKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_UNITS, "Pa"); + } + + long grib_ltype; + { + int (*ltypeMap)(int grib_ltype) = editionNumber <= 1 ? zaxisTypeToGrib1ltype : zaxisTypeToGrib2ltype; + grib_ltype = ltypeMap(zaxistype); + } + long grib_ltype2 = (ltype != ltype2 && ltype2 != -1) ? ltype2 : grib_ltype; + + void (*defLevel)(grib_handle * gh, int gcinit, long leveltype1, long leveltype2, bool hasBounds, double level, double dlevel1, + double dlevel2) + = editionNumber <= 1 ? grib1DefLevel : grib2DefLevel; + + switch (zaxistype) + { + case ZAXIS_SURFACE: + case ZAXIS_MEANSEA: + case ZAXIS_HEIGHT: + case ZAXIS_ALTITUDE: + case ZAXIS_SIGMA: + case ZAXIS_DEPTH_BELOW_SEA: + case ZAXIS_ISENTROPIC: + { + if (zaxistype == ZAXIS_HEIGHT) + { + double sf = zaxis_units_to_meter(zaxisID); + level *= sf; + dlevel1 *= sf; + dlevel2 *= sf; + } + + /* GRIB2: PRODUCT DEFINITION TEMPLATE NUMBER 32: + + "Analysis or forecast at a horizontal level or in a + horizontal layer at a point in time for simulate + (synthetic) satellite data" + + The key/value pairs that are set in "grib2DefLevel" do not + exist for this template. */ + if (editionNumber <= 1 || proddef_template_num != 32) + defLevel(gh, gcinit, grib_ltype, grib_ltype2, hasBounds, level, dlevel1, dlevel2); + + break; + } + case ZAXIS_CLOUD_BASE: + case ZAXIS_CLOUD_TOP: + case ZAXIS_ISOTHERM_ZERO: + case ZAXIS_TROPOPAUSE: + case ZAXIS_TOA: + case ZAXIS_SEA_BOTTOM: + case ZAXIS_LAKE_BOTTOM: + case ZAXIS_SEDIMENT_BOTTOM: + case ZAXIS_SEDIMENT_BOTTOM_TA: + case ZAXIS_SEDIMENT_BOTTOM_TW: + case ZAXIS_MIX_LAYER: + case ZAXIS_ATMOSPHERE: + { + defLevel(gh, gcinit, grib_ltype, grib_ltype, hasBounds, level, dlevel1, dlevel2); + } + break; + case ZAXIS_HYBRID: + case ZAXIS_HYBRID_HALF: + { + if (editionNumber <= 1) + { + grib_ltype = hasBounds ? GRIB1_LTYPE_HYBRID_LAYER : GRIB1_LTYPE_HYBRID; + } + defLevel(gh, gcinit, grib_ltype, grib_ltype, hasBounds, level, dlevel1, dlevel2); + + if (!gcinit) + { + int vctsize = zaxisInqVctSize(zaxisID); + if (vctsize > 0) + { + GRIB_CHECK(my_grib_set_long(gh, "PVPresent", 1), 0); + GRIB_CHECK(grib_set_double_array(gh, "pv", zaxisInqVctPtr(zaxisID), (size_t) vctsize), 0); + } + } + + break; + } + case ZAXIS_PRESSURE: + { + if (level < 0) Warning("Pressure level of %f Pa is below zero!", level); + + if (!zaxis_units_is_Pa(zaxisID)) + { + level *= 100; + dlevel1 *= 100; + dlevel2 *= 100; + } + + if (editionNumber <= 1) + { + double dum; + if (level < 32768 && (level < 100 || modf(level / 100, &dum) > 0)) + grib_ltype = GRIB1_LTYPE_ISOBARIC_PA; + else + level /= 100; + } + else if (ltype2 == -1) + ltype2 = GRIB2_LTYPE_ISOBARIC; + defLevel(gh, gcinit, grib_ltype, ltype2, hasBounds, level, dlevel1, dlevel2); + + break; + } + case ZAXIS_SNOW: + if (editionNumber <= 1) + ; // not available + else + { + grib2DefLevel(gh, gcinit, grib_ltype, grib_ltype, hasBounds, level, dlevel1, dlevel2); + } + + break; + case ZAXIS_DEPTH_BELOW_LAND: + { + double sf = editionNumber <= 1 ? zaxis_units_to_centimeter(zaxisID) : zaxis_units_to_meter(zaxisID); + grib_ltype = editionNumber <= 1 ? (hasBounds ? GRIB1_LTYPE_LANDDEPTH_LAYER : GRIB1_LTYPE_LANDDEPTH) : grib_ltype; + defLevel(gh, gcinit, grib_ltype, grib_ltype, hasBounds, level * sf, dlevel1 * sf, dlevel2 * sf); + + break; + } + case ZAXIS_REFERENCE: + { + if (!gcinit) GRIB_CHECK(my_grib_set_long(gh, "genVertHeightCoords", 1), 0); + + if (editionNumber <= 1) + ; // not available + else + { + if (hasBounds) + { + gribapiDefLevelType(gh, gcinit, "typeOfFirstFixedSurface", grib_ltype); + gribapiDefLevelType(gh, gcinit, "typeOfSecondFixedSurface", grib_ltype2); + GRIB_CHECK(my_grib_set_long(gh, "topLevel", (long) dlevel1), 0); + GRIB_CHECK(my_grib_set_long(gh, "bottomLevel", (long) dlevel2), 0); + } + else + { + grib2DefLevel(gh, gcinit, grib_ltype, grib_ltype2, hasBounds, level, dlevel1, dlevel2); + } + + GRIB_CHECK(my_grib_set_long(gh, "NV", 6), 0); + int number = 0; + cdiInqKeyInt(zaxisID, CDI_GLOBAL, CDI_KEY_NUMBEROFVGRIDUSED, &number); + GRIB_CHECK(my_grib_set_long(gh, "numberOfVGridUsed", number), 0); + int nlev = 0; + cdiInqKeyInt(zaxisID, CDI_GLOBAL, CDI_KEY_NLEV, &nlev); + GRIB_CHECK(my_grib_set_long(gh, "nlev", nlev), 0); + unsigned char uuid[CDI_UUID_SIZE]; + int length = CDI_UUID_SIZE; + memset(uuid, 0, length); + cdiInqKeyBytes(zaxisID, CDI_GLOBAL, CDI_KEY_UUID, uuid, &length); + size_t len = CDI_UUID_SIZE; + if (grib_set_bytes(gh, "uuidOfVGrid", uuid, &len) != 0) Warning("Can't write UUID!"); + } + + break; + } + case ZAXIS_GENERIC: + { + defLevel(gh, gcinit, ltype, ltype, hasBounds, level, dlevel1, dlevel2); + break; + } + default: + { + Error("Unsupported zaxis type: %s", zaxisNamePtr(zaxistype)); + break; + } + } +} + +int +gribapiGetScanningMode(grib_handle *gh) +{ + long iScansNegatively, jScansPositively, jPointsAreConsecutive; + GRIB_CHECK(grib_get_long(gh, "iScansNegatively", &iScansNegatively), 0); + GRIB_CHECK(grib_get_long(gh, "jScansPositively", &jScansPositively), 0); + GRIB_CHECK(grib_get_long(gh, "jPointsAreConsecutive", &jPointsAreConsecutive), 0); + int scanningMode = 128 * (bool) iScansNegatively + 64 * (bool) jScansPositively + 32 * (bool) jPointsAreConsecutive; + if (cdiDebugExt >= 30) + printf("gribapiGetScanningMode(): Scanning mode = %02d (%1d%1d%1d)*32; \n", scanningMode, (int) jPointsAreConsecutive, + (int) jScansPositively, (int) iScansNegatively); + + return scanningMode; +} + +void +gribapiSetScanningMode(grib_handle *gh, int scanningMode) +{ + // 127: reserved for testing; generated test data will be in 64 scanning mode + // if (scanningMode== 127) scanningMode = 64; + + long iScansNegatively = (scanningMode & 128) / 128; + long jScansPositively = (scanningMode & 64) / 64; + long jPointsAreConsecutive = (scanningMode & 32) / 32; + + if (cdiDebugExt >= 30 && gribEditionNumber(gh) <= 1) + { + long paramId, levelTypeId, levelId, uvRelativeToGrid; + GRIB_CHECK(grib_get_long(gh, "uvRelativeToGrid", &uvRelativeToGrid), 0); + GRIB_CHECK(grib_get_long(gh, "indicatorOfParameter", ¶mId), 0); + GRIB_CHECK(grib_get_long(gh, "indicatorOfTypeOfLevel", &levelTypeId), 0); + GRIB_CHECK(grib_get_long(gh, "level", &levelId), 0); + printf("gribapiSetScanningMode(): (param,ltype,level) = (%3d,%3d,%4d); Scanning mode = %02d (%1d%1d%1d)*32; " + "uvRelativeToGrid = %02d\n", + (int) paramId, (int) levelTypeId, (int) levelId, scanningMode, (int) jPointsAreConsecutive, (int) jScansPositively, + (int) iScansNegatively, (int) uvRelativeToGrid); + } + + GRIB_CHECK(my_grib_set_long(gh, "iScansNegatively", iScansNegatively), 0); + GRIB_CHECK(my_grib_set_long(gh, "jScansPositively", jScansPositively), 0); + GRIB_CHECK(my_grib_set_long(gh, "jPointsAreConsecutive", jPointsAreConsecutive), 0); +} + +/* + TABLE 8. SCANNING MODE FLAG + + (GDS Octet 28) + BIT VALUE MEANING + 1 0 Points scan in +i direction + 1 Points scan in -i direction + 2 0 Points scan in -j direction + 1 Points scan in +j direction + 3 0 Adjacent points in i direction are consecutive + (FORTRAN: (I,J)) + 1 Adjacent points in j direction are consecutive + (FORTRAN: (J,I)) + + => Scanning Mode 0 0 0 0 0 0 0 0 (00 dec) +i, -j; i direction consecutive (row-major order West->East & North->South) + => Scanning Mode 0 1 0 0 0 0 0 0 (64 dec) +i, +j; i direction consecutive (row-major order West->East & South->North ) + => Scanning Mode 1 1 0 0 0 0 0 0 (96 dec) +i, +j; j direction consecutive (column-major order South->North & West->East ) + + NOTE: South->North - As if you would plot the data as image on the screen + where [0,0] of the data is the top-left pixel. + + grib2ppm LAMH_D11_201302150000_00000_oro | display ppm:- + ImageMagick (display): [0,0] of an image belongs to the top-left pixel + [DEFAULT] : 64 dec + + iScansNegatively = 0; + jScansPositively = 1; + jPointsAreConsecutive = 0; => Scanning Mode 64 + + cdo selindexbox,1,726,100,550 LAMH_D11_201302150000_00000_oro LAMH_D11_201302150000_00000_oro_cropped + grib2ppm LAMH_D11_201302150000_00000_oro_cropped | /usr/bin/display ppm:- & + # ^^^ this image will be missing the souther parts of data + + grib2ppm LAMH_D11_201302150000_00000_oro | /usr/bin/display ppm:- & + # ^ full domain data +*/ + +#ifdef HIRLAM_EXTENSIONS +static void +verticallyFlipGridDefinitionWhenScanningModeChanged(grib_handle *gh, double yfirst, double ylast, double yinc) +{ + /* + Nj = 550; + latitudeOfFirstGridPointInDegrees = -30.8; + latitudeOfLastGridPointInDegrees = 24.1; + iScansNegatively = 0; + jScansPositively = 0; + jPointsAreConsecutive = 0; + jDirectionIncrementInDegrees = 0.1; + + When switching from scanning mode 0 <=> 64 + yfirst = -30.8 + (550-1)*0.1 + + yfirst = yfirst + (ysize-1) * yinc + yinc = -1.0*yinc + */ + + // long jDim=0; + // GRIB_CHECK(grib_get_long(gh, "Nj", &jDim), 0); + + double latitudeOfFirstGridPointInDegrees; + double latitudeOfLastGridPointInDegrees; + double jDirectionIncrementInDegrees; + + // GRIB_CHECK(grib_get_double(gh, "latitudeOfFirstGridPointInDegrees", &latitudeOfFirstGridPointInDegrees), 0); // yfirst + // GRIB_CHECK(grib_get_double(gh, "latitudeOfLastGridPointInDegrees", &latitudeOfLastGridPointInDegrees), 0); // ylast + // GRIB_CHECK(grib_get_double(gh, "jDirectionIncrementInDegrees", &jDirectionIncrementInDegrees), 0); // yinc + + if (cdiDebugExt >= 10) Message(" BEFORE: yfirst = %f; ylast = %f; yinc = %f; ", yfirst, ylast, yinc); + + GRIB_CHECK(my_grib_set_double(gh, "latitudeOfFirstGridPointInDegrees", ylast), 0); + GRIB_CHECK(my_grib_set_double(gh, "latitudeOfLastGridPointInDegrees", yfirst), 0); + // yinc *= -1.0; // don't set yinc here ... + // GRIB_CHECK(my_grib_set_double(gh, "jDirectionIncrementInDegrees", yinc), 0); + + if (cdiDebugExt >= 10) + { + GRIB_CHECK(grib_get_double(gh, "latitudeOfFirstGridPointInDegrees", &latitudeOfFirstGridPointInDegrees), 0); // yfirst + GRIB_CHECK(grib_get_double(gh, "latitudeOfLastGridPointInDegrees", &latitudeOfLastGridPointInDegrees), 0); // ylast + GRIB_CHECK(grib_get_double(gh, "jDirectionIncrementInDegrees", &jDirectionIncrementInDegrees), 0); // yinc + Message("CHANGED INTO: yfirst = %f, ylast = %f, yinc = %f", latitudeOfFirstGridPointInDegrees, + latitudeOfLastGridPointInDegrees, jDirectionIncrementInDegrees); + } +} + +static void +convertDataScanningMode(int scanModeIN, int scanModeOUT, double *data, size_t gridsize, size_t iDim, size_t jDim) +{ + size_t idxIN, idxOUT; + + // 127: reserved for testing; it will generate test data in 64 scanning mode + if (scanModeOUT == 127) // fill with testdata ... + { + scanModeOUT = 64; + if (cdiDebugExt >= 30) printf("convertDataScanningMode(): Generating test data in 64 scanning mode..\n"); + for (size_t j = 0; j < jDim; j++) + { + size_t jXiDim = j * iDim; + for (size_t i = 0; i < iDim; i++) + { + idxIN = i + jXiDim; + data[idxIN] = (double) (100.0 * j + i); + } + } + } + + if ((iDim * jDim) != gridsize) + { + if (cdiDebugExt >= 30) + printf("convertDataScanningMode(): ERROR: (iDim*jDim)!= gridsize; (%zu * %zu) != %zu\n", iDim, jDim, gridsize); + return; + } + if (cdiDebugExt >= 30) + printf("convertDataScanningMode(): scanModeIN=%02d => scanModeOUT=%02d ; where: (iDim * jDim == gridsize) (%zu*%zu == %zu)\n", + scanModeIN, scanModeOUT, iDim, jDim, gridsize); + + if (cdiDebugExt >= 100) + { + printf("convertDataScanningMode(): data IN:\n"); + for (size_t j = 0; j < jDim; j++) + { + size_t jXiDim = j * iDim; + for (size_t i = 0; i < iDim; i++) + { + idxIN = i + jXiDim; + printf("%03.0f, ", data[idxIN]); + } + printf("\n"); + } + } + + if (scanModeIN == scanModeOUT) + { + if (cdiDebugExt >= 30) printf("convertDataScanningMode(): INFO: Nothing to do; scanModeIN==scanModeOUT..\n"); + return; + } + + if (0) + { + return; + if (scanModeOUT == 00) + { + if (cdiDebugExt > 0) printf("convertDataScanningMode(): Leave data unchaged BUT set scanModeOUT=00.\n"); + // CHECK: Looks like that GRIB-API provide (no matter what) data in the scannning mode 00, even it is store in the + // gribfile as 64 !! + return; + } + } + double *dataCopy = (double *) Malloc(gridsize * sizeof(double)); + memcpy((void *) dataCopy, (void *) data, gridsize * sizeof(double)); + + if (scanModeIN + == 64) // Scanning Mode (00 dec) +i, -j; i direction consecutive (row-major order West->East & South->North ) + { // Scanning Mode (64 dec) +i, +j; i direction consecutive (row-major order West->East & North->South ) + // Scanning Mode (96 dec) +i, +j; j direction consecutive (column-major order North->South & West->East ) + if (scanModeOUT == 00) + // CHECK: Looks like that GRIB-API provide (no matter what) data in the scannning mode 00, even it is store in the gribfile + // as 64 !! +#define VERTICAL_FLIP +#ifdef VERTICAL_FLIP + { // flip the data vertically .. + idxIN = 0; + idxOUT = (jDim - 1) * iDim; + if (cdiDebugExt >= 30) printf("convertDataScanningMode(): copying rows nr. (%04d : %04zu)\n", 0, jDim - 1); + for (size_t j = 0; j < jDim; j++) + { + memcpy((void *) &data[idxOUT], (void *) &dataCopy[idxIN], iDim * sizeof(double)); + idxIN += iDim; + idxOUT -= iDim; + } + } // end if (scanModeOUT==00)*/ +#endif +#ifdef HORIZONTAL_FLIP + { // flip data horizontally ... + if (1) + { + if (cdiDebugExt >= 30) printf("convertDataScanningMode(): copying columns nr. (%04d : %04d);\n", 0, iDim - 1); + for (size_t i = 0; i < iDim; i++) + { + for (size_t j = 0; j < jDim; j++) + { + size_t jXiDim = j * iDim; + idxIN = i + jXiDim; + // data[idxIN] = (double) (100.0*j +i); // just some testdata .. + idxOUT = iDim - i - 1 + jXiDim; + // printf("[%03d=>%03d] = %f;",idxIN,idxOUT,dataCopy[idxIN]); + data[idxOUT] = dataCopy[idxIN]; + } + } + } + } // end if (scanModeOUT==00) +#endif + + if (scanModeOUT == 96) + { // transpose the data + if (cdiDebugExt >= 30) + printf("convertDataScanningMode(): transpose data rows=>columns nr. (%04d : %04zu) => (%04d : %04zu);\n", 0, iDim - 1, + 0, jDim - 1); + for (size_t j = 0; j < jDim; j++) + { + size_t jXiDim = j * iDim; + for (size_t i = 0; i < iDim; i++) + { + idxIN = i + jXiDim; + idxOUT = j + i * jDim; + // printf("[%03d=>%03d] = %f;",idxIN,idxOUT,dataCopy[idxIN]); + data[idxOUT] = dataCopy[idxIN]; + } + // printf(".\n"); + } + } // end if (scanModeOUT==96) + } // end if (scanModeIN==64) + + if (scanModeIN + == 00) // Scanning Mode (00 dec) +i, -j; i direction consecutive (row-major order West->East & South->North ) + { // Scanning Mode (64 dec) +i, +j; i direction consecutive (row-major order West->East & North->South ) + // Scanning Mode (96 dec) +i, +j; j direction consecutive (column-major order North->South & West->East ) + if (scanModeOUT == 64) + { // flip the data vertically .. + idxIN = 0; + idxOUT = (jDim - 1) * iDim; + for (size_t j = 0; j < jDim; j++) + { + if (cdiDebugExt >= 25) + printf("convertDataScanningMode(): copying row nr. %04zu; [idxIN=%08zu] => [idxOUT=%08zu]\n", j, idxIN, idxOUT); + memcpy((void *) &data[idxOUT], (void *) &dataCopy[idxIN], iDim * sizeof(double)); + idxIN += iDim; + idxOUT -= iDim; + } + } // end if (scanModeOUT==64) + + if (scanModeOUT == 96) + { // transpose the data + size_t jInv; + for (size_t j = 0; j < jDim; j++) + { + if (cdiDebugExt >= 30) printf("convertDataScanningMode(): processing row nr. %04zu;\n", j); + jInv = (jDim - 1) - j; + for (size_t i = 0; i < iDim; i++) data[j + i * jDim] = dataCopy[i + jInv * iDim]; // source data has -j + } + } // end if (scanModeOUT==96) + } // end if (scanModeIN==00) + + if (scanModeIN + == 96) // Scanning Mode (00 dec) +i, -j; i direction consecutive (row-major order West->East & South->North ) + { // Scanning Mode (64 dec) +i, +j; i direction consecutive (row-major order West->East & North->South ) + // Scanning Mode (96 dec) +i, +j; j direction consecutive (column-major order North->South & West->East ) + if (scanModeOUT == 64) + { // transpose the data + for (size_t j = 0; j < jDim; j++) + { + if (cdiDebugExt >= 30) printf("convertDataScanningMode(): processing row nr. %04zu;\n", j); + size_t jXiDim = j * iDim; + for (size_t i = 0; i < iDim; i++) + // data[j + i*jDim] = dataCopy[i + j*iDim]; + data[i + jXiDim] = dataCopy[j + i * jDim]; + } + } // end if (scanModeOUT==64) + + if (scanModeOUT == 00) + { // transpose the data + idxIN = 0; + idxOUT = 0; + size_t jInv; + for (size_t j = 0; j < jDim; j++) + { + if (cdiDebugExt >= 30) printf("convertDataScanningMode(): processing row nr. %04zu;\n", j); + jInv = (jDim - 1) - j; + size_t jXiDim = j * iDim; + for (size_t i = 0; i < iDim; i++) + // data[jInv + iXjDim] = dataCopy[i + jXiDim]; // target data has -j + data[i + jXiDim] = dataCopy[jInv + i * jDim]; // target data has -j + } + } // end if (scanModeOUT==00) + } // end if (scanModeIN==96) + + if (cdiDebugExt >= 100) + { + printf("convertDataScanningMode(): data OUT (new scanning mode):\n"); + for (size_t j = 0; j < jDim; j++) + { + size_t jXiDim = j * iDim; + for (size_t i = 0; i < iDim; i++) + { + idxIN = i + jXiDim; + printf("%03.0f, ", data[idxIN]); + } + printf("\n"); + } + } + + free(dataCopy); +} +#endif // HIRLAM_EXTENSIONS + +static void +gribapiSetExtMode(grib_handle *gh, int gridID, size_t datasize, const void *data) +{ +#ifndef HIRLAM_EXTENSIONS + (void) data; + (void) datasize; +#endif + int gridtype = gridInqType(gridID); + if (gridtype == GRID_PROJECTION) + { + int projtype = gridInqProjType(gridID); + // clang-format off + if (projtype == CDI_PROJ_RLL) gridtype = GRID_LONLAT; + else if (projtype == CDI_PROJ_LCC) gridtype = CDI_PROJ_LCC; + else if (projtype == CDI_PROJ_STERE) gridtype = CDI_PROJ_STERE; + // clang-format on + } + + if (gridtype == GRID_GENERIC || gridtype == GRID_LONLAT || gridtype == GRID_GAUSSIAN || gridtype == GRID_GAUSSIAN_REDUCED + || gridtype == CDI_PROJ_LCC) + { +#ifdef HIRLAM_EXTENSIONS + int scanModeIN = 0; + cdiInqKeyInt(gridID, CDI_GLOBAL, CDI_KEY_SCANNINGMODE, &scanModeIN); + + if (cdiDebugExt >= 100) Message("scanModeIN=%d; gridsize=%zu", scanModeIN, gridInqSize(gridID)); + + if (cdiGribDataScanningMode.active) // allowed modes: <0, 64, 96>; Default is 64 + { + size_t iDim = gridInqXsize(gridID); + size_t jDim = gridInqYsize(gridID); + + double yfirst = gridInqYval(gridID, 0); + double ylast = gridInqYval(gridID, jDim - 1); + double yinc = gridInqYinc(gridID); + + int scanModeOUT = cdiGribDataScanningMode.value; + convertDataScanningMode(scanModeIN, scanModeOUT, (double *) data, datasize, iDim, jDim); + // This will overrule the old scanning mode of the given grid + if (cdiDebugExt >= 10) Message("Set GribDataScanningMode (%d) => (%d)", scanModeIN, cdiGribDataScanningMode.value); + gribapiSetScanningMode(gh, cdiGribDataScanningMode.value); + + if (((scanModeIN == 00) && (cdiGribDataScanningMode.value == 64)) + || ((scanModeIN == 64) && (cdiGribDataScanningMode.value == 00))) + verticallyFlipGridDefinitionWhenScanningModeChanged(gh, yfirst, ylast, yinc); + } + else + { + if (cdiDebugExt >= 100) Message("Set GribDataScanningMode => (%d) based on used grid", scanModeIN); + gribapiSetScanningMode(gh, scanModeIN); + } +#endif + } +} + +// #define GRIBAPIENCODETEST 1 + +size_t +gribapiEncode(int varID, int levelID, int vlistID, int gridID, int zaxisID, CdiDateTime vDateTime, int tsteptype, int numavg, + size_t datasize, const void *data, size_t nmiss, void **gribbuffer, size_t *gribbuffersize, int comptype, + void *gribContainer) +{ + long editionNumber = 2; + + // extern unsigned char _grib_template_GRIB2[]; + cdi_check_gridsize_int_limit("GRIB", datasize); + + int param = vlistInqVarParam(vlistID, varID); + int datatype = vlistInqVarDatatype(vlistID, varID); + int typeOfGeneratingProcess = 0; + cdiInqKeyInt(vlistID, varID, CDI_KEY_TYPEOFGENERATINGPROCESS, &typeOfGeneratingProcess); + int productDefinitionTemplate = -1; + cdiInqKeyInt(vlistID, varID, CDI_KEY_PRODUCTDEFINITIONTEMPLATE, &productDefinitionTemplate); + + int uvRelativeToGrid = -1; + cdiInqKeyInt(vlistID, varID, CDI_KEY_UVRELATIVETOGRID, &uvRelativeToGrid); + +#ifdef GRIBAPIENCODETEST + grib_handle *gh = (grib_handle *) gribHandleNew(editionNumber); +#else + gribContainer_t *gc = (gribContainer_t *) gribContainer; + assert(gc != NULL); + grib_handle *gh = (struct grib_handle *) gc->gribHandle; +#endif + + GRIB_CHECK(grib_get_long(gh, "editionNumber", &editionNumber), 0); + + if (editionNumber == 2) + { + if (!gc->init) + { + int backgroundProcess = 0; + cdiInqKeyInt(vlistID, varID, CDI_KEY_BACKGROUNDPROCESS, &backgroundProcess); + GRIB_CHECK(my_grib_set_long(gh, "typeOfGeneratingProcess", typeOfGeneratingProcess), 0); + GRIB_CHECK(my_grib_set_long(gh, "backgroundProcess", backgroundProcess), 0); + int status, tablesVersion, localTablesVersion; + status = cdiInqKeyInt(vlistID, varID, CDI_KEY_TABLESVERSION, &tablesVersion); + if (status == 0) GRIB_CHECK(my_grib_set_long(gh, "tablesVersion", (long) tablesVersion), 0); + status = cdiInqKeyInt(vlistID, varID, CDI_KEY_LOCALTABLESVERSION, &localTablesVersion); + if (status == 0) GRIB_CHECK(my_grib_set_long(gh, "localTablesVersion", (long) localTablesVersion), 0); + int typeOfProcessedData = 0; + status = cdiInqKeyInt(vlistID, varID, CDI_KEY_TYPEOFPROCESSEDDATA, &typeOfProcessedData); + if (status == 0) GRIB_CHECK(my_grib_set_long(gh, "typeOfProcessedData", (long) typeOfProcessedData), 0); + /* + int constituentType = 0; + status = cdiInqKeyInt(vlistID, varID, CDI_KEY_CONSTITUENTTYPE, &constituentType); + if ( status == 0 ) GRIB_CHECK(my_grib_set_long(gh, "constituentType", (long)constituentType), 0); + */ + } + } + + gribapiDefTime((int) editionNumber, productDefinitionTemplate, typeOfGeneratingProcess, gh, vDateTime, tsteptype, numavg, + vlistInqTaxis(vlistID), gc->init); + + { + int typeOfTimeIncrement = 0; + int status = cdiInqKeyInt(vlistID, varID, CDI_KEY_TYPEOFTIMEINCREMENT, &typeOfTimeIncrement); + if (status == 0) grib_set_long(gh, "typeOfTimeIncrement", (long) typeOfTimeIncrement); + } + + { + int status, perturbationNumber, numberOfForecastsInEnsemble, typeOfEnsembleForecast; + status = cdiInqKeyInt(vlistID, varID, CDI_KEY_TYPEOFENSEMBLEFORECAST, &typeOfEnsembleForecast); + if (status == 0) grib_set_long(gh, "typeOfEnsembleForecast", typeOfEnsembleForecast); + status = cdiInqKeyInt(vlistID, varID, CDI_KEY_NUMBEROFFORECASTSINENSEMBLE, &numberOfForecastsInEnsemble); + if (status == 0) grib_set_long(gh, "numberOfForecastsInEnsemble", numberOfForecastsInEnsemble); + status = cdiInqKeyInt(vlistID, varID, CDI_KEY_PERTURBATIONNUMBER, &perturbationNumber); + if (status == 0) grib_set_long(gh, "perturbationNumber", perturbationNumber); + } + + if (!gc->init) gribapiDefInstitut(gh, vlistID, varID); + if (!gc->init) gribapiDefModel(gh, vlistID, varID); + + if (!gc->init) + { + char name[256], stdname[256]; + vlistInqVarName(vlistID, varID, name); + vlistInqVarStdname(vlistID, varID, stdname); + gribapiDefParam((int) editionNumber, gh, param, name, stdname); + } + + if (!gc->init && editionNumber == 2) + { + int shapeOfTheEarth = 0; + cdiInqKeyInt(vlistID, varID, CDI_KEY_SHAPEOFTHEEARTH, &shapeOfTheEarth); + GRIB_CHECK(my_grib_set_long(gh, "shapeOfTheEarth", (long) shapeOfTheEarth), 0); + + int grib2LocalSectionNumber, section2PaddingLength; + int mpimType, mpimClass, mpimUser; + if (cdiInqKeyInt(vlistID, varID, CDI_KEY_MPIMTYPE, &mpimType) == CDI_NOERR + && cdiInqKeyInt(vlistID, varID, CDI_KEY_MPIMCLASS, &mpimClass) == CDI_NOERR + && cdiInqKeyInt(vlistID, varID, CDI_KEY_MPIMUSER, &mpimUser) == CDI_NOERR) + { + grib_set_long(gh, "grib2LocalSectionPresent", 1); + grib_set_long(gh, "grib2LocalSectionNumber", 1); + grib_set_long(gh, "mpimType", mpimType); + grib_set_long(gh, "mpimClass", mpimClass); + grib_set_long(gh, "mpimUser", mpimUser); + + int revNumLen = 20; + unsigned char revNumber[revNumLen]; + if (cdiInqKeyBytes(vlistID, varID, CDI_KEY_REVNUMBER, revNumber, &revNumLen) == CDI_NOERR) + { + size_t revNumLenS = revNumLen; + grib_set_bytes(gh, "revNumber", revNumber, &revNumLenS); + } + int revStatus; + if (cdiInqKeyInt(vlistID, varID, CDI_KEY_REVSTATUS, &revStatus) == CDI_NOERR) grib_set_long(gh, "revStatus", revStatus); + } + else if (cdiInqKeyInt(vlistID, varID, CDI_KEY_GRIB2LOCALSECTIONNUMBER, &grib2LocalSectionNumber) == CDI_NOERR + && cdiInqKeyInt(vlistID, varID, CDI_KEY_SECTION2PADDINGLENGTH, §ion2PaddingLength) == CDI_NOERR) + { + grib_set_long(gh, "grib2LocalSectionPresent", 1); + grib_set_long(gh, "grib2LocalSectionNumber", grib2LocalSectionNumber); + unsigned char *section2Padding = (unsigned char *) Malloc(section2PaddingLength); + cdiInqKeyBytes(vlistID, varID, CDI_KEY_SECTION2PADDING, section2Padding, §ion2PaddingLength); + size_t len = section2PaddingLength; + // Does not work anymore with ecCodes 2.22.0/2.25.0!!! + // ECCODES ERROR : pack_bytes: Wrong size (10) for section2Padding. It is 0 bytes long + grib_set_bytes(gh, "section2Padding", section2Padding, &len); + Free(section2Padding); + } + } + + // bitsPerValue have to be defined first (complex packing) + GRIB_CHECK(my_grib_set_long(gh, "bitsPerValue", (long) grbBitsPerValue(datatype)), 0); + + if (!gc->init) gribapiDefGrid((int) editionNumber, gh, gridID, comptype, datatype, uvRelativeToGrid); + + gribapiDefLevel((int) editionNumber, gh, zaxisID, levelID, gc->init, productDefinitionTemplate); + + vlist_t *vlistptr = vlist_to_pointer(vlistID); + int zaxisSize = zaxisInqSize(zaxisID); + // if (!gc->init) + { + int ret = 0; + + // NOTE: Optional key/value pairs: Note that we do not distinguish between tiles here! + + for (int i = 0; i < vlistptr->vars[varID].opt_grib_nentries; i++) + { + if (vlistptr->vars[varID].opt_grib_kvpair[i].update) + { + // DR: Fix for multi-level fields (otherwise only the 1st level is correct) + if (zaxisSize == (levelID + 1)) vlistptr->vars[varID].opt_grib_kvpair[i].update = false; + + if (vlistptr->vars[varID].opt_grib_kvpair[i].data_type == t_double) + { + if (CDI_Debug) + Message("key \"%s\" : double value = %g", vlistptr->vars[varID].opt_grib_kvpair[i].keyword, + vlistptr->vars[varID].opt_grib_kvpair[i].dbl_val); + my_grib_set_double(gh, vlistptr->vars[varID].opt_grib_kvpair[i].keyword, + vlistptr->vars[varID].opt_grib_kvpair[i].dbl_val); + GRIB_CHECK(ret, 0); + } + if (vlistptr->vars[varID].opt_grib_kvpair[i].data_type == t_int) + { + if (CDI_Debug) + Message("key \"%s\" : integer value = %d", vlistptr->vars[varID].opt_grib_kvpair[i].keyword, + vlistptr->vars[varID].opt_grib_kvpair[i].int_val); + my_grib_set_long(gh, vlistptr->vars[varID].opt_grib_kvpair[i].keyword, + (long) vlistptr->vars[varID].opt_grib_kvpair[i].int_val); + GRIB_CHECK(ret, 0); + } + } + } + } + + if (nmiss > 0) + { + GRIB_CHECK(my_grib_set_long(gh, "bitmapPresent", 1), 0); + GRIB_CHECK(my_grib_set_double(gh, "missingValue", vlistInqVarMissval(vlistID, varID)), 0); + } + + gribapiSetExtMode(gh, gridID, datasize, data); + + GRIB_CHECK(grib_set_double_array(gh, "values", (const double *) data, datasize), 0); + + if (nmiss) + { + long numberOfMissing = -1; + GRIB_CHECK(grib_get_long(gh, "numberOfMissing", &numberOfMissing), 0); + if (numberOfMissing == 0) GRIB_CHECK(my_grib_set_long(gh, "bitmapPresent", 0), 0); + } + + // get the size of coded message + const void *dummy = NULL; + size_t recsize = 0; + GRIB_CHECK(grib_get_message(gh, &dummy, &recsize), 0); + recsize += 512; // add some space for possible filling + *gribbuffersize = recsize; + *gribbuffer = Malloc(*gribbuffersize); + + if (!gc->init && editionNumber == 2) + { + long pdis; + grib_get_long(gh, "discipline", &pdis); + if (pdis != 255) + { + char cdi_name[CDI_MAX_NAME]; + cdi_name[0] = 0; + vlistInqVarName(vlistID, varID, cdi_name); + char grb_name[256]; + gribapiGetString(gh, "shortName", grb_name, sizeof(grb_name)); + str_to_lower(cdi_name); + str_to_lower(grb_name); + bool checkName = (!grb_name[0] && strncmp(cdi_name, "param", 5) == 0) ? false : true; + if (checkName && ((strlen(cdi_name) != strlen(grb_name)) || !strStartsWith(cdi_name, grb_name))) + Warning("*** GRIB2 shortName does not correspond to chosen variable name: \"%s\" (\"%s\").", + grb_name[0] ? grb_name : "unknown", cdi_name); + } + } + + // get a copy of the coded message + GRIB_CHECK(grib_get_message_copy(gh, *gribbuffer, &recsize), 0); + +#ifdef GRIBAPIENCODETEST + gribHandleDelete(gh); +#endif + + gc->init = true; + + return recsize; +} + +void +gribapiChangeParameterIdentification(grib_handle *gh, int code, int ltype, int level) +{ + // timeRangeIndicator: could be included later + if (gribEditionNumber(gh) <= 1) + { + if (code != -1) GRIB_CHECK(my_grib_set_long(gh, "indicatorOfParameter", code), 0); + if (ltype != -1) GRIB_CHECK(my_grib_set_long(gh, "indicatorOfTypeOfLevel", ltype), 0); + if (level != -1) GRIB_CHECK(my_grib_set_long(gh, "level", level), 0); + } +} + +#endif + +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifdef HAVE_CONFIG_H +#endif + +#include <float.h> + + + +#ifdef HAVE_LIBIEG + +static int +iegInqDatatype(int prec) +{ + return (prec == EXSE_DOUBLE_PRECISION) ? CDI_DATATYPE_FLT64 : CDI_DATATYPE_FLT32; +} + +static int +iegDefDatatype(int datatype) +{ + if (datatype == CDI_DATATYPE_CPX32 || datatype == CDI_DATATYPE_CPX64) Error("CDI/IEG library does not support complex numbers!"); + + if (datatype != CDI_DATATYPE_FLT32 && datatype != CDI_DATATYPE_FLT64) datatype = CDI_DATATYPE_FLT32; + + return (datatype == CDI_DATATYPE_FLT64) ? EXSE_DOUBLE_PRECISION : EXSE_SINGLE_PRECISION; +} + +static void +ieg_read_recordSP(stream_t *streamptr, float *data, size_t *nmiss) +{ + int vlistID = streamptr->vlistID; + int fileID = streamptr->fileID; + int tsID = streamptr->curTsID; + + int vrecID = streamptr->tsteps[tsID].curRecID; + int recID = streamptr->tsteps[tsID].recIDs[vrecID]; + int varID = streamptr->tsteps[tsID].records[recID].varID; + off_t recpos = streamptr->tsteps[tsID].records[recID].position; + + fileSetPos(fileID, recpos, SEEK_SET); + + void *iegp = streamptr->record->objectp; + if (iegRead(fileID, iegp) < 0) Error("Could not read IEG record!"); + + iegInqDataSP(iegp, data); + + double missval = vlistInqVarMissval(vlistID, varID); + size_t size = gridInqSize(vlistInqVarGrid(vlistID, varID)); + + *nmiss = get_num_missvalsSP(size, data, missval); + + streamptr->numvals += size; +} + +static void +ieg_read_recordDP(stream_t *streamptr, double *data, size_t *nmiss) +{ + int vlistID = streamptr->vlistID; + int fileID = streamptr->fileID; + int tsID = streamptr->curTsID; + + int vrecID = streamptr->tsteps[tsID].curRecID; + int recID = streamptr->tsteps[tsID].recIDs[vrecID]; + int varID = streamptr->tsteps[tsID].records[recID].varID; + off_t recpos = streamptr->tsteps[tsID].records[recID].position; + + fileSetPos(fileID, recpos, SEEK_SET); + + void *iegp = streamptr->record->objectp; + if (iegRead(fileID, iegp) < 0) Error("Could not read IEG record!"); + + iegInqDataDP(iegp, data); + + double missval = vlistInqVarMissval(vlistID, varID); + size_t size = gridInqSize(vlistInqVarGrid(vlistID, varID)); + + *nmiss = get_num_missvalsDP(size, data, missval); + + streamptr->numvals += size; +} + +void +ieg_read_record(stream_t *streamptr, int memtype, void *data, size_t *nmiss) +{ + if (memtype == MEMTYPE_DOUBLE) + ieg_read_recordDP(streamptr, (double *) data, nmiss); + else + ieg_read_recordSP(streamptr, (float *) data, nmiss); +} + +static int +iegGetZaxisType(int iegleveltype) +{ + // clang-format off + switch (iegleveltype) + { + case IEG_LTYPE_SURFACE: return ZAXIS_SURFACE; + case IEG_LTYPE_99: + case IEG_LTYPE_ISOBARIC: return ZAXIS_PRESSURE; + case IEG_LTYPE_HEIGHT: return ZAXIS_HEIGHT; + case IEG_LTYPE_ALTITUDE: return ZAXIS_ALTITUDE; + case IEG_LTYPE_HYBRID: + case IEG_LTYPE_HYBRID_LAYER: return ZAXIS_HYBRID; + case IEG_LTYPE_LANDDEPTH: + case IEG_LTYPE_LANDDEPTH_LAYER: return ZAXIS_DEPTH_BELOW_LAND; + case IEG_LTYPE_SEADEPTH: return ZAXIS_DEPTH_BELOW_SEA; + } + // clang-format on + return ZAXIS_GENERIC; +} + +static void +iegDefTime(int *pdb, CdiDateTime datetime, int taxisID) +{ + int timetype = (taxisID != -1) ? taxisInqType(taxisID) : -1; + if (timetype == TAXIS_ABSOLUTE || timetype == TAXIS_RELATIVE) + { + IEG_P_Year(pdb) = datetime.date.year; + IEG_P_Month(pdb) = datetime.date.month; + IEG_P_Day(pdb) = datetime.date.day; + IEG_P_Hour(pdb) = datetime.time.hour; + IEG_P_Minute(pdb) = datetime.time.minute; + + pdb[15] = 1; + pdb[16] = 0; + pdb[17] = 0; + pdb[18] = 10; + pdb[36] = 1; + } + + pdb[5] = 128; +} + +/* find smallest power of 10 in [1000,10000000] that upon multiplication results in fractional part + close to zero for all arguments */ +static double +calc_resfac(double xfirst, double xlast, double xinc, double yfirst, double ylast, double yinc) +{ + double resfac = 1000.0; + enum + { + nPwrOf10 = 5, + nMultTests = 6, + }; + static const double scaleFactors[nPwrOf10] = { 1000, 10000, 100000, 1000000, 10000000 }; + const double vals[nMultTests] = { xfirst, xlast, xinc, yfirst, ylast, yinc }; + + for (size_t j = 0; j < nPwrOf10; ++j) + { + double scaleBy = scaleFactors[j]; + bool fractionalScale = false; + for (size_t i = 0; i < nMultTests; ++i) + { + fractionalScale = fractionalScale || fabs(vals[i] * scaleBy - round(vals[i] * scaleBy)) > FLT_EPSILON; + } + if (!fractionalScale) + { + resfac = scaleBy; + break; + } + } + + return resfac; +} + +static void +iegDefGrid(int *gdb, int gridID) +{ + int projID = gridInqProj(gridID); + if (projID != CDI_UNDEFID && gridInqProjType(projID) == CDI_PROJ_RLL) gridID = projID; + + int gridtype = gridInqType(gridID); + int projtype = CDI_UNDEFID; + if (gridtype == GRID_PROJECTION && gridInqProjType(gridID) == CDI_PROJ_RLL) projtype = CDI_PROJ_RLL; + + size_t xsize = gridInqXsize(gridID); + size_t ysize = gridInqYsize(gridID); + + cdi_check_gridsize_int_limit("IEG", xsize * ysize); + + if (gridtype == GRID_GENERIC) + { + if ((ysize == 32 || ysize == 48 || ysize == 64 || ysize == 96 || ysize == 160) && (xsize == 2 * ysize || xsize == 1)) + { + gridtype = GRID_GAUSSIAN; + gridChangeType(gridID, gridtype); + } + else if ((xsize == 1 && ysize == 1) || (xsize == 0 && ysize == 0)) + { + gridtype = GRID_LONLAT; + gridChangeType(gridID, gridtype); + } + else if (gridInqXvals(gridID, NULL) && gridInqYvals(gridID, NULL)) + { + gridtype = GRID_LONLAT; + gridChangeType(gridID, gridtype); + } + } + else if (gridtype == GRID_CURVILINEAR) + { + gridtype = GRID_LONLAT; + } + + bool lrotated = (projtype == CDI_PROJ_RLL); + + if (gridtype == GRID_LONLAT || gridtype == GRID_GAUSSIAN || projtype == CDI_PROJ_RLL) + { + double xfirst = 0.0, xlast = 0.0, xinc = 0.0; + double yfirst = 0.0, ylast = 0.0, yinc = 0.0; + + if (xsize == 0) + xsize = 1; + else + { + xfirst = gridInqXval(gridID, 0); + xlast = gridInqXval(gridID, xsize - 1); + xinc = gridInqXinc(gridID); + } + + if (ysize == 0) + ysize = 1; + else + { + yfirst = gridInqYval(gridID, 0); + ylast = gridInqYval(gridID, ysize - 1); + yinc = gridInqYinc(gridID); + } + + if (gridtype == GRID_GAUSSIAN) + IEG_G_GridType(gdb) = 4; + else if (lrotated) + IEG_G_GridType(gdb) = 10; + else + IEG_G_GridType(gdb) = 0; + + double resfac = calc_resfac(xfirst, xlast, xinc, yfirst, ylast, yinc); + int iresfac = (int) resfac; + if (iresfac == 1000) iresfac = 0; + + IEG_G_ResFac(gdb) = iresfac; + + IEG_G_NumLon(gdb) = (int) xsize; + IEG_G_NumLat(gdb) = (int) ysize; + IEG_G_FirstLat(gdb) = (int) lround(yfirst * resfac); + IEG_G_LastLat(gdb) = (int) lround(ylast * resfac); + IEG_G_FirstLon(gdb) = (int) lround(xfirst * resfac); + IEG_G_LastLon(gdb) = (int) lround(xlast * resfac); + IEG_G_LonIncr(gdb) = (int) lround(xinc * resfac); + if (fabs(xinc * resfac - IEG_G_LonIncr(gdb)) > FLT_EPSILON) IEG_G_LonIncr(gdb) = 0; + + if (gridtype == GRID_GAUSSIAN) + IEG_G_LatIncr(gdb) = (int) ysize / 2; + else + { + IEG_G_LatIncr(gdb) = (int) lround(yinc * resfac); + if (fabs(yinc * resfac - IEG_G_LatIncr(gdb)) > FLT_EPSILON) IEG_G_LatIncr(gdb) = 0; + + if (IEG_G_LatIncr(gdb) < 0) IEG_G_LatIncr(gdb) = -IEG_G_LatIncr(gdb); + } + + if (IEG_G_NumLon(gdb) > 1 && IEG_G_NumLat(gdb) == 1) + if (IEG_G_LonIncr(gdb) != 0 && IEG_G_LatIncr(gdb) == 0) IEG_G_LatIncr(gdb) = IEG_G_LonIncr(gdb); + + if (IEG_G_NumLon(gdb) == 1 && IEG_G_NumLat(gdb) > 1) + if (IEG_G_LonIncr(gdb) == 0 && IEG_G_LatIncr(gdb) != 0) IEG_G_LonIncr(gdb) = IEG_G_LatIncr(gdb); + + IEG_G_ResFlag(gdb) = (IEG_G_LatIncr(gdb) == 0 || IEG_G_LonIncr(gdb) == 0) ? 0 : 128; + + if (lrotated) + { + double xpole = 0.0, ypole = 0.0, angle = 0.0; + gridInqParamRLL(gridID, &xpole, &ypole, &angle); + + IEG_G_LatSP(gdb) = -(int) lround(ypole * resfac); + IEG_G_LonSP(gdb) = (int) lround((xpole + 180) * resfac); + IEG_G_Size(gdb) = 42; + } + else + { + IEG_G_Size(gdb) = 32; + } + } + else + { + Error("Unsupported grid type: %s", gridNamePtr(gridtype)); + } + + IEG_G_ScanFlag(gdb) = 64; +} + +static void +pdbDefLevel(int *pdb, int leveltype, int level1, int level2) +{ + IEG_P_LevelType(pdb) = leveltype; + IEG_P_Level1(pdb) = level1; + IEG_P_Level2(pdb) = level2; +} + +static void +iegDefLevel(int *pdb, int *gdb, double *vct, int zaxisID, int levelID) +{ + double level; + + int leveltype = zaxisInqType(zaxisID); + if (leveltype == ZAXIS_GENERIC) + { + Warning("Changed zaxis type from %s to %s", zaxisNamePtr(leveltype), zaxisNamePtr(ZAXIS_PRESSURE)); + leveltype = ZAXIS_PRESSURE; + zaxisChangeType(zaxisID, leveltype); + cdiDefKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_UNITS, "Pa"); + } + + // IEG_G_NumVCP(gdb) = 0; + + switch (leveltype) + { + case ZAXIS_SURFACE: + { + pdbDefLevel(pdb, IEG_LTYPE_SURFACE, 0, (int) (zaxisInqLevel(zaxisID, levelID))); + break; + } + case ZAXIS_HYBRID: + { + if (zaxisInqLbounds(zaxisID, NULL) && zaxisInqUbounds(zaxisID, NULL)) + pdbDefLevel(pdb, IEG_LTYPE_HYBRID_LAYER, (int) (zaxisInqLbound(zaxisID, levelID)), + (int) (zaxisInqUbound(zaxisID, levelID))); + else + pdbDefLevel(pdb, IEG_LTYPE_HYBRID, 0, (int) (zaxisInqLevel(zaxisID, levelID))); + + int vctsize = zaxisInqVctSize(zaxisID); + if (vctsize > 100) + { + static bool vct_warning = true; + // IEG_G_NumVCP(gdb) = 0; + if (vct_warning) + { + Warning("VCT size of %d is too large (maximum is 100). Set to 0!", vctsize); + vct_warning = false; + } + } + else + { + IEG_G_Size(gdb) += (vctsize * 4); + memcpy(vct, zaxisInqVctPtr(zaxisID), (size_t) vctsize / 2 * sizeof(double)); + memcpy(vct + 50, zaxisInqVctPtr(zaxisID) + vctsize / 2, (size_t) vctsize / 2 * sizeof(double)); + } + break; + } + case ZAXIS_PRESSURE: + { + level = zaxisInqLevel(zaxisID, levelID); + if (level < 0) Warning("pressure level of %f Pa is below 0.", level); + + char units[CDI_MAX_NAME]; + int length = CDI_MAX_NAME; + cdiInqKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_UNITS, units, &length); + if (memcmp(units, "hPa", 3) == 0 || memcmp(units, "mb", 2) == 0) level = level * 100; + + double dum; + int ilevel = (int) level; + if (level < 32768 && (level < 100 || modf(level / 100, &dum) > 0)) + pdbDefLevel(pdb, IEG_LTYPE_99, 0, ilevel); + else + pdbDefLevel(pdb, IEG_LTYPE_ISOBARIC, 0, ilevel / 100); + + break; + } + case ZAXIS_HEIGHT: + { + level = zaxisInqLevel(zaxisID, levelID); + pdbDefLevel(pdb, IEG_LTYPE_HEIGHT, 0, (int) level); + break; + } + case ZAXIS_ALTITUDE: + { + level = zaxisInqLevel(zaxisID, levelID); + pdbDefLevel(pdb, IEG_LTYPE_ALTITUDE, 0, (int) level); + break; + } + case ZAXIS_DEPTH_BELOW_LAND: + { + if (zaxisInqLbounds(zaxisID, NULL) && zaxisInqUbounds(zaxisID, NULL)) + pdbDefLevel(pdb, IEG_LTYPE_LANDDEPTH_LAYER, (int) (zaxisInqLbound(zaxisID, levelID)), + (int) (zaxisInqUbound(zaxisID, levelID))); + else + pdbDefLevel(pdb, IEG_LTYPE_LANDDEPTH, 0, (int) (zaxisInqLevel(zaxisID, levelID))); + + break; + } + case ZAXIS_DEPTH_BELOW_SEA: + { + level = zaxisInqLevel(zaxisID, levelID); + pdbDefLevel(pdb, IEG_LTYPE_SEADEPTH, 0, (int) level); + break; + } + case ZAXIS_ISENTROPIC: + { + level = zaxisInqLevel(zaxisID, levelID); + pdbDefLevel(pdb, 113, 0, (int) level); + break; + } + default: + { + Error("Unsupported zaxis type: %s", zaxisNamePtr(leveltype)); + break; + } + } +} + +void +iegCopyRecord(stream_t *streamptr2, stream_t *streamptr1) +{ + streamFCopyRecord(streamptr2, streamptr1, "IEG"); +} + +void +iegDefRecord(stream_t *streamptr) +{ + Record *record = streamptr->record; + + int vlistID = streamptr->vlistID; + int byteorder = streamptr->byteorder; + + int varID = record->varID; + int levelID = record->levelID; + int tsID = streamptr->curTsID; + CdiDateTime vDateTime = streamptr->tsteps[tsID].taxis.vDateTime; + + int gridID = vlistInqVarGrid(vlistID, varID); + int zaxisID = vlistInqVarZaxis(vlistID, varID); + + iegrec_t *iegp = (iegrec_t *) record->objectp; + iegInitMem(iegp); + for (int i = 0; i < 37; i++) iegp->ipdb[i] = -1; + + iegp->byteswap = getByteswap(byteorder); + + int param = vlistInqVarParam(vlistID, varID); + int pdis, pcat, pnum; + cdiDecodeParam(param, &pnum, &pcat, &pdis); + IEG_P_Parameter(iegp->ipdb) = pnum; + if (pdis == 255) IEG_P_CodeTable(iegp->ipdb) = pcat; + + iegDefTime(iegp->ipdb, vDateTime, vlistInqTaxis(vlistID)); + iegDefGrid(iegp->igdb, gridID); + iegDefLevel(iegp->ipdb, iegp->igdb, iegp->vct, zaxisID, levelID); + + iegp->dprec = iegDefDatatype(record->prec); +} + +static double +calc_refvalSP(size_t size, const float *data) +{ + float refval = data[0]; + for (size_t i = 1; i < size; ++i) + if (data[i] < refval) refval = data[i]; + return refval; +} + +static double +calc_refvalDP(size_t size, const double *data) +{ + double refval = data[0]; + for (size_t i = 1; i < size; ++i) + if (data[i] < refval) refval = data[i]; + return refval; +} + +static void +ieg_write_recordSP(stream_t *streamptr, const float *data) +{ + Record *record = streamptr->record; + iegrec_t *iegp = (iegrec_t *) record->objectp; + + int fileID = streamptr->fileID; + size_t gridsize = gridInqSize(record->gridID); + + iegp->refval = calc_refvalSP(gridsize, data); + + iegDefDataSP(iegp, data); + iegWrite(fileID, iegp); +} + +static void +ieg_write_recordDP(stream_t *streamptr, const double *data) +{ + Record *record = streamptr->record; + iegrec_t *iegp = (iegrec_t *) record->objectp; + + int fileID = streamptr->fileID; + size_t gridsize = gridInqSize(record->gridID); + + iegp->refval = calc_refvalDP(gridsize, data); + + iegDefDataDP(iegp, data); + iegWrite(fileID, iegp); +} + +void +ieg_write_record(stream_t *streamptr, int memtype, const void *data) +{ + if (memtype == MEMTYPE_DOUBLE) + ieg_write_recordDP(streamptr, (const double *) data); + else + ieg_write_recordSP(streamptr, (const float *) data); +} + +static void +iegAddRecord(stream_t *streamptr, int param, int *pdb, int *gdb, double *vct, size_t recsize, off_t position, int prec) +{ + int vlistID = streamptr->vlistID; + int tsID = streamptr->curTsID; + int recID = recordNewEntry(streamptr, tsID); + record_t *record = &streamptr->tsteps[tsID].records[recID]; + + int level1, level2; + if (IEG_P_LevelType(pdb) == IEG_LTYPE_HYBRID_LAYER) + { + level1 = IEG_P_Level1(pdb); + level2 = IEG_P_Level2(pdb); + } + else + { + level1 = IEG_P_Level2(pdb); + level2 = 0; + if (IEG_P_LevelType(pdb) == 100) level1 *= 100; + } + + record->size = recsize; + record->position = position; + record->param = param; + record->ilevel = level1; + record->ilevel2 = level2; + record->ltype = IEG_P_LevelType(pdb); + + int gridtype = (IEG_G_GridType(gdb) == 0) ? GRID_LONLAT + : (IEG_G_GridType(gdb) == 10) ? GRID_PROJECTION + : (IEG_G_GridType(gdb) == 4) ? GRID_GAUSSIAN + : GRID_GENERIC; + + grid_t *grid = (grid_t *) Malloc(sizeof(*grid)); + grid_init(grid); + cdiGridTypeInit(grid, gridtype, IEG_G_NumLon(gdb) * IEG_G_NumLat(gdb)); + size_t xsize = (size_t) IEG_G_NumLon(gdb); + size_t ysize = (size_t) IEG_G_NumLat(gdb); + grid->x.size = xsize; + grid->y.size = ysize; + grid->x.inc = 0; + grid->y.inc = 0; + grid->x.flag = 0; + + int iresfac = IEG_G_ResFac(gdb); + if (iresfac == 0) iresfac = 1000; + double resfac = 1. / (double) iresfac; + + // if ( IEG_G_FirstLon != 0 || IEG_G_LastLon != 0 ) + { + if (xsize > 1) + { + if (IEG_G_ResFlag(gdb) && IEG_G_LonIncr(gdb) > 0) + grid->x.inc = IEG_G_LonIncr(gdb) * resfac; + else + grid->x.inc = (IEG_G_LastLon(gdb) - IEG_G_FirstLon(gdb)) * resfac / (xsize - 1); + + // correct xinc if necessary + if (IEG_G_FirstLon(gdb) == 0 && IEG_G_LastLon(gdb) > 354000) + { + double xinc = 360. / xsize; + // FIXME: why not use grid->x.inc != xinc as condition? + if (fabs(grid->x.inc - xinc) > 0.0) + { + grid->x.inc = xinc; + if (CDI_Debug) Message("set xinc to %g", grid->x.inc); + } + } + } + grid->x.first = IEG_G_FirstLon(gdb) * resfac; + grid->x.last = IEG_G_LastLon(gdb) * resfac; + grid->x.flag = 2; + } + grid->y.flag = 0; + // if ( IEG_G_FirstLat != 0 || IEG_G_LastLat != 0 ) + { + if (ysize > 1) + { + if (IEG_G_ResFlag(gdb) && IEG_G_LatIncr(gdb) > 0) + grid->y.inc = IEG_G_LatIncr(gdb) * resfac; + else + grid->y.inc = (IEG_G_LastLat(gdb) - IEG_G_FirstLat(gdb)) * resfac / (ysize - 1); + } + grid->y.first = IEG_G_FirstLat(gdb) * resfac; + grid->y.last = IEG_G_LastLat(gdb) * resfac; + grid->y.flag = 2; + } + + double xpole = 0, ypole = 0; + if (IEG_G_GridType(gdb) == 10) + { + xpole = IEG_G_LonSP(gdb) * resfac - 180; + ypole = -IEG_G_LatSP(gdb) * resfac; + grid->projtype = CDI_PROJ_RLL; + } + + struct addIfNewRes gridAdded = cdiVlistAddGridIfNew(vlistID, grid, 0); + int gridID = gridAdded.Id; + if (!gridAdded.isNew) + { + grid_free(grid); + Free(grid); + } + else if (gridtype == GRID_PROJECTION) + gridDefParamRLL(gridID, xpole, ypole, 0); + + int leveltype = iegGetZaxisType(IEG_P_LevelType(pdb)); + if (leveltype == ZAXIS_HYBRID) + { + double tmpvct[100]; + size_t vctsize = (size_t) IEG_G_NumVCP(gdb); + + for (size_t i = 0; i < vctsize / 2; i++) tmpvct[i] = vct[i]; + for (size_t i = 0; i < vctsize / 2; i++) tmpvct[i + vctsize / 2] = vct[i + 50]; + + varDefVCT(vctsize, tmpvct); + } + + int lbounds = IEG_P_LevelType(pdb) == IEG_LTYPE_HYBRID_LAYER ? 1 : 0; + + int datatype = iegInqDatatype(prec); + + int varID, levelID = 0; + varAddRecord(recID, param, gridID, leveltype, lbounds, level1, level2, 0, 0, datatype, &varID, &levelID, TSTEP_INSTANT, 0, -1, + NULL, NULL, NULL, NULL); + + record->varID = (short) varID; + record->levelID = levelID; + + streamptr->tsteps[tsID].nallrecs++; + streamptr->nrecs++; + + if (CDI_Debug) Message("varID = %d gridID = %d levelID = %d", varID, gridID, levelID); +} + +#if 0 +static +void iegCmpRecord(stream_t *streamptr, int tsID, int recID, off_t position, int param, + int level, size_t xsize, size_t ysize) +{ + int varID = 0; + int levelID = 0; + + record_t *record = &streamptr->tsteps[tsID].records[recID]; + + if (param != (*record).param || level != (*record).ilevel) Error("inconsistent timestep"); + + (*record).position = position; + /* + varID = (*record).varID; + levelID = (*record).levelID; + + streamptr->vars[varID].level[levelID] = recID; + + streamptr->tsteps[tsID].nallrecs++; + streamptr->nrecs++; + */ + if (CDI_Debug) Message("varID = %d levelID = %d", varID, levelID); +} +#endif + +static CdiDateTime +iegDateTime(const int *pdb) +{ + int ryear = IEG_P_Year(pdb); + int rmonth = IEG_P_Month(pdb); + int rday = IEG_P_Day(pdb); + + int rhour = IEG_P_Hour(pdb); + int rminute = IEG_P_Minute(pdb); + + if (rminute == -1) rminute = 0; + + CdiDateTime cdiDateTime; + cdiDateTime.date = cdiDate_encode(ryear, rmonth, rday); + cdiDateTime.time = cdiTime_encode(rhour, rminute, 0, 0); + return cdiDateTime; +} + +static void +iegScanTimestep1(stream_t *streamptr) +{ + CdiDateTime datetime0; + cdiDateTime_init(&datetime0); + off_t recpos; + iegrec_t *iegp = (iegrec_t *) streamptr->record->objectp; + + streamptr->curTsID = 0; + + int tsID = tstepsNewEntry(streamptr); + if (tsID != 0) Error("Internal problem! tstepsNewEntry returns %d", tsID); + taxis_t *taxis = &streamptr->tsteps[tsID].taxis; + + int fileID = streamptr->fileID; + + int nrecs = 0; + while (true) + { + recpos = fileGetPos(fileID); + if (iegRead(fileID, iegp) != 0) + { + streamptr->ntsteps = 1; + break; + } + + size_t recsize = (size_t) (fileGetPos(fileID) - recpos); + + int prec = iegp->dprec; + int rcode = IEG_P_Parameter(iegp->ipdb); + int tabnum = IEG_P_CodeTable(iegp->ipdb); + int param = cdiEncodeParam(rcode, tabnum, 255); + int rlevel = (IEG_P_LevelType(iegp->ipdb) == IEG_LTYPE_HYBRID_LAYER) ? IEG_P_Level1(iegp->ipdb) : IEG_P_Level2(iegp->ipdb); + + if (IEG_P_LevelType(iegp->ipdb) == 100) rlevel *= 100; + + CdiDateTime datetime = iegDateTime(iegp->ipdb); + + if (nrecs == 0) + { + datetime0 = datetime; + taxis->vDateTime = datetime; + } + else + { + record_t *records = streamptr->tsteps[tsID].records; + for (int recID = 0; recID < nrecs; recID++) + if (param == records[recID].param && rlevel == records[recID].ilevel) goto tstepScanLoopFinished; + + if (cdiDateTime_isNE(datetime, datetime0)) Warning("Inconsistent verification time for param %d level %d", param, rlevel); + } + + nrecs++; + + if (CDI_Debug) Message("%4d%8d%4d%8d %s", nrecs, (int) recpos, param, rlevel, CdiDateTime_string(datetime)); + + iegAddRecord(streamptr, param, iegp->ipdb, iegp->igdb, iegp->vct, recsize, recpos, prec); + } + +tstepScanLoopFinished: + streamptr->rtsteps = 1; + + cdi_generate_vars(streamptr); + + int taxisID = taxisCreate(TAXIS_ABSOLUTE); + taxis->type = TAXIS_ABSOLUTE; + taxis->rDateTime = taxis->vDateTime; + + int vlistID = streamptr->vlistID; + vlistDefTaxis(vlistID, taxisID); + + vlist_check_contents(vlistID); + + streamScanResizeRecords1(streamptr); + + streamScanTsFixNtsteps(streamptr, recpos); + streamScanTimeConstAdjust(streamptr, taxis); +} + +static int +iegScanTimestep2(stream_t *streamptr) +{ + off_t recpos = 0; + iegrec_t *iegp = (iegrec_t *) streamptr->record->objectp; + + streamptr->curTsID = 1; + + int vlistID = streamptr->vlistID; + int fileID = streamptr->fileID; + + int tsID = streamptr->rtsteps; + if (tsID != 1) Error("Internal problem! unexpected timestep %d", tsID + 1); + + taxis_t *taxis = &streamptr->tsteps[tsID].taxis; + + fileSetPos(fileID, streamptr->tsteps[tsID].position, SEEK_SET); + + cdi_create_records(streamptr, tsID); + record_t *records = streamptr->tsteps[tsID].records; + + int nrecords = streamScanInitRecords2(streamptr); + + for (int rindex = 0; rindex <= nrecords; rindex++) + { + recpos = fileGetPos(fileID); + if (iegRead(fileID, iegp) != 0) + { + streamptr->ntsteps = 2; + break; + } + + size_t recsize = (size_t) (fileGetPos(fileID) - recpos); + + int rcode = IEG_P_Parameter(iegp->ipdb); + int tabnum = IEG_P_CodeTable(iegp->ipdb); + int param = cdiEncodeParam(rcode, tabnum, 255); + int rlevel = (IEG_P_LevelType(iegp->ipdb) == IEG_LTYPE_HYBRID_LAYER) ? IEG_P_Level1(iegp->ipdb) : IEG_P_Level2(iegp->ipdb); + + if (IEG_P_LevelType(iegp->ipdb) == 100) rlevel *= 100; + + CdiDateTime datetime = iegDateTime(iegp->ipdb); + + if (rindex == 0) + { + taxis->type = TAXIS_ABSOLUTE; + taxis->vDateTime = datetime; + } + + bool nextstep = false; + int recID = 0; + for (recID = 0; recID < nrecords; recID++) + { + if (param == records[recID].param && rlevel == records[recID].ilevel) + { + if (records[recID].used) + { + nextstep = true; + } + else + { + records[recID].used = true; + streamptr->tsteps[tsID].recIDs[rindex] = recID; + } + break; + } + } + if (recID == nrecords) + { + char paramstr[32]; + cdiParamToString(param, paramstr, sizeof(paramstr)); + Warning("param %s level %d not defined at timestep 1", paramstr, rlevel); + return CDI_EUFSTRUCT; + } + + if (nextstep) break; + + if (CDI_Debug) Message("%4d%8d%4d%8d %s", rindex + 1, (int) recpos, param, rlevel, CdiDateTime_string(datetime)); + + if (param != records[recID].param || rlevel != records[recID].ilevel) + { + Message("tsID = %d recID = %d param = %3d new %3d level = %3d new %3d", tsID, recID, records[recID].param, param, + records[recID].ilevel, rlevel); + return CDI_EUFSTRUCT; + } + + records[recID].position = recpos; + records[recID].size = recsize; + } + + int nrecs = 0; + for (int recID = 0; recID < nrecords; recID++) + { + if (records[recID].used) + nrecs++; + else + vlistDefVarTimetype(vlistID, records[recID].varID, TIME_CONSTANT); + } + streamptr->tsteps[tsID].nrecs = nrecs; + + streamptr->rtsteps = 2; + + streamScanTsFixNtsteps(streamptr, recpos); + + return 0; +} + +int +iegInqContents(stream_t *streamptr) +{ + streamptr->curTsID = 0; + + iegScanTimestep1(streamptr); + + int status = (streamptr->ntsteps == -1) ? iegScanTimestep2(streamptr) : 0; + + fileSetPos(streamptr->fileID, 0, SEEK_SET); + + return status; +} + +static long +iegScanTimestep(stream_t *streamptr) +{ + off_t recpos = 0; + iegrec_t *iegp = (iegrec_t *) streamptr->record->objectp; + + if (streamptr->rtsteps == 0) Error("Internal problem! Missing contents."); + + int tsID = streamptr->rtsteps; + taxis_t *taxis = &streamptr->tsteps[tsID].taxis; + + int nrecs = 0; + if (streamptr->tsteps[tsID].recordSize == 0) + { + cdi_create_records(streamptr, tsID); + record_t *records = streamptr->tsteps[tsID].records; + + nrecs = streamScanInitRecords(streamptr, tsID); + + int fileID = streamptr->fileID; + + fileSetPos(fileID, streamptr->tsteps[tsID].position, SEEK_SET); + + for (int rindex = 0; rindex <= nrecs; rindex++) + { + recpos = fileGetPos(fileID); + if (iegRead(fileID, iegp) != 0) + { + streamptr->ntsteps = streamptr->rtsteps + 1; + break; + } + + size_t recsize = (size_t) (fileGetPos(fileID) - recpos); + + int rcode = IEG_P_Parameter(iegp->ipdb); + int tabnum = IEG_P_CodeTable(iegp->ipdb); + int param = cdiEncodeParam(rcode, tabnum, 255); + int rlevel + = (IEG_P_LevelType(iegp->ipdb) == IEG_LTYPE_HYBRID_LAYER) ? IEG_P_Level1(iegp->ipdb) : IEG_P_Level2(iegp->ipdb); + + if (IEG_P_LevelType(iegp->ipdb) == 100) rlevel *= 100; + + CdiDateTime datetime = iegDateTime(iegp->ipdb); + + // if ( rindex == nrecs ) break; gcc-4.5 internal compiler error + if (rindex == nrecs) continue; + int recID = streamptr->tsteps[tsID].recIDs[rindex]; + + if (rindex == 0) + { + taxis->type = TAXIS_ABSOLUTE; + taxis->vDateTime = datetime; + } + + if (param != records[recID].param || rlevel != records[recID].ilevel) + { + Message("tsID = %d recID = %d param = %3d new %3d level = %3d new %3d", tsID, recID, records[recID].param, param, + records[recID].ilevel, rlevel); + Error("Invalid, unsupported or inconsistent record structure"); + } + + records[recID].position = recpos; + records[recID].size = recsize; + + if (CDI_Debug) Message("%4d%8d%4d%8d %s", rindex, (int) recpos, param, rlevel, CdiDateTime_string(datetime)); + } + + streamptr->rtsteps++; + + if (streamptr->ntsteps != streamptr->rtsteps) + { + tsID = tstepsNewEntry(streamptr); + if (tsID != streamptr->rtsteps) Error("Internal error. tsID = %d", tsID); + + streamptr->tsteps[tsID - 1].next = true; + streamptr->tsteps[tsID].position = recpos; + } + + fileSetPos(fileID, streamptr->tsteps[tsID].position, SEEK_SET); + streamptr->tsteps[tsID].position = recpos; + } + + if (nrecs > 0 && nrecs < streamptr->tsteps[tsID].nrecs) + { + Warning("Incomplete timestep. Stop scanning at timestep %d.", tsID); + streamptr->ntsteps = tsID; + } + + return streamptr->ntsteps; +} + +int +iegInqTimestep(stream_t *streamptr, int tsID) +{ + if (tsID == 0 && streamptr->rtsteps == 0) Error("Call to cdiInqContents missing!"); + + if (CDI_Debug) Message("tsID = %d rtsteps = %d", tsID, streamptr->rtsteps); + + long ntsteps = CDI_UNDEFID; + while ((tsID + 1) > streamptr->rtsteps && ntsteps == CDI_UNDEFID) ntsteps = iegScanTimestep(streamptr); + + int nrecs = 0; + if (!(tsID >= streamptr->ntsteps && streamptr->ntsteps != CDI_UNDEFID)) + { + streamptr->curTsID = tsID; + nrecs = streamptr->tsteps[tsID].nrecs; + } + + return nrecs; +} + +void +iegReadVarSliceDP(stream_t *streamptr, int varID, int levID, double *data, size_t *nmiss) +{ + if (CDI_Debug) Message("streamID = %d varID = %d levID = %d", streamptr->self, varID, levID); + + void *iegp = streamptr->record->objectp; + + int vlistID = streamptr->vlistID; + int fileID = streamptr->fileID; + + double missval = vlistInqVarMissval(vlistID, varID); + size_t gridsize = gridInqSize(vlistInqVarGrid(vlistID, varID)); + int tsid = streamptr->curTsID; + + off_t currentfilepos = fileGetPos(fileID); + + int recID = streamptr->vars[varID].recordTable[0].recordID[levID]; + off_t recpos = streamptr->tsteps[tsid].records[recID].position; + fileSetPos(fileID, recpos, SEEK_SET); + iegRead(fileID, iegp); + iegInqDataDP(iegp, data); + + fileSetPos(fileID, currentfilepos, SEEK_SET); + + *nmiss = get_num_missvalsDP(gridsize, data, missval); +} + +void +iegReadVarDP(stream_t *streamptr, int varID, double *data, size_t *nmiss) +{ + if (CDI_Debug) Message("streamID = %d varID = %d", streamptr->self, varID); + + int vlistID = streamptr->vlistID; + size_t gridsize = gridInqSize(vlistInqVarGrid(vlistID, varID)); + size_t nlevs = (size_t) streamptr->vars[varID].recordTable[0].nlevs; + + for (size_t levID = 0; levID < nlevs; levID++) iegReadVarSliceDP(streamptr, varID, (int) levID, &data[levID * gridsize], nmiss); +} + +void +iegWriteVarSliceDP(stream_t *streamptr, int varID, int levID, const double *data) +{ + if (CDI_Debug) Message("streamID = %d varID = %d levID = %d", streamptr->self, varID, levID); + + iegrec_t *iegp = (iegrec_t *) streamptr->record->objectp; + iegInitMem(iegp); + for (int i = 0; i < 37; i++) iegp->ipdb[i] = -1; + + int vlistID = streamptr->vlistID; + int fileID = streamptr->fileID; + int tsID = streamptr->curTsID; + CdiDateTime vDateTime = streamptr->tsteps[tsID].taxis.vDateTime; + int gridID = vlistInqVarGrid(vlistID, varID); + int zaxisID = vlistInqVarZaxis(vlistID, varID); + + int param = vlistInqVarParam(vlistID, varID); + int pdis, pcat, pnum; + cdiDecodeParam(param, &pnum, &pcat, &pdis); + IEG_P_Parameter(iegp->ipdb) = pnum; + if (pdis == 255) IEG_P_CodeTable(iegp->ipdb) = pcat; + + iegDefTime(iegp->ipdb, vDateTime, vlistInqTaxis(vlistID)); + iegDefGrid(iegp->igdb, gridID); + iegDefLevel(iegp->ipdb, iegp->igdb, iegp->vct, zaxisID, levID); + + iegp->dprec = iegDefDatatype(vlistInqVarDatatype(vlistID, varID)); + + size_t gridsize = gridInqSize(gridID); + iegp->refval = calc_refvalDP(gridsize, data); + + iegDefDataDP(iegp, data); + iegWrite(fileID, iegp); +} + +void +iegWriteVarDP(stream_t *streamptr, int varID, const double *data) +{ + if (CDI_Debug) Message("streamID = %d varID = %d", streamptr->self, varID); + + int vlistID = streamptr->vlistID; + size_t gridsize = gridInqSize(vlistInqVarGrid(vlistID, varID)); + size_t nlevels = (size_t) zaxisInqSize(vlistInqVarZaxis(vlistID, varID)); + + for (size_t levID = 0; levID < nlevels; levID++) iegWriteVarSliceDP(streamptr, varID, (int) levID, &data[levID * gridsize]); +} + +#endif /* HAVE_LIBIEG */ +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifdef HAVE_CONFIG_H +#endif + +#include <limits.h> +#include <stdio.h> +#include <string.h> + + + +void +recordInitEntry(record_t *record) +{ + record->position = CDI_UNDEFID; + record->size = 0; + record->gridsize = 0; + record->param = 0; + record->ilevel = CDI_UNDEFID; + record->used = false; + record->tsteptype = CDI_UNDEFID; + record->varID = CDI_UNDEFID; + record->levelID = CDI_UNDEFID; + memset(record->varname, 0, sizeof(record->varname)); + varScanKeysInit(&record->scanKeys); + memset(&record->tiles, 0, sizeof(record->tiles)); +#ifdef HAVE_LIBFDB5 + record->fdbItem = NULL; +#endif +} + +int +recordNewEntry(stream_t *streamptr, int tsID) +{ + int recordSize = streamptr->tsteps[tsID].recordSize; + record_t *records = streamptr->tsteps[tsID].records; + + // Look for a free slot in record. + int recordID = 0; + if (recordSize) + { + while (recordID < recordSize && records[recordID].used != CDI_UNDEFID) ++recordID; + } + else // Create the table the first time through. + { + recordSize = 1; // <<<<---- + records = (record_t *) Malloc(recordSize * sizeof(record_t)); + for (int i = recordID; i < recordSize; i++) records[i].used = CDI_UNDEFID; + } + + // If the table overflows, double its size. + if (recordID == recordSize) + { + // clang-format off + if (recordSize <= INT_MAX / 2) recordSize *= 2; + else if (recordSize < INT_MAX) recordSize = INT_MAX; + else Error("Cannot handle this many records!\n"); + // clang-format on + records = (record_t *) Realloc(records, recordSize * sizeof(record_t)); + + for (int i = recordID; i < recordSize; i++) records[i].used = CDI_UNDEFID; + } + + recordInitEntry(&records[recordID]); + + records[recordID].used = true; + + streamptr->tsteps[tsID].recordSize = recordSize; + streamptr->tsteps[tsID].records = records; + + return recordID; +} + +static void +cdiInitRecord(stream_t *streamptr) +{ + Record *record = (Record *) Malloc(sizeof(Record)); + streamptr->record = record; + + record->param = 0; + record->ilevel = 0; + record->vdate = 0; + record->vtime = 0; + record->gridID = 0; + record->buffer = NULL; + record->buffersize = 0; + record->position = 0; + record->varID = 0; + record->levelID = CDI_UNDEFID; +} + +void +streamInqRecord(int streamID, int *varID, int *levelID) +{ + check_parg(varID); + check_parg(levelID); + + stream_t *streamptr = stream_to_pointer(streamID); + + cdiDefAccesstype(streamID, TYPE_REC); + + if (!streamptr->record) cdiInitRecord(streamptr); + + const int tsID = streamptr->curTsID; + const int rindex = streamptr->tsteps[tsID].curRecID + 1; + + if (rindex >= streamptr->tsteps[tsID].nrecs) Error("record %d not available at timestep %d", rindex + 1, tsID + 1); + + const int recID = streamptr->tsteps[tsID].recIDs[rindex]; + + if (recID == -1 || recID >= streamptr->tsteps[tsID].nallrecs) Error("Internal problem! tsID = %d recID = %d", tsID, recID); + + *varID = streamptr->tsteps[tsID].records[recID].varID; + if (*varID == -1) Error("Internal problem! varID = %d recID = %d", *varID, recID); + + const int lindex = streamptr->tsteps[tsID].records[recID].levelID; + + const int isub = subtypeInqActiveIndex(streamptr->vars[*varID].subtypeID); + *levelID = streamptr->vars[*varID].recordTable[isub].lindex[lindex]; + + if (CDI_Debug) Message("streamID = %d tsID = %d, recID = %d, varID = %d, levelID = %d", streamID, tsID, recID, *varID, *levelID); + + streamptr->curTsID = tsID; + streamptr->tsteps[tsID].curRecID = rindex; +} + +/* +@Function streamDefRecord +@Title Define the next record + +@Prototype void streamDefRecord(int streamID, int varID, int levelID) +@Parameter + @Item streamID Stream ID, from a previous call to @fref{streamOpenWrite}. + @Item varID Variable identifier. + @Item levelID Level identifier. + +@Description +The function streamDefRecord defines the meta-data of the next record. +@EndFunction +*/ +void +streamDefRecord(int streamID, int varID, int levelID) +{ + stream_t *streamptr = stream_to_pointer(streamID); + + int tsID = streamptr->curTsID; + if (tsID == CDI_UNDEFID) + { + tsID++; + streamDefTimestep(streamID, tsID); + } + + if (!streamptr->record) cdiInitRecord(streamptr); + + const int vlistID = streamptr->vlistID; + const int gridID = vlistInqVarGrid(vlistID, varID); + const int zaxisID = vlistInqVarZaxis(vlistID, varID); + const int param = vlistInqVarParam(vlistID, varID); + const int ilevel = (int) lround(zaxisInqLevel(zaxisID, levelID)); + + Record *record = streamptr->record; + record->varID = varID; + record->levelID = levelID; + record->param = param; + record->ilevel = ilevel; + record->vdate = (int) cdiDate_get(streamptr->tsteps[tsID].taxis.vDateTime.date); + record->vtime = cdiTime_get(streamptr->tsteps[tsID].taxis.vDateTime.time); + record->gridID = gridID; + record->prec = vlistInqVarDatatype(vlistID, varID); + + switch (cdiBaseFiletype(streamptr->filetype)) + { +#ifdef HAVE_LIBGRIB + case CDI_FILETYPE_GRB: + case CDI_FILETYPE_GRB2: grbDefRecord(streamptr); break; +#endif +#ifdef HAVE_LIBSERVICE + case CDI_FILETYPE_SRV: srvDefRecord(streamptr); break; +#endif +#ifdef HAVE_LIBEXTRA + case CDI_FILETYPE_EXT: extDefRecord(streamptr); break; +#endif +#ifdef HAVE_LIBIEG + case CDI_FILETYPE_IEG: iegDefRecord(streamptr); break; +#endif +#ifdef HAVE_LIBNETCDF + case CDI_FILETYPE_NETCDF: + if (streamptr->accessmode == 0) cdfEndDef(streamptr); + cdfDefRecord(streamptr); + break; +#endif + default: Error("%s support not compiled in!", strfiletype(streamptr->filetype)); break; + } +} + +void +streamCopyRecord(int streamID2, int streamID1) +{ + stream_t *streamptr1 = stream_to_pointer(streamID1), *streamptr2 = stream_to_pointer(streamID2); + int filetype1 = streamptr1->filetype, filetype2 = streamptr2->filetype, filetype = CDI_FILETYPE_UNDEF; + + if (cdiBaseFiletype(filetype1) == cdiBaseFiletype(filetype2)) filetype = filetype2; + + if (filetype == CDI_FILETYPE_UNDEF) + Error("Streams have different file types (%s -> %s)!", strfiletype(filetype1), strfiletype(filetype2)); + + switch (cdiBaseFiletype(filetype)) + { +#ifdef HAVE_LIBGRIB + case CDI_FILETYPE_GRB: + case CDI_FILETYPE_GRB2: grbCopyRecord(streamptr2, streamptr1); break; +#endif +#ifdef HAVE_LIBSERVICE + case CDI_FILETYPE_SRV: srvCopyRecord(streamptr2, streamptr1); break; +#endif +#ifdef HAVE_LIBEXTRA + case CDI_FILETYPE_EXT: extCopyRecord(streamptr2, streamptr1); break; +#endif +#ifdef HAVE_LIBIEG + case CDI_FILETYPE_IEG: iegCopyRecord(streamptr2, streamptr1); break; +#endif +#ifdef HAVE_LIBNETCDF + case CDI_FILETYPE_NETCDF: cdfCopyRecord(streamptr2, streamptr1); break; +#endif + default: Error("%s support not compiled in!", strfiletype(filetype)); + } +} + +void +cdi_create_records(stream_t *streamptr, int tsID) +{ + unsigned nrecords, maxrecords; + + tsteps_t *sourceTstep = streamptr->tsteps; + tsteps_t *destTstep = sourceTstep + tsID; + + if (destTstep->records) return; + + const int vlistID = streamptr->vlistID; + + if (tsID == 0) + { + maxrecords = 0; + const int nvars = streamptr->nvars; + for (int varID = 0; varID < nvars; varID++) + for (int isub = 0; isub < streamptr->vars[varID].subtypeSize; isub++) + maxrecords += (unsigned) streamptr->vars[varID].recordTable[isub].nlevs; + } + else + { + maxrecords = (unsigned) sourceTstep->recordSize; + } + + if (tsID == 0) + { + nrecords = maxrecords; + } + else if (tsID == 1) + { + nrecords = 0; + maxrecords = (unsigned) sourceTstep->recordSize; + if (sourceTstep->records) + { + for (size_t recID = 0; recID < maxrecords; recID++) + { + int varID = sourceTstep->records[recID].varID; + nrecords += (varID == CDI_UNDEFID /* varID = CDI_UNDEFID for write mode !!! */ + || vlistInqVarTimetype(vlistID, varID) != TIME_CONSTANT); + // printf("varID nrecords %d %d %d \n", varID, nrecords, vlistInqVarTsteptype(vlistID, varID)); + } + } + else + { + nrecords = maxrecords; + } + } + else + { + nrecords = (unsigned) streamptr->tsteps[1].nallrecs; + } + // printf("tsID, nrecords %d %d\n", tsID, nrecords); + + record_t *records = (maxrecords > 0) ? (record_t *) (Malloc(maxrecords * sizeof(record_t))) : (record_t *) NULL; + + destTstep->records = records; + destTstep->recordSize = (int) maxrecords; + destTstep->nallrecs = (int) nrecords; +#ifdef HAVE_LIBFDB5 + destTstep->records->fdbItem = NULL; +#endif + + if (tsID == 0) + { + for (unsigned recID = 0; recID < maxrecords; recID++) recordInitEntry(&destTstep->records[recID]); + } + else if (sourceTstep->records) + { + memcpy(destTstep->records, sourceTstep->records, (size_t) maxrecords * sizeof(record_t)); + + for (size_t recID = 0; recID < maxrecords; recID++) + { + record_t *curRecord = &sourceTstep->records[recID]; + destTstep->records[recID].used = curRecord->used; + if (curRecord->used != CDI_UNDEFID && curRecord->varID != -1) // curRecord->varID = -1 for write mode !!! + { + if (vlistInqVarTimetype(vlistID, curRecord->varID) != TIME_CONSTANT) + { + destTstep->records[recID].position = CDI_UNDEFID; + destTstep->records[recID].size = 0; + destTstep->records[recID].used = false; + } + } + } + } +} + + +void +streamFCopyRecord(stream_t *streamptr2, stream_t *streamptr1, const char *container_name) +{ + const int fileID1 = streamptr1->fileID; + const int fileID2 = streamptr2->fileID; + + const int tsID = streamptr1->curTsID; + const int vrecID = streamptr1->tsteps[tsID].curRecID; + const int recID = streamptr1->tsteps[tsID].recIDs[vrecID]; + const off_t recpos = streamptr1->tsteps[tsID].records[recID].position; + const size_t recsize = streamptr1->tsteps[tsID].records[recID].size; + + if (fileSetPos(fileID1, recpos, SEEK_SET) != 0) Error("Cannot seek input file for %s record copy!", container_name); + + char *buffer = (char *) Malloc(recsize); + + if (fileRead(fileID1, buffer, recsize) != recsize) Error("Failed to read record from %s file for copying!", container_name); + + if (fileWrite(fileID2, buffer, recsize) != recsize) Error("Failed to write record to %s file when copying!", container_name); + + Free(buffer); +} +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifdef HAVE_CONFIG_H +#endif + + + +#ifdef HAVE_LIBSERVICE + +static int +srvInqDatatype(int prec) +{ + return (prec == EXSE_DOUBLE_PRECISION) ? CDI_DATATYPE_FLT64 : CDI_DATATYPE_FLT32; +} + +static int +srvDefDatatype(int datatype) +{ + if (datatype == CDI_DATATYPE_CPX32 || datatype == CDI_DATATYPE_CPX64) + Error("CDI/SERVICE library does not support complex numbers!"); + + if (datatype != CDI_DATATYPE_FLT32 && datatype != CDI_DATATYPE_FLT64) datatype = CDI_DATATYPE_FLT32; + + return (datatype == CDI_DATATYPE_FLT64) ? EXSE_DOUBLE_PRECISION : EXSE_SINGLE_PRECISION; +} + +/* not used +int srvInqRecord(stream_t *streamptr, int *varID, int *levelID) +{ + int status; + int fileID; + int icode, ilevel; + int zaxisID = -1; + int header[8]; + int vlistID; + void *srvp = streamptr->record->objectp; + + vlistID = streamptr->vlistID; + fileID = streamptr->fileID; + + *varID = -1; + *levelID = -1; + + status = srvRead(fileID, srvp); + if ( status != 0 ) return (0); + + srvInqHeader(srvp, header); + + icode = header[0]; + ilevel = header[1]; + + *varID = vlistInqVarID(vlistID, icode); + + if ( *varID == CDI_UNDEFID ) Error("Code %d undefined", icode); + + zaxisID = vlistInqVarZaxis(vlistID, *varID); + + *levelID = zaxisInqLevelID(zaxisID, (double) ilevel); + + return 1; +} +*/ + +static void +srv_read_recordSP(stream_t *streamptr, float *data, size_t *nmiss) +{ + int vlistID = streamptr->vlistID; + int fileID = streamptr->fileID; + int tsID = streamptr->curTsID; + + int vrecID = streamptr->tsteps[tsID].curRecID; + int recID = streamptr->tsteps[tsID].recIDs[vrecID]; + int varID = streamptr->tsteps[tsID].records[recID].varID; + off_t recpos = streamptr->tsteps[tsID].records[recID].position; + + fileSetPos(fileID, recpos, SEEK_SET); + + void *srvp = streamptr->record->objectp; + if (srvRead(fileID, srvp) < 0) Error("Failed to read record from SRV file"); + + int header[8]; + srvInqHeader(srvp, header); + srvInqDataSP(srvp, data); + + double missval = vlistInqVarMissval(vlistID, varID); + size_t size = gridInqSize(vlistInqVarGrid(vlistID, varID)); + + *nmiss = get_num_missvalsSP(size, data, (float) missval); + + streamptr->numvals += size; +} + +static void +srv_read_recordDP(stream_t *streamptr, double *data, size_t *nmiss) +{ + int vlistID = streamptr->vlistID; + int fileID = streamptr->fileID; + int tsID = streamptr->curTsID; + + int vrecID = streamptr->tsteps[tsID].curRecID; + int recID = streamptr->tsteps[tsID].recIDs[vrecID]; + int varID = streamptr->tsteps[tsID].records[recID].varID; + off_t recpos = streamptr->tsteps[tsID].records[recID].position; + + fileSetPos(fileID, recpos, SEEK_SET); + + void *srvp = streamptr->record->objectp; + if (srvRead(fileID, srvp) < 0) Error("Failed to read record from SRV file"); + + int header[8]; + srvInqHeader(srvp, header); + srvInqDataDP(srvp, data); + + double missval = vlistInqVarMissval(vlistID, varID); + size_t size = gridInqSize(vlistInqVarGrid(vlistID, varID)); + + *nmiss = get_num_missvalsDP(size, data, missval); + + streamptr->numvals += size; +} + +void +srv_read_record(stream_t *streamptr, int memtype, void *data, size_t *nmiss) +{ + if (memtype == MEMTYPE_DOUBLE) + srv_read_recordDP(streamptr, (double *) data, nmiss); + else + srv_read_recordSP(streamptr, (float *) data, nmiss); +} + +void +srvCopyRecord(stream_t *streamptr2, stream_t *streamptr1) +{ + streamFCopyRecord(streamptr2, streamptr1, "SRV"); +} + +void +srvDefRecord(stream_t *streamptr) +{ + Record *record = streamptr->record; + + int pdis, pcat, pnum; + cdiDecodeParam(record->param, &pnum, &pcat, &pdis); + + int header[8]; + header[0] = pnum; + header[1] = record->ilevel; + header[2] = record->vdate; + header[3] = record->vtime; + + int gridID = record->gridID; + size_t xsize = gridInqXsize(gridID), ysize = gridInqYsize(gridID); + if (xsize == 0 || ysize == 0) + { + xsize = gridInqSize(gridID); + ysize = 1; + } + if (gridInqType(gridID) == GRID_UNSTRUCTURED) ysize = 1; + if ((size_t) gridInqSize(gridID) != xsize * ysize) Error("Internal problem with gridsize!"); + + cdi_check_gridsize_int_limit("SERVICE", gridInqSize(gridID)); + + header[4] = (int) xsize; + header[5] = (int) ysize; + header[6] = 0; + header[7] = 0; + + srvrec_t *srvp = (srvrec_t *) record->objectp; + srvp->dprec = srvDefDatatype(record->prec); + + srvDefHeader(srvp, header); +} + +static void +srv_write_recordSP(stream_t *streamptr, const float *data) +{ + void *srvp = streamptr->record->objectp; + srvDefDataSP(srvp, data); + srvWrite(streamptr->fileID, srvp); +} + +static void +srv_write_recordDP(stream_t *streamptr, const double *data) +{ + void *srvp = streamptr->record->objectp; + srvDefDataDP(srvp, data); + srvWrite(streamptr->fileID, srvp); +} + +void +srv_write_record(stream_t *streamptr, int memtype, const void *data) +{ + if (memtype == MEMTYPE_DOUBLE) + srv_write_recordDP(streamptr, (const double *) data); + else + srv_write_recordSP(streamptr, (const float *) data); +} + +static void +srv_add_record(stream_t *streamptr, int param, int level, size_t xsize, size_t ysize, size_t recsize, off_t position, int prec) +{ + int vlistID = streamptr->vlistID; + int tsID = streamptr->curTsID; + int recID = recordNewEntry(streamptr, tsID); + record_t *record = &streamptr->tsteps[tsID].records[recID]; + + record->size = recsize; + record->position = position; + record->param = param; + record->ilevel = level; + + grid_t *grid = (grid_t *) Malloc(sizeof(*grid)); + grid_init(grid); + cdiGridTypeInit(grid, GRID_GENERIC, xsize * ysize); + grid->x.size = xsize; + grid->y.size = ysize; + struct addIfNewRes gridAdded = cdiVlistAddGridIfNew(vlistID, grid, 0); + int gridID = gridAdded.Id; + if (!gridAdded.isNew) + { + grid_free(grid); + Free(grid); + } + + int leveltype = ZAXIS_GENERIC; + int datatype = srvInqDatatype(prec); + + int varID, levelID = 0; + varAddRecord(recID, param, gridID, leveltype, 0, level, 0, 0, 0, datatype, &varID, &levelID, TSTEP_INSTANT, 0, -1, NULL, NULL, + NULL, NULL); + + xassert(varID <= SHRT_MAX && levelID <= SHRT_MAX); + record->varID = (short) varID; + record->levelID = levelID; + + streamptr->tsteps[tsID].nallrecs++; + streamptr->nrecs++; + + if (CDI_Debug) Message("varID = %d gridID = %d levelID = %d", varID, gridID, levelID); +} + +static void +srvScanTimestep1(stream_t *streamptr) +{ + CdiDateTime datetime0; + cdiDateTime_init(&datetime0); + off_t recpos; + srvrec_t *srvp = (srvrec_t *) streamptr->record->objectp; + + streamptr->curTsID = 0; + + int tsID = tstepsNewEntry(streamptr); + if (tsID != 0) Error("Internal problem! tstepsNewEntry returns %d", tsID); + taxis_t *taxis = &streamptr->tsteps[tsID].taxis; + + int fileID = streamptr->fileID; + + int nrecs = 0; + while (true) + { + recpos = fileGetPos(fileID); + if (srvRead(fileID, srvp) != 0) + { + streamptr->ntsteps = 1; + break; + } + + size_t recsize = (size_t) (fileGetPos(fileID) - recpos); + + int header[8]; + srvInqHeader(srvp, header); + + int prec = srvp->dprec; + int rcode = header[0]; + int rlevel = header[1]; + int vdate = header[2]; + int vtime = header[3]; + int rxsize = header[4]; + int rysize = header[5]; + int param = cdiEncodeParam(rcode, 255, 255); + CdiDateTime datetime = cdiDateTime_set(vdate, vtime); + + if (nrecs == 0) + { + datetime0 = datetime; + taxis->vDateTime = datetime; + } + else + { + record_t *records = streamptr->tsteps[tsID].records; + for (int recID = 0; recID < nrecs; recID++) + if (param == records[recID].param && rlevel == records[recID].ilevel) goto tstepScanLoopFinished; + + if (cdiDateTime_isNE(datetime, datetime0)) Warning("Inconsistent verification time for code %d level %d", rcode, rlevel); + } + + nrecs++; + + if (CDI_Debug) Message("%4d%8d%4d%8d%8d%6d", nrecs, (int) recpos, rcode, rlevel, vdate, vtime); + + srv_add_record(streamptr, param, rlevel, rxsize, rysize, recsize, recpos, prec); + } + +tstepScanLoopFinished: + streamptr->rtsteps = 1; + + cdi_generate_vars(streamptr); + + int taxisID = taxisCreate(TAXIS_ABSOLUTE); + taxis->type = TAXIS_ABSOLUTE; + taxis->rDateTime = taxis->vDateTime; + + int vlistID = streamptr->vlistID; + vlistDefTaxis(vlistID, taxisID); + + vlist_check_contents(vlistID); + + streamScanResizeRecords1(streamptr); + + streamScanTsFixNtsteps(streamptr, recpos); + streamScanTimeConstAdjust(streamptr, taxis); +} + +static int +srvScanTimestep2(stream_t *streamptr) +{ + int header[8]; + off_t recpos = 0; + void *srvp = streamptr->record->objectp; + + streamptr->curTsID = 1; + + int vlistID = streamptr->vlistID; + int fileID = streamptr->fileID; + + int tsID = streamptr->rtsteps; + if (tsID != 1) Error("Internal problem! unexpected timestep %d", tsID + 1); + + taxis_t *taxis = &streamptr->tsteps[tsID].taxis; + + fileSetPos(fileID, streamptr->tsteps[tsID].position, SEEK_SET); + + cdi_create_records(streamptr, tsID); + record_t *records = streamptr->tsteps[tsID].records; + + int nrecords = streamScanInitRecords2(streamptr); + + for (int rindex = 0; rindex <= nrecords; rindex++) + { + recpos = fileGetPos(fileID); + if (srvRead(fileID, srvp) != 0) + { + streamptr->ntsteps = 2; + break; + } + + size_t recsize = (size_t) (fileGetPos(fileID) - recpos); + + srvInqHeader(srvp, header); + + int rcode = header[0]; + int rlevel = header[1]; + int vdate = header[2]; + int vtime = header[3]; + int param = cdiEncodeParam(rcode, 255, 255); + + if (rindex == 0) + { + taxis->type = TAXIS_ABSOLUTE; + taxis->vDateTime = cdiDateTime_set(vdate, vtime); + } + + bool nextstep = false; + int recID; + for (recID = 0; recID < nrecords; recID++) + { + if (param == records[recID].param && rlevel == records[recID].ilevel) + { + if (records[recID].used) + { + nextstep = true; + } + else + { + records[recID].used = true; + streamptr->tsteps[tsID].recIDs[rindex] = recID; + } + break; + } + } + if (recID == nrecords) + { + Warning("Code %d level %d not found at timestep %d", rcode, rlevel, tsID + 1); + return CDI_EUFSTRUCT; + } + + if (nextstep) break; + + if (CDI_Debug) Message("%4d%8d%4d%8d%8d%6d", rindex + 1, (int) recpos, rcode, rlevel, vdate, vtime); + + if (param != records[recID].param || rlevel != records[recID].ilevel) + { + Message("tsID = %d recID = %d param = %3d new %3d level = %3d new %3d", tsID, recID, records[recID].param, param, + records[recID].ilevel, rlevel); + return CDI_EUFSTRUCT; + } + + records[recID].position = recpos; + records[recID].size = recsize; + } + + int nrecs = 0; + for (int recID = 0; recID < nrecords; recID++) + { + if (records[recID].used) + nrecs++; + else + vlistDefVarTimetype(vlistID, records[recID].varID, TIME_CONSTANT); + } + streamptr->tsteps[tsID].nrecs = nrecs; + + streamptr->rtsteps = 2; + + streamScanTsFixNtsteps(streamptr, recpos); + + return 0; +} + +int +srvInqContents(stream_t *streamptr) +{ + streamptr->curTsID = 0; + + srvScanTimestep1(streamptr); + + int status = (streamptr->ntsteps == -1) ? srvScanTimestep2(streamptr) : 0; + + fileSetPos(streamptr->fileID, 0, SEEK_SET); + + return status; +} + +static long +srvScanTimestep(stream_t *streamptr) +{ + int header[8]; + off_t recpos = 0; + int nrecs = 0; + void *srvp = streamptr->record->objectp; + + int tsID = streamptr->rtsteps; + taxis_t *taxis = &streamptr->tsteps[tsID].taxis; + + if (streamptr->tsteps[tsID].recordSize == 0) + { + cdi_create_records(streamptr, tsID); + record_t *records = streamptr->tsteps[tsID].records; + + nrecs = streamScanInitRecords(streamptr, tsID); + + int fileID = streamptr->fileID; + + fileSetPos(fileID, streamptr->tsteps[tsID].position, SEEK_SET); + + for (int rindex = 0; rindex <= nrecs; rindex++) + { + recpos = fileGetPos(fileID); + if (srvRead(fileID, srvp) != 0) + { + streamptr->ntsteps = streamptr->rtsteps + 1; + break; + } + + size_t recsize = (size_t) (fileGetPos(fileID) - recpos); + + srvInqHeader(srvp, header); + + int rcode = header[0]; + int rlevel = header[1]; + int vdate = header[2]; + int vtime = header[3]; + int param = cdiEncodeParam(rcode, 255, 255); + + // if ( rindex == nrecs ) break; gcc-4.5 internal compiler error + if (rindex == nrecs) continue; + int recID = streamptr->tsteps[tsID].recIDs[rindex]; + + if (rindex == 0) + { + taxis->type = TAXIS_ABSOLUTE; + taxis->vDateTime = cdiDateTime_set(vdate, vtime); + } + + if (param != records[recID].param || rlevel != records[recID].ilevel) + { + Message("tsID = %d recID = %d param = %3d new %3d level = %3d new %3d", tsID, recID, records[recID].param, param, + records[recID].ilevel, rlevel); + Error("Invalid, unsupported or inconsistent record structure!"); + } + + records[recID].position = recpos; + records[recID].size = recsize; + + if (CDI_Debug) Message("%4d%8d%4d%8d%8d%6d", rindex, (int) recpos, rcode, rlevel, vdate, vtime); + } + + streamptr->rtsteps++; + + if (streamptr->ntsteps != streamptr->rtsteps) + { + tsID = tstepsNewEntry(streamptr); + if (tsID != streamptr->rtsteps) Error("Internal error. tsID = %d", tsID); + + streamptr->tsteps[tsID - 1].next = true; + streamptr->tsteps[tsID].position = recpos; + } + + fileSetPos(fileID, streamptr->tsteps[tsID].position, SEEK_SET); + streamptr->tsteps[tsID].position = recpos; + } + + if (nrecs > 0 && nrecs < streamptr->tsteps[tsID].nrecs) + { + Warning("Incomplete timestep. Stop scanning at timestep %d.", tsID); + streamptr->ntsteps = tsID; + } + + return streamptr->ntsteps; +} + +int +srvInqTimestep(stream_t *streamptr, int tsID) +{ + if (tsID == 0 && streamptr->rtsteps == 0) Error("Call to cdiInqContents missing!"); + + if (CDI_Debug) Message("tsID = %d rtsteps = %d", tsID, streamptr->rtsteps); + + long ntsteps = CDI_UNDEFID; + while ((tsID + 1) > streamptr->rtsteps && ntsteps == CDI_UNDEFID) ntsteps = srvScanTimestep(streamptr); + + int nrecs = 0; + if (!(tsID >= streamptr->ntsteps && streamptr->ntsteps != CDI_UNDEFID)) + { + streamptr->curTsID = tsID; + nrecs = streamptr->tsteps[tsID].nrecs; + } + + return nrecs; +} + +void +srvReadVarSliceDP(stream_t *streamptr, int varID, int levID, double *data, size_t *nmiss) +{ + if (CDI_Debug) Message("streamID = %d varID = %d levID = %d", streamptr->self, varID, levID); + + int vlistID = streamptr->vlistID; + int fileID = streamptr->fileID; + int tsid = streamptr->curTsID; + + off_t currentfilepos = fileGetPos(fileID); + + int recID = streamptr->vars[varID].recordTable[0].recordID[levID]; + off_t recpos = streamptr->tsteps[tsid].records[recID].position; + + fileSetPos(fileID, recpos, SEEK_SET); + + void *srvp = streamptr->record->objectp; + if (srvRead(fileID, srvp) < 0) abort(); + + int header[8]; + srvInqHeader(srvp, header); + srvInqDataDP(srvp, data); + + fileSetPos(fileID, currentfilepos, SEEK_SET); + + double missval = vlistInqVarMissval(vlistID, varID); + size_t size = gridInqSize(vlistInqVarGrid(vlistID, varID)); + + *nmiss = get_num_missvalsDP(size, data, missval); +} + +void +srvReadVarDP(stream_t *streamptr, int varID, double *data, size_t *nmiss) +{ + if (CDI_Debug) Message("streamID = %d varID = %d", streamptr->self, varID); + + int vlistID = streamptr->vlistID; + size_t gridsize = gridInqSize(vlistInqVarGrid(vlistID, varID)); + size_t nlevs = (size_t) streamptr->vars[varID].recordTable[0].nlevs; + + for (size_t levID = 0; levID < nlevs; levID++) srvReadVarSliceDP(streamptr, varID, (int) levID, &data[levID * gridsize], nmiss); +} + +void +srvWriteVarSliceDP(stream_t *streamptr, int varID, int levID, const double *data) +{ + if (CDI_Debug) Message("streamID = %d varID = %d levID = %d", streamptr->self, varID, levID); + + int vlistID = streamptr->vlistID; + int fileID = streamptr->fileID; + int tsID = streamptr->curTsID; + CdiDateTime vDateTime = streamptr->tsteps[tsID].taxis.vDateTime; + int gridID = vlistInqVarGrid(vlistID, varID); + + int pdis, pcat, pnum; + cdiDecodeParam(vlistInqVarParam(vlistID, varID), &pnum, &pcat, &pdis); + + int header[8]; + header[0] = pnum; + header[1] = (int) lround(zaxisInqLevel(vlistInqVarZaxis(vlistID, varID), levID)); + header[2] = (int) cdiDate_get(vDateTime.date); + header[3] = cdiTime_get(vDateTime.time); + + size_t xsize = gridInqXsize(gridID); + size_t ysize = gridInqYsize(gridID); + if (xsize == 0 || ysize == 0) + { + xsize = gridInqSize(gridID); + ysize = 1; + } + if (gridInqType(gridID) == GRID_UNSTRUCTURED) ysize = 1; + if ((size_t) gridInqSize(gridID) != xsize * ysize) Error("Internal problem with gridsize!"); + + cdi_check_gridsize_int_limit("SERVICE", gridInqSize(gridID)); + + header[4] = xsize; + header[5] = ysize; + header[6] = 0; + header[7] = 0; + + int datatype = vlistInqVarDatatype(vlistID, varID); + + srvrec_t *srvp = (srvrec_t *) streamptr->record->objectp; + srvp->dprec = srvDefDatatype(datatype); + + srvDefHeader(srvp, header); + srvDefDataDP(srvp, data); + srvWrite(fileID, srvp); +} + +void +srvWriteVarDP(stream_t *streamptr, int varID, const double *data) +{ + if (CDI_Debug) Message("streamID = %d varID = %d", streamptr->self, varID); + + int vlistID = streamptr->vlistID; + size_t gridsize = gridInqSize(vlistInqVarGrid(vlistID, varID)); + size_t nlevs = (size_t) zaxisInqSize(vlistInqVarZaxis(vlistID, varID)); + + for (size_t levID = 0; levID < nlevs; levID++) srvWriteVarSliceDP(streamptr, varID, (int) levID, &data[levID * gridsize]); +} + +#endif /* HAVE_LIBSERVICE */ + +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ + + +static void +streamvar_init_recordtable(stream_t *streamptr, int varID, int isub) +{ + streamptr->vars[varID].recordTable[isub].nlevs = 0; + streamptr->vars[varID].recordTable[isub].recordID = NULL; + streamptr->vars[varID].recordTable[isub].lindex = NULL; +} + +static void +streamvar_init_entry(stream_t *streamptr, int varID) +{ + streamptr->vars[varID].ncvarid = CDI_UNDEFID; + streamptr->vars[varID].defmiss = false; + + streamptr->vars[varID].subtypeSize = 0; + streamptr->vars[varID].recordTable = NULL; + + streamptr->vars[varID].gridID = CDI_UNDEFID; + streamptr->vars[varID].zaxisID = CDI_UNDEFID; + streamptr->vars[varID].tsteptype = CDI_UNDEFID; + streamptr->vars[varID].subtypeID = CDI_UNDEFID; +} + +static int +streamvar_new_entry(stream_t *streamptr) +{ + int varID = 0; + int streamvarSize = streamptr->varsAllocated; + svarinfo_t *streamvar = streamptr->vars; + /* + Look for a free slot in streamvar. + (Create the table the first time through). + */ + if (!streamvarSize) + { + streamvarSize = 2; + streamvar = (svarinfo_t *) Malloc((size_t) streamvarSize * sizeof(svarinfo_t)); + if (streamvar == NULL) + { + Message("streamvarSize = %d", streamvarSize); + SysError("Allocation of svarinfo_t failed"); + } + + for (int i = 0; i < streamvarSize; i++) streamvar[i].isUsed = false; + } + else + { + while (varID < streamvarSize) + { + if (!streamvar[varID].isUsed) break; + varID++; + } + } + /* + If the table overflows, double its size. + */ + if (varID == streamvarSize) + { + streamvarSize = 2 * streamvarSize; + streamvar = (svarinfo_t *) Realloc(streamvar, (size_t) streamvarSize * sizeof(svarinfo_t)); + if (streamvar == NULL) + { + Message("streamvarSize = %d", streamvarSize); + SysError("Reallocation of svarinfo_t failed"); + } + varID = streamvarSize / 2; + + for (int i = varID; i < streamvarSize; i++) streamvar[i].isUsed = false; + } + + streamptr->varsAllocated = streamvarSize; + streamptr->vars = streamvar; + + streamvar_init_entry(streamptr, varID); + + streamptr->vars[varID].isUsed = true; + + return varID; +} + +static void +allocate_record_table_entry(stream_t *streamptr, int varID, int subID, int nlevs) +{ + int *level = (int *) Malloc((size_t) nlevs * sizeof(int)); + int *lindex = (int *) Malloc((size_t) nlevs * sizeof(int)); + + for (int levID = 0; levID < nlevs; levID++) + { + level[levID] = CDI_UNDEFID; + lindex[levID] = levID; + } + + streamptr->vars[varID].recordTable[subID].nlevs = nlevs; + streamptr->vars[varID].recordTable[subID].recordID = level; + streamptr->vars[varID].recordTable[subID].lindex = lindex; +} + +int +stream_new_var(stream_t *streamptr, int gridID, int zaxisID, int tilesetID) +{ + if (CDI_Debug) Message("gridID = %d zaxisID = %d", gridID, zaxisID); + + int varID = streamvar_new_entry(streamptr); + int nlevs = zaxisInqSize(zaxisID); + + streamptr->nvars++; + + streamptr->vars[varID].gridID = gridID; + streamptr->vars[varID].zaxisID = zaxisID; + + int nsub = 1; + if (tilesetID != CDI_UNDEFID) nsub = subtypeInqSize(tilesetID); /* e.g. no of tiles */ + if (CDI_Debug) Message("varID %d: create %d tiles with %d level(s), zaxisID=%d", varID, nsub, nlevs, zaxisID); + streamptr->vars[varID].recordTable = (sleveltable_t *) Malloc((size_t) nsub * sizeof(sleveltable_t)); + if (streamptr->vars[varID].recordTable == NULL) SysError("Allocation of leveltable failed!"); + streamptr->vars[varID].subtypeSize = nsub; + + for (int isub = 0; isub < nsub; isub++) + { + streamvar_init_recordtable(streamptr, varID, isub); + allocate_record_table_entry(streamptr, varID, isub, nlevs); + if (CDI_Debug) + Message("streamptr->vars[varID].recordTable[isub].recordID[0]=%d", streamptr->vars[varID].recordTable[isub].recordID[0]); + } + + streamptr->vars[varID].subtypeID = tilesetID; + + return varID; +} +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifdef HAVE_CONFIG_H +#endif + +#ifdef HAVE_LIBGRIB + +#ifdef HAVE_LIBFDB5 +#endif + +#ifdef HAVE_ACROSS +#endif + + +static size_t +grbEncode(int filetype, int memtype, int varID, int levelID, int vlistID, int gridID, int zaxisID, CdiDateTime vDateTime, + int tsteptype, int numavg, size_t datasize, const void *data, size_t nmiss, void **gribbuffer, int comptype, + void *gribContainers) +{ + size_t nbytes = 0; + +#ifdef HAVE_LIBCGRIBEX + if (filetype == CDI_FILETYPE_GRB && !CDI_gribapi_grib1) + { + size_t gribbuffersize = datasize * 4 + 3000; + *gribbuffer = Malloc(gribbuffersize); + + nbytes = cgribexEncode(memtype, varID, levelID, vlistID, gridID, zaxisID, vDateTime, tsteptype, numavg, datasize, data, nmiss, + *gribbuffer, gribbuffersize); + } + else +#endif +#ifdef HAVE_LIBGRIB_API + { +#ifdef GRIBCONTAINER2D + void *gribContainer = (void *) &((gribContainer_t **) gribContainers)[varID][levelID]; +#else + void *gribContainer = (void *) &((gribContainer_t *) gribContainers)[varID]; +#endif + const void *datap = data; + if (memtype == MEMTYPE_FLOAT) + { + const float *dataf = (const float *) data; + double *datad = (double *) Malloc(datasize * sizeof(double)); + for (size_t i = 0; i < datasize; ++i) datad[i] = (double) dataf[i]; + datap = (const void *) datad; + } + + size_t gribbuffersize; + nbytes = gribapiEncode(varID, levelID, vlistID, gridID, zaxisID, vDateTime, tsteptype, numavg, (long) datasize, datap, nmiss, + gribbuffer, &gribbuffersize, comptype, gribContainer); + + if (memtype == MEMTYPE_FLOAT) Free((void *) datap); + } +#else + { + Error("ecCodes support not compiled in!"); + (void) gribContainers; + (void) comptype; + } +#endif + + return nbytes; +} + +static size_t +grbSzip(int filetype, void *gribbuffer, size_t gribbuffersize) +{ + size_t buffersize = gribbuffersize + 1000; /* compressed record can be greater than source record */ + void *buffer = Malloc(buffersize); + + // memcpy(buffer, gribbuffer, gribbuffersize); + + size_t nbytes = 0; + if (filetype == CDI_FILETYPE_GRB) + { + nbytes = (size_t) gribZip((unsigned char *) gribbuffer, (long) gribbuffersize, (unsigned char *) buffer, (long) buffersize); + } + else + { + static int lszip_warn = 1; + if (lszip_warn) Warning("Szip compression of GRIB2 records not implemented!"); + lszip_warn = 0; + nbytes = gribbuffersize; + } + + Free(buffer); + + return nbytes; +} + +typedef struct +{ + char date[16]; + char time[8]; + char param[8]; + char levtype[8]; + char levelist[8]; +} FDB_Keys; + +void +cdi_fdb_store(void *fdbHandle, const char *filename, void *gribbuffer, size_t nbytes, const FDB_Keys *fdbKeys) +{ +#ifdef HAVE_LIBFDB5 + size_t len = strlen(filename); + if (len == 4) Error("FDB keys missing!"); + + KeyValueEntry keyValue; + keyValue.item = NULL; + decode_fdbitem(filename + 4, &keyValue); + + if (keyValue.numKeys == 0) Error("FDB keys missing!"); + + const char *class = NULL; + const char *stream = NULL; + const char *expver = NULL; + for (int i = 0; i < keyValue.numKeys; i++) + { + // clang-format off + if (str_is_equal(keyValue.keys[i], "class")) class = keyValue.values[i]; + else if (str_is_equal(keyValue.keys[i], "stream")) stream = keyValue.values[i]; + else if (str_is_equal(keyValue.keys[i], "expver")) expver = keyValue.values[i]; + else Error("Unsupported FDB parameter: %s=%s", keyValue.keys[i], keyValue.values[i]); + // clang-format on + } + + if (!class) Error("FDB parameter <class> undefined!"); + if (!stream) Error("FDB parameter <stream> undefined!"); + if (!expver) Error("FDB parameter <expver> undefined!"); + + if (CDI_Debug) + { + printf("{class=%s,expver=%s,stream=%s,date=%s,time=%s,domain=g}", class, expver, stream, fdbKeys->date, fdbKeys->time); + printf("{type=an,levtype=%s}{step=0,", fdbKeys->levtype); + if (fdbKeys->levelist[0]) printf("levelist=%s,", fdbKeys->levelist); + printf("param=%s},length=%zu\n", fdbKeys->param, nbytes); + } + + fdb_key_t *key; + fdb_new_key(&key); + fdb_key_add(key, "class", class); + fdb_key_add(key, "expver", expver); + fdb_key_add(key, "stream", stream); + fdb_key_add(key, "domain", "g"); + fdb_key_add(key, "date", fdbKeys->date); + fdb_key_add(key, "time", fdbKeys->time); + fdb_key_add(key, "type", "an"); + fdb_key_add(key, "levtype", fdbKeys->levtype); + fdb_key_add(key, "step", "0"); + fdb_key_add(key, "param", fdbKeys->param); + if (fdbKeys->levelist[0]) fdb_key_add(key, "levelist", fdbKeys->levelist); + + fdb_archive(fdbHandle, key, gribbuffer, nbytes); + // alternative: write to tmpfile and use C++ code from fdb_write + + fdb_delete_key(key); +#endif +} + +static int +map_grib2_param(int pnum, int pcat, int pdis) +{ + // clang-format off + if (pnum == 8 && pcat == 2 && pdis == 0) return 135; + else if (pnum == 0 && pcat == 0 && pdis == 0) return 130; + else if (pnum == 0 && pcat == 1 && pdis == 0) return 133; + else if (pnum == 83 && pcat == 1 && pdis == 0) return 246; + else if (pnum == 84 && pcat == 1 && pdis == 0) return 247; + else if (pnum == 85 && pcat == 1 && pdis == 0) return 75; + else if (pnum == 86 && pcat == 1 && pdis == 0) return 76; + else if (pnum == 2 && pcat == 2 && pdis == 0) return 131; + else if (pnum == 3 && pcat == 2 && pdis == 0) return 132; + else if (pnum == 25 && pcat == 3 && pdis == 0) return 152; + else if (pnum == 4 && pcat == 3 && pdis == 0) return 129; + // clang-format on + + return -1; +} + +static int +get_fdb_param(int cdiParam) +{ + int pnum, pcat, pdis; + cdiDecodeParam(cdiParam, &pnum, &pcat, &pdis); + if (pnum < 0) pnum = -pnum; + if (pnum > 255) pnum = pnum % 256; + + int fdbParam = (pdis == 255) ? pnum : map_grib2_param(pnum, pcat, pdis); + + return fdbParam; +} + +static void +fillup_gribbuffer(size_t nbytes, unsigned char *gribbuffer) +{ + while (nbytes & 7) gribbuffer[nbytes++] = 0; +} + +void +grbCopyRecord(stream_t *streamptr2, stream_t *streamptr1) +{ + int filetype = streamptr1->filetype; + int fileID1 = streamptr1->fileID; + int fileID2 = streamptr2->fileID; + int tsID = streamptr1->curTsID; + int vrecID = streamptr1->tsteps[tsID].curRecID; + int recID = streamptr1->tsteps[tsID].recIDs[vrecID]; + const record_t *record = &streamptr1->tsteps[tsID].records[recID]; + off_t recpos = record->position; + size_t recsize = record->size; + + void *gribbuffer = NULL; + + if (streamptr1->protocol == CDI_PROTOCOL_FDB) + { +#ifdef HAVE_LIBFDB5 + void *fdbItem = streamptr1->tsteps[tsID].records[recID].fdbItem; + if (!fdbItem) Error("fdbItem not available!"); + + size_t buffersize = 0; + recsize = fdb_read_record(streamptr1->protocolData, fdbItem, &buffersize, &gribbuffer); + + // round up recsize to next multiple of 8 + size_t gribbuffersize = ((recsize + 7U) & ~7U); + + gribbuffer = (unsigned char *) Realloc(gribbuffer, gribbuffersize); +#endif + } + else + { + fileSetPos(fileID1, recpos, SEEK_SET); + + // round up recsize to next multiple of 8 + size_t gribbuffersize = ((recsize + 7U) & ~7U); + + gribbuffer = (unsigned char *) Malloc(gribbuffersize); + + if (fileRead(fileID1, gribbuffer, recsize) != recsize) Error("Could not read GRIB record for copying!"); + } + + size_t nbytes = recsize; + +#ifdef HAVE_LIBCGRIBEX + if (filetype == CDI_FILETYPE_GRB && !CDI_gribapi_grib1) + { + if (cdiGribChangeParameterID.active) + { + // Even if you are stream-copy records you might need to change a bit of grib-header ! + void *gh = cgribex_handle_new_from_meassage((void *) gribbuffer, recsize); + cgribexChangeParameterIdentification(gh, cdiGribChangeParameterID.code, cdiGribChangeParameterID.ltype, + cdiGribChangeParameterID.lev); + cgribex_handle_delete(gh); + cdiGribChangeParameterID.active = false; // after grib attributes have been changed turn it off again + } + } + else +#endif +#ifdef HAVE_LIBGRIB_API + { + if (cdiGribChangeParameterID.active) + { + // Even if you are stream-copy records you might need to change a bit of grib-header ! + grib_handle *gh = grib_handle_new_from_message(NULL, (void *) gribbuffer, recsize); + gribapiChangeParameterIdentification(gh, cdiGribChangeParameterID.code, cdiGribChangeParameterID.ltype, + cdiGribChangeParameterID.lev); + grib_handle_delete(gh); + cdiGribChangeParameterID.active = false; // after grib attributes have been changed turn it off again + } + } +#else + { + Error("ecCodes support not compiled in!"); + } +#endif + +#ifdef HAVE_LIBGRIB_API +#ifdef HIRLAM_EXTENSIONS + // Even if you are stream-copy records you might need to change a bit of grib-header ! + + if (cdiGribDataScanningMode.active) + // allowed modes: <0, 64, 96>; Default is 64 + // This will overrule the old scanning mode of the given grid + { + grib_handle *gh = grib_handle_new_from_message(NULL, (void *) gribbuffer, recsize); + + int scanModeIN = gribapiGetScanningMode(gh); + + grib_handle_delete(gh); + + if (cdiDebugExt >= 20) + Message("Change GribDataScanningMode => %d (scanModeIN = %d)", cdiGribDataScanningMode.value, scanModeIN); + + if (scanModeIN != cdiGribDataScanningMode.value) + { + size_t nmiss = 0; + + int vlistID = streamptr1->vlistID; + int varID = record->varID; + int levelID = record->levelID; + int gridID = vlistInqVarGrid(vlistID, varID); + + size_t gridsize = gridInqSize(gridID); + if (vlistNumber(vlistID) != CDI_REAL) gridsize *= 2; + double *data = (double *) Malloc(gridsize * sizeof(double)); + + if (cdiDebugExt >= 20) Message(" processing varID %d; levelID %d", varID, levelID); + + grb_write_var_slice(streamptr2, varID, levelID, MEMTYPE_DOUBLE, (const void *) data, nmiss); + + free(data); + } + } +#endif // HIRLAM_EXTENSIONS +#endif + + if (filetype == CDI_FILETYPE_GRB) + { + size_t unzipsize; + int izip = gribGetZip(recsize, (unsigned char *) gribbuffer, &unzipsize); + + if (izip == 0 && (streamptr2->comptype == CDI_COMPRESS_SZIP || streamptr2->comptype == CDI_COMPRESS_AEC)) + nbytes = grbSzip(filetype, gribbuffer, nbytes); + } + + fillup_gribbuffer(nbytes, (unsigned char *) gribbuffer); + + if (streamptr2->protocol == CDI_PROTOCOL_FDB) + { + int vlistID = streamptr1->vlistID; + int varID = record->varID; + int zaxisID = vlistInqVarZaxis(vlistID, varID); + int zaxisType = zaxisInqType(zaxisID); + CdiDateTime vDateTime = streamptr1->tsteps[tsID].taxis.vDateTime; + + FDB_Keys fdbKeys; + snprintf(fdbKeys.date, sizeof(fdbKeys.date), "%d", (int) cdiDate_get(vDateTime.date)); + snprintf(fdbKeys.time, sizeof(fdbKeys.time), "%04d", (short) (cdiTime_get(vDateTime.time) / 100)); + snprintf(fdbKeys.param, sizeof(fdbKeys.param), "%d", get_fdb_param(record->param)); + bool isML = (zaxisType == ZAXIS_HYBRID || zaxisType == ZAXIS_HYBRID_HALF); + snprintf(fdbKeys.levtype, sizeof(fdbKeys.levtype), "%s", isML ? "ml" : "sfc"); + fdbKeys.levelist[0] = 0; + if (isML) snprintf(fdbKeys.levelist, sizeof(fdbKeys.levelist), "%d", isML ? record->ilevel : 0); + +#ifdef HAVE_LIBFDB5 + cdi_fdb_store(streamptr2->protocolData, streamptr2->filename, gribbuffer, nbytes, &fdbKeys); +#endif + } + else + { + size_t nwrite = fileWrite(fileID2, gribbuffer, nbytes); + if (nwrite != nbytes) SysError("Could not write record for copying!"); + } + + Free(gribbuffer); +} + +void +grb_write_var_slice(stream_t *streamptr, int varID, int levelID, int memtype, const void *data, size_t nmiss) +{ + int filetype = streamptr->filetype; + int fileID = streamptr->fileID; + int vlistID = streamptr->vlistID; + int gridID = vlistInqVarGrid(vlistID, varID); + int zaxisID = vlistInqVarZaxis(vlistID, varID); + int tsteptype = vlistInqVarTsteptype(vlistID, varID); + int tsID = streamptr->curTsID; + CdiDateTime vDateTime = streamptr->tsteps[tsID].taxis.vDateTime; + int numavg = (tsteptype == TSTEP_AVG) ? streamptr->tsteps[tsID].taxis.numavg : 0; + int comptype = streamptr->comptype; + + if (CDI_Debug) Message("gridID = %d zaxisID = %d", gridID, zaxisID); + + size_t datasize = gridInqSize(gridID); + + if (comptype != CDI_COMPRESS_JPEG && comptype != CDI_COMPRESS_SZIP && comptype != CDI_COMPRESS_AEC) comptype = CDI_COMPRESS_NONE; + + if (filetype == CDI_FILETYPE_GRB && !CDI_gribapi_grib1 && comptype == CDI_COMPRESS_JPEG) + { + static bool ljpeg_warn = true; + if (ljpeg_warn) Warning("JPEG compression of GRIB1 records not available!"); + ljpeg_warn = false; + } + + void *gribbuffer = NULL; + size_t nbytes = grbEncode(filetype, memtype, varID, levelID, vlistID, gridID, zaxisID, vDateTime, tsteptype, numavg, datasize, + data, nmiss, &gribbuffer, comptype, streamptr->gribContainers); + + if (filetype == CDI_FILETYPE_GRB && (comptype == CDI_COMPRESS_SZIP || comptype == CDI_COMPRESS_AEC)) + nbytes = grbSzip(filetype, gribbuffer, nbytes); + + switch (streamptr->protocol) + { + case CDI_PROTOCOL_ACROSS: + { +#ifdef HAVE_ACROSS + if (across_write_grib_message(streamptr, gribbuffer, nbytes)) SysError("Failed to write GRIB slice!"); +#endif + } + break; + + case CDI_PROTOCOL_FDB: + { +#ifdef HAVE_LIBFDB5 + int zaxisType = zaxisInqType(zaxisID); + double level = zaxisInqLevel(zaxisID, levelID); + + FDB_Keys fdbKeys; + snprintf(fdbKeys.date, sizeof(fdbKeys.date), "%d", (int) cdiDate_get(vDateTime.date)); + snprintf(fdbKeys.time, sizeof(fdbKeys.time), "%04d", (short) (cdiTime_get(vDateTime.time) / 100)); + snprintf(fdbKeys.param, sizeof(fdbKeys.param), "%d", get_fdb_param(vlistInqVarParam(vlistID, varID))); + bool isML = (zaxisType == ZAXIS_HYBRID || zaxisType == ZAXIS_HYBRID_HALF); + snprintf(fdbKeys.levtype, sizeof(fdbKeys.levtype), "%s", isML ? "ml" : "sfc"); + fdbKeys.levelist[0] = 0; + int ilevel = (isML) ? (int) level : 0; + if (isML) snprintf(fdbKeys.levelist, sizeof(fdbKeys.levelist), "%d", isML ? ilevel : 0); + + cdi_fdb_store(streamptr->protocolData, streamptr->filename, gribbuffer, nbytes, &fdbKeys); +#endif + } + break; + + case CDI_PROTOCOL_OTHER: + case CDI_PROTOCOL_FILE: + { + size_t (*myFileWrite)(int fileID, const void *restrict buffer, size_t len) + = (size_t(*)(int, const void *restrict, size_t)) namespaceSwitchGet(NSSWITCH_FILE_WRITE).func; + + size_t nwrite = myFileWrite(fileID, gribbuffer, nbytes); + if (nwrite != nbytes) SysError("Failed to write GRIB slice!"); + } + break; + } + + if (gribbuffer) Free(gribbuffer); +} + +void +grb_write_var(stream_t *streamptr, int varID, int memtype, const void *data, size_t nmiss) +{ + int vlistID = streamptr->vlistID, gridID = vlistInqVarGrid(vlistID, varID), zaxisID = vlistInqVarZaxis(vlistID, varID), + nlevs = zaxisInqSize(zaxisID); + size_t gridsize = gridInqSize(gridID); + double missval = vlistInqVarMissval(vlistID, varID); + + size_t chunkLen = gridsize; + if (memtype == MEMTYPE_FLOAT) + for (int levelID = 0; levelID < nlevs; levelID++) + { + const float *restrict fdata = ((const float *) data) + levelID * gridsize; + + size_t nmiss_slice = 0; + if (nmiss) + for (size_t i = 0; i < chunkLen; ++i) nmiss_slice += DBL_IS_EQUAL(fdata[i], missval); + + grb_write_var_slice(streamptr, varID, levelID, memtype, fdata, nmiss_slice); + } + else + for (int levelID = 0; levelID < nlevs; levelID++) + { + const double *restrict ddata = ((const double *) data) + levelID * gridsize; + + size_t nmiss_slice = 0; + if (nmiss) + for (size_t i = 0; i < chunkLen; ++i) nmiss_slice += DBL_IS_EQUAL(ddata[i], missval); + + grb_write_var_slice(streamptr, varID, levelID, memtype, ddata, nmiss_slice); + } +} + +void +grb_write_record(stream_t *streamptr, int memtype, const void *data, size_t nmiss) +{ + int varID = streamptr->record->varID; + int levelID = streamptr->record->levelID; + grb_write_var_slice(streamptr, varID, levelID, memtype, data, nmiss); +} + +#endif + +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifdef HAVE_CONFIG_H +#endif + +#ifdef HAVE_LIBGRIB + +#ifdef HAVE_LIBFDB5 +#endif + + +static int +grb_decode(int filetype, int memtype, void *cgribexp, void *gribbuffer, size_t gribsize, void *data, size_t datasize, int unreduced, + size_t *nmiss, double missval) +{ + int status = 0; + +#ifdef HAVE_LIBCGRIBEX + if (filetype == CDI_FILETYPE_GRB && !CDI_gribapi_grib1) + { +#ifdef HAVE_LIBGRIB_API + extern int cdiNAdditionalGRIBKeys; + if (cdiNAdditionalGRIBKeys > 0) Error("CGRIBEX decode does not support reading of additional GRIB keys!"); +#endif + status = cgribexDecode(memtype, cgribexp, gribbuffer, gribsize, data, datasize, unreduced, nmiss, missval); + } + else +#endif +#ifdef HAVE_LIBGRIB_API + { + void *datap = (memtype == MEMTYPE_FLOAT) ? Malloc(datasize * sizeof(double)) : data; + + status = gribapiDecode(gribbuffer, gribsize, datap, datasize, unreduced, nmiss, missval); + + if (memtype == MEMTYPE_FLOAT) + { + float *dataf = (float *) data; + double *datad = (double *) datap; + for (size_t i = 0; i < datasize; ++i) dataf[i] = (float) datad[i]; + Free(datap); + } + } +#else + { + Error("ecCodes support not compiled in!"); + } +#endif + + return status; +} + +// Decompresses the grib data in gribbuffer. +static int +grib1_unzip_record(void *gribbuffer, size_t *gribsize) +{ + int zip = 0; + + size_t igribsize = *gribsize; + size_t ogribsize = *gribsize; + + int izip; + size_t unzipsize; + if ((izip = gribGetZip(igribsize, (unsigned char *) gribbuffer, &unzipsize)) > 0) + { + zip = izip; + if (izip == 128) // szip + { + if (unzipsize < igribsize) + { + fprintf(stderr, "Decompressed size smaller than compressed size (in %zu; out %zu)!\n", igribsize, unzipsize); + return 0; + } + + unzipsize += 100; // need 0 to 1 bytes for rounding of bds + + void *buffer = Malloc(igribsize); + memcpy(buffer, gribbuffer, igribsize); + + ogribsize + = (size_t) gribUnzip((unsigned char *) gribbuffer, (long) unzipsize, (unsigned char *) buffer, (long) igribsize); + + Free(buffer); + + if (ogribsize <= 0) Error("Decompression problem!"); + } + else + { + Error("Decompression for %d not implemented!", izip); + } + } + + *gribsize = ogribsize; + + return zip; +} + +typedef struct DecodeArgs +{ + int recID, tsID, *outZip, filetype, memtype, unreduced; + void *cgribexp, *gribbuffer, *data; + size_t recsize, gridsize, nmiss; + double missval; +} DecodeArgs; + +static int +grb_decode_record(void *untypedArgs) +{ + DecodeArgs *args = (DecodeArgs *) untypedArgs; + *args->outZip = grib1_unzip_record(args->gribbuffer, &args->recsize); + grb_decode(args->filetype, args->memtype, args->cgribexp, args->gribbuffer, args->recsize, args->data, args->gridsize, + args->unreduced, &args->nmiss, args->missval); + return 0; +} + +static DecodeArgs +grb_read_raw_data(stream_t *streamptr, int tsID, int recID, int memtype, void *gribbuffer, void *data, bool resetFilePos) +{ + int vlistID = streamptr->vlistID; + int varID = streamptr->tsteps[tsID].records[recID].varID; + size_t recsize = streamptr->tsteps[tsID].records[recID].size; + + int gridID = vlistInqVarGrid(vlistID, varID); + size_t gridsize = gridInqSize(gridID); + if (CDI_Debug) Message("gridID = %d gridsize = %zu", gridID, gridsize); + + void *cgribexp = (gribbuffer && streamptr->record->objectp) ? streamptr->record->objectp : NULL; + if (!gribbuffer) gribbuffer = Malloc(streamptr->record->buffersize); + if (!data) data = Malloc(gridsize * ((memtype == MEMTYPE_FLOAT) ? sizeof(float) : sizeof(double))); + + if (streamptr->protocol == CDI_PROTOCOL_FDB) + { +#ifdef HAVE_LIBFDB5 + void *fdbItem = streamptr->tsteps[tsID].records[recID].fdbItem; + if (!fdbItem) Error("fdbItem not available!"); + + recsize = fdb_read_record(streamptr->protocolData, fdbItem, &(streamptr->record->buffersize), &gribbuffer); +#endif + } + else + { + if (recsize == 0) Error("Internal problem! Recordsize is zero for record %d at timestep %d", recID + 1, tsID + 1); + + int fileID = streamptr->fileID; + off_t recpos = streamptr->tsteps[tsID].records[recID].position; + off_t currentfilepos = (resetFilePos ? fileGetPos(fileID) : 0); + + fileSetPos(fileID, recpos, SEEK_SET); + if (fileRead(fileID, gribbuffer, recsize) != recsize) Error("Failed to read GRIB record!"); + + if (resetFilePos) fileSetPos(fileID, currentfilepos, SEEK_SET); + if (!resetFilePos) streamptr->numvals += gridsize; + } + + return (DecodeArgs){ + .recID = recID, + .tsID = tsID, + .outZip = &streamptr->tsteps[tsID].records[recID].zip, + .filetype = streamptr->filetype, + .memtype = memtype, + .unreduced = streamptr->unreduced, + .cgribexp = cgribexp, + .gribbuffer = gribbuffer, + .data = data, + .recsize = recsize, + .gridsize = gridsize, + .nmiss = 0, + .missval = vlistInqVarMissval(vlistID, varID), + }; +} + +static size_t +grb_read_and_decode_record(stream_t *streamptr, int recID, int memtype, void *data, bool resetFilePos) +{ + DecodeArgs args = grb_read_raw_data(streamptr, streamptr->curTsID, recID, memtype, streamptr->record->buffer, data, resetFilePos); + grb_decode_record(&args); + return args.nmiss; +} + +typedef struct JobDescriptor +{ + DecodeArgs args; + AsyncJob *job; +} JobDescriptor; + +static void +JobDescriptor_startJob(AsyncManager *jobManager, JobDescriptor *me, stream_t *streamptr, int tsID, int recID, int memtype) +{ + me->args = grb_read_raw_data(streamptr, tsID, recID, memtype, NULL, NULL, false); + me->job = AsyncWorker_requestWork(jobManager, grb_decode_record, &me->args); + if (!me->job) xabort("error while trying to send job to worker thread"); +} + +static void +JobDescriptor_finishJob(AsyncManager *jobManager, JobDescriptor *me, void *data, size_t *nmiss) +{ + if (AsyncWorker_wait(jobManager, me->job)) xabort("error executing job in worker thread"); + memcpy(data, me->args.data, me->args.gridsize * ((me->args.memtype == MEMTYPE_FLOAT) ? sizeof(float) : sizeof(double))); + *nmiss = me->args.nmiss; + + Free(me->args.gribbuffer); + Free(me->args.data); + me->args.recID = -1; // mark as inactive + me->args.tsID = -1; // mark as inactive +} +/* +static long +get_global_recId(stream_t *streamptr, int tsID, int recID) +{ + const tsteps_t *tsteps = streamptr->tsteps; + long globalRecId = recID; + if (tsID > 0) globalRecId += tsteps[0].nrecs; + if (tsID > 1) globalRecId += tsteps[1].nrecs * (tsID - 1); + return globalRecId; +} +*/ +static long +get_max_global_recs(stream_t *streamptr) +{ + long maxGlobalRecs = -1; + long numSteps = streamptr->ntsteps; + if (numSteps > 0) + { + const tsteps_t *tsteps = streamptr->tsteps; + maxGlobalRecs = tsteps[0].nrecs; + if (numSteps > 1) maxGlobalRecs += tsteps[1].nrecs * (numSteps - 1); + } + return maxGlobalRecs; +} + +static void +get_local_step_and_recId(stream_t *streamptr, long globalRecId, int *tsID, int *recID) +{ + int localTsId = 0; + long numSteps = streamptr->ntsteps; + const tsteps_t *tsteps = streamptr->tsteps; + if (numSteps > 0 && globalRecId >= tsteps[0].nrecs) + { + localTsId++; + globalRecId -= tsteps[0].nrecs; + } + while (globalRecId >= tsteps[1].nrecs) + { + localTsId++; + globalRecId -= tsteps[1].nrecs; + } + + *tsID = localTsId; + *recID = globalRecId; +} + +static void +read_next_record(AsyncManager *jobManager, JobDescriptor *jd, stream_t *streamptr, int memtype) +{ + int tsId = -1, recId = -1; + get_local_step_and_recId(streamptr, streamptr->nextGlobalRecId, &tsId, &recId); + int xRecId = streamptr->tsteps[tsId].recIDs[recId]; + JobDescriptor_startJob(jobManager, jd, streamptr, tsId, xRecId, memtype); + streamptr->nextGlobalRecId++; +} + +static void +grb_read_next_record(stream_t *streamptr, int recID, int memtype, void *data, size_t *nmiss) +{ + bool jobFound = false; + + int workerCount = streamptr->numWorker; + if (workerCount > 0) + { + int tsID = streamptr->curTsID; + long maxGlobalRecs = get_max_global_recs(streamptr); + // long globalRecId = get_global_recId(streamptr, streamptr->curTsID, recID); + if (maxGlobalRecs == -1) xabort("Internal error: number of timesteps missing!"); + + if (workerCount > maxGlobalRecs) workerCount = maxGlobalRecs; + + AsyncManager *jobManager = (AsyncManager *) streamptr->jobManager; + JobDescriptor *jobs = (JobDescriptor *) streamptr->jobs; + + // if this is the first call, init and start worker threads + + if (!jobs) + { + jobs = (JobDescriptor *) malloc(workerCount * sizeof(*jobs)); + streamptr->jobs = jobs; + for (int i = 0; i < workerCount; i++) jobs[i].args.recID = -1; + for (int i = 0; i < workerCount; i++) jobs[i].args.tsID = -1; + if (AsyncWorker_init(&jobManager, workerCount)) xabort("error while trying to start worker threads"); + streamptr->jobManager = jobManager; + + // Start as many new jobs as possible. + for (int i = 0; streamptr->nextGlobalRecId < maxGlobalRecs && i < workerCount; i++) + { + JobDescriptor *jd = &jobs[i]; + if (jd->args.recID < 0 && jd->args.tsID < 0) read_next_record(jobManager, jd, streamptr, memtype); + } + } + + // search for a job descriptor with the given tsID and recID, and use its results if it exists + for (int i = 0; !jobFound && i < workerCount; i++) + { + JobDescriptor *jd = &jobs[i]; + if (jd->args.recID == recID && jd->args.tsID == tsID) + { + jobFound = true; + JobDescriptor_finishJob(jobManager, jd, data, nmiss); + if (streamptr->nextGlobalRecId < maxGlobalRecs) read_next_record(jobManager, jd, streamptr, memtype); + } + } + } + + // perform the work synchronously if we didn't start a job for it yet + if (!jobFound) *nmiss = grb_read_and_decode_record(streamptr, recID, memtype, data, false); +} + +void +grb_read_record(stream_t *streamptr, int memtype, void *data, size_t *nmiss) +{ + int tsID = streamptr->curTsID; + int vrecID = streamptr->tsteps[tsID].curRecID; + int recID = streamptr->tsteps[tsID].recIDs[vrecID]; + + grb_read_next_record(streamptr, recID, memtype, data, nmiss); +} + +void +grb_read_var_slice(stream_t *streamptr, int varID, int levelID, int memtype, void *data, size_t *nmiss) +{ + int isub = subtypeInqActiveIndex(streamptr->vars[varID].subtypeID); + int recID = streamptr->vars[varID].recordTable[isub].recordID[levelID]; + + *nmiss = grb_read_and_decode_record(streamptr, recID, memtype, data, true); +} + +void +grb_read_var(stream_t *streamptr, int varID, int memtype, void *data, size_t *nmiss) +{ + int vlistID = streamptr->vlistID; + int fileID = streamptr->fileID; + + int gridID = vlistInqVarGrid(vlistID, varID); + size_t gridsize = gridInqSize(gridID); + + off_t currentfilepos = fileGetPos(fileID); + + int isub = subtypeInqActiveIndex(streamptr->vars[varID].subtypeID); + int nlevs = streamptr->vars[varID].recordTable[0].nlevs; + + if (CDI_Debug) Message("nlevs = %d gridID = %d gridsize = %zu", nlevs, gridID, gridsize); + + *nmiss = 0; + for (int levelID = 0; levelID < nlevs; levelID++) + { + int recID = streamptr->vars[varID].recordTable[isub].recordID[levelID]; + size_t offset = levelID * gridsize; + void *datap = (memtype == MEMTYPE_FLOAT) ? (void *) ((float *) data + offset) : (void *) ((double *) data + offset); + + *nmiss += grb_read_and_decode_record(streamptr, recID, memtype, datap, false); + } + + fileSetPos(fileID, currentfilepos, SEEK_SET); +} + +#endif + +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifndef VLIST_VAR_H +#define VLIST_VAR_H + +#ifdef HAVE_CONFIG_H +#endif + +#ifndef VLIST_H +#endif + +int vlistVarGetPackSize(vlist_t *p, int varID, void *context); +void vlistVarPack(vlist_t *p, int varID, char *buffer, int bufferSize, int *pos, void *context); +void vlistVarUnpack(int vlistID, char *buf, int size, int *position, int, void *context); +int vlistVarCompare(vlist_t *a, int varIDA, vlist_t *b, int varIDB); +void vlistDefVarIOrank(int, int, int); +int vlistInqVarIOrank(int, int); + +void cdiVlistCreateVarLevInfo(vlist_t *vlistptr, int varID); + +#endif +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifdef HAVE_CONFIG_H +#endif + +#ifdef HAVE_LIBNETCDF + + +//#include <netcdf_filter.h> + +void +cdf_def_var_filter(int ncid, int ncvarID, unsigned int id, size_t nparams, const unsigned int *params) +{ +#ifdef HAVE_NETCDF4 + int status; + if ((status = nc_def_var_filter(ncid, ncvarID, id, nparams, params))) + { + Error("nc_def_var_filter failed; %s", nc_strerror(status)); + } +#else + static bool lwarn = true; + if (lwarn) + { + lwarn = false; + Warning("filter failed, NetCDF4 not available!"); + } +#endif +} + +void +cdfDefVarDeflate(int ncid, int ncvarID, int compLevel) +{ +#ifdef HAVE_NETCDF4 + // Set chunking, shuffle, and deflate. + int shuffle = (CDI_Shuffle > 0), deflate = 1; + + if (compLevel < 1 || compLevel > 9) compLevel = 1; + + int status; + if ((status = nc_def_var_deflate(ncid, ncvarID, shuffle, deflate, compLevel))) + { + Error("nc_def_var_deflate failed; %s", nc_strerror(status)); + } +#else + static bool lwarn = true; + if (lwarn) + { + lwarn = false; + Warning("Deflate compression failed, NetCDF4 not available!"); + } +#endif +} + +void +cdfDefVarSzip(int ncid, int ncvarID, int pixels_per_block) +{ +#ifdef HAVE_NC_DEF_VAR_SZIP + // Set options_mask. + /* + H5_SZIP_ALLOW_K13_OPTION_MASK 1 + H5_SZIP_CHIP_OPTION_MASK 2 + H5_SZIP_EC_OPTION_MASK 4 + H5_SZIP_NN_OPTION_MASK 32 + H5_SZIP_ALL_MASKS (H5_SZIP_CHIP_OPTION_MASK|H5_SZIP_EC_OPTION_MASK|H5_SZIP_NN_OPTION_MASK) + */ + int options_mask = 38; + int status; + if ((status = nc_def_var_szip(ncid, ncvarID, options_mask, pixels_per_block))) + Error("nc_def_var_szip failed; %s", nc_strerror(status)); +#else + static bool lwarn = true; + if (lwarn) + { + lwarn = false; + Warning("Szip compression failed, NetCDF4/szlib not available!"); + } +#endif +} + +#ifdef HAVE_NETCDF4 +static nc_type +cdfTypeComplexFloat(stream_t *streamptr) +{ + if (streamptr->nc_complex_float_id == CDI_UNDEFID) + { + typedef struct complex_float + { + float r, i; + } complex_float; + int fileID = streamptr->fileID; + int nc_complex_id; + int status; + status = nc_def_compound(fileID, sizeof(complex_float), "complex_float", &nc_complex_id); + if (status != NC_NOERR) Error("%s", nc_strerror(status)); + status = nc_insert_compound(fileID, nc_complex_id, "r", NC_COMPOUND_OFFSET(complex_float, r), NC_FLOAT); + if (status != NC_NOERR) Error("%s", nc_strerror(status)); + status = nc_insert_compound(fileID, nc_complex_id, "i", NC_COMPOUND_OFFSET(complex_float, i), NC_FLOAT); + if (status != NC_NOERR) Error("%s", nc_strerror(status)); + streamptr->nc_complex_float_id = nc_complex_id; + } + + return (nc_type) streamptr->nc_complex_float_id; +} + +static nc_type +cdfTypeComplexDouble(stream_t *streamptr) +{ + if (streamptr->nc_complex_double_id == CDI_UNDEFID) + { + typedef struct complex_double + { + double r, i; + } complex_double; + int fileID = streamptr->fileID; + int nc_complex_id; + int status; + status = nc_def_compound(fileID, sizeof(complex_double), "complex_double", &nc_complex_id); + if (status != NC_NOERR) Error("%s", nc_strerror(status)); + status = nc_insert_compound(fileID, nc_complex_id, "r", NC_COMPOUND_OFFSET(complex_double, r), NC_DOUBLE); + if (status != NC_NOERR) Error("%s", nc_strerror(status)); + status = nc_insert_compound(fileID, nc_complex_id, "i", NC_COMPOUND_OFFSET(complex_double, i), NC_DOUBLE); + if (status != NC_NOERR) Error("%s", nc_strerror(status)); + streamptr->nc_complex_double_id = nc_complex_id; + } + + return (nc_type) streamptr->nc_complex_double_id; +} +#endif + +nc_type +cdfDefDatatype(int datatype, stream_t *streamptr) +{ + nc_type xtype = NC_FLOAT; + + // clang-format off + if (streamptr->filetype == CDI_FILETYPE_NC4) + { + if (datatype == CDI_DATATYPE_INT8 ) xtype = NC_BYTE; + else if (datatype == CDI_DATATYPE_INT16 ) xtype = NC_SHORT; + else if (datatype == CDI_DATATYPE_INT32 ) xtype = NC_INT; +#ifdef HAVE_NETCDF4 + else if (datatype == CDI_DATATYPE_UINT8 ) xtype = NC_UBYTE; + else if (datatype == CDI_DATATYPE_UINT16) xtype = NC_USHORT; + else if (datatype == CDI_DATATYPE_UINT32) xtype = NC_UINT; + else if (datatype == CDI_DATATYPE_CPX32 ) xtype = cdfTypeComplexFloat(streamptr); + else if (datatype == CDI_DATATYPE_CPX64 ) xtype = cdfTypeComplexDouble(streamptr); +#else + else if (datatype == CDI_DATATYPE_UINT8 ) xtype = NC_SHORT; + else if (datatype == CDI_DATATYPE_UINT16) xtype = NC_INT; + else if (datatype == CDI_DATATYPE_UINT32) xtype = NC_INT; + else if (datatype == CDI_DATATYPE_CPX32 || datatype == CDI_DATATYPE_CPX64) + Error("CDI library does not support complex numbers with NetCDF4 classic!"); +#endif + else if (datatype == CDI_DATATYPE_FLT64 ) xtype = NC_DOUBLE; + else if (datatype == CDI_DATATYPE_FLT32 ) xtype = NC_FLOAT; + } + else + { + if (datatype == CDI_DATATYPE_INT8 ) xtype = NC_BYTE; + else if (datatype == CDI_DATATYPE_INT16 ) xtype = NC_SHORT; + else if (datatype == CDI_DATATYPE_INT32 ) xtype = NC_INT; + else if (datatype == CDI_DATATYPE_UINT8 ) xtype = NC_SHORT; + else if (datatype == CDI_DATATYPE_UINT16) xtype = NC_INT; + else if (datatype == CDI_DATATYPE_UINT32) xtype = NC_INT; + else if (datatype == CDI_DATATYPE_FLT64 ) xtype = NC_DOUBLE; + else if (datatype == CDI_DATATYPE_FLT32 ) xtype = NC_FLOAT; + else if (datatype == CDI_DATATYPE_CPX32 || datatype == CDI_DATATYPE_CPX64) + Error("CDI library does not support complex numbers with NetCDF classic!"); + } + // clang-format on + + return xtype; +} + +static void +cdfDefVarMissval(stream_t *streamptr, int varID, int dtype, int lcheck) +{ + if (streamptr->vars[varID].defmiss == false) + { + int vlistID = streamptr->vlistID; + int fileID = streamptr->fileID; + int ncvarID = streamptr->vars[varID].ncvarid; + double missval = vlistInqVarMissval(vlistID, varID); + + if (lcheck && streamptr->ncmode == 2) cdf_redef(fileID); + + nc_type xtype = cdfDefDatatype(dtype, streamptr); + if (xtype == NC_BYTE && missval > 127 && missval < 256) xtype = NC_INT; + + if (lcheck == 0 || streamptr->ncmode != 2 || streamptr->filetype == CDI_FILETYPE_NC || streamptr->filetype == CDI_FILETYPE_NC2 + || streamptr->filetype == CDI_FILETYPE_NC5) + cdf_put_att_double(fileID, ncvarID, "_FillValue", xtype, 1, &missval); + + cdf_put_att_double(fileID, ncvarID, "missing_value", xtype, 1, &missval); + + if (lcheck && streamptr->ncmode == 2) cdf_enddef(fileID, streamptr->self); + + streamptr->vars[varID].defmiss = true; + } +} + +static void +cdfDefInstituteGlobal(const stream_t *streamptr) +{ + int vlistID = streamptr->vlistID; + int fileID = streamptr->fileID; + int instID = vlistInqInstitut(vlistID); + + if (instID != CDI_UNDEFID) + { + const char *longname = institutInqLongnamePtr(instID); + if (longname) + { + size_t len = strlen(longname); + if (len > 0) + { + if (streamptr->ncmode == 2) cdf_redef(fileID); + cdf_put_att_text(fileID, NC_GLOBAL, "institution", len, longname); + if (streamptr->ncmode == 2) cdf_enddef(fileID, streamptr->self); + } + } + } +} + +static void +cdfDefSourceGlobal(const stream_t *streamptr) +{ + int vlistID = streamptr->vlistID; + int fileID = streamptr->fileID; + int modelID = vlistInqModel(vlistID); + + if (modelID != CDI_UNDEFID) + { + const char *longname = modelInqNamePtr(modelID); + if (longname) + { + size_t len = strlen(longname); + if (len > 0) + { + if (streamptr->ncmode == 2) cdf_redef(fileID); + cdf_put_att_text(fileID, NC_GLOBAL, "source", len, longname); + if (streamptr->ncmode == 2) cdf_enddef(fileID, streamptr->self); + } + } + } +} + +static inline void * +resizeBuf(void **buf, size_t *bufSize, size_t reqSize) +{ + if (reqSize > *bufSize) + { + *buf = Realloc(*buf, reqSize); + *bufSize = reqSize; + } + return *buf; +} + +static void +cdfDefineCellMethods(stream_t *streamptr, int cdiID, int varID, int fileID, int ncvarID) +{ + taxis_t *taxis = &streamptr->tsteps[0].taxis; + if (!taxis->hasBounds) return; + + int timeVarId = streamptr->basetime.ncvarid; + char timeVarName[CDI_MAX_NAME]; + cdf_inq_varname(fileID, timeVarId, timeVarName); + + int stepType = vlistInqVarTsteptype(cdiID, varID); + + const char *cellMethod = NULL; + // clang-format off + if (stepType == TSTEP_AVG) cellMethod = "mean"; + else if (stepType == TSTEP_SUM) cellMethod = "sum"; + else if (stepType == TSTEP_RANGE) cellMethod = "range"; + else if (stepType == TSTEP_MIN) cellMethod = "minimum"; + else if (stepType == TSTEP_MAX) cellMethod = "maximum"; + // clang-format on + + if (cellMethod) + { + const char *attname = "cell_methods"; + char atttxt[CDI_MAX_NAME + 10]; + snprintf(atttxt, sizeof(atttxt), "%s: %s", timeVarName, cellMethod); + cdf_put_att_text(fileID, ncvarID, attname, strlen(atttxt), atttxt); + } +} + +void +cdfDefineAttributes(int cdiID, int varID, int fileID, int ncvarID) +{ + int atttype, attlen; + char attname[CDI_MAX_NAME + 1]; + void *attBuf = NULL; + size_t attBufSize = 0; + + int natts; + cdiInqNatts(cdiID, varID, &natts); + + for (int iatt = 0; iatt < natts; ++iatt) + { + cdiInqAtt(cdiID, varID, iatt, attname, &atttype, &attlen); + + // if (attlen == 0) continue; + + if (atttype == CDI_DATATYPE_TXT) + { + size_t attSize = (size_t) attlen * sizeof(char); + char *atttxt = (char *) resizeBuf(&attBuf, &attBufSize, attSize); + cdiInqAttTxt(cdiID, varID, attname, attlen, atttxt); + size_t len = (size_t) attlen; + cdf_put_att_text(fileID, ncvarID, attname, len, atttxt); + } + else if (atttype == CDI_DATATYPE_INT8 || atttype == CDI_DATATYPE_UINT8 || atttype == CDI_DATATYPE_INT16 + || atttype == CDI_DATATYPE_UINT16 || atttype == CDI_DATATYPE_INT32 || atttype == CDI_DATATYPE_UINT32) + { + if (attlen == 0) continue; + size_t attSize = (size_t) attlen * sizeof(int); + int *attint = (int *) resizeBuf(&attBuf, &attBufSize, attSize); + cdiInqAttInt(cdiID, varID, attname, attlen, &attint[0]); + size_t len = (size_t) attlen; + // clang-format off + nc_type xtype = (atttype == CDI_DATATYPE_INT8) ? NC_BYTE : + (atttype == CDI_DATATYPE_INT16) ? NC_SHORT : +#ifdef HAVE_NETCDF4 + (atttype == CDI_DATATYPE_UINT8) ? NC_UBYTE : + (atttype == CDI_DATATYPE_UINT16) ? NC_USHORT : + (atttype == CDI_DATATYPE_UINT32) ? NC_UINT : +#endif + NC_INT; + // clang-format on + cdf_put_att_int(fileID, ncvarID, attname, xtype, len, attint); + } + else if (atttype == CDI_DATATYPE_FLT32 || atttype == CDI_DATATYPE_FLT64) + { + if (attlen == 0) continue; + size_t attSize = (size_t) attlen * sizeof(double); + double *attflt = (double *) resizeBuf(&attBuf, &attBufSize, attSize); + cdiInqAttFlt(cdiID, varID, attname, attlen, attflt); + size_t len = (size_t) attlen; + if (atttype == CDI_DATATYPE_FLT32) + { + float attflt_sp[8]; + float *pattflt_sp = (len > 8) ? (float *) malloc(len * sizeof(float)) : attflt_sp; + for (size_t i = 0; i < len; ++i) pattflt_sp[i] = (float) attflt[i]; + cdf_put_att_float(fileID, ncvarID, attname, NC_FLOAT, len, pattflt_sp); + if (len > 8) free(pattflt_sp); + } + else + cdf_put_att_double(fileID, ncvarID, attname, NC_DOUBLE, len, attflt); + } + } + + if (attBuf) Free(attBuf); +} + +static void +cdfDefineInstituteName(int vlistID, int varID, int fileID, int ncvarID) +{ + int instID = vlistInqVarInstitut(vlistID, varID); + if (instID != CDI_UNDEFID) + { + const char *name = institutInqNamePtr(instID); + if (name) cdf_put_att_text(fileID, ncvarID, "institution", strlen(name), name); + } +} + +static void +cdfDefGlobalAtts(stream_t *streamptr) +{ + if (streamptr->globalatts) return; + + int vlistID = streamptr->vlistID; + int fileID = streamptr->fileID; + + cdfDefSourceGlobal(streamptr); + cdfDefInstituteGlobal(streamptr); + + int natts; + cdiInqNatts(vlistID, CDI_GLOBAL, &natts); + + if (natts > 0 && streamptr->ncmode == 2) cdf_redef(fileID); + + cdfDefineAttributes(vlistID, CDI_GLOBAL, fileID, NC_GLOBAL); + + if (natts > 0 && streamptr->ncmode == 2) cdf_enddef(fileID, streamptr->self); + + streamptr->globalatts = 1; +} + +static void +cdf_get_gmapvarname(int gridID, char *gmapvarname) +{ + int length = CDI_MAX_NAME; + int pgridID = gridID; + cdiInqKeyString(pgridID, CDI_GLOBAL, CDI_KEY_GRIDMAP_VARNAME, gmapvarname, &length); + + if (!gmapvarname[0]) + { + length = CDI_MAX_NAME; + pgridID = gridInqProj(gridID); + if (pgridID != CDI_UNDEFID) cdiInqKeyString(pgridID, CDI_GLOBAL, CDI_KEY_GRIDMAP_VARNAME, gmapvarname, &length); + } +} + +static int +nc_grid_index(stream_t *streamptr, int gridID) +{ + int index = 0; + int vlistID = streamptr->vlistID; + int ngrids = vlistNgrids(vlistID); + for (index = 0; index < ngrids; ++index) + if (streamptr->ncgrid[index].gridID == gridID) break; + + assert(index < ngrids); + + return index; +} + +// convert NetCDF xtype to pixels_per_block +static int +xtype2ppb(nc_type xtype) +{ + int ppb = 32; + + // clang-format off + if (xtype == NC_BYTE) ppb = 8; + else if (xtype == NC_SHORT) ppb = 16; +#ifdef HAVE_NETCDF4 + else if (xtype == NC_UBYTE) ppb = 8; + else if (xtype == NC_USHORT) ppb = 16; +#endif + // clang-format on + + return ppb; +} + +static void +cdfDefVarFilter(const stream_t *s, int ncvarID) +{ + if (s->filterId != 0) + { + if (s->filetype == CDI_FILETYPE_NC4 || s->filetype == CDI_FILETYPE_NC4C || s->filetype == CDI_FILETYPE_NCZARR) + { + cdf_def_var_filter(s->fileID, ncvarID, s->filterId, s->numParams, s->params); + } + else + { + static bool lwarn = true; + if (lwarn) + { + lwarn = false; + Warning("Filter is only available for NetCDF4!"); + } + } + } +} + +static void +cdfDefVarCompression(const stream_t *streamptr, int ncvarID, nc_type xtype) +{ + if (streamptr->comptype == CDI_COMPRESS_ZIP) + { + if (streamptr->filetype == CDI_FILETYPE_NC4 || streamptr->filetype == CDI_FILETYPE_NC4C + || streamptr->filetype == CDI_FILETYPE_NCZARR) + { + cdfDefVarDeflate(streamptr->fileID, ncvarID, streamptr->complevel); + } + else + { + static bool lwarn = true; + if (lwarn) + { + lwarn = false; + Warning("Deflate compression is only available for NetCDF4!"); + } + } + } + /* + else if (streamptr->comptype == CDI_COMPRESS_ZSTD) + { + if (streamptr->filetype == CDI_FILETYPE_NC4 || streamptr->filetype == CDI_FILETYPE_NC4C + || streamptr->filetype == CDI_FILETYPE_NCZARR) + { + cdfDefVarZstd(streamptr->fileID, ncvarID, streamptr->complevel); + } + else + { + static bool lwarn = true; + if (lwarn) + { + lwarn = false; + Warning("SZIP compression is only available for NetCDF4!"); + } + } + } + */ + else if (streamptr->comptype == CDI_COMPRESS_SZIP) + { + if (streamptr->filetype == CDI_FILETYPE_NC4 || streamptr->filetype == CDI_FILETYPE_NC4C + || streamptr->filetype == CDI_FILETYPE_NCZARR) + { + cdfDefVarSzip(streamptr->fileID, ncvarID, xtype2ppb(xtype)); + } + else + { + static bool lwarn = true; + if (lwarn) + { + lwarn = false; + Warning("SZIP compression is only available for NetCDF4!"); + } + } + } +} + +static void +cdfDefVarPacking(const stream_t *streamptr, int ncvarID, nc_type xtype, int vlistID, int varID) +{ + // if ( xtype == NC_BYTE || xtype == NC_SHORT || xtype == NC_INT ) + { + double addoffset = 0.0, scalefactor = 1.0; + bool haveAddoffset = (cdiInqKeyFloat(vlistID, varID, CDI_KEY_ADDOFFSET, &addoffset) == CDI_NOERR); + bool haveScalefactor = (cdiInqKeyFloat(vlistID, varID, CDI_KEY_SCALEFACTOR, &scalefactor) == CDI_NOERR); + + if (haveAddoffset || haveScalefactor) + { + nc_type astype = (xtype == NC_FLOAT) ? NC_FLOAT : NC_DOUBLE; + if ((astype == NC_DOUBLE) && IS_EQUAL(addoffset, (double) ((float) addoffset)) + && IS_EQUAL(scalefactor, (double) ((float) scalefactor))) + { + astype = NC_FLOAT; + } + + cdf_put_att_double(streamptr->fileID, ncvarID, "add_offset", astype, 1, &addoffset); + cdf_put_att_double(streamptr->fileID, ncvarID, "scale_factor", astype, 1, &scalefactor); + } + } +} + +static void +cdfAppendCoordinates(int fileID, int ncvarID, char coordinates[CDI_MAX_NAME]) +{ + if (ncvarID != CDI_UNDEFID) + { + size_t len = strlen(coordinates); + if (len) coordinates[len++] = ' '; + cdf_inq_varname(fileID, ncvarID, coordinates + len); + } +} + +static void +cdfDefineCoordinates(const stream_t *streamptr, int ncvarID, int nczvarID, int gridtype, int gridID, int gridindex, int xid, + int yid, size_t gridsize, char axis[5], size_t iax) +{ + int fileID = streamptr->fileID; + + if (gridtype != GRID_GENERIC && gridtype != GRID_LONLAT && gridtype != GRID_PROJECTION && gridtype != GRID_CURVILINEAR + && gridtype != GRID_CHARXY) + { + size_t len = strlen(gridNamePtr(gridtype)); + if (len > 0) cdf_put_att_text(fileID, ncvarID, "CDI_grid_type", len, gridNamePtr(gridtype)); + } + + char gmapvarname[CDI_MAX_NAME]; + gmapvarname[0] = 0; + cdf_get_gmapvarname(gridID, gmapvarname); + if (gmapvarname[0]) cdf_put_att_text(fileID, ncvarID, "grid_mapping", strlen(gmapvarname), gmapvarname); + + if (gridtype == GRID_GAUSSIAN || gridtype == GRID_GAUSSIAN_REDUCED) + { + int numLPE = gridInqNP(gridID); + if (numLPE > 0) cdf_put_att_int(fileID, ncvarID, "CDI_grid_num_LPE", NC_INT, 1, &numLPE); + } + + if (gridtype == GRID_GAUSSIAN_REDUCED) + { + int ncyvarID = streamptr->ncgrid[gridindex].ncIDs[CDF_VARID_Y]; + if (ncyvarID != CDI_UNDEFID) + { + char name[CDI_MAX_NAME]; + name[0] = 0; + cdf_inq_varname(fileID, ncyvarID, name); + size_t len = strlen(name); + cdf_put_att_text(fileID, ncvarID, "CDI_grid_latitudes", len, name); + } + + int ncrpvarID = streamptr->ncgrid[gridindex].ncIDs[CDF_VARID_RP]; + if (ncrpvarID != CDI_UNDEFID) + { + char name[CDI_MAX_NAME]; + name[0] = 0; + cdf_inq_varname(fileID, ncrpvarID, name); + size_t len = strlen(name); + cdf_put_att_text(fileID, ncvarID, "CDI_grid_reduced_points", len, name); + } + } + + // define coordinates attribute + + char coordinates[CDI_MAX_NAME]; + coordinates[0] = 0; + + if (nczvarID != CDI_UNDEFID) cdfAppendCoordinates(fileID, nczvarID, coordinates); + + if (gridtype == GRID_TRAJECTORY) + { + cdf_put_att_text(fileID, ncvarID, "coordinates", 9, "tlon tlat"); + } + else if (gridtype == GRID_LONLAT && xid == CDI_UNDEFID && yid == CDI_UNDEFID && gridsize == 1) + { + int ncxvarID = streamptr->ncgrid[gridindex].ncIDs[CDF_VARID_X]; + int ncyvarID = streamptr->ncgrid[gridindex].ncIDs[CDF_VARID_Y]; + cdfAppendCoordinates(fileID, ncyvarID, coordinates); + cdfAppendCoordinates(fileID, ncxvarID, coordinates); + } + else if (gridtype == GRID_GAUSSIAN_REDUCED) + { + /* + int ncxvarID = streamptr->ncgrid[gridindex].ncIDs[CDF_VARID_X]; + int ncyvarID = streamptr->ncgrid[gridindex].ncIDs[CDF_VARID_Y]; + cdfAppendCoordinates(fileID, ncyvarID, coordinates); + cdfAppendCoordinates(fileID, ncxvarID, coordinates); + */ + } + else if (gridtype == GRID_UNSTRUCTURED || gridtype == GRID_CURVILINEAR) + { + int ncxvarID = streamptr->ncgrid[gridindex].ncIDs[CDF_VARID_X]; + int ncyvarID = streamptr->ncgrid[gridindex].ncIDs[CDF_VARID_Y]; + int ncavarID = streamptr->ncgrid[gridindex].ncIDs[CDF_VARID_A]; + // CMOR order: coordinates = "lat lon" + if (CDI_Coordinates_Lon_Lat) + { + cdfAppendCoordinates(fileID, ncxvarID, coordinates); + cdfAppendCoordinates(fileID, ncyvarID, coordinates); + } + else + { + cdfAppendCoordinates(fileID, ncyvarID, coordinates); + cdfAppendCoordinates(fileID, ncxvarID, coordinates); + } + + if (ncavarID != CDI_UNDEFID) + { + char cellarea[CDI_MAX_NAME] = "area: "; + size_t len = strlen(cellarea); + cdf_inq_varname(fileID, ncavarID, cellarea + len); + len = strlen(cellarea); + cdf_put_att_text(fileID, ncvarID, "cell_measures", len, cellarea); + } + + if (gridtype == GRID_UNSTRUCTURED) + { + int position = gridInqPosition(gridID); + if (position > 0) cdf_put_att_int(fileID, ncvarID, "number_of_grid_in_reference", NC_INT, 1, &position); + } + } + else if (gridtype == GRID_SPECTRAL || gridtype == GRID_FOURIER) + { + axis[iax++] = '-'; + axis[iax++] = '-'; + cdf_put_att_text(fileID, ncvarID, "axis", iax, axis); + int gridTruncation = gridInqTrunc(gridID); + cdf_put_att_int(fileID, ncvarID, "truncation", NC_INT, 1, &gridTruncation); + } + else if (gridtype == GRID_CHARXY) + { + if (gridInqXIsc(gridID)) + { + int ncxvarID = streamptr->ncgrid[gridindex].ncIDs[CDF_VARID_X]; + cdfAppendCoordinates(fileID, ncxvarID, coordinates); + } + else if (gridInqYIsc(gridID)) + { + int ncyvarID = streamptr->ncgrid[gridindex].ncIDs[CDF_VARID_Y]; + cdfAppendCoordinates(fileID, ncyvarID, coordinates); + } + } + + size_t len = strlen(coordinates); + if (len) cdf_put_att_text(fileID, ncvarID, "coordinates", len, coordinates); +} + +static size_t +calc_chunksize(size_t chunkSizeLim, size_t size) +{ + static const size_t pageSize = 4096; + + if (size <= chunkSizeLim) return size; + + size_t numChunks = (size / chunkSizeLim) + 1; + size_t chunkSize = size / numChunks; + if (chunkSize % pageSize) chunkSize = (chunkSize / pageSize + 1) * pageSize; + + return chunkSize; +} + +static const size_t chunkSizeMax = 65536; +static const size_t chunkSizeLim = 1048576; + +size_t +calc_chunksize_y(int chunkType, size_t gridsize, size_t xsize, size_t ysize) +{ + if (chunkType == CDI_CHUNK_AUTO) + return (gridsize <= chunkSizeMax) ? ysize : chunkSizeMax / xsize; + else + return (chunkType == CDI_CHUNK_LINES) ? 1 : ysize; +} + +size_t +calc_chunksize_x(int chunkType, int chunkSize, size_t xsize, bool yIsUndefined) +{ + if (chunkType == CDI_CHUNK_AUTO && yIsUndefined) + return (chunkSize > 0) ? (size_t) chunkSize : ((xsize <= chunkSizeMax) ? xsize : chunkSizeMax); + else + return calc_chunksize(chunkSizeLim, xsize); +} + +static int +cdfDefineDimsAndChunks(const stream_t *streamptr, int varID, int xid, int yid, int zid, size_t gridsize, const int dimorder[3], + int dims[4], bool useChunks, size_t chunks[4], char axis[5], size_t *piax) +{ + int fileID = streamptr->fileID; + int vlistID = streamptr->vlistID; + + size_t iax = *piax; + int ndims = 0; + + for (int i = 0; i < 4; ++i) chunks[i] = 0; + + size_t xsize = 0, ysize = 0; + if (xid != CDI_UNDEFID) cdf_inq_dimlen(fileID, xid, &xsize); + if (yid != CDI_UNDEFID) cdf_inq_dimlen(fileID, yid, &ysize); + + int timetype = vlistInqVarTimetype(vlistID, varID); + if (vlistHasTime(vlistID) && timetype != TIME_CONSTANT) + { + int tid = streamptr->basetime.ncdimid; + if (tid == CDI_UNDEFID) Error("Internal problem, time undefined!"); + axis[iax++] = 'T'; + chunks[ndims] = 1; + dims[ndims] = tid; + ndims++; + } + + int chunkSize = 0; + int chunkType = CDI_CHUNK_GRID; + cdiInqKeyInt(vlistID, varID, CDI_KEY_CHUNKTYPE, &chunkType); + cdiInqKeyInt(vlistID, varID, CDI_KEY_CHUNKSIZE, &chunkSize); + if (chunkSize > 0 && yid == CDI_UNDEFID) chunkType = CDI_CHUNK_AUTO; + + if (chunkType == CDI_CHUNK_GRID && gridsize > ChunkSizeLim) + { + if (CDI_Debug) fprintf(stderr, "gridsize > %u, changed chunkType to CDI_CHUNK_LINES!\n", ChunkSizeLim); + chunkType = CDI_CHUNK_LINES; + } + + for (int id = 0; id < 3; ++id) + { + if (dimorder[id] == 3 && zid != CDI_UNDEFID) + { + axis[iax++] = 'Z'; + chunks[ndims] = 1; + dims[ndims] = zid; + ndims++; + } + else if (dimorder[id] == 2 && yid != CDI_UNDEFID) + { + chunks[ndims] = calc_chunksize_y(chunkType, gridsize, xsize, ysize); + dims[ndims] = yid; + ndims++; + } + else if (dimorder[id] == 1 && xid != CDI_UNDEFID) + { + chunks[ndims] = calc_chunksize_x(chunkType, chunkSize, xsize, (yid == CDI_UNDEFID)); + dims[ndims] = xid; + ndims++; + } + } + + if (CDI_Debug) + fprintf(stderr, "useChunks %d chunkType %d chunkSize %d chunks %zu %zu %zu %zu\n", useChunks, chunkType, chunkSize, chunks[0], + chunks[1], chunks[2], chunks[3]); + + *piax = iax; + return ndims; +} + +static void +cdfDefineAttrLeveltype(int fileID, int ncvarID, int zaxisID, int zaxistype) +{ + // clang-format off + if ( zaxistype == ZAXIS_CLOUD_BASE || + zaxistype == ZAXIS_CLOUD_TOP || + zaxistype == ZAXIS_ISOTHERM_ZERO || + zaxistype == ZAXIS_TROPOPAUSE || + zaxistype == ZAXIS_TOA || + zaxistype == ZAXIS_SEA_BOTTOM || + zaxistype == ZAXIS_LAKE_BOTTOM || + zaxistype == ZAXIS_SEDIMENT_BOTTOM || + zaxistype == ZAXIS_SEDIMENT_BOTTOM_TA || + zaxistype == ZAXIS_SEDIMENT_BOTTOM_TW || + zaxistype == ZAXIS_MIX_LAYER || + zaxistype == ZAXIS_ATMOSPHERE ) + { + char varname[CDI_MAX_NAME]; + int length = CDI_MAX_NAME; + cdiInqKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_NAME, varname, &length); + cdf_put_att_text(fileID, ncvarID, "level_type", strlen(varname), varname); + } + // clang-format on +} + +static void +cdfDefineAttrEnsemble(int fileID, int ncvarID, int vlistID, int varID) +{ + int perturbationNumber, numberOfForecastsInEnsemble, typeOfEnsembleForecast; + if (cdiInqKeyInt(vlistID, varID, CDI_KEY_PERTURBATIONNUMBER, &perturbationNumber) == 0) + cdf_put_att_int(fileID, ncvarID, "realization", NC_INT, 1, &perturbationNumber); + if (cdiInqKeyInt(vlistID, varID, CDI_KEY_NUMBEROFFORECASTSINENSEMBLE, &numberOfForecastsInEnsemble) == 0) + cdf_put_att_int(fileID, ncvarID, "ensemble_members", NC_INT, 1, &numberOfForecastsInEnsemble); + if (cdiInqKeyInt(vlistID, varID, CDI_KEY_TYPEOFENSEMBLEFORECAST, &typeOfEnsembleForecast) == 0) + cdf_put_att_int(fileID, ncvarID, "forecast_init_type", NC_INT, 1, &typeOfEnsembleForecast); +} + +static void +cdfCheckVarname(int fileID, char name[CDI_MAX_NAME]) +{ + if (name[0]) + { + int ncvarID; + char varname[CDI_MAX_NAME]; + snprintf(varname, sizeof(varname), "%s", name); + char *varname2 = varname + strlen(varname); + unsigned iz = 0; + + do + { + if (iz) sprintf(varname2, "_%u", iz + 1); + + if (nc_inq_varid(fileID, varname, &ncvarID) != NC_NOERR) break; + + ++iz; + } + while (iz <= 99); + + if (iz > 99) Error("Variable name %s already exsist!", name); + + if (!str_is_equal(name, varname)) + Warning("Changed %s entry of variable name '%s' to '%s'!", (iz == 1) ? "double" : "multiple", name, varname); + + strcpy(name, varname); + } +} + +static void +cdfGenVarname(int fileID, char name[CDI_MAX_NAME], int pnum, int pcat, int *pdis, int *pcode) +{ + char varname[CDI_MAX_NAME]; + + int code = *pcode; + if (code < 0) code = -code; + if (pnum < 0) pnum = -pnum; + + if (*pdis == 255) + snprintf(varname, sizeof(varname), "var%d", code); + else + snprintf(varname, sizeof(varname), "param%d.%d.%d", pnum, pcat, *pdis); + + char *varname2 = varname + strlen(varname); + int ncvarID; + unsigned iz = 0; + + do + { + if (iz) sprintf(varname2, "_%u", iz + 1); + + if (nc_inq_varid(fileID, varname, &ncvarID) != NC_NOERR) break; + + ++iz; + } + while (iz <= 99); + + if (iz > 99) Error("Variable name %s already exsist!", name); + + strcpy(name, varname); + *pcode = 0; + *pdis = 255; +} + +int +cdfDefVar(stream_t *streamptr, int varID) +{ + if (streamptr->vars[varID].ncvarid != CDI_UNDEFID) return streamptr->vars[varID].ncvarid; + + int fileID = streamptr->fileID; + if (CDI_Debug) Message("streamID = %d, fileID = %d, varID = %d", streamptr->self, fileID, varID); + + int vlistID = streamptr->vlistID; + int param = vlistInqVarParam(vlistID, varID); + int code = vlistInqVarCode(vlistID, varID); + int pnum, pcat, pdis; + cdiDecodeParam(param, &pnum, &pcat, &pdis); + + int gridID = vlistInqVarGrid(vlistID, varID); + SizeType gridsize = gridInqSize(gridID); + int gridtype = gridInqType(gridID); + int gridindex = nc_grid_index(streamptr, gridID); + int xid = (gridtype != GRID_TRAJECTORY) ? streamptr->ncgrid[gridindex].ncIDs[CDF_DIMID_X] : CDI_UNDEFID; + int yid = (gridtype != GRID_TRAJECTORY && gridtype != GRID_GAUSSIAN_REDUCED) ? streamptr->ncgrid[gridindex].ncIDs[CDF_DIMID_Y] + : CDI_UNDEFID; + + int zaxisID = vlistInqVarZaxis(vlistID, varID); + int zaxistype = zaxisInqType(zaxisID); + int zaxisindex = vlistZaxisIndex(vlistID, zaxisID); + int zid = streamptr->zaxisID[zaxisindex]; + + int dimorder[3]; // ZYX/321 and ZXY/312 + vlistInqVarDimorder(vlistID, varID, dimorder); + bool useChunks + = (gridsize >= 32) && ((dimorder[0] == 3) || (dimorder[1] == 3 && dimorder[2] == 1 && gridsize == gridInqXsize(gridID))); + + if (((dimorder[0] > 0) + (dimorder[1] > 0) + (dimorder[2] > 0)) + < ((xid != CDI_UNDEFID) + (yid != CDI_UNDEFID) + (zid != CDI_UNDEFID))) + { + printf("zid=%d yid=%d xid=%d\n", zid, yid, xid); + Error("Internal problem, dimension order missing!"); + } + + size_t iax = 0; + char axis[5]; + int dims[4]; + size_t chunks[4]; + int ndims = cdfDefineDimsAndChunks(streamptr, varID, xid, yid, zid, gridsize, dimorder, dims, useChunks, chunks, axis, &iax); + + char name[CDI_MAX_NAME]; + int length = CDI_MAX_NAME; + cdiInqKeyString(vlistID, varID, CDI_KEY_NAME, name, &length); + + char longname[CDI_MAX_NAME]; + vlistInqVarLongname(vlistID, varID, longname); + + char units[CDI_MAX_NAME]; + vlistInqVarUnits(vlistID, varID, units); + + char stdname[CDI_MAX_NAME]; + length = CDI_MAX_NAME; + cdiInqKeyString(vlistID, varID, CDI_KEY_STDNAME, stdname, &length); + + int tableID = vlistInqVarTable(vlistID, varID); + if (!name[0]) tableInqEntry(tableID, code, -1, name, longname, units); + if (name[0]) + cdfCheckVarname(fileID, name); + else + cdfGenVarname(fileID, name, pnum, pcat, &pdis, &code); + + int dtype = vlistInqVarDatatype(vlistID, varID); + const nc_type xtype = cdfDefDatatype(dtype, streamptr); + + if (streamptr->ncmode == 2) + { + cdf_redef(fileID); + streamptr->ncmode = 1; + } + + int ncvarID = -1; + cdf_def_var(fileID, name, xtype, ndims, dims, &ncvarID); + +#ifdef HAVE_NETCDF4 +#ifdef NC_QUANTIZE_BITROUND + if (xtype == NC_FLOAT || xtype == NC_DOUBLE) + { + int nsb = vlistInqVarNSB(vlistID, varID); + if (nsb > 0) nc_def_var_quantize(fileID, ncvarID, NC_QUANTIZE_BITROUND, nsb); + // if (nsb > 0) nc_def_var_quantize(fileID, ncvarID, NC_QUANTIZE_GRANULARBR, nsb); + } +#endif + + if (useChunks + && (streamptr->filetype == CDI_FILETYPE_NC4 || streamptr->filetype == CDI_FILETYPE_NC4C + || streamptr->filetype == CDI_FILETYPE_NCZARR)) + cdf_def_var_chunking(fileID, ncvarID, NC_CHUNKED, chunks); +#endif + + if (useChunks) cdfDefVarCompression(streamptr, ncvarID, xtype); + if (useChunks) cdfDefVarFilter(streamptr, ncvarID); + + if (*stdname) cdf_put_att_text(fileID, ncvarID, "standard_name", strlen(stdname), stdname); + if (*longname) cdf_put_att_text(fileID, ncvarID, "long_name", strlen(longname), longname); + if (*units) cdf_put_att_text(fileID, ncvarID, "units", strlen(units), units); + + if (code > 0 && pdis == 255) cdf_put_att_int(fileID, ncvarID, "code", NC_INT, 1, &code); + + if (pdis != 255) + { + char paramstr[32]; + cdiParamToString(param, paramstr, sizeof(paramstr)); + cdf_put_att_text(fileID, ncvarID, "param", strlen(paramstr), paramstr); + } + + if (tableID != CDI_UNDEFID) + { + int tablenum = tableInqNum(tableID); + if (tablenum > 0) cdf_put_att_int(fileID, ncvarID, "table", NC_INT, 1, &tablenum); + } + + bool zaxisIsScalar = (zid == CDI_UNDEFID) ? (zaxisInqScalar(zaxisID) > 0) : false; + int nczvarID = (zaxisIsScalar || zaxistype == ZAXIS_CHAR) ? streamptr->nczvarID[zaxisindex] : CDI_UNDEFID; + + cdfDefineCoordinates(streamptr, ncvarID, nczvarID, gridtype, gridID, gridindex, xid, yid, gridsize, axis, iax); + + cdfDefVarPacking(streamptr, ncvarID, xtype, vlistID, varID); + + if (dtype == CDI_DATATYPE_UINT8 && xtype == NC_BYTE) + { + int validrange[2] = { 0, 255 }; + cdf_put_att_int(fileID, ncvarID, "valid_range", NC_SHORT, 2, validrange); + cdf_put_att_text(fileID, ncvarID, "_Unsigned", 4, "true"); + } + + streamptr->vars[varID].ncvarid = ncvarID; + + if (vlistInqVarMissvalUsed(vlistID, varID)) cdfDefVarMissval(streamptr, varID, vlistInqVarDatatype(vlistID, varID), 0); + + if (zid == CDI_UNDEFID) cdfDefineAttrLeveltype(fileID, ncvarID, zaxisID, zaxistype); + + cdfDefineAttrEnsemble(fileID, ncvarID, vlistID, varID); + + // Attribute: cell_methods + cdfDefineCellMethods(streamptr, vlistID, varID, fileID, ncvarID); + + // Attributes + cdfDefineAttributes(vlistID, varID, fileID, ncvarID); + + // Institute + if (vlistInqInstitut(vlistID) == CDI_UNDEFID) cdfDefineInstituteName(vlistID, varID, fileID, ncvarID); + + return ncvarID; +} + +void +cdfEndDef(stream_t *streamptr) +{ + cdfDefGlobalAtts(streamptr); + + if (streamptr->accessmode == 0) + { + int fileID = streamptr->fileID; + if (streamptr->ncmode == 2) + { + cdf_redef(fileID); + streamptr->ncmode = 1; + } + + int nvars = streamptr->nvars; + for (int varID = 0; varID < nvars; ++varID) cdfDefVar(streamptr, varID); + + if (streamptr->ncmode != 2) + { + if (CDI_Netcdf_Hdr_Pad == 0UL) + cdf_enddef(fileID, streamptr->self); + else + cdf__enddef(fileID, streamptr->self, CDI_Netcdf_Hdr_Pad); + streamptr->ncmode = 2; + } + + streamptr->accessmode = 1; + } +} + +static void +cdfWriteGridTraj(stream_t *streamptr, int gridID) +{ + int gridindex = nc_grid_index(streamptr, gridID); + int lonID = streamptr->ncgrid[gridindex].ncIDs[CDF_DIMID_X]; + int latID = streamptr->ncgrid[gridindex].ncIDs[CDF_DIMID_Y]; + size_t index = (size_t) streamptr->curTsID; + + double xlon = gridInqXval(gridID, 0); + double xlat = gridInqYval(gridID, 0); + + cdf_put_var1_double(streamptr->fileID, lonID, &index, &xlon); + cdf_put_var1_double(streamptr->fileID, latID, &index, &xlat); +} + +static void +cdf_write_var_data(int fileID, int vlistID, int varID, int ncvarID, int dtype, size_t nvals, size_t xsize, size_t ysize, + bool swapxy, size_t *start, size_t *count, int memtype, const void *data, size_t nmiss) +{ + const double *pdata_dp = (const double *) data; + double *mdata_dp = NULL; + double *sdata_dp = NULL; + const float *pdata_sp = (const float *) data; + float *mdata_sp = NULL; + float *sdata_sp = NULL; + + /* if ( dtype == CDI_DATATYPE_INT8 || dtype == CDI_DATATYPE_INT16 || dtype == CDI_DATATYPE_INT32 ) */ + { + double missval = vlistInqVarMissval(vlistID, varID); + double addoffset = 0.0, scalefactor = 1.0; + bool haveAddoffset = (cdiInqKeyFloat(vlistID, varID, CDI_KEY_ADDOFFSET, &addoffset) == CDI_NOERR); + bool haveScalefactor = (cdiInqKeyFloat(vlistID, varID, CDI_KEY_SCALEFACTOR, &scalefactor) == CDI_NOERR); + + if (haveAddoffset || haveScalefactor) + { + if (memtype == MEMTYPE_FLOAT) + { + mdata_sp = (float *) Malloc(nvals * sizeof(float)); + memcpy(mdata_sp, pdata_sp, nvals * sizeof(float)); + pdata_sp = mdata_sp; + + if (nmiss > 0) + { + for (size_t i = 0; i < nvals; ++i) + { + double temp = mdata_sp[i]; + if (!DBL_IS_EQUAL(temp, missval)) + { + if (haveAddoffset) temp -= addoffset; + if (haveScalefactor) temp /= scalefactor; + mdata_sp[i] = (float) temp; + } + } + } + else + { + for (size_t i = 0; i < nvals; ++i) + { + double temp = mdata_sp[i]; + if (haveAddoffset) temp -= addoffset; + if (haveScalefactor) temp /= scalefactor; + mdata_sp[i] = (float) temp; + } + } + } + else + { + mdata_dp = (double *) Malloc(nvals * sizeof(double)); + memcpy(mdata_dp, pdata_dp, nvals * sizeof(double)); + pdata_dp = mdata_dp; + + if (nmiss > 0) + { + for (size_t i = 0; i < nvals; ++i) + { + if (!DBL_IS_EQUAL(mdata_dp[i], missval)) + { + if (haveAddoffset) mdata_dp[i] -= addoffset; + if (haveScalefactor) mdata_dp[i] /= scalefactor; + } + } + } + else + { + for (size_t i = 0; i < nvals; ++i) + { + if (haveAddoffset) mdata_dp[i] -= addoffset; + if (haveScalefactor) mdata_dp[i] /= scalefactor; + } + } + } + } + + if (dtype == CDI_DATATYPE_UINT8 || dtype == CDI_DATATYPE_INT8 || dtype == CDI_DATATYPE_INT16 || dtype == CDI_DATATYPE_INT32) + { + if (memtype == MEMTYPE_FLOAT) + { + if (mdata_sp == NULL) + { + mdata_sp = (float *) Malloc(nvals * sizeof(float)); + memcpy(mdata_sp, pdata_sp, nvals * sizeof(float)); + pdata_sp = mdata_sp; + } + + for (size_t i = 0; i < nvals; ++i) mdata_sp[i] = roundf(mdata_sp[i]); + + if (dtype == CDI_DATATYPE_UINT8) + { + nc_type xtype; + cdf_inq_vartype(fileID, ncvarID, &xtype); + if (xtype == NC_BYTE) + { + for (size_t i = 0; i < nvals; ++i) + if (mdata_sp[i] > 127) mdata_sp[i] -= 256; + } + } + } + else + { + if (mdata_dp == NULL) + { + mdata_dp = (double *) Malloc(nvals * sizeof(double)); + memcpy(mdata_dp, pdata_dp, nvals * sizeof(double)); + pdata_dp = mdata_dp; + } + + for (size_t i = 0; i < nvals; ++i) mdata_dp[i] = round(mdata_dp[i]); + + if (dtype == CDI_DATATYPE_UINT8) + { + nc_type xtype; + cdf_inq_vartype(fileID, ncvarID, &xtype); + if (xtype == NC_BYTE) + { + for (size_t i = 0; i < nvals; ++i) + if (mdata_dp[i] > 127) mdata_dp[i] -= 256; + } + } + } + } + + if (CDF_Debug && memtype != MEMTYPE_FLOAT) + { + double fmin = 1.0e200; + double fmax = -1.0e200; + for (size_t i = 0; i < nvals; ++i) + { + if (!DBL_IS_EQUAL(pdata_dp[i], missval)) + { + if (pdata_dp[i] < fmin) fmin = pdata_dp[i]; + if (pdata_dp[i] > fmax) fmax = pdata_dp[i]; + } + } + Message("nvals = %zu, nmiss = %d, missval = %g, minval = %g, maxval = %g", nvals, nmiss, missval, fmin, fmax); + } + } + + if (swapxy) // implemented only for cdf_write_var_slice() + { + size_t gridsize = xsize * ysize; + if (memtype == MEMTYPE_FLOAT) + { + sdata_sp = (float *) Malloc(gridsize * sizeof(float)); + for (size_t j = 0; j < ysize; ++j) + for (size_t i = 0; i < xsize; ++i) sdata_sp[i * ysize + j] = pdata_sp[j * xsize + i]; + pdata_sp = sdata_sp; + } + else + { + sdata_dp = (double *) Malloc(gridsize * sizeof(double)); + for (size_t j = 0; j < ysize; ++j) + for (size_t i = 0; i < xsize; ++i) sdata_dp[i * ysize + j] = pdata_dp[j * xsize + i]; + pdata_dp = sdata_dp; + } + } + + if (dtype == CDI_DATATYPE_CPX32 || dtype == CDI_DATATYPE_CPX64) + { + void *pdata = (memtype == MEMTYPE_FLOAT) ? (void *) pdata_sp : (void *) pdata_dp; + float *cdata_sp = NULL; + double *cdata_dp = NULL; + if (memtype == MEMTYPE_FLOAT && dtype == CDI_DATATYPE_CPX64) + { + cdata_dp = (double *) Malloc(2 * nvals * sizeof(double)); + for (size_t i = 0; i < nvals; ++i) + { + cdata_dp[2 * i] = (double) (pdata_sp[2 * i]); + cdata_dp[2 * i + 1] = (double) (pdata_sp[2 * i + 1]); + } + pdata = cdata_dp; + } + else if (memtype == MEMTYPE_DOUBLE && dtype == CDI_DATATYPE_CPX32) + { + cdata_sp = (float *) Malloc(2 * nvals * sizeof(float)); + for (size_t i = 0; i < nvals; ++i) + { + cdata_sp[2 * i] = (float) (pdata_dp[2 * i]); + cdata_sp[2 * i + 1] = (float) (pdata_dp[2 * i + 1]); + } + pdata = cdata_sp; + } + + cdf_put_vara(fileID, ncvarID, start, count, pdata); + if (cdata_sp) Free(cdata_sp); + if (cdata_dp) Free(cdata_dp); + } + else + { + if (memtype == MEMTYPE_FLOAT) + cdf_put_vara_float(fileID, ncvarID, start, count, pdata_sp); + else + cdf_put_vara_double(fileID, ncvarID, start, count, pdata_dp); + } + + if (mdata_dp) Free(mdata_dp); + if (sdata_dp) Free(sdata_dp); + if (mdata_sp) Free(mdata_sp); + if (sdata_sp) Free(sdata_sp); +} + +static void +cdfGetXYZid(stream_t *streamptr, int gridID, int zaxisID, int *xid, int *yid, int *zid) +{ + *xid = CDI_UNDEFID; + *yid = CDI_UNDEFID; + + int gridtype = gridInqType(gridID); + if (gridtype == GRID_TRAJECTORY) + { + cdfWriteGridTraj(streamptr, gridID); + } + else + { + int gridindex = nc_grid_index(streamptr, gridID); + *xid = streamptr->ncgrid[gridindex].ncIDs[CDF_DIMID_X]; + if (gridtype != GRID_GAUSSIAN_REDUCED) *yid = streamptr->ncgrid[gridindex].ncIDs[CDF_DIMID_Y]; + } + + int vlistID = streamptr->vlistID; + int zaxisindex = vlistZaxisIndex(vlistID, zaxisID); + *zid = streamptr->zaxisID[zaxisindex]; +} + +static void +cdfDefineStartAndCount(stream_t *streamptr, int varID, int xid, int yid, int zid, size_t start[5], size_t count[5], size_t *xsize, + size_t *ysize) +{ + size_t ndims = 0; + *xsize = 0; + *ysize = 0; + + int vlistID = streamptr->vlistID; + int fileID = streamptr->fileID; + + const long ntsteps = streamptr->ntsteps; + if (CDI_Debug) Message("ntsteps = %ld", ntsteps); + + int timetype = vlistInqVarTimetype(vlistID, varID); + + if (vlistHasTime(vlistID) && timetype != TIME_CONSTANT) + { + start[ndims] = (size_t) ntsteps - 1; + count[ndims] = 1; + ndims++; + } + + if (zid != CDI_UNDEFID) + { + int zaxisID = vlistInqVarZaxis(vlistID, varID); + start[ndims] = 0; + count[ndims] = (size_t) zaxisInqSize(zaxisID); + ndims++; + } + + if (yid != CDI_UNDEFID) + { + start[ndims] = 0; + size_t size; + cdf_inq_dimlen(fileID, yid, &size); + /* count[ndims] = gridInqYsize(gridID); */ + count[ndims] = size; + ndims++; + } + + if (xid != CDI_UNDEFID) + { + start[ndims] = 0; + size_t size; + cdf_inq_dimlen(fileID, xid, &size); + /* count[ndims] = gridInqXsize(gridID); */ + count[ndims] = size; + ndims++; + } + + if (CDI_Debug) + for (size_t idim = 0; idim < ndims; ++idim) Message("dim = %d start = %d count = %d", idim, start[idim], count[idim]); +} + +void +cdf_write_var(stream_t *streamptr, int varID, int memtype, const void *data, size_t nmiss) +{ + if (streamptr->accessmode == 0) cdfEndDef(streamptr); + + if (CDI_Debug) Message("streamID = %d varID = %d", streamptr->self, varID); + + int vlistID = streamptr->vlistID; + int fileID = streamptr->fileID; + + int ncvarID = cdfDefVar(streamptr, varID); + + int gridID = vlistInqVarGrid(vlistID, varID); + int zaxisID = vlistInqVarZaxis(vlistID, varID); + + int xid, yid, zid; + cdfGetXYZid(streamptr, gridID, zaxisID, &xid, &yid, &zid); + + size_t xsize, ysize; + size_t start[5], count[5]; + cdfDefineStartAndCount(streamptr, varID, xid, yid, zid, start, count, &xsize, &ysize); + + if (streamptr->ncmode == 1) + { + cdf_enddef(fileID, streamptr->self); + streamptr->ncmode = 2; + } + + int dtype = vlistInqVarDatatype(vlistID, varID); + + if (nmiss > 0) cdfDefVarMissval(streamptr, varID, dtype, 1); + + size_t nvals = gridInqSize(gridID) * (size_t) (zaxisInqSize(zaxisID)); + + bool swapxy = false; + cdf_write_var_data(fileID, vlistID, varID, ncvarID, dtype, nvals, xsize, ysize, swapxy, start, count, memtype, data, nmiss); +} + +static void +cdfDefineStartAndCountChunk(stream_t *streamptr, const int rect[][2], int varID, int xid, int yid, int zid, size_t start[5], + size_t count[5], size_t *xsize, size_t *ysize) +{ + size_t ndims = 0; + *xsize = 0; + *ysize = 0; + + int vlistID = streamptr->vlistID; + int fileID = streamptr->fileID; + + const long ntsteps = streamptr->ntsteps; + if (CDI_Debug) Message("ntsteps = %ld", ntsteps); + + int timetype = vlistInqVarTimetype(vlistID, varID); + + if (vlistHasTime(vlistID) && timetype != TIME_CONSTANT) + { + start[ndims] = (size_t) ntsteps - 1; + count[ndims] = 1; + ndims++; + } + + if (zid != CDI_UNDEFID) + { + int zaxisID = vlistInqVarZaxis(vlistID, varID); + int size = zaxisInqSize(zaxisID); + xassert(rect[2][0] >= 0 && rect[2][0] <= rect[2][1] + 1 && rect[2][1] <= size); + start[ndims] = (size_t) rect[2][0]; + count[ndims] = rect[2][1] < 0 ? (size_t) 0 : (size_t) rect[2][1] - (size_t) rect[2][0] + 1; + ndims++; + } + + if (yid != CDI_UNDEFID) + { + size_t size; + cdf_inq_dimlen(fileID, yid, &size); + xassert(rect[1][0] >= 0 && rect[1][0] <= rect[1][1] + 1 && (rect[1][1] < 0 || (size_t) rect[1][1] <= size)); + start[ndims] = (size_t) rect[1][0]; + count[ndims] = rect[1][1] < 0 ? (size_t) 0 : ((size_t) rect[1][1] - (size_t) rect[1][0] + 1); + ndims++; + } + + if (xid != CDI_UNDEFID) + { + size_t size; + cdf_inq_dimlen(fileID, xid, &size); + xassert(rect[0][0] >= 0 && rect[0][0] <= rect[0][1] + 1 && (rect[0][1] < 0 || (size_t) rect[0][1] <= size)); + start[ndims] = (size_t) rect[0][0]; + count[ndims] = rect[0][1] < 0 ? (size_t) 0 : (size_t) rect[0][1] - (size_t) rect[0][0] + 1; + ndims++; + } + + if (CDI_Debug) + for (size_t idim = 0; idim < ndims; ++idim) Message("dim = %d start = %d count = %d", idim, start[idim], count[idim]); +} + +void +cdf_write_var_chunk(stream_t *streamptr, int varID, int memtype, const int rect[][2], const void *data, size_t nmiss) +{ + if (streamptr->accessmode == 0) cdfEndDef(streamptr); + + int streamID = streamptr->self; + + if (CDI_Debug) Message("streamID = %d varID = %d", streamID, varID); + + int vlistID = streamInqVlist(streamID); + int fileID = streamInqFileID(streamID); + + int ncvarID = cdfDefVar(streamptr, varID); + + int gridID = vlistInqVarGrid(vlistID, varID); + int zaxisID = vlistInqVarZaxis(vlistID, varID); + + int xid, yid, zid; + cdfGetXYZid(streamptr, gridID, zaxisID, &xid, &yid, &zid); + + size_t xsize, ysize; + size_t start[5], count[5]; + cdfDefineStartAndCountChunk(streamptr, rect, varID, xid, yid, zid, start, count, &xsize, &ysize); + + if (streamptr->ncmode == 1) + { + cdf_enddef(fileID, streamptr->self); + streamptr->ncmode = 2; + } + + int dtype = vlistInqVarDatatype(vlistID, varID); + + if (nmiss > 0) cdfDefVarMissval(streamptr, varID, dtype, 1); + + size_t nvals = gridInqSize(gridID) * (size_t) (zaxisInqSize(zaxisID)); + + bool swapxy = false; + cdf_write_var_data(fileID, vlistID, varID, ncvarID, dtype, nvals, xsize, ysize, swapxy, start, count, memtype, data, nmiss); +} + +static void +cdfDefineStartAndCountSlice(stream_t *streamptr, int varID, int levelID, int dimorder[3], int xid, int yid, int zid, + size_t start[5], size_t count[5], size_t *xsize, size_t *ysize) +{ + size_t ndims = 0; + *xsize = 0; + *ysize = 0; + + int vlistID = streamptr->vlistID; + int fileID = streamptr->fileID; + + const long ntsteps = streamptr->ntsteps; + if (CDI_Debug) Message("ntsteps = %ld", ntsteps); + + int timetype = vlistInqVarTimetype(vlistID, varID); + + if (vlistHasTime(vlistID) && timetype != TIME_CONSTANT) + { + start[ndims] = (size_t) ntsteps - 1; + count[ndims] = 1; + ndims++; + } + + for (int id = 0; id < 3; ++id) + { + if (dimorder[id] == 3 && zid != CDI_UNDEFID) + { + start[ndims] = (size_t) levelID; + count[ndims] = 1; + ndims++; + } + else if (dimorder[id] == 2 && yid != CDI_UNDEFID) + { + start[ndims] = 0; + cdf_inq_dimlen(fileID, yid, ysize); + count[ndims] = *ysize; + ndims++; + } + else if (dimorder[id] == 1 && xid != CDI_UNDEFID) + { + start[ndims] = 0; + cdf_inq_dimlen(fileID, xid, xsize); + count[ndims] = *xsize; + ndims++; + } + } + + if (CDI_Debug) + for (size_t idim = 0; idim < ndims; ++idim) Message("dim = %d start = %d count = %d", idim, start[idim], count[idim]); +} + +void +cdf_write_var_slice(stream_t *streamptr, int varID, int levelID, int memtype, const void *data, size_t nmiss) +{ + if (streamptr->accessmode == 0) cdfEndDef(streamptr); + + if (CDI_Debug) Message("streamID = %d varID = %d", streamptr->self, varID); + + int vlistID = streamptr->vlistID; + int fileID = streamptr->fileID; + + int ncvarID = cdfDefVar(streamptr, varID); + + int gridID = vlistInqVarGrid(vlistID, varID); + int zaxisID = vlistInqVarZaxis(vlistID, varID); + + int xid, yid, zid; + cdfGetXYZid(streamptr, gridID, zaxisID, &xid, &yid, &zid); + + int dimorder[3]; + vlistInqVarDimorder(vlistID, varID, dimorder); + bool swapxy = (dimorder[2] == 2 || dimorder[0] == 1) && xid != CDI_UNDEFID && yid != CDI_UNDEFID; + + size_t xsize, ysize; + size_t start[5], count[5]; + cdfDefineStartAndCountSlice(streamptr, varID, levelID, dimorder, xid, yid, zid, start, count, &xsize, &ysize); + + int dtype = vlistInqVarDatatype(vlistID, varID); + + if (nmiss > 0) cdfDefVarMissval(streamptr, varID, dtype, 1); + + size_t nvals = gridInqSize(gridID); + + cdf_write_var_data(fileID, vlistID, varID, ncvarID, dtype, nvals, xsize, ysize, swapxy, start, count, memtype, data, nmiss); +} + +void +cdf_write_record(stream_t *streamptr, int memtype, const void *data, size_t nmiss) +{ + int varID = streamptr->record->varID; + int levelID = streamptr->record->levelID; + cdf_write_var_slice(streamptr, varID, levelID, memtype, data, nmiss); +} + +#endif + +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifdef HAVE_CONFIG_H +#endif + +#ifdef HAVE_LIBNETCDF + +#include <limits.h> +#include <float.h> + + +static void +cdfReadGridTraj(stream_t *streamptr, int gridID) +{ + int vlistID = streamptr->vlistID; + int fileID = streamptr->fileID; + + int gridindex = vlistGridIndex(vlistID, gridID); + int ncLonId = streamptr->ncgrid[gridindex].ncIDs[CDF_VARID_X]; + int ncLatId = streamptr->ncgrid[gridindex].ncIDs[CDF_VARID_Y]; + + int tsID = streamptr->curTsID; + size_t ncStepIndex = (size_t) streamptr->tsteps[tsID].ncStepIndex; + + double xlon, xlat; + cdf_get_var1_double(fileID, ncLonId, &ncStepIndex, &xlon); + cdf_get_var1_double(fileID, ncLatId, &ncStepIndex, &xlat); + + gridDefXvals(gridID, &xlon); + gridDefYvals(gridID, &xlat); +} + +static void +cdfGetSlapDescription(stream_t *streamptr, int varID, size_t (*start)[MAX_DIMENSIONS], size_t (*count)[MAX_DIMENSIONS]) +{ + int vlistID = streamptr->vlistID; + int tsID = streamptr->curTsID; + int gridID = vlistInqVarGrid(vlistID, varID); + int zaxisID = vlistInqVarZaxis(vlistID, varID); + int timetype = vlistInqVarTimetype(vlistID, varID); + int gridindex = vlistGridIndex(vlistID, gridID); + size_t ncStepIndex = (size_t) streamptr->tsteps[tsID].ncStepIndex; + + int xid = CDI_UNDEFID, yid = CDI_UNDEFID; + if (gridInqType(gridID) == GRID_TRAJECTORY) + { + cdfReadGridTraj(streamptr, gridID); + } + else + { + xid = streamptr->ncgrid[gridindex].ncIDs[CDF_DIMID_X]; + yid = streamptr->ncgrid[gridindex].ncIDs[CDF_DIMID_Y]; + } + int zaxisindex = vlistZaxisIndex(vlistID, zaxisID); + int zid = streamptr->zaxisID[zaxisindex]; + + int ndims = 0; +#define addDimension(startCoord, length) \ + do \ + { \ + (*start)[ndims] = startCoord; \ + (*count)[ndims] = length; \ + ndims++; \ + } \ + while (0) + if (timetype != TIME_CONSTANT) addDimension(ncStepIndex, 1); + if (zid != CDI_UNDEFID) addDimension(0, (size_t) zaxisInqSize(zaxisID)); + if (yid != CDI_UNDEFID) addDimension(0, gridInqYsize(gridID)); + if (xid != CDI_UNDEFID) addDimension(0, gridInqXsize(gridID)); +#undef addDimension + + assert(ndims <= (int) (sizeof(*start) / sizeof(**start))); + assert(ndims <= (int) (sizeof(*count) / sizeof(**count))); + + if (CDI_Debug) + for (int idim = 0; idim < ndims; ++idim) Message("dim = %d start = %d count = %d", idim, start[idim], count[idim]); +} + +// Scans the data array for missVals, optionally applying first a scale factor and then an offset. +// Returns the number of missing + out-of-range values encountered. +static size_t +cdfDoInputDataTransformationDP(int vlistID, int varID, size_t valueCount, double *data) +{ + double missVal = vlistInqVarMissval(vlistID, varID); + int haveMissVal = vlistInqVarMissvalUsed(vlistID, varID); + double validRange[2]; + if (!(haveMissVal && vlistInqVarValidrange(vlistID, varID, validRange))) validRange[0] = DBL_MIN, validRange[1] = DBL_MAX; + double addoffset = 0.0, scalefactor = 1.0; + int haveAddoffset = (cdiInqKeyFloat(vlistID, varID, CDI_KEY_ADDOFFSET, &addoffset) == CDI_NOERR); + int haveScalefactor = (cdiInqKeyFloat(vlistID, varID, CDI_KEY_SCALEFACTOR, &scalefactor) == CDI_NOERR); + + bool missValIsNaN = DBL_IS_NAN(missVal); + size_t missValCount = 0; + + double validMin = validRange[0]; + double validMax = validRange[1]; + if (IS_EQUAL(validMin, VALIDMISS)) validMin = DBL_MIN; + if (IS_EQUAL(validMax, VALIDMISS)) validMax = DBL_MAX; + + int haveRangeCheck = (IS_NOT_EQUAL(validMax, DBL_MAX)) | (IS_NOT_EQUAL(validMin, DBL_MIN)); + assert(!haveRangeCheck || haveMissVal); + + switch (haveMissVal | (haveScalefactor << 1) | (haveAddoffset << 2) | (haveRangeCheck << 3)) + { + case 15: // haveRangeCheck & haveMissVal & haveScalefactor & haveAddoffset + for (size_t i = 0; i < valueCount; ++i) + { + int outOfRange = (data[i] < validMin || data[i] > validMax); + int isMissVal = DBL_IS_EQUAL(data[i], missVal); + missValCount += (size_t) (outOfRange | isMissVal); + data[i] = outOfRange ? missVal : isMissVal ? data[i] : data[i] * scalefactor + addoffset; + } + break; + case 13: // haveRangeCheck & haveMissVal & haveAddoffset + for (size_t i = 0; i < valueCount; ++i) + { + int outOfRange = (data[i] < validMin || data[i] > validMax); + int isMissVal = DBL_IS_EQUAL(data[i], missVal); + missValCount += (size_t) (outOfRange | isMissVal); + data[i] = outOfRange ? missVal : isMissVal ? data[i] : data[i] + addoffset; + } + break; + case 11: // haveRangeCheck & haveMissVal & haveScalefactor + for (size_t i = 0; i < valueCount; ++i) + { + int outOfRange = (data[i] < validMin || data[i] > validMax); + int isMissVal = DBL_IS_EQUAL(data[i], missVal); + missValCount += (size_t) (outOfRange | isMissVal); + data[i] = outOfRange ? missVal : isMissVal ? data[i] : data[i] * scalefactor; + } + break; + case 9: // haveRangeCheck & haveMissVal + for (size_t i = 0; i < valueCount; ++i) + { + int outOfRange = (data[i] < validMin || data[i] > validMax); + int isMissVal = DBL_IS_EQUAL(data[i], missVal); + missValCount += (size_t) (outOfRange | isMissVal); + data[i] = outOfRange ? missVal : data[i]; + } + break; + case 7: // haveMissVal & haveScalefactor & haveAddoffset + for (size_t i = 0; i < valueCount; ++i) + if (DBL_IS_EQUAL(data[i], missVal)) + missValCount++; + else + data[i] = data[i] * scalefactor + addoffset; + break; + case 6: // haveAddoffset & haveScalefactor + for (size_t i = 0; i < valueCount; ++i) data[i] = data[i] * scalefactor + addoffset; + break; + case 5: // haveMissVal & haveAddoffset + for (size_t i = 0; i < valueCount; ++i) + if (DBL_IS_EQUAL(data[i], missVal)) + missValCount++; + else + data[i] += addoffset; + break; + case 4: // haveAddoffset + for (size_t i = 0; i < valueCount; ++i) data[i] += addoffset; + break; + case 3: // haveMissVal & haveScalefactor + for (size_t i = 0; i < valueCount; ++i) + if (DBL_IS_EQUAL(data[i], missVal)) + missValCount++; + else + data[i] *= scalefactor; + break; + case 2: // haveScalefactor + for (size_t i = 0; i < valueCount; ++i) data[i] *= scalefactor; + break; + case 1: // haveMissVal + if (missValIsNaN) + { + for (size_t i = 0; i < valueCount; ++i) missValCount += (size_t) DBL_IS_NAN(data[i]); + } + else + { + for (size_t i = 0; i < valueCount; ++i) missValCount += (size_t) DBL_IS_EQUAL(data[i], missVal); + } + break; + } + + return missValCount; +} + +static size_t +cdfDoInputDataTransformationSP(int vlistID, int varID, size_t valueCount, float *data) +{ + double missVal = vlistInqVarMissval(vlistID, varID); + int haveMissVal = vlistInqVarMissvalUsed(vlistID, varID); + double validRange[2]; + if (!(haveMissVal && vlistInqVarValidrange(vlistID, varID, validRange))) validRange[0] = DBL_MIN, validRange[1] = DBL_MAX; + double addoffset = 0.0, scalefactor = 1.0; + int haveAddoffset = (cdiInqKeyFloat(vlistID, varID, CDI_KEY_ADDOFFSET, &addoffset) == CDI_NOERR); + int haveScalefactor = (cdiInqKeyFloat(vlistID, varID, CDI_KEY_SCALEFACTOR, &scalefactor) == CDI_NOERR); + + bool missValIsNaN = DBL_IS_NAN(missVal); + size_t missValCount = 0; + + double validMin = validRange[0]; + double validMax = validRange[1]; + if (IS_EQUAL(validMin, VALIDMISS)) validMin = DBL_MIN; + if (IS_EQUAL(validMax, VALIDMISS)) validMax = DBL_MAX; + + int haveRangeCheck = (IS_NOT_EQUAL(validMax, DBL_MAX)) | (IS_NOT_EQUAL(validMin, DBL_MIN)); + assert(!haveRangeCheck || haveMissVal); + + switch (haveMissVal | (haveScalefactor << 1) | (haveAddoffset << 2) | (haveRangeCheck << 3)) + { + case 15: // haveRangeCheck & haveMissVal & haveScalefactor & haveAddoffset + for (size_t i = 0; i < valueCount; ++i) + { + int outOfRange = (data[i] < validMin || data[i] > validMax); + int isMissVal = DBL_IS_EQUAL(data[i], missVal); + missValCount += (size_t) (outOfRange | isMissVal); + data[i] = outOfRange ? (float) missVal : isMissVal ? data[i] : (float) (data[i] * scalefactor + addoffset); + } + break; + case 13: // haveRangeCheck & haveMissVal & haveAddoffset + for (size_t i = 0; i < valueCount; ++i) + { + int outOfRange = (data[i] < validMin || data[i] > validMax); + int isMissVal = DBL_IS_EQUAL(data[i], missVal); + missValCount += (size_t) (outOfRange | isMissVal); + data[i] = outOfRange ? (float) missVal : isMissVal ? data[i] : (float) (data[i] + addoffset); + } + break; + case 11: // haveRangeCheck & haveMissVal & haveScalefactor + for (size_t i = 0; i < valueCount; ++i) + { + int outOfRange = (data[i] < validMin || data[i] > validMax); + int isMissVal = DBL_IS_EQUAL(data[i], missVal); + missValCount += (size_t) (outOfRange | isMissVal); + data[i] = outOfRange ? (float) missVal : isMissVal ? data[i] : (float) (data[i] * scalefactor); + } + break; + case 9: // haveRangeCheck & haveMissVal + for (size_t i = 0; i < valueCount; ++i) + { + int outOfRange = (data[i] < validMin || data[i] > validMax); + int isMissVal = DBL_IS_EQUAL(data[i], missVal); + missValCount += (size_t) (outOfRange | isMissVal); + data[i] = outOfRange ? (float) missVal : data[i]; + } + break; + case 7: // haveMissVal & haveScalefactor & haveAddoffset + for (size_t i = 0; i < valueCount; ++i) + if (DBL_IS_EQUAL(data[i], missVal)) + missValCount++; + else + data[i] = (float) (data[i] * scalefactor + addoffset); + break; + case 6: // haveAddoffset & haveScalefactor + for (size_t i = 0; i < valueCount; ++i) data[i] = (float) (data[i] * scalefactor + addoffset); + break; + case 5: // haveMissVal & haveAddoffset + for (size_t i = 0; i < valueCount; ++i) + if (DBL_IS_EQUAL(data[i], missVal)) + missValCount++; + else + data[i] = (float) (data[i] + addoffset); + break; + case 4: // haveAddoffset + for (size_t i = 0; i < valueCount; ++i) data[i] = (float) (data[i] + addoffset); + break; + case 3: // haveMissVal & haveScalefactor + for (size_t i = 0; i < valueCount; ++i) + if (DBL_IS_EQUAL(data[i], missVal)) + missValCount++; + else + data[i] = (float) (data[i] * scalefactor); + break; + case 2: // haveScalefactor + for (size_t i = 0; i < valueCount; ++i) data[i] = (float) (data[i] * scalefactor); + break; + case 1: // haveMissVal + if (missValIsNaN) + { + for (size_t i = 0; i < valueCount; ++i) missValCount += (size_t) DBL_IS_NAN(data[i]); + } + else + { + for (size_t i = 0; i < valueCount; ++i) missValCount += (size_t) DBL_IS_EQUAL(data[i], missVal); + } + break; + } + + return missValCount; +} + +static size_t +min_size(size_t a, size_t b) +{ + return a < b ? a : b; +} + +static void +transpose2dArrayDP(int gridId, double *data) +{ + size_t inWidth = gridInqYsize(gridId); + size_t inHeight = gridInqXsize(gridId); + + size_t cacheBlockSize = 256; // Purely an optimization parameter. Current value of 32 means we are handling 8kB blocks, + // which should be a decent compromise on many architectures. + double **out = (double **) malloc(inWidth * sizeof(double *)); + double **temp = (double **) malloc(inHeight * sizeof(double *)); + temp[0] = (double *) malloc(inHeight * inWidth * sizeof(double)); + memcpy(temp[0], data, inHeight * inWidth * sizeof(double)); + for (size_t i = 0; i < inWidth; ++i) out[i] = data + (inHeight * i); + for (size_t i = 1; i < inHeight; ++i) temp[i] = temp[0] + (inWidth * i); + + /* + for (size_t y = 0; y < inHeight; ++y) + for (size_t x = 0; x < inWidth; ++x) + out[x][y] = temp[y][x]; + */ + + for (size_t yBlock = 0; yBlock < inHeight; yBlock += cacheBlockSize) + for (size_t xBlock = 0; xBlock < inWidth; xBlock += cacheBlockSize) + for (size_t y = yBlock, yEnd = min_size(yBlock + cacheBlockSize, inHeight); y < yEnd; y++) + for (size_t x = xBlock, xEnd = min_size(xBlock + cacheBlockSize, inWidth); x < xEnd; x++) + { + out[x][y] = temp[y][x]; + } + + free(out); + free(temp[0]); + free(temp); +} + +static void +transpose2dArraySP(size_t gridId, float *data) +{ + size_t inWidth = gridInqYsize(gridId); + size_t inHeight = gridInqXsize(gridId); + + size_t cacheBlockSize = 256; // Purely an optimization parameter. Current value of 32 means we are handling 8kB blocks, + // which should be a decent compromise on many architectures. + float **out = (float **) malloc(inWidth * sizeof(float *)); + float **temp = (float **) malloc(inHeight * sizeof(float *)); + temp[0] = (float *) malloc(inHeight * inWidth * sizeof(float)); + memcpy(temp[0], data, inHeight * inWidth * sizeof(float)); + for (size_t i = 0; i < inWidth; i++) out[i] = data + (inHeight * i); + for (size_t i = 1; i < inHeight; i++) temp[i] = temp[0] + (inWidth * i); + + /* + for (size_t y = 0; y < inHeight; ++y) + for (size_t x = 0; x < inWidth; ++x) + out[x][y] = temp[y][x]; + */ + + for (size_t yBlock = 0; yBlock < inHeight; yBlock += cacheBlockSize) + for (size_t xBlock = 0; xBlock < inWidth; xBlock += cacheBlockSize) + for (size_t y = yBlock, yEnd = min_size(yBlock + cacheBlockSize, inHeight); y < yEnd; y++) + for (size_t x = xBlock, xEnd = min_size(xBlock + cacheBlockSize, inWidth); x < xEnd; x++) + { + out[x][y] = temp[y][x]; + } + + free(out); + free(temp[0]); + free(temp); +} + +static void +cdf_inq_dimIds(stream_t *streamptr, int varId, int (*outDimIds)[4]) +{ + int vlistID = streamptr->vlistID; + int gridId = vlistInqVarGrid(vlistID, varId); + int gridindex = vlistGridIndex(vlistID, gridId); + const int *ncIDs = streamptr->ncgrid[gridindex].ncIDs; + + switch (gridInqType(gridId)) + { + case GRID_TRAJECTORY: cdfReadGridTraj(streamptr, gridId); break; + case GRID_UNSTRUCTURED: + (*outDimIds)[0] = ncIDs[CDF_DIMID_X]; + (*outDimIds)[3] = ncIDs[CDF_DIMID_E]; // used only for cube_sphere grids + if ((*outDimIds)[3] != CDI_UNDEFID) (*outDimIds)[1] = ncIDs[CDF_DIMID_Y]; // used only for cube_sphere grids + break; + case GRID_GAUSSIAN_REDUCED: (*outDimIds)[0] = ncIDs[CDF_DIMID_X]; break; + default: + (*outDimIds)[0] = ncIDs[CDF_DIMID_X]; + (*outDimIds)[1] = ncIDs[CDF_DIMID_Y]; + break; + } + + int zaxisID = vlistInqVarZaxis(vlistID, varId); + int zaxisindex = vlistZaxisIndex(vlistID, zaxisID); + (*outDimIds)[2] = streamptr->zaxisID[zaxisindex]; +} + +static size_t +stream_inq_dimlen(stream_t *streamptr, int dimid) +{ + int ndims = streamptr->ncNumDims; + int *ncdimid = streamptr->ncDimID; + size_t *ncdimlen = streamptr->ncDimLen; + for (int i = 0; i < ndims; ++i) + { + if (dimid == ncdimid[i]) return ncdimlen[i]; + } + + size_t size = 0; + int fileId = streamptr->fileID; + cdf_inq_dimlen(fileId, dimid, &size); + return size; +} + +static int +stream_get_skip_dim(stream_t *streamptr, int ncvarid, int dimIds[3]) +{ + if (dimIds[0] != CDI_UNDEFID || dimIds[1] != CDI_UNDEFID) return 0; + + int fileId = streamptr->fileID; + int nvdims; + cdf_inq_varndims(fileId, ncvarid, &nvdims); + if (nvdims != 3) return 0; + + int varDimIds[3] = { -1, -1, -1 }; + cdf_inq_vardimid(fileId, ncvarid, varDimIds); + + if (dimIds[2] == varDimIds[2]) + { + if (stream_inq_dimlen(streamptr, varDimIds[1]) == 1) return 1; + } + else if (dimIds[2] == varDimIds[1]) + { + if (stream_inq_dimlen(streamptr, varDimIds[2]) == 1) return 2; + } + + return 0; +} + +enum +{ + cdfSliceNDim = MAX_DIMENSIONS +}; + +static void +cdfGetSliceSlapDescription(stream_t *streamptr, int varID, int levelID, bool *outSwapXY, size_t start[cdfSliceNDim], + size_t count[cdfSliceNDim]) +{ + int tsID = streamptr->curTsID; + int fileId = streamptr->fileID; + int vlistID = streamptr->vlistID; + int ncvarid = streamptr->vars[varID].ncvarid; + size_t ncStepIndex = (size_t) streamptr->tsteps[tsID].ncStepIndex; + + int gridId = vlistInqVarGrid(vlistID, varID); + int timetype = vlistInqVarTimetype(vlistID, varID); + size_t gridsize = gridInqSize(gridId); + + streamptr->numvals += gridsize; + + int dimIds[4] = { -1, -1, -1, -1 }; // this array joins the old variables xid, yid, and zid + cdf_inq_dimIds(streamptr, varID, &dimIds); + + int skipdim = stream_get_skip_dim(streamptr, ncvarid, dimIds); + + int dimorder[4] = { 3, 4, 2, 1 }; // order of cube sphere grid + if (dimIds[3] == CDI_UNDEFID) + { + int tmpdimorder[3]; + vlistInqVarDimorder(vlistID, varID, tmpdimorder); + for (int i = 0; i < 3; ++i) dimorder[i] = tmpdimorder[i]; + dimorder[3] = 4; + *outSwapXY = ((dimorder[2] == 2 || dimorder[0] == 1) && (dimIds[0] != CDI_UNDEFID) && (dimIds[1] != CDI_UNDEFID)); + } + + int ndims = 0; + +#define addDimension(startIndex, extent) \ + do \ + { \ + start[ndims] = startIndex; \ + count[ndims] = extent; \ + ndims++; \ + } \ + while (0) + + if (timetype != TIME_CONSTANT) addDimension(ncStepIndex, 1); + if (skipdim == 1) addDimension(0, 1); + + int gridindex = vlistGridIndex(vlistID, gridId); + const ncgrid_t *ncGrid = &streamptr->ncgrid[gridindex]; + bool readPart = (ncGrid->gridID == gridId && ncGrid->start != -1 && ncGrid->count != -1); + + for (int id = 0; id < 4; ++id) + { + int curDimId = dimIds[dimorder[id] - 1]; + if (curDimId == CDI_UNDEFID) continue; + switch (dimorder[id]) + { + case 1: + case 2: + case 4: + if (readPart && curDimId == dimIds[0]) + addDimension(ncGrid->start, ncGrid->count); + else + addDimension(0, stream_inq_dimlen(streamptr, curDimId)); + break; + case 3: addDimension((size_t) levelID, 1); break; + default: Error("Internal errror: Malformed dimension order encountered. Please report this bug."); + } + } + + if (skipdim == 2) addDimension(0, 1); + + assert(ndims <= cdfSliceNDim); + +#undef addDimension + + if (CDI_Debug) + for (int idim = 0; idim < ndims; ++idim) Message("dim = %d start = %zu count = %zu", idim, start[idim], count[idim]); + + int nvdims; + cdf_inq_varndims(fileId, ncvarid, &nvdims); + + if (nvdims != ndims) + { + char name[CDI_MAX_NAME]; + vlistInqVarName(vlistID, varID, name); + Error("Internal error, variable %s has an unsupported array structure!", name); + } +} + +static size_t +getSizeVar3D(int vlistID, int varID) +{ + int gridID = vlistInqVarGrid(vlistID, varID); + int zaxisID = vlistInqVarZaxis(vlistID, varID); + return gridInqSize(gridID) * (size_t) zaxisInqSize(zaxisID); +} + +static void +cdfReadDataSliceSP2DP(int fileID, int ncvarid, size_t length, size_t start[MAX_DIMENSIONS], size_t count[MAX_DIMENSIONS], + double *data) +{ + float *data_fp = (float *) Malloc(length * sizeof(*data_fp)); + cdf_get_vara_float(fileID, ncvarid, start, count, data_fp); + for (size_t i = 0; i < length; ++i) data[i] = (double) data_fp[i]; + Free(data_fp); +} + +static void +cdfReadDataSliceDP2SP(int fileID, int ncvarid, size_t length, size_t start[MAX_DIMENSIONS], size_t count[MAX_DIMENSIONS], + float *data) +{ + double *data_dp = (double *) Malloc(length * sizeof(*data_dp)); + cdf_get_vara_double(fileID, ncvarid, start, count, data_dp); + for (size_t i = 0; i < length; ++i) data[i] = (float) data_dp[i]; + Free(data_dp); +} + +static void +cdfCheckDataDP_UINT8(int fileID, int ncvarid, int vlistID, int varID, size_t length, double *data) +{ + if (vlistInqVarDatatype(vlistID, varID) == CDI_DATATYPE_UINT8) + { + nc_type xtype; + cdf_inq_vartype(fileID, ncvarid, &xtype); + if (xtype == NC_BYTE) + { + for (size_t i = 0; i < length; ++i) + if (data[i] < 0) data[i] += 256; + } + } +} + +static void +cdfCheckDataSP_UINT8(int fileID, int ncvarid, int vlistID, int varID, size_t length, float *data) +{ + if (vlistInqVarDatatype(vlistID, varID) == CDI_DATATYPE_UINT8) + { + nc_type xtype; + cdf_inq_vartype(fileID, ncvarid, &xtype); + if (xtype == NC_BYTE) + { + for (size_t i = 0; i < length; ++i) + if (data[i] < 0) data[i] += 256; + } + } +} + +static void +cdfReadDataDP(stream_t *streamptr, int varID, size_t length, size_t start[MAX_DIMENSIONS], size_t count[MAX_DIMENSIONS], + double *data) +{ + int vlistID = streamptr->vlistID; + int fileID = streamptr->fileID; + int ncvarid = streamptr->vars[varID].ncvarid; + int datatype = vlistInqVarDatatype(vlistID, varID); + + if (datatype == CDI_DATATYPE_CPX32 || datatype == CDI_DATATYPE_CPX64) + { + cdf_get_vara(fileID, ncvarid, start, count, data); + if (datatype == CDI_DATATYPE_CPX32) + { + for (long i = (long) length - 1; i >= 0; --i) + { + data[2 * i] = (double) (((float *) data)[2 * i]); + data[2 * i + 1] = (double) (((float *) data)[2 * i + 1]); + } + } + } + else + { + if (datatype == CDI_DATATYPE_FLT32) + { + cdfReadDataSliceSP2DP(fileID, ncvarid, length, start, count, data); + } + else + { + cdf_get_vara_double(fileID, ncvarid, start, count, data); + + cdfCheckDataDP_UINT8(fileID, ncvarid, vlistID, varID, length, data); + } + } +} + +static void +cdfReadDataSP(stream_t *streamptr, int varID, size_t length, size_t start[MAX_DIMENSIONS], size_t count[MAX_DIMENSIONS], + float *data) +{ + int vlistID = streamptr->vlistID; + int fileID = streamptr->fileID; + int ncvarid = streamptr->vars[varID].ncvarid; + int datatype = vlistInqVarDatatype(vlistID, varID); + + if (datatype == CDI_DATATYPE_CPX32 || datatype == CDI_DATATYPE_CPX64) + { + if (datatype == CDI_DATATYPE_CPX64) + { + double *cdata = (double *) Malloc(2 * length * sizeof(double)); + cdf_get_vara(fileID, ncvarid, start, count, cdata); + for (size_t i = 0; i < length; ++i) + { + data[2 * i] = (float) (cdata[2 * i]); + data[2 * i + 1] = (float) (cdata[2 * i + 1]); + } + Free(cdata); + } + else + { + cdf_get_vara(fileID, ncvarid, start, count, data); + } + } + else + { + if (datatype == CDI_DATATYPE_FLT64) + { + cdfReadDataSliceDP2SP(fileID, ncvarid, length, start, count, data); + } + else + { + cdf_get_vara_float(fileID, ncvarid, start, count, data); + + cdfCheckDataSP_UINT8(fileID, ncvarid, vlistID, varID, length, data); + } + } +} + +static void +cdfReadVarDP(stream_t *streamptr, int varID, double *data, size_t *nmiss) +{ + if (CDI_Debug) Message("streamID = %d varID = %d", streamptr->self, varID); + + int vlistID = streamptr->vlistID; + + size_t start[MAX_DIMENSIONS], count[MAX_DIMENSIONS]; + cdfGetSlapDescription(streamptr, varID, &start, &count); + + size_t length = getSizeVar3D(vlistID, varID); + cdfReadDataDP(streamptr, varID, length, start, count, data); + + *nmiss = cdfDoInputDataTransformationDP(vlistID, varID, length, data); +} + +static void +cdfReadVarSP(stream_t *streamptr, int varID, float *data, size_t *nmiss) +{ + if (CDI_Debug) Message("streamID = %d varID = %d", streamptr->self, varID); + + int vlistID = streamptr->vlistID; + + size_t start[MAX_DIMENSIONS], count[MAX_DIMENSIONS]; + cdfGetSlapDescription(streamptr, varID, &start, &count); + + size_t length = getSizeVar3D(vlistID, varID); + cdfReadDataSP(streamptr, varID, length, start, count, data); + + *nmiss = cdfDoInputDataTransformationSP(vlistID, varID, length, data); +} + +void +cdf_read_var(stream_t *streamptr, int varID, int memtype, void *data, size_t *nmiss) +{ + if (memtype == MEMTYPE_DOUBLE) + cdfReadVarDP(streamptr, varID, (double *) data, nmiss); + else + cdfReadVarSP(streamptr, varID, (float *) data, nmiss); +} + +static void +cdfReadVarSliceDP(stream_t *streamptr, int varID, int levelID, double *data, size_t *nmiss) +{ + if (CDI_Debug) Message("streamID = %d varID = %d levelID = %d", streamptr->self, varID, levelID); + + bool swapxy = false; + size_t start[cdfSliceNDim], count[cdfSliceNDim]; + cdfGetSliceSlapDescription(streamptr, varID, levelID, &swapxy, start, count); + + int vlistID = streamptr->vlistID; + int gridId = vlistInqVarGrid(vlistID, varID); + size_t length = gridInqSize(gridId); + cdfReadDataDP(streamptr, varID, length, start, count, data); + + if (swapxy) transpose2dArrayDP(gridId, data); + + *nmiss = cdfDoInputDataTransformationDP(vlistID, varID, length, data); +} + +static void +cdfReadVarSliceSP(stream_t *streamptr, int varID, int levelID, float *data, size_t *nmiss) +{ + if (CDI_Debug) Message("streamID = %d varID = %d levelID = %d", streamptr->self, varID, levelID); + + bool swapxy = false; + size_t start[cdfSliceNDim], count[cdfSliceNDim]; + cdfGetSliceSlapDescription(streamptr, varID, levelID, &swapxy, start, count); + + int vlistID = streamptr->vlistID; + int gridId = vlistInqVarGrid(vlistID, varID); + size_t length = gridInqSize(gridId); + cdfReadDataSP(streamptr, varID, length, start, count, data); + + if (swapxy) transpose2dArraySP(gridId, data); + + *nmiss = cdfDoInputDataTransformationSP(vlistID, varID, length, data); +} + +void +cdf_read_var_slice(stream_t *streamptr, int varID, int levelID, int memtype, void *data, size_t *nmiss) +{ + if (memtype == MEMTYPE_DOUBLE) + cdfReadVarSliceDP(streamptr, varID, levelID, (double *) data, nmiss); + else + cdfReadVarSliceSP(streamptr, varID, levelID, (float *) data, nmiss); +} + +void +cdf_read_record(stream_t *streamptr, int memtype, void *data, size_t *nmiss) +{ + if (CDI_Debug) Message("streamID = %d", streamptr->self); + + int tsID = streamptr->curTsID; + int vrecID = streamptr->tsteps[tsID].curRecID; + int recID = streamptr->tsteps[tsID].recIDs[vrecID]; + int varID = streamptr->tsteps[tsID].records[recID].varID; + int levelID = streamptr->tsteps[tsID].records[recID].levelID; + + if (memtype == MEMTYPE_DOUBLE) + cdfReadVarSliceDP(streamptr, varID, levelID, (double *) data, nmiss); + else + cdfReadVarSliceSP(streamptr, varID, levelID, (float *) data, nmiss); +} + +//---------------------------------------------------------------------------- +// Parallel Version +//---------------------------------------------------------------------------- + +void +cdfReadVarSliceDPPart(stream_t *streamptr, int varID, int levelID, int varType, int startpoint, size_t length, double *data, + size_t *nmiss) +{ + (void) (varType); + + if (CDI_Debug) Message("streamID = %d varID = %d levelID = %d", streamptr->self, varID, levelID); + + int vlistID = streamptr->vlistID; + + bool swapxy = false; + size_t start[cdfSliceNDim], count[cdfSliceNDim]; + cdfGetSliceSlapDescription(streamptr, varID, levelID, &swapxy, start, count); + + int gridId = vlistInqVarGrid(vlistID, varID); + size_t gridsize = gridInqSize(gridId); + + unsigned int position = 0; + for (int i = 0; i < MAX_DIMENSIONS; ++i) + if (count[i] == gridsize) position = i; + + start[position] = start[position] + startpoint; + count[position] = length; + + cdfReadDataDP(streamptr, varID, length, start, count, data); + + if (swapxy) transpose2dArrayDP(gridId, data); + + *nmiss = cdfDoInputDataTransformationDP(vlistID, varID, length, data); +} + +void +cdfReadVarSliceSPPart(stream_t *streamptr, int varID, int levelID, int varType, int startpoint, size_t length, float *data, + size_t *nmiss) +{ + (void) (varType); + + if (CDI_Debug) Message("streamID = %d varID = %d levelID = %d", streamptr->self, varID, levelID); + + int vlistID = streamptr->vlistID; + + bool swapxy = false; + size_t start[cdfSliceNDim], count[cdfSliceNDim]; + cdfGetSliceSlapDescription(streamptr, varID, levelID, &swapxy, start, count); + + int gridId = vlistInqVarGrid(vlistID, varID); + size_t gridsize = gridInqSize(gridId); + + unsigned int position = 0; + for (int i = 0; i < MAX_DIMENSIONS; ++i) + if (count[i] == gridsize) position = i; + + start[position] = start[position] + startpoint; + count[position] = length; + + cdfReadDataSP(streamptr, varID, length, start, count, data); + + if (swapxy) transpose2dArraySP(gridId, data); + + *nmiss = cdfDoInputDataTransformationSP(vlistID, varID, length, data); +} + +static int +cdiStreamReadVarSlicePart(int streamID, int varID, int levelID, int varType, int start, size_t size, int memtype, void *data, + size_t *nmiss) +{ + int status = 0; + + if (CDI_Debug) Message("streamID = %d varID = %d", streamID, varID); + + check_parg(data); + check_parg(nmiss); + + stream_t *streamptr = stream_to_pointer(streamID); + int filetype = streamptr->filetype; + + *nmiss = 0; + + // currently we only care for netcdf data + switch (cdiBaseFiletype(filetype)) + { +#ifdef HAVE_LIBGRIB + case CDI_FILETYPE_GRB: + case CDI_FILETYPE_GRB2: + { + grb_read_var_slice(streamptr, varID, levelID, memtype, data, nmiss); + break; + } +#endif +#ifdef HAVE_LIBNETCDF + case CDI_FILETYPE_NETCDF: + { + if (memtype == MEMTYPE_FLOAT) + cdfReadVarSliceSPPart(streamptr, varID, levelID, varType, start, size, (float *) data, nmiss); + else + cdfReadVarSliceDPPart(streamptr, varID, levelID, varType, start, size, (double *) data, nmiss); + break; + } +#endif + default: + { + Error("%s support not compiled in!", strfiletype(filetype)); + status = 2; + break; + } + } + + return status; +} + +void +cdfReadVarDPPart(stream_t *streamptr, int varID, int varType, int startpoint, size_t length, double *data, size_t *nmiss) +{ + (void) (varType); + if (CDI_Debug) Message("streamID = %d varID = %d", streamptr->self, varID); + + int vlistID = streamptr->vlistID; + int ncvarid = streamptr->vars[varID].ncvarid; + + size_t start[MAX_DIMENSIONS], count[MAX_DIMENSIONS]; + cdfGetSlapDescription(streamptr, varID, &start, &count); + + int ltime = (TIME_CONSTANT != vlistInqVarTimetype(vlistID, varID)); + start[1 + ltime] = start[1 + ltime] + startpoint; + count[1 + ltime] = length; + + cdf_get_vara_double(streamptr->fileID, ncvarid, start, count, data); + + *nmiss = cdfDoInputDataTransformationDP(vlistID, varID, length, data); +} + +void +cdfReadVarSPPart(stream_t *streamptr, int varID, int varType, int startpoint, size_t length, float *data, size_t *nmiss) +{ + (void) (varType); + if (CDI_Debug) Message("streamID = %d varID = %d", streamptr->self, varID); + + int vlistID = streamptr->vlistID; + int ncvarid = streamptr->vars[varID].ncvarid; + + size_t start[MAX_DIMENSIONS], count[MAX_DIMENSIONS]; + cdfGetSlapDescription(streamptr, varID, &start, &count); + + int ltime = (TIME_CONSTANT != vlistInqVarTimetype(vlistID, varID)); + start[1 + ltime] = start[1 + ltime] + startpoint; + count[1 + ltime] = length; + + cdf_get_vara_float(streamptr->fileID, ncvarid, start, count, data); + + *nmiss = cdfDoInputDataTransformationSP(vlistID, varID, length, data); +} + +static void +cdiStreamReadVarPart(int streamID, int varID, int varType, int start, size_t size, int memtype, void *data, size_t *nmiss) +{ + (void) (varType); + if (CDI_Debug) Message("streamID = %d varID = %d", streamID, varID); + + check_parg(data); + check_parg(nmiss); + + stream_t *streamptr = stream_to_pointer(streamID); + int filetype = streamptr->filetype; + + *nmiss = 0; + + // currently we only care for netcdf data + switch (cdiBaseFiletype(filetype)) + { +#ifdef HAVE_LIBGRIB + case CDI_FILETYPE_GRB: + case CDI_FILETYPE_GRB2: + { + grb_read_var(streamptr, varID, memtype, data, nmiss); + break; + } +#endif +#ifdef HAVE_LIBNETCDF + case CDI_FILETYPE_NETCDF: + { + if (memtype == MEMTYPE_FLOAT) + cdfReadVarSPPart(streamptr, varID, varType, start, size, (float *) data, nmiss); + else + cdfReadVarDPPart(streamptr, varID, varType, start, size, (double *) data, nmiss); + + break; + } +#endif + default: + { + Error("%s support not compiled in!", strfiletype(filetype)); + break; + } + } +} + +void +streamReadVarSlicePart(int streamID, int varID, int levelID, int varType, int start, SizeType size, void *data, SizeType *nmiss, + int memtype) +{ + size_t numMiss = 0; + if (cdiStreamReadVarSlicePart(streamID, varID, levelID, varType, start, size, memtype, data, &numMiss)) + { + Error("Unexpected error returned from cdiStreamReadVarSlicePart()!"); + } + *nmiss = (SizeType) numMiss; +} + +void +streamReadVarPart(int streamID, int varID, int varType, int start, SizeType size, void *data, SizeType *nmiss, int memtype) +{ + size_t numMiss = 0; + cdiStreamReadVarPart(streamID, varID, varType, start, size, memtype, data, &numMiss); + *nmiss = (SizeType) numMiss; +} + +#endif /* HAVE_LIBNETCDF */ +/* Subroutines and data structures for storing "subtypes". */ +/* */ +/* A subtype is, for example, a list of TILES. This can be interpreted */ +/* as an additional axis like the vertical axis. */ +/* */ +/* @author 02/2015 F. Prill, DWD */ +/* */ +/* DATA LAYOUT: */ +/* */ +/* A subtype contains several "subtype entries", each of which */ +/* contains a linked list of subtype attributes. */ +/* */ +/* The number of subtype entries is not specified in advance, but the */ +/* list of entries is itself dynamically growing. There is no */ +/* guaranteed ordering of the entries, therefore each entry must be */ +/* identifiable by its attributes. */ +/* */ +/* [subtype_t] */ +/* | */ +/* |------- globals [subtype_entry_t] */ +/* | |--- atts [subtype_attr_t] */ +/* | */ +/* |------- entries */ +/* |- entry #0 */ +/* | |--- atts [subtype_attr_t] */ +/* |- entry #1 */ +/* | |--- atts [subtype_attr_t] */ +/* |- entry #2 */ +/* . |--- atts [subtype_attr_t] */ +/* . */ + + +/* Literal constants corresponding to the different subtypes of the + enumeration "subtype_kind". */ +static const char *subtypeName[] = { "tileset" }; + +const char *const cdiSubtypeAttributeName[] = { "tileIndex", "totalNumberOfTileAttributePairs", "tileClassification", + "numberOfTiles", "numberOfTileAttributes", "tileAttribute" }; + +/* prototypes: */ +static int subtypeCompareP(subtype_t *z1, subtype_t *z2); +static void subtypeDestroyP(void *subtype_ptr); +static void subtypePrintP(void *subtype_ptr, FILE *fp); +static int subtypeGetPackSize(void *subtype_ptr, void *context); +static void subtypePack(void *subtype_ptr, void *buffer, int size, int *pos, void *context); +static int subtypeTxCode(void *subtype_ptr); + +static const resOps subtypeOps = { (int (*)(void *, void *)) subtypeCompareP, + (void (*)(void *)) subtypeDestroyP, + (void (*)(void *, FILE *)) subtypePrintP, + (int (*)(void *, void *)) subtypeGetPackSize, + subtypePack, + subtypeTxCode }; + +enum +{ + differ = 1, +}; + +/* ------------------------------------------------------------------- */ +/* SUBROUTINES FOR ATTRIBUTE LISTS */ +/* ------------------------------------------------------------------- */ + +static int +attribute_to_index(const char *key) +{ + if (key == NULL) Error("Internal error!"); + for (int i = 0; i < nSubtypeAttributes; i++) + if (str_is_equal(key, cdiSubtypeAttributeName[i])) return i; + return -1; +} + +/* + @Function subtypeAttrNewList + @Title Create new linked list of subtype attributes. + @EndFunction +*/ +static struct subtype_attr_t * +subtypeAttrNewList(struct subtype_entry_t *head, int key, int val) +{ + if (head == NULL) Error("Internal error!"); + struct subtype_attr_t *ptr = (struct subtype_attr_t *) Malloc(sizeof(struct subtype_attr_t)); + if (NULL == ptr) Error("Node creation failed"); + ptr->key = key; + ptr->val = val; + ptr->next = NULL; + + head->atts = ptr; + return ptr; +} + +/* + @Function subtypeAttrInsert + + @Title Add subtype attribute to linked list, s.t. the result is a + smallest-to-largest ordered list. + @EndFunction +*/ +static struct subtype_attr_t * +subtypeAttrInsert(struct subtype_entry_t *head, int key, int val) +{ + if (head == NULL) Error("Internal error!"); + if (head->atts == NULL) return (subtypeAttrNewList(head, key, val)); + + /* create new attribute */ + struct subtype_attr_t *ptr = (struct subtype_attr_t *) Malloc(sizeof(struct subtype_attr_t)); + if (NULL == ptr) Error("Node creation failed"); + + ptr->key = key; + ptr->val = val; + ptr->next = NULL; + + /* find the right place for insertion: */ + if (head->atts->key >= key) + { + /* insert at position 0 */ + ptr->next = head->atts; + head->atts = ptr; + } + else + { + struct subtype_attr_t **predec = &head->atts; + while (((*predec)->next != NULL) && ((*predec)->next->key < key)) + { + predec = &((*predec)->next); + } + ptr->next = (*predec)->next; + (*predec)->next = ptr; + } + return ptr; +} + +/* Recursively free a linked list with attributes. */ +static void +subtypeAttrDestroy(struct subtype_attr_t *head) +{ + if (head == NULL) return; + subtypeAttrDestroy(head->next); + Free(head); + head = NULL; +} + +/* Find an attribute in linked list by its key or return NULL + otherwise. */ +static struct subtype_attr_t * +subtypeAttrFind(struct subtype_attr_t *head, int key) +{ + if (head == NULL) + return NULL; + else if (head->key == key) + return head; + else + return subtypeAttrFind(head->next, key); +} + +/* Recursively compares two subtype attribute lists under the implicit + assumptions that both lists are ordered by their keys and that keys + are unique. */ +static int +subtypeAttsCompare(struct subtype_attr_t *a1, struct subtype_attr_t *a2) +{ + if ((a1 == NULL) && (a2 == NULL)) + return 0; + else if ((a1 == NULL) && (a2 != NULL)) + { + return differ; + } + else if ((a1 != NULL) && (a2 == NULL)) + { + return differ; + } + + if (a1->key != a2->key) + { + return differ; + } + if (a1->val != a2->val) return differ; + + return subtypeAttsCompare(a1->next, a2->next); +} + +/* (Recursively) duplicate linked list of attributes. */ +static void +subtypeAttsDuplicate(struct subtype_attr_t *a1, struct subtype_entry_t *dst) +{ + if (a1 == NULL) return; + /* duplicate "a1->key", "a1->val" */ + subtypeAttsDuplicate(a1->next, dst); + (void) subtypeAttrInsert(dst, a1->key, a1->val); +} + +/* ------------------------------------------------------------------- */ +/* SUBROUTINES FOR LIST OF ENTRIES */ +/* ------------------------------------------------------------------- */ + +/* + @Function subtypeEntryNewList + @Title Create new linked list of subtype entries. + @EndFunction +*/ +static struct subtype_entry_t * +subtypeEntryNewList(subtype_t *head) +{ + struct subtype_entry_t *ptr = (struct subtype_entry_t *) Malloc(sizeof(struct subtype_entry_t)); + if (NULL == ptr) Error("Node creation failed"); + ptr->atts = NULL; + ptr->next = NULL; + head->entries = ptr; + head->nentries = 0; + ptr->self = head->nentries++; + return ptr; +} + +/* + @Function subtypeEntryInsert + + @Title Add subtype entry to the head of a linked list. + @EndFunction +*/ +struct subtype_entry_t * +subtypeEntryInsert(subtype_t *head) +{ + if (head == NULL) Error("Internal error!"); + if (head->entries == NULL) return (subtypeEntryNewList(head)); + + /* create new entry */ + struct subtype_entry_t *ptr = (struct subtype_entry_t *) Malloc(sizeof(struct subtype_entry_t)); + if (NULL == ptr) Error("Node creation failed"); + + ptr->atts = NULL; + ptr->self = head->nentries++; + + /* find the right place for insertion: */ + if (head->entries->self >= ptr->self) + { + /* insert at position 0 */ + ptr->next = head->entries; + head->entries = ptr; + } + else + { + struct subtype_entry_t **predec = &head->entries; + while (((*predec)->next != NULL) && ((*predec)->next->self < ptr->self)) + { + predec = &((*predec)->next); + } + ptr->next = (*predec)->next; + (*predec)->next = ptr; + } + return ptr; +} + +/* + @Function subtypeEntryAppend + + @Title Append subtype entry to the end of a linked list. + @EndFunction +*/ +static struct subtype_entry_t * +subtypeEntryAppend(subtype_t *head) +{ + if (head == NULL) Error("Internal error!"); + if (head->entries == NULL) return (subtypeEntryNewList(head)); + + /* create new entry */ + struct subtype_entry_t *ptr = (struct subtype_entry_t *) Malloc(sizeof(struct subtype_entry_t)); + if (NULL == ptr) Error("Node creation failed"); + + ptr->atts = NULL; + ptr->next = NULL; + ptr->self = head->nentries++; + + /* find last position of linked list */ + struct subtype_entry_t *prec_ptr = head->entries; + while (prec_ptr->next != NULL) prec_ptr = prec_ptr->next; + + prec_ptr->next = ptr; + return ptr; +} + +/* Recursively free a list of subtype entries. */ +static void +subtypeEntryDestroy(struct subtype_entry_t *entry) +{ + if (entry == NULL) return; + subtypeEntryDestroy(entry->next); + subtypeAttrDestroy(entry->atts); + Free(entry); + entry = NULL; +} + +/* Compares two subtype entries. */ +static int +subtypeEntryCompare(struct subtype_entry_t *e1, struct subtype_entry_t *e2) +{ + if (e1 == NULL) Error("Internal error!"); + if (e2 == NULL) Error("Internal error!"); + return (e1->self == e2->self) && subtypeAttsCompare(e1->atts, e2->atts); +} + +/* (Recursively) duplicate list of entries. */ +static void +subtypeEntryDuplicate(struct subtype_entry_t *a1, subtype_t *dst) +{ + if (a1 == NULL) return; + /* append entry to dst pointer */ + struct subtype_entry_t *ptr = subtypeEntryAppend(dst); + /* duplicate attributes */ + subtypeAttsDuplicate(a1->atts, ptr); + ptr->self = a1->self; + /* call next link in linked list */ + subtypeEntryDuplicate(a1->next, dst); +} + +/* ------------------------------------------------------------------- */ +/* SUBROUTINES FOR THE SUBTYPE ITSELF */ +/* ------------------------------------------------------------------- */ + +/* Print-out subtype data structure together with its attributes. */ +static void +subtypePrintKernel(subtype_t *subtype_ptr, FILE *fp) +{ + if (subtype_ptr == NULL) Error("Internal error!"); + fprintf(fp, "# %s (subtype ID %d)\n", subtypeName[subtype_ptr->subtype], subtype_ptr->self); + /* print global attributes of this subtype */ + struct subtype_attr_t *ptr = subtype_ptr->globals.atts; + if (ptr != NULL) fprintf(fp, "#\n# global attributes:\n"); + while (ptr != NULL) + { + fprintf(fp, "# %-40s (%2d) : %d\n", cdiSubtypeAttributeName[ptr->key], ptr->key, ptr->val); + ptr = ptr->next; + } + /* print attributes for each subtype */ + fprintf(fp, "# %d local entries:\n", subtype_ptr->nentries); + struct subtype_entry_t *entry = subtype_ptr->entries; + while (entry != NULL) + { + fprintf(fp, "# subtype entry %d\n", entry->self); + ptr = entry->atts; + if (ptr != NULL) fprintf(fp, "# attributes:\n"); + while (ptr != NULL) + { + fprintf(fp, "# %-40s (%2d) : %d\n", cdiSubtypeAttributeName[ptr->key], ptr->key, ptr->val); + ptr = ptr->next; + } + entry = entry->next; + } + fprintf(fp, "\n"); +} + +/* Compares two subtype data structures. Pointer version of this + method. */ +static int +subtypeCompareP(subtype_t *s1, subtype_t *s2) +{ + xassert(s1 && s2); + if (s1->subtype != s2->subtype) return differ; + if (subtypeEntryCompare(&s1->globals, &s2->globals) != 0) return differ; + + struct subtype_entry_t *entry1 = s1->entries; + struct subtype_entry_t *entry2 = s2->entries; + while ((entry1 != NULL) && (entry2 != NULL)) + { + if (subtypeEntryCompare(entry1, entry2) != 0) return differ; + entry1 = entry1->next; + entry2 = entry2->next; + } + /* compare list lengths: */ + if ((entry1 != NULL) || (entry2 != NULL)) return differ; + return 0; +} + +/* Clean up data structure. */ +static void +subtypeDestroyP(void *ptr) +{ + subtype_t *subtype_ptr = (subtype_t *) ptr; + /* destroy global attributes */ + subtypeAttrDestroy(subtype_ptr->globals.atts); + /* destroy list of subtype entries */ + subtypeEntryDestroy(subtype_ptr->entries); + subtype_ptr->entries = NULL; + Free(subtype_ptr); + subtype_ptr = NULL; +} + +/* Non-static wrapper function for "subtypeDestroyP". */ +void +subtypeDestroyPtr(void *ptr) +{ + subtypeDestroyP(ptr); +} + +/* Non-static wrapper function for "subtypeCompareP". */ +int +subtypeComparePtr(int s1_ID, subtype_t *s2) +{ + subtype_t *subtype_ptr = (subtype_t *) reshGetVal(s1_ID, &subtypeOps); + if (subtype_ptr == NULL) Error("Internal error"); + return subtypeCompareP(subtype_ptr, s2); +} + +/* Print-out subtype data structure together with its attributes. + Pointer version of this method. */ +static void +subtypePrintP(void *subtype_ptr, FILE *fp) +{ + subtypePrintKernel((subtype_t *) subtype_ptr, fp); +} + +/* Print-out subtype data structure together with its attributes. */ +void +subtypePrintPtr(subtype_t *subtype_ptr) +{ + subtypePrintKernel(subtype_ptr, stdout); +} + +/* Fill subtype data structure with default values. */ +static void +subtypeDefaultValue(subtype_t *subtype_ptr) +{ + if (subtype_ptr == NULL) Error("Internal error!"); + subtype_ptr->self = CDI_UNDEFID; + subtype_ptr->nentries = 0; + subtype_ptr->entries = NULL; + subtype_ptr->globals.atts = NULL; + subtype_ptr->globals.next = NULL; + subtype_ptr->globals.self = -1; + subtype_ptr->active_subtype_index = 0; +} + +void +subtypeAllocate(subtype_t **subtype_ptr2, int subtype) +{ + /* allocate new subtype */ + (*subtype_ptr2) = (subtype_t *) Malloc(sizeof(subtype_t)); + subtype_t *subtype_ptr = *subtype_ptr2; + subtypeDefaultValue(subtype_ptr); + subtype_ptr->subtype = subtype; + subtype_ptr->self = CDI_UNDEFID; +} + +/* Create a copy of an existing subtype data structure. */ +void +subtypeDuplicate(subtype_t *subtype_ptr, subtype_t **dst_ptr) +{ + if (subtype_ptr == NULL) Error("Internal error!"); + subtypeAllocate(dst_ptr, subtype_ptr->subtype); + subtype_t *dst = (*dst_ptr); + /* create duplicate of subtype globals */ + subtypeAttsDuplicate(subtype_ptr->globals.atts, &dst->globals); + dst->globals.self = subtype_ptr->globals.self; + /* create duplicate of subtype entries */ + subtypeEntryDuplicate(subtype_ptr->entries, dst); +} + +/* Register subtype object at resource handler. */ +int +subtypePush(subtype_t *subtype_ptr) +{ + if (subtype_ptr == NULL) Error("Internal error!"); + subtype_ptr->self = reshPut(subtype_ptr, &subtypeOps); + return subtype_ptr->self; /* subtypeID */ +} + +/* Sets an attribute for a subtype (for example a set of TILES). If + the attribute has already been defined, then its value is + overwritten. */ +void +subtypeDefGlobalDataP(subtype_t *subtype_ptr, int key, int val) +{ + if (subtype_ptr == NULL) Error("Internal error!"); + /* find entry in linked list or append otherwise */ + struct subtype_attr_t *att_ptr = subtypeAttrFind(subtype_ptr->globals.atts, key); + if (att_ptr == NULL) + subtypeAttrInsert(&subtype_ptr->globals, key, val); + else + att_ptr->val = val; +} + +/* Sets an attribute for a subtype (for example a set of TILES). If + the attribute has already been defined, then its value is + overwritten. */ +void +subtypeDefGlobalData(int subtypeID, int key, int val) +{ + subtype_t *subtype_ptr = (subtype_t *) reshGetVal(subtypeID, &subtypeOps); + subtypeDefGlobalDataP(subtype_ptr, key, val); +} + +/* Retrieves an attribute for a subtype (for example a set of TILES). + If the attribute has not been defined, then return -1. */ +int +subtypeGetGlobalDataP(subtype_t *subtype_ptr, int key) +{ + if (subtype_ptr == NULL) Error("Internal error!"); + /* find entry in linked list */ + struct subtype_attr_t *att_ptr = subtypeAttrFind(subtype_ptr->globals.atts, key); + if (att_ptr == NULL) + return -1; + else + return att_ptr->val; +} + +/* Retrieves an attribute for a subtype (for example a set of TILES) . + If the attribute has not been defined, then return -1. */ +int +subtypeGetGlobalData(int subtypeID, int key) +{ + subtype_t *subtype_ptr = (subtype_t *) reshGetVal(subtypeID, &subtypeOps); + return subtypeGetGlobalDataP(subtype_ptr, key); +} + +/* Sets an attribute for a single subtype entry (e.g. a single TILE). + If the attribute has already been defined, then its value is + overwritten. */ +void +subtypeDefEntryDataP(struct subtype_entry_t *subtype_entry_ptr, int key, int val) +{ + if (subtype_entry_ptr == NULL) Error("Internal error!"); + /* find entry in linked list or append otherwise */ + struct subtype_attr_t *att_ptr = subtypeAttrFind(subtype_entry_ptr->atts, key); + if (att_ptr == NULL) + subtypeAttrInsert(subtype_entry_ptr, key, val); + else + att_ptr->val = val; +} + +/* ------------------------------------------------------------------- */ +/* IMPLEMENTATIONS FOR KEY-VALUE-PAIR QUERIES */ +/* ------------------------------------------------------------------- */ + +/* Generate a "query object" out of a key-value pair. */ +subtype_query_t +keyValuePair(const char *key, int value) +{ + subtype_query_t result; + result.nAND = 1; + result.key_value_pairs[0][0] = attribute_to_index(key); + result.key_value_pairs[1][0] = value; + if (CDI_Debug) Message("key %s matches %d", key, result.key_value_pairs[0][0]); + if (CDI_Debug) Message("%d --?-- %d", result.key_value_pairs[0][0], result.key_value_pairs[1][0]); + return result; +} + +/* Generate an AND-combined "query object" out of two previous query + objects. */ +subtype_query_t +matchAND(subtype_query_t q1, subtype_query_t q2) +{ + if ((q1.nAND + q2.nAND) > MAX_KV_PAIRS_MATCH) Error("Internal error"); + subtype_query_t result; + memset(&result, 0, sizeof(subtype_query_t)); + result.nAND = q1.nAND; + for (int i = 0; i < q1.nAND; i++) + { + result.key_value_pairs[0][i] = q1.key_value_pairs[0][i]; + result.key_value_pairs[1][i] = q1.key_value_pairs[1][i]; + } + for (int i = 0; i < q2.nAND; i++) + { + result.key_value_pairs[0][result.nAND] = q2.key_value_pairs[0][i]; + result.key_value_pairs[1][result.nAND] = q2.key_value_pairs[1][i]; + result.nAND++; + } + + if (CDI_Debug) Message("combined criterion:"); + if (CDI_Debug) + for (int i = 0; i < result.nAND; i++) Message("%d --?-- %d", result.key_value_pairs[0][i], result.key_value_pairs[1][i]); + + return result; +} + +/* ------------------------------------------------------------------- */ +/* SPECIFIC IMPLEMENTATIONS FOR TILE SETS */ +/* ------------------------------------------------------------------- */ + +/* Integrate tile set "s2" into the tile set "subtype1_ID": + + Insert all entries set 2 to set 1 together with its attributes. +*/ +void +tilesetInsertP(subtype_t *s1, subtype_t *s2) +{ + if (s1 == NULL) Error("Internal error!"); + if (s2 == NULL) Error("Internal error!"); + struct subtype_entry_t *entry1 = s1->entries, *entry2 = s2->entries; + struct subtype_attr_t *att_ptr2; + + /* test all entries of set 2 against set 1, to check if entry + already exists: */ + if (subtypeAttsCompare(s1->globals.atts, s2->globals.atts) != differ) + { + while (entry1 != NULL) + { + int found = 1; + entry2 = s2->entries; + while (entry2 != NULL) + { + found &= (subtypeAttsCompare(entry1->atts, entry2->atts) != differ); + entry2 = entry2->next; + } + if (found) + { + return; + } + entry1 = entry1->next; + } + + entry2 = s2->entries; + while (entry2 != NULL) + { + entry1 = subtypeEntryInsert(s1); + + att_ptr2 = entry2->atts; + while (att_ptr2 != NULL) + { + (void) subtypeAttrInsert(entry1, att_ptr2->key, att_ptr2->val); + att_ptr2 = att_ptr2->next; + } + entry2 = entry2->next; + } + } + else + { + fprintf(stderr, "\n# SUBTYPE A:\n"); + subtypePrintKernel(s1, stderr); + fprintf(stderr, "\n# SUBTYPE B:\n"); + subtypePrintKernel(s2, stderr); + Error("Attempting to insert subtype entry into subtype with different global attributes!"); + } +} + +/* ------------------------------------------------------------------- */ +/* IMPLEMENTATIONS FOR ROUTINES VISIBLE THROUGH CDI.H */ +/* ------------------------------------------------------------------- */ + +/* + @Function subtypeCreate + @Title Create a variable subtype + + @Prototype int subtypeCreate(int subtype) + @Parameter + @Item subtype The type of the variable subtype, one of the set of predefined CDI variable subtypes. + The valid CDI variable subtypes are @func{SUBTYPE_TILES} + + @Description + The function @func{subtypeCreate} creates a variable subtype. + + @Result + @func{subtypeCreate} returns an identifier to the variable subtype. + + @EndFunction +*/ +int +subtypeCreate(int subtype) +{ + if (CDI_Debug) Message("subtype: %d ", subtype); + + /* allocate new subtype */ + subtype_t *subtype_ptr; + subtypeAllocate(&subtype_ptr, subtype); + /* register object at resource handler */ + return subtypePush(subtype_ptr); +} + +/* Print-out subtype data structure together with its attributes. */ +void +subtypePrint(int subtypeID) +{ + subtype_t *subtype_ptr = (subtype_t *) reshGetVal(subtypeID, &subtypeOps); + subtypePrintKernel(subtype_ptr, stdout); +} + +/* Compares two subtype data structures. */ +int +subtypeCompare(int subtypeID1, int subtypeID2) +{ + subtype_t *subtype_ptr1 = (subtype_t *) reshGetVal(subtypeID1, &subtypeOps); + subtype_t *subtype_ptr2 = (subtype_t *) reshGetVal(subtypeID2, &subtypeOps); + return subtypeCompareP(subtype_ptr1, subtype_ptr2); +} + +/* Get the size of a subtype (e.g. no. of tiles). */ +int +subtypeInqSize(int subtypeID) +{ + if (subtypeID == CDI_UNDEFID) + { + return 0; + } + else + { + subtype_t *subtype_ptr = (subtype_t *) reshGetVal(subtypeID, &subtypeOps); + return subtype_ptr->nentries; + } +} + +/* Get the currently active index of a subtype (e.g. current tile index). */ +int +subtypeInqActiveIndex(int subtypeID) +{ + if (subtypeID == CDI_UNDEFID) return 0; + subtype_t *subtype_ptr = (subtype_t *) reshGetVal(subtypeID, &subtypeOps); + return subtype_ptr->active_subtype_index; +} + +/* Set the currently active index of a subtype (e.g. current tile index). */ +void +subtypeDefActiveIndex(int subtypeID, int index) +{ + subtype_t *subtype_ptr = (subtype_t *) reshGetVal(subtypeID, &subtypeOps); + subtype_ptr->active_subtype_index = index; +} + +/* subtypeInqSubEntry: Returns subtype entry ID for a given + criterion. */ +int +subtypeInqSubEntry(int subtypeID, subtype_query_t criterion) +{ + subtype_t *subtype_ptr = (subtype_t *) reshGetVal(subtypeID, &subtypeOps); + struct subtype_entry_t *entry = subtype_ptr->entries; + /* loop over all entries of this subtype */ + while (entry != NULL) + { + { + int match = 1; + /* test if this entry matches ALL criteria. */ + for (int j = 0; (j < criterion.nAND) && (match); j++) + { + if (CDI_Debug) + Message("check criterion %d : %d --?-- %d", j, criterion.key_value_pairs[0][j], criterion.key_value_pairs[1][j]); + struct subtype_attr_t *att_ptr = subtypeAttrFind(entry->atts, criterion.key_value_pairs[0][j]); + if (att_ptr == NULL) + { + match = 0; + if (CDI_Debug) Message("did not find %d", criterion.key_value_pairs[0][j]); + } + else + { + if (CDI_Debug) Message("found %d", criterion.key_value_pairs[0][j]); + match &= (att_ptr->val == criterion.key_value_pairs[1][j]); + } + } + if (match) return entry->self; + } + entry = entry->next; + } + return CDI_UNDEFID; +} + +int +subtypeInqTile(int subtypeID, int tileindex, int attribute) +{ + return subtypeInqSubEntry(subtypeID, matchAND(keyValuePair(cdiSubtypeAttributeName[SUBTYPE_ATT_TILEINDEX], tileindex), + keyValuePair(cdiSubtypeAttributeName[SUBTYPE_ATT_TILEATTRIBUTE], attribute))); +} + +int +subtypeInqAttribute(int subtypeID, int index, const char *key, int *outValue) +{ + // Validate input params. + if (subtypeID == CDI_UNDEFID) + xabort("CDI_UNDEFID was passed to %s() as a subtypeID. Please check the origin of that ID.", __func__); + subtype_t *subtype_ptr = (subtype_t *) reshGetVal(subtypeID, &subtypeOps); + if (!subtype_ptr) xabort("Internal error: subtypeID %d resolved to NULL.", subtypeID); + + if ((unsigned) index >= (unsigned) subtype_ptr->nentries) + { + xabort("index argument of %s() is out of range. Expected 0 <= index < %d, but got index = %d.", __func__, + subtype_ptr->nentries, index); + } + +#ifndef __cplusplus + if (!outValue) outValue = &(int){ 0 }; +#else + int dummy = 0; + if (!outValue) outValue = &dummy; +#endif + + if (!key) return CDI_EINVAL; + int iKey = attribute_to_index(key); + if (iKey < 0) return CDI_EINVAL; + + // Find the entry. + struct subtype_entry_t *entry = subtype_ptr->entries; + for (; index--; entry = entry->next) + if (!entry) xabort("internal error: preliminary end of subtype entry list"); + + // Find the attribute. + for (struct subtype_attr_t *attribute = entry->atts; attribute; attribute = attribute->next) + { + if (attribute->key == iKey) + { + *outValue = attribute->val; + return CDI_NOERR; + } + } + + // Failed to find the attribute if this point is reached. + return CDI_EINVAL; +} + +/* Construct a new subtype for a tile set. If a corresponding subtype + * already exists, then we return this subtype ID instead. + * + * See comment on subtype.c::tilesetMatchingPtr for the specification + * of the term "corresponding" tile set. + */ +int +vlistDefTileSubtype(int vlistID, subtype_t *tiles) +{ + int subtypeID = CDI_UNDEFID; + + /* loop over subtypes and search for an identical tileset */ + vlist_t *vlistptr = vlist_to_pointer(vlistID); + int tileset_defined = 0; + for (int isub = 0; isub < vlistptr->nsubtypes; isub++) + { + /* get the ID of the "isub"th subtype */ + subtypeID = vlistptr->subtypeIDs[isub]; + if (subtypeComparePtr(subtypeID, tiles) == 0) + { + tileset_defined = 1; + break; + } + } + + /* tile set seems to be new: register at resource handler. */ + if (tileset_defined == 0) + { + subtype_t *tiles_duplicate = NULL; + subtypeDuplicate(tiles, &tiles_duplicate); + subtypeID = vlistptr->subtypeIDs[vlistptr->nsubtypes++] = subtypePush(tiles_duplicate); + } + + return subtypeID; +} + +int +vlistInsertTrivialTileSubtype(int vlistID) +{ + /* first, generate a subtype */ + subtype_t *subtype_ptr; + subtypeAllocate(&subtype_ptr, SUBTYPE_TILES); + + /* create a tile set that contains only one tile/attribute pair. */ + (void) subtypeEntryInsert(subtype_ptr); + + /* register tile */ + vlist_t *vlistptr = vlist_to_pointer(vlistID); + int subtypeID = vlistptr->subtypeIDs[vlistptr->nsubtypes++] = subtypePush(subtype_ptr); + return subtypeID; +} + +/* ------------------------------------------------------------------- */ +/* NOT YET IMPLEMENTED */ +/* ------------------------------------------------------------------- */ + +static int +subtypeGetPackSize(void *subtype_ptr, void *context) +{ + (void) subtype_ptr; + (void) context; + Error("Not yet implemented for subtypes!"); + return 0; +} + +static void +subtypePack(void *subtype_ptr, void *buffer, int size, int *pos, void *context) +{ + (void) subtype_ptr; + (void) buffer; + (void) size; + (void) pos; + (void) context; + Error("Not yet implemented for subtypes!"); +} + +static int +subtypeTxCode(void *subtypePtr) +{ + (void) subtypePtr; + Error("Not yet implemented for subtypes!"); + return 0; +} + +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#include <inttypes.h> +#include <stdio.h> + + +void +swap4byte(void *ptr, size_t size) +{ + int32_t *ptrtmp = (int32_t *) ptr; + + // clang-format off + for (size_t i = 0; i < size; ++i) + ptrtmp[i] = (((ptrtmp[i] >> 24) & 0x00ff) | ((ptrtmp[i] & 0x00ff) << 24) | + ((ptrtmp[i] >> 8) & 0xff00) | ((ptrtmp[i] & 0xff00) << 8)); + // clang-format on +} + +void +swap8byte(void *ptr, size_t size) +{ + int64_t *ptrtmp = (int64_t *) ptr; + + // clang-format off + for (size_t i = 0; i < size; ++i) + ptrtmp[i] = (((ptrtmp[i] >> 56) & 0x000000ff) | ((ptrtmp[i] & 0x000000ff) << 56) | + ((ptrtmp[i] >> 40) & 0x0000ff00) | ((ptrtmp[i] & 0x0000ff00) << 40) | + ((ptrtmp[i] >> 24) & 0x00ff0000) | ((ptrtmp[i] & 0x00ff0000) << 24) | + ((ptrtmp[i] >> 8) & 0xff000000) | ((ptrtmp[i] & 0xff000000) << 8)); + // clang-format on +} +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifndef TABLEPAR_H +#define TABLEPAR_H + +enum +{ + TABLE_DUP_NAME = 1 << 0, + TABLE_DUP_LONGNAME = 1 << 1, + TABLE_DUP_UNITS = 1 << 2, +}; + +typedef struct +{ + int id; // Parameter number (GRIB) + int ltype; // Level type (GRIB) + int dupflags; // keep track of which attributes got strdup'ed + const char *name; // Parameter name + const char *longname; // Parameter long name + const char *units; // Parameter units +} param_type; + +void tableLink(int tableID, const param_type *pars, int npars); +int tableDef(int modelID, int tablegribID, const char *tablename); + +int tableInqParCode(int tableID, char *name, int *code); + +#endif +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +/* Automatically generated, do not edit! */ +#ifndef TABLE_H +#define TABLE_H + +// clang-format off + +static const param_type echam4[] = { + { 4, -1, 0, "precip", "total precipitation", "m/s" }, + { 34, -1, 0, "low_cld", "low cloud", NULL }, + { 35, -1, 0, "mid_cld", "mid cloud", NULL }, + { 36, -1, 0, "hih_cld", "high cloud", NULL }, + { 129, -1, 0, "geosp", "surface geopotential (orography)", "m^2/s^2" }, + { 130, -1, 0, "t", "temperature", "K" }, + { 131, -1, 0, "u", "u-velocity", "m/s" }, + { 132, -1, 0, "v", "v-velocity", "m/s" }, + { 133, -1, 0, "sq", "specific humidity", "kg/kg" }, + { 134, -1, 0, "aps", "Surface pressure", "Pa" }, + { 135, -1, 0, "omega", "vertical velocity", "Pa/s" }, + { 138, -1, 0, "svo", "vorticity", "1/s" }, + { 139, -1, 0, "ts", "surface temperature", "K" }, + { 140, -1, 0, "ws", "soil wetness", "m" }, + { 141, -1, 0, "sn", "snow depth", "m" }, + { 142, -1, 0, "aprl", "large scale precipitation", "m/s" }, + { 143, -1, 0, "aprc", "convective precipitation", "m/s" }, + { 144, -1, 0, "aprs", "snow fall", "m/s" }, + { 145, -1, 0, "vdis", "boundary layer dissipation", "W/m^2" }, + { 146, -1, 0, "ahfs", "surface sensible heat flux", "W/m^2" }, + { 147, -1, 0, "ahfl", "surface latent heat flux", "W/m^2" }, + { 148, -1, 0, "stream", "streamfunction", "m^2/s" }, + { 149, -1, 0, "velopot", "velocity potential", "m^2/s" }, + { 151, -1, 0, "slp", "mean sea level pressure", "Pa" }, + { 152, -1, 0, "lsp", "log surface pressure", NULL }, + { 153, -1, 0, "sx", "liquid water content", "kg/kg" }, + { 155, -1, 0, "sd", "divergence", "1/s" }, + { 156, -1, 0, "geopoth", "geopotential height", "m" }, + { 157, -1, 0, "rhumidity", "relative humidity", "fraction" }, + { 158, -1, 0, "var158", "tendency of surface pressure", "Pa/s" }, + { 159, -1, 0, "ustar3", "ustar3", "m^3/s^3" }, + { 160, -1, 0, "runoff", "surface runoff", "m/s" }, + { 161, -1, 0, "alwc", "liquid water content", "kg/kg" }, + { 162, -1, 0, "aclc", "cloud cover", "fraction" }, + { 163, -1, 0, "aclcv", "total cloud cover", "fraction" }, + { 164, -1, 0, "aclcov", "total cloud cover", "fraction" }, + { 165, -1, 0, "u10", "10m u-velocity", "m/s" }, + { 166, -1, 0, "v10", "10m v-velocity", "m/s" }, + { 167, -1, 0, "temp2", "2m temperature", "K" }, + { 168, -1, 0, "dew2", "2m dew point temperature", "K" }, + { 169, -1, 0, "tsurf", "surface temperature", "K" }, + { 170, -1, 0, "td", "deep soil temperature", "K" }, + { 171, -1, 0, "wind10", "10m windspeed", "m/s" }, + { 172, -1, 0, "slm", "land sea mask", "fraction" }, + { 173, -1, 0, "az0", "surface roughness length", "m" }, + { 174, -1, 0, "alb", "surface background albedo", "fraction" }, + { 175, -1, 0, "albedo", "surface albedo", "fraction" }, + { 176, -1, 0, "srads", "net surface solar radiation", "W/m^2" }, + { 177, -1, 0, "trads", "net surface thermal radiation", "W/m^2" }, + { 178, -1, 0, "srad0", "net top solar radiation", "W/m^2" }, + { 179, -1, 0, "trad0", "top thermal radiation (OLR)", "W/m^2" }, + { 180, -1, 0, "ustr", "surface u-stress", "Pa" }, + { 181, -1, 0, "vstr", "surface v-stress", "Pa" }, + { 182, -1, 0, "evap", "surface evaporation", "m/s" }, + { 183, -1, 0, "tdcl", "soil temperature", "K" }, + { 185, -1, 0, "srafs", "net surf. solar radiation (clear sky)", "W/m^2" }, + { 186, -1, 0, "trafs", "net surf. thermal radiation (clear sky)", "W/m^2" }, + { 187, -1, 0, "sraf0", "net top solar radiation (clear sky)", "W/m^2" }, + { 188, -1, 0, "traf0", "net top thermal radiation (clear sky)", "W/m^2" }, + { 189, -1, 0, "sclfs", "surface solar cloud forcing", "W/m^2" }, + { 190, -1, 0, "tclfs", "surface thermal cloud forcing", "W/m^2" }, + { 191, -1, 0, "sclf0", "top solar cloud forcing", "W/m^2" }, + { 192, -1, 0, "tclf0", "top thermal cloud forcing", "W/m^2" }, + { 193, -1, 0, "wl", "skin reservoir content", "m" }, + { 194, -1, 0, "wlm1", "skin reservoir content of plants", "m" }, + { 195, -1, 0, "ustrgw", "u-gravity wave stress", "Pa" }, + { 196, -1, 0, "vstrgw", "v-gravity wave stress", "Pa" }, + { 197, -1, 0, "vdisgw", "gravity wave dissipation", "W/m^2" }, + { 198, -1, 0, "vgrat", "vegetation ratio", "fraction" }, + { 199, -1, 0, "varor", "orographic variance", "m^2" }, + { 200, -1, 0, "vlt", "leaf area index", NULL }, + { 201, -1, 0, "t2max", "maximum 2m-temperature", "K" }, + { 202, -1, 0, "t2min", "minimum 2m-temperature", "K" }, + { 203, -1, 0, "srad0u", "top solar radiation upward", "W/m^2" }, + { 204, -1, 0, "sradsu", "surface solar radiation upward", "W/m^2" }, + { 205, -1, 0, "tradsu", "surface thermal radiation upward", "W/m^2" }, + { 206, -1, 0, "tsn", "snow temperature", "K" }, + { 207, -1, 0, "td3", "soil temperature 3", "K" }, + { 208, -1, 0, "td4", "soil temperature 4", "K" }, + { 209, -1, 0, "td5", "soil temperature 5", "K" }, + { 210, -1, 0, "seaice", "sea ice cover", "fraction" }, + { 211, -1, 0, "siced", "sea ice depth", "m" }, + { 212, -1, 0, "forest", "vegetation type", "fraction" }, + { 213, -1, 0, "teff", "(effective) sea-ice skin temperature", "K" }, + { 214, -1, 0, "tsmax", "maximum surface temperature", "K" }, + { 215, -1, 0, "tsmin", "minimum surface temperature", "K" }, + { 216, -1, 0, "wimax", "maximum 10m-wind speed", "m/s" }, + { 217, -1, 0, "topmax", "maximum height of convective cloud tops", "Pa" }, + { 218, -1, 0, "snmel", "snow melt", "m/s" }, + { 219, -1, 0, "runtoc", "surface runoff into ocean", NULL }, + { 220, -1, 0, "tslin", "land: residual surface heat budget", "W/m^2" }, + { 221, -1, 0, "dsnac", "snow depth change", "m/s" }, + { 222, -1, 0, "alwcac", "liquid water content", "kg/kg" }, + { 223, -1, 0, "aclcac", "cloud cover", "fraction" }, + { 224, -1, 0, "tke", "turbulent kinetic energy", NULL }, + { 225, -1, 0, "tkem1", "turbulent kinetic energy (t-1)", NULL }, + { 226, -1, 0, "fao", "FAO data set (soil data flags)", NULL }, + { 227, -1, 0, "rgcgn", "heat capacity of soil", NULL }, + { 228, -1, 0, "sodif", "soil diffusivity", NULL }, + { 229, -1, 0, "wsmx", "field capacity of soil", "m" }, + { 230, -1, 0, "qvi", "vertically integrated specific humidity", "kg/m^2" }, + { 231, -1, 0, "alwcvi", "vertically integrated liquid water cont.", "kg/m^2" }, + { 232, -1, 0, "glac", "glacier mask", "fraction" }, + { 233, -1, 0, "runlnd", "surface runoff not running into ocean", NULL }, + { 259, -1, 0, "windspeed", "windspeed (sqrt(u^2+v^2))", NULL }, + { 260, -1, 0, "precip", "total precipitation", "m/s" }, + { 261, -1, 0, "net_top", "total top radiation", NULL }, + { 262, -1, 0, "net_bot", "total surface radiation", NULL }, + { 263, -1, 0, "net_heat", "net surface heat flux", NULL }, + { 264, -1, 0, "net_water", "total surface water", NULL }, + { 268, -1, 0, "sw_atm", NULL, NULL }, + { 269, -1, 0, "lw_atm", NULL, NULL }, + { 270, -1, 0, "net_atm", NULL, NULL }, + { 271, -1, 0, "surf_runoff", "surface runoff", NULL }, + { 275, -1, 0, "fresh_water", NULL, NULL }, +}; + +static const param_type echam5[] = { + { 4, -1, 0, "precip", "total precipitation", "kg/m^2s" }, + { 79, -1, 0, "swnirac", "net surface NIR flux acc.", "W/m^2" }, + { 80, -1, 0, "swdifnirac", "fraction of diffuse NIR acc.", "W/m^2" }, + { 81, -1, 0, "swvisac", "net surface visible flux acc.", "W/m^2" }, + { 82, -1, 0, "swdifvisac", "fraction of diffuse visible acc.", "W/m^2" }, + { 83, -1, 0, "ocu", "ocean eastw. velocity (coupled mode)", "m/s" }, + { 84, -1, 0, "ocv", "ocean northw. velocity (coupled mode)", "m/s" }, + { 85, -1, 0, "tradl", "net LW radiation 200mb", "W/m^2" }, + { 86, -1, 0, "sradl", "net SW radiation 200mb", "W/m^2" }, + { 87, -1, 0, "trafl", "net LW radiation 200mb (clear sky)", "W/m^2" }, + { 88, -1, 0, "srafl", "net SW radiation 200mb (clear sky)", "W/m^2" }, + { 89, -1, 0, "amlcorac", "mixed layer flux correction", "W/m^2" }, + { 90, -1, 0, "amlheatac", "mixed layer heat content", "J/m^2" }, + { 91, -1, 0, "trfliac", "net LW radiation over ice", "W/m^2" }, + { 92, -1, 0, "trflwac", "net LW radiation over water", "W/m^2" }, + { 93, -1, 0, "trfllac", "net LW radiation over land", "W/m^2" }, + { 94, -1, 0, "sofliac", "net SW radiation over ice", "W/m^2" }, + { 95, -1, 0, "soflwac", "net SW radiation over water", "W/m^2" }, + { 96, -1, 0, "sofllac", "net SW radiation over land", "W/m^2" }, + { 97, -1, 0, "friac", "ice cover (fraction of grid box)", NULL }, + { 102, -1, 0, "tsi", "surface temperature of ice", "K" }, + { 103, -1, 0, "tsw", "surface temperature of water", "K" }, + { 104, -1, 0, "ustri", "zonal wind stress over ice", "Pa" }, + { 105, -1, 0, "vstri", "meridional wind stress over ice", "Pa" }, + { 106, -1, 0, "ustrw", "zonal wind stress over water", "Pa" }, + { 107, -1, 0, "vstrw", "meridional wind stress over water", "Pa" }, + { 108, -1, 0, "ustrl", "zonal wind stress over land", "Pa" }, + { 109, -1, 0, "vstrl", "meridional wind stress over land", "Pa" }, + { 110, -1, 0, "ahfliac", "latent heat flux over ice", "W/m^2" }, + { 111, -1, 0, "ahflwac", "latent heat flux over water", "W/m^2" }, + { 112, -1, 0, "ahfllac", "latent heat flux over land", "W/m^2" }, + { 113, -1, 0, "evapiac", "evaporation over ice", "kg/m^2s" }, + { 114, -1, 0, "evapwac", "evaporation over water", "kg/m^2s" }, + { 115, -1, 0, "evaplac", "evaporation over land", "kg/m^2s" }, + { 116, -1, 0, "az0i", "roughness length over ice", "m" }, + { 117, -1, 0, "az0w", "roughness length over water", "m" }, + { 118, -1, 0, "az0l", "roughness length over land", "m" }, + { 119, -1, 0, "ahfsiac", "sensible heat flux over ice", "W/m^2" }, + { 120, -1, 0, "ahfswac", "sensible heat flux over water", "W/m^2" }, + { 121, -1, 0, "ahfslac", "sensible heat flux over land", "W/m^2" }, + { 122, -1, 0, "alsoi", "albedo of ice", NULL }, + { 123, -1, 0, "alsow", "albedo of water", NULL }, + { 124, -1, 0, "alsol", "albedo of land", NULL }, + { 125, -1, 0, "ahfice", "conductive heat flux through ice", "W/m^2" }, + { 126, -1, 0, "qres", "residual heat flux for melting sea ice", "W/m^2" }, + { 127, -1, 0, "alake", "lake fraction", NULL }, + { 128, -1, 0, "rintop", "low level inversion", NULL }, + { 129, -1, 0, "geosp", "surface geopotential (orography)", "m^2/s^2" }, + { 130, -1, 0, "t", "temperature", "K" }, + { 131, -1, 0, "u", "u-velocity", "m/s" }, + { 132, -1, 0, "v", "v-velocity", "m/s" }, + { 133, -1, 0, "q", "specific humidity", "kg/kg" }, + { 134, -1, 0, "aps", "surface pressure", "Pa" }, + { 135, -1, 0, "omega", "vertical velocity", "Pa/s" }, + { 136, -1, 0, "acdnc", "cloud droplet number concentration", "1/m^3" }, + { 137, -1, 0, "apmeb", "(P-E) error", "kg/m^2s" }, + { 138, -1, 0, "svo", "vorticity", "1/s" }, + { 139, -1, 0, "tslm1", "surface temperature of land", "K" }, + { 140, -1, 0, "ws", "soil wetness", "m" }, + { 141, -1, 0, "sn", "water equivalent snow depth", "m" }, + { 142, -1, 0, "aprl", "large scale precipitation", "kg/m^2s" }, + { 143, -1, 0, "aprc", "convective precipitation", "kg/m^2s" }, + { 144, -1, 0, "aprs", "snow fall", "kg/m^2s" }, + { 145, -1, 0, "vdis", "boundary layer dissipation", "W/m^2" }, + { 146, -1, 0, "ahfs", "sensible heat flux", "W/m^2" }, + { 147, -1, 0, "ahfl", "latent heat flux", "W/m^2" }, + { 148, -1, 0, "stream", "streamfunction", "m^2/s" }, + { 149, -1, 0, "velopot", "velocity potential", "m^2/s" }, + { 150, -1, 0, "xivi", "vertically integrated cloud ice", "kg/m^2" }, + { 151, -1, 0, "slp", "mean sea level pressure", "Pa" }, + { 152, -1, 0, "lsp", "log surface pressure", NULL }, + { 153, -1, 0, "xl", "cloud water", "kg/kg" }, + { 154, -1, 0, "xi", "cloud ice", "kg/kg" }, + { 155, -1, 0, "sd", "divergence", "1/s" }, + { 156, -1, 0, "geopoth", "geopotential height", "m" }, + { 157, -1, 0, "rhumidity", "relative humidity", NULL }, + { 159, -1, 0, "wind10w", "10m windspeed over water", "m/s" }, + { 160, -1, 0, "runoff", "surface runoff and drainage", "kg/m^2s" }, + { 161, -1, 0, "drain", "drainage", "kg/m^2s" }, + { 162, -1, 0, "aclc", "cloud cover", NULL }, + { 164, -1, 0, "aclcov", "total cloud cover", NULL }, + { 165, -1, 0, "u10", "10m u-velocity", "m/s" }, + { 166, -1, 0, "v10", "10m v-velocity", "m/s" }, + { 167, -1, 0, "temp2", "2m temperature", "K" }, + { 168, -1, 0, "dew2", "2m dew point temperature", "K" }, + { 169, -1, 0, "tsurf", "surface temperature", "K" }, + { 170, -1, 0, "xvar", "variance of total water amount", "kg/kg" }, + { 171, -1, 0, "wind10", "10m windspeed", "m/s" }, + { 172, -1, 0, "slm", "land sea mask (1. = land, 0. = sea/lakes)", NULL }, + { 173, -1, 0, "az0", "roughness length", "m" }, + { 174, -1, 0, "alb", "surface background albedo", NULL }, + { 175, -1, 0, "albedo", "surface albedo", NULL }, + { 176, -1, 0, "srads", "net surface SW radiation", "W/m^2" }, + { 177, -1, 0, "trads", "net surface LW radiation", "W/m^2" }, + { 178, -1, 0, "srad0", "net top SW radiation", "W/m^2" }, + { 179, -1, 0, "trad0", "net top LW radiation (-OLR)", "W/m^2" }, + { 180, -1, 0, "ustr", "u-stress", "Pa" }, + { 181, -1, 0, "vstr", "v-stress", "Pa" }, + { 182, -1, 0, "evap", "evaporation", "kg/m^2s" }, + { 183, -1, 0, "xskew", "skewness of total water amount qv+qi+ql", NULL }, + { 184, -1, 0, "srad0d", "top incoming SW radiation", "W/m^2" }, + { 185, -1, 0, "srafs", "net surface SW radiation (clear sky)", "W/m^2" }, + { 186, -1, 0, "trafs", "net surface LW radiation (clear sky)", "W/m^2" }, + { 187, -1, 0, "sraf0", "net top SW radiation (clear sky)", "W/m^2" }, + { 188, -1, 0, "traf0", "net top LW radiation (clear sky)", "W/m^2" }, + { 189, -1, 0, "sclfs", "net surface SW cloud forcing (176-185)", "W/m^2" }, + { 190, -1, 0, "tclfs", "net surface LW cloud forcing (177-186)", "W/m^2" }, + { 191, -1, 0, "sclf0", "net SW top cloud forcing (178-187)", "W/m^2" }, + { 192, -1, 0, "tclf0", "net LW top cloud forcing (179-188)", "W/m^2" }, + { 193, -1, 0, "wl", "skin reservoir content", "m" }, + { 194, -1, 0, "slf", "fractional land cover", NULL }, + { 195, -1, 0, "ustrgw", "u-gravity wave stress", "Pa" }, + { 196, -1, 0, "vstrgw", "v-gravity wave stress", "Pa" }, + { 197, -1, 0, "vdisgw", "gravity wave dissipation", "W/m^2" }, + { 198, -1, 0, "vgrat", "vegetation ratio", NULL }, + { 199, -1, 0, "orostd", "orographic standard deviation", "m" }, + { 200, -1, 0, "vlt", "leaf area index", NULL }, + { 201, -1, 0, "t2max", "maximum 2m-temperature", "K" }, + { 202, -1, 0, "t2min", "minimum 2m-temperature", "K" }, + { 203, -1, 0, "srad0u", "top SW radiation upward", "W/m^2" }, + { 204, -1, 0, "sradsu", "surface SW radiation upward", "W/m^2" }, + { 205, -1, 0, "tradsu", "surface LW radiation upward", "W/m^2" }, + { 206, -1, 0, "grndflux", "surface ground heat flux", NULL }, + { 207, -1, 0, "tsoil", "deep soil temperatures (5 layers)", "K" }, + { 208, -1, 0, "ahfcon", "conductive heat flux through ice", "W/m^2" }, + { 209, -1, 0, "ahfres", "res. heat flux for melting ice", "W/m^2" }, + { 210, -1, 0, "seaice", "ice cover (fraction of ice+water)", NULL }, + { 211, -1, 0, "siced", "ice thickness", "m" }, + { 212, -1, 0, "forest", "forest fraction", NULL }, + { 213, -1, 0, "gld", "glacier thickness", "m" }, + { 214, -1, 0, "sni", "water equivalent of snow on ice", "m" }, + { 215, -1, 0, "rogl", "glacier runoff", "kg/m^2s" }, + { 216, -1, 0, "wimax", "maximum 10m-wind speed", "m/s" }, + { 217, -1, 0, "topmax", "maximum height of convective cloud tops", "Pa" }, + { 218, -1, 0, "snmel", "snow melt", "kg/m^2s" }, + { 219, -1, 0, "runtoc", "surface runoff into ocean", "kg/m^2s" }, + { 220, -1, 0, "runlnd", "surface runoff not running into ocean", "kg/m^2s" }, + { 221, -1, 0, "apmegl", "P-E over land ice", "kg/m^2s" }, + { 222, -1, 0, "snacl", "snow accumulation over land", "kg/m^2s" }, + { 223, -1, 0, "aclcac", "cloud cover", NULL }, + { 224, -1, 0, "tke", "turbulent kinetic energy", "m^2/s^2" }, + { 225, -1, 0, "tkem1", "turbulent kinetic energy (t-1)", "m^2/s^2" }, + { 226, -1, 0, "fao", "FAO data set (soil data flags) 0...5", NULL }, + { 227, -1, 0, "rgcgn", "heat capacity of soil", NULL }, + { 228, -1, 0, "sodif", "soil diffusivity", "m^2/s" }, + { 229, -1, 0, "wsmx", "field capacity of soil", "m" }, + { 230, -1, 0, "qvi", "vertically integrated water vapor", "kg/m^2" }, + { 231, -1, 0, "xlvi", "vertically integrated cloud water", "kg/m^2" }, + { 232, -1, 0, "glac", "fraction of land covered by glaciers", NULL }, + { 233, -1, 0, "snc", "snow depth at the canopy", "m" }, + { 234, -1, 0, "rtype", "type of convection", "0...3" }, + { 235, -1, 0, "abso4", "anthropogenic sulfur burden", "kg/m^2" }, + { 236, -1, 0, "ao3", "ipcc ozone", "kg/m^2" }, + { 237, -1, 0, "tropo", "WMO defined tropopause height", "Pa" }, + { 259, -1, 0, "windspeed", "windspeed (sqrt(u^2+v^2))", "m/s" }, + { 260, -1, 0, "precip", "total precipitation (142+143)", "kg/m^2s" }, + { 261, -1, 0, "net_top", "total top radiation (178+179)", "W/m^2" }, + { 262, -1, 0, "net_bot", "total surface radiation (176+177)", "W/m^2" }, + { 272, -1, 0, "mastrfu", "mass stream function", "kg/s" }, +}; + +static const param_type echam6[] = { + { 4, -1, 0, "precip", "total precipitation", "kg m-2 s-1" }, + { 34, -1, 0, "low_cld", "low cloud", NULL }, + { 35, -1, 0, "mid_cld", "mid cloud", NULL }, + { 36, -1, 0, "hih_cld", "high cloud", NULL }, + { 68, -1, 0, "fage", "aging factor of snow on ice", NULL }, + { 69, -1, 0, "snifrac", "fraction of ice covered with snow", NULL }, + { 70, -1, 0, "barefrac", "bare ice fraction", NULL }, + { 71, -1, 0, "alsom", "albedo of melt ponds", NULL }, + { 72, -1, 0, "alsobs", "albedo of bare ice and snow", NULL }, + { 73, -1, 0, "sicepdw", "melt pond depth on sea-ice", "m" }, + { 74, -1, 0, "sicepdi", "ice thickness on melt pond", "m" }, + { 75, -1, 0, "tsicepdi", "ice temperature on frozen melt pond", "K" }, + { 76, -1, 0, "sicepres", "residual heat flux", "W m-2" }, + { 77, -1, 0, "ameltdepth", "total melt pond depth", "m" }, + { 78, -1, 0, "ameltfrac", "fractional area of melt ponds on sea-ice", NULL }, + { 79, -1, 0, "albedo_vis_dir", "surface albedo visible range direct", NULL }, + { 80, -1, 0, "albedo_nir_dir", "surface albedo NIR range direct", NULL }, + { 81, -1, 0, "albedo_vis_dif", "surface albedo visible range diffuse", NULL }, + { 82, -1, 0, "albedo_nir_dif", "surface albedo NIR range diffuse", NULL }, + { 83, -1, 0, "ocu", "ocean eastw. velocity (coupled mode)", "m/s" }, + { 84, -1, 0, "ocv", "ocean northw. velocity (coupled mode)", "m/s" }, + { 85, -1, 0, "tradl", "thermal radiation 200mb", "W m-2" }, + { 86, -1, 0, "sradl", "solar radiation 200mb", "W m-2" }, + { 87, -1, 0, "trafl", "thermal radiation 200mb (clear sky)", "W m-2" }, + { 88, -1, 0, "srafl", "solar radiation 200mb (clear sky)", "W m-2" }, + { 89, -1, 0, "amlcorac", "mixed layer flux correction", "W m-2" }, + { 90, -1, 0, "amlheatac", "mixed layer heat content", "J m-2" }, + { 91, -1, 0, "trfliac", "LW flux over ice", "W m-2" }, + { 92, -1, 0, "trflwac", "LW flux over water", "W m-2" }, + { 93, -1, 0, "trfllac", "LW flux over land", "W m-2" }, + { 94, -1, 0, "sofliac", "SW flux over ice", "W m-2" }, + { 95, -1, 0, "soflwac", "SW flux over water", "W m-2" }, + { 96, -1, 0, "sofllac", "SW flux over land", "W m-2" }, + { 97, -1, 0, "friac", "ice cover (fraction of grid box)", NULL }, + { 102, -1, 0, "tsi", "surface temperature of ice", "K" }, + { 103, -1, 0, "tsw", "surface temperature of water", "K" }, + { 104, -1, 0, "ustri", "zonal wind stress over ice", "Pa" }, + { 105, -1, 0, "vstri", "meridional wind stress over ice", "Pa" }, + { 106, -1, 0, "ustrw", "zonal wind stress over water", "Pa" }, + { 107, -1, 0, "vstrw", "meridional wind stress over water", "Pa" }, + { 108, -1, 0, "ustrl", "zonal wind stress over land", "Pa" }, + { 109, -1, 0, "vstrl", "meridional wind stress over land", "Pa" }, + { 110, -1, 0, "ahfliac", "latent heat flux over ice", "W m-2" }, + { 111, -1, 0, "ahflwac", "latent heat flux over water", "W m-2" }, + { 112, -1, 0, "ahfllac", "latent heat flux over land", "W m-2" }, + { 113, -1, 0, "evapiac", "evaporation over ice", "kg m-2 s-1" }, + { 114, -1, 0, "evapwac", "evaporation over water", "kg m-2 s-1" }, + { 115, -1, 0, "evaplac", "evaporation over land", "kg m-2 s-1" }, + { 116, -1, 0, "az0i", "roughness length over ice", "m" }, + { 117, -1, 0, "az0w", "roughness length over water", "m" }, + { 118, -1, 0, "az0l", "roughness length over land", "m" }, + { 119, -1, 0, "ahfsiac", "sensible heat flux over ice", "W m-2" }, + { 120, -1, 0, "ahfswac", "sensible heat flux over water", "W m-2" }, + { 121, -1, 0, "ahfslac", "sensible heat flux over land", "W m-2" }, + { 122, -1, 0, "alsoi", "albedo of ice", NULL }, + { 123, -1, 0, "alsow", "albedo of water", NULL }, + { 124, -1, 0, "alsol", "albedo of land", NULL }, + { 125, -1, 0, "ahfice", "conductive heat flux", "W m-2" }, + { 126, -1, 0, "qres", "residual heat flux for melting sea ice", "W m-2" }, + { 127, -1, 0, "alake", "lake fraction of grid box", "fraction" }, + { 128, -1, 0, "rintop", "low level inversion", NULL }, + { 129, -1, 0, "geosp", "surface geopotential (orography)", "m^2/s^2" }, + { 130, -1, 0, "t", "temperature", "K" }, + { 131, -1, 0, "u", "u-velocity", "m/s" }, + { 132, -1, 0, "v", "v-velocity", "m/s" }, + { 133, -1, 0, "q", "specific humidity", "kg/kg" }, + { 134, -1, 0, "aps", "surface pressure", "Pa" }, + { 135, -1, 0, "omega", "vertical velocity", "Pa/s" }, + { 136, -1, 0, "acdnc", "cloud droplet number concentration", "1 m-3" }, + { 137, -1, 0, "apmeb", "vert. integr. tendencies of water", "kg m-2 s-1" }, + { 138, -1, 0, "svo", "vorticity", "1/s" }, + { 139, -1, 0, "tslm1", "surface temperature of land", "K" }, + { 140, -1, 0, "ws", "soil wetness", "m" }, + { 141, -1, 0, "sn", "snow depth", "m" }, + { 142, -1, 0, "aprl", "large scale precipitation", "kg m-2 s-1" }, + { 143, -1, 0, "aprc", "convective precipitation", "kg m-2 s-1" }, + { 144, -1, 0, "aprs", "snow fall", "kg m-2 s-1" }, + { 145, -1, 0, "vdis", "boundary layer dissipation", "W m-2" }, + { 146, -1, 0, "ahfs", "sensible heat flux", "W m-2" }, + { 147, -1, 0, "ahfl", "latent heat flux", "W m-2" }, + { 148, -1, 0, "stream", "streamfunction", "m^2/s" }, + { 149, -1, 0, "velopot", "velocity potential", "m^2/s" }, + { 150, -1, 0, "xivi", "vertically integrated cloud ice", "kg m-2" }, + { 151, -1, 0, "slp", "mean sea level pressure", "Pa" }, + { 152, -1, 0, "lsp", "log surface pressure", NULL }, + { 153, -1, 0, "xl", "cloud water", "kg/kg" }, + { 154, -1, 0, "xi", "cloud ice", "kg/kg" }, + { 155, -1, 0, "sd", "divergence", "1/s" }, + { 156, -1, 0, "geopoth", "geopotential height", "m" }, + { 157, -1, 0, "rhumidity", "relative humidity", "fraction" }, + { 158, -1, 0, "var158", "tendency of surface pressure", "Pa/s" }, + { 159, -1, 0, "wind10w", "10m windspeed over water", "m/s" }, + { 160, -1, 0, "runoff", "surface runoff and drainage", "kg m-2 s-1" }, + { 161, -1, 0, "drain", "drainage", "kg m-2 s-1" }, + { 162, -1, 0, "aclc", "cloud cover", NULL }, + { 163, -1, 0, "aclcv", "total cloud cover", NULL }, + { 164, -1, 0, "aclcov", "total cloud cover (mean)", NULL }, + { 165, -1, 0, "u10", "10m u-velocity", "m/s" }, + { 166, -1, 0, "v10", "10m v-velocity", "m/s" }, + { 167, -1, 0, "temp2", "2m temperature", "K" }, + { 168, -1, 0, "dew2", "2m dew point temperature", "K" }, + { 169, -1, 0, "tsurf", "surface temperature", "K" }, + { 170, -1, 0, "xvar", "variance of total water amount qv+qi+ql", "kg/kg" }, + { 171, -1, 0, "wind10", "10m windspeed", "m/s" }, + { 172, -1, 0, "slm", "land sea mask (1. = land, 0. = sea/lakes)", NULL }, + { 173, -1, 0, "az0", "roughness length", "m" }, + { 174, -1, 0, "alb", "surface background albedo", NULL }, + { 175, -1, 0, "albedo", "surface albedo", NULL }, + { 176, -1, 0, "srads", "net surface solar radiation", "W m-2" }, + { 177, -1, 0, "trads", "net surface thermal radiation", "W m-2" }, + { 178, -1, 0, "srad0", "net top solar radiation", "W m-2" }, + { 179, -1, 0, "trad0", "top thermal radiation (OLR)", "W m-2" }, + { 180, -1, 0, "ustr", "u-stress", "Pa" }, + { 181, -1, 0, "vstr", "v-stress", "Pa" }, + { 182, -1, 0, "evap", "evaporation", "kg m-2 s-1" }, + { 183, -1, 0, "xskew", "skewness of total water amount qv+qi+ql", NULL }, + { 184, -1, 0, "srad0d", "top incoming solar radiation", "W m-2" }, + { 185, -1, 0, "srafs", "net surf. solar radiation (clear sky)", "W m-2" }, + { 186, -1, 0, "trafs", "net surf. thermal radiation (clear sky)", "W m-2" }, + { 187, -1, 0, "sraf0", "net top solar radiation (clear sky)", "W m-2" }, + { 188, -1, 0, "traf0", "net top thermal radiation (clear sky)", "W m-2" }, + { 189, -1, 0, "sclfs", "surface solar cloud forcing", "W m-2" }, + { 190, -1, 0, "tclfs", "surface thermal cloud forcing", "W m-2" }, + { 191, -1, 0, "sclf0", "SW top cloud forcing (178-187)", "W m-2" }, + { 192, -1, 0, "tclf0", "LW top cloud forcing (179-188)", "W m-2" }, + { 193, -1, 0, "wl", "skin reservoir content", "m" }, + { 194, -1, 0, "slf", "sea land fraction", NULL }, + { 195, -1, 0, "ustrgw", "u-gravity wave stress", "Pa" }, + { 196, -1, 0, "vstrgw", "v-gravity wave stress", "Pa" }, + { 197, -1, 0, "vdisgw", "gravity wave dissipation", "W m-2" }, + { 198, -1, 0, "vgrat", "vegetation ratio", NULL }, + { 199, -1, 0, "orostd", "orographic standard deviation", "m" }, + { 200, -1, 0, "vlt", "leaf area index", NULL }, + { 201, -1, 0, "t2max", "maximum 2m-temperature", "K" }, + { 202, -1, 0, "t2min", "minimum 2m-temperature", "K" }, + { 203, -1, 0, "srad0u", "top solar radiation upward", "W m-2" }, + { 204, -1, 0, "sradsu", "surface solar radiation upward", "W m-2" }, + { 205, -1, 0, "tradsu", "surface thermal radiation upward", "W m-2" }, + { 206, -1, 0, "grndflux", "surface ground heat flux", NULL }, + { 207, -1, 0, "tsoil", "deep soil temperatures (5 layers)", "K" }, + { 208, -1, 0, "ahfcon", "conductive heat flux through ice", "W m-2" }, + { 209, -1, 0, "ahfres", "melting of ice", "W m-2" }, + { 210, -1, 0, "seaice", "ice cover (fraction of 1-SLM)", NULL }, + { 211, -1, 0, "siced", "ice depth", "m" }, + { 212, -1, 0, "forest", "forest fraction", NULL }, + { 213, -1, 0, "gld", "glacier depth", "m" }, + { 214, -1, 0, "sni", "water equivalent of snow on ice", "m" }, + { 215, -1, 0, "rogl", "glacier runoff", "kg m-2 s-1" }, + { 216, -1, 0, "wimax", "maximum 10m-wind speed", "m/s" }, + { 217, -1, 0, "topmax", "maximum height of convective cloud tops", "Pa" }, + { 218, -1, 0, "snmel", "snow melt", "kg m-2 s-1" }, + { 219, -1, 0, "runtoc", "surface runoff into ocean", "kg m-2 s-1" }, + { 220, -1, 0, "runlnd", "surface runoff not running into ocean", "kg m-2 s-1" }, + { 221, -1, 0, "apmegl", "P-E over land ice", "kg m-2 s-1" }, + { 222, -1, 0, "snacl", "snow accumulation over land", "kg m-2 s-1" }, + { 223, -1, 0, "aclcac", "cloud cover", NULL }, + { 224, -1, 0, "tke", "turbulent kinetic energy", "m^2/s^2" }, + { 225, -1, 0, "tkem1", "turbulent kinetic energy (t-1)", "m^2/s^2" }, + { 226, -1, 0, "fao", "FAO data set (soil data flags)", "0...5" }, + { 227, -1, 0, "rgcgn", "heat capacity of soil", NULL }, + { 228, -1, 0, "sodif", "diffusivity of soil and land ice", "m^2/s" }, + { 229, -1, 0, "wsmx", "field capacity of soil", "m" }, + { 230, -1, 0, "qvi", "vertically integrated water vapor", "kg m-2" }, + { 231, -1, 0, "xlvi", "vertically integrated cloud water", "kg m-2" }, + { 232, -1, 0, "glac", "fraction of land covered by glaciers", NULL }, + { 233, -1, 0, "snc", "snow depth at the canopy", "m" }, + { 234, -1, 0, "rtype", "type of convection", "0...3" }, + { 235, -1, 0, "abso4", "antropogenic sulfur burden", "kg m-2" }, + { 236, -1, 0, "ao3", "ipcc ozone", "kg m-2" }, + { 237, -1, 0, "tropo", "WMO defined tropopause height", "Pa" }, + { 259, -1, 0, "windspeed", "windspeed (sqrt(u^2+v^2))", "m/s" }, + { 260, -1, 0, "precip", "total precipitation (142+143)", "kg m-2 s-1" }, + { 261, -1, 0, "net_top", "total top radiation (178+179)", "W m-2" }, + { 262, -1, 0, "net_bot", "total surface radiation (176+177)", "W m-2" }, + { 272, -1, 0, "mastfru", "mass stream function", "kg/s" }, +}; + +static const param_type mpiom1[] = { + { 2, -1, 0, "THO", "temperature", "C" }, + { 5, -1, 0, "SAO", "salinity", "psu" }, + { 3, -1, 0, "UKO", "zon. velocity", "m/s" }, + { 4, -1, 0, "VKE", "mer. velocity", "m/s" }, + { 303, -1, 0, "UKOMFL", "zon. velocity (divergence free)", "m/s" }, + { 304, -1, 0, "VKEMFL", "mer. velocity (divergence free)", "m/s" }, + { 7, -1, 0, "WO", "ver. velocity", "m/s" }, + { 8, -1, 0, "RHO", "insitu density", "kg/m**3" }, + { 6, -1, 0, "PO", "pressure", "Pa" }, + { 67, -1, 0, "EMINPO", "freshwaterflux by restoring", "m/s" }, + { 70, -1, 0, "FLUM", "total heatflux", "W/m**2" }, + { 79, -1, 0, "PEM", "total freshwaterflux", "m/s" }, + { 13, -1, 0, "SICTHO", "ice thickness", "m" }, + { 15, -1, 0, "SICOMO", "ice compactness", "frac." }, + { 35, -1, 0, "SICUO", "zon. ice velocity", "m/s" }, + { 36, -1, 0, "SICVE", "mer. ice velocity", "m/s" }, + { 92, -1, 0, "TAFO", "surface air temperature", "C" }, + { 164, -1, 0, "FCLOU", "cloud cover", NULL }, + { 52, -1, 0, "TXO", "surface u-stress", "Pa/1025." }, + { 53, -1, 0, "TYE", "surface v-stress", "Pa/1025." }, + { 260, -1, 0, "FPREC", "prescr. precipitation", "m/s" }, + { 80, -1, 0, "FSWR", "downward shortwave rad.", "W/m**2" }, + { 81, -1, 0, "FTDEW", "dewpoint temperature", "K" }, + { 171, -1, 0, "FU10", "10m windspeed", "m/s" }, + { 141, -1, 0, "SICSNO", "snow thickness", "m" }, + { 176, -1, 0, "QSWO", "heat flux shortwave", "W/m**2" }, + { 177, -1, 0, "QLWO", "heat flux longwave", "W/m**2" }, + { 147, -1, 0, "QLAO", "heat flux latent", "W/m**2" }, + { 146, -1, 0, "QSEO", "heat flux sensible", "W/m**2" }, + { 65, -1, 0, "PRECO", "net freshwater flux + runoff", "m/s" }, + { 1, -1, 0, "ZO", "sealevel", "m" }, + { 82, -1, 0, "Z1O", "sealevel change", "m" }, + { 69, -1, 0, "KCONDEP", "depth of convection", "level" }, + { 27, -1, 0, "PSIUWE", "hor. bar. streamfunction", "Sv" }, + { 83, -1, 0, "AMLD", "mixed layer depth", "m" }, + { 172, -1, 0, "WETO", "landseamask (pressure points)", NULL }, + { 507, -1, 0, "AMSUE", "landseamask (vector points v)", NULL }, + { 508, -1, 0, "AMSUO", "landseamask (vector points u)", NULL }, + { 84, -1, 0, "DEPTO", "depth at pressure points", "m" }, + { 484, -1, 0, "DEUTO", "depth at vector points (u)", "m" }, + { 584, -1, 0, "DEUTE", "depth at vector points (v)", "m" }, + { 184, -1, 0, "DDUO", "level thickness (vector u )", "m" }, + { 284, -1, 0, "DDUE", "level thickness (vector v )", "m" }, + { 384, -1, 0, "DDPO", "level thickness (pressure )", "m" }, + { 85, -1, 0, "DLXP", "grid distance x", "m" }, + { 86, -1, 0, "DLYP", "grid distance y", "m" }, + { 185, -1, 0, "DLXU", "grid distance x (vector u)", "m" }, + { 186, -1, 0, "DLYU", "grid distance y (vector u)", "m" }, + { 285, -1, 0, "DLXV", "grid distance x (vector v)", "m" }, + { 286, -1, 0, "DLYV", "grid distance y (vector v)", "m" }, + { 54, -1, 0, "GILA", "latitude in radiants", "rad" }, + { 55, -1, 0, "GIPH", "longitude in radiants", "rad" }, + { 354, -1, 0, "ALAT", "latitude in degrees (pressure)", "deg" }, + { 355, -1, 0, "ALON", "longitude in degrees (pressure)", "deg" }, + { 154, -1, 0, "ALATU", "latitude in degrees (vector u)", "deg" }, + { 155, -1, 0, "ALONU", "longitude in degrees (vector u)", "deg" }, + { 254, -1, 0, "ALATV", "latitude in degrees (vector v)", "deg" }, + { 255, -1, 0, "ALONV", "longitude in degrees (vector v)", "deg" }, + { 110, -1, 0, "AVO", "vertical impuls diffusion", "m**2/s" }, + { 111, -1, 0, "DVO", "vertical T,S diffusion", "m**2/s" }, + { 142, -1, 0, "SICTRU", "seaice transport x", "m**2/s" }, + { 143, -1, 0, "SICTRV", "seaice transport y", "m**2/s" }, + { 612, -1, 0, "WTMIX", "wind mixing", "m**2/s" }, + { 183, -1, 0, "zmld", "mixed layer depth (SJ)", "m" }, + { 207, -1, 0, "WGO", "GM vertical velocity", "m/s" }, + { 305, -1, 0, "rivrun", "RiverRunoff", "m/s" }, + { 158, -1, 0, "TMCDO", "mon. mean depth of convection", "level" }, + { 247, -1, 0, "DQSWO", "heatflux sw over water", "W/m**2" }, + { 248, -1, 0, "DQLWO", "heatflux lw over water", "W/m**2" }, + { 249, -1, 0, "DQSEO", "heatflux se over water", "W/m**2" }, + { 250, -1, 0, "DQLAO", "heatflux la over water", "W/m**2" }, + { 251, -1, 0, "DQTHO", "heatflux net over water", "W/m**2" }, + { 252, -1, 0, "DQSWI", "heatflux sw over seaice", "W/m**2" }, + { 253, -1, 0, "DQLWI", "heatflux lw over seaice", "W/m**2" }, + { 254, -1, 0, "DQSEI", "heatflux se over seaice", "W/m**2" }, + { 255, -1, 0, "DQLAI", "heatflux la over seaice", "W/m**2" }, + { 256, -1, 0, "DQTHI", "heatflux net over seaice", "W/m**2" }, + { 257, -1, 0, "DTICEO", "Equi. temp over seaice", "K" }, + { 270, -1, 0, "AOFLNHWO", "oasis net heat flux water", "W/m**2" }, + { 271, -1, 0, "AOFLSHWO", "oasis downward short wave", "W/m**2" }, + { 272, -1, 0, "AOFLRHIO", "oasis residual heat flux ice", "W/m**2" }, + { 273, -1, 0, "AOFLCHIO", "oasis conduct. heat flux ice", "W/m**2" }, + { 274, -1, 0, "AOFLFRWO", "oasis fluid fresh water flux", "m/s" }, + { 275, -1, 0, "AOFLFRIO", "oasis solid fresh water flux", "m/s" }, + { 276, -1, 0, "AOFLTXWO", "oasis wind stress water x", "Pa/102" }, + { 277, -1, 0, "AOFLTYWO", "oasis wind stress water y", "Pa/102" }, + { 278, -1, 0, "AOFLTXIO", "oasis wind stress ice x", "Pa/102" }, + { 279, -1, 0, "AOFLTYIO", "oasis wind stress ice x", "Pa/102" }, + { 280, -1, 0, "AOFLWSVO", "oasis wind speed", "m/s" }, +}; + +static const param_type ecmwf[] = { + { 1, -1, 0, "STRF", "Stream function", "m**2 s**-1" }, + { 2, -1, 0, "VPOT", "Velocity potential", "m**2 s**-1" }, + { 3, -1, 0, "PT", "Potential temperature", "K" }, + { 4, -1, 0, "EQPT", "Equivalent potential temperature", "K" }, + { 5, -1, 0, "SEPT", "Saturated equivalent potential temperature", "K" }, + { 11, -1, 0, "UDVW", "U component of divergent wind", "m s**-1" }, + { 12, -1, 0, "VDVW", "V component of divergent wind", "m s**-1" }, + { 13, -1, 0, "URTW", "U component of rotational wind", "m s**-1" }, + { 14, -1, 0, "VRTW", "V component of rotational wind", "m s**-1" }, + { 21, -1, 0, "UCTP", "Unbalanced component of temperature", "K" }, + { 22, -1, 0, "UCLN", "Unbalanced component of logarithm of surface pressure", NULL }, + { 23, -1, 0, "UCDV", "Unbalanced component of divergence", "s**-1" }, + { 26, -1, 0, "CL", "Lake cover", NULL }, + { 27, -1, 0, "CVL", "Low vegetation cover", NULL }, + { 28, -1, 0, "CVH", "High vegetation cover", NULL }, + { 29, -1, 0, "TVL", "Type of low vegetation", NULL }, + { 30, -1, 0, "TVH", "Type of high vegetation", NULL }, + { 31, -1, 0, "CI", "Sea-ice cover", NULL }, + { 32, -1, 0, "ASN", "Snow albedo", NULL }, + { 33, -1, 0, "RSN", "Snow density kg", "m**-3" }, + { 34, -1, 0, "SSTK", "Sea surface temperature", "K" }, + { 35, -1, 0, "ISTL1", "Ice surface temperature layer 1", "K" }, + { 36, -1, 0, "ISTL2", "Ice surface temperature layer 2", "K" }, + { 37, -1, 0, "ISTL3", "Ice surface temperature layer 3", "K" }, + { 38, -1, 0, "ISTL4", "Ice surface temperature layer 4", "K" }, + { 39, -1, 0, "SWVL1", "Volumetric soil water layer 1", "m**3 m**-3" }, + { 40, -1, 0, "SWVL2", "Volumetric soil water layer 2", "m**3 m**-3" }, + { 41, -1, 0, "SWVL3", "Volumetric soil water layer 3", "m**3 m**-3" }, + { 42, -1, 0, "SWVL4", "Volumetric soil water layer 4", "m**3 m**-3" }, + { 43, -1, 0, "SLT", "Soil type", NULL }, + { 44, -1, 0, "ES", "Snow evaporation m of water", NULL }, + { 45, -1, 0, "SMLT", "Snowmelt m of water", NULL }, + { 46, -1, 0, "SDUR", "Solar duration", "s" }, + { 47, -1, 0, "DSRP", "Direct solar radiation", "w m**-2" }, + { 48, -1, 0, "MAGSS", "Magnitude of surface stress", "N m**-2 s" }, + { 49, -1, 0, "WG10", "Wind gust at 10 metres", "m s**-1" }, + { 50, -1, 0, "LSPF", "Large-scale precipitation fraction", "s" }, + { 51, -1, 0, "MX2T24", "Maximum 2 metre temperature", "K" }, + { 52, -1, 0, "MN2T24", "Minimum 2 metre temperature", "K" }, + { 53, -1, 0, "MONT", "Montgomery potential", "m**2 s**-2" }, + { 54, -1, 0, "PRES", "Pressure", "Pa" }, + { 55, -1, 0, "MEAN2T24", "Mean 2 metre temperature past 24 hours", "K" }, + { 56, -1, 0, "MEAN2D24", "Mean 2 metre dewpoint temperature past 24 hours", "K" }, + { 60, -1, 0, "PV", "Potential vorticity", "K m**2 kg**-1 s**-1" }, + { 127, -1, 0, "AT", "Atmospheric tide", NULL }, + { 128, -1, 0, "BV", "Budget values", NULL }, + { 129, -1, 0, "Z", "Geopotential", "m**2 s**-2" }, + { 130, -1, 0, "T", "Temperature", "K" }, + { 131, -1, 0, "U", "U velocity", "m s**-1" }, + { 132, -1, 0, "V", "V velocity", "m s**-1" }, + { 133, -1, 0, "Q", "Specific humidity", "kg kg**-1" }, + { 134, -1, 0, "SP", "Surface pressure", "Pa" }, + { 135, -1, 0, "W", "Vertical velocity", "Pa s**-1" }, + { 136, -1, 0, "TCW", "Total column water", "kg m**-2" }, + { 137, -1, 0, "TCWV", "Total column water vapour", "kg m**-2" }, + { 138, -1, 0, "VO", "Vorticity (relative)", "s**-1" }, + { 139, -1, 0, "STL1", "Soil temperature level 1", "K" }, + { 140, -1, 0, "SWL1", "Soil wetness level 1 m of water", NULL }, + { 141, -1, 0, "SD", "Snow depth 1 m of water equivalent", NULL }, + { 142, -1, 0, "LSP", "Stratiform precipitation (Large scale precipitation)", "m" }, + { 143, -1, 0, "CP", "Convective precipitation", "m" }, + { 144, -1, 0, "SF", "Snowfall (convective + stratiform)", "m" }, + { 145, -1, 0, "BLD", "Boundary layer dissipation", "W m**-2 s" }, + { 146, -1, 0, "SSHF", "Surface sensible heat flux", "W m**-2 s" }, + { 147, -1, 0, "SLHF", "Surface latent heat flux", "W m**-2 s" }, + { 148, -1, 0, "CHNK", "Charnock", NULL }, + { 149, -1, 0, "SNR", "Surface net radiation", "W m**-2 s" }, + { 150, -1, 0, "TNR", "Top net radiation", NULL }, + { 151, -1, 0, "MSL", "Mean sea-level pressure", "Pa" }, + { 152, -1, 0, "LNSP", "Logarithm of surface pressure", NULL }, + { 153, -1, 0, "SWHR", "Short-wave heating rate", "K" }, + { 154, -1, 0, "LWHR", "Long-wave heating rate", "K" }, + { 155, -1, 0, "D", "Divergence", "s**-1" }, + { 156, -1, 0, "GH", "Height m Geopotential height", NULL }, + { 157, -1, 0, "R", "Relative humidity", "%" }, + { 158, -1, 0, "TSP", "Tendency of surface pressure", "Pa s**-1" }, + { 159, -1, 0, "BLH", "Boundary layer height", "m" }, + { 160, -1, 0, "SDOR", "Standard deviation of orography", NULL }, + { 161, -1, 0, "ISOR", "Anisotropy of sub-gridscale orography", NULL }, + { 162, -1, 0, "ANOR", "Angle of sub-gridscale orography", "rad" }, + { 163, -1, 0, "SLOR", "Slope of sub-gridscale orography", NULL }, + { 164, -1, 0, "TCC", "Total cloud cover", NULL }, + { 165, -1, 0, "U10M", "10 metre U wind component", "m s**-1" }, + { 166, -1, 0, "V10M", "10 metre V wind component", "m s**-1" }, + { 167, -1, 0, "T2M", "2 metre temperature", "K" }, + { 168, -1, 0, "D2M", "2 metre dewpoint temperature", "K" }, + { 169, -1, 0, "SSRD", "Surface solar radiation downwards", "W m**-2 s" }, + { 170, -1, 0, "STL2", "Soil temperature level 2", "K" }, + { 171, -1, 0, "SWL2", "Soil wetness level 2", "m of water" }, + { 172, -1, 0, "LSM", "Land/sea mask", NULL }, + { 173, -1, 0, "SR", "Surface roughness", "m" }, + { 174, -1, 0, "AL", "Albedo", NULL }, + { 175, -1, 0, "STRD", "Surface thermal radiation downwards", "W m**-2 s" }, + { 176, -1, 0, "SSR", "Surface solar radiation", "W m**-2 s" }, + { 177, -1, 0, "STR", "Surface thermal radiation", "W m**-2 s" }, + { 178, -1, 0, "TSR", "Top solar radiation", "W m**-2 s" }, + { 179, -1, 0, "TTR", "Top thermal radiation", "W m**-2 s" }, + { 180, -1, 0, "EWSS", "East/West surface stress", "N m**-2 s" }, + { 181, -1, 0, "NSSS", "North/South surface stress", "N m**-2 s" }, + { 182, -1, 0, "E", "Evaporation", "m of water" }, + { 183, -1, 0, "STL3", "Soil temperature level 3", "K" }, + { 184, -1, 0, "SWL3", "Soil wetness level 3", "m of water" }, + { 185, -1, 0, "CCC", "Convective cloud cover", NULL }, + { 186, -1, 0, "LCC", "Low cloud cover", NULL }, + { 187, -1, 0, "MCC", "Medium cloud cover", NULL }, + { 188, -1, 0, "HCC", "High cloud cover", NULL }, + { 189, -1, 0, "SUND", "Sunshine duration", "s" }, + { 190, -1, 0, "EWOV", "EW component of subgrid orographic variance", "m**2" }, + { 191, -1, 0, "NSOV", "NS component of subgrid orographic variance", "m**2" }, + { 192, -1, 0, "NWOV", "NWSE component of subgrid orographic variance", "m**2" }, + { 193, -1, 0, "NEOV", "NESW component of subgrid orographic variance", "m**2" }, + { 194, -1, 0, "BTMP", "Brightness temperature", "K" }, + { 195, -1, 0, "LGWS", "Lat. component of gravity wave stress", "N m**-2 s" }, + { 196, -1, 0, "MGWS", "Meridional component of gravity wave stress", "N m**-2 s" }, + { 197, -1, 0, "GWD", "Gravity wave dissipation", "W m**-2 s" }, + { 198, -1, 0, "SRC", "Skin reservoir content", "m of water" }, + { 199, -1, 0, "VEG", "Vegetation fraction", NULL }, + { 200, -1, 0, "VSO", "Variance of sub-gridscale orography", "m**2" }, + { 201, -1, 0, "MX2T", "Maximum 2 metre temperature since previous post-processing", "K" }, + { 202, -1, 0, "MN2T", "Minimum 2 metre temperature since previous post-processing", "K" }, + { 203, -1, 0, "O3", "Ozone mass mixing ratio", "kg kg**-1" }, + { 204, -1, 0, "PAW", "Precipiation analysis weights", NULL }, + { 205, -1, 0, "RO", "Runoff", "m" }, + { 206, -1, 0, "TCO3", "Total column ozone", "kg m**-2" }, + { 207, -1, 0, "WS10", "10 meter windspeed", "m s**-1" }, + { 208, -1, 0, "TSRC", "Top net solar radiation, clear sky", "W m**-2" }, + { 209, -1, 0, "TTRC", "Top net thermal radiation, clear sky", "W m**-2" }, + { 210, -1, 0, "SSRC", "Surface net solar radiation, clear sky", "W m**-2" }, + { 211, -1, 0, "STRC", "Surface net thermal radiation, clear sky", "W m**-2" }, + { 212, -1, 0, "SI", "Solar insolation", "W m**-2" }, + { 214, -1, 0, "DHR", "Diabatic heating by radiation", "K" }, + { 215, -1, 0, "DHVD", "Diabatic heating by vertical diffusion", "K" }, + { 216, -1, 0, "DHCC", "Diabatic heating by cumulus convection", "K" }, + { 217, -1, 0, "DHLC", "Diabatic heating large-scale condensation", "K" }, + { 218, -1, 0, "VDZW", "Vertical diffusion of zonal wind", "m s**-1" }, + { 219, -1, 0, "VDMW", "Vertical diffusion of meridional wind", "m s**-1" }, + { 220, -1, 0, "EWGD", "EW gravity wave drag tendency", "m s**-1" }, + { 221, -1, 0, "NSGD", "NS gravity wave drag tendency", "m s**-1" }, + { 222, -1, 0, "CTZW", "Convective tendency of zonal wind", "m s**-1" }, + { 223, -1, 0, "CTMW", "Convective tendency of meridional wind", "m s**-1" }, + { 224, -1, 0, "VDH", "Vertical diffusion of humidity", "kg kg**-1" }, + { 225, -1, 0, "HTCC", "Humidity tendency by cumulus convection", "kg kg**-1" }, + { 226, -1, 0, "HTLC", "Humidity tendency large-scale condensation", "kg kg**-1" }, + { 227, -1, 0, "CRNH", "Change from removing negative humidity", "kg kg**-1" }, + { 228, -1, 0, "TP", "Total precipitation", "m" }, + { 229, -1, 0, "IEWS", "Instantaneous X surface stress", "N m**-2" }, + { 230, -1, 0, "INSS", "Instantaneous Y surface stress", "N m**-2" }, + { 231, -1, 0, "ISHF", "Instantaneous surface heat flux", "W m**-2" }, + { 232, -1, 0, "IE", "Instantaneous moisture flux", "kg m**-2 s" }, + { 233, -1, 0, "ASQ", "Apparent surface humidity", "kg kg**-1" }, + { 234, -1, 0, "LSRH", "Logarithm of surface roughness length for heat", NULL }, + { 235, -1, 0, "SKT", "Skin temperature", "K" }, + { 236, -1, 0, "STL4", "Soil temperature level 4", "K" }, + { 237, -1, 0, "SWL4", "Soil wetness level 4", "m" }, + { 238, -1, 0, "TSN", "Temperature of snow layer", "K" }, + { 239, -1, 0, "CSF", "Convective snowfall", "m of water equivalent" }, + { 240, -1, 0, "LSF", "Large-scale snowfall", "m of water equivalent" }, + { 241, -1, 0, "ACF", "Accumulated cloud fraction tendency", NULL }, + { 242, -1, 0, "ALW", "Accumulated liquid water tendency", NULL }, + { 243, -1, 0, "FAL", "Forecast albedo", NULL }, + { 244, -1, 0, "FSR", "Forecast surface roughness", "m" }, + { 245, -1, 0, "FLSR", "Forecast log of surface roughness for heat", NULL }, + { 246, -1, 0, "CLWC", "Cloud liquid water content", "kg kg**-1" }, + { 247, -1, 0, "CIWC", "Cloud ice water content", "kg kg**-1" }, + { 248, -1, 0, "CC", "Cloud cover", NULL }, + { 249, -1, 0, "AIW", "Accumulated ice water tendency", NULL }, + { 250, -1, 0, "ICE", "Ice age", NULL }, + { 251, -1, 0, "ATTE", "Adiabatic tendency of temperature", "K" }, + { 252, -1, 0, "ATHE", "Adiabatic tendency of humidity", "kg kg**-1" }, + { 253, -1, 0, "ATZE", "Adiabatic tendency of zonal wind", "m s**-1" }, + { 254, -1, 0, "ATMW", "Adiabatic tendency of meridional wind", "m s**-1" }, +}; + +static const param_type remo[] = { + { 14, -1, 0, "FTKVM", "turbulent transfer coefficient of momentum in the atmosphere", NULL }, + { 15, -1, 0, "FTKVH", "turbulent transfer coefficient of heat in the atmosphere", NULL }, + { 38, -1, 0, "U10ER", "10m u-velocity", "m/s" }, + { 39, -1, 0, "V10ER", "10m v-velocity", "m/s" }, + { 40, -1, 0, "CAPE", "convetive available potential energy", NULL }, + { 41, -1, 0, "GHPBL", "height of the planetary boudary layer", "gpm" }, + { 42, -1, 0, "BETA", "BETA", NULL }, + { 43, -1, 0, "WMINLOK", "WMINLOK", NULL }, + { 44, -1, 0, "WMAXLOK", "WMAXLOK", NULL }, + { 45, -1, 0, "VBM10M", "maximum of the expected gust velocity near the surface", "m/s" }, + { 46, -1, 0, "BFLHS", "surface sensible heat flux", "W/m**2" }, + { 47, -1, 0, "BFLQDS", "surface latent heat flux", "W/m**2" }, + { 48, -1, 0, "TMCM", "turbulent transfer coefficient of momentum at the surface", NULL }, + { 49, -1, 0, "TRSOL", "TRSOL", NULL }, + { 50, -1, 0, "TMCH", "turbulent transfer coefficient of heat at the surface", NULL }, + { 51, -1, 0, "EMTEF", "EMTEF", NULL }, + { 52, -1, 0, "TRSOF", "TRSOF", NULL }, + { 53, -1, 0, "DRAIN", "drainage", "mm" }, + { 54, -1, 0, "TSL", "surface temperature (land)", "K" }, + { 55, -1, 0, "TSW", "surface temperature (water)", "K" }, + { 56, -1, 0, "TSI", "surface temperature (ice)", "K" }, + { 57, -1, 0, "USTRL", "surface u-stress (land)", "Pa" }, + { 58, -1, 0, "USTRW", "surface u-stress (water)", "Pa" }, + { 59, -1, 0, "USTRI", "surface u-stress (ice)", "Pa" }, + { 60, -1, 0, "VSTRL", "surface v-stress (land)", "Pa" }, + { 61, -1, 0, "VSTRW", "surface v-stress (water)", "Pa" }, + { 62, -1, 0, "VSTRI", "surface v-stress (ice)", "Pa" }, + { 63, -1, 0, "EVAPL", "surface evaporation (land)", "mm" }, + { 64, -1, 0, "EVAPW", "surface evaporation (water)", "mm" }, + { 65, -1, 0, "EVAPI", "surface evaporation (ice)", "mm" }, + { 66, -1, 0, "AHFLL", "surface latent heat flux (land)", "W/m**2" }, + { 67, -1, 0, "AHFLW", "surface latent heat flux (water)", "W/m**2" }, + { 68, -1, 0, "AHFLI", "surface latent heat flux (ice)", "W/m**2" }, + { 69, -1, 0, "AHFSL", "surface sensible heat flux (land)", "W/m**2" }, + { 70, -1, 0, "AHFSW", "surface sensible heat flux (water)", "W/m**2" }, + { 71, -1, 0, "AHFSI", "surface sensible heat flux (ice)", "W/m**2" }, + { 72, -1, 0, "AZ0L", "surface roughness length (land)", "m" }, + { 73, -1, 0, "AZ0W", "surface roughness length (water)", "m" }, + { 74, -1, 0, "AZ0I", "surface roughness length (ice)", "m" }, + { 75, -1, 0, "ALSOL", "surface albedo (land)", "fract." }, + { 76, -1, 0, "ALSOW", "surface albedo (water)", "fract." }, + { 77, -1, 0, "ALSOI", "surface albedo (ice)", "fract." }, + { 81, -1, 0, "TMCHL", "turbulent transfer coefficient of heat at the surface (land)", NULL }, + { 82, -1, 0, "TMCHW", "turbulent transfer coefficient of heat at the surface (water)", NULL }, + { 83, -1, 0, "TMCHI", "turbulent transfer coefficient of heat at the surface (ice)", NULL }, + { 84, -1, 0, "QDBL", "specific humidity surface (land)", "kg/kg" }, + { 85, -1, 0, "QDBW", "specific humidity surface (water)", "kg/kg" }, + { 86, -1, 0, "QDBI", "specific humidity surface (ice)", "kg/kg" }, + { 87, -1, 0, "BFLHSL", "surface sensible heat flux (land)", "W/m**2" }, + { 88, -1, 0, "BFLHSW", "surface sensible heat flux (water)", "W/m**2" }, + { 89, -1, 0, "BFLHSI", "surface sensible heat flux (ice)", "W/m**2" }, + { 90, -1, 0, "BFLQDSL", "surface latent heat flux (land)", "W/m**2" }, + { 91, -1, 0, "BFLQDSW", "surface latent heat flux (water)", "W/m**2" }, + { 92, -1, 0, "BFLQDSI", "surface latent heat flux (ice)", "W/m**2" }, + { 93, -1, 0, "AHFICE", "sea-ice: conductive heat", "W/m" }, + { 94, -1, 0, "QRES", "residual heat flux for melting sea ice", "W/m**2" }, + { 95, -1, 0, "SRFL", "SRFL", NULL }, + { 96, -1, 0, "QDBOXS", "horizontal transport of water vapour", "kg/m**2" }, + { 97, -1, 0, "QWBOXS", "horizontal transport of cloud water", "kg/m**2" }, + { 98, -1, 0, "EKBOXS", "horizontal transport of kinetic energy", "(3600*J)/m**2" }, + { 99, -1, 0, "FHBOXS", "horizontal transport of sensible heat", "(3600*J)/m**2" }, + { 100, -1, 0, "FIBOXS", "horizontal transport of potential energy", "(3600*J)/m**2" }, + { 101, -1, 0, "TLAMBDA", "heat conductivity of dry soil", "W/(K*m)" }, + { 103, -1, 0, "DLAMBDA", "parameter for increasing the heat conductivity of the soil", NULL }, + { 104, -1, 0, "PORVOL", "pore volume", NULL }, + { 105, -1, 0, "FCAP", "field capacity of soil", NULL }, + { 106, -1, 0, "WI3", "fraction of frozen soil", NULL }, + { 107, -1, 0, "WI4", "fraction of frozen soil", NULL }, + { 108, -1, 0, "WI5", "fraction of frozen soil", NULL }, + { 109, -1, 0, "WI", "fraction of frozen soil", NULL }, + { 110, -1, 0, "WICL", "fraction of frozen soil", NULL }, + { 112, -1, 0, "QDB", "specific humidity surface", "kg/kg" }, + { 129, -1, 0, "FIB", "surface geopotential (orography)", "m" }, + { 130, -1, 0, "T", "temperature", "K" }, + { 131, -1, 0, "U", "u-velocity", "m/s" }, + { 132, -1, 0, "V", "v-velocity", "m/s" }, + { 133, -1, 0, "QD", "specific humidity", "kg/kg" }, + { 134, -1, 0, "PS", "Surface pressure", "Pa" }, + { 135, -1, 0, "VERVEL", "Vertical velocity", "Pa/s" }, + { 138, -1, 0, "SVO", "vorticity", "1/s" }, + { 139, -1, 0, "TS", "surface temperature", "K" }, + { 140, -1, 0, "WS", "soil wetness", "m" }, + { 141, -1, 0, "SN", "snow depth", "m" }, + { 142, -1, 0, "APRL", "large scale precipitation", "mm" }, + { 143, -1, 0, "APRC", "convective precipitation", "mm" }, + { 144, -1, 0, "APRS", "snow fall", "mm" }, + { 145, -1, 0, "VDIS", "boundary layer dissipation", "W/m**2" }, + { 146, -1, 0, "AHFS", "surface sensible heat flux", "W/m**2" }, + { 147, -1, 0, "AHFL", "surface latent heat flux", "W/m**2" }, + { 148, -1, 0, "STREAM", "streamfunction", "m**2/s" }, + { 149, -1, 0, "VELOPOT", "velocity potential", "m**2/s" }, + { 151, -1, 0, "PSRED", "mean sea level pressure", "Pa" }, + { 152, -1, 0, "LSP", "log surface pressure", NULL }, + { 153, -1, 0, "QW", "liquid water content", "kg/kg" }, + { 155, -1, 0, "SD", "divergence", "1/s" }, + { 156, -1, 0, "FI", "geopotential height", "gpm" }, + { 159, -1, 0, "USTAR3", "ustar**3", "m**3/s**3" }, + { 160, -1, 0, "RUNOFF", "surface runoff", "mm" }, + { 162, -1, 0, "ACLC", "cloud cover", "fract." }, + { 163, -1, 0, "ACLCV", "total cloud cover", "fract." }, + { 164, -1, 0, "ACLCOV", "total cloud cover", "fract." }, + { 165, -1, 0, "U10", "10m u-velocity", "m/s" }, + { 166, -1, 0, "V10", "10m v-velocity", "m/s" }, + { 167, -1, 0, "TEMP2", "2m temperature", "K" }, + { 168, -1, 0, "DEW2", "2m dew point temperature", "K" }, + { 169, -1, 0, "TSURF", "surface temperature (land)", "K" }, + { 170, -1, 0, "TD", "deep soil temperature", "K" }, + { 171, -1, 0, "WIND10", "10m windspeed", "m/s" }, + { 172, -1, 0, "BLA", "land sea mask", "fract." }, + { 173, -1, 0, "AZ0", "surface roughness length", "m" }, + { 174, -1, 0, "ALB", "surface background albedo", "fract." }, + { 175, -1, 0, "ALBEDO", "surface albedo", "fract." }, + { 176, -1, 0, "SRADS", "net surface solar radiation", "W/m**2" }, + { 177, -1, 0, "TRADS", "net surface thermal radiation", "W/m**2" }, + { 178, -1, 0, "SRAD0", "net top solar radiation", "W/m**2" }, + { 179, -1, 0, "TRAD0", "top thermal radiation (OLR)", "W/m**2" }, + { 180, -1, 0, "USTR", "surface u-stress", "Pa" }, + { 181, -1, 0, "VSTR", "surface v-stress", "Pa" }, + { 182, -1, 0, "EVAP", "surface evaporation", "mm" }, + { 183, -1, 0, "TDCL", "soil temperature", "K" }, + { 185, -1, 0, "SRAFS", "net surf. solar radiation (clear sky)", "W/m**2" }, + { 186, -1, 0, "TRAFS", "net surf. thermal radiation (clear sky)", "W/m**2" }, + { 187, -1, 0, "SRAF0", "net top solar radiation (clear sky)", "W/m**2" }, + { 188, -1, 0, "TRAF0", "net top thermal radiation (clear sky)", "W/m**2" }, + { 189, -1, 0, "SCLFS", "surface solar cloud forcing", "W/m**2" }, + { 190, -1, 0, "TCLFS", "surface thermal cloud forcing", "W/m**2" }, + { 191, -1, 0, "SCLF0", "top solar cloud forcing", "W/m**2" }, + { 192, -1, 0, "TCLF0", "top thermal cloud forcing", "W/m**2" }, + { 194, -1, 0, "WL", "skin reservoir content", "m" }, + { 195, -1, 0, "USTRGW", "u-gravity wave stress", "Pa" }, + { 196, -1, 0, "VSTRGW", "v-gravity wave stress", "Pa" }, + { 197, -1, 0, "VDISGW", "gravity wave dissipation", "W/m**2" }, + { 198, -1, 0, "VGRAT", "vegetation ratio", NULL }, + { 199, -1, 0, "VAROR", "orographic variance (for surface runoff)", NULL }, + { 200, -1, 0, "VLT", "leaf area index", NULL }, + { 201, -1, 0, "T2MAX", "maximum 2m-temperature", "K" }, + { 202, -1, 0, "T2MIN", "minimum 2m-temperature", "K" }, + { 203, -1, 0, "SRAD0U", "top solar radiation upward", "W/m**2" }, + { 204, -1, 0, "SRADSU", "surface solar radiation upward", "W/m**2" }, + { 205, -1, 0, "TRADSU", "surface thermal radiation upward", "W/m**2" }, + { 206, -1, 0, "TSN", "snow temperature", "K" }, + { 207, -1, 0, "TD3", "soil temperature", "K" }, + { 208, -1, 0, "TD4", "soil temperature", "K" }, + { 209, -1, 0, "TD5", "soil temperature", "K" }, + { 210, -1, 0, "SEAICE", "sea ice cover", "fract." }, + { 211, -1, 0, "SICED", "sea ice depth", "m" }, + { 212, -1, 0, "FOREST", "vegetation type", NULL }, + { 213, -1, 0, "TEFF", "(effective) sea-ice skin temperature", "K" }, + { 214, -1, 0, "TSMAX", "maximum surface temperature", "K" }, + { 215, -1, 0, "TSMIN", "minimum surface temperature", "K" }, + { 216, -1, 0, "WIMAX", "maximum 10m-wind speed", "m/s" }, + { 217, -1, 0, "TOPMAX", "maximum height of convective cloud tops", "Pa" }, + { 218, -1, 0, "SNMEL", "snow melt", "mm" }, + { 220, -1, 0, "TSLIN", "land: residual surface heat budget", "W/m**2" }, + { 221, -1, 0, "DSNAC", "snow depth change", "mm" }, + { 222, -1, 0, "EMTER", "EMTER", NULL }, + { 223, -1, 0, "ACLCAC", "cloud cover", "fract." }, + { 224, -1, 0, "TKE", "turbulent kinetic energy", NULL }, + { 226, -1, 0, "FAO", "FAO data set (soil data flags)", NULL }, + { 227, -1, 0, "RGCGN", "heat capacity of soil", NULL }, + { 229, -1, 0, "WSMX", "field capacity of soil", NULL }, + { 230, -1, 0, "QVI", "vertically integrated specific humidity", "kg/m**2" }, + { 231, -1, 0, "ALWCVI", "vertically integrated liquid water cont.", "kg/m**2" }, + { 232, -1, 0, "GLAC", "glacier mask", NULL }, + { 253, -1, 0, "PHI", "latitude in real coordinates", "degrees_north" }, + { 254, -1, 0, "RLA", "longitude in real coordinates", "degrees_east" }, + { 259, -1, 0, "WINDSPEED", "windspeed (sqrt(u**2+v**2))", NULL }, + { 260, -1, 0, "PRECIP", "total precipitation", NULL }, +}; + +static const param_type cosmo002[] = { + { 1, -1, 0, "P", "pressure", "Pa" }, + { 2, -1, 0, "PMSL", "mean sea level pressure", "Pa" }, + { 3, -1, 0, "DPSDT", "surface pressure change", "Pa s-1" }, + { 6, -1, 0, "FI", "geopotential", "m2 s-2" }, + { 8, -1, 0, "HH", "height", "m" }, + { 10, -1, 0, "TO3", "vertical integrated ozone content", "Dobson" }, + { 11, -1, 0, "T", "temperature", "K" }, + { 15, -1, 0, "TMAX", "2m maximum temperature", "K" }, + { 16, -1, 0, "TMIN", "2m minimum temperature", "K" }, + { 17, -1, 0, "TD", "2m dew point temperature", "K" }, + { 31, -1, 0, "DD", "undefined", "undefined" }, + { 32, -1, 0, "FF", "undefined", "undefined" }, + { 33, -1, 0, "U", "U-component of wind", "m s-1" }, + { 34, -1, 0, "V", "V-component of wind", "m s-1" }, + { 39, -1, 0, "OMEGA", "omega", "Pa s-1" }, + { 40, -1, 0, "W", "vertical wind velocity", "m s-1" }, + { 51, -1, 0, "QV", "specific humidity", "kg kg-1" }, + { 52, -1, 0, "RELHUM", "relative humidity", "%" }, + { 54, -1, 0, "TQV", "precipitable water", "kg m-2" }, + { 57, -1, 0, "AEVAP", "surface evaporation", "kg m-2" }, + { 58, -1, 0, "TQI", "vertical integrated cloud ice", "kg m-2" }, + { 59, -1, 0, "TOT_PR", "total precipitation rate", "kg m-2 s-1" }, + { 61, -1, 0, "TOT_PREC", "total precipitation amount", "kg m-2" }, + { 65, -1, 0, "W_SNOW", "surface snow amount", "m" }, + { 66, -1, 0, "H_SNOW", "thickness of snow", "m" }, + { 71, -1, 0, "CLCT", "total cloud cover", "1" }, + { 72, -1, 0, "CLC_CON", "convective cloud area fraction", "1" }, + { 73, -1, 0, "CLCL", "low cloud cover", "1" }, + { 74, -1, 0, "CLCM", "medium cloud cover", "1" }, + { 75, -1, 0, "CLCH", "high cloud cover", "1" }, + { 76, -1, 0, "TQC", "vertical integrated cloud water", "kg m-2" }, + { 78, -1, 0, "SNOW_CON", "convective snowfall", "kg m-2" }, + { 79, -1, 0, "SNOW_GSP", "large scale snowfall", "kg m-2" }, + { 81, -1, 0, "FR_LAND", "land-sea fraction", "1" }, + { 83, -1, 0, "Z0", "surface roughness length", "m" }, + { 84, -1, 0, "ALB_RAD", "surface albedo", "1" }, + { 85, -1, 0, "TSOIL", "soil surface temperature", "K" }, + { 86, -1, 0, "WSOIL", "water content of 1. soil layer", "m" }, + { 87, -1, 0, "PLCOV", "vegetation area fraction", "1" }, + { 90, -1, 0, "RUNOFF", "subsurface runoff", "kg m-2" }, + { 91, -1, 0, "FR_ICE", "sea ice area fraction", "1" }, + { 92, -1, 0, "H_ICE", "sea ice thickness", "m" }, + { 111, -1, 0, "ASOB", "averaged surface net downward shortwave radiation", "W m-2" }, + { 112, -1, 0, "ATHB", "averaged surface net downward longwave radiation", "W m-2" }, + { 113, -1, 0, "ASOB", "averaged TOA net downward shortwave radiation", "W m-2" }, + { 114, -1, 0, "ATHB", "averaged TOA outgoing longwave radiation", "W m-2" }, + { 115, -1, 0, "ASWDIR", "direct downward sw radiation at the surface", "W m-2" }, + { 116, -1, 0, "ASWDIFD", "diffuse downward sw radiation at the surface", "W m-2" }, + { 117, -1, 0, "ASWDIFU", "diffuse upwnward sw radiation at the surface", "W m-2" }, + { 118, -1, 0, "ALWD", "downward lw radiation at the surface", "W m-2" }, + { 119, -1, 0, "ALWU", "upward lw radiation at the surface", "W m-2" }, + { 121, -1, 0, "ALHFL", "averaged surface latent heat flux", "W m-2" }, + { 122, -1, 0, "ASHFL", "averaged surface sensible heat flux", "W m-2" }, + { 124, -1, 0, "AUMFL", "averaged eastward stress", "Pa" }, + { 125, -1, 0, "AVMFL", "averaged northward stress", "Pa" }, + { 128, -1, 0, "SUNSH", "undefined", "undefined" }, + { 129, -1, 0, "SUNSH2", "undefined", "undefined" }, + { 130, -1, 0, "SUN_SUM", "undefined", "undefined" }, + { 131, -1, 0, "SUN_SUM2", "undefined", "undefined" }, + { 133, -1, 0, "FCOR", "undefined", "undefined" }, + { 134, -1, 0, "SKYVIEW", "sky-view factor", "1" }, + { 137, -1, 0, "SWDIR_COR", "topo correction of direct solar radiarion", "1" }, +}; + +static const param_type cosmo201[] = { + { 5, -1, 0, "APAB", "&", "W m-2" }, + { 13, -1, 0, "SOHR_RAD", "&", "K s-1" }, + { 14, -1, 0, "THHR_RAD", "&", "K s-1" }, + { 20, -1, 0, "DURSUN", "duration of sunshine", "s" }, + { 29, -1, 0, "CLC", "cloud area fraction", "1" }, + { 30, -1, 0, "CLC_SGS", "grid scale cloud area fraction", "1" }, + { 31, -1, 0, "QC", "specific cloud liquid water content", "kg kg-1" }, + { 33, -1, 0, "QI", "specific cloud ice content", "kg kg-1" }, + { 35, -1, 0, "QR", "specific rain content", "kg kg-1" }, + { 36, -1, 0, "QS", "specific snow content", "kg kg-1" }, + { 37, -1, 0, "TQR", "total rain water content vertically integrated", "kg m-2" }, + { 38, -1, 0, "TQS", "total snow content vertically integrated", "kg m-2" }, + { 39, -1, 0, "QG", "specific graupel content", "kg kg-1" }, + { 40, -1, 0, "TQG", "total graupel content vertically integrated", "kg m-2" }, + { 41, -1, 0, "TWATER", "cloud condensed water content", "kg m-2" }, + { 42, -1, 0, "TDIV_HUM", "atmosphere water divergence", "kg m-2" }, + { 43, -1, 0, "QC_RAD", "sub scale specific cloud liquid water content", "kg kg-1" }, + { 44, -1, 0, "QI_RAD", "sub scale specific cloud ice content", "kg kg-1" }, + { 61, -1, 0, "CLW_CON", "convective cloud liquid water", "1" }, + { 68, -1, 0, "HBAS_CON", "height of convective cloud base", "m" }, + { 69, -1, 0, "HTOP_CON", "height of convective cloud top", "m" }, + { 70, -1, 0, "HBAS_CONI", "height of convective cloud base", "m" }, + { 71, -1, 0, "HTOP_CONI", "height of convective cloud top", "m" }, + { 72, -1, 0, "BAS_CON", "index of convective cloud base", "1" }, + { 73, -1, 0, "TOP_CON", "index of convective cloud top", "1" }, + { 74, -1, 0, "DT_CON", "convective tendency of temperature", "K s-1" }, + { 75, -1, 0, "DQV_CON", "convective tendency of specific humidity", "s-1" }, + { 78, -1, 0, "DU_CON", "convective tendency of u-wind component", "m s-2" }, + { 79, -1, 0, "DV_CON", "convective tendency of v-wind component", "m s-2" }, + { 82, -1, 0, "HTOP_DC", "height of dry convection top", "m" }, + { 84, -1, 0, "HZEROCL", "height of freezing level", "m" }, + { 85, -1, 0, "SNOWLMT", "height of the snow fall limit in m above sea level", "m" }, + { 86, -1, 0, "HCBAS", "height of cloud base", "m" }, + { 87, -1, 0, "HCTOP", "height of cloud top", "m" }, + { 91, -1, 0, "C_T_LK", "&", "1" }, + { 92, -1, 0, "GAMSO_LK", "&", "m-1" }, + { 93, -1, 0, "DP_BS_LK", "&", "m" }, + { 94, -1, 0, "H_B1_LK", "&", "m" }, + { 95, -1, 0, "H_ML_LK", "&", "m" }, + { 96, -1, 0, "DEPTH_LK", "lake depth", "m" }, + { 97, -1, 0, "FETCH_LK", "wind fetch over lake", "m" }, + { 99, -1, 0, "QRS", "precipitation water (water loading)", "1" }, + { 100, -1, 0, "PRR_GSP", "mass flux density of large scale rainfall", "kg m-2 s-1" }, + { 101, -1, 0, "PRS_GSP", "mass flux density of large scale snowfall", "kg m-2 s-1" }, + { 102, -1, 0, "RAIN_GSP", "large scale rainfall", "kg m-2" }, + { 111, -1, 0, "PRR_CON", "mass flux density of convective rainfall", "kg m-2 s-1" }, + { 112, -1, 0, "PRS_CON", "mass flux density of convective snowfall", "kg m-2 s-1" }, + { 113, -1, 0, "RAIN_CON", "convective rainfall", "kg m-2" }, + { 129, -1, 0, "FRESHSNW", "freshness of snow", "undefined" }, + { 131, -1, 0, "PRG_GSP", "mass flux density of large scale graupel", "kg m-2 s-1" }, + { 132, -1, 0, "GRAU_GSP", "large scale graupel", "kg m-2" }, + { 133, -1, 0, "RHO_SNOW", "density of snow", "kg m-3" }, + { 139, -1, 0, "PP", "deviation from reference pressure", "Pa" }, + { 140, -1, 0, "RCLD", "standard deviation of saturation deficit", "undefined" }, + { 143, -1, 0, "CAPE_MU", "cape of most unstable parcel", "J kg-1" }, + { 144, -1, 0, "CIN_MU", "convective inhibition of most unstable parcel", "J kg-1" }, + { 145, -1, 0, "CAPE_ML", "cape of mean surface layer parcel", "J kg-1" }, + { 146, -1, 0, "CIN_ML", "convective inhibition of mean surface layer parcel", "J kg-1" }, + { 147, -1, 0, "TKE_CON", "convective turbulent kinetic energy", "undefined" }, + { 148, -1, 0, "TKETENS", "tendency of turbulent kinetic energy", "undefined" }, + { 152, -1, 0, "TKE", "turbulent kinetic energy", "m2 s-2" }, + { 153, -1, 0, "TKVM", "diffusion coefficient of momentum", "m2 s-1" }, + { 154, -1, 0, "TKVH", "diffusion coefficient of heat", "m2 s-1" }, + { 170, -1, 0, "TCM", "drag coefficient of momentum", "1" }, + { 171, -1, 0, "TCH", "drag coefficient of heat", "1" }, + { 187, -1, 0, "VMAX", "maximum turbulent wind gust in 10m", "m s-1" }, + { 190, -1, 0, "TSOIL", "&", "K" }, + { 191, -1, 0, "TSOIL", "&", "K" }, + { 192, -1, 0, "TSOIL", "&", "K" }, + { 193, -1, 0, "TSOIL", "mixed layer temperature", "K" }, + { 194, -1, 0, "TSOIL", "mean temperature of water column", "K" }, + { 197, -1, 0, "TSOIL", "soil temperature", "K" }, + { 198, -1, 0, "W_SO", "soil water content", "m" }, + { 199, -1, 0, "W_SO_ICE", "soil frozen water content", "m" }, + { 200, -1, 0, "W_I", "canopy water amount", "m" }, + { 203, -1, 0, "TSOIL", "snow surface temperature", "K" }, + { 215, -1, 0, "TSOIL", "temperature of ice upper surface", "K" }, + { 230, -1, 0, "dBZ", "unattenuated radar reflectivity in Rayleigh approximation", "1" }, + { 240, -1, 0, "MFLX_CON", "convective mass flux density", "kg m-2 s-1" }, + { 241, -1, 0, "CAPE_CON", "&", "J kg-1" }, + { 243, -1, 0, "QCVG_CON", "&", "s-1" }, +}; + +static const param_type cosmo202[] = { + { 46, -1, 0, "SSO_STDH", "standard deviation of subgrid scale height", "m" }, + { 47, -1, 0, "SSO_GAMMA", "anisotropy of topography", "-" }, + { 48, -1, 0, "SSO_THETA", "angle between principal axis of orography and global east", "-" }, + { 49, -1, 0, "SSO_SIGMA", "mean slope of subgrid scale orography", "-" }, + { 55, -1, 0, "FR_LAKE", "fraction of inland lake water", "1" }, + { 57, -1, 0, "SOILTYP", "soil type", "1" }, + { 61, -1, 0, "LAI", "leaf area index", "1" }, + { 62, -1, 0, "ROOTDP", "root depth", "m" }, + { 64, -1, 0, "HMO3", "air pressure at ozone maximum", "Pa" }, + { 65, -1, 0, "VIO3", "vertical integrated ozone amount", "Pa" }, + { 67, -1, 0, "PLCOV_MX", "vegetation area fraction maximum", "1" }, + { 68, -1, 0, "PLCOV_MN", "vegetation area fraction minimum", "1" }, + { 69, -1, 0, "LAI_MX", "leaf area index maximum", "1" }, + { 70, -1, 0, "LAI_MN", "leaf area index minimum", "1" }, + { 75, -1, 0, "FOR_E", "ground fraction covered by evergreen forest", "-" }, + { 76, -1, 0, "FOR_D", "ground fraction covered by deciduous forest", "-" }, + { 104, -1, 0, "DQVDT", "tendency of water vapor", "s-1" }, + { 105, -1, 0, "QVSFLX", "surface flux of water vapour", "s-1m-2" }, + { 113, -1, 0, "FC", "coriolis parameter", "s-1" }, + { 114, -1, 0, "RLAT", "latitude", "radian" }, + { 115, -1, 0, "RLON", "longitude", "radian" }, + { 121, -1, 0, "ZTD", "integrated total atmospheric refractivity", "undefined" }, + { 122, -1, 0, "ZWD", "integrated wet atmospheric refractivity", "undefined" }, + { 123, -1, 0, "ZHD", "integrated dry atmospheric refractivity", "undefined" }, + { 180, -1, 0, "O3", "ozone mass mixing ratio", "kg kg-1" }, + { 200, -1, 0, "I131a", "undefined", "undefined" }, + { 201, -1, 0, "I131a_DD", "undefined", "undefined" }, + { 202, -1, 0, "I131a_WD", "undefined", "undefined" }, + { 203, -1, 0, "Cs137", "undefined", "undefined" }, + { 204, -1, 0, "Cs137_DD", "undefined", "undefined" }, + { 205, -1, 0, "Cs137_WD", "undefined", "undefined" }, + { 206, -1, 0, "Te132", "undefined", "undefined" }, + { 207, -1, 0, "Te132_DD", "undefined", "undefined" }, + { 208, -1, 0, "Te132_WD", "undefined", "undefined" }, + { 209, -1, 0, "Zr95", "undefined", "undefined" }, + { 210, -1, 0, "Zr95_DD", "undefined", "undefined" }, + { 211, -1, 0, "Zr95_WD", "undefined", "undefined" }, + { 212, -1, 0, "Kr85", "undefined", "undefined" }, + { 213, -1, 0, "Kr85_DD", "undefined", "undefined" }, + { 214, -1, 0, "Kr85_WD", "undefined", "undefined" }, + { 215, -1, 0, "TRACER", "undefined", "undefined" }, + { 216, -1, 0, "TRACER_DD", "undefined", "undefined" }, + { 217, -1, 0, "TRACER_WD", "undefined", "undefined" }, + { 218, -1, 0, "Xe133", "undefined", "undefined" }, + { 219, -1, 0, "Xe133_DD", "undefined", "undefined" }, + { 220, -1, 0, "Xe133_WD", "undefined", "undefined" }, + { 221, -1, 0, "I131g", "undefined", "undefined" }, + { 222, -1, 0, "I131g_DD", "undefined", "undefined" }, + { 223, -1, 0, "I131g_WD", "undefined", "undefined" }, + { 224, -1, 0, "I131o", "undefined", "undefined" }, + { 225, -1, 0, "I131o_DD", "undefined", "undefined" }, + { 226, -1, 0, "I131o_WD", "undefined", "undefined" }, + { 227, -1, 0, "Ba140", "undefined", "undefined" }, + { 228, -1, 0, "Ba140_DD", "undefined", "undefined" }, + { 229, -1, 0, "Ba140_WD", "undefined", "undefined" }, + { 230, -1, 0, "Sr90", "undefined", "undefined" }, + { 231, -1, 0, "Sr90_DD", "undefined", "undefined" }, + { 232, -1, 0, "Sr90_WD", "undefined", "undefined" }, + { 233, -1, 0, "Ru103", "undefined", "undefined" }, + { 234, -1, 0, "Ru103_DD", "undefined", "undefined" }, + { 235, -1, 0, "Ru103_WD", "undefined", "undefined" }, +}; + +static const param_type cosmo203[] = { + { 135, -1, 0, "LCL_ML", "undefined", "undefined" }, + { 136, -1, 0, "LFC_ML", "undefined", "undefined" }, + { 137, -1, 0, "CAPE_3KM", "undefined", "undefined" }, + { 138, -1, 0, "SWISS00", "swiss00 index", "1" }, + { 139, -1, 0, "SWISS12", "swiss12 index", "1" }, + { 147, -1, 0, "SLI", "surface lifted index", "K" }, + { 149, -1, 0, "SI", "showalter index", "K" }, + { 155, -1, 0, "BRN", "undefined", "undefined" }, + { 156, -1, 0, "HPBL", "undefined", "undefined" }, + { 203, -1, 0, "CLDEPTH", "normalized cloud depth", "1" }, + { 204, -1, 0, "CLCT_MOD", "modified_total_cloud_cover", "1" }, +}; + +static const param_type cosmo205[] = { + { 1, -1, 0, "SYNME5", "synthetic satellite images Meteosat5", "-" }, + { 2, -1, 0, "SYNME6", "synthetic satellite images Meteosat6", "-" }, + { 3, -1, 0, "SYNME7", "synthetic satellite images Meteosat7", "-" }, + { 4, -1, 0, "SYNMSG", "synthetic satellite images MSG", "-" }, +}; + +static const param_type cosmo250[] = { + { 1, -1, 0, "QNH", "sea level air pressure", "hPa" }, + { 11, -1, 0, "TSOIL", "2m temperature", "K" }, + { 12, -1, 0, "TSOIL", "2m temperature", "K" }, + { 13, -1, 0, "D_T_2M_K", "kalman correction to 2m temperature", "K" }, + { 14, -1, 0, "TSOIL", "2m temperature", "K" }, + { 15, -1, 0, "TSOIL", "2m temperature", "K" }, + { 16, -1, 0, "RH_ICE", "relative humidity over ice", "%" }, + { 17, -1, 0, "TD", "dew point temperature", "K" }, + { 18, -1, 0, "D_TD", "dew point depression", "K" }, + { 19, -1, 0, "THETAE", "equivalent potential temperature", "K" }, + { 20, -1, 0, "TD_2M_K", "2m dew point temperature", "K" }, + { 21, -1, 0, "D_TD_2M_K", "kalman correction to 2m dew point temperature", "K" }, + { 22, -1, 0, "TD_2M_OLD", "2m dew point temperature", "K" }, + { 23, -1, 0, "TD_2M_BUZ", "2m dew point temperature", "K" }, + { 24, -1, 0, "HI", "heat index", "Fahrenheit" }, + { 25, -1, 0, "DURSUN_M", "maximum duration of sunshine", "s" }, + { 26, -1, 0, "DURSUN_R", "relative duration of sunshine", "%" }, + { 52, -1, 0, "RH_2M_K", "2m relative humidity", "%" }, + { 53, -1, 0, "D_RH_2M_K", "kalman correction to 2m relative humidity", "%" }, + { 58, -1, 0, "CLI_RATIO", "cloud ice ratio (Qi/Qc+Qi)", "%" }, + { 61, -1, 0, "TOT_SNOW", "total precipitation in snow", "kg/m**2" }, + { 62, -1, 0, "TOT_RAIN", "total precipitation in rain", "kg/m**2" }, + { 63, -1, 0, "TOT_CON", "total convective precipitation", "kg/m**2" }, + { 64, -1, 0, "TOT_GSP", "total large scale precipitation", "kg/m**2" }, + { 65, -1, 0, "SNOW_%", "percentage of precipitation in snow", "%" }, + { 66, -1, 0, "CONV_%", "percentage of convective precipitation", "%" }, + { 67, -1, 0, "VORTP_ABS", "absolute", "VORTP_ABS 67 -1 absolute vorticity" }, + { 68, -1, 0, "VORTP_REL", "relative", "VORTP_REL 68 -1 relative vorticity" }, + { 70, -1, 0, "PDIFF_CON", "pressure difference between cloud base and cloud top", "Pa" }, + { 71, -1, 0, "TTOP_CON", "temperature at cloud top", "K" }, + { 80, -1, 0, "GEM", "emissivity of the ground", "%" }, + { 82, -1, 0, "Z0LOC", "local surface roughness length", "m" }, + { 110, -1, 0, "LUM", "luminosity", "klux" }, + { 111, -1, 0, "GLOB", "global shortwave radiation at surface", "W/m**2" }, + { 112, -1, 0, "LW_IN_TG", "incoming longwave radiation at surface", "W/m**2" }, + { 113, -1, 0, "LW_IN_TS", "incoming longwave radiation at surface", "W/m**2" }, + { 114, -1, 0, "LW_IN_T2M", "incoming longwave radiation at surface", "W/m**2" }, + { 115, -1, 0, "SWISS_WE", "Swiss", "SWISS_WE 115 1 Swiss coordinates" }, + { 116, -1, 0, "SWISS_SN", "Swiss", "SWISS_SN 116 1 Swiss coordinates" }, + { 150, -1, 0, "KOINDEX", "KO index", "K" }, + { 151, -1, 0, "TTINDEX", "total-totals index", "K" }, + { 152, -1, 0, "DCI", "deep convection index", "K" }, + { 153, -1, 0, "SWEAT", "severe weather thread index", "undefined" }, + { 154, -1, 0, "ADEDO2", "adedokun 2 index", "K" }, + { 160, -1, 0, "C_TSTORM", "thunderstorm index using AdaBoost classifier", "undefined" }, + { 161, -1, 0, "CN_TSTORM", "thunderstorm probabilty using AdaBoost classifier", "%" }, + { 200, -1, 0, "WSHEARL", "wind shear between surface and 3 km asl", "1/s" }, + { 201, -1, 0, "WSHEARM", "wind shear between surface and 6 km asl", "1/s" }, + { 202, -1, 0, "WSHEARU", "wind shear between 3 km (or surface) and 6 km asl", "1/s" }, + { 211, -1, 0, "VWIN", "maximum OLD turbulent wind gust in 10m", "m s-1" }, + { 212, -1, 0, "VW10M_20", "maximum 10m wind speed", "m s-1" }, + { 213, -1, 0, "VW10M_25", "duration of VWIN_10M above 25 knots", "s" }, + { 214, -1, 0, "VW10M_30", "duration of VWIN_10M above 30 knots", "s" }, + { 215, -1, 0, "VW10M_35", "duration of VWIN_10M above 35 knots", "s" }, + { 216, -1, 0, "VW10M_40", "duration of VWIN_10M above 40 knots", "s" }, + { 217, -1, 0, "VW10M_45", "duration of VWIN_10M above 45 knots", "s" }, + { 218, -1, 0, "VW10M_50", "duration of VWIN_10M above 50 knots", "s" }, + { 219, -1, 0, "VOLD", "maximum turbulent wind gust in 10m", "m s-1" }, + { 220, -1, 0, "VJPS", "maximum turbulent wind gust in 10m", "m s-1" }, + { 221, -1, 0, "VBRA", "maximum Brasseur turbulent wind gust in 10m", "m s-1" }, + { 222, -1, 0, "VB10M_20", "duration of VBRA_10M above 20 knots", "s" }, + { 223, -1, 0, "VB10M_25", "duration of VBRA_10M above 25 knots", "s" }, + { 224, -1, 0, "VB10M_30", "duration of VBRA_10M above 30 knots", "s" }, + { 225, -1, 0, "VB10M_35", "duration of VBRA_10M above 35 knots", "s" }, + { 226, -1, 0, "VB10M_40", "duration of VBRA_10M above 40 knots", "s" }, + { 227, -1, 0, "VB10M_45", "duration of VBRA_10M above 45 knots", "s" }, + { 228, -1, 0, "VB10M_50", "duration of VBRA_10M above 50 knots", "s" }, + { 231, -1, 0, "VCON", "maximum convective wind gust in 10m", "m s-1" }, + { 232, -1, 0, "VC10M_20", "duration of VCON_10M above 20 knots", "s" }, + { 233, -1, 0, "VC10M_25", "duration of VCON_10M above 25 knots", "s" }, + { 234, -1, 0, "VC10M_30", "duration of VCON_10M above 30 knots", "s" }, + { 235, -1, 0, "VC10M_35", "duration of VCON_10M above 35 knots", "s" }, + { 236, -1, 0, "VC10M_40", "duration of VCON_10M above 40 knots", "s" }, + { 237, -1, 0, "VC10M_45", "duration of VCON_10M above 45 knots", "s" }, + { 238, -1, 0, "VC10M_50", "duration of VCON_10M above 50 knots", "s" }, + { 241, -1, 0, "FMAX", "maximum wind speed at k=ke", "m s-1" }, + { 242, -1, 0, "USTARMAX", "maximal u*=SQRT(Drag_coef)*fmax_10m", "m s-1" }, + { 243, -1, 0, "GLOB_DIF", "global diffuse shortwave radiation at the surface", "W/m**2" }, + { 244, -1, 0, "GLOB_DIR", "global direct (beam) shortwave radiation at the surface", "W/m**2" }, + { 245, -1, 0, "GLOB_vE", "global shortwave radiation on a vertical surface facing east", "W/m**2" }, + { 246, -1, 0, "GLOB_vS", "global shortwave radiation on a vertical surface facing south", "W/m**2" }, + { 247, -1, 0, "GLOB_vW", "global shortwave radiation on a vertical surface facing west", "W/m**2" }, + { 248, -1, 0, "GLOB_vN", "global shortwave radiation on a vertical surface facing north", "W/m**2" }, + { 249, -1, 0, "LW_TG_vS", "incoming longwave radiation on a vertical surface facing south", "W/m**2" }, + { 250, -1, 0, "ENTH", "enthalpy", "kJ/kg" }, + { 251, -1, 0, "ENTH", "enthalpy", "kJ/kg" }, + { 252, -1, 0, "MIXRAT", "mixing ratio", "g/kg" }, + { 253, -1, 0, "MIXRAT", "mixing ratio", "g/kg" }, + { 254, -1, 0, "TW", "wet bulb temperature", "degC" }, + { 255, -1, 0, "TW", "wet bulb temperature", "degC" }, +}; + + +static +void tableDefault(void) +{ + + // define table : echam4 + { + int instID = institutInq(98, 255, "MPIMET", NULL); + if (instID == -1) instID = institutDef(98, 255, "MPIMET", NULL); + + int modelID = modelInq(instID, 0, "ECHAM4"); + if (modelID == -1) modelID = modelDef(instID, 0, "ECHAM4"); + + int tableID = tableDef(modelID, 128, "echam4"); + + tableLink(tableID, echam4, sizeof(echam4) / sizeof(param_type)); + } + + // define table : echam5 + { + int instID = institutInq(98, 232, "MPIMET", NULL); + if (instID == -1) instID = institutDef(98, 232, "MPIMET", NULL); + + int modelID = modelInq(instID, 0, "ECHAM5"); + if (modelID == -1) modelID = modelDef(instID, 0, "ECHAM5"); + + int tableID = tableDef(modelID, 128, "echam5"); + + tableLink(tableID, echam5, sizeof(echam5) / sizeof(param_type)); + } + + // define table : echam6 + { + int instID = institutInq(0, 0, "MPIMET", NULL); + if (instID == -1) instID = institutDef(0, 0, "MPIMET", NULL); + + int modelID = modelInq(instID, 0, "ECHAM6"); + if (modelID == -1) modelID = modelDef(instID, 0, "ECHAM6"); + + int tableID = tableDef(modelID, 128, "echam6"); + + tableLink(tableID, echam6, sizeof(echam6) / sizeof(param_type)); + } + + // define table : mpiom1 + { + int instID = institutInq(0, 0, "MPIMET", NULL); + if (instID == -1) instID = institutDef(0, 0, "MPIMET", NULL); + + int modelID = modelInq(instID, 0, "MPIOM1"); + if (modelID == -1) modelID = modelDef(instID, 0, "MPIOM1"); + + int tableID = tableDef(modelID, 128, "mpiom1"); + + tableLink(tableID, mpiom1, sizeof(mpiom1) / sizeof(param_type)); + } + + // define table : ecmwf + { + int instID = institutInq(0, 0, "ECMWF", NULL); + if (instID == -1) instID = institutDef(0, 0, "ECMWF", NULL); + + int modelID = modelInq(instID, 0, ""); + if (modelID == -1) modelID = modelDef(instID, 0, ""); + + int tableID = tableDef(modelID, 128, "ecmwf"); + + tableLink(tableID, ecmwf, sizeof(ecmwf) / sizeof(param_type)); + } + + // define table : remo + { + int instID = institutInq(0, 0, "MPIMET", NULL); + if (instID == -1) instID = institutDef(0, 0, "MPIMET", NULL); + + int modelID = modelInq(instID, 0, "REMO"); + if (modelID == -1) modelID = modelDef(instID, 0, "REMO"); + + int tableID = tableDef(modelID, 128, "remo"); + + tableLink(tableID, remo, sizeof(remo) / sizeof(param_type)); + } + + // define table : cosmo002 + { + int instID = institutInq(0, 0, "MCH", NULL); + if (instID == -1) instID = institutDef(0, 0, "MCH", NULL); + + int modelID = modelInq(instID, 0, "COSMO"); + if (modelID == -1) modelID = modelDef(instID, 0, "COSMO"); + + int tableID = tableDef(modelID, 002, "cosmo002"); + + tableLink(tableID, cosmo002, sizeof(cosmo002) / sizeof(param_type)); + } + + // define table : cosmo201 + { + int instID = institutInq(0, 0, "MCH", NULL); + if (instID == -1) instID = institutDef(0, 0, "MCH", NULL); + + int modelID = modelInq(instID, 0, "COSMO"); + if (modelID == -1) modelID = modelDef(instID, 0, "COSMO"); + + int tableID = tableDef(modelID, 201, "cosmo201"); + + tableLink(tableID, cosmo201, sizeof(cosmo201) / sizeof(param_type)); + } + + // define table : cosmo202 + { + int instID = institutInq(0, 0, "MCH", NULL); + if (instID == -1) instID = institutDef(0, 0, "MCH", NULL); + + int modelID = modelInq(instID, 0, "COSMO"); + if (modelID == -1) modelID = modelDef(instID, 0, "COSMO"); + + int tableID = tableDef(modelID, 202, "cosmo202"); + + tableLink(tableID, cosmo202, sizeof(cosmo202) / sizeof(param_type)); + } + + // define table : cosmo203 + { + int instID = institutInq(0, 0, "MCH", NULL); + if (instID == -1) instID = institutDef(0, 0, "MCH", NULL); + + int modelID = modelInq(instID, 0, "COSMO"); + if (modelID == -1) modelID = modelDef(instID, 0, "COSMO"); + + int tableID = tableDef(modelID, 203, "cosmo203"); + + tableLink(tableID, cosmo203, sizeof(cosmo203) / sizeof(param_type)); + } + + // define table : cosmo205 + { + int instID = institutInq(0, 0, "MCH", NULL); + if (instID == -1) instID = institutDef(0, 0, "MCH", NULL); + + int modelID = modelInq(instID, 0, "COSMO"); + if (modelID == -1) modelID = modelDef(instID, 0, "COSMO"); + + int tableID = tableDef(modelID, 205, "cosmo205"); + + tableLink(tableID, cosmo205, sizeof(cosmo205) / sizeof(param_type)); + } + + // define table : cosmo250 + { + int instID = institutInq(0, 0, "MCH", NULL); + if (instID == -1) instID = institutDef(0, 0, "MCH", NULL); + + int modelID = modelInq(instID, 0, "COSMO"); + if (modelID == -1) modelID = modelDef(instID, 0, "COSMO"); + + int tableID = tableDef(modelID, 250, "cosmo250"); + + tableLink(tableID, cosmo250, sizeof(cosmo250) / sizeof(param_type)); + } +} + +// clang-format on + +#endif /* TABLE_H */ +#include <stddef.h> +#include <string.h> +#include <ctype.h> + + + +#define MAX_TABLE 256 +#define MAX_PARS 1024 + +typedef struct +{ + bool used; + int npars; + int modelID; + int number; + char *name; + param_type *pars; +} paramtab_type; + +static paramtab_type parTable[MAX_TABLE]; +static int parTableSize = MAX_TABLE; +static int parTableNum = 0; +static int ParTableInit = 0; + +static char *tablePath = NULL; + +static void tableDefModelID(int tableID, int modelID); +static void tableDefNum(int tableID, int tablenum); + +static void +tableDefEntry(int tableID, int id, int ltype, const char *name, const char *longname, const char *units) +{ + if (tableID >= 0 && tableID < MAX_TABLE && parTable[tableID].used) + { + } + else + Error("Invalid table ID %d", tableID); + + int item = parTable[tableID].npars++; + parTable[tableID].pars[item].id = id; + parTable[tableID].pars[item].ltype = ltype; + parTable[tableID].pars[item].dupflags = 0; + parTable[tableID].pars[item].name = NULL; + parTable[tableID].pars[item].longname = NULL; + parTable[tableID].pars[item].units = NULL; + + if (name && name[0]) + { + parTable[tableID].pars[item].name = strdupx(name); + parTable[tableID].pars[item].dupflags |= TABLE_DUP_NAME; + } + if (longname && longname[0]) + { + parTable[tableID].pars[item].longname = strdupx(longname); + parTable[tableID].pars[item].dupflags |= TABLE_DUP_LONGNAME; + } + if (units && units[0]) + { + parTable[tableID].pars[item].units = strdupx(units); + parTable[tableID].pars[item].dupflags |= TABLE_DUP_UNITS; + } +} + +void +tableLink(int tableID, const param_type *pars, int npars) +{ + for (int item = 0; item < npars; item++) + { + parTable[tableID].pars[item].id = pars[item].id; + parTable[tableID].pars[item].ltype = pars[item].ltype; + parTable[tableID].pars[item].dupflags = 0; + parTable[tableID].pars[item].name = pars[item].name; + parTable[tableID].pars[item].longname = pars[item].longname; + parTable[tableID].pars[item].units = pars[item].units; + } + + parTable[tableID].npars = npars; +} + +static void +parTableInitEntry(int tableID) +{ + parTable[tableID].used = false; + parTable[tableID].pars = NULL; + parTable[tableID].npars = 0; + parTable[tableID].modelID = CDI_UNDEFID; + parTable[tableID].number = CDI_UNDEFID; + parTable[tableID].name = NULL; +} + +static void +tableGetPath(void) +{ + char *path = getenv("TABLEPATH"); + if (path) tablePath = strdupx(path); + // printf("tablePath = %s\n", tablePath); +} + +static void +parTableFinalize(void) +{ + for (int tableID = 0; tableID < MAX_TABLE; ++tableID) + if (parTable[tableID].used) + { + int npars = parTable[tableID].npars; + for (int item = 0; item < npars; ++item) + { + if (parTable[tableID].pars[item].dupflags & TABLE_DUP_NAME) Free((void *) parTable[tableID].pars[item].name); + if (parTable[tableID].pars[item].dupflags & TABLE_DUP_LONGNAME) Free((void *) parTable[tableID].pars[item].longname); + if (parTable[tableID].pars[item].dupflags & TABLE_DUP_UNITS) Free((void *) parTable[tableID].pars[item].units); + } + Free(parTable[tableID].pars); + Free(parTable[tableID].name); + } +} + +static void +parTableInit(void) +{ + ParTableInit = 1; + + atexit(parTableFinalize); + if (cdiPartabIntern) tableDefault(); + + tableGetPath(); +} + +static int +tableNewEntry() +{ + int tableID = 0; + + static int init = 0; + if (!init) + { + for (tableID = 0; tableID < parTableSize; tableID++) parTableInitEntry(tableID); + init = 1; + } + + // Look for a free slot in parTable. + for (tableID = 0; tableID < parTableSize; tableID++) + { + if (!parTable[tableID].used) break; + } + + if (tableID == parTableSize) Error("no more entries!"); + + parTable[tableID].used = true; + parTableNum++; + + return tableID; +} + +static int +decodeForm1(char *pline, char *name, char *longname, char *units) +{ + char *pstart, *pend; + + // FIXME: parse success isn't verified + /* long level = */ strtol(pline, &pline, 10); + while (isspace((int) *pline)) pline++; + + pstart = pline; + while (!(isspace((int) *pline) || *pline == 0)) pline++; + size_t len = (size_t) (pline - pstart); + if (len > 0) + { + memcpy(name, pstart, len); + name[len] = 0; + } + else + return 0; + + if (pline[0] == 0) return 0; + + // Format 1 : code name add mult longname [units] + // FIXME: successful parse isn't verified + /* double add = */ strtod(pline, &pline); + // FIXME: successful parse isn't verified + /* double mult = */ strtod(pline, &pline); + + while (isspace((int) *pline)) pline++; + + len = strlen(pline); + if (len > 0) + { + pstart = pline; + pend = strrchr(pline, '['); + if (pend == pstart) + len = 0; + else + { + if (pend) + pend--; + else + pend = pstart + len; + while (isspace((int) *pend)) pend--; + len = (size_t) (pend - pstart + 1); + } + if (len > 0) + { + memcpy(longname, pstart, len); + longname[len] = 0; + } + pstart = strrchr(pline, '['); + if (pstart) + { + pstart++; + while (isspace((int) *pstart)) pstart++; + pend = strchr(pstart, ']'); + if (!pend) return 0; + pend--; + while (isspace((int) *pend)) pend--; + len = (size_t) (pend - pstart + 1); + if (len > 0) + { + memcpy(units, pstart, len); + units[len] = 0; + } + } + } + + return 0; +} + +static int +decodeForm2(char *pline, char *name, char *longname, char *units) +{ + // Format 2 : code | name | longname | units + char *pend; + + pline = strchr(pline, '|'); + pline++; + + while (isspace((int) *pline)) pline++; + if (*pline != '|') + { + pend = strchr(pline, '|'); + if (!pend) + { + pend = pline; + while (!isspace((int) *pend)) pend++; + size_t len = (size_t) (pend - pline); + if (len > 0) + { + memcpy(name, pline, len); + name[len] = 0; + } + return 0; + } + else + { + pend--; + while (isspace((int) *pend)) pend--; + size_t len = (size_t) (pend - pline + 1); + if (len > 0) + { + memcpy(name, pline, len); + name[len] = 0; + } + } + } + else + name[0] = '\0'; + + pline = strchr(pline, '|'); + pline++; + while (isspace((int) *pline)) pline++; + pend = strchr(pline, '|'); + if (!pend) pend = strchr(pline, 0); + pend--; + while (isspace((int) *pend)) pend--; + { + size_t len = (size_t) (pend - pline + 1); + if (len > 0) + { + memcpy(longname, pline, len); + longname[len] = 0; + } + } + + pline = strchr(pline, '|'); + if (pline) + { + pline++; + while (isspace((int) *pline)) pline++; + pend = strchr(pline, '|'); + if (!pend) pend = strchr(pline, 0); + pend--; + while (isspace((int) *pend)) pend--; + ptrdiff_t len = pend - pline + 1; + if (len < 0) len = 0; + memcpy(units, pline, (size_t) len); + units[len] = 0; + } + + return 0; +} + +int +tableRead(const char *tablefile) +{ + char line[1024], *pline; + char name[256], longname[256], units[256]; + int tableID = CDI_UNDEFID; + + FILE *tablefp = fopen(tablefile, "r"); + if (tablefp == NULL) return tableID; + + const char *tablename = strrchr(tablefile, '/'); + if (tablename == 0) + tablename = tablefile; + else + tablename++; + + tableID = tableDef(-1, 0, tablename); + + while (fgets(line, 1023, tablefp)) + { + size_t len = strlen(line); + if (line[len - 1] == '\n') line[len - 1] = '\0'; + name[0] = 0; + longname[0] = 0; + units[0] = 0; + if (line[0] == '#') continue; + pline = line; + + len = strlen(pline); + if (len < 4) continue; + while (isspace((int) *pline)) pline++; + int id = atoi(pline); + // if ( id > 255 ) id -= 256; + if (id == 0) continue; + + while (isdigit((int) *pline)) pline++; + + int ltype = CDI_UNDEFID; + if (*pline == ';' || *pline == ':') + { + pline++; + ltype = atoi(pline); + while (isdigit((int) *pline)) pline++; + + if (*pline == ';' || *pline == ':') + { + pline++; + while (isdigit((int) *pline)) pline++; + } + } + + while (isdigit((int) *pline)) pline++; + + int err = (strchr(pline, '|')) ? decodeForm2(pline, name, longname, units) : decodeForm1(pline, name, longname, units); + if (err) continue; + + if (name[0] == 0) snprintf(name, sizeof(name), "var%d", id); + + tableDefEntry(tableID, id, ltype, name, longname, units); + } + + return tableID; +} + +static int +tableFromEnv(int modelID, int tablenum) +{ + char tablename[256] = { '\0' }; + size_t tablenameLen = 0; + int instID; + + const char *name2Use; + { + const char *modelName, *instName; + if ((modelName = modelInqNamePtr(modelID))) + name2Use = modelName; + else if ((instID = modelInqInstitut(modelID)) != CDI_UNDEFID && (instName = institutInqNamePtr(instID))) + name2Use = instName; + else + return CDI_UNDEFID; + } + tablenameLen = strlen(name2Use); + memcpy(tablename, name2Use, tablenameLen); + if (tablenum) tablenameLen += (size_t) (sprintf(tablename + tablenameLen, "_%03d", tablenum)); + size_t lenp = 0, lenf = tablenameLen; + if (tablePath) lenp = strlen(tablePath); + // if (tablePath) printf("tablePath = %s\n", tablePath); + // if (tablename) printf("tableName = %s\n", tablename); + char *tablefile = (char *) Malloc(lenp + lenf + 3); + if (tablePath) + { + strcpy(tablefile, tablePath); + strcat(tablefile, "/"); + } + else + tablefile[0] = '\0'; + strcat(tablefile, tablename); + // if (tablefile) printf("tableFile = %s\n", tablefile); + + int tableID = tableRead(tablefile); + if (tableID != CDI_UNDEFID) + { + tableDefModelID(tableID, modelID); + tableDefNum(tableID, tablenum); + } + // printf("tableID = %d %s\n", tableID, tablefile); + Free(tablefile); + + return tableID; +} + +int +tableInq(int modelID, int tablenum, const char *tablename) +{ + int tableID = CDI_UNDEFID; + int modelID2 = CDI_UNDEFID; + char tablefile[256] = { '\0' }; + + if (!ParTableInit) parTableInit(); + + if (tablename) + { + strcpy(tablefile, tablename); + /* + printf("tableInq: tablefile = >%s<\n", tablefile); + */ + /* search for internal table */ + for (tableID = 0; tableID < MAX_TABLE; tableID++) + { + if (parTable[tableID].used && parTable[tableID].name) + { + /* len = strlen(parTable[tableID].name); */ + size_t len = strlen(tablename); + if (memcmp(parTable[tableID].name, tablename, len) == 0) break; + } + } + if (tableID == MAX_TABLE) tableID = CDI_UNDEFID; + if (CDI_Debug) Message("tableID = %d tablename = %s", tableID, tablename); + } + else + { + for (tableID = 0; tableID < MAX_TABLE; tableID++) + { + if (parTable[tableID].used) + { + if (parTable[tableID].modelID == modelID && parTable[tableID].number == tablenum) break; + } + } + + if (tableID == MAX_TABLE) tableID = CDI_UNDEFID; + + if (tableID == CDI_UNDEFID) + { + if (modelID != CDI_UNDEFID) + { + const char *modelName; + if ((modelName = modelInqNamePtr(modelID))) + { + strcpy(tablefile, modelName); + size_t len = strlen(tablefile); + for (size_t i = 0; i < len; i++) + if (tablefile[i] == '.') tablefile[i] = '\0'; + modelID2 = modelInq(-1, 0, tablefile); + } + } + if (modelID2 != CDI_UNDEFID) + for (tableID = 0; tableID < MAX_TABLE; tableID++) + { + if (parTable[tableID].used) + { + if (parTable[tableID].modelID == modelID2 && parTable[tableID].number == tablenum) break; + } + } + } + + if (tableID == MAX_TABLE) tableID = CDI_UNDEFID; + + if (tableID == CDI_UNDEFID && modelID != CDI_UNDEFID) tableID = tableFromEnv(modelID, tablenum); + + if (CDI_Debug && tablename) Message("tableID = %d tablename = %s", tableID, tablename); + } + + return tableID; +} + +int +tableDef(int modelID, int tablenum, const char *tablename) +{ + int tableID = CDI_UNDEFID; + + if (!ParTableInit) parTableInit(); + // if (!(modelID == CDI_UNDEFID && tablenum == 0)) tableID = tableInq(modelID, tablenum, tablename); + if (tableID == CDI_UNDEFID) + { + tableID = tableNewEntry(); + + parTable[tableID].modelID = modelID; + parTable[tableID].number = tablenum; + if (tablename) parTable[tableID].name = strdupx(tablename); + + parTable[tableID].pars = (param_type *) Malloc(MAX_PARS * sizeof(param_type)); + } + + return tableID; +} + +static void +tableDefModelID(int tableID, int modelID) +{ + parTable[tableID].modelID = modelID; +} + +static void +tableDefNum(int tableID, int tablenum) +{ + parTable[tableID].number = tablenum; +} + +int +tableInqNum(int tableID) +{ + int number = 0; + + if (tableID >= 0 && tableID < MAX_TABLE) number = parTable[tableID].number; + + return number; +} + +int +tableInqModel(int tableID) +{ + int modelID = -1; + + if (tableID >= 0 && tableID < MAX_TABLE) modelID = parTable[tableID].modelID; + + return modelID; +} + +static void +partabCheckID(int item) +{ + if (item < 0 || item >= parTableSize) Error("item %d undefined!", item); + + if (!parTable[item].name) Error("item %d name undefined!", item); +} + +const char * +tableInqNamePtr(int tableID) +{ + const char *tablename = NULL; + + if (CDI_Debug) Message("tableID = %d", tableID); + + if (!ParTableInit) parTableInit(); + + if (tableID >= 0 && tableID < parTableSize) + if (parTable[tableID].name) tablename = parTable[tableID].name; + + return tablename; +} + +static size_t +max_length(size_t maxlen, const char *cstring) +{ + if (cstring) + { + size_t len = strlen(cstring); + if (len > maxlen) maxlen = len; + } + return maxlen; +} + +void +tableWrite(const char *ptfile, int tableID) +{ + size_t maxname = 4, maxlname = 10, maxunits = 2; + int instID = CDI_UNDEFID; + int center = 0, subcenter = 0; + const char *instnameptr = NULL, *modelnameptr = NULL; + + if (CDI_Debug) Message("write parameter table %d to %s", tableID, ptfile); + + if (tableID == CDI_UNDEFID) + { + Warning("parameter table ID undefined"); + return; + } + + partabCheckID(tableID); + + FILE *ptfp = fopen(ptfile, "w"); + + int npars = parTable[tableID].npars; + for (int item = 0; item < npars; item++) + { + maxname = max_length(maxname, parTable[tableID].pars[item].name); + maxlname = max_length(maxlname, parTable[tableID].pars[item].longname); + maxunits = max_length(maxunits, parTable[tableID].pars[item].units); + } + + int tablenum = tableInqNum(tableID); + int modelID = parTable[tableID].modelID; + if (modelID != CDI_UNDEFID) + { + modelnameptr = modelInqNamePtr(modelID); + instID = modelInqInstitut(modelID); + } + if (instID != CDI_UNDEFID) + { + center = institutInqCenter(instID); + subcenter = institutInqSubcenter(instID); + instnameptr = institutInqNamePtr(instID); + } + + fprintf(ptfp, "# Parameter table\n"); + fprintf(ptfp, "#\n"); + if (tablenum) fprintf(ptfp, "# TABLE_ID=%d\n", tablenum); + fprintf(ptfp, "# TABLE_NAME=%s\n", parTable[tableID].name); + if (modelnameptr) fprintf(ptfp, "# TABLE_MODEL=%s\n", modelnameptr); + if (instnameptr) fprintf(ptfp, "# TABLE_INSTITUT=%s\n", instnameptr); + if (center) fprintf(ptfp, "# TABLE_CENTER=%d\n", center); + if (subcenter) fprintf(ptfp, "# TABLE_SUBCENTER=%d\n", subcenter); + fprintf(ptfp, "#\n"); + fprintf(ptfp, "#\n"); + fprintf(ptfp, "# id = parameter ID\n"); + fprintf(ptfp, "# name = variable name\n"); + fprintf(ptfp, "# title = long name (description)\n"); + fprintf(ptfp, "# units = variable units\n"); + fprintf(ptfp, "#\n"); + fprintf(ptfp, "# The format of each record is:\n"); + fprintf(ptfp, "#\n"); + fprintf(ptfp, "# id | %-*s | %-*s | %-*s\n", (int) maxname, "name", (int) maxlname, "title", (int) maxunits, "units"); + + for (int item = 0; item < npars; item++) + { + const char *name = parTable[tableID].pars[item].name, *longname = parTable[tableID].pars[item].longname, + *units = parTable[tableID].pars[item].units; + if (name == NULL) name = " "; + if (longname == NULL) longname = " "; + if (units == NULL) units = " "; + fprintf(ptfp, "%4d | %-*s | %-*s | %-*s\n", parTable[tableID].pars[item].id, (int) maxname, name, (int) maxlname, longname, + (int) maxunits, units); + } + + fclose(ptfp); +} + +void +tableFWriteC(FILE *ptfp, int tableID) +{ + const char chelp[] = ""; + size_t maxname = 0, maxlname = 0, maxunits = 0; + char tablename[256]; + + if (tableID == CDI_UNDEFID) + { + Warning("parameter table ID undefined"); + return; + } + + partabCheckID(tableID); + + int npars = parTable[tableID].npars; + for (int item = 0; item < npars; item++) + { + maxname = max_length(maxname, parTable[tableID].pars[item].name); + maxlname = max_length(maxlname, parTable[tableID].pars[item].longname); + maxunits = max_length(maxunits, parTable[tableID].pars[item].units); + } + + strncpy(tablename, parTable[tableID].name, sizeof(tablename) - 1); + tablename[sizeof(tablename) - 1] = '\0'; + { + size_t len = strlen(tablename); + for (size_t i = 0; i < len; i++) + if (tablename[i] == '.') tablename[i] = '_'; + } + fprintf(ptfp, "static const param_type %s[] = {\n", tablename); + + for (int item = 0; item < npars; item++) + { + size_t len = strlen(parTable[tableID].pars[item].name), + llen = parTable[tableID].pars[item].longname ? strlen(parTable[tableID].pars[item].longname) : 0, + ulen = parTable[tableID].pars[item].units ? strlen(parTable[tableID].pars[item].units) : 0; + fprintf(ptfp, " {%4d, -1, 0, \"%s\", %-*s%c%s%s, %-*s%c%s%s %-*s},\n", parTable[tableID].pars[item].id, + parTable[tableID].pars[item].name, (int) (maxname - len), chelp, llen ? '"' : ' ', + llen ? parTable[tableID].pars[item].longname : "NULL", llen ? "\"" : "", (int) (maxlname - (llen ? llen : 3)), chelp, + ulen ? '"' : ' ', ulen ? parTable[tableID].pars[item].units : "NULL", ulen ? "\"" : "", + (int) (maxunits - (ulen ? ulen : 3)), chelp); + } + + fprintf(ptfp, "};\n\n"); +} + +void +tableInqEntry(int tableID, int id, int ltype, char *name, char *longname, char *units) +{ + if (((tableID >= 0) & (tableID < MAX_TABLE)) | (tableID == CDI_UNDEFID)) + { + } + else + Error("Invalid table ID %d", tableID); + + if (tableID != CDI_UNDEFID) + { + int npars = parTable[tableID].npars; + for (int item = 0; item < npars; item++) + { + if (parTable[tableID].pars[item].id == id + && (parTable[tableID].pars[item].ltype == -1 || ltype == -1 || parTable[tableID].pars[item].ltype == ltype)) + { + if (name && parTable[tableID].pars[item].name) strcpy(name, parTable[tableID].pars[item].name); + if (longname && parTable[tableID].pars[item].longname) strcpy(longname, parTable[tableID].pars[item].longname); + if (units && parTable[tableID].pars[item].units) strcpy(units, parTable[tableID].pars[item].units); + + break; + } + } + } +} + +int +tableInqParCode(int tableID, char *varname, int *code) +{ + int err = 1; + + if (tableID != CDI_UNDEFID && varname != NULL) + { + int npars = parTable[tableID].npars; + for (int item = 0; item < npars; item++) + { + if (parTable[tableID].pars[item].name && str_is_equal(parTable[tableID].pars[item].name, varname)) + { + *code = parTable[tableID].pars[item].id; + err = 0; + break; + } + } + } + + return err; +} + +int +tableInqNumber(void) +{ + if (!ParTableInit) parTableInit(); + + return parTableNum; +} +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifndef NORMALIZE_MONTH_H +#define NORMALIZE_MONTH_H + +#include <stdlib.h> + +struct YearMonth +{ + int year, month; +}; + +/* normalizes month to range [1,12] and adjusts year accordingly */ +static inline struct YearMonth +normalize_month(int year, int month) +{ + div_t modres = div(month - 1, 12); + year += modres.quot - ((month < 1) & (modres.rem != 0)); + return (struct YearMonth){ .year = year, .month = (modres.rem + 12) % 12 + 1 }; +} + +#endif +#include <stddef.h> +#include <stdio.h> + + +static int DefaultTimeType = TAXIS_ABSOLUTE; +static int DefaultTimeUnit = TUNIT_HOUR; + +static int taxisCompareP(void *taxisptr1, void *taxisptr2); +static void taxisDestroyP(void *taxisptr); +static void taxisPrintKernel(taxis_t *taxisptr, FILE *fp); +static int taxisGetPackSize(void *taxisptr, void *context); +static void taxisPack(void *taxisptr, void *buf, int size, int *position, void *context); +static int taxisTxCode(void *taxisptr); + +const resOps taxisOps + = { taxisCompareP, taxisDestroyP, (void (*)(void *, FILE *)) taxisPrintKernel, taxisGetPackSize, taxisPack, taxisTxCode }; + +#define container_of(ptr, type, member) ((type *) (void *) ((unsigned char *) ptr - offsetof(type, member))) + +struct refcount_string +{ + int ref_count; + char string[]; +}; + +static char * +new_refcount_string(size_t len) +{ + struct refcount_string *container = (struct refcount_string *) Malloc(sizeof(*container) + len + 1); + container->ref_count = 1; + return container->string; +} + +static void +delete_refcount_string(void *p) +{ + if (p) + { + struct refcount_string *container = container_of(p, struct refcount_string, string); + if (!--(container->ref_count)) Free(container); + } +} + +static char * +dup_refcount_string(char *p) +{ + if (p) + { + struct refcount_string *container = container_of(p, struct refcount_string, string); + ++(container->ref_count); + } + return p; +} + +#undef container_of + +const char * +taxisNamePtr(int taxisID) +{ + taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); + return taxisptr->name; +} + +const char * +tunitNamePtr(int unitID) +{ + static const char Timeunits[][TAXIS_MAX_UNIT_STR_LEN + 1] = { + "undefined", "seconds", "minutes", "quarters", "30minutes", "hours", "3hours", "6hours", "12hours", "days", "months", "years", + }; + enum + { + size = sizeof(Timeunits) / sizeof(Timeunits[0]) + }; + + const char *name = unitID > 0 && unitID < size ? Timeunits[unitID] : Timeunits[0]; + + return name; +} + +void +ptaxisInit(taxis_t *taxisptr) +{ + taxisptr->self = CDI_UNDEFID; + taxisptr->datatype = CDI_DATATYPE_FLT64; + taxisptr->type = DefaultTimeType; + taxisptr->calendar = CDI_Default_Calendar; + taxisptr->unit = DefaultTimeUnit; + taxisptr->numavg = 0; + taxisptr->climatology = false; + taxisptr->hasBounds = false; + cdiDateTime_init(&taxisptr->sDateTime); + cdiDateTime_init(&taxisptr->vDateTime); + cdiDateTime_init(&taxisptr->rDateTime); + cdiDateTime_init(&taxisptr->fDateTime); + cdiDateTime_init(&taxisptr->vDateTime_lb); + cdiDateTime_init(&taxisptr->vDateTime_ub); + taxisptr->fc_unit = DefaultTimeUnit; + taxisptr->fc_period = 0; + taxisptr->name = NULL; + taxisptr->longname = NULL; + taxisptr->units = NULL; +} + +static taxis_t * +taxisNewEntry(cdiResH resH) +{ + taxis_t *taxisptr = (taxis_t *) Malloc(sizeof(taxis_t)); + + ptaxisInit(taxisptr); + if (resH == CDI_UNDEFID) + taxisptr->self = reshPut(taxisptr, &taxisOps); + else + { + taxisptr->self = resH; + reshReplace(resH, taxisptr, &taxisOps); + } + + return taxisptr; +} + +/* +@Function taxisCreate +@Title Create a Time axis + +@Prototype int taxisCreate(int taxistype) +@Parameter + @Item taxistype The type of the Time axis, one of the set of predefined CDI time axis types. + The valid CDI time axis types are @func{TAXIS_ABSOLUTE} and @func{TAXIS_RELATIVE}. + +@Description +The function @func{taxisCreate} creates a Time axis. + +@Result +@func{taxisCreate} returns an identifier to the Time axis. + +@Example +Here is an example using @func{taxisCreate} to create a relative T-axis with a standard calendar. + +@Source + ... +int taxisID; + ... +taxisID = taxisCreate(TAXIS_RELATIVE); +taxisDefCalendar(taxisID, CALENDAR_STANDARD); +taxisDefRdate(taxisID, 19850101); +taxisDefRtime(taxisID, 120000); + ... +@EndSource +@EndFunction +*/ +int +taxisCreate(int taxistype) +{ + taxis_t *taxisptr = taxisNewEntry(CDI_UNDEFID); + taxisptr->type = taxistype; + + int taxisID = taxisptr->self; + return taxisID; +} + +void +taxisDestroyKernel(taxis_t *taxisptr) +{ + delete_refcount_string(taxisptr->name); + delete_refcount_string(taxisptr->longname); + delete_refcount_string(taxisptr->units); +} + +/* +@Function taxisDestroy +@Title Destroy a Time axis + +@Prototype void taxisDestroy(int taxisID) +@Parameter + @Item taxisID Time axis ID, from a previous call to @func{taxisCreate} + +@EndFunction +*/ +void +taxisDestroy(int taxisID) +{ + taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); + reshRemove(taxisID, &taxisOps); + taxisDestroyKernel(taxisptr); + Free(taxisptr); +} + +void +taxisDestroyP(void *taxisptr) +{ + taxisDestroyKernel((taxis_t *) taxisptr); + Free(taxisptr); +} + +int +taxisDuplicate(int taxisID1) +{ + taxis_t *taxisptr1 = (taxis_t *) reshGetVal(taxisID1, &taxisOps); + taxis_t *taxisptr2 = taxisNewEntry(CDI_UNDEFID); + + int taxisID2 = taxisptr2->self; + + ptaxisCopy(taxisptr2, taxisptr1); + + return taxisID2; +} + +void +taxisDefType(int taxisID, int taxistype) +{ + taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); + + if (taxisptr->type != taxistype) + { + taxisptr->type = taxistype; + taxisptr->datatype = CDI_DATATYPE_FLT64; + delete_refcount_string(taxisptr->units); + taxisptr->units = NULL; + reshSetStatus(taxisID, &taxisOps, RESH_DESYNC_IN_USE); + } +} + +/* +@Function taxisDefVdate +@Title Define the verification date + +@Prototype void taxisDefVdate(int taxisID, int vdate) +@Parameter + @Item taxisID Time axis ID, from a previous call to @fref{taxisCreate} + @Item vdate Verification date (YYYYMMDD) + +@Description +The function @func{taxisDefVdate} defines the verification date of a Time axis. + +@EndFunction +*/ +void +taxisDefVdate(int taxisID, int vdate) +{ + taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); + + if ((int) cdiDate_get(taxisptr->vDateTime.date) != vdate) + { + taxisptr->vDateTime.date = cdiDate_set(vdate); + reshSetStatus(taxisID, &taxisOps, RESH_DESYNC_IN_USE); + } +} + +/* +@Function taxisDefVtime +@Title Define the verification time + +@Prototype void taxisDefVtime(int taxisID, int vtime) +@Parameter + @Item taxisID Time axis ID, from a previous call to @fref{taxisCreate} + @Item vtime Verification time (hhmmss) + +@Description +The function @func{taxisDefVtime} defines the verification time of a Time axis. + +@EndFunction +*/ +void +taxisDefVtime(int taxisID, int vtime) +{ + taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); + + if (cdiTime_get(taxisptr->vDateTime.time) != vtime) + { + taxisptr->vDateTime.time = cdiTime_set(vtime); + reshSetStatus(taxisID, &taxisOps, RESH_DESYNC_IN_USE); + } +} + +void +taxisDefVdatetime(int taxisID, CdiDateTime vDateTime) +{ + taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); + + if (cdiDateTime_isNE(taxisptr->vDateTime, vDateTime)) + { + taxisptr->vDateTime = vDateTime; + reshSetStatus(taxisID, &taxisOps, RESH_DESYNC_IN_USE); + } +} + +void +taxisDefRdatetime(int taxisID, CdiDateTime rDateTime) +{ + taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); + + if (cdiDateTime_isNE(taxisptr->rDateTime, rDateTime)) + { + taxisptr->rDateTime = rDateTime; + delete_refcount_string(taxisptr->units); + taxisptr->units = NULL; + reshSetStatus(taxisID, &taxisOps, RESH_DESYNC_IN_USE); + } +} + +/* +@Function taxisDefRdate +@Title Define the reference date + +@Prototype void taxisDefRdate(int taxisID, int rdate) +@Parameter + @Item taxisID Time axis ID, from a previous call to @fref{taxisCreate} + @Item rdate Reference date (YYYYMMDD) + +@Description +The function @func{taxisDefRdate} defines the reference date of a Time axis. + +@EndFunction +*/ +void +taxisDefRdate(int taxisID, int rdate) +{ + taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); + + if ((int) cdiDate_get(taxisptr->rDateTime.date) != rdate) + { + taxisptr->rDateTime.date = cdiDate_set(rdate); + delete_refcount_string(taxisptr->units); + taxisptr->units = NULL; + reshSetStatus(taxisID, &taxisOps, RESH_DESYNC_IN_USE); + } +} + +/* +@Function taxisDefRtime +@Title Define the reference time + +@Prototype void taxisDefRtime(int taxisID, int rtime) +@Parameter + @Item taxisID Time axis ID, from a previous call to @fref{taxisCreate} + @Item rtime Reference time (hhmmss) + +@Description +The function @func{taxisDefRtime} defines the reference time of a Time axis. + +@EndFunction +*/ +void +taxisDefRtime(int taxisID, int rtime) +{ + taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); + + if (cdiTime_get(taxisptr->rDateTime.time) != rtime) + { + taxisptr->rDateTime.time = cdiTime_set(rtime); + if (taxisptr->units) + { + delete_refcount_string(taxisptr->units); + taxisptr->units = NULL; + } + reshSetStatus(taxisID, &taxisOps, RESH_DESYNC_IN_USE); + } +} + +/* +@Function taxisDefFdatetime +@Title Define the forecast reference date/time + +@Prototype void taxisDefFdatetime(int taxisID, CdiDateTime fDateTime) +@Parameter + @Item taxisID Time axis ID, from a previous call to @fref{taxisCreate} + @Item fDateTime Forecast reference date/time + +@Description +The function @func{taxisDefFdatetime} defines the forecast reference date/time of a Time axis. + +@EndFunction +*/ +void +taxisDefFdatetime(int taxisID, CdiDateTime fDateTime) +{ + taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); + + if (cdiDateTime_isNE(taxisptr->fDateTime, fDateTime)) + { + taxisptr->fDateTime = fDateTime; + reshSetStatus(taxisID, &taxisOps, RESH_DESYNC_IN_USE); + } +} + +/* +@Function taxisDefCalendar +@Title Define the calendar + +@Prototype void taxisDefCalendar(int taxisID, int calendar) +@Parameter + @Item taxisID Time axis ID, from a previous call to @fref{taxisCreate} + @Item calendar The type of the calendar, one of the set of predefined CDI calendar types. + The valid CDI calendar types are @func{CALENDAR_STANDARD}, @func{CALENDAR_PROLEPTIC}, + @func{CALENDAR_360DAYS}, @func{CALENDAR_365DAYS} and @func{CALENDAR_366DAYS}. + +@Description +The function @func{taxisDefCalendar} defines the calendar of a Time axis. + +@EndFunction +*/ +void +taxisDefCalendar(int taxisID, int calendar) +{ + taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); + + if (taxisptr->calendar != calendar) + { + taxisptr->calendar = calendar; + reshSetStatus(taxisID, &taxisOps, RESH_DESYNC_IN_USE); + } +} + +void +taxisDefTunit(int taxisID, int unit) +{ + taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); + + if (taxisptr->unit != unit) + { + taxisptr->unit = unit; + delete_refcount_string(taxisptr->units); + taxisptr->units = NULL; + reshSetStatus(taxisID, &taxisOps, RESH_DESYNC_IN_USE); + } +} + +void +taxisDefForecastTunit(int taxisID, int unit) +{ + taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); + + if (taxisptr->fc_unit != unit) + { + taxisptr->fc_unit = unit; + reshSetStatus(taxisID, &taxisOps, RESH_DESYNC_IN_USE); + } +} + +void +taxisDefForecastPeriod(int taxisID, double fc_period) +{ + taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); + + if (IS_NOT_EQUAL(taxisptr->fc_period, fc_period)) + { + taxisptr->fc_period = fc_period; + reshSetStatus(taxisID, &taxisOps, RESH_DESYNC_IN_USE); + } +} + +void +taxisDefNumavg(int taxisID, int numavg) +{ + taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); + + if (taxisptr->numavg != numavg) + { + taxisptr->numavg = numavg; + reshSetStatus(taxisID, &taxisOps, RESH_DESYNC_IN_USE); + } +} + +/* + The type of the time axis, one of the set of predefined CDI time types. + The valid CDI time types are TAXIS_ABSOLUTE and TAXIS_RELATIVE. +*/ +int +taxisInqType(int taxisID) +{ + taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); + return taxisptr->type; +} + +int +taxisHasBounds(int taxisID) +{ + taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); + return (int) taxisptr->hasBounds; +} + +void +taxisWithBounds(int taxisID) +{ + taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); + + if (taxisptr->hasBounds == false) + { + taxisptr->hasBounds = true; + reshSetStatus(taxisID, &taxisOps, RESH_DESYNC_IN_USE); + } +} + +void +taxisDeleteBounds(int taxisID) +{ + taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); + + if (taxisptr->hasBounds) + { + taxisptr->hasBounds = false; + reshSetStatus(taxisID, &taxisOps, RESH_DESYNC_IN_USE); + } +} + +void +taxisCopyTimestep(int taxisID2, int taxisID1) +{ + taxis_t *taxisptr1 = (taxis_t *) reshGetVal(taxisID1, &taxisOps), *taxisptr2 = (taxis_t *) reshGetVal(taxisID2, &taxisOps); + + reshLock(); + + // reference date/time and units can't be changed after streamDefVlist()! + + taxisptr2->sDateTime = taxisptr1->sDateTime; + taxisptr2->vDateTime = taxisptr1->vDateTime; + taxisptr2->fDateTime = taxisptr1->fDateTime; + + if (taxisptr2->hasBounds) + { + taxisptr2->vDateTime_lb = taxisptr1->vDateTime_lb; + taxisptr2->vDateTime_ub = taxisptr1->vDateTime_ub; + } + + taxisptr2->fc_unit = taxisptr1->fc_unit; + taxisptr2->fc_period = taxisptr1->fc_period; + + reshSetStatus(taxisID2, &taxisOps, RESH_DESYNC_IN_USE); + reshUnlock(); +} + +CdiDateTime +taxisInqVdatetime(int taxisID) +{ + taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); + return taxisptr->vDateTime; +} + +CdiDateTime +taxisInqRdatetime(int taxisID) +{ + taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); + + if (cdiDateTime_isNull(taxisptr->rDateTime)) + { + taxisptr->rDateTime = taxisptr->vDateTime; + reshSetStatus(taxisID, &taxisOps, RESH_DESYNC_IN_USE); + } + + return taxisptr->rDateTime; +} + +/* +@Function taxisInqVdate +@Title Get the verification date + +@Prototype int taxisInqVdate(int taxisID) +@Parameter + @Item taxisID Time axis ID, from a previous call to @fref{taxisCreate} or @fref{vlistInqTaxis} + +@Description +The function @func{taxisInqVdate} returns the verification date of a Time axis. + +@Result +@func{taxisInqVdate} returns the verification date. + +@EndFunction +*/ +int +taxisInqVdate(int taxisID) +{ + taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); + return (int) cdiDate_get(taxisptr->vDateTime.date); +} + +CdiDateTime +taxisInqSdatetime(int taxisID) +{ + taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); + return taxisptr->sDateTime; +} + +void +taxisInqVdateBounds(int taxisID, int *vdate_lb, int *vdate_ub) +{ + taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); + *vdate_lb = (int) cdiDate_get(taxisptr->vDateTime_lb.date); + *vdate_ub = (int) cdiDate_get(taxisptr->vDateTime_ub.date); +} + +void +taxisInqVdatetimeBounds(int taxisID, CdiDateTime *vDateTime_lb, CdiDateTime *vDateTime_ub) +{ + taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); + *vDateTime_lb = taxisptr->vDateTime_lb; + *vDateTime_ub = taxisptr->vDateTime_ub; +} + +void +taxisDefVdateBounds(int taxisID, int vdate_lb, int vdate_ub) +{ + taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); + + if (taxisptr->hasBounds == false || (int) cdiDate_get(taxisptr->vDateTime_lb.date) != vdate_lb + || (int) cdiDate_get(taxisptr->vDateTime_ub.date) != vdate_ub) + { + taxisptr->vDateTime_lb.date = cdiDate_set(vdate_lb); + taxisptr->vDateTime_ub.date = cdiDate_set(vdate_ub); + taxisptr->hasBounds = true; + reshSetStatus(taxisID, &taxisOps, RESH_DESYNC_IN_USE); + } +} + +void +taxisDefVdatetimeBounds(int taxisID, CdiDateTime vDateTime_lb, CdiDateTime vDateTime_ub) +{ + taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); + + if (taxisptr->hasBounds == false || cdiDateTime_isNE(taxisptr->vDateTime_lb, vDateTime_lb) + || cdiDateTime_isNE(taxisptr->vDateTime_ub, vDateTime_ub)) + { + taxisptr->vDateTime_lb = vDateTime_lb; + taxisptr->vDateTime_ub = vDateTime_ub; + taxisptr->hasBounds = true; + reshSetStatus(taxisID, &taxisOps, RESH_DESYNC_IN_USE); + } +} + +/* +@Function taxisInqVtime +@Title Get the verification time + +@Prototype int taxisInqVtime(int taxisID) +@Parameter + @Item taxisID Time axis ID, from a previous call to @fref{taxisCreate} or @fref{vlistInqTaxis} + +@Description +The function @func{taxisInqVtime} returns the verification time of a Time axis. + +@Result +@func{taxisInqVtime} returns the verification time. + +@EndFunction +*/ +int +taxisInqVtime(int taxisID) +{ + taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); + return cdiTime_get(taxisptr->vDateTime.time); +} + +void +taxisInqVtimeBounds(int taxisID, int *vtime_lb, int *vtime_ub) +{ + taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); + *vtime_lb = cdiTime_get(taxisptr->vDateTime_lb.time); + *vtime_ub = cdiTime_get(taxisptr->vDateTime_ub.time); +} + +void +taxisDefVtimeBounds(int taxisID, int vtime_lb, int vtime_ub) +{ + taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); + + if (taxisptr->hasBounds == false || cdiTime_get(taxisptr->vDateTime_lb.time) != vtime_lb + || cdiTime_get(taxisptr->vDateTime_ub.time) != vtime_ub) + { + taxisptr->vDateTime_lb.time = cdiTime_set(vtime_lb); + taxisptr->vDateTime_ub.time = cdiTime_set(vtime_ub); + taxisptr->hasBounds = true; + reshSetStatus(taxisID, &taxisOps, RESH_DESYNC_IN_USE); + } +} + +/* +@Function taxisInqRdate +@Title Get the reference date + +@Prototype int taxisInqRdate(int taxisID) +@Parameter + @Item taxisID Time axis ID, from a previous call to @fref{taxisCreate} or @fref{vlistInqTaxis} + +@Description +The function @func{taxisInqRdate} returns the reference date of a Time axis. + +@Result +@func{taxisInqRdate} returns the reference date. + +@EndFunction +*/ +int +taxisInqRdate(int taxisID) +{ + taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); + + if (cdiDateTime_isNull(taxisptr->rDateTime)) + { + taxisptr->rDateTime = taxisptr->vDateTime; + reshSetStatus(taxisID, &taxisOps, RESH_DESYNC_IN_USE); + } + + return (int) cdiDate_get(taxisptr->rDateTime.date); +} + +/* +@Function taxisInqRtime +@Title Get the reference time + +@Prototype int taxisInqRtime(int taxisID) +@Parameter + @Item taxisID Time axis ID, from a previous call to @fref{taxisCreate} or @fref{vlistInqTaxis} + +@Description +The function @func{taxisInqRtime} returns the reference time of a Time axis. + +@Result +@func{taxisInqRtime} returns the reference time. + +@EndFunction +*/ +int +taxisInqRtime(int taxisID) +{ + taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); + + if (cdiDateTime_isNull(taxisptr->rDateTime)) + { + taxisptr->rDateTime = taxisptr->vDateTime; + reshSetStatus(taxisID, &taxisOps, RESH_DESYNC_IN_USE); + } + + return cdiTime_get(taxisptr->rDateTime.time); +} + +/* +@Function taxisInqFdatetime +@Title Get the forecast reference date/time + +@Prototype int taxisInqFdatetime(int taxisID) +@Parameter + @Item taxisID Time axis ID, from a previous call to @fref{taxisCreate} or @fref{vlistInqTaxis} + +@Description +The function @func{taxisInqFdatetime} returns the forecast reference date/time of a Time axis. + +@Result +@func{taxisInqFdate} returns the forecast reference date/time. + +@EndFunction +*/ +CdiDateTime +taxisInqFdatetime(int taxisID) +{ + taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); + + if (cdiDateTime_isNull(taxisptr->fDateTime)) + { + // rDateTime is initialized from vDateTime if empty! + taxisptr->fDateTime = taxisInqRdatetime(taxisID); + reshSetStatus(taxisID, &taxisOps, RESH_DESYNC_IN_USE); + } + + return taxisptr->fDateTime; +} + +/* +@Function taxisInqCalendar +@Title Get the calendar + +@Prototype int taxisInqCalendar(int taxisID) +@Parameter + @Item taxisID Time axis ID, from a previous call to @fref{taxisCreate} or @fref{vlistInqTaxis} + +@Description +The function @func{taxisInqCalendar} returns the calendar of a Time axis. + +@Result +@func{taxisInqCalendar} returns the type of the calendar, +one of the set of predefined CDI calendar types. +The valid CDI calendar types are @func{CALENDAR_STANDARD}, @func{CALENDAR_PROLEPTIC}, +@func{CALENDAR_360DAYS}, @func{CALENDAR_365DAYS} and @func{CALENDAR_366DAYS}. + +@EndFunction +*/ +int +taxisInqCalendar(int taxisID) +{ + taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); + return taxisptr->calendar; +} + +int +taxisInqTunit(int taxisID) +{ + taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); + return taxisptr->unit; +} + +int +taxisInqForecastTunit(int taxisID) +{ + taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); + return taxisptr->fc_unit; +} + +double +taxisInqForecastPeriod(int taxisID) +{ + taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); + return taxisptr->fc_period; +} + +int +taxisInqNumavg(int taxisID) +{ + taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); + return taxisptr->numavg; +} + +taxis_t * +taxisPtr(int taxisID) +{ + taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); + return taxisptr; +} + +void +ptaxisDefDatatype(taxis_t *taxisptr, int datatype) +{ + taxisptr->datatype = datatype; +} + +void +ptaxisDefName(taxis_t *taxisptr, const char *name) +{ + if (name) + { + size_t len = strlen(name); + delete_refcount_string(taxisptr->name); + char *taxisname = taxisptr->name = new_refcount_string(len); + strcpy(taxisname, name); + } +} + +void +ptaxisDefLongname(taxis_t *taxisptr, const char *longname) +{ + if (longname) + { + size_t len = strlen(longname); + delete_refcount_string(taxisptr->longname); + char *taxislongname = taxisptr->longname = new_refcount_string(len); + strcpy(taxislongname, longname); + } +} + +char * +ptaxisAllocUnits(taxis_t *taxisptr, size_t len) +{ + delete_refcount_string(taxisptr->units); + return taxisptr->units = new_refcount_string(len); +} + +void +ptaxisDefUnits(taxis_t *taxisptr, const char *units) +{ + if (units) + { + size_t len = strlen(units); + char *taxisunits = ptaxisAllocUnits(taxisptr, len); + strcpy(taxisunits, units); + } +} + +static JulianDate +timevalue_decode(int timeunits, double timevalue) +{ + JulianDate julianDate; + julianDate.julianDay = 0; + julianDate.secondOfDay = 0.0; + + if (timeunits == TUNIT_MINUTE) + { + timevalue *= 60; + timeunits = TUNIT_SECOND; + } + else if (timeunits == TUNIT_HOUR) + { + timevalue /= 24; + timeunits = TUNIT_DAY; + } + + if (timeunits == TUNIT_SECOND) + { + julianDate.julianDay = (int64_t) (timevalue / 86400.0); + double seconds = timevalue - julianDate.julianDay * 86400.0; + julianDate.secondOfDay = round(seconds * 1000.0) / 1000.0; + if (julianDate.secondOfDay < 0) + { + julianDate.julianDay -= 1; + julianDate.secondOfDay += 86400.0; + }; + /* + { + double cval = julianDate.julianDay * 86400.0 + julianDate.secondOfDay; + if (cval != timevalue) printf("TUNIT_SECOND error: %g %g %d %d\n", timevalue, cval, julianDate.julianDay, + julianDate.secondOfDay); + } + */ + } + else if (timeunits == TUNIT_DAY) + { + julianDate.julianDay = (int64_t) timevalue; + double seconds = (timevalue - julianDate.julianDay) * 86400.0; + julianDate.secondOfDay = (int) lround(seconds); + if (julianDate.secondOfDay < 0) + { + julianDate.julianDay -= 1; + julianDate.secondOfDay += 86400.0; + }; + /* + { + double cval = julianDate.julianDay + julianDate.secondOfDay / 86400.0; + if (cval != timevalue) printf("TUNIT_DAY error: %g %g %d %d\n", timevalue, cval, julianDate.julianDay, + julianDate.secondOfDay); + } + */ + } + else + { + static bool lwarn = true; + if (lwarn) + { + Warning("timeunit %s unsupported!", tunitNamePtr(timeunits)); + lwarn = false; + } + } + + return julianDate; +} + +static double +cdi_encode_timevalue(int days, double secs, int timeunit) +{ + double timevalue = 0.0; + + if (timeunit == TUNIT_SECOND) + { + timevalue = days * 86400.0 + secs; + } + else if (timeunit == TUNIT_MINUTE || timeunit == TUNIT_QUARTER || timeunit == TUNIT_30MINUTES) + { + timevalue = days * 1440. + secs / 60.; + } + else if (timeunit == TUNIT_HOUR || timeunit == TUNIT_3HOURS || timeunit == TUNIT_6HOURS || timeunit == TUNIT_12HOURS) + { + timevalue = days * 24. + secs / 3600.; + } + else if (timeunit == TUNIT_DAY) + { + timevalue = days + secs / 86400.; + } + else + { + static bool lwarn = true; + if (lwarn) + { + Warning("timeunit %s unsupported!", tunitNamePtr(timeunit)); + lwarn = false; + } + } + + return timevalue; +} + +// convert relative time value to CdiDateTime +static CdiDateTime +rtimeval2datetime(double timevalue, const taxis_t *taxis) +{ + if (IS_EQUAL(timevalue, 0.0)) return taxis->rDateTime; + + int timeunits = taxis->unit; + int calendar = taxis->calendar; + + if (timeunits == TUNIT_MONTH && calendar == CALENDAR_360DAYS) + { + timeunits = TUNIT_DAY; + timevalue *= 30; + } + + CdiDateTime rDateTime = taxis->rDateTime; + + if (timeunits == TUNIT_MONTH || timeunits == TUNIT_YEAR) + { + int year = rDateTime.date.year; + int month = rDateTime.date.month; + + if (timeunits == TUNIT_YEAR) timevalue *= 12; + + int nmon = (int) timevalue; + double fmon = timevalue - nmon; + + month += nmon; + + struct YearMonth ym = normalize_month(year, month); + year = ym.year; + month = ym.month; + + timeunits = TUNIT_DAY; + timevalue = fmon * days_per_month(calendar, year, month); + + rDateTime.date.year = year; + rDateTime.date.month = month; + } + + JulianDate julianDate = julianDate_encode(calendar, rDateTime); + JulianDate julianDate2 = timevalue_decode(timeunits, timevalue); + + return julianDate_decode(calendar, julianDate_add(julianDate2, julianDate)); +} + +// convert CdiDateTime to relative time value +static double +datetime2rtimeval(CdiDateTime vDateTime, const taxis_t *taxis) +{ + double value = 0.0; + + int calendar = taxis->calendar; + int timeunits = taxis->unit; + int timeunits0 = timeunits; + + CdiDateTime rDateTime = taxis->rDateTime; + + if (cdiDateTime_isNull(rDateTime)) rDateTime = (*taxis).vDateTime; + + if (cdiDateTime_isNull(rDateTime) && cdiDateTime_isNull(vDateTime)) return value; + + JulianDate julianDate1 = julianDate_encode(calendar, rDateTime); + + if (timeunits == TUNIT_MONTH && calendar == CALENDAR_360DAYS) timeunits = TUNIT_DAY; + + if (timeunits == TUNIT_MONTH || timeunits == TUNIT_YEAR) + { + int ryear = rDateTime.date.year; + int rmonth = rDateTime.date.month; + int year = vDateTime.date.year; + int month = vDateTime.date.month; + value = (year - ryear) * 12 - rmonth + month; + + int nmonth = (int) value; + month -= nmonth; + + struct YearMonth ym = normalize_month(year, month); + year = ym.year; + month = ym.month; + + int dpm = days_per_month(calendar, year, month); + + vDateTime.date.year = year; + vDateTime.date.month = month; + JulianDate julianDate2 = julianDate_encode(calendar, vDateTime); + JulianDate dateDifference = julianDate_sub(julianDate2, julianDate1); + + value += (dateDifference.julianDay + dateDifference.secondOfDay / 86400.0) / dpm; + if (timeunits == TUNIT_YEAR) value = value / 12; + } + else + { + JulianDate julianDate2 = julianDate_encode(calendar, vDateTime); + JulianDate dateDifference = julianDate_sub(julianDate2, julianDate1); + + value = cdi_encode_timevalue(dateDifference.julianDay, dateDifference.secondOfDay, timeunits); + } + + if (timeunits0 == TUNIT_MONTH && calendar == CALENDAR_360DAYS) value /= 30.0; + + return value; +} + +// convert absolute time value to CdiDateTime +static CdiDateTime +atimeval2datetime(double timevalue) +{ + int64_t vdate = (int64_t) timevalue; + double tmpval = (timevalue - vdate) * 86400.0; + int daysec = (vdate < 0) ? (int) (-tmpval + 0.01) : (int) (tmpval + 0.01); + + int year, month, day; + cdiDecodeDate(vdate, &year, &month, &day); + + int hour = daysec / 3600; + int minute = (daysec - hour * 3600) / 60; + int second = daysec - hour * 3600 - minute * 60; + int ms = 0; + + CdiDateTime datetime; + datetime.date = cdiDate_encode(year, month, day); + datetime.time = cdiTime_encode(hour, minute, second, ms); + + return datetime; +} + +static CdiDateTime +split_timevalue(double timevalue, int timeunit) +{ + CdiDateTime datetime; + cdiDateTime_init(&datetime); + + if (timeunit == TUNIT_SECOND) + { + timevalue /= 86400; + datetime = atimeval2datetime(timevalue); + } + else if (timeunit == TUNIT_HOUR) + { + timevalue /= 24; + datetime = atimeval2datetime(timevalue); + } + else if (timeunit == TUNIT_DAY) + { + datetime = atimeval2datetime(timevalue); + } + else if (timeunit == TUNIT_MONTH) + { + int64_t vdate = (int64_t) timevalue * 100 - ((timevalue < 0) * 2 - 1); + datetime.date = cdiDate_set(vdate); + } + else if (timeunit == TUNIT_YEAR) + { + { + static bool lwarn = true; + if (lwarn && (fabs(timevalue - (int64_t) timevalue) > 0)) + { + Warning("Fraction of a year is not supported!!"); + lwarn = false; + } + } + + { + static bool lwarn = true; + if (timevalue < -214700) + { + if (lwarn) + { + Warning("Year %g out of range, set to -214700", timevalue); + lwarn = false; + } + timevalue = -214700; + } + else if (timevalue > 214700) + { + if (lwarn) + { + Warning("Year %g out of range, set to 214700", timevalue); + lwarn = false; + } + timevalue = 214700; + } + } + + int64_t vdate = (int64_t) timevalue * 10000; + vdate += (timevalue < 0) ? -101 : 101; + datetime.date = cdiDate_set(vdate); + } + else + { + static bool lwarn = true; + if (lwarn) + { + Warning("timeunit %s unsupported!", tunitNamePtr(timeunit)); + lwarn = false; + } + } + + // verify date and time + + int year, month, day; + cdiDate_decode(datetime.date, &year, &month, &day); + int hour, minute, second, ms; + cdiTime_decode(datetime.time, &hour, &minute, &second, &ms); + + if (month > 17 || day > 31 || hour > 23 || minute > 59 || second > 59) + { + if ((month > 17 || day > 31) && (year < -9999 || year > 9999)) year = 1; + if (month > 17) month = 1; + if (day > 31) day = 1; + if (hour > 23) hour = 0; + if (minute > 59) minute = 0; + if (second > 59) second = 0; + + datetime.date = cdiDate_encode(year, month, day); + datetime.time = cdiTime_encode(hour, minute, second, ms); + + static bool lwarn = true; + if (lwarn) + { + lwarn = false; + Warning("Reset wrong date/time to %4.4d-%2.2d-%2.2d %2.2d:%2.2d:%2.2d!", year, month, day, hour, minute, second); + } + } + + return datetime; +} + +void +cdi_set_forecast_period(double timevalue, taxis_t *taxis) +{ + taxis->fc_period = timevalue; + + int timeunits = taxis->fc_unit; + int calendar = taxis->calendar; + + if (cdiDateTime_isNull(taxis->vDateTime) && DBL_IS_EQUAL(timevalue, 0.0)) return; + + if (timeunits == TUNIT_MONTH && calendar == CALENDAR_360DAYS) + { + timeunits = TUNIT_DAY; + timevalue *= 30; + } + + CdiDateTime vDateTime = taxis->vDateTime; + + if (timeunits == TUNIT_MONTH || timeunits == TUNIT_YEAR) + { + int year = vDateTime.date.year; + int month = vDateTime.date.month; + + if (timeunits == TUNIT_YEAR) timevalue *= 12; + + int nmon = (int) timevalue; + double fmon = timevalue - nmon; + + month -= nmon; + + struct YearMonth ym = normalize_month(year, month); + year = ym.year; + month = ym.month; + + timeunits = TUNIT_DAY; + timevalue = fmon * days_per_month(calendar, year, month); + + vDateTime.date.year = year; + vDateTime.date.month = month; + } + + JulianDate julianDate = julianDate_encode(calendar, vDateTime); + JulianDate julianDate2 = timevalue_decode(timeunits, timevalue); + + taxis->fDateTime = julianDate_decode(calendar, julianDate_sub(julianDate, julianDate2)); +} + +CdiDateTime +cdi_decode_timeval(double timevalue, const taxis_t *taxis) +{ + return (taxis->type == TAXIS_ABSOLUTE) ? split_timevalue(timevalue, taxis->unit) : rtimeval2datetime(timevalue, taxis); +} + +double +cdi_encode_timeval(CdiDateTime datetime, taxis_t *taxis) +{ + double timeValue = 0.0; + + if (taxis->type == TAXIS_ABSOLUTE) + { + if (taxis->unit == TUNIT_YEAR) + { + timeValue = datetime.date.year; + } + else if (taxis->unit == TUNIT_MONTH) + { + int64_t xdate = cdiDate_get(datetime.date); + timeValue = xdate / 100 + copysign((double) (datetime.date.day != 0) * 0.5, (double) xdate); + } + else if (taxis->unit == TUNIT_SECOND) + { + int hour, minute, second, ms; + cdiTime_decode(datetime.time, &hour, &minute, &second, &ms); + timeValue = hour * 3600 + minute * 60 + second; + } + else + { + int hour, minute, second, ms; + cdiTime_decode(datetime.time, &hour, &minute, &second, &ms); + int64_t xdate = cdiDate_get(datetime.date); + timeValue = copysign(1.0, (double) xdate) * (fabs((double) xdate) + (hour * 3600 + minute * 60 + second) / 86400.0); + } + } + else + timeValue = datetime2rtimeval(datetime, taxis); + + return timeValue; +} + +void +ptaxisCopy(taxis_t *dest, taxis_t *source) +{ + reshLock(); + + // memcpy(dest, source, sizeof(taxis_t)); + dest->datatype = source->datatype; + dest->type = source->type; + dest->calendar = source->calendar; + dest->unit = source->unit; + dest->numavg = source->numavg; + dest->climatology = source->climatology; + dest->hasBounds = source->hasBounds; + dest->sDateTime = source->sDateTime; + dest->vDateTime = source->vDateTime; + dest->rDateTime = source->rDateTime; + dest->fDateTime = source->fDateTime; + dest->vDateTime_lb = source->vDateTime_lb; + dest->vDateTime_ub = source->vDateTime_ub; + dest->fc_unit = source->fc_unit; + dest->fc_period = source->fc_period; + + dest->climatology = source->climatology; + delete_refcount_string(dest->name); + delete_refcount_string(dest->longname); + delete_refcount_string(dest->units); + dest->name = dup_refcount_string(source->name); + dest->longname = dup_refcount_string(source->longname); + dest->units = dup_refcount_string(source->units); + if (dest->self != CDI_UNDEFID) reshSetStatus(dest->self, &taxisOps, RESH_DESYNC_IN_USE); + + reshUnlock(); +} + +static void +taxisPrintKernel(taxis_t *taxisptr, FILE *fp) +{ + int vdate_lb, vdate_ub; + int vtime_lb, vtime_ub; + + taxisInqVdateBounds(taxisptr->self, &vdate_lb, &vdate_ub); + taxisInqVtimeBounds(taxisptr->self, &vtime_lb, &vtime_ub); + + fprintf(fp, + "#\n" + "# taxisID %d\n" + "#\n" + "self = %d\n" + "type = %d\n" + "vdate = %d\n" + "vtime = %d\n" + "rdate = %d\n" + "rtime = %d\n" + "fdate = %d\n" + "ftime = %d\n" + "calendar = %d\n" + "unit = %d\n" + "numavg = %d\n" + "climatology = %d\n" + "hasBounds = %d\n" + "vdate_lb = %d\n" + "vtime_lb = %d\n" + "vdate_ub = %d\n" + "vtime_ub = %d\n" + "fc_unit = %d\n" + "fc_period = %g\n" + "\n", + taxisptr->self, taxisptr->self, taxisptr->type, (int) cdiDate_get(taxisptr->vDateTime.date), + cdiTime_get(taxisptr->vDateTime.time), (int) cdiDate_get(taxisptr->rDateTime.date), cdiTime_get(taxisptr->rDateTime.time), + (int) cdiDate_get(taxisptr->fDateTime.date), cdiTime_get(taxisptr->fDateTime.time), taxisptr->calendar, taxisptr->unit, + taxisptr->numavg, (int) taxisptr->climatology, (int) taxisptr->hasBounds, vdate_lb, vtime_lb, vdate_ub, vtime_ub, + taxisptr->fc_unit, taxisptr->fc_period); +} + +static int +taxisCompareP(void *taxisptr1, void *taxisptr2) +{ + const taxis_t *t1 = (const taxis_t *) taxisptr1, *t2 = (const taxis_t *) taxisptr2; + + xassert(t1 && t2); + + return !(t1->type == t2->type && cdiDateTime_isEQ(t1->vDateTime, t2->vDateTime) && cdiDateTime_isEQ(t1->rDateTime, t2->rDateTime) + && cdiDateTime_isEQ(t1->fDateTime, t2->fDateTime) && t1->calendar == t2->calendar && t1->unit == t2->unit + && t1->fc_unit == t2->fc_unit && t1->fc_period == t2->fc_period && t1->numavg == t2->numavg + && t1->climatology == t2->climatology && t1->hasBounds == t2->hasBounds + && cdiDateTime_isEQ(t1->vDateTime_lb, t2->vDateTime_lb) && cdiDateTime_isEQ(t1->vDateTime_ub, t2->vDateTime_ub)); +} + +static int +taxisTxCode(void *taxisptr) +{ + (void) taxisptr; + return TAXIS; +} + +enum +{ + TAXIS_PACK_INT_SELF, + TAXIS_PACK_INT_TYPE, + TAXIS_PACK_INT_VDATE, + TAXIS_PACK_INT_VTIME, + TAXIS_PACK_INT_RDATE, + TAXIS_PACK_INT_RTIME, + TAXIS_PACK_INT_FDATE, + TAXIS_PACK_INT_FTIME, + TAXIS_PACK_INT_CALENDAR, + TAXIS_PACK_INT_UNIT, + TAXIS_PACK_INT_FC_UNIT, + TAXIS_PACK_INT_NUMAVG, + TAXIS_PACK_INT_CLIMATOLOGY, + TAXIS_PACK_INT_HAS_BOUNDS, + TAXIS_PACK_INT_VDATE_LB, + TAXIS_PACK_INT_VDATE_UB, + TAXIS_PACK_INT_VTIME_LB, + TAXIS_PACK_INT_VTIME_UB, + TAXIS_PACK_INT_NAMELEN, + TAXIS_PACK_INT_LNAMELEN, + TAXIS_PACK_INT_UNITSLEN, + taxisNint +}; + +enum +{ + TAXIS_PACK_FC_PERIOD, + taxisNdouble +}; + +static int +taxisGetPackSize(void *p, void *context) +{ + taxis_t *taxisptr = (taxis_t *) p; + int packBufferSize = serializeGetSize(taxisNint, CDI_DATATYPE_INT, context) + + serializeGetSize(taxisNdouble, CDI_DATATYPE_FLT64, context) + + (taxisptr->name ? serializeGetSize((int) strlen(taxisptr->name), CDI_DATATYPE_TXT, context) : 0) + + (taxisptr->longname ? serializeGetSize((int) strlen(taxisptr->longname), CDI_DATATYPE_TXT, context) : 0) + + (taxisptr->units ? serializeGetSize((int) strlen(taxisptr->units), CDI_DATATYPE_TXT, context) : 0) + + serializeGetSize(1, CDI_DATATYPE_UINT32, context); + return packBufferSize; +} + +int +taxisUnpack(char *unpackBuffer, int unpackBufferSize, int *unpackBufferPos, int originNamespace, void *context, int force_id) +{ +#define adaptKey(key) (namespaceAdaptKey((key), originNamespace)) + taxis_t *taxisP; + int intBuffer[taxisNint]; + double dblBuffer[taxisNdouble]; + uint32_t d; + + serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, intBuffer, taxisNint, CDI_DATATYPE_INT, context); + serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, dblBuffer, taxisNdouble, CDI_DATATYPE_FLT64, context); + serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, &d, 1, CDI_DATATYPE_UINT32, context); + + xassert(cdiCheckSum(CDI_DATATYPE_INT, taxisNint, intBuffer) == d); + + cdiResH targetID = force_id ? adaptKey(intBuffer[TAXIS_PACK_INT_SELF]) : CDI_UNDEFID; + taxisP = taxisNewEntry(targetID); + + xassert(!force_id || targetID == taxisP->self); + + taxisP->type = intBuffer[TAXIS_PACK_INT_TYPE]; + taxisP->vDateTime.date = cdiDate_set(intBuffer[TAXIS_PACK_INT_VDATE]); + taxisP->vDateTime.time = cdiTime_set(intBuffer[TAXIS_PACK_INT_VTIME]); + taxisP->rDateTime.date = cdiDate_set(intBuffer[TAXIS_PACK_INT_RDATE]); + taxisP->rDateTime.time = cdiTime_set(intBuffer[TAXIS_PACK_INT_RTIME]); + taxisP->fDateTime.date = cdiDate_set(intBuffer[TAXIS_PACK_INT_FDATE]); + taxisP->fDateTime.time = cdiTime_set(intBuffer[TAXIS_PACK_INT_FTIME]); + taxisP->calendar = intBuffer[TAXIS_PACK_INT_CALENDAR]; + taxisP->unit = intBuffer[TAXIS_PACK_INT_UNIT]; + taxisP->fc_unit = intBuffer[TAXIS_PACK_INT_FC_UNIT]; + taxisP->numavg = intBuffer[TAXIS_PACK_INT_NUMAVG]; + taxisP->climatology = intBuffer[TAXIS_PACK_INT_CLIMATOLOGY]; + taxisP->hasBounds = (bool) intBuffer[TAXIS_PACK_INT_HAS_BOUNDS]; + taxisP->vDateTime_lb.date = cdiDate_set(intBuffer[TAXIS_PACK_INT_VDATE_LB]); + taxisP->vDateTime_lb.time = cdiTime_set(intBuffer[TAXIS_PACK_INT_VDATE_UB]); + taxisP->vDateTime_ub.date = cdiDate_set(intBuffer[TAXIS_PACK_INT_VTIME_LB]); + taxisP->vDateTime_ub.time = cdiTime_set(intBuffer[TAXIS_PACK_INT_VTIME_UB]); + taxisP->fc_period = dblBuffer[TAXIS_PACK_FC_PERIOD]; + if (intBuffer[TAXIS_PACK_INT_NAMELEN]) + { + int len = intBuffer[TAXIS_PACK_INT_NAMELEN]; + char *name = new_refcount_string((size_t) len); + serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, name, len, CDI_DATATYPE_TXT, context); + name[len] = '\0'; + taxisP->name = name; + } + if (intBuffer[TAXIS_PACK_INT_LNAMELEN]) + { + int len = intBuffer[TAXIS_PACK_INT_LNAMELEN]; + char *longname = new_refcount_string((size_t) len); + serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, longname, len, CDI_DATATYPE_TXT, context); + longname[len] = '\0'; + taxisP->longname = longname; + } + if (intBuffer[TAXIS_PACK_INT_UNITSLEN]) + { + int len = intBuffer[TAXIS_PACK_INT_UNITSLEN]; + char *units = new_refcount_string((size_t) len); + serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, units, len, CDI_DATATYPE_TXT, context); + units[len] = '\0'; + taxisP->units = units; + } + + reshSetStatus(taxisP->self, &taxisOps, reshGetStatus(taxisP->self, &taxisOps) & ~RESH_SYNC_BIT); +#undef adaptKey + + return taxisP->self; +} + +static void +taxisPack(void *voidP, void *packBuffer, int packBufferSize, int *packBufferPos, void *context) +{ + taxis_t *taxisP = (taxis_t *) voidP; + int nameLen, lnameLen, unitsLen; + uint32_t d; + + { + int intBuffer[taxisNint]; + intBuffer[TAXIS_PACK_INT_SELF] = taxisP->self; + intBuffer[TAXIS_PACK_INT_TYPE] = taxisP->type; + intBuffer[TAXIS_PACK_INT_VDATE] = (int) cdiDate_get(taxisP->vDateTime.date); + intBuffer[TAXIS_PACK_INT_VTIME] = cdiTime_get(taxisP->vDateTime.time); + intBuffer[TAXIS_PACK_INT_RDATE] = (int) cdiDate_get(taxisP->rDateTime.date); + intBuffer[TAXIS_PACK_INT_RTIME] = cdiTime_get(taxisP->rDateTime.time); + intBuffer[TAXIS_PACK_INT_FDATE] = (int) cdiDate_get(taxisP->fDateTime.date); + intBuffer[TAXIS_PACK_INT_FTIME] = cdiTime_get(taxisP->fDateTime.time); + intBuffer[TAXIS_PACK_INT_CALENDAR] = taxisP->calendar; + intBuffer[TAXIS_PACK_INT_UNIT] = taxisP->unit; + intBuffer[TAXIS_PACK_INT_FC_UNIT] = taxisP->fc_unit; + intBuffer[TAXIS_PACK_INT_NUMAVG] = taxisP->numavg; + intBuffer[TAXIS_PACK_INT_CLIMATOLOGY] = taxisP->climatology; + intBuffer[TAXIS_PACK_INT_HAS_BOUNDS] = taxisP->hasBounds; + intBuffer[TAXIS_PACK_INT_VDATE_LB] = (int) cdiDate_get(taxisP->vDateTime_lb.date); + intBuffer[TAXIS_PACK_INT_VDATE_UB] = cdiTime_get(taxisP->vDateTime_lb.time); + intBuffer[TAXIS_PACK_INT_VTIME_LB] = (int) cdiDate_get(taxisP->vDateTime_ub.date); + intBuffer[TAXIS_PACK_INT_VTIME_UB] = cdiTime_get(taxisP->vDateTime_ub.time); + intBuffer[TAXIS_PACK_INT_NAMELEN] = nameLen = taxisP->name ? (int) strlen(taxisP->name) : 0; + intBuffer[TAXIS_PACK_INT_LNAMELEN] = lnameLen = taxisP->longname ? (int) strlen(taxisP->longname) : 0; + intBuffer[TAXIS_PACK_INT_UNITSLEN] = unitsLen = taxisP->units ? (int) strlen(taxisP->units) : 0; + serializePack(intBuffer, taxisNint, CDI_DATATYPE_INT, packBuffer, packBufferSize, packBufferPos, context); + d = cdiCheckSum(CDI_DATATYPE_INT, taxisNint, intBuffer); + } + + { + double dblBuffer[taxisNdouble]; + dblBuffer[TAXIS_PACK_FC_PERIOD] = taxisP->fc_period; + serializePack(dblBuffer, taxisNdouble, CDI_DATATYPE_FLT64, packBuffer, packBufferSize, packBufferPos, context); + } + serializePack(&d, 1, CDI_DATATYPE_UINT32, packBuffer, packBufferSize, packBufferPos, context); + if (taxisP->name) serializePack(taxisP->name, nameLen, CDI_DATATYPE_TXT, packBuffer, packBufferSize, packBufferPos, context); + if (taxisP->longname) + serializePack(taxisP->longname, lnameLen, CDI_DATATYPE_TXT, packBuffer, packBufferSize, packBufferPos, context); + if (taxisP->units) serializePack(taxisP->units, unitsLen, CDI_DATATYPE_TXT, packBuffer, packBufferSize, packBufferPos, context); +} + +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#include <limits.h> + + +static void +tstepsInitEntry(tsteps_t *tstep) +{ + tstep->recIDs = NULL; + tstep->records = NULL; + tstep->recordSize = 0; + tstep->nrecs = 0; + tstep->curRecID = CDI_UNDEFID; + tstep->ncStepIndex = 0; + tstep->position = 0; + tstep->nallrecs = 0; + tstep->next = 0; + + ptaxisInit(&(tstep->taxis)); +} + +int +tstepsNewEntry(stream_t *streamptr) +{ + const int tsID = streamptr->tstepsNextID++; + int tstepsTableSize = streamptr->tstepsTableSize; + tsteps_t *tstepsTable = streamptr->tsteps; + + // If the table overflows, double its size. + if (tsID == tstepsTableSize) + { + if (tstepsTableSize == 0) tstepsTableSize = 1; + if (tstepsTableSize <= INT_MAX / 2) + tstepsTableSize *= 2; + else if (tstepsTableSize < INT_MAX) + tstepsTableSize = INT_MAX; + else + Error("Resizing of tstep table failed!"); + + tstepsTable = (tsteps_t *) Realloc(tstepsTable, (size_t) tstepsTableSize * sizeof(tsteps_t)); + } + + streamptr->tstepsTableSize = tstepsTableSize; + streamptr->tsteps = tstepsTable; + + tsteps_t *curTstep = &streamptr->tsteps[tsID]; + tstepsInitEntry(curTstep); + + return tsID; +} + +void +cdi_create_timesteps(int numTimesteps, stream_t *streamptr) +{ + streamptr->ntsteps = (long) numTimesteps; + if (numTimesteps < 0 || streamptr->tstepsTableSize > 0) return; + + int ntsteps = (numTimesteps == 0) ? 1 : numTimesteps; + + streamptr->tsteps = (tsteps_t *) Malloc((size_t) ntsteps * sizeof(tsteps_t)); + + streamptr->tstepsTableSize = ntsteps; + streamptr->tstepsNextID = ntsteps; + + for (int tsID = 0; tsID < ntsteps; tsID++) + { + tstepsInitEntry(&streamptr->tsteps[tsID]); + } +} +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifdef HAVE_CONFIG_H +#endif + +#define _XOPEN_SOURCE 600 + +#include <errno.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + + +static const char uuidFmt[] = "%02hhx%02hhx%02hhx%02hhx-" + "%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx-" + "%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx"; + +int +cdiUUID2Str(const unsigned char *uuid, char *uuidstr) +{ + if (uuid == NULL || uuidstr == NULL) return 0; + + int iret = sprintf(uuidstr, uuidFmt, uuid[0], uuid[1], uuid[2], uuid[3], uuid[4], uuid[5], uuid[6], uuid[7], uuid[8], uuid[9], + uuid[10], uuid[11], uuid[12], uuid[13], uuid[14], uuid[15]); + + if (iret != uuidNumHexChars) + { + uuidstr[0] = 0; + iret = -1; + } + + return iret; +} + +int +cdiStr2UUID(const char *uuidstr, unsigned char *uuid) +{ + if (uuid == NULL || uuidstr == NULL || strlen(uuidstr) != uuidNumHexChars) return -1; + + int iret = sscanf(uuidstr, uuidFmt, &uuid[0], &uuid[1], &uuid[2], &uuid[3], &uuid[4], &uuid[5], &uuid[6], &uuid[7], &uuid[8], + &uuid[9], &uuid[10], &uuid[11], &uuid[12], &uuid[13], &uuid[14], &uuid[15]); + if (iret != CDI_UUID_SIZE) return -1; + + return iret; +} + +// Returns a malloc'ed string that escapes all spaces and backslashes with backslashes. +char * +cdiEscapeSpaces(const char *string) +{ + // How much memory do we need? + size_t escapeCount = 0, length = 0; + for (; string[length]; ++length) escapeCount += string[length] == ' ' || string[length] == '\\'; + + char *result = (char *) Malloc(length + escapeCount + 1); + if (!result) return NULL; + + // Do the escaping. + for (size_t in = 0, out = 0; in < length; ++out, ++in) + { + if (string[in] == ' ' || string[in] == '\\') result[out++] = '\\'; + result[out] = string[in]; + } + result[length + escapeCount] = 0; // termination! + return result; +} + +// input: a space terminated string that may contain escaped characters +// output: a new zero terminated string with the escape characters removed +//*outStringEnd points to the terminating character upon return. +char * +cdiUnescapeSpaces(const char *string, const char **outStringEnd) +{ + // How much memory do we need? + size_t escapeCount = 0, length = 0; + for (const char *current = string; *current && *current != ' '; current++) + { + if (*current == '\\') + { + current++, escapeCount++; + if (!current) return NULL; + } + length++; + } + + char *result = (char *) Malloc(length + 1); + if (!result) return NULL; + + // Do the unescaping. + for (size_t in = 0, out = 0; out < length;) + { + if (string[in] == '\\') in++; + result[out++] = string[in++]; + } + result[length] = 0; // termination! + if (outStringEnd) *outStringEnd = &string[length + escapeCount]; + return result; +} + +#if defined(HAVE_DECL_UUID_GENERATE) && defined(HAVE_UUID_UUID_H) +#ifdef HAVE_SYS_TIME_H +#include <sys/time.h> +#endif +#include <uuid/uuid.h> +void +cdiCreateUUID(unsigned char uuid[CDI_UUID_SIZE]) +{ + static int uuid_seeded = 0; + static char uuid_rand_state[31 * sizeof(long)]; + char *caller_rand_state; + if (uuid_seeded) + caller_rand_state = setstate(uuid_rand_state); + else + { + struct timeval tv; + int status = gettimeofday(&tv, NULL); + if (status != 0) + { + perror("uuid random seed generation failed!"); + exit(1); + } + unsigned seed = (unsigned) (tv.tv_sec ^ tv.tv_usec); + caller_rand_state = initstate(seed, uuid_rand_state, sizeof(uuid_rand_state)); + uuid_seeded = 1; + } + uuid_generate(uuid); + setstate(caller_rand_state); +} +#elif defined(HAVE_DECL_UUID_CREATE) && defined(HAVE_UUID_H) +#ifdef HAVE_DECL_UUID_MAKE_V5 +#include <uuid.h> +void +cdiCreateUUID(unsigned char *uuid) +{ + static const char error_stage[][16] + = { "uuid_create", "uuid_create", "uuid_load", "uuid_make", "uuid_export", "uuid_destroy1", "uuid_destroy2" }; + uuid_t *objuuid = NULL, *nsuuid = NULL; + int stage = 0; + uuid_rc_t status; + if ((status = uuid_create(&objuuid)) == UUID_RC_OK) + { + ++stage; + if ((status = uuid_create(&nsuuid)) == UUID_RC_OK) + { + ++stage; + if ((status = uuid_load(nsuuid, "ns:OID")) == UUID_RC_OK) + { + ++stage; + if ((status = uuid_make(objuuid, UUID_MAKE_V5, nsuuid, cdiLibraryVersion())) == UUID_RC_OK) + { + ++stage; + size_t datalen = CDI_UUID_SIZE; + status = uuid_export(objuuid, UUID_FMT_BIN, &uuid, &datalen); + } + } + } + } + if (status != UUID_RC_OK) Error("failed to generate UUID at stage %s\n", error_stage[stage]); + stage = 5; + if ((status = uuid_destroy(nsuuid)) != UUID_RC_OK) Error("failed to generate UUID at stage %s\n", error_stage[stage]); + ++stage; + if ((status = uuid_destroy(objuuid)) != UUID_RC_OK) Error("failed to generate UUID at stage %s\n", error_stage[stage]); +} +#else +#include <inttypes.h> +typedef uint8_t u_int8_t; +typedef uint16_t u_int16_t; +typedef uint32_t u_int32_t; +#include <uuid.h> +void +cdiCreateUUID(unsigned char *uuid) +{ + uint32_t status; + uuid_create((uuid_t *) (void *) uuid, &status); + if (status != uuid_s_ok) + { + perror("uuid generation failed!"); + exit(1); + } +} +#endif +#else +#ifdef HAVE_SYS_TIME_H +#include <sys/time.h> +#endif +void +cdiCreateUUID(unsigned char *uuid) +{ + static int uuid_seeded = 0; +#ifndef _SX + static char uuid_rand_state[31 * sizeof(long)]; + char *caller_rand_state; + if (uuid_seeded) + caller_rand_state = setstate(uuid_rand_state); + else + { +#ifdef HAVE_SYS_TIME_H + struct timeval tv; + int status = gettimeofday(&tv, NULL); + if (status != 0) + { + perror("failed seed generation!"); + exit(1); + } + unsigned seed = tv.tv_sec ^ tv.tv_usec; +#else + unsigned seed = 0; +#endif + caller_rand_state = initstate(seed, uuid_rand_state, sizeof(uuid_rand_state)); + uuid_seeded = 1; + } + for (size_t i = 0; i < CDI_UUID_SIZE; ++i) uuid[i] = (unsigned char) random(); +#else + unsigned short caller_rand_state[3]; + { + static unsigned short our_rand_state[3]; + if (!uuid_seeded) + { +#ifdef HAVE_SYS_TIME_H + struct timeval tv; + int status = gettimeofday(&tv, NULL); + if (status != 0) + { + perror("failed seed generation!"); + exit(1); + } + unsigned seed = tv.tv_sec ^ tv.tv_usec; +#else + unsigned seed = 0; +#endif + our_rand_state[0] = 0x330E; + our_rand_state[1] = (unsigned short) (seed & 0xFFFFU); + our_rand_state[2] = (unsigned short) ((seed >> 16) & 0xFFFFU); + } + unsigned short *p = seed48(our_rand_state); + uuid_seeded = 1; + memcpy(caller_rand_state, p, sizeof(caller_rand_state)); + } + for (size_t i = 0; i < CDI_UUID_SIZE; ++i) uuid[i] = (unsigned char) lrand48(); +#endif + /* encode variant into msb of octet 8 */ + uuid[8] = (unsigned char) ((uuid[8] & 0x3f) | (1 << 7)); + /* encode version 4 ((pseudo-)random uuid) into msb of octet 7 */ + uuid[7] = (unsigned char) ((uuid[7] & 0x0f) | (4 << 4)); +#ifndef _SX + setstate(caller_rand_state); +#else + seed48(caller_rand_state); +#endif +} +#endif + +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifdef HAVE_CONFIG_H +#endif + + +static size_t Vctsize = 0; +static double *Vct = NULL; + +static int numberOfVerticalLevels = 0; +static int numberOfVerticalGrid = 0; +static unsigned char uuidVGrid[CDI_UUID_SIZE]; + +typedef struct +{ + int level1; + int level2; + int recID; + int lindex; +} leveltable_t; + +typedef struct +{ + int subtypeIndex; // corresponding tile in subtype_t structure (subtype->self) + int nlevels; + int levelTableSize; + leveltable_t *levelTable; +} subtypetable_t; + +typedef struct +{ + int varID; + int param; + int prec; + int tsteptype; + VarScanKeys scanKeys; + int gridID; + int zaxistype; + int ltype1; // GRIB first level type + int ltype2; // GRIB second level type + int hasBounds; + int level_sf; + int level_unit; + int zaxisID; + + int nsubtypes_alloc; + int nsubtypes; + subtypetable_t *recordTable; // ~ two-dimensional record list [nsubtypes_alloc][levelTableSize] + + int instID; + int modelID; + int tableID; + int comptype; // compression type + int complevel; // compression level + bool lmissval; + double missval; + char *name; + + // meta-data for specification of tiles (currently only GRIB-API: + subtype_t *tiles; + + cdi_keys_t keys; + + int opt_grib_nentries; // current no. key-value pairs + int opt_grib_kvpair_size; // current allocated size + opt_key_val_pair_t *opt_grib_kvpair; // (optional) list of keyword/value pairs +} vartable_t; + +static vartable_t *vartable; +static int varTableSize = 0; +static int varTableUsed = 0; + +static void +paramInitEntry(int varID, int param) +{ + vartable[varID].varID = varID; + vartable[varID].param = param; + vartable[varID].prec = 0; + vartable[varID].tsteptype = TSTEP_INSTANT; + varScanKeysInit(&vartable[varID].scanKeys); + vartable[varID].gridID = CDI_UNDEFID; + vartable[varID].zaxistype = 0; + vartable[varID].ltype1 = 0; + vartable[varID].ltype2 = -1; + vartable[varID].hasBounds = 0; + vartable[varID].level_sf = 0; + vartable[varID].level_unit = 0; + vartable[varID].recordTable = NULL; + vartable[varID].nsubtypes_alloc = 0; + vartable[varID].nsubtypes = 0; + vartable[varID].instID = CDI_UNDEFID; + vartable[varID].modelID = CDI_UNDEFID; + vartable[varID].tableID = CDI_UNDEFID; + cdiInitKeys(&vartable[varID].keys); + vartable[varID].comptype = CDI_COMPRESS_NONE; + vartable[varID].complevel = 1; + vartable[varID].lmissval = false; + vartable[varID].missval = 0; + vartable[varID].name = NULL; + vartable[varID].tiles = NULL; +} + +// Test if a variable specified by the given meta-data has already been registered in "vartable". +static int +varGetEntry(int param, int gridID, int zaxistype, int ltype1, int tsteptype, const char *name, const VarScanKeys *scanKeys, + const var_tile_t *tiles) +{ + for (int varID = 0; varID < varTableSize; ++varID) + { + // testing for "param" implicitly checks if we are beyond the current vartable size: + if (vartable[varID].param == param) + { + const int no_of_tiles = tiles ? tiles->numberOfTiles : -1; + const int vt_no_of_tiles + = vartable[varID].tiles ? subtypeGetGlobalDataP(vartable[varID].tiles, SUBTYPE_ATT_NUMBER_OF_TILES) : -1; + if ((vartable[varID].zaxistype == zaxistype) && (vartable[varID].ltype1 == ltype1) + && (vartable[varID].tsteptype == tsteptype) + && (scanKeys == NULL || varScanKeysIsEqual(&vartable[varID].scanKeys, scanKeys)) && (vartable[varID].gridID == gridID) + && (vt_no_of_tiles == no_of_tiles)) + { + if (name && name[0] && vartable[varID].name && vartable[varID].name[0]) + { + if (str_is_equal(name, vartable[varID].name)) return varID; + } + else + { + return varID; + } + } + } + } + + return -1; +} + +static void +varFree(void) +{ + if (CDI_Debug) Message("call to varFree"); + + for (int varID = 0; varID < varTableUsed; ++varID) + { + if (vartable[varID].recordTable) + { + for (int isub = 0; isub < vartable[varID].nsubtypes_alloc; isub++) Free(vartable[varID].recordTable[isub].levelTable); + Free(vartable[varID].recordTable); + } + + if (vartable[varID].name) Free(vartable[varID].name); + if (vartable[varID].tiles) subtypeDestroyPtr(vartable[varID].tiles); + + cdi_keys_t *keysp = &(vartable[varID].keys); + cdiDeleteVarKeys(keysp); + + if (vartable[varID].opt_grib_kvpair) + { + for (int i = 0; i < vartable[varID].opt_grib_nentries; i++) + { + if (vartable[varID].opt_grib_kvpair[i].keyword) Free(vartable[varID].opt_grib_kvpair[i].keyword); + } + Free(vartable[varID].opt_grib_kvpair); + } + vartable[varID].opt_grib_nentries = 0; + vartable[varID].opt_grib_kvpair_size = 0; + vartable[varID].opt_grib_kvpair = NULL; + } + + if (vartable) Free(vartable); + vartable = NULL; + varTableSize = 0; + varTableUsed = 0; + + if (Vct) Free(Vct); + Vct = NULL; + Vctsize = 0; +} + +// Search for a tile subtype with subtypeIndex == tile_index. +static int +tileGetEntry(int varID, int tile_index) +{ + for (int isub = 0; isub < vartable[varID].nsubtypes; isub++) + if (vartable[varID].recordTable[isub].subtypeIndex == tile_index) return isub; + return CDI_UNDEFID; +} + +/* Resizes vartable:recordTable data structure, if necessary. */ +static int +tileNewEntry(int varID) +{ + int tileID = 0; + if (vartable[varID].nsubtypes_alloc == 0) + { + /* create table for the first time. */ + vartable[varID].nsubtypes_alloc = 2; + vartable[varID].nsubtypes = 0; + vartable[varID].recordTable = (subtypetable_t *) Malloc((size_t) vartable[varID].nsubtypes_alloc * sizeof(subtypetable_t)); + if (vartable[varID].recordTable == NULL) SysError("Allocation of leveltable failed!"); + + for (int isub = 0; isub < vartable[varID].nsubtypes_alloc; isub++) + { + vartable[varID].recordTable[isub].levelTable = NULL; + vartable[varID].recordTable[isub].levelTableSize = 0; + vartable[varID].recordTable[isub].nlevels = 0; + vartable[varID].recordTable[isub].subtypeIndex = CDI_UNDEFID; + } + } + else + { + /* data structure large enough; find a free entry. */ + while (tileID < vartable[varID].nsubtypes_alloc) + { + if (vartable[varID].recordTable[tileID].levelTable == NULL) break; + tileID++; + } + } + + /* If the table overflows, double its size. */ + if (tileID == vartable[varID].nsubtypes_alloc) + { + tileID = vartable[varID].nsubtypes_alloc; + vartable[varID].nsubtypes_alloc *= 2; + vartable[varID].recordTable = (subtypetable_t *) Realloc(vartable[varID].recordTable, + (size_t) vartable[varID].nsubtypes_alloc * sizeof(subtypetable_t)); + if (vartable[varID].recordTable == NULL) SysError("Reallocation of leveltable failed"); + for (int isub = tileID; isub < vartable[varID].nsubtypes_alloc; isub++) + { + vartable[varID].recordTable[isub].levelTable = NULL; + vartable[varID].recordTable[isub].levelTableSize = 0; + vartable[varID].recordTable[isub].nlevels = 0; + vartable[varID].recordTable[isub].subtypeIndex = CDI_UNDEFID; + } + } + + return tileID; +} + +static int +levelNewEntry(int varID, int level1, int level2, int tileID) +{ + int levelID = 0; + int levelTableSize = vartable[varID].recordTable[tileID].levelTableSize; + leveltable_t *levelTable = vartable[varID].recordTable[tileID].levelTable; + + // Look for a free slot in levelTable. (Create the table the first time through). + if (!levelTableSize) + { + levelTableSize = 2; + levelTable = (leveltable_t *) Malloc((size_t) levelTableSize * sizeof(leveltable_t)); + for (int i = 0; i < levelTableSize; i++) levelTable[i].recID = CDI_UNDEFID; + } + else + { + while (levelID < levelTableSize && levelTable[levelID].recID != CDI_UNDEFID) ++levelID; + } + + // If the table overflows, double its size. + if (levelID == levelTableSize) + { + levelTable = (leveltable_t *) Realloc(levelTable, (size_t) (levelTableSize *= 2) * sizeof(leveltable_t)); + for (int i = levelID; i < levelTableSize; i++) levelTable[i].recID = CDI_UNDEFID; + } + + levelTable[levelID].level1 = level1; + levelTable[levelID].level2 = level2; + levelTable[levelID].lindex = levelID; + + vartable[varID].recordTable[tileID].nlevels = levelID + 1; + vartable[varID].recordTable[tileID].levelTableSize = levelTableSize; + vartable[varID].recordTable[tileID].levelTable = levelTable; + + return levelID; +} + +#define UNDEF_PARAM -4711 + +static int +paramNewEntry(int param) +{ + int varID = 0; + + // Look for a free slot in vartable. (Create the table the first time through). + if (!varTableSize) + { + varTableSize = 2; + vartable = (vartable_t *) Malloc((size_t) varTableSize * sizeof(vartable_t)); + if (vartable == NULL) + { + Message("varTableSize = %d", varTableSize); + SysError("Allocation of vartable failed"); + } + + for (int i = 0; i < varTableSize; i++) + { + vartable[i].param = UNDEF_PARAM; + vartable[i].opt_grib_kvpair = NULL; + vartable[i].opt_grib_kvpair_size = 0; + vartable[i].opt_grib_nentries = 0; + } + } + else + { + while (varID < varTableSize) + { + if (vartable[varID].param == UNDEF_PARAM) break; + varID++; + } + } + + // If the table overflows, double its size. + if (varID == varTableSize) + { + vartable = (vartable_t *) Realloc(vartable, (size_t) (varTableSize *= 2) * sizeof(vartable_t)); + for (int i = varID; i < varTableSize; i++) + { + vartable[i].param = UNDEF_PARAM; + vartable[i].opt_grib_kvpair = NULL; + vartable[i].opt_grib_kvpair_size = 0; + vartable[i].opt_grib_nentries = 0; + } + } + + paramInitEntry(varID, param); + + return varID; +} + +// Append tile set to a subtype. Return index of the new tile (i.e. the "entry->self" value). +static int +varInsertTileSubtype(vartable_t *vptr, const var_tile_t *tiles) +{ + if (tiles == NULL) return 0; + + // first, generate a subtype based on the info in "tiles". + subtype_t *subtype_ptr; + subtypeAllocate(&subtype_ptr, SUBTYPE_TILES); + subtypeDefGlobalDataP(subtype_ptr, SUBTYPE_ATT_TOTALNO_OF_TILEATTR_PAIRS, tiles->totalno_of_tileattr_pairs); + subtypeDefGlobalDataP(subtype_ptr, SUBTYPE_ATT_TILE_CLASSIFICATION, tiles->tileClassification); + subtypeDefGlobalDataP(subtype_ptr, SUBTYPE_ATT_NUMBER_OF_TILES, tiles->numberOfTiles); + + // Here, we create a tile set for comparison that contains only one tile/attribute pair (based on "tiles"). + struct subtype_entry_t *entry = subtypeEntryInsert(subtype_ptr); + subtypeDefEntryDataP(entry, SUBTYPE_ATT_NUMBER_OF_ATTR, tiles->numberOfAttributes); + subtypeDefEntryDataP(entry, SUBTYPE_ATT_TILEINDEX, tiles->tileindex); + subtypeDefEntryDataP(entry, SUBTYPE_ATT_TILEATTRIBUTE, tiles->attribute); + + if (vptr->tiles == NULL) + { + vptr->tiles = subtype_ptr; + return 0; + } + else + { + tilesetInsertP(vptr->tiles, subtype_ptr); + subtypeDestroyPtr(subtype_ptr); + return vptr->tiles->nentries - 1; + } +} + +void +varAddRecord(int recID, int param, int gridID, int zaxistype, int hasBounds, int level1, int level2, int level_sf, int level_unit, + int prec, int *pvarID, int *plevelID, int tsteptype, int ltype1, int ltype2, const char *name, + const VarScanKeys *scanKeys, const var_tile_t *tiles, int *tile_index) +{ + int varID = (CDI_Split_Ltype105 != 1 || zaxistype != ZAXIS_HEIGHT) + ? varGetEntry(param, gridID, zaxistype, ltype1, tsteptype, name, scanKeys, tiles) + : CDI_UNDEFID; + + if (varID == CDI_UNDEFID) + { + varTableUsed++; + varID = paramNewEntry(param); + vartable[varID].gridID = gridID; + vartable[varID].zaxistype = zaxistype; + vartable[varID].ltype1 = ltype1; + vartable[varID].ltype2 = ltype2; + vartable[varID].hasBounds = hasBounds; + vartable[varID].level_sf = level_sf; + vartable[varID].level_unit = level_unit; + vartable[varID].tsteptype = tsteptype; + if (scanKeys) vartable[varID].scanKeys = *scanKeys; + + if (name && name[0]) vartable[varID].name = strdup(name); + } + else + { + char paramstr[32]; + cdiParamToString(param, paramstr, sizeof(paramstr)); + + if (vartable[varID].gridID != gridID) + { + Message("param = %s gridID = %d", paramstr, gridID); + Error("horizontal grid must not change for same parameter!"); + } + if (vartable[varID].zaxistype != zaxistype) + { + Message("param = %s zaxistype = %d", paramstr, zaxistype); + Error("zaxistype must not change for same parameter!"); + } + } + + if (prec > vartable[varID].prec) vartable[varID].prec = prec; + + // append current tile to tile subtype info. + const int this_tile = varInsertTileSubtype(&vartable[varID], tiles); + int tileID = tileGetEntry(varID, this_tile); + if (tile_index) (*tile_index) = this_tile; + if (tileID == CDI_UNDEFID) + { + tileID = tileNewEntry((int) varID); + vartable[varID].recordTable[tileID].subtypeIndex = this_tile; + vartable[varID].nsubtypes++; + } + + // append current level to level table info + const int levelID = levelNewEntry(varID, level1, level2, tileID); + if (CDI_Debug) + Message("vartable[%d].recordTable[%d].levelTable[%d].recID = %d; level1,2=%d,%d", varID, tileID, levelID, recID, level1, + level2); + vartable[varID].recordTable[tileID].levelTable[levelID].recID = recID; + + *pvarID = (int) varID; + *plevelID = levelID; +} + +/* +static +int dblcmp(const void *s1, const void *s2) +{ + int cmp = 0; + + if ( *((double *) s1) < *((double *) s2) ) cmp = -1; + else if ( *((double *) s1) > *((double *) s2) ) cmp = 1; + + return cmp; +} +*/ +static int +cmpLevelTable(const void *s1, const void *s2) +{ + int cmp = 0; + const leveltable_t *x = (const leveltable_t *) s1; + const leveltable_t *y = (const leveltable_t *) s2; + // printf("%g %g %d %d\n", x->leve11, y->level1, x, y); + if (x->level1 < y->level1) + cmp = -1; + else if (x->level1 > y->level1) + cmp = 1; + + return cmp; +} + +static int +cmpLevelTableInv(const void *s1, const void *s2) +{ + int cmp = 0; + const leveltable_t *x = (const leveltable_t *) s1; + const leveltable_t *y = (const leveltable_t *) s2; + // printf("%g %g %d %d\n", x->leve11, y->level1, x, y); + if (x->level1 < y->level1) + cmp = 1; + else if (x->level1 > y->level1) + cmp = -1; + + return cmp; +} + +void +varCopyKeys(int vlistID, int varID) +{ + vlist_t *vlistptr = vlist_to_pointer(vlistID); + cdiInitKeys(&vlistptr->vars[varID].keys); + cdiCopyVarKeys(&vartable[varID].keys, &vlistptr->vars[varID].keys); +} + +struct cdi_generate_varinfo +{ + int varid; + const char *name; +}; + +/* +static int +cdi_generate_cmp_varname(const void *s1, const void *s2) +{ + const struct cdi_generate_varinfo *x = (const struct cdi_generate_varinfo *) s1, *y = (const struct cdi_generate_varinfo *) s2; + return strcmp(x->name, y->name); +} +*/ + +void +cdi_generate_vars(stream_t *streamptr) +{ + const int vlistID = streamptr->vlistID; + + int *varids = (int *) Malloc(varTableUsed * sizeof(int)); + for (int varID = 0; varID < varTableUsed; varID++) varids[varID] = (int) varID; + /* + if ( streamptr->sortname ) + { + size_t varID; + for (varID = 0; varID < varTableUsed; varID++) + if (!vartable[varID].name) break; + + if ( varID == varTableUsed ) + { + struct cdi_generate_varinfo *varInfo + = (struct cdi_generate_varinfo *) Malloc((size_t)varTableUsed * sizeof(struct cdi_generate_varinfo)); + + for (size_t varID = 0; varID < varTableUsed; varID++) + { + varInfo[varID].varid = varids[varID]; + varInfo[varID].name = vartable[varids[varID]].name; + } + qsort(varInfo, varTableUsed, sizeof(varInfo[0]), cdi_generate_cmp_varname); + for (size_t varID = 0; varID < varTableUsed; varID++) + { + varids[varID] = varInfo[varID].varid; + } + Free(varInfo); + } + } + */ + for (int index = 0; index < varTableUsed; index++) + { + const int varid = varids[index]; + + const int gridID = vartable[varid].gridID; + const int param = vartable[varid].param; + const int ltype1 = vartable[varid].ltype1; + const int ltype2 = vartable[varid].ltype2; + int zaxistype = vartable[varid].zaxistype; + if (ltype1 == 0 && zaxistype == ZAXIS_GENERIC && cdiDefaultLeveltype != -1) zaxistype = cdiDefaultLeveltype; + const int hasBounds = vartable[varid].hasBounds; + const int prec = vartable[varid].prec; + int instID = vartable[varid].instID; + int modelID = vartable[varid].modelID; + int tableID = vartable[varid].tableID; + const int tsteptype = vartable[varid].tsteptype; + const int comptype = vartable[varid].comptype; + + const double level_sf = (vartable[varid].level_sf != 0) ? (1.0 / vartable[varid].level_sf) : 1; + + /* consistency check: test if all subtypes have the same levels: */ + const int nlevels = vartable[varid].recordTable[0].nlevels; + for (int isub = 1; isub < vartable[varid].nsubtypes; isub++) + { + if (vartable[varid].recordTable[isub].nlevels != nlevels) + { + fprintf(stderr, + "var \"%s\": isub = %d / %d :: " + "nlevels = %d, vartable[varid].recordTable[isub].nlevels = %d\n", + vartable[varid].name, isub, vartable[varid].nsubtypes, nlevels, vartable[varid].recordTable[isub].nlevels); + Error("zaxis size must not change for same parameter!"); + } + + const leveltable_t *t1 = vartable[varid].recordTable[isub - 1].levelTable; + const leveltable_t *t2 = vartable[varid].recordTable[isub].levelTable; + for (int ilev = 0; ilev < nlevels; ilev++) + if ((t1[ilev].level1 != t2[ilev].level1) || (t1[ilev].level2 != t2[ilev].level2) + || (t1[ilev].lindex != t2[ilev].lindex)) + { + fprintf(stderr, + "var \"%s\", varID=%d: isub = %d / %d :: " + "nlevels = %d, vartable[varid].recordTable[isub].nlevels = %d\n", + vartable[varid].name, varid, isub, vartable[varid].nsubtypes, nlevels, + vartable[varid].recordTable[isub].nlevels); + Message("t1[ilev].level1=%d / t2[ilev].level1=%d", t1[ilev].level1, t2[ilev].level1); + Message("t1[ilev].level2=%d / t2[ilev].level2=%d", t1[ilev].level2, t2[ilev].level2); + Message("t1[ilev].lindex=%d / t2[ilev].lindex=%d", t1[ilev].lindex, t2[ilev].lindex); + Error("zaxis type must not change for same parameter!"); + } + } + leveltable_t *levelTable = vartable[varid].recordTable[0].levelTable; + + if (ltype1 == 0 && zaxistype == ZAXIS_GENERIC && nlevels == 1 && levelTable[0].level1 == 0) zaxistype = ZAXIS_SURFACE; + + double *dlevels = (double *) Malloc(nlevels * sizeof(double)); + + /* + if ( hasBounds && zaxistype != ZAXIS_HYBRID && zaxistype != ZAXIS_HYBRID_HALF ) + for (int levelID = 0; levelID < nlevels; levelID++) + dlevels[levelID] = (level_sf*levelTable[levelID].level1 + level_sf*levelTable[levelID].level2) / 2.0; + else + */ + for (int levelID = 0; levelID < nlevels; levelID++) dlevels[levelID] = level_sf * levelTable[levelID].level1; + + if (nlevels > 1) + { + bool linc = true, ldec = true, lsort = false; + for (int levelID = 1; levelID < nlevels; levelID++) + { + // check increasing of levels + linc &= (dlevels[levelID] > dlevels[levelID - 1]); + // check decreasing of levels + ldec &= (dlevels[levelID] < dlevels[levelID - 1]); + } + /* + * always sort pressure z-axis to ensure + * levelTable[levelID1].level1 < levelTable[levelID2].level1 <=> levelID1 > levelID2 + * unless already sorted in decreasing order + */ + if ((!linc && !ldec) && zaxistype == ZAXIS_PRESSURE) + { + qsort(levelTable, nlevels, sizeof(leveltable_t), cmpLevelTableInv); + lsort = true; + } + /* + * always sort hybrid and depth-below-land z-axis to ensure + * levelTable[levelID1].level1 < levelTable[levelID2].level1 <=> levelID1 < levelID2 + * unless already sorted in increasing order + */ + else if ((!linc && !ldec) || zaxistype == ZAXIS_HYBRID || zaxistype == ZAXIS_DEPTH_BELOW_LAND) + { + qsort(levelTable, nlevels, sizeof(leveltable_t), cmpLevelTable); + lsort = true; + } + + if (lsort) + { + /* + if ( hasBounds && zaxistype != ZAXIS_HYBRID && zaxistype != ZAXIS_HYBRID_HALF ) + for (int levelID = 0; levelID < nlevels; levelID++) + dlevels[levelID] = (level_sf*levelTable[levelID].level1 + level_sf*levelTable[levelID].level2) / 2.0; + else + */ + for (int levelID = 0; levelID < nlevels; levelID++) dlevels[levelID] = level_sf * levelTable[levelID].level1; + } + } + + double *dlevels1 = NULL; + double *dlevels2 = NULL; + if (hasBounds) + { + dlevels1 = (double *) Malloc(nlevels * sizeof(double)); + for (int levelID = 0; levelID < nlevels; levelID++) dlevels1[levelID] = level_sf * levelTable[levelID].level1; + dlevels2 = (double *) Malloc(nlevels * sizeof(double)); + for (int levelID = 0; levelID < nlevels; levelID++) dlevels2[levelID] = level_sf * levelTable[levelID].level2; + } + + const char **cvals = NULL; + const char *unitptr = cdiUnitNamePtr(vartable[varid].level_unit); + int zaxisID = varDefZaxis(vlistID, zaxistype, (int) nlevels, dlevels, cvals, 0, hasBounds, dlevels1, dlevels2, (int) Vctsize, + Vct, NULL, NULL, unitptr, 0, 0, ltype1, ltype2); + + if (CDI_CMOR_Mode && nlevels == 1 && zaxistype != ZAXIS_HYBRID) zaxisDefScalar(zaxisID); + + if (zaxisInqType(zaxisID) == ZAXIS_REFERENCE) + { + if (numberOfVerticalLevels > 0) cdiDefKeyInt(zaxisID, CDI_GLOBAL, CDI_KEY_NLEV, numberOfVerticalLevels); + if (numberOfVerticalGrid > 0) cdiDefKeyInt(zaxisID, CDI_GLOBAL, CDI_KEY_NUMBEROFVGRIDUSED, numberOfVerticalGrid); + if (!cdiUUIDIsNull(uuidVGrid)) cdiDefKeyBytes(zaxisID, CDI_GLOBAL, CDI_KEY_UUID, uuidVGrid, CDI_UUID_SIZE); + } + + if (hasBounds) Free(dlevels1); + if (hasBounds) Free(dlevels2); + Free(dlevels); + + // define new subtype for tile set + int tilesetID = CDI_UNDEFID; + if (vartable[varid].tiles) tilesetID = vlistDefTileSubtype(vlistID, vartable[varid].tiles); + + // generate new variable + int varID = stream_new_var(streamptr, gridID, zaxisID, tilesetID); + varID = vlistDefVarTiles(vlistID, gridID, zaxisID, TIME_VARYING, tilesetID); + + vlistDefVarTsteptype(vlistID, varID, tsteptype); + vlistDefVarParam(vlistID, varID, param); + vlistDefVarDatatype(vlistID, varID, prec); + vlistDefVarCompType(vlistID, varID, comptype); + + varCopyKeys(vlistID, varID); + + if (vartable[varid].lmissval) vlistDefVarMissval(vlistID, varID, vartable[varid].missval); + if (vartable[varid].name) cdiDefKeyString(vlistID, varID, CDI_KEY_NAME, vartable[varid].name); + + vlist_t *vlistptr = vlist_to_pointer(vlistID); + for (int i = 0; i < vartable[varid].opt_grib_nentries; i++) + { + resize_opt_grib_entries(&vlistptr->vars[varID], vlistptr->vars[varID].opt_grib_nentries + 1); + vlistptr->vars[varID].opt_grib_nentries += 1; + const int idx = vlistptr->vars[varID].opt_grib_nentries - 1; + + vlistptr->vars[varID].opt_grib_kvpair[idx] = vartable[varid].opt_grib_kvpair[i]; + vlistptr->vars[varID].opt_grib_kvpair[idx].keyword = NULL; + if (vartable[varid].opt_grib_kvpair[i].keyword) + vlistptr->vars[varID].opt_grib_kvpair[idx].keyword = strdupx(vartable[varid].opt_grib_kvpair[i].keyword); + vlistptr->vars[varID].opt_grib_kvpair[i].update = true; + } + // note: if the key is not defined, we do not throw an error! + + if (CDI_Default_TableID != CDI_UNDEFID) + { + int pdis, pcat, pnum; + cdiDecodeParam(param, &pnum, &pcat, &pdis); + char name[CDI_MAX_NAME]; + name[0] = 0; + char longname[CDI_MAX_NAME]; + longname[0] = 0; + char units[CDI_MAX_NAME]; + units[0] = 0; + tableInqEntry(CDI_Default_TableID, pnum, -1, name, longname, units); + if (name[0]) + { + if (tableID != CDI_UNDEFID) + { + cdiDefKeyString(vlistID, varID, CDI_KEY_NAME, name); + if (longname[0]) cdiDefKeyString(vlistID, varID, CDI_KEY_LONGNAME, longname); + if (units[0]) cdiDefKeyString(vlistID, varID, CDI_KEY_UNITS, units); + } + else + tableID = CDI_Default_TableID; + } + if (CDI_Default_ModelID != CDI_UNDEFID) modelID = CDI_Default_ModelID; + if (CDI_Default_InstID != CDI_UNDEFID) instID = CDI_Default_InstID; + } + + if (instID != CDI_UNDEFID) vlistDefVarInstitut(vlistID, varID, instID); + if (modelID != CDI_UNDEFID) vlistDefVarModel(vlistID, varID, modelID); + if (tableID != CDI_UNDEFID) vlistDefVarTable(vlistID, varID, tableID); + } + + for (int index = 0; index < varTableUsed; index++) + { + int varid = varids[index]; + int nlevels = vartable[varid].recordTable[0].nlevels; + + int nsub = (vartable[varid].nsubtypes >= 0) ? vartable[varid].nsubtypes : 0; + for (int isub = 0; isub < nsub; isub++) + { + sleveltable_t *streamRecordTable = streamptr->vars[index].recordTable + isub; + leveltable_t *vartableLevelTable = vartable[varid].recordTable[isub].levelTable; + for (int levelID = 0; levelID < nlevels; levelID++) + { + streamRecordTable->recordID[levelID] = vartableLevelTable[levelID].recID; + int lindex; + for (lindex = 0; lindex < nlevels; lindex++) + if (levelID == vartableLevelTable[lindex].lindex) break; + if (lindex == nlevels) Error("Internal problem! lindex not found."); + streamRecordTable->lindex[levelID] = (int) lindex; + } + } + } + + Free(varids); + + varFree(); +} + +void +varDefVCT(size_t vctsize, double *vctptr) +{ + if (Vct == NULL && vctptr != NULL && vctsize > 0) + { + Vctsize = vctsize; + Vct = (double *) Malloc(vctsize * sizeof(double)); + memcpy(Vct, vctptr, vctsize * sizeof(double)); + } +} + +void +varDefZAxisReference(int nhlev, int nvgrid, unsigned char uuid[CDI_UUID_SIZE]) +{ + numberOfVerticalLevels = nhlev; + numberOfVerticalGrid = nvgrid; + memcpy(uuidVGrid, uuid, CDI_UUID_SIZE); +} + +bool +zaxis_compare(int zaxisID, int zaxistype, int nlevels, const double *levels, const double *lbounds, const double *ubounds, + const char *longname, const char *units, int ltype1, int ltype2) +{ + bool differ = true; + + int ltype1_0 = 0, ltype2_0 = -1; + cdiInqKeyInt(zaxisID, CDI_GLOBAL, CDI_KEY_TYPEOFFIRSTFIXEDSURFACE, <ype1_0); + cdiInqKeyInt(zaxisID, CDI_GLOBAL, CDI_KEY_TYPEOFSECONDFIXEDSURFACE, <ype2_0); + const bool ltype1IsEqual = (ltype1 == ltype1_0); + const bool ltype2IsEqual = (ltype2 == ltype2_0); + const bool hasBounds = (lbounds && ubounds); + + if (ltype1IsEqual && ltype2IsEqual && (zaxistype == zaxisInqType(zaxisID) || zaxistype == ZAXIS_GENERIC)) + { + const bool hasBoundsZ = (zaxisInqLbounds(zaxisID, NULL) > 0 && zaxisInqUbounds(zaxisID, NULL) > 0); + if (nlevels == zaxisInqSize(zaxisID) && hasBoundsZ == hasBounds) + { + const double *dlevels = zaxisInqLevelsPtr(zaxisID); + if (dlevels && levels) + { + int levelID; + for (levelID = 0; levelID < nlevels; levelID++) + { + if (fabs(dlevels[levelID] - levels[levelID]) > 1.e-9) break; + } + if (levelID == nlevels) differ = false; + } + + if (!differ && hasBounds) + { + double *bounds = (double *) malloc(2 * nlevels * sizeof(double)); + zaxisInqLbounds(zaxisID, bounds); + zaxisInqUbounds(zaxisID, bounds + nlevels); + for (int levelID = 0; levelID < nlevels; levelID++) + { + if (fabs(lbounds[levelID] - bounds[levelID]) > 1.e-9 + || fabs(ubounds[levelID] - bounds[levelID + nlevels]) > 1.e-9) + { + differ = true; + break; + } + } + free(bounds); + } + + if (!differ) + { + if (longname && longname[0]) + { + char zlongname[CDI_MAX_NAME]; + int length = CDI_MAX_NAME; + cdiInqKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_LONGNAME, zlongname, &length); + if (zlongname[0] && !str_is_equal(longname, zlongname)) differ = true; + } + if (units && units[0]) + { + char zunits[CDI_MAX_NAME]; + int length = CDI_MAX_NAME; + cdiInqKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_UNITS, zunits, &length); + if (zunits[0] && !str_is_equal(units, zunits)) differ = true; + } + } + } + } + + return differ; +} + +struct varDefZAxisSearchState +{ + int resIDValue; + int zaxistype; + int nlevels; + const double *levels; + const double *lbounds; + const double *ubounds; + const char *longname; + const char *units; + int ltype1; + int ltype2; +}; + +static enum cdiApplyRet +varDefZAxisSearch(int id, void *res, void *data) +{ + struct varDefZAxisSearchState *state = (struct varDefZAxisSearchState *) data; + (void) res; + if (zaxis_compare(id, state->zaxistype, state->nlevels, state->levels, state->lbounds, state->ubounds, state->longname, + state->units, state->ltype1, state->ltype2) + == false) + { + state->resIDValue = id; + return CDI_APPLY_STOP; + } + else + return CDI_APPLY_GO_ON; +} + +int +varDefZaxis(int vlistID, int zaxistype, int nlevels, const double *levels, const char **cvals, size_t clength, bool hasBounds, + const double *levels1, const double *levels2, int vctsize, const double *vct, char *name, const char *longname, + const char *units, int prec, int mode, int ltype1, int ltype2) +{ + /* + mode: 0 search in vlist and zaxis table + 1 search in zaxis table + */ + int zaxisID = CDI_UNDEFID; + bool zaxisdefined = false; + bool zaxisglobdefined = false; + vlist_t *vlistptr = vlist_to_pointer(vlistID); + int nzaxis = vlistptr->nzaxis; + + if (ltype2 == 255) ltype2 = -1; + + if (mode == 0) + for (int index = 0; index < nzaxis; index++) + { + zaxisID = vlistptr->zaxisIDs[index]; + + if (!zaxis_compare(zaxisID, zaxistype, nlevels, levels, levels1, levels2, longname, units, ltype1, ltype2)) + { + zaxisdefined = true; + break; + } + } + + if (!zaxisdefined) + { + struct varDefZAxisSearchState query; + query.zaxistype = zaxistype; + query.nlevels = nlevels; + query.levels = levels; + query.lbounds = levels1; + query.ubounds = levels2; + query.longname = longname; + query.units = units; + query.ltype1 = ltype1; + query.ltype2 = ltype2; + + if ((zaxisglobdefined = (cdiResHFilterApply(getZaxisOps(), varDefZAxisSearch, &query) == CDI_APPLY_STOP))) + zaxisID = query.resIDValue; + + if (mode == 1 && zaxisglobdefined) + for (int index = 0; index < nzaxis; index++) + if (vlistptr->zaxisIDs[index] == zaxisID) + { + zaxisglobdefined = false; + break; + } + } + + if (!zaxisdefined) + { + if (!zaxisglobdefined) + { + zaxisID = zaxisCreate(zaxistype, nlevels); + if (levels) zaxisDefLevels(zaxisID, levels); + if (hasBounds) + { + zaxisDefLbounds(zaxisID, levels1); + zaxisDefUbounds(zaxisID, levels2); + } + + if (cvals != NULL && nlevels != 0 && clength != 0) zaxisDefCvals(zaxisID, cvals, (int) clength); + + if ((zaxistype == ZAXIS_HYBRID || zaxistype == ZAXIS_HYBRID_HALF) && vctsize > 0) zaxisDefVct(zaxisID, vctsize, vct); + + if (name && name[0]) cdiDefKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_NAME, name); + if (longname && longname[0]) cdiDefKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_LONGNAME, longname); + if (units && units[0]) cdiDefKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_UNITS, units); + zaxisDefDatatype(zaxisID, prec); + cdiDefKeyInt(zaxisID, CDI_GLOBAL, CDI_KEY_TYPEOFFIRSTFIXEDSURFACE, ltype1); + if (ltype2 != -1) cdiDefKeyInt(zaxisID, CDI_GLOBAL, CDI_KEY_TYPEOFSECONDFIXEDSURFACE, ltype2); + } + + vlistptr->zaxisIDs[nzaxis] = zaxisID; + vlistptr->nzaxis++; + } + + return zaxisID; +} + +void +varDefMissval(int varID, double missval) +{ + vartable[varID].lmissval = true; + vartable[varID].missval = missval; +} + +void +varDefCompType(int varID, int comptype) +{ + if (vartable[varID].comptype == CDI_COMPRESS_NONE) vartable[varID].comptype = comptype; +} + +void +varDefCompLevel(int varID, int complevel) +{ + vartable[varID].complevel = complevel; +} + +int +varInqInst(int varID) +{ + return vartable[varID].instID; +} + +void +varDefInst(int varID, int instID) +{ + vartable[varID].instID = instID; +} + +int +varInqModel(int varID) +{ + return vartable[varID].modelID; +} + +void +varDefModel(int varID, int modelID) +{ + vartable[varID].modelID = modelID; +} + +int +varInqTable(int varID) +{ + return vartable[varID].tableID; +} + +void +varDefTable(int varID, int tableID) +{ + vartable[varID].tableID = tableID; +} + +void +varDefKeyInt(int varID, int key, int value) +{ + cdi_keys_t *keysp = &(vartable[varID].keys); + cdiDefVarKeyInt(keysp, key, value); +} + +void +varDefKeyBytes(int varID, int key, const unsigned char *bytes, int length) +{ + cdi_keys_t *keysp = &(vartable[varID].keys); + cdiDefVarKeyBytes(keysp, key, bytes, length); +} + +void +varDefKeyString(int varID, int key, const char *string) +{ + int length = strlen(string) + 1; + cdi_keys_t *keysp = &(vartable[varID].keys); + cdiDefVarKeyBytes(keysp, key, (const unsigned char *) string, length); +} + +#ifdef HAVE_LIBGRIB_API +// Resizes and initializes opt_grib_kvpair data structure. +static void +resize_vartable_opt_grib_entries(vartable_t *var, int nentries) +{ + if (var->opt_grib_kvpair_size < nentries) + { + if (CDI_Debug) Message("resize data structure, %d -> %d", var->opt_grib_kvpair_size, nentries); + + int new_size = ((2 * var->opt_grib_kvpair_size) > nentries) ? (2 * var->opt_grib_kvpair_size) : nentries; + if (CDI_Debug) Message("resize vartable opt_grib_entries array to size %d", new_size); + opt_key_val_pair_t *tmp = (opt_key_val_pair_t *) Malloc((size_t) new_size * sizeof(opt_key_val_pair_t)); + for (int i = 0; i < var->opt_grib_kvpair_size; i++) + { + tmp[i] = var->opt_grib_kvpair[i]; + } + for (int i = var->opt_grib_kvpair_size; i < new_size; i++) + { + tmp[i].int_val = 0; + tmp[i].dbl_val = 0; + tmp[i].update = false; + tmp[i].keyword = NULL; + } // for + var->opt_grib_kvpair_size = new_size; + Free(var->opt_grib_kvpair); + var->opt_grib_kvpair = tmp; + } +} +#endif + +#ifdef HAVE_LIBGRIB_API +void +varDefOptGribInt(int varID, int tile_index, long lval, const char *keyword) +{ + int idx = -1; + for (int i = 0; i < vartable[varID].opt_grib_nentries; i++) + { + if (str_is_equal(keyword, vartable[varID].opt_grib_kvpair[i].keyword) + && (vartable[varID].opt_grib_kvpair[i].data_type == t_int) + && (vartable[varID].opt_grib_kvpair[i].subtype_index == tile_index)) + idx = i; + } + + if (idx == -1) + { + resize_vartable_opt_grib_entries(&vartable[varID], vartable[varID].opt_grib_nentries + 1); + vartable[varID].opt_grib_nentries += 1; + idx = vartable[varID].opt_grib_nentries - 1; + } + else + { + if (vartable[varID].opt_grib_kvpair[idx].keyword) Free(vartable[varID].opt_grib_kvpair[idx].keyword); + } + vartable[varID].opt_grib_kvpair[idx].data_type = t_int; + vartable[varID].opt_grib_kvpair[idx].int_val = (int) lval; + vartable[varID].opt_grib_kvpair[idx].keyword = strdupx(keyword); + vartable[varID].opt_grib_kvpair[idx].subtype_index = tile_index; +} +#endif + +#ifdef HAVE_LIBGRIB_API +void +varDefOptGribDbl(int varID, int tile_index, double dval, const char *keyword) +{ + int idx = -1; + for (int i = 0; i < vartable[varID].opt_grib_nentries; i++) + { + if (str_is_equal(keyword, vartable[varID].opt_grib_kvpair[i].keyword) + && (vartable[varID].opt_grib_kvpair[i].data_type == t_double) + && (vartable[varID].opt_grib_kvpair[i].subtype_index == tile_index)) + idx = i; + } + + if (idx == -1) + { + resize_vartable_opt_grib_entries(&vartable[varID], vartable[varID].opt_grib_nentries + 1); + vartable[varID].opt_grib_nentries += 1; + idx = vartable[varID].opt_grib_nentries - 1; + } + else + { + if (vartable[varID].opt_grib_kvpair[idx].keyword) Free(vartable[varID].opt_grib_kvpair[idx].keyword); + } + vartable[varID].opt_grib_kvpair[idx].data_type = t_double; + vartable[varID].opt_grib_kvpair[idx].dbl_val = dval; + vartable[varID].opt_grib_kvpair[idx].keyword = strdupx(keyword); + vartable[varID].opt_grib_kvpair[idx].subtype_index = tile_index; +} +#endif + +#ifdef HAVE_LIBGRIB_API +int +varOptGribNentries(int varID) +{ + int nentries = vartable[varID].opt_grib_nentries; + return nentries; +} +#endif + +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifdef HAVE_CONFIG_H +#endif + +#include <stdbool.h> + + + +#ifdef HAVE_LIBGRIB_API +/* list of additional GRIB2 keywords which are read by the open process */ +int cdiNAdditionalGRIBKeys = 0; +char *cdiAdditionalGRIBKeys[MAX_OPT_GRIB_ENTRIES]; +#endif + +static int VLIST_Debug = 0; + +static void vlist_initialize(void); + +#ifdef HAVE_LIBPTHREAD +#include <pthread.h> + +static pthread_once_t _vlist_init_thread = PTHREAD_ONCE_INIT; + +#define VLIST_INIT() pthread_once(&_vlist_init_thread, vlist_initialize) + +#else + +static bool vlistIsInitialized = false; + +#define VLIST_INIT() \ + if (!vlistIsInitialized) vlist_initialize() +#endif + +static int +vlist_compare(vlist_t *a, vlist_t *b) +{ + int diff = (a->nvars != b->nvars) | (a->ngrids != b->ngrids) | (a->nzaxis != b->nzaxis) | (a->instID != b->instID) + | (a->modelID != b->modelID) | (a->tableID != b->tableID) | (a->ntsteps != b->ntsteps) + | (a->atts.nelems != b->atts.nelems); + + int nvars = a->nvars; + for (int varID = 0; varID < nvars; ++varID) diff |= vlistVarCompare(a, varID, b, varID); + + size_t natts = a->atts.nelems; + for (size_t attID = 0; attID < natts; ++attID) diff |= cdi_att_compare(&a->atts, &a->atts, (int) attID); + + return diff; +} + +static void vlistPrintKernel(vlist_t *vlistptr, FILE *fp); +static void vlist_delete(vlist_t *vlistptr); + +static int vlistGetSizeP(void *vlistptr, void *context); +static void vlistPackP(void *vlistptr, void *buff, int size, int *position, void *context); +static int vlistTxCode(void *vlistptr); + +#if !defined(__cplusplus) +const +#endif + resOps vlistOps + = { (valCompareFunc) vlist_compare, + (valDestroyFunc) vlist_delete, + (valPrintFunc) vlistPrintKernel, + vlistGetSizeP, + vlistPackP, + vlistTxCode }; + +vlist_t * +vlist_to_pointer(int vlistID) +{ + VLIST_INIT(); + return (vlist_t *) reshGetVal(vlistID, &vlistOps); +} + +static void +vlist_init_entry(vlist_t *vlistptr) +{ + vlistptr->immutable = 0; + vlistptr->internal = 0; + vlistptr->self = CDI_UNDEFID; + vlistptr->nvars = 0; + vlistptr->vars = NULL; + vlistptr->ngrids = 0; + vlistptr->nzaxis = 0; + vlistptr->taxisID = CDI_UNDEFID; + vlistptr->instID = CDI_Default_InstID; + vlistptr->modelID = CDI_Default_ModelID; + vlistptr->tableID = CDI_Default_TableID; + vlistptr->varsAllocated = 0; + vlistptr->ntsteps = CDI_UNDEFID; + vlistptr->keys.nalloc = MAX_KEYS; + vlistptr->keys.nelems = 0; + for (int i = 0; i < MAX_KEYS; ++i) vlistptr->keys.value[i].length = 0; + vlistptr->atts.nalloc = MAX_ATTRIBUTES; + vlistptr->atts.nelems = 0; + vlistptr->nsubtypes = 0; + for (int i = 0; i < MAX_SUBTYPES_PS; ++i) vlistptr->subtypeIDs[i] = CDI_UNDEFID; +} + +static vlist_t * +vlist_new_entry(cdiResH resH) +{ + vlist_t *vlistptr = (vlist_t *) Malloc(sizeof(vlist_t)); + vlist_init_entry(vlistptr); + if (resH == CDI_UNDEFID) + vlistptr->self = reshPut(vlistptr, &vlistOps); + else + { + vlistptr->self = resH; + reshReplace(resH, vlistptr, &vlistOps); + } + return vlistptr; +} + +static void +vlist_delete_entry(int vlistID) +{ + reshRemove(vlistID, &vlistOps); + + if (VLIST_Debug) Message("Removed idx %d from vlist list", vlistID); +} + +static void +vlist_initialize(void) +{ + char *env = getenv("VLIST_DEBUG"); + if (env) VLIST_Debug = atoi(env); +#ifndef HAVE_LIBPTHREAD + vlistIsInitialized = true; +#endif +} + +static void +vlist_copy(vlist_t *vlistptr2, vlist_t *vlistptr1) +{ + int vlistID2 = vlistptr2->self; + int vlist2internal = vlistptr2->internal; + memcpy(vlistptr2, vlistptr1, sizeof(vlist_t)); + vlistptr2->internal = vlist2internal; // the question who's responsible to destroy the vlist is tied to its containing memory + // region, so we retain this flag + vlistptr2->immutable = 0; // this is a copy, so it's mutable, independent of whether the original is mutable or not + vlistptr2->keys.nelems = 0; + vlistptr2->atts.nelems = 0; + vlistptr2->self = vlistID2; +} + +void +cdiVlistMakeInternal(int vlistID) +{ + vlist_to_pointer(vlistID)->internal = 1; +} + +void +cdiVlistMakeImmutable(int vlistID) +{ + vlist_to_pointer(vlistID)->immutable = 1; +} + +/* +@Function vlistCreate +@Title Create a variable list + +@Prototype int vlistCreate(void) + +@Example +Here is an example using @func{vlistCreate} to create a variable list +and add a variable with @func{vlistDefVar}. + +@Source + ... +int vlistID, varID; + ... +vlistID = vlistCreate(); +varID = vlistDefVar(vlistID, gridID, zaxisID, TIME_VARYING); + ... +streamDefVlist(streamID, vlistID); + ... +vlistDestroy(vlistID); + ... +@EndSource +@EndFunction +*/ +int +vlistCreate(void) +{ + cdiInitialize(); + + VLIST_INIT(); + + vlist_t *vlistptr = vlist_new_entry(CDI_UNDEFID); + if (CDI_Debug) Message("create vlistID = %d", vlistptr->self); + return vlistptr->self; +} + +static void +vlist_delete(vlist_t *vlistptr) +{ + int vlistID = vlistptr->self; + if (CDI_Debug) Message("call to vlist_delete, vlistID = %d", vlistID); + + cdiDeleteKeys(vlistID, CDI_GLOBAL); + cdiDeleteAtts(vlistID, CDI_GLOBAL); + + int nvars = vlistptr->nvars; + var_t *vars = vlistptr->vars; + + for (int varID = 0; varID < nvars; varID++) + { + if (vars[varID].levinfo) Free(vars[varID].levinfo); + + if (vlistptr->vars[varID].opt_grib_kvpair) + { + for (int i = 0; i < vlistptr->vars[varID].opt_grib_nentries; i++) + { + if (vlistptr->vars[varID].opt_grib_kvpair[i].keyword) Free(vlistptr->vars[varID].opt_grib_kvpair[i].keyword); + } + Free(vlistptr->vars[varID].opt_grib_kvpair); + } + vlistptr->vars[varID].opt_grib_nentries = 0; + vlistptr->vars[varID].opt_grib_kvpair_size = 0; + vlistptr->vars[varID].opt_grib_kvpair = NULL; + + cdiDeleteKeys(vlistID, varID); + cdiDeleteAtts(vlistID, varID); + } + + if (vars) Free(vars); + + Free(vlistptr); +} + +// destroy a vlist object, should always be called through namespace lookup +void +cdiVlistDestroy_(int vlistID, bool assertInternal) +{ + vlist_t *vlistptr = vlist_to_pointer(vlistID); + + static const char warningTextUserByInternal[] + = "Destroying a vlist object that is owned by the user (vlistID=%d).\n" + "This is most likely because of a missing vlistDestroy() in the application code.\n" + "If that's not the case, and you are absolutely certain about it, please report the bug.", + warningTextInternalByUser[] = "Attempt to destroy an internal vlist object by the user (vlistID=%d)."; + static const char *const wText[2] = { warningTextUserByInternal, warningTextInternalByUser }; + if (vlistptr->internal == assertInternal) + { + vlist_delete(vlistptr); + vlist_delete_entry(vlistID); + } + else + Warning(wText[!assertInternal], vlistID); +} + +/* +@Function vlistDestroy +@Title Destroy a variable list + +@Prototype void vlistDestroy(int vlistID) +@Parameter + @Item vlistID Variable list ID, from a previous call to @fref{vlistCreate}. + +@EndFunction +*/ +void +vlistDestroy(int vlistID) +{ + void (*mycdiVlistDestroy_)(int, bool) = (void (*)(int, bool)) namespaceSwitchGet(NSSWITCH_VLIST_DESTROY_).func; + mycdiVlistDestroy_(vlistID, false); +} + +static void +var_copy_entries(var_t *var2, var_t *var1) +{ + var2->opt_grib_kvpair_size = 0; + var2->opt_grib_kvpair = NULL; + var2->opt_grib_nentries = 0; + + resize_opt_grib_entries(var2, var1->opt_grib_nentries); + var2->opt_grib_nentries = var1->opt_grib_nentries; + if ((var2->opt_grib_nentries > 0) && CDI_Debug) Message("copy %d optional GRIB keywords", var2->opt_grib_nentries); + + for (int i = 0; i < var1->opt_grib_nentries; i++) + { + if (CDI_Debug) Message("copy entry \"%s\" ...", var1->opt_grib_kvpair[i].keyword); + var2->opt_grib_kvpair[i].keyword = NULL; + if (var1->opt_grib_kvpair[i].keyword != NULL) + { + var2->opt_grib_kvpair[i] = var1->opt_grib_kvpair[i]; + var2->opt_grib_kvpair[i].keyword = strdupx(var1->opt_grib_kvpair[i].keyword); + var2->opt_grib_kvpair[i].update = true; + if (CDI_Debug) Message("done."); + } + else + { + if (CDI_Debug) Message("not done."); + } + } +} + +/* +@Function vlistCopy +@Title Copy a variable list + +@Prototype void vlistCopy(int vlistID2, int vlistID1) +@Parameter + @Item vlistID2 Target variable list ID. + @Item vlistID1 Source variable list ID. + +@Description +The function @func{vlistCopy} copies all entries from vlistID1 to vlistID2. + +@EndFunction +*/ +void +vlistCopy(int vlistID2, int vlistID1) +{ + vlist_t *vlistptr1 = vlist_to_pointer(vlistID1); + vlist_t *vlistptr2 = vlist_to_pointer(vlistID2); + if (CDI_Debug) Message("call to vlistCopy, vlistIDs %d -> %d", vlistID1, vlistID2); + + var_t *vars1 = vlistptr1->vars; + var_t *vars2 = vlistptr2->vars; + vlist_copy(vlistptr2, vlistptr1); + + vlistptr2->keys.nelems = 0; + cdiCopyKeys(vlistID1, CDI_GLOBAL, vlistID2, CDI_GLOBAL); + vlistptr2->atts.nelems = 0; + cdiCopyAtts(vlistID1, CDI_GLOBAL, vlistID2, CDI_GLOBAL); + + if (vars1) + { + int nvars = vlistptr1->nvars; + // vlistptr2->varsAllocated = nvars; + + size_t n = (size_t) vlistptr2->varsAllocated; + vars2 = (var_t *) Realloc(vars2, n * sizeof(var_t)); + memcpy(vars2, vars1, n * sizeof(var_t)); + vlistptr2->vars = vars2; + + for (int varID = 0; varID < nvars; varID++) + { + var_copy_entries(&vars2[varID], &vars1[varID]); + vlistptr2->vars[varID].keys.nelems = 0; + cdiCopyKeys(vlistID1, varID, vlistID2, varID); + + vlistptr2->vars[varID].atts.nelems = 0; + cdiCopyAtts(vlistID1, varID, vlistID2, varID); + + if (vars1[varID].levinfo) + { + n = (size_t) zaxisInqSize(vars1[varID].zaxisID); + vars2[varID].levinfo = (levinfo_t *) Malloc(n * sizeof(levinfo_t)); + memcpy(vars2[varID].levinfo, vars1[varID].levinfo, n * sizeof(levinfo_t)); + } + } + } +} + +/* +@Function vlistDuplicate +@Title Duplicate a variable list + +@Prototype int vlistDuplicate(int vlistID) +@Parameter + @Item vlistID Variable list ID, from a previous call to @fref{vlistCreate} or @fref{streamInqVlist}. + +@Description +The function @func{vlistDuplicate} duplicates the variable list from vlistID1. + +@Result +@func{vlistDuplicate} returns an identifier to the duplicated variable list. + +@EndFunction +*/ +int +vlistDuplicate(int vlistID) +{ + if (CDI_Debug) Message("call to vlistDuplicate"); + + int vlistIDnew = vlistCreate(); + vlistCopy(vlistIDnew, vlistID); + return vlistIDnew; +} + +void +vlistClearFlag(int vlistID) +{ + vlist_t *vlistptr = vlist_to_pointer(vlistID); + + for (int varID = 0; varID < vlistptr->nvars; varID++) + { + vlistptr->vars[varID].flag = false; + if (vlistptr->vars[varID].levinfo) + { + int nlevs = zaxisInqSize(vlistptr->vars[varID].zaxisID); + for (int levID = 0; levID < nlevs; levID++) vlistptr->vars[varID].levinfo[levID].flag = false; + } + } +} + +struct vgzSearchState +{ + int resIDValue; + int zaxistype; + int nlevels; + const double *levels; + const double *lbounds; + const double *ubounds; +}; + +static enum cdiApplyRet +vgzZAxisSearch(int id, void *res, void *data) +{ + struct vgzSearchState *state = (struct vgzSearchState *) data; + (void) res; + if (zaxis_compare(id, state->zaxistype, state->nlevels, state->levels, state->lbounds, state->ubounds, NULL, NULL, 0, -1) + == false) + { + state->resIDValue = id; + return CDI_APPLY_STOP; + } + else + return CDI_APPLY_GO_ON; +} + +static int +vlist_generate_zaxis(int vlistID, int zaxistype, int nlevels, const double *levels, const double *lbounds, const double *ubounds, + int vctsize, const double *vct, const char **cvals, size_t clen) +{ + int zaxisID = CDI_UNDEFID; + bool zaxisdefined = false; + bool zaxisglobdefined = false; + vlist_t *vlistptr = vlist_to_pointer(vlistID); + int nzaxis = vlistptr->nzaxis; + + const bool hasBounds = (lbounds && ubounds); + + for (int index = 0; index < nzaxis; ++index) + { + zaxisID = vlistptr->zaxisIDs[index]; + + if (zaxis_compare(zaxisID, zaxistype, nlevels, levels, lbounds, ubounds, NULL, NULL, 0, -1) == false) + { + zaxisdefined = true; + break; + } + } + + if (!zaxisdefined) + { + struct vgzSearchState query; + query.zaxistype = zaxistype; + query.nlevels = nlevels; + query.levels = levels; + + if ((zaxisglobdefined = (cdiResHFilterApply(getZaxisOps(), vgzZAxisSearch, &query) == CDI_APPLY_STOP))) + zaxisID = query.resIDValue; + } + + if (!zaxisdefined) + { + if (!zaxisglobdefined) + { + zaxisID = zaxisCreate(zaxistype, nlevels); + zaxisDefLevels(zaxisID, levels); + + if (zaxistype == ZAXIS_CHAR) zaxisDefCvals(zaxisID, cvals, (int) clen); + + if (hasBounds) + { + zaxisDefLbounds(zaxisID, lbounds); + zaxisDefUbounds(zaxisID, ubounds); + } + + if (zaxistype == ZAXIS_HYBRID && vctsize > 0) zaxisDefVct(zaxisID, vctsize, vct); + } + + nzaxis = vlistptr->nzaxis; + vlistptr->zaxisIDs[nzaxis] = zaxisID; + vlistptr->nzaxis++; + } + + return zaxisID; +} + +/* +@Function vlistCopyFlag +@Title Copy some entries of a variable list + +@Prototype void vlistCopyFlag(int vlistID2, int vlistID1) +@Parameter + @Item vlistID2 Target variable list ID. + @Item vlistID1 Source variable list ID. + +@Description +The function @func{vlistCopyFlag} copies all entries with a flag from vlistID1 to vlistID2. + +@EndFunction +*/ +void +vlistCopyFlag(int vlistID2, int vlistID1) +{ + vlist_t *vlistptr1 = vlist_to_pointer(vlistID1); + vlist_t *vlistptr2 = vlist_to_pointer(vlistID2); + var_t *vars1 = vlistptr1->vars; + var_t *vars2 = vlistptr2->vars; + + vlist_copy(vlistptr2, vlistptr1); + + vlistptr2->keys.nelems = 0; + cdiCopyKeys(vlistID1, CDI_GLOBAL, vlistID2, CDI_GLOBAL); + vlistptr2->atts.nelems = 0; + cdiCopyAtts(vlistID1, CDI_GLOBAL, vlistID2, CDI_GLOBAL); + + if (vlistptr1->vars) + { + vlistptr2->ngrids = 0; + vlistptr2->nzaxis = 0; + + int nvars = vlistptr1->nvars; + int nvars2 = 0; + for (int varID = 0; varID < nvars; varID++) nvars2 += vars1[varID].flag; + + vlistptr2->nvars = nvars2; + vlistptr2->varsAllocated = nvars2; + vars2 = (nvars2 > 0) ? (var_t *) Malloc((size_t) nvars2 * sizeof(var_t)) : NULL; + + vlistptr2->vars = vars2; + + int varID2 = 0; + for (int varID = 0; varID < nvars; varID++) + if (vars1[varID].flag) + { + vlistptr2->vars[varID2].flag = false; + int zaxisID = vlistptr1->vars[varID].zaxisID; + int gridID = vlistptr1->vars[varID].gridID; + int subtypeID = vlistptr1->vars[varID].subtypeID; + + memcpy(&vars2[varID2], &vars1[varID], sizeof(var_t)); + + vars1[varID].fvarID = varID2; + vars2[varID2].fvarID = varID; + + vars2[varID2].mvarID = varID2; + + var_copy_entries(&vars2[varID2], &vars1[varID]); + vlistptr2->vars[varID2].keys.nelems = 0; + cdiCopyKeys(vlistID1, varID, vlistID2, varID2); + + vlistptr2->vars[varID2].atts.nelems = 0; + cdiCopyAtts(vlistID1, varID, vlistID2, varID2); + + int nlevs = zaxisInqSize(vars1[varID].zaxisID); + int nlevs2 = 0; + if (vars1[varID].levinfo) + for (int levID = 0; levID < nlevs; levID++) nlevs2 += vars1[varID].levinfo[levID].flag; + + vars2[varID2].levinfo = (levinfo_t *) Malloc((size_t) nlevs2 * sizeof(levinfo_t)); + + if (nlevs != nlevs2) + { + int nvct = 0; + double *levels = NULL; + double *lbounds = NULL, *ubounds = NULL; + const double *vct = NULL; + + if (!vars1[varID].levinfo) cdiVlistCreateVarLevInfo(vlistptr1, varID); + + zaxisID = vars1[varID].zaxisID; + int zaxisType = zaxisInqType(zaxisID); + + int levID2 = 0; + for (int levID = 0; levID < nlevs; levID++) + if (vars1[varID].levinfo[levID].flag) + { + vars1[varID].levinfo[levID].flevelID = levID2; + vars1[varID].levinfo[levID].mlevelID = levID2; + } + + if (zaxisInqLevels(zaxisID, NULL)) + { + levels = (double *) Malloc((size_t) nlevs2 * sizeof(double)); + + levID2 = 0; + for (int levID = 0; levID < nlevs; ++levID) + if (vars1[varID].levinfo[levID].flag) levels[levID2++] = zaxisInqLevel(zaxisID, levID); + } + + if (zaxisType == ZAXIS_HYBRID) + { + nvct = zaxisInqVctSize(zaxisID); + vct = zaxisInqVctPtr(zaxisID); + } + + size_t clen2 = 0; + char **cvals2 = NULL; +#ifndef USE_MPI + if (zaxisType == ZAXIS_CHAR) + { + char **cvals1 = zaxisInqCValsPtr(zaxisID); + size_t clen1 = (size_t) zaxisInqCLen(zaxisID); + for (int levID = 0; levID < nlevs; ++levID) + if (vars1[varID].levinfo[levID].flag) + { + size_t testlen = clen1; + while (cvals1[levID][testlen] == ' ') testlen--; + if (clen2 < testlen) clen2 = testlen; + } + cvals2 = (char **) Malloc((size_t) nlevs2 * sizeof(char *)); + levID2 = 0; + + for (int levID = 0; levID < nlevs; ++levID) + if (vars1[varID].levinfo[levID].flag) + { + cvals2[levID2] = (char *) Malloc((size_t) (clen2) * sizeof(char)); + memcpy(cvals2[levID2], cvals1[levID], clen2 * sizeof(char)); + levID2++; + } + } +#endif + + if (zaxisInqLbounds(zaxisID, NULL) && zaxisInqUbounds(zaxisID, NULL)) + { + lbounds = (double *) Malloc(2 * (size_t) nlevs2 * sizeof(double)); + ubounds = lbounds + nlevs2; + + double *lbounds1 = (double *) Malloc(2 * (size_t) nlevs * sizeof(double)), *ubounds1 = lbounds1 + nlevs; + + zaxisInqLbounds(zaxisID, lbounds1); + zaxisInqUbounds(zaxisID, ubounds1); + + levID2 = 0; + for (int levID = 0; levID < nlevs; ++levID) + if (vars1[varID].levinfo[levID].flag) + { + lbounds[levID2] = lbounds1[levID]; + ubounds[levID2] = ubounds1[levID]; + levID2++; + } + + Free(lbounds1); + } + + int zaxisID2 = vlist_generate_zaxis(vlistID2, zaxisType, nlevs2, levels, lbounds, ubounds, nvct, vct, + (const char **) cvals2, clen2); + if (levels) Free(levels); + if (lbounds) Free(lbounds); + if (cvals2) + { + for (int levID = 0; levID < nlevs2; ++levID) Free(cvals2[levID]); + Free(cvals2); + } + + char ctemp[CDI_MAX_NAME]; + int length = CDI_MAX_NAME; + cdiInqKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_NAME, ctemp, &length); + cdiDefKeyString(zaxisID2, CDI_GLOBAL, CDI_KEY_NAME, ctemp); + length = CDI_MAX_NAME; + cdiInqKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_LONGNAME, ctemp, &length); + cdiDefKeyString(zaxisID2, CDI_GLOBAL, CDI_KEY_LONGNAME, ctemp); + length = CDI_MAX_NAME; + cdiInqKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_UNITS, ctemp, &length); + cdiDefKeyString(zaxisID2, CDI_GLOBAL, CDI_KEY_UNITS, ctemp); + + zaxisDefDatatype(zaxisID2, zaxisInqDatatype(zaxisID)); + zaxisDefPositive(zaxisID2, zaxisInqPositive(zaxisID)); + + if (zaxisType == ZAXIS_CHAR) + { + char dimname[CDI_MAX_NAME + 3]; + length = sizeof(dimname); + cdiInqKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_DIMNAME, dimname, &length); + if (dimname[0] == 0) + { + memcpy(dimname, "area_type", 10); + dimname[10] = 0; + } + cdiDefKeyString(zaxisID2, CDI_GLOBAL, CDI_KEY_DIMNAME, dimname); + } + + if (zaxisType == ZAXIS_GENERIC) cdiCopyKey(zaxisID, CDI_GLOBAL, CDI_KEY_TYPEOFFIRSTFIXEDSURFACE, zaxisID2); + + cdiCopyAtts(zaxisID, CDI_GLOBAL, zaxisID2, CDI_GLOBAL); + + zaxisID = zaxisID2; + vars2[varID2].zaxisID = zaxisID2; + } + + for (int levID = 0; levID < nlevs2; levID++) + { + vars2[varID2].levinfo[levID].flag = false; + vars2[varID2].levinfo[levID].index = -1; + } + + int levID2 = 0; + for (int levID = 0; levID < nlevs; levID++) + if (vars1[varID].levinfo[levID].flag) + { + vars2[varID2].levinfo[levID2].flevelID = levID; + vars2[varID2].levinfo[levID2].mlevelID = levID2; + levID2++; + } + + vlistAdd2GridIDs(vlistptr2, gridID); + vlistAdd2ZaxisIDs(vlistptr2, zaxisID); + vlistAdd2SubtypeIDs(vlistptr2, subtypeID); + + varID2++; + } + } +} + +/* +@Function vlistCat +@Title Concatenate two variable lists + +@Prototype void vlistCat(int vlistID2, int vlistID1) +@Parameter + @Item vlistID2 Target variable list ID. + @Item vlistID1 Source variable list ID. + +@Description +Concatenate the variable list vlistID1 at the end of vlistID2. + +@EndFunction +*/ +void +vlistCat(int vlistID2, int vlistID1) +{ + vlist_t *vlistptr1 = vlist_to_pointer(vlistID1); + vlist_t *vlistptr2 = vlist_to_pointer(vlistID2); + var_t *vars1 = vlistptr1->vars; + var_t *vars2 = vlistptr2->vars; + int nvars1 = vlistptr1->nvars; + int nvars2 = vlistptr2->nvars; + int nvars = nvars1 + nvars2; + vlistptr2->nvars = nvars; + + if (nvars > vlistptr2->varsAllocated) + { + vlistptr2->varsAllocated = nvars; + vars2 = (var_t *) Realloc(vars2, (size_t) nvars * sizeof(var_t)); + vlistptr2->vars = vars2; + } + memcpy(vars2 + nvars2, vars1, (size_t) nvars1 * sizeof(var_t)); + + for (int varID = 0; varID < nvars1; varID++) + { + int varID2 = varID + nvars2; + vars1[varID].fvarID = varID2; + vars2[varID2].fvarID = varID; + + vars1[varID].mvarID = varID2; + vars2[varID2].mvarID = varID; + + if (vars1[varID].param < 0) + { + int pnum, pcat, pdis; + cdiDecodeParam(vars1[varID].param, &pnum, &pcat, &pdis); + pnum = -(varID2 + 1); + vars2[varID2].param = cdiEncodeParam(pnum, pcat, pdis); + } + + var_copy_entries(&vars2[varID2], &vars1[varID]); + vars2[varID2].keys.nelems = 0; + cdiCopyKeys(vlistID1, varID, vlistID2, varID2); + + if (vars1[varID].levinfo) + { + size_t nlevs = (size_t) zaxisInqSize(vars1[varID].zaxisID); + vars2[varID2].levinfo = (levinfo_t *) Malloc(nlevs * sizeof(levinfo_t)); + memcpy(vars2[varID2].levinfo, vars1[varID].levinfo, nlevs * sizeof(levinfo_t)); + } + + vars2[varID2].atts.nelems = 0; + cdiCopyAtts(vlistID1, varID, vlistID2, varID2); + + vlistAdd2GridIDs(vlistptr2, vars1[varID].gridID); + vlistAdd2ZaxisIDs(vlistptr2, vars1[varID].zaxisID); + vlistAdd2SubtypeIDs(vlistptr2, vars1[varID].subtypeID); + } +} + +/* +@Function vlistMerge +@Title Merge two variable lists + +@Prototype void vlistMerge(int vlistID2, int vlistID1) +@Parameter + @Item vlistID2 Target variable list ID. + @Item vlistID1 Source variable list ID. + +@Description +Merge the variable list vlistID1 to the variable list vlistID2. + +@EndFunction +*/ +void +vlistMerge(int vlistID2, int vlistID1) +{ + int varID = 0; + vlist_t *vlistptr1 = vlist_to_pointer(vlistID1); + vlist_t *vlistptr2 = vlist_to_pointer(vlistID2); + var_t *vars1 = vlistptr1->vars; + var_t *vars2 = vlistptr2->vars; + int nvars1 = vlistptr1->nvars; + int nvars2 = vlistptr2->nvars; + + if (nvars1 == nvars2) + { + char name1[CDI_MAX_NAME], name2[CDI_MAX_NAME]; + for (varID = 0; varID < nvars2; varID++) + { + size_t ngp1 = gridInqSize(vars1[varID].gridID); + size_t ngp2 = gridInqSize(vars2[varID].gridID); + if (ngp1 != ngp2) break; + + int length = CDI_MAX_NAME; + (void) cdiInqKeyString(vlistID1, varID, CDI_KEY_NAME, name1, &length); + length = CDI_MAX_NAME; + (void) cdiInqKeyString(vlistID2, varID, CDI_KEY_NAME, name2, &length); + + if (*name1 && *name2) + { + if (!str_is_equal(name1, name2)) break; + } + else + { + if (vars1[varID].param != vars2[varID].param) break; + } + } + } + + if (varID == nvars2) /* same variables in vlistID1 and vlistID2 */ + { + for (varID = 0; varID < nvars2; varID++) + { + vars1[varID].fvarID = varID; + vars2[varID].fvarID = varID; + + vars1[varID].mvarID = varID; + vars2[varID].mvarID = varID; + + int nlevs1 = zaxisInqSize(vars1[varID].zaxisID); + int nlevs2 = zaxisInqSize(vars2[varID].zaxisID); + + int nlevs = nlevs1 + nlevs2; + + /* + fprintf(stderr, "var %d %d %d %d %d\n", varID, nlevs1, nlevs2, nlevs, sizeof(levinfo_t)); + */ + if (vars1[varID].levinfo) + { + vars2[varID].levinfo = (levinfo_t *) Realloc(vars2[varID].levinfo, (size_t) nlevs * sizeof(levinfo_t)); + + memcpy(vars2[varID].levinfo + nlevs2, vars1[varID].levinfo, (size_t) nlevs1 * sizeof(levinfo_t)); + } + else + cdiVlistCreateVarLevInfo(vlistptr1, varID); + + for (int levID = 0; levID < nlevs1; levID++) vars1[varID].levinfo[levID].mlevelID = nlevs2 + levID; + } + + bool *lvar = (bool *) Calloc((size_t) nvars2, sizeof(bool)); + + for (varID = 0; varID < nvars2; varID++) + { + if (lvar[varID] == true) continue; + + int zaxisID1 = vars1[varID].zaxisID; + int zaxisID2 = vars2[varID].zaxisID; + // nlevs1 = zaxisInqSize(vars1[varID].zaxisID); + // nlevs2 = zaxisInqSize(vars2[varID].zaxisID); + int nlevs1 = zaxisInqSize(zaxisID1); + int nlevs2 = zaxisInqSize(zaxisID2); + // fprintf(stderr, "zaxis %d %d %d %d\n", zaxisID1, zaxisID2, nlevs1, nlevs2); + + int nlevs = nlevs1 + nlevs2; + + int zaxisID = zaxisDuplicate(zaxisID2); + zaxisResize(zaxisID, nlevs); + + if (zaxisInqLevels(zaxisID1, NULL)) + { + double *levels = (double *) Malloc((size_t) nlevs1 * sizeof(double)); + + zaxisInqLevels(zaxisID1, levels); + /* + for (int levID = 0; levID < nlevs1; levID++) + fprintf(stderr, "%d %d %d %d %d %g\n", varID, levID, nlevs1, nlevs2, vars2[varID].nlevs, levels[levID]); + */ + for (int levID = 0; levID < nlevs1; levID++) zaxisDefLevel(zaxisID, nlevs2 + levID, levels[levID]); + + Free(levels); + } + + for (int index = 0; index < vlistptr2->nzaxis; index++) + if (vlistptr2->zaxisIDs[index] == zaxisID2) vlistptr2->zaxisIDs[index] = zaxisID; + + for (int varID2 = 0; varID2 < nvars2; varID2++) + if (lvar[varID2] == false && vars2[varID2].zaxisID == zaxisID2) + { + vars2[varID2].zaxisID = zaxisID; + lvar[varID2] = true; + } + } + + Free(lvar); + } + else + { + vlistCat(vlistID2, vlistID1); + } +} + +/* +@Function vlistNvars +@Title Number of variables in a variable list + +@Prototype int vlistNvars(int vlistID) +@Parameter + @Item vlistID Variable list ID, from a previous call to @fref{vlistCreate} or @fref{streamInqVlist}. + +@Description +The function @func{vlistNvars} returns the number of variables in the variable list vlistID. + +@Result +@func{vlistNvars} returns the number of variables in a variable list. + +@EndFunction +*/ +int +vlistNvars(int vlistID) +{ + vlist_t *vlistptr = vlist_to_pointer(vlistID); + return vlistptr->nvars; +} + +int +vlistNrecs(int vlistID) +{ + vlist_t *vlistptr = vlist_to_pointer(vlistID); + + int nrecs = 0; + for (int varID = 0; varID < vlistptr->nvars; varID++) nrecs += zaxisInqSize(vlistptr->vars[varID].zaxisID); + + return nrecs; +} + +int +vlistNumber(int vlistID) +{ + int number, number2; + vlist_t *vlistptr = vlist_to_pointer(vlistID); + + int datatype = vlistptr->vars[0].datatype; + if (datatype == CDI_DATATYPE_CPX32 || datatype == CDI_DATATYPE_CPX64) + number = CDI_COMP; + else + number = CDI_REAL; + + for (int varID = 1; varID < vlistptr->nvars; varID++) + { + datatype = vlistptr->vars[varID].datatype; + if (datatype == CDI_DATATYPE_CPX32 || datatype == CDI_DATATYPE_CPX64) + number2 = CDI_COMP; + else + number2 = CDI_REAL; + + if (number2 != number) + { + number = CDI_BOTH; + break; + } + } + + return number; +} + +/* +@Function vlistNgrids +@Title Number of grids in a variable list + +@Prototype int vlistNgrids(int vlistID) +@Parameter + @Item vlistID Variable list ID, from a previous call to @fref{vlistCreate} or @fref{streamInqVlist}. + +@Description +The function @func{vlistNgrids} returns the number of grids in the variable list vlistID. + +@Result +@func{vlistNgrids} returns the number of grids in a variable list. + +@EndFunction +*/ +int +vlistNgrids(int vlistID) +{ + vlist_t *vlistptr = vlist_to_pointer(vlistID); + + return vlistptr->ngrids; +} + +/* +@Function vlistNzaxis +@Title Number of zaxis in a variable list + +@Prototype int vlistNzaxis(int vlistID) +@Parameter + @Item vlistID Variable list ID, from a previous call to @fref{vlistCreate} or @fref{streamInqVlist}. + +@Description +The function @func{vlistNzaxis} returns the number of zaxis in the variable list vlistID. + +@Result +@func{vlistNzaxis} returns the number of zaxis in a variable list. + +@EndFunction +*/ +int +vlistNzaxis(int vlistID) +{ + vlist_t *vlistptr = vlist_to_pointer(vlistID); + + return vlistptr->nzaxis; +} + +int +vlistNsubtypes(int vlistID) +{ + vlist_t *vlistptr = vlist_to_pointer(vlistID); + + return vlistptr->nsubtypes; +} + +void +vlistDefNtsteps(int vlistID, int nts) +{ + vlist_t *vlistptr = vlist_to_pointer(vlistID); + + if (vlistptr->ntsteps != nts) + { + vlistptr->ntsteps = nts; + reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE); + } +} + +// This function is used in CDO! +int +vlistNtsteps(int vlistID) +{ + vlist_t *vlistptr = vlist_to_pointer(vlistID); + + return (int) vlistptr->ntsteps; +} + +static void +vlistPrintKernel(vlist_t *vlistptr, FILE *fp) +{ + const int vlistID = vlistptr->self; + fprintf(fp, "#\n# vlistID %d\n#\n", vlistID); + + const int nvars = vlistptr->nvars; + + fprintf(fp, + "nvars : %d\n" + "ngrids : %d\n" + "nzaxis : %d\n" + "nsubtypes: %d\n" + "taxisID : %d\n" + "instID : %d\n" + "modelID : %d\n" + "tableID : %d\n", + nvars, vlistptr->ngrids, vlistptr->nzaxis, vlistptr->nsubtypes, vlistptr->taxisID, vlistptr->instID, vlistptr->modelID, + vlistptr->tableID); + + if (nvars > 0) + { + fprintf(fp, " varID param gridID zaxisID stypeID tsteptype flag name longname units\n"); + for (int varID = 0; varID < nvars; varID++) + { + int param = vlistptr->vars[varID].param; + int gridID = vlistptr->vars[varID].gridID; + int zaxisID = vlistptr->vars[varID].zaxisID; + int subtypeID = vlistptr->vars[varID].subtypeID; + int tsteptype = vlistptr->vars[varID].tsteptype; + char name[CDI_MAX_NAME], longname[CDI_MAX_NAME], units[CDI_MAX_NAME]; + int length = CDI_MAX_NAME; + (void) cdiInqKeyString(vlistID, varID, CDI_KEY_NAME, name, &length); + length = CDI_MAX_NAME; + (void) cdiInqKeyString(vlistID, varID, CDI_KEY_LONGNAME, longname, &length); + length = CDI_MAX_NAME; + (void) cdiInqKeyString(vlistID, varID, CDI_KEY_UNITS, units, &length); + int flag = vlistptr->vars[varID].flag; + + char paramstr[32]; + cdiParamToString(param, paramstr, sizeof(paramstr)); + fprintf(fp, "%6d %-8s %6d %6d %6d %6d %5d %-8s %s [%s]\n", varID, paramstr, gridID, zaxisID, subtypeID, tsteptype, + flag, name, longname, units); + } + + fputs("\n" + " varID levID fvarID flevID mvarID mlevID index dtype flag level\n", + fp); + for (int varID = 0; varID < nvars; varID++) + { + int zaxisID = vlistptr->vars[varID].zaxisID; + int nlevs = zaxisInqSize(zaxisID); + int fvarID = vlistptr->vars[varID].fvarID; + int mvarID = vlistptr->vars[varID].mvarID; + int dtype = vlistptr->vars[varID].datatype; + for (int levID = 0; levID < nlevs; levID++) + { + levinfo_t li; + if (vlistptr->vars[varID].levinfo) + li = vlistptr->vars[varID].levinfo[levID]; + else + li = DEFAULT_LEVINFO(levID); + int flevID = li.flevelID; + int mlevID = li.mlevelID; + int index = li.index; + int flag = li.flag; + + double level = zaxisInqLevels(zaxisID, NULL) ? zaxisInqLevel(zaxisID, levID) : levID + 1; + + fprintf(fp, "%6d %6d %6d %6d %6d %6d %6d %6d %5d %.9g\n", varID, levID, fvarID, flevID, mvarID, mlevID, index, dtype, + flag, level); + } + } + + fputs("\n" + " varID size\n", + fp); + for (int varID = 0; varID < nvars; varID++) + fprintf(fp, "%3d %8zu\n", varID, + (size_t) zaxisInqSize(vlistptr->vars[varID].zaxisID) * gridInqSize(vlistptr->vars[varID].gridID)); + } +} + +void +vlistPrint(int vlistID) +{ + if (vlistID == CDI_UNDEFID) return; + vlist_t *vlistptr = vlist_to_pointer(vlistID); + vlistPrintKernel(vlistptr, stdout); +} + +/* +@Function vlistDefTaxis +@Title Define the time axis + +@Prototype void vlistDefTaxis(int vlistID, int taxisID) +@Parameter + @Item vlistID Variable list ID, from a previous call to @fref{vlistCreate}. + @Item taxisID Time axis ID, from a previous call to @fref{taxisCreate}. + +@Description +The function @func{vlistDefTaxis} defines the time axis of a variable list. + +@EndFunction +*/ +void +vlistDefTaxis(int vlistID, int taxisID) +{ + vlist_t *vlistptr = vlist_to_pointer(vlistID); + + if (vlistptr->taxisID != taxisID) + { + // FIXME: This code seems to leak a taxis_t object if `vlistptr->taxisID` was valid before the call to vlistDefTaxis. + vlistptr->taxisID = taxisID; + reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE); + } +} + +/* +@Function vlistInqTaxis +@Title Get the time axis + +@Prototype int vlistInqTaxis(int vlistID) +@Parameter + @Item vlistID Variable list ID, from a previous call to @fref{vlistCreate} or @fref{streamInqVlist}. + +@Description +The function @func{vlistInqTaxis} returns the time axis of a variable list. + +@Result +@func{vlistInqTaxis} returns an identifier to the time axis. + +@EndFunction +*/ +int +vlistInqTaxis(int vlistID) +{ + vlist_t *vlistptr = vlist_to_pointer(vlistID); + return vlistptr->taxisID; +} + +void +vlistDefTable(int vlistID, int tableID) +{ + vlist_t *vlistptr = vlist_to_pointer(vlistID); + + if (vlistptr->tableID != tableID) + { + vlistptr->tableID = tableID; + reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE); + } +} + +int +vlistInqTable(int vlistID) +{ + vlist_t *vlistptr = vlist_to_pointer(vlistID); + return vlistptr->tableID; +} + +void +vlistDefInstitut(int vlistID, int instID) +{ + vlist_t *vlistptr = vlist_to_pointer(vlistID); + + if (vlistptr->instID != instID) + { + vlistptr->instID = instID; + reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE); + } +} + +int +vlistInqInstitut(int vlistID) +{ + vlist_t *vlistptr = vlist_to_pointer(vlistID); + + int instID = vlistptr->instID; + + if (instID == CDI_UNDEFID) + { + instID = vlistInqVarInstitut(vlistID, 0); + + for (int varID = 1; varID < vlistptr->nvars; varID++) + if (instID != vlistInqVarInstitut(vlistID, varID)) + { + instID = CDI_UNDEFID; + break; + } + vlistDefInstitut(vlistID, instID); + } + + return instID; +} + +void +vlistDefModel(int vlistID, int modelID) +{ + vlist_t *vlistptr = vlist_to_pointer(vlistID); + + if (vlistptr->modelID != modelID) + { + vlistptr->modelID = modelID; + reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE); + } +} + +int +vlistInqModel(int vlistID) +{ + vlist_t *vlistptr = vlist_to_pointer(vlistID); + + int modelID = vlistptr->modelID; + + if (modelID == CDI_UNDEFID) + { + modelID = vlistInqVarModel(vlistID, 0); + + for (int varID = 1; varID < vlistptr->nvars; varID++) + if (modelID != vlistInqVarModel(vlistID, varID)) + { + modelID = CDI_UNDEFID; + break; + } + + vlistDefModel(vlistID, modelID); + } + + return modelID; +} + +SizeType +vlistGridsizeMax(int vlistID) +{ + SizeType gridsizemax = 0; + vlist_t *vlistptr = vlist_to_pointer(vlistID); + + for (int index = 0; index < vlistptr->ngrids; index++) + { + int gridID = vlistptr->gridIDs[index]; + SizeType gridsize = gridInqSize(gridID); + if (gridsize > gridsizemax) gridsizemax = gridsize; + } + + return gridsizemax; +} + +int +vlistGrid(int vlistID, int index) +{ + int gridID = CDI_UNDEFID; + vlist_t *vlistptr = vlist_to_pointer(vlistID); + + if (index < vlistptr->ngrids && index >= 0) gridID = vlistptr->gridIDs[index]; + + return gridID; +} + +int +vlistGridIndex(int vlistID, int gridID) +{ + int index; + vlist_t *vlistptr = vlist_to_pointer(vlistID); + + for (index = 0; index < vlistptr->ngrids; index++) + if (gridID == vlistptr->gridIDs[index]) break; + + if (index == vlistptr->ngrids) index = -1; + + return index; +} + +void +vlistChangeGridIndex(int vlistID, int index, int gridID) +{ + vlist_t *vlistptr = vlist_to_pointer(vlistID); + + int gridIDold = vlistptr->gridIDs[index]; + if (gridIDold != gridID) + { + vlistptr->gridIDs[index] = gridID; + + int nvars = vlistptr->nvars; + for (int varID = 0; varID < nvars; varID++) + if (vlistptr->vars[varID].gridID == gridIDold) vlistptr->vars[varID].gridID = gridID; + reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE); + } +} + +void +vlistChangeGrid(int vlistID, int gridID1, int gridID2) +{ + vlist_t *vlistptr = vlist_to_pointer(vlistID); + + if (gridID1 != gridID2) + { + int ngrids = vlistptr->ngrids; + for (int index = 0; index < ngrids; index++) + { + if (vlistptr->gridIDs[index] == gridID1) + { + vlistptr->gridIDs[index] = gridID2; + break; + } + } + int nvars = vlistptr->nvars; + for (int varID = 0; varID < nvars; varID++) + if (vlistptr->vars[varID].gridID == gridID1) vlistptr->vars[varID].gridID = gridID2; + reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE); + } +} + +int +vlistZaxis(int vlistID, int index) +{ + int zaxisID = CDI_UNDEFID; + vlist_t *vlistptr = vlist_to_pointer(vlistID); + + if (index < vlistptr->nzaxis && index >= 0) zaxisID = vlistptr->zaxisIDs[index]; + + return zaxisID; +} + +int +vlistZaxisIndex(int vlistID, int zaxisID) +{ + vlist_t *vlistptr = vlist_to_pointer(vlistID); + + int index; + for (index = 0; index < vlistptr->nzaxis; index++) + if (zaxisID == vlistptr->zaxisIDs[index]) break; + + if (index == vlistptr->nzaxis) index = -1; + + return index; +} + +void +vlistChangeZaxisIndex(int vlistID, int index, int zaxisID) +{ + vlist_t *vlistptr = vlist_to_pointer(vlistID); + + int zaxisIDold = vlistptr->zaxisIDs[index]; + if (zaxisIDold != zaxisID) + { + vlistptr->zaxisIDs[index] = zaxisID; + + int nlevs = zaxisInqSize(zaxisID), nlevsOld = zaxisInqSize(zaxisIDold); + int nvars = vlistptr->nvars; + for (int varID = 0; varID < nvars; varID++) + if (vlistptr->vars[varID].zaxisID == zaxisIDold) + { + vlistptr->vars[varID].zaxisID = zaxisID; + if (vlistptr->vars[varID].levinfo && nlevs != nlevsOld) + { + vlistptr->vars[varID].levinfo + = (levinfo_t *) Realloc(vlistptr->vars[varID].levinfo, (size_t) nlevs * sizeof(levinfo_t)); + + for (int levID = 0; levID < nlevs; levID++) vlistptr->vars[varID].levinfo[levID] = DEFAULT_LEVINFO(levID); + } + } + reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE); + } +} + +void +vlistChangeZaxis(int vlistID, int zaxisID1, int zaxisID2) +{ + int nlevs1 = zaxisInqSize(zaxisID1), nlevs2 = zaxisInqSize(zaxisID2); + vlist_t *vlistptr = vlist_to_pointer(vlistID); + + int nzaxis = vlistptr->nzaxis; + for (int index = 0; index < nzaxis; index++) + { + if (vlistptr->zaxisIDs[index] == zaxisID1) + { + vlistptr->zaxisIDs[index] = zaxisID2; + break; + } + } + + int nvars = vlistptr->nvars; + for (int varID = 0; varID < nvars; varID++) + if (vlistptr->vars[varID].zaxisID == zaxisID1) + { + vlistptr->vars[varID].zaxisID = zaxisID2; + + if (vlistptr->vars[varID].levinfo && nlevs2 != nlevs1) + { + vlistptr->vars[varID].levinfo + = (levinfo_t *) Realloc(vlistptr->vars[varID].levinfo, (size_t) nlevs2 * sizeof(levinfo_t)); + + for (int levID = 0; levID < nlevs2; levID++) vlistptr->vars[varID].levinfo[levID] = DEFAULT_LEVINFO(levID); + } + } + reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE); +} + +int +vlistSubtype(int vlistID, int index) +{ + int subtypeID = CDI_UNDEFID; + vlist_t *vlistptr = vlist_to_pointer(vlistID); + + if (index < vlistptr->nsubtypes && index >= 0) subtypeID = vlistptr->subtypeIDs[index]; + + return subtypeID; +} + +int +vlistSubtypeIndex(int vlistID, int subtypeID) +{ + vlist_t *vlistptr = vlist_to_pointer(vlistID); + + int index; + for (index = vlistptr->nsubtypes; index--;) + if (subtypeID == vlistptr->subtypeIDs[index]) break; + + return index; +} + +int +vlistHasTime(int vlistID) +{ + bool hastime = false; + vlist_t *vlistptr = vlist_to_pointer(vlistID); + + if (!(CDI_Reduce_Dim && vlistptr->ntsteps == 1)) + { + size_t nvars = vlistptr->nvars > 0 ? (size_t) vlistptr->nvars : (size_t) 0; + var_t *restrict vars = vlistptr->vars; + for (size_t varID = 0; varID < nvars; varID++) + if (vars[varID].timetype != TIME_CONSTANT) + { + hastime = true; + break; + } + } + + return (int) hastime; +} + +enum +{ + VLIST_PACK_INT_SELF, + VLIST_PACK_INT_NVARS, + VLIST_PACK_INT_TAXISID, + VLIST_PACK_INT_TABLEID, + VLIST_PACK_INT_INSTID, + VLIST_PACK_INT_MODELID, + vlistNints, +}; + +static int +vlistTxCode(void *vlistptr) +{ + (void) vlistptr; + return VLIST; +} + +static int +vlistGetSizeP(void *vlistptr, void *context) +{ + vlist_t *p = (vlist_t *) vlistptr; + int txsize = serializeGetSize(vlistNints, CDI_DATATYPE_INT, context); + txsize += serializeGetSize(1, CDI_DATATYPE_LONG, context); + txsize += cdiAttsGetSize(p, CDI_GLOBAL, context); + for (int varID = 0; varID < p->nvars; varID++) txsize += vlistVarGetPackSize(p, varID, context); + return txsize; +} + +static void +vlistPackP(void *vlistptr, void *buf, int size, int *position, void *context) +{ + int tempbuf[vlistNints]; + vlist_t *p = (vlist_t *) vlistptr; + tempbuf[VLIST_PACK_INT_SELF] = p->self; + tempbuf[VLIST_PACK_INT_NVARS] = p->nvars; + tempbuf[VLIST_PACK_INT_TAXISID] = p->taxisID; + tempbuf[VLIST_PACK_INT_TABLEID] = p->tableID; + tempbuf[VLIST_PACK_INT_INSTID] = p->instID; + tempbuf[VLIST_PACK_INT_MODELID] = p->modelID; + serializePack(tempbuf, vlistNints, CDI_DATATYPE_INT, buf, size, position, context); + serializePack(&p->ntsteps, 1, CDI_DATATYPE_LONG, buf, size, position, context); + + cdiAttsPack(p, CDI_GLOBAL, buf, size, position, context); + for (int varID = 0; varID < p->nvars; varID++) + { + vlistVarPack(p, varID, (char *) buf, size, position, context); + } +} + +int +vlistUnpack(char *buf, int size, int *position, int originNamespace, void *context, int force_id) +{ +#define adaptKey(key) (namespaceAdaptKey((key), originNamespace)) + int tempbuf[vlistNints]; + serializeUnpack(buf, size, position, tempbuf, vlistNints, CDI_DATATYPE_INT, context); + int nvars = tempbuf[VLIST_PACK_INT_NVARS]; + int targetID = force_id ? adaptKey(tempbuf[VLIST_PACK_INT_SELF]) : CDI_UNDEFID; + vlist_t *p = vlist_new_entry(targetID); + xassert(!force_id || p->self == targetID); + if (!force_id) targetID = p->self; + cdiVlistMakeInternal(p->self); + p->taxisID = adaptKey(tempbuf[VLIST_PACK_INT_TAXISID]); + p->tableID = tempbuf[VLIST_PACK_INT_TABLEID]; + p->instID = adaptKey(tempbuf[VLIST_PACK_INT_INSTID]); + p->modelID = adaptKey(tempbuf[VLIST_PACK_INT_MODELID]); + serializeUnpack(buf, size, position, &p->ntsteps, 1, CDI_DATATYPE_LONG, context); + cdiAttsUnpack(targetID, CDI_GLOBAL, buf, size, position, context); + for (int varID = 0; varID < nvars; varID++) vlistVarUnpack(targetID, buf, size, position, originNamespace, context); + reshSetStatus(targetID, &vlistOps, reshGetStatus(targetID, &vlistOps) & ~RESH_SYNC_BIT); +#undef adaptKey + return targetID; +} + +void +vlist_check_contents(int vlistID) +{ + int nzaxis = vlistNzaxis(vlistID); + for (int index = 0; index < nzaxis; index++) + { + int zaxisID = vlistZaxis(vlistID, index); + if (zaxisInqType(zaxisID) == ZAXIS_GENERIC) cdiCheckZaxis(zaxisID); + } +} + +/* Resizes and initializes opt_grib_kvpair data structure. */ +void +resize_opt_grib_entries(var_t *var, int nentries) +{ + if (var->opt_grib_kvpair_size >= nentries) + { + return; /* nothing to do; array is still large enough */ + } + else + { + if (CDI_Debug) Message("resize data structure, %d -> %d", var->opt_grib_kvpair_size, nentries); + + int new_size = (2 * var->opt_grib_kvpair_size) > nentries ? (2 * var->opt_grib_kvpair_size) : nentries; + opt_key_val_pair_t *tmp = (opt_key_val_pair_t *) Malloc((size_t) new_size * sizeof(opt_key_val_pair_t)); + for (int i = 0; i < var->opt_grib_kvpair_size; ++i) + { + tmp[i] = var->opt_grib_kvpair[i]; + } + for (int i = var->opt_grib_kvpair_size; i < new_size; ++i) + { + tmp[i].int_val = 0; + tmp[i].dbl_val = 0; + tmp[i].update = false; + tmp[i].keyword = NULL; + } // for + var->opt_grib_kvpair_size = new_size; + Free(var->opt_grib_kvpair); + var->opt_grib_kvpair = tmp; + } +} + +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ + +static cdi_keys_t * +vlist_get_keysp(vlist_t *vlistptr, int varID) +{ + if (varID == CDI_GLOBAL) return &vlistptr->keys; + if (varID >= 0 && varID < vlistptr->nvars) return &(vlistptr->vars[varID].keys); + + return NULL; +} + +static cdi_keys_t * +grid_get_keysp(grid_t *gridptr, int varID) +{ + if (varID == CDI_GLOBAL) return &gridptr->keys; + if (varID == CDI_XAXIS) return &gridptr->x.keys; + if (varID == CDI_YAXIS) return &gridptr->y.keys; + + return NULL; +} + +static cdi_keys_t * +zaxis_get_keysp(zaxis_t *zaxisptr, int varID) +{ + return (varID == CDI_GLOBAL) ? &zaxisptr->keys : NULL; +} + +static cdi_key_t * +new_key(cdi_keys_t *keysp, int key) +{ + xassert(keysp != NULL); + + if (keysp->nelems == keysp->nalloc) return NULL; + + cdi_key_t *keyp = &(keysp->value[keysp->nelems]); + keysp->nelems++; + + keyp->key = key; + keyp->type = 0; + keyp->length = 0; + keyp->v.s = NULL; + + return keyp; +} + +cdi_key_t * +find_key(cdi_keys_t *keysp, int key) +{ + xassert(keysp != NULL); + + if (keysp->nelems == 0) return NULL; + + for (size_t keyid = 0; keyid < keysp->nelems; keyid++) + { + cdi_key_t *keyp = &(keysp->value[keyid]); + if (keyp->key == key) return keyp; // Normal return + } + + return NULL; +} + +static const cdi_key_t * +find_key_const(const cdi_keys_t *keysp, int key) +{ + xassert(keysp != NULL); + + if (keysp->nelems == 0) return NULL; + + for (size_t keyid = 0; keyid < keysp->nelems; keyid++) + { + const cdi_key_t *keyp = &(keysp->value[keyid]); + if (keyp->key == key) return keyp; // Normal return + } + + return NULL; +} + +static cdi_keys_t * +cdi_get_keysp(int objID, int varID) +{ + if (reshGetTxCode(objID) == GRID) return grid_get_keysp(grid_to_pointer(objID), varID); + if (reshGetTxCode(objID) == DIST_GRID) return grid_get_keysp(grid_to_pointer(objID), varID); + if (reshGetTxCode(objID) == ZAXIS) return zaxis_get_keysp(zaxis_to_pointer(objID), varID); + if (reshGetTxCode(objID) == VLIST) return vlist_get_keysp(vlist_to_pointer(objID), varID); + + return NULL; +} + +int +cdi_key_compare(cdi_keys_t *keyspa, cdi_keys_t *keyspb, int keynum) +{ + xassert(keynum >= 0 && keynum < (int) keyspa->nelems && keynum < (int) keyspb->nelems); + cdi_key_t *keypa = keyspa->value + keynum, *keypb = keyspb->value + keynum; + + if (keypa->key != keypb->key) return 1; + if (keypa->type != keypb->type) return 1; + if (keypa->length != keypb->length) return 1; + + if (keypa->type == KEY_BYTES) return (memcmp(keypa->v.s, keypb->v.s, keypa->length) != 0); + if (keypa->type == KEY_FLOAT) return (IS_NOT_EQUAL(keypa->v.d, keypb->v.d)); + if (keypa->type == KEY_INT) return (keypa->v.i != keypb->v.i); + + return 0; +} + +static void +cdi_delete_key(cdi_key_t *keyp) +{ + if (keyp != NULL && keyp->length) // key in use + { + keyp->length = 0; + if (keyp->type == KEY_BYTES) + { + if (keyp->v.s) free(keyp->v.s); + keyp->v.s = NULL; + } + else if (keyp->type == KEY_FLOAT) + { + keyp->v.d = 0.0; + } + else if (keyp->type == KEY_INT) + { + keyp->v.i = 0; + } + } +} + +void +cdiDeleteVarKeys(cdi_keys_t *keysp) +{ + int nelems = keysp ? (int) keysp->nelems : 0; + for (int keyid = 0; keyid < nelems; keyid++) + { + cdi_delete_key(&(keysp->value[keyid])); + } + + keysp->nelems = 0; +} + +void +cdiDeleteKeys(int cdiID, int varID) +{ + cdi_keys_t *keysp = cdi_get_keysp(cdiID, varID); + xassert(keysp != NULL); + + cdiDeleteVarKeys(keysp); +} + +void +cdiPrintVarKeys(cdi_keys_t *keysp) +{ + int nelems = keysp ? (int) keysp->nelems : 0; + for (int keyid = 0; keyid < nelems; keyid++) + { + cdi_key_t *keyp = &(keysp->value[keyid]); + if (keyp->length == 0) continue; + if (keyp->type == KEY_BYTES) + { + fprintf(stdout, "%d key %d length %d value %s\n", keyid + 1, keyp->key, keyp->length, keyp->v.s); + } + else if (keyp->type == KEY_FLOAT) + { + fprintf(stdout, "%d key %d value %g\n", keyid + 1, keyp->key, keyp->v.d); + } + else if (keyp->type == KEY_INT) + { + fprintf(stdout, "%d key %d value %d\n", keyid + 1, keyp->key, keyp->v.i); + } + } +} + +void +cdiPrintKeys(int cdiID, int varID) +{ + cdi_keys_t *keysp = cdi_get_keysp(cdiID, varID); + xassert(keysp != NULL); + + cdiPrintVarKeys(keysp); +} + +// cdiInqKeyLen: Get the length of the string representation of the key +int +cdiInqKeyLen(int cdiID, int varID, int key, int *length) +{ + int status = -1; + + const cdi_keys_t *keysp = cdi_get_keysp(cdiID, varID); + xassert(keysp != NULL); + + const cdi_key_t *keyp = find_key_const(keysp, key); + if (keyp != NULL && keyp->length > 0) + { + *length = keyp->length; + status = CDI_NOERR; + } + + return status; +} + +static void +cdi_define_key(const cdi_key_t *keyp, cdi_keys_t *keysp) +{ + // clang-format off + if (keyp->type == KEY_INT) cdiDefVarKeyInt(keysp, keyp->key, keyp->v.i); + else if (keyp->type == KEY_FLOAT) cdiDefVarKeyFloat(keysp, keyp->key, keyp->v.d); + else if (keyp->type == KEY_BYTES) cdiDefVarKeyBytes(keysp, keyp->key, keyp->v.s, keyp->length); + // clang-format on +} + +int +cdiDeleteKey(int cdiID, int varID, int key) +{ + int status = CDI_NOERR; + + cdi_keys_t *keysp = cdi_get_keysp(cdiID, varID); + xassert(keysp != NULL); + + cdi_delete_key(find_key(keysp, key)); + + return status; +} + +void +cdiCopyVarKeys(const cdi_keys_t *keysp1, cdi_keys_t *keysp2) +{ + for (size_t keyid = 0; keyid < keysp1->nelems; keyid++) + { + const cdi_key_t *keyp = &(keysp1->value[keyid]); + if (keyp->length > 0) cdi_define_key(keyp, keysp2); + } +} + +int +cdiCopyKeys(int cdiID1, int varID1, int cdiID2, int varID2) +{ + int status = CDI_NOERR; + + cdi_keys_t *keysp1 = cdi_get_keysp(cdiID1, varID1); + xassert(keysp1 != NULL); + + cdi_keys_t *keysp2 = cdi_get_keysp(cdiID2, varID2); + xassert(keysp2 != NULL); + + cdiCopyVarKeys(keysp1, keysp2); + + return status; +} + +int +cdiCopyVarKey(const cdi_keys_t *keysp1, int key, cdi_keys_t *keysp2) +{ + int status = CDI_NOERR; + + const cdi_key_t *keyp = find_key_const(keysp1, key); + if (keyp == NULL) return -1; + + if (keyp->length > 0) cdi_define_key(keyp, keysp2); + + return status; +} + +int +cdiCopyKey(int cdiID1, int varID1, int key, int cdiID2) +{ + cdi_keys_t *keysp1 = cdi_get_keysp(cdiID1, varID1); + xassert(keysp1 != NULL); + + cdi_keys_t *keysp2 = cdi_get_keysp(cdiID2, varID1); + xassert(keysp2 != NULL); + + return cdiCopyVarKey(keysp1, key, keysp2); +} + +void +cdiDefVarKeyInt(cdi_keys_t *keysp, int key, int value) +{ + cdi_key_t *keyp = find_key(keysp, key); + if (keyp == NULL) keyp = new_key(keysp, key); + + if (keyp != NULL) + { + // if ( keyp->v.i != value ) + { + keyp->type = KEY_INT; + keyp->v.i = value; + keyp->length = 1; + } + } +} + +/* +@Function cdiDefKeyInt +@Title Define an integer value from a key + +@Prototype int cdiDefKeyInt(int cdiID, int varID, int key, int value) +@Parameter + @Item cdiID CDI object ID (vlistID, gridID, zaxisID). + @Item varID Variable identifier or CDI_GLOBAL. + @Item key The key to be searched. + @Item value An integer where the data will be read. + +@Description +The function @func{cdiDefKeyInt} defines an integer value from a key. + +@Result +@func{cdiDefKeyInt} returns CDI_NOERR if OK. + +@EndFunction +*/ +int +cdiDefKeyInt(int cdiID, int varID, int key, int value) +{ + int status = CDI_NOERR; + + cdi_keys_t *keysp = cdi_get_keysp(cdiID, varID); + xassert(keysp != NULL); + + cdiDefVarKeyInt(keysp, key, value); + + return status; +} + +/* +@Function cdiInqKeyInt +@Title Get an integer value from a key + +@Prototype int cdiInqKeyInt(int cdiID, int varID, int key, int *value) +@Parameter + @Item cdiID CDI object ID (vlistID, gridID, zaxisID). + @Item varID Variable identifier or CDI_GLOBAL. + @Item key The key to be searched.. + @Item value The address of an integer where the data will be retrieved. + +@Description +The function @func{cdiInqKeyInt} gets an integer value from a key. + +@Result +@func{cdiInqKeyInt} returns CDI_NOERR if key is available. + +@EndFunction +*/ +int +cdiInqKeyInt(int cdiID, int varID, int key, int *value) +{ + int status = -1; + + // if (varID != CDI_GLOBAL) status = cdiInqKeyInt(cdiID, CDI_GLOBAL, key, value); + + const cdi_keys_t *keysp = cdi_get_keysp(cdiID, varID); + xassert(keysp != NULL); + + const cdi_key_t *keyp = find_key_const(keysp, key); + if (keyp != NULL && keyp->length == 1) // key in use + { + if (keyp->type == KEY_INT) + { + *value = keyp->v.i; + status = CDI_NOERR; + } + } + + return status; +} + +int +cdiInqVarKeyInt(const cdi_keys_t *keysp, int key) +{ + int value = 0; + + const cdi_key_t *keyp = find_key_const(keysp, key); + if (keyp && keyp->type == KEY_INT) value = keyp->v.i; + + return value; +} + +void +cdiDefVarKeyFloat(cdi_keys_t *keysp, int key, double value) +{ + cdi_key_t *keyp = find_key(keysp, key); + if (keyp == NULL) keyp = new_key(keysp, key); + + if (keyp != NULL) + { + keyp->type = KEY_FLOAT; + keyp->v.d = value; + keyp->length = 1; + } +} + +/* +@Function cdiDefKeyFloat +@Title Define a floating point value from a key + +@Prototype int cdiDefKeyFloat(int cdiID, int varID, int key, double value) +@Parameter + @Item cdiID CDI object ID (vlistID, gridID, zaxisID). + @Item varID Variable identifier or CDI_GLOBAL. + @Item key The key to be searched + @Item value A double where the data will be read + +@Description +The function @func{cdiDefKeyFloat} defines a CDI floating point value from a key. + +@Result +@func{cdiDefKeyFloat} returns CDI_NOERR if OK. + +@EndFunction +*/ +int +cdiDefKeyFloat(int cdiID, int varID, int key, double value) +{ + int status = CDI_NOERR; + + cdi_keys_t *keysp = cdi_get_keysp(cdiID, varID); + xassert(keysp != NULL); + + cdiDefVarKeyFloat(keysp, key, value); + + return status; +} + +/* +@Function cdiInqKeyFloat +@Title Get a floating point value from a key + +@Prototype int cdiInqKeyFloat(int cdiID, int varID, int key, double *value) +@Parameter + @Item cdiID CDI object ID (vlistID, gridID, zaxisID). + @Item varID Variable identifier or CDI_GLOBAL. + @Item key The key to be searched. + @Item value The address of a double where the data will be retrieved. + +@Description +The function @func{cdiInqKeyFloat} gets a floating point value from a key. + +@Result +@func{cdiInqKeyFloat} returns CDI_NOERR if key is available. + +@EndFunction +*/ +int +cdiInqKeyFloat(int cdiID, int varID, int key, double *value) +{ + int status = -1; + + // if (varID != CDI_GLOBAL) status = cdiInqKeyFloat(cdiID, CDI_GLOBAL, key, value); + + const cdi_keys_t *keysp = cdi_get_keysp(cdiID, varID); + xassert(keysp != NULL); + + const cdi_key_t *keyp = find_key_const(keysp, key); + if (keyp != NULL && keyp->length == 1) // key in use + { + if (keyp->type == KEY_FLOAT) + { + *value = keyp->v.d; + status = CDI_NOERR; + } + } + + return status; +} + +void +cdiDefVarKeyBytes(cdi_keys_t *keysp, int key, const unsigned char *bytes, int length) +{ + cdi_key_t *keyp = find_key(keysp, key); + if (keyp == NULL) keyp = new_key(keysp, key); + + if (keyp != NULL) + { + if (keyp->length != 0 && keyp->length != length) + { + if (keyp->v.s) free(keyp->v.s); + keyp->length = 0; + } + if (keyp->length == 0) + { + keyp->v.s = (unsigned char *) malloc((size_t) length); + keyp->length = length; + } + + memcpy(keyp->v.s, bytes, length); + keyp->type = KEY_BYTES; + } +} + +/* +@Function cdiDefKeyBytes +@Title Define a byte array from a key + +@Prototype int cdiDefKeyBytes(int cdiID, int varID, int key, const unsigned char *bytes, int length) +@Parameter + @Item cdiID CDI object ID (vlistID, gridID, zaxisID). + @Item varID Variable identifier or CDI_GLOBAL. + @Item key The key to be searched. + @Item bytes The address of a byte array where the data will be read. + @Item length Length of the byte array + +@Description +The function @func{cdiDefKeyBytes} defines a byte array from a key. + +@Result +@func{cdiDefKeyBytes} returns CDI_NOERR if OK. + +@EndFunction +*/ +int +cdiDefKeyBytes(int cdiID, int varID, int key, const unsigned char *bytes, int length) +{ + int status = CDI_NOERR; + + cdi_keys_t *keysp = cdi_get_keysp(cdiID, varID); + xassert(keysp != NULL); + + cdiDefVarKeyBytes(keysp, key, bytes, length); + + return status; +} + +int +cdiInqVarKeyBytes(const cdi_keys_t *keysp, int key, unsigned char *bytes, int *length) +{ + int status = -1; + + const cdi_key_t *keyp = find_key_const(keysp, key); + if (keyp != NULL && keyp->length > 0) // key in use + { + if (keyp->type == KEY_BYTES) + { + if (keyp->length < *length) *length = keyp->length; + memcpy(bytes, keyp->v.s, *length); + status = CDI_NOERR; + } + } + + return status; +} + +// cdiInqKeyBytes: Get a byte array from a key +/* +@Function cdiInqKeyBytes +@Title Get a byte array from a key + +@Prototype int cdiInqKeyBytes(int cdiID, int varID, int key, unsigned char *bytes, int *length) +@Parameter + @Item cdiID CDI object ID (vlistID, gridID, zaxisID). + @Item varID Variable identifier or CDI_GLOBAL. + @Item key The key to be searched. + @Item bytes The address of a byte array where the data will be retrieved. + The caller must allocate space for the returned byte array. + @Item length The allocated length of the byte array on input. +@Description +The function @func{cdiInqKeyBytes} gets a byte array from a key. + +@Result +@func{cdiInqKeyBytes} returns CDI_NOERR if key is available. + +@EndFunction +*/ +int +cdiInqKeyBytes(int cdiID, int varID, int key, unsigned char *bytes, int *length) +{ + xassert(bytes != NULL); + xassert(length != NULL); + + // if (varID != CDI_GLOBAL) status = cdiInqKeyBytes(cdiID, CDI_GLOBAL, key, bytes, length); + + const cdi_keys_t *keysp = cdi_get_keysp(cdiID, varID); + xassert(keysp != NULL); + + return cdiInqVarKeyBytes(keysp, key, bytes, length); +} + +/* +@Function cdiDefKeyString +@Title Define a string from a key + +@Prototype int cdiDefKeyString(int cdiID, int varID, int key, const char *string) +@Parameter + @Item cdiID CDI object ID (vlistID, gridID, zaxisID). + @Item varID Variable identifier or CDI_GLOBAL. + @Item key The key to be searched. + @Item string The address of a string where the data will be read. + +@Description +The function @func{cdiDefKeyString} defines a text string from a key. + +@Result +@func{cdiDefKeyString} returns CDI_NOERR if OK. + +@Example +Here is an example using @func{cdiDefKeyString} to define the name of a variable: + +@Source + ... +int vlistID, varID, status; + ... +vlistID = vlistCreate(); +varID = vlistDefVar(vlistID, gridID, zaxisID, TIME_VARYING); + ... +status = cdiDefKeyString(vlistID, varID, CDI_KEY_NAME, "temperature"); + ... +@EndSource +@EndFunction +*/ +int +cdiDefKeyString(int cdiID, int varID, int key, const char *string) +{ + xassert(string != NULL); + + int length = strlen(string) + 1; + int status = cdiDefKeyBytes(cdiID, varID, key, (const unsigned char *) string, length); + + return status; +} + +/* +@Function cdiInqKeyString +@Title Get a string from a key + +@Prototype int cdiInqKeyString(int cdiID, int varID, int key, char *string, int *length) +@Parameter + @Item cdiID CDI object ID (vlistID, gridID, zaxisID). + @Item varID Variable identifier or CDI_GLOBAL. + @Item key The key to be searched. + @Item string The address of a string where the data will be retrieved. + The caller must allocate space for the returned string. + @Item length The allocated length of the string on input. +@Description +The function @func{cdiInqKeyString} gets a text string from a key. + +@Result +@func{cdiInqKeyString} returns CDI_NOERR if key is available. + +@Example +Here is an example using @func{cdiInqKeyString} to get the name of the first variable: + +@Source + ... +#define STRLEN 256 + ... +int streamID, vlistID, varID, status; +int length = STRLEN; +char name[STRLEN]; + ... +streamID = streamOpenRead(...); +vlistID = streamInqVlist(streamID); + ... +varID = 0; +status = cdiInqKeyString(vlistID, varID, CDI_KEY_NAME, name, &length); + ... +@EndSource +@EndFunction +*/ +int +cdiInqKeyString(int cdiID, int varID, int key, char *string, int *length) +{ + xassert(string != NULL); + xassert(length != NULL); + + int maxlength = *length; + if (maxlength > 0) string[0] = '\0'; + + int status = cdiInqKeyBytes(cdiID, varID, key, (unsigned char *) string, length); + if (CDI_NOERR == status) + string[maxlength - 1] = '\0'; + else + *length = 0; + + return status; +} + +const char * +cdiInqVarKeyStringPtr(const cdi_keys_t *keysp, int key) +{ + const cdi_key_t *keyp = find_key_const(keysp, key); + if (keyp != NULL) // key in use + { + if (keyp->type == KEY_BYTES) return (const char *) keyp->v.s; + } + + return NULL; +} + +void +cdiInitKeys(cdi_keys_t *keysp) +{ + keysp->nalloc = MAX_KEYS; + keysp->nelems = 0; + for (int i = 0; i < MAX_KEYS; ++i) keysp->value[i].length = 0; +} + +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#include <assert.h> +#include <limits.h> +#include <stdio.h> +#include <string.h> + + + +static cdi_atts_t * +get_attsp(vlist_t *vlistptr, int varID) +{ + if (varID == CDI_GLOBAL) + return &vlistptr->atts; + else if (varID >= 0 && varID < vlistptr->nvars) + return &(vlistptr->vars[varID].atts); + + return NULL; +} + +static cdi_att_t * +find_att(cdi_atts_t *attsp, const char *name) +{ + xassert(attsp != NULL); + + if (attsp->nelems == 0) return NULL; + + size_t slen = strlen(name); + if (slen > CDI_MAX_NAME) slen = CDI_MAX_NAME; + + cdi_att_t *atts = attsp->value; + for (size_t attid = 0; attid < attsp->nelems; attid++) + { + cdi_att_t *attp = atts + attid; + if (attp->namesz == slen && memcmp(attp->name, name, slen) == 0) return attp; // Normal return + } + + return NULL; +} + +static cdi_att_t * +new_att(cdi_atts_t *attsp, const char *name) +{ + xassert(attsp != NULL); + xassert(name != NULL); + + if (attsp->nelems == attsp->nalloc) return NULL; + + cdi_att_t *attp = &(attsp->value[attsp->nelems]); + attsp->nelems++; + + size_t slen = strlen(name); + if (slen > CDI_MAX_NAME) slen = CDI_MAX_NAME; + + attp->name = (char *) Malloc(slen + 1); + memcpy(attp->name, name, slen + 1); + attp->namesz = slen; + attp->xvalue = NULL; + + return attp; +} + +static void +fill_att(cdi_att_t *attp, int indtype, int exdtype, size_t nelems, size_t xsz, const void *xvalue) +{ + xassert(attp != NULL); + + attp->xsz = xsz; + attp->indtype = indtype; + attp->exdtype = exdtype; + attp->nelems = nelems; + + if (xsz > 0) + { + attp->xvalue = Realloc(attp->xvalue, xsz); + memcpy(attp->xvalue, xvalue, xsz); + } +} + +static cdi_atts_t * +cdi_get_attsp(int objID, int varID) +{ + cdi_atts_t *attsp = NULL; + + if (varID == CDI_GLOBAL && reshGetTxCode(objID) == GRID) + { + grid_t *gridptr = grid_to_pointer(objID); + attsp = &gridptr->atts; + } + else if (varID == CDI_GLOBAL && reshGetTxCode(objID) == ZAXIS) + { + zaxis_t *zaxisptr = zaxis_to_pointer(objID); + attsp = &zaxisptr->atts; + } + else + { + vlist_t *vlistptr = vlist_to_pointer(objID); + attsp = get_attsp(vlistptr, varID); + } + + return attsp; +} + +/* +@Function cdiInqNatts +@Title Get number of attributes + +@Prototype int cdiInqNatts(int cdiID, int varID, int *nattsp) +@Parameter + @Item cdiID CDI ID, from a previous call to @fref{vlistCreate}, @fref{gridCreate} or @fref{streamInqVlist}. + @Item varID Variable identifier, or @func{CDI_GLOBAL} for a global attribute. + @Item nattsp Pointer to location for returned number of attributes. + +@Description +The function @func{cdiInqNatts} gets the number of attributes assigned to this variable. + +@EndFunction +*/ +int +cdiInqNatts(int cdiID, int varID, int *nattsp) +{ + int status = CDI_NOERR; + + cdi_atts_t *attsp = cdi_get_attsp(cdiID, varID); + xassert(attsp != NULL); + + *nattsp = (int) attsp->nelems; + + return status; +} + +/* +@Function cdiInqAtt +@Title Get information about an attribute + +@Prototype int cdiInqAtt(int cdiID, int varID, int attnum, char *name, int *typep, int *lenp) +@Parameter + @Item cdiID CDI ID, from a previous call to @fref{vlistCreate}, @fref{gridCreate} or @fref{streamInqVlist}. + @Item varID Variable identifier, or @func{CDI_GLOBAL} for a global attribute. + @Item attnum Attribute number (from 0 to natts-1). + @Item name Pointer to the location for the returned attribute name. The caller must allocate space for the + returned string. The maximum possible length, in characters, of + the string is given by the predefined constant @func{CDI_MAX_NAME}. + @Item typep Pointer to location for returned attribute type. + @Item lenp Pointer to location for returned attribute number. + +@Description +The function @func{cdiInqAtt} gets information about an attribute. + +@EndFunction +*/ +int +cdiInqAtt(int cdiID, int varID, int attnum, char *name, int *typep, int *lenp) +{ + int status = CDI_NOERR; + + xassert(name != NULL); + + cdi_atts_t *attsp = cdi_get_attsp(cdiID, varID); + xassert(attsp != NULL); + + cdi_att_t *attp = NULL; + if (attnum >= 0 && attnum < (int) attsp->nelems) attp = &(attsp->value[attnum]); + + if (attp != NULL && attp->name) // name in use + { + memcpy(name, attp->name, attp->namesz + 1); + *typep = attp->exdtype; + *lenp = (int) attp->nelems; + } + else + { + name[0] = 0; + *typep = -1; + *lenp = 0; + status = -1; + } + + return status; +} + +int +cdiInqAttLen(int cdiID, int varID, const char *name) +{ + int length = -1; + + xassert(name != NULL); + + cdi_atts_t *attsp = cdi_get_attsp(cdiID, varID); + xassert(attsp != NULL); + + for (int attid = 0; attid < (int) attsp->nelems; attid++) + { + cdi_att_t *attp = &(attsp->value[attid]); + if (attp->name && str_is_equal(attp->name, name)) length = (int) attp->nelems; + } + + return length; +} + +int +cdiInqAttType(int cdiID, int varID, const char *name) +{ + int type = -1; + + xassert(name != NULL); + + cdi_atts_t *attsp = cdi_get_attsp(cdiID, varID); + xassert(attsp != NULL); + + for (int attid = 0; attid < (int) attsp->nelems; attid++) + { + cdi_att_t *attp = &(attsp->value[attid]); + if (attp->name && str_is_equal(attp->name, name)) type = attp->exdtype; + } + + return type; +} + +static void +cdi_attribute_free(cdi_att_t *attp) +{ + if (attp->name) + { + Free(attp->name); + attp->name = NULL; + attp->namesz = 0; + } + if (attp->xvalue) + { + Free(attp->xvalue); + attp->xvalue = NULL; + } +} + +int +cdiDeleteAtts(int cdiID, int varID) +{ + int status = CDI_NOERR; + + cdi_atts_t *attsp = cdi_get_attsp(cdiID, varID); + xassert(attsp != NULL); + + for (int attid = 0; attid < (int) attsp->nelems; attid++) + { + cdi_att_t *attp = &(attsp->value[attid]); + cdi_attribute_free(attp); + } + + attsp->nelems = 0; + + return status; +} + +int +cdiDelAtt(int cdiID, int varID, const char *name) +{ + int status = -1; + + cdi_atts_t *attsp = cdi_get_attsp(cdiID, varID); + xassert(attsp != NULL); + + for (int attid = 0; attid < (int) attsp->nelems; attid++) + { + cdi_att_t *attp = &(attsp->value[attid]); + if (attp->name && str_is_equal(attp->name, name)) + { + cdi_attribute_free(attp); + status = CDI_NOERR; + break; + } + } + + return status; +} + +static int +cdi_def_att(int indtype, int exdtype, int cdiID, int varID, const char *name, size_t len, size_t xsz, const void *xp) +{ + int status = CDI_NOERR; + + if (len != 0 && xp == NULL) return CDI_EINVAL; // Null arg + + cdi_atts_t *attsp = cdi_get_attsp(cdiID, varID); + xassert(attsp != NULL); + + cdi_att_t *attp = find_att(attsp, name); + if (attp == NULL) attp = new_att(attsp, name); + + if (attp != NULL) fill_att(attp, indtype, exdtype, len, xsz, xp); + + return status; +} + +static int +cdi_inq_att(int indtype, int cdiID, int varID, const char *name, size_t mxsz, void *xp) +{ + int status = CDI_NOERR; + + if (mxsz != 0 && xp == NULL) return CDI_EINVAL; // Null arg + + cdi_atts_t *attsp = cdi_get_attsp(cdiID, varID); + xassert(attsp != NULL); + + cdi_att_t *attp = find_att(attsp, name); + if (attp != NULL) // name in use + { + if (attp->indtype == indtype) + { + size_t xsz = attp->xsz; + if (mxsz < xsz) xsz = mxsz; + if (xsz > 0) memcpy(xp, attp->xvalue, xsz); + } + else + { + Warning("Attribute %s has wrong data type!", name); + status = -2; + } + } + else + { + // Warning("Internal problem, attribute %s not found!", name); + status = -1; + } + + return status; +} + +int +cdiCopyAtts(int cdiID1, int varID1, int cdiID2, int varID2) +{ + int status = CDI_NOERR; + + cdi_atts_t *attsp1 = cdi_get_attsp(cdiID1, varID1); + xassert(attsp1 != NULL); + + for (size_t attid = 0; attid < attsp1->nelems; attid++) + { + cdi_att_t *attp = &(attsp1->value[attid]); + cdi_def_att(attp->indtype, attp->exdtype, cdiID2, varID2, attp->name, attp->nelems, attp->xsz, attp->xvalue); + } + + return status; +} + +/* +@Function cdiDefAttInt +@Title Define an integer attribute + +@Prototype int cdiDefAttInt(int cdiID, int varID, const char *name, int type, int len, const int *ip) + +@Parameter + @Item cdiID CDI ID, from a previous call to @fref{vlistCreate}, @fref{gridCreate} or @fref{zaxisCreate}. + @Item varID Variable identifier, or @func{CDI_GLOBAL} for a global attribute. + @Item name Attribute name. + @Item type External data type (@func{CDI_DATATYPE_INT16} or @func{CDI_DATATYPE_INT32}). + @Item len Number of values provided for the attribute. + @Item ip Pointer to one or more integer values. + +@Description +The function @func{cdiDefAttInt} defines an integer attribute. + +@EndFunction +*/ +int +cdiDefAttInt(int cdiID, int varID, const char *name, int type, int len, const int *ip) +{ + return cdi_def_att(CDI_DATATYPE_INT, type, cdiID, varID, name, (size_t) len, (size_t) len * sizeof(int), ip); +} + +/* +@Function cdiDefAttFlt +@Title Define a floating point attribute + +@Prototype int cdiDefAttFlt(int cdiID, int varID, const char *name, int type, int len, const double *dp) + +@Parameter + @Item cdiID CDI ID, from a previous call to @fref{vlistCreate}, @fref{gridCreate} or @fref{zaxisCreate}. + @Item varID Variable identifier, or @func{CDI_GLOBAL} for a global attribute. + @Item name Attribute name. + @Item type External data type (@func{CDI_DATATYPE_FLT32} or @func{CDI_DATATYPE_FLT64}). + @Item len Number of values provided for the attribute. + @Item dp Pointer to one or more floating point values. + +@Description +The function @func{cdiDefAttFlt} defines a floating point attribute. + +@EndFunction +*/ +int +cdiDefAttFlt(int cdiID, int varID, const char *name, int type, int len, const double *dp) +{ + return cdi_def_att(CDI_DATATYPE_FLT, type, cdiID, varID, name, (size_t) len, (size_t) len * sizeof(double), dp); +} + +/* +@Function cdiDefAttTxt +@Title Define a text attribute + +@Prototype int cdiDefAttTxt(int cdiID, int varID, const char *name, int len, const char *tp) + +@Parameter + @Item cdiID CDI ID, from a previous call to @fref{vlistCreate}, @fref{gridCreate} or @fref{zaxisCreate}. + @Item varID Variable identifier, or @func{CDI_GLOBAL} for a global attribute. + @Item name Attribute name. + @Item len Number of values provided for the attribute. + @Item tp Pointer to one or more character values. + +@Description +The function @func{cdiDefAttTxt} defines a text attribute. + +@Example +Here is an example using @func{cdiDefAttTxt} to define the attribute "description": + +@Source + ... +int vlistID, varID, status; +char text[] = "description of the variable"; + ... +vlistID = vlistCreate(); +varID = vlistDefVar(vlistID, gridID, zaxisID, TIME_VARYING); + ... +status = cdiDefAttTxt(vlistID, varID, "description", LEN(text), text); + ... +@EndSource +@EndFunction +*/ +int +cdiDefAttTxt(int cdiID, int varID, const char *name, int len, const char *tp) +{ + return cdi_def_att(CDI_DATATYPE_TXT, CDI_DATATYPE_TXT, cdiID, varID, name, (size_t) len, (size_t) len, tp); +} + +/* +@Function cdiInqAttInt +@Title Get the value(s) of an integer attribute + +@Prototype int cdiInqAttInt(int cdiID, int varID, const char *name, int mlen, int *ip) +@Parameter + @Item cdiID CDI ID, from a previous call to @fref{vlistCreate}, @fref{gridCreate} or @fref{zaxisCreate}. + @Item varID Variable identifier, or @func{CDI_GLOBAL} for a global attribute. + @Item name Attribute name. + @Item mlen Number of allocated values provided for the attribute. + @Item ip Pointer location for returned integer attribute value(s). + +@Description +The function @func{cdiInqAttInt} gets the values(s) of an integer attribute. + +@EndFunction +*/ +int +cdiInqAttInt(int cdiID, int varID, const char *name, int mlen, int *ip) +{ + return cdi_inq_att(CDI_DATATYPE_INT, cdiID, varID, name, (size_t) mlen * sizeof(int), ip); +} + +/* +@Function cdiInqAttFlt +@Title Get the value(s) of a floating point attribute + +@Prototype int cdiInqAttFlt(int cdiID, int varID, const char *name, int mlen, double *dp) +@Parameter + @Item cdiID CDI ID, from a previous call to @fref{vlistCreate}, @fref{gridCreate} or @fref{zaxisCreate}. + @Item varID Variable identifier, or @func{CDI_GLOBAL} for a global attribute. + @Item name Attribute name. + @Item mlen Number of allocated values provided for the attribute. + @Item dp Pointer location for returned floating point attribute value(s). + +@Description +The function @func{cdiInqAttFlt} gets the values(s) of a floating point attribute. + +@EndFunction +*/ +int +cdiInqAttFlt(int cdiID, int varID, const char *name, int mlen, double *dp) +{ + return cdi_inq_att(CDI_DATATYPE_FLT, cdiID, varID, name, (size_t) mlen * sizeof(double), dp); +} + +/* +@Function cdiInqAttTxt +@Title Get the value(s) of a text attribute + +@Prototype int cdiInqAttTxt(int cdiID, int varID, const char *name, int mlen, char *tp) +@Parameter + @Item cdiID CDI ID, from a previous call to @fref{vlistCreate}, @fref{gridCreate} or @fref{zaxisCreate}. + @Item varID Variable identifier, or @func{CDI_GLOBAL} for a global attribute. + @Item name Attribute name. + @Item mlen Number of allocated values provided for the attribute. + @Item tp Pointer location for returned text attribute value(s). + +@Description +The function @func{cdiInqAttTxt} gets the values(s) of a text attribute. + +@EndFunction +*/ +int +cdiInqAttTxt(int cdiID, int varID, const char *name, int mlen, char *tp) +{ + return cdi_inq_att(CDI_DATATYPE_TXT, cdiID, varID, name, (size_t) mlen * sizeof(char), tp); +} + +enum +{ + cdi_att_nints = 4, /* namesz, exdtype, indtype, nelems */ +}; + +static inline int +cdiAttTypeLookup(cdi_att_t *attp) +{ + int type; + switch (attp->indtype) + { + case CDI_DATATYPE_FLT: type = CDI_DATATYPE_FLT64; break; + case CDI_DATATYPE_INT: + case CDI_DATATYPE_TXT: type = attp->indtype; break; + default: xabort("Unknown datatype encountered in attribute %s: %d\n", attp->name, attp->indtype); + } + return type; +} + +int +cdi_att_compare(cdi_atts_t *attspa, cdi_atts_t *attspb, int attnum) +{ + xassert(attnum >= 0 && attnum < (int) attspa->nelems && attnum < (int) attspb->nelems); + cdi_att_t *attpa = attspa->value + attnum, *attpb = attspb->value + attnum; + + if (attpa->namesz != attpb->namesz) return 1; + + if (attpa->name && attpb->name && memcmp(attpa->name, attpb->name, attpa->namesz)) return 1; + + if (attpa->indtype != attpb->indtype || attpa->exdtype != attpb->exdtype || attpa->nelems != attpb->nelems) return 1; + + return memcmp(attpa->xvalue, attpb->xvalue, attpa->xsz); +} + +static int +cdiAttGetSize(cdi_atts_t *attsp, int attnum, void *context) +{ + xassert(attnum >= 0 && attnum < (int) attsp->nelems); + cdi_att_t *attp = &(attsp->value[attnum]); + int txsize = serializeGetSize(cdi_att_nints, CDI_DATATYPE_INT, context) + + serializeGetSize((int) attp->namesz, CDI_DATATYPE_TXT, context); + txsize += serializeGetSize((int) attp->nelems, cdiAttTypeLookup(attp), context); + return txsize; +} + +int +cdiAttsGetSize(void *vp, int varID, void *context) +{ + cdi_atts_t *attsp; + xassert(attsp = get_attsp((vlist_t *) vp, varID)); + int txsize = serializeGetSize(1, CDI_DATATYPE_INT, context); + size_t numAtts = attsp->nelems; + for (size_t i = 0; i < numAtts; ++i) txsize += cdiAttGetSize(attsp, (int) i, context); + return txsize; +} + +static void +cdiAttPack(cdi_atts_t *attsp, int attnum, void *buf, int size, int *position, void *context) +{ + int tempbuf[cdi_att_nints]; + + xassert(attnum >= 0 && attnum < (int) attsp->nelems); + cdi_att_t *attp = &(attsp->value[attnum]); + tempbuf[0] = (int) attp->namesz; + tempbuf[1] = attp->exdtype; + tempbuf[2] = attp->indtype; + tempbuf[3] = (int) attp->nelems; + serializePack(tempbuf, cdi_att_nints, CDI_DATATYPE_INT, buf, size, position, context); + serializePack(attp->name, (int) attp->namesz, CDI_DATATYPE_TXT, buf, size, position, context); + serializePack(attp->xvalue, (int) attp->nelems, cdiAttTypeLookup(attp), buf, size, position, context); +} + +void +cdiAttsPack(void *vp, int varID, void *buf, int size, int *position, void *context) +{ + cdi_atts_t *attsp; + xassert(attsp = get_attsp((vlist_t *) vp, varID)); + size_t numAtts = attsp->nelems; + int numAttsI = (int) numAtts; + xassert(numAtts <= INT_MAX); + serializePack(&numAttsI, 1, CDI_DATATYPE_INT, buf, size, position, context); + for (size_t i = 0; i < numAtts; ++i) cdiAttPack(attsp, (int) i, buf, size, position, context); +} + +static void +cdiAttUnpack(int cdiID, int varID, void *buf, int size, int *position, void *context) +{ + int tempbuf[cdi_att_nints]; + + serializeUnpack(buf, size, position, tempbuf, cdi_att_nints, CDI_DATATYPE_INT, context); + char *attName = (char *) Malloc((size_t) tempbuf[0] + 1); + serializeUnpack(buf, size, position, attName, tempbuf[0], CDI_DATATYPE_TXT, context); + attName[tempbuf[0]] = '\0'; + int attVDt; + size_t elemSize; + switch (tempbuf[2]) + { + case CDI_DATATYPE_FLT: + attVDt = CDI_DATATYPE_FLT64; + elemSize = sizeof(double); + break; + case CDI_DATATYPE_INT: + attVDt = CDI_DATATYPE_INT; + elemSize = sizeof(int); + break; + case CDI_DATATYPE_TXT: + attVDt = CDI_DATATYPE_TXT; + elemSize = 1; + break; + default: xabort("Unknown datatype encountered in attribute %s: %d\n", attName, tempbuf[2]); + } + void *attData = Malloc(elemSize * (size_t) tempbuf[3]); + serializeUnpack(buf, size, position, attData, tempbuf[3], attVDt, context); + cdi_def_att(tempbuf[2], tempbuf[1], cdiID, varID, attName, (size_t) tempbuf[3], (size_t) tempbuf[3] * elemSize, attData); + Free(attName); + Free(attData); +} + +void +cdiAttsUnpack(int cdiID, int varID, void *buf, int size, int *position, void *context) +{ + int numAtts; + serializeUnpack(buf, size, position, &numAtts, 1, CDI_DATATYPE_INT, context); + for (int i = 0; i < numAtts; ++i) cdiAttUnpack(cdiID, varID, buf, size, position, context); +} + +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#include <float.h> /* FLT_MAX */ + +static void +vlistvar_init_entry(var_t *vlistvars, int varID) +{ + var_t *varptr = &vlistvars[varID]; + varptr->flag = false; + varptr->lvalidrange = false; + varptr->xyz = 5; // xyzStorVals[5] == 321 + varptr->missvalused = false; + varptr->mvarID = varID; + varptr->fvarID = varID; + varptr->param = 0; + varptr->gridID = CDI_UNDEFID; + varptr->zaxisID = CDI_UNDEFID; + varptr->timetype = CDI_UNDEFID; + varptr->tsteptype = TSTEP_INSTANT; + varptr->datatype = CDI_UNDEFID; + varptr->instID = CDI_UNDEFID; + varptr->modelID = CDI_UNDEFID; + varptr->tableID = CDI_UNDEFID; + varptr->timave = 0; + varptr->nsb = 0; + varptr->missval = CDI_Default_Missval; + varptr->validrange[0] = VALIDMISS; + varptr->validrange[1] = VALIDMISS; + varptr->levinfo = NULL; + varptr->comptype = CDI_COMPRESS_NONE; + varptr->complevel = 1; + varptr->keys.nalloc = MAX_KEYS; + varptr->keys.nelems = 0; + for (int i = 0; i < MAX_KEYS; ++i) varptr->keys.value[i].length = 0; + varptr->atts.nalloc = MAX_ATTRIBUTES; + varptr->atts.nelems = 0; + varptr->subtypeID = CDI_UNDEFID; + varptr->opt_grib_nentries = 0; + varptr->opt_grib_kvpair_size = 0; + varptr->opt_grib_kvpair = NULL; +} + +static int +vlistvarNewEntry(int vlistID) +{ + int varID = 0; + vlist_t *vlistptr = vlist_to_pointer(vlistID); + int vlistvarSize = vlistptr->varsAllocated; + var_t *vlistvars = vlistptr->vars; + // Look for a free slot in vlistvar. (Create the table the first time through). + if (!vlistvarSize) + { + vlistvarSize = 2; + vlistvars = (var_t *) Malloc((size_t) vlistvarSize * sizeof(var_t)); + for (int i = 0; i < vlistvarSize; ++i) vlistvars[i].isUsed = false; + } + else + { + while (varID < vlistvarSize && vlistvars[varID].isUsed) ++varID; + } + // If the table overflows, double its size. + if (varID == vlistvarSize) + { + vlistvars = (var_t *) Realloc(vlistvars, (size_t) (vlistvarSize *= 2) * sizeof(var_t)); + for (int i = varID; i < vlistvarSize; ++i) vlistvars[i].isUsed = false; + } + + vlistptr->varsAllocated = vlistvarSize; + vlistptr->vars = vlistvars; + + vlistvar_init_entry(vlistvars, varID); + vlistvars[varID].isUsed = true; + + return varID; +} + +static var_t * +vlistptr_get_varptr(const char *caller, vlist_t *vlistptr, int varID) +{ + if (varID < 0 || varID >= vlistptr->nvars || !vlistptr->vars[varID].isUsed) Errorc("varID %d undefined!", varID); + return &vlistptr->vars[varID]; +} + +int +vlistDefVarTiles(int vlistID, int gridID, int zaxisID, int timetype, int tilesetID) +{ + if (CDI_Debug) Message("gridID = %d zaxisID = %d timetype = %d", gridID, zaxisID, timetype); + + int varID = vlistvarNewEntry(vlistID); + + vlist_t *vlistptr = vlist_to_pointer(vlistID); + vlistptr->nvars++; + var_t *varptr = &vlistptr->vars[varID]; + varptr->gridID = gridID; + varptr->zaxisID = zaxisID; + varptr->timetype = timetype; + varptr->subtypeID = tilesetID; + + if (timetype < 0) + { + Warning("Unexpected time type %d, set to TIME_VARYING!", timetype); + varptr->timetype = TIME_VARYING; + } + + // Compatibility for release 1.8.3 + if (timetype > 1 && timetype < 15) + { + varptr->timetype = TIME_VARYING; + varptr->tsteptype = timetype; + static bool printInfo = true; + if (printInfo) + { + printInfo = false; + fprintf(stdout, "CDI info: The vlistDefVar() function was called with an invalid value for the timetype parameter.\n"); + fprintf(stdout, "CDI info: This may be an obsolete form of using the vlistDefVar() function.\n"); + fprintf(stdout, "CDI info: The correct form is:\n"); + fprintf(stdout, "CDI info: varID = vlistDefVar(vlistID, gridID, zaxisID, timetype)\n"); + fprintf(stdout, "CDI info: vlistDefVarTsteptype(vlistID, varID, tsteptype)\n"); + fprintf(stdout, "CDI info: with: timetype = TIME_CONSTANT | TIME_VARYING\n"); + fprintf(stdout, "CDI info: tsteptype = TSTEP_AVG .... TSTEP_SUM\n"); + } + } + + vlistAdd2GridIDs(vlistptr, gridID); + vlistAdd2ZaxisIDs(vlistptr, zaxisID); + vlistAdd2SubtypeIDs(vlistptr, tilesetID); + + varptr->param = cdiEncodeParam(-(varID + 1), 255, 255); + reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE); + + return varID; +} + +/* +@Function vlistDefVar +@Title Define a Variable + +@Prototype int vlistDefVar(int vlistID, int gridID, int zaxisID, int timetype) +@Parameter + @Item vlistID Variable list ID, from a previous call to @fref{vlistCreate}. + @Item gridID Grid ID, from a previous call to @fref{gridCreate}. + @Item zaxisID Z-axis ID, from a previous call to @fref{zaxisCreate}. + @Item timetype One of the set of predefined CDI timestep types. + The valid CDI timestep types are @func{TIME_CONSTANT} and @func{TIME_VARYING}. + +@Description +The function @func{vlistDefVar} adds a new variable to vlistID. + +@Result +@func{vlistDefVar} returns an identifier to the new variable. + +@Example +Here is an example using @func{vlistCreate} to create a variable list +and add a variable with @func{vlistDefVar}. + +@Source + ... +int vlistID, varID; + ... +vlistID = vlistCreate(); +varID = vlistDefVar(vlistID, gridID, zaxisID, TIME_VARYING); + ... +streamDefVlist(streamID, vlistID); + ... +vlistDestroy(vlistID); + ... +@EndSource +@EndFunction +*/ +int +vlistDefVar(int vlistID, int gridID, int zaxisID, int timetype) +{ + // call "vlistDefVarTiles" with a trivial tile index: + return vlistDefVarTiles(vlistID, gridID, zaxisID, timetype, CDI_UNDEFID); +} + +void +cdiVlistCreateVarLevInfo(vlist_t *vlistptr, int varID) +{ + var_t *varptr = vlistptr_get_varptr(__func__, vlistptr, varID); + xassert(varID >= 0 && varID < vlistptr->nvars && varptr->levinfo == NULL); + + int zaxisID = varptr->zaxisID; + size_t nlevs = (size_t) zaxisInqSize(zaxisID); + + varptr->levinfo = (levinfo_t *) Malloc(nlevs * sizeof(levinfo_t)); + + for (size_t levID = 0; levID < nlevs; ++levID) varptr->levinfo[levID] = DEFAULT_LEVINFO((int) levID); +} + +/* +@Function vlistDefVarParam +@Title Define the parameter number of a Variable + +@Prototype void vlistDefVarParam(int vlistID, int varID, int param) +@Parameter + @Item vlistID Variable list ID, from a previous call to @fref{vlistCreate}. + @Item varID Variable identifier. + @Item param Parameter number. + +@Description +The function @func{vlistDefVarParam} defines the parameter number of a variable. + +@EndFunction +*/ +void +vlistDefVarParam(int vlistID, int varID, int param) +{ + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + + if (varptr->param != param) + { + varptr->param = param; + reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE); + } +} + +/* +@Function vlistDefVarCode +@Title Define the code number of a Variable + +@Prototype void vlistDefVarCode(int vlistID, int varID, int code) +@Parameter + @Item vlistID Variable list ID, from a previous call to @fref{vlistCreate}. + @Item varID Variable identifier. + @Item code Code number. + +@Description +The function @func{vlistDefVarCode} defines the code number of a variable. + +@EndFunction +*/ +void +vlistDefVarCode(int vlistID, int varID, int code) +{ + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + + int pnum, pcat, pdis; + cdiDecodeParam(varptr->param, &pnum, &pcat, &pdis); + int newParam = cdiEncodeParam(code, pcat, pdis); + if (varptr->param != newParam) + { + varptr->param = newParam; + reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE); + } +} + +void +vlistInqVar(int vlistID, int varID, int *gridID, int *zaxisID, int *timetype) +{ + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + + *gridID = varptr->gridID; + *zaxisID = varptr->zaxisID; + *timetype = varptr->timetype; +} + +/* +@Function vlistInqVarGrid +@Title Get the Grid ID of a Variable + +@Prototype int vlistInqVarGrid(int vlistID, int varID) +@Parameter + @Item vlistID Variable list ID, from a previous call to @fref{vlistCreate} or @fref{streamInqVlist}. + @Item varID Variable identifier. + +@Description +The function @func{vlistInqVarGrid} returns the grid ID of a Variable. + +@Result +@func{vlistInqVarGrid} returns the grid ID of the Variable. + +@EndFunction +*/ +int +vlistInqVarGrid(int vlistID, int varID) +{ + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + return varptr->gridID; +} + +/* +@Function vlistInqVarZaxis +@Title Get the Zaxis ID of a Variable + +@Prototype int vlistInqVarZaxis(int vlistID, int varID) +@Parameter + @Item vlistID Variable list ID, from a previous call to @fref{vlistCreate} or @fref{streamInqVlist}. + @Item varID Variable identifier. + +@Description +The function @func{vlistInqVarZaxis} returns the zaxis ID of a variable. + +@Result +@func{vlistInqVarZaxis} returns the zaxis ID of the variable. + +@EndFunction +*/ +int +vlistInqVarZaxis(int vlistID, int varID) +{ + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + return varptr->zaxisID; +} + +/* +@Function vlistInqVarSubtype +@Title Get the Subtype ID of a Variable + +@Description +The function @func{vlistInqVarSubtype} returns the subtype ID of a variable. + +@Result +@func{vlistInqVarSubtype} returns the subtype ID of the variable. + +@EndFunction +*/ +int +vlistInqVarSubtype(int vlistID, int varID) +{ + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + return varptr->subtypeID; +} + +/* +@Function vlistInqVarParam +@Title Get the parameter number of a Variable + +@Prototype int vlistInqVarParam(int vlistID, int varID) +@Parameter + @Item vlistID Variable list ID, from a previous call to @fref{vlistCreate} or @fref{streamInqVlist}. + @Item varID Variable identifier. + +@Description +The function @func{vlistInqVarParam} returns the parameter number of a variable. + +@Result +@func{vlistInqVarParam} returns the parameter number of the variable. + +@EndFunction +*/ +int +vlistInqVarParam(int vlistID, int varID) +{ + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + return varptr->param; +} + +/* +@Function vlistInqVarCode +@Title Get the Code number of a Variable + +@Prototype int vlistInqVarCode(int vlistID, int varID) +@Parameter + @Item vlistID Variable list ID, from a previous call to @fref{vlistCreate} or @fref{streamInqVlist}. + @Item varID Variable identifier. + +@Description +The function @func{vlistInqVarCode} returns the code number of a variable. + +@Result +@func{vlistInqVarCode} returns the code number of the variable. + +@EndFunction +*/ +int +vlistInqVarCode(int vlistID, int varID) +{ + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + + int pdis, pcat, pnum; + cdiDecodeParam(varptr->param, &pnum, &pcat, &pdis); + int code = pnum; + if (pdis != 255) code = -varID - 1; // GRIB2 Parameter + + int tableID = varptr->tableID; + if (code < 0 && tableID != -1) + { + char name[CDI_MAX_NAME]; + int length = CDI_MAX_NAME; + (void) cdiInqKeyString(vlistID, varID, CDI_KEY_NAME, name, &length); + + if (name[0]) tableInqParCode(tableID, name, &code); + } + + return code; +} + +/* +@Function vlistInqVarName +@Title Get the name of a Variable + +@Prototype void vlistInqVarName(int vlistID, int varID, char *name) +@Parameter + @Item vlistID Variable list ID, from a previous call to @fref{vlistCreate} or @fref{streamInqVlist}. + @Item varID Variable identifier. + @Item name Returned variable name. The caller must allocate space for the + returned string. The maximum possible length, in characters, of + the string is given by the predefined constant @func{CDI_MAX_NAME}. + +@Description +The function @func{vlistInqVarName} returns the name of a variable. + +@Result +@func{vlistInqVarName} returns the name of the variable to the parameter name if available, +otherwise the result is an empty string. + +@EndFunction +*/ +void +vlistInqVarName(int vlistID, int varID, char *name) +{ + int length = CDI_MAX_NAME; + if (CDI_NOERR != cdiInqKeyString(vlistID, varID, CDI_KEY_NAME, name, &length)) + { + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + + int pdis, pcat, pnum; + cdiDecodeParam(varptr->param, &pnum, &pcat, &pdis); + if (pdis == 255) + { + int code = pnum; + int tableID = varptr->tableID; + tableInqEntry(tableID, code, -1, name, NULL, NULL); + if (!name[0]) sprintf(name, "var%d", code); + } + else + { + sprintf(name, "param%d.%d.%d", pnum, pcat, pdis); + } + } +} + +/* +@Function vlistCopyVarName +@Tatle Get the name of a Variable in a safe way + +@Prototype char* vlistCopyVarName(int vlistId, int varId) +@Parameter + @Item vlistID Variable list ID, from a previous call to @fref{vlistCreate} or @fref{streamInqVlist}. + @Item varID Variable identifier. + +@Return A pointer to a malloc'ed string. Must be cleaned up with Free(). + +@Description +This is the buffer overflow immune version of vlistInqVarName(). +The memory for the returned string is allocated to fit the string via Malloc(). + +@EndFunction +*/ +char * +vlistCopyVarName(int vlistID, int varID) +{ + // If a name is set in the variable description, use that. + char name[CDI_MAX_NAME]; + int length = CDI_MAX_NAME; + (void) cdiInqKeyString(vlistID, varID, CDI_KEY_NAME, name, &length); + if (name[0]) return strdup(name); + + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + + // Otherwise we check if we should use the table of parameter descriptions. + int discipline, category, number; + cdiDecodeParam(varptr->param, &number, &category, &discipline); + char *result = NULL; + if (discipline == 255) + { + tableInqEntry(varptr->tableID, number, -1, name, NULL, NULL); + if (name[0]) + result = strdup(name); + else + { + // No luck, fall back to outputting a name of the format "var<num>". + result = (char *) Malloc(3 + 3 * sizeof(int) * CHAR_BIT / 8 + 2); + sprintf(result, "var%d", number); + } + } + else + { + result = (char *) Malloc(5 + 2 + 3 * (3 * sizeof(int) * CHAR_BIT + 1) + 1); + sprintf(result, "param%d.%d.%d", number, category, discipline); + } + // Finally, we fall back to outputting a name of the format "param<num>.<cat>.<dis>". + return result; +} + +/* +@Function vlistInqVarLongname +@Title Get the longname of a Variable + +@Prototype void vlistInqVarLongname(int vlistID, int varID, char *longname) +@Parameter + @Item vlistID Variable list ID, from a previous call to @fref{vlistCreate} or @fref{streamInqVlist}. + @Item varID Variable identifier. + @Item longname Long name of the variable. The caller must allocate space for the + returned string. The maximum possible length, in characters, of + the string is given by the predefined constant @func{CDI_MAX_NAME}. + +@Description +The function @func{vlistInqVarLongname} returns the longname of a variable if available, +otherwise the result is an empty string. + +@Result +@func{vlistInqVarLongname} returns the longname of the variable to the parameter longname. + +@EndFunction +*/ +void +vlistInqVarLongname(int vlistID, int varID, char *longname) +{ + int length = CDI_MAX_NAME; + if (CDI_NOERR != cdiInqKeyString(vlistID, varID, CDI_KEY_LONGNAME, longname, &length)) + { + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + + int pdis, pcat, pnum; + cdiDecodeParam(varptr->param, &pnum, &pcat, &pdis); + if (pdis == 255) tableInqEntry(varptr->tableID, pnum, -1, NULL, longname, NULL); + } +} + +/* +@Function vlistInqVarStdname +@Title Get the standard name of a Variable + +@Prototype void vlistInqVarStdname(int vlistID, int varID, char *stdname) +@Parameter + @Item vlistID Variable list ID, from a previous call to @fref{vlistCreate} or @fref{streamInqVlist}. + @Item varID Variable identifier. + @Item stdname Standard name of the variable. The caller must allocate space for the + returned string. The maximum possible length, in characters, of + the string is given by the predefined constant @func{CDI_MAX_NAME}. + +@Description +The function @func{vlistInqVarStdname} returns the standard name of a variable if available, +otherwise the result is an empty string. + +@Result +@func{vlistInqVarStdname} returns the standard name of the variable to the parameter stdname. + +@EndFunction +*/ +void +vlistInqVarStdname(int vlistID, int varID, char *stdname) +{ + int length = CDI_MAX_NAME; + (void) cdiInqKeyString(vlistID, varID, CDI_KEY_STDNAME, stdname, &length); +} + +// obsolete function +int +vlistInqVarTypeOfGeneratingProcess(int vlistID, int varID) +{ + static bool printInfo = true; + if (printInfo) printInfo = cdiObsoleteInfo(__func__, "cdiInqKeyInt"); + int typeOfGeneratingProcess = 0; + cdiInqKeyInt(vlistID, varID, CDI_KEY_TYPEOFGENERATINGPROCESS, &typeOfGeneratingProcess); + return typeOfGeneratingProcess; +} + +// obsolete function +void +vlistDefVarTypeOfGeneratingProcess(int vlistID, int varID, int typeOfGeneratingProcess) +{ + static bool printInfo = true; + if (printInfo) printInfo = cdiObsoleteInfo(__func__, "cdiDefKeyInt"); + cdiDefKeyInt(vlistID, varID, CDI_KEY_TYPEOFGENERATINGPROCESS, typeOfGeneratingProcess); +} + +// obsolete function +void +vlistDefVarProductDefinitionTemplate(int vlistID, int varID, int productDefinitionTemplate) +{ + static bool printInfo = true; + if (printInfo) printInfo = cdiObsoleteInfo(__func__, "cdiDefKeyInt"); + cdiDefKeyInt(vlistID, varID, CDI_KEY_PRODUCTDEFINITIONTEMPLATE, productDefinitionTemplate); +} + +/* +@Function vlistInqVarUnits +@Title Get the units of a Variable + +@Prototype void vlistInqVarUnits(int vlistID, int varID, char *units) +@Parameter + @Item vlistID Variable list ID, from a previous call to @fref{vlistCreate} or @fref{streamInqVlist}. + @Item varID Variable identifier. + @Item units Units of the variable. The caller must allocate space for the + returned string. The maximum possible length, in characters, of + the string is given by the predefined constant @func{CDI_MAX_NAME}. + +@Description +The function @func{vlistInqVarUnits} returns the units of a variable if available, +otherwise the result is an empty string. + +@Result +@func{vlistInqVarUnits} returns the units of the variable to the parameter units. + +@EndFunction +*/ +void +vlistInqVarUnits(int vlistID, int varID, char *units) +{ + int length = CDI_MAX_NAME; + if (CDI_NOERR != cdiInqKeyString(vlistID, varID, CDI_KEY_UNITS, units, &length)) + { + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + + int pdis, pcat, pnum; + cdiDecodeParam(varptr->param, &pnum, &pcat, &pdis); + if (pdis == 255) tableInqEntry(varptr->tableID, pnum, -1, NULL, NULL, units); + } +} + +// used in MPIOM ! +int +vlistInqVarID(int vlistID, int code) +{ + vlist_t *vlistptr = vlist_to_pointer(vlistID); + + for (int varID = 0; varID < vlistptr->nvars; ++varID) + { + int param = vlistptr->vars[varID].param; + int pdis, pcat, pnum; + cdiDecodeParam(param, &pnum, &pcat, &pdis); + if (pnum == code) return varID; + } + + return CDI_UNDEFID; +} + +SizeType +vlistInqVarSize(int vlistID, int varID) +{ + int zaxisID, gridID, timetype; + vlistInqVar(vlistID, varID, &gridID, &zaxisID, &timetype); + + SizeType nlevs = (SizeType) zaxisInqSize(zaxisID); + SizeType gridsize = gridInqSize(gridID); + + return gridsize * nlevs; +} + +/* +@Function vlistInqVarDatatype +@Title Get the data type of a Variable + +@Prototype int vlistInqVarDatatype(int vlistID, int varID) +@Parameter + @Item vlistID Variable list ID, from a previous call to @fref{vlistCreate} or @fref{streamInqVlist}. + @Item varID Variable identifier. + +@Description +The function @func{vlistInqVarDatatype} returns the data type of a variable. + +@Result +@func{vlistInqVarDatatype} returns an identifier to the data type of the variable. +The valid CDI data types are @func{CDI_DATATYPE_PACK8}, @func{CDI_DATATYPE_PACK16}, @func{CDI_DATATYPE_PACK24}, +@func{CDI_DATATYPE_FLT32}, @func{CDI_DATATYPE_FLT64}, @func{CDI_DATATYPE_INT8}, @func{CDI_DATATYPE_INT16} and +@func{CDI_DATATYPE_INT32}. + +@EndFunction +*/ +int +vlistInqVarDatatype(int vlistID, int varID) +{ + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + return varptr->datatype; +} + +int +vlistInqVarNumber(int vlistID, int varID) +{ + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + return (varptr->datatype == CDI_DATATYPE_CPX32 || varptr->datatype == CDI_DATATYPE_CPX64) ? CDI_COMP : CDI_REAL; +} + +static bool +check_range(double value, double lowerBound, double upperBound) +{ + return (value >= lowerBound && value <= upperBound); +} + +/* +@Function vlistDefVarDatatype +@Title Define the data type of a Variable + +@Prototype void vlistDefVarDatatype(int vlistID, int varID, int datatype) +@Parameter + @Item vlistID Variable list ID, from a previous call to @fref{vlistCreate}. + @Item varID Variable identifier. + @Item datatype The data type identifier. + The valid CDI data types are @func{CDI_DATATYPE_PACK8}, @func{CDI_DATATYPE_PACK16}, + @func{CDI_DATATYPE_PACK24}, @func{CDI_DATATYPE_FLT32}, @func{CDI_DATATYPE_FLT64}, + @func{CDI_DATATYPE_INT8}, @func{CDI_DATATYPE_INT16} and @func{CDI_DATATYPE_INT32}. + +@Description +The function @func{vlistDefVarDatatype} defines the data type of a variable. + +@EndFunction +*/ +void +vlistDefVarDatatype(int vlistID, int varID, int datatype) +{ + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + + if (varptr->datatype != datatype) + { + varptr->datatype = datatype; + + if (!varptr->missvalused) + { + double missval = varptr->missval; + bool missvalIsDefault = DBL_IS_EQUAL(missval, CDI_Default_Missval); + if (missvalIsDefault) + { + // clang-format off + switch (datatype) + { + case CDI_DATATYPE_INT8: varptr->missval = -SCHAR_MAX; break; + case CDI_DATATYPE_UINT8: varptr->missval = UCHAR_MAX; break; + case CDI_DATATYPE_INT16: varptr->missval = -SHRT_MAX; break; + case CDI_DATATYPE_UINT16: varptr->missval = USHRT_MAX; break; + case CDI_DATATYPE_INT32: varptr->missval = -INT_MAX; break; + case CDI_DATATYPE_UINT32: varptr->missval = UINT_MAX; break; + case CDI_DATATYPE_FLT32: varptr->missval = (float) CDI_Default_Missval; break; + } + // clang-format on + } + else + { + // clang-format off + switch (datatype) + { + case CDI_DATATYPE_INT8: varptr->missval = check_range(missval, -SCHAR_MAX, SCHAR_MAX) ? missval : -SCHAR_MAX; break; + case CDI_DATATYPE_UINT8: varptr->missval = check_range(missval, 0, UCHAR_MAX) ? missval : UCHAR_MAX; break; + case CDI_DATATYPE_INT16: varptr->missval = check_range(missval, -SHRT_MAX, SHRT_MAX) ? missval : -SHRT_MAX; break; + case CDI_DATATYPE_UINT16: varptr->missval = check_range(missval, 0, USHRT_MAX) ? missval : USHRT_MAX; break; + case CDI_DATATYPE_INT32: varptr->missval = check_range(missval, -INT_MAX, INT_MAX) ? missval : -INT_MAX; break; + case CDI_DATATYPE_UINT32: varptr->missval = check_range(missval, 0, UINT_MAX) ? missval : UINT_MAX; break; + case CDI_DATATYPE_FLT32: varptr->missval = check_range(missval, -FLT_MAX, FLT_MAX) ? missval : CDI_Default_Missval; break; + } + // clang-format on + } + } + reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE); + } +} + +void +vlistDefVarInstitut(int vlistID, int varID, int instID) +{ + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + if (varptr->instID != instID) + { + varptr->instID = instID; + reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE); + } +} + +int +vlistInqVarInstitut(int vlistID, int varID) +{ + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + return varptr->instID; +} + +void +vlistDefVarModel(int vlistID, int varID, int modelID) +{ + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + if (varptr->modelID != modelID) + { + varptr->modelID = modelID; + reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE); + } +} + +int +vlistInqVarModel(int vlistID, int varID) +{ + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + return varptr->modelID; +} + +void +vlistDefVarTable(int vlistID, int varID, int tableID) +{ + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + + if (varptr->tableID != tableID) + { + varptr->tableID = tableID; + int tablenum = tableInqNum(tableID); + int pnum, pcat, pdis; + cdiDecodeParam(varptr->param, &pnum, &pcat, &pdis); + varptr->param = cdiEncodeParam(pnum, tablenum, pdis); + reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE); + } +} + +int +vlistInqVarTable(int vlistID, int varID) +{ + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + return varptr->tableID; +} + +/* +@Function vlistDefVarName +@Title Define the name of a Variable + +@Prototype void vlistDefVarName(int vlistID, int varID, const char *name) +@Parameter + @Item vlistID Variable list ID, from a previous call to @fref{vlistCreate}. + @Item varID Variable identifier. + @Item name Name of the variable. + +@Description +The function @func{vlistDefVarName} defines the name of a variable. + +@EndFunction +*/ +void +vlistDefVarName(int vlistID, int varID, const char *name) +{ + (void) cdiDefKeyString(vlistID, varID, CDI_KEY_NAME, name); +} + +/* +@Function vlistDefVarLongname +@Title Define the long name of a Variable + +@Prototype void vlistDefVarLongname(int vlistID, int varID, const char *longname) +@Parameter + @Item vlistID Variable list ID, from a previous call to @fref{vlistCreate}. + @Item varID Variable identifier. + @Item longname Long name of the variable. + +@Description +The function @func{vlistDefVarLongname} defines the long name of a variable. + +@EndFunction +*/ +void +vlistDefVarLongname(int vlistID, int varID, const char *longname) +{ + if (longname) (void) cdiDefKeyString(vlistID, varID, CDI_KEY_LONGNAME, longname); +} + +/* +@Function vlistDefVarStdname +@Title Define the standard name of a Variable + +@Prototype void vlistDefVarStdname(int vlistID, int varID, const char *stdname) +@Parameter + @Item vlistID Variable list ID, from a previous call to @fref{vlistCreate}. + @Item varID Variable identifier. + @Item stdname Standard name of the variable. + +@Description +The function @func{vlistDefVarStdname} defines the standard name of a variable. + +@EndFunction +*/ +void +vlistDefVarStdname(int vlistID, int varID, const char *stdname) +{ + if (stdname) (void) cdiDefKeyString(vlistID, varID, CDI_KEY_STDNAME, stdname); +} + +/* +@Function vlistDefVarUnits +@Title Define the units of a Variable + +@Prototype void vlistDefVarUnits(int vlistID, int varID, const char *units) +@Parameter + @Item vlistID Variable list ID, from a previous call to @fref{vlistCreate}. + @Item varID Variable identifier. + @Item units Units of the variable. + +@Description +The function @func{vlistDefVarUnits} defines the units of a variable. + +@EndFunction +*/ +void +vlistDefVarUnits(int vlistID, int varID, const char *units) +{ + if (units) (void) cdiDefKeyString(vlistID, varID, CDI_KEY_UNITS, units); +} + +/* +@Function vlistInqVarMissval +@Title Get the missing value of a Variable + +@Prototype double vlistInqVarMissval(int vlistID, int varID) +@Parameter + @Item vlistID Variable list ID, from a previous call to @fref{vlistCreate} or @fref{streamInqVlist}. + @Item varID Variable identifier. + +@Description +The function @func{vlistInqVarMissval} returns the missing value of a variable. + +@Result +@func{vlistInqVarMissval} returns the missing value of the variable. + +@EndFunction +*/ +double +vlistInqVarMissval(int vlistID, int varID) +{ + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + return varptr->missval; +} + +/* +@Function vlistDefVarMissval +@Title Define the missing value of a Variable + +@Prototype void vlistDefVarMissval(int vlistID, int varID, double missval) +@Parameter + @Item vlistID Variable list ID, from a previous call to @fref{vlistCreate}. + @Item varID Variable identifier. + @Item missval Missing value. + +@Description +The function @func{vlistDefVarMissval} defines the missing value of a variable. + +@EndFunction +*/ +void +vlistDefVarMissval(int vlistID, int varID, double missval) +{ + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + varptr->missval = missval; + varptr->missvalused = true; +} + +int +vlistInqVarValidrange(int vlistID, int varID, double *validrange) +{ + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + + if (validrange != NULL && varptr->lvalidrange) + { + validrange[0] = varptr->validrange[0]; + validrange[1] = varptr->validrange[1]; + } + + return (int) varptr->lvalidrange; +} + +void +vlistDefVarValidrange(int vlistID, int varID, const double *validrange) +{ + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + varptr->validrange[0] = validrange[0]; + varptr->validrange[1] = validrange[1]; + varptr->lvalidrange = true; + reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE); +} + +void +vlistDefVarTimetype(int vlistID, int varID, int timetype) +{ + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + if (varptr->timetype != timetype) + { + varptr->timetype = timetype; + reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE); + } +} + +int +vlistInqVarTimetype(int vlistID, int varID) +{ + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + return varptr->timetype; +} + +void +vlistDefVarTsteptype(int vlistID, int varID, int tsteptype) +{ + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + if (varptr->tsteptype != tsteptype) + { + varptr->tsteptype = tsteptype; + reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE); + } +} + +/* +@Function vlistInqVarTsteptype +@Title Get the timestep type of a Variable + +@Prototype int vlistInqVarTsteptype(int vlistID, int varID) +@Parameter + @Item vlistID Variable list ID, from a previous call to @fref{vlistCreate} or @fref{streamInqVlist}. + @Item varID Variable identifier. + +@Description +The function @func{vlistInqVarTsteptype} returns the timestep type of a Variable. + +@Result +@func{vlistInqVarTsteptype} returns the timestep type of the Variable, +one of the set of predefined CDI timestep types. +The valid CDI timestep types are @func{TSTEP_INSTANT}, +@func{TSTEP_ACCUM}, @func{TSTEP_AVG}, @func{TSTEP_MAX}, @func{TSTEP_MIN} and @func{TSTEP_SD}. + +@EndFunction +*/ +int +vlistInqVarTsteptype(int vlistID, int varID) +{ + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + return varptr->tsteptype; +} + +int +vlistInqVarMissvalUsed(int vlistID, int varID) +{ + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + return (int) varptr->missvalused; +} + +void +vlistDefFlag(int vlistID, int varID, int levID, int flag) +{ + vlist_t *vlistptr = vlist_to_pointer(vlistID); + var_t *varptr = vlistptr_get_varptr(__func__, vlistptr, varID); + + levinfo_t li = DEFAULT_LEVINFO(levID); + if (varptr->levinfo) + ; + else if (flag != li.flag) + cdiVlistCreateVarLevInfo(vlistptr, varID); + else + return; + + varptr->levinfo[levID].flag = flag; + varptr->flag = 0; + + int nlevs = zaxisInqSize(varptr->zaxisID); + for (int levelID = 0; levelID < nlevs; ++levelID) + { + if (varptr->levinfo[levelID].flag) + { + varptr->flag = 1; + break; + } + } + + reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE); +} + +int +vlistInqFlag(int vlistID, int varID, int levID) +{ + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + + if (varptr->levinfo) + return varptr->levinfo[levID].flag; + else + { + levinfo_t li = DEFAULT_LEVINFO(levID); + return li.flag; + } +} + +int +vlistFindVar(int vlistID, int fvarID) +{ + int varID; + vlist_t *vlistptr = vlist_to_pointer(vlistID); + + for (varID = 0; varID < vlistptr->nvars; ++varID) + { + if (vlistptr->vars[varID].fvarID == fvarID) break; + } + + if (varID == vlistptr->nvars) + { + varID = -1; + Warning("varID not found for fvarID %d in vlistID %d!", fvarID, vlistID); + } + + return varID; +} + +int +vlistFindLevel(int vlistID, int fvarID, int flevelID) +{ + int levelID = -1; + int varID = vlistFindVar(vlistID, fvarID); + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + + if (varID != -1) + { + int nlevs = zaxisInqSize(varptr->zaxisID); + for (levelID = 0; levelID < nlevs; ++levelID) + { + if (varptr->levinfo[levelID].flevelID == flevelID) break; + } + + if (levelID == nlevs) + { + levelID = -1; + Warning("levelID not found for fvarID %d and levelID %d in vlistID %d!", fvarID, flevelID, vlistID); + } + } + + return levelID; +} + +int +vlistMergedVar(int vlistID, int varID) +{ + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + return varptr->mvarID; +} + +int +vlistMergedLevel(int vlistID, int varID, int levelID) +{ + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + + if (varptr->levinfo) + return varptr->levinfo[levelID].mlevelID; + else + { + levinfo_t li = DEFAULT_LEVINFO(levelID); + return li.mlevelID; + } +} + +void +vlistDefIndex(int vlistID, int varID, int levelID, int index) +{ + vlist_t *vlistptr = vlist_to_pointer(vlistID); + var_t *varptr = vlistptr_get_varptr(__func__, vlistptr, varID); + + levinfo_t li = DEFAULT_LEVINFO(levelID); + if (varptr->levinfo) + ; + else if (index != li.index) + cdiVlistCreateVarLevInfo(vlistptr, varID); + else + return; + + varptr->levinfo[levelID].index = index; + reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE); +} + +int +vlistInqIndex(int vlistID, int varID, int levelID) +{ + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + + if (varptr->levinfo) + return varptr->levinfo[levelID].index; + else + { + levinfo_t li = DEFAULT_LEVINFO(levelID); + return li.index; + } +} + +void +vlistChangeVarZaxis(int vlistID, int varID, int zaxisID) +{ + vlist_t *vlistptr = vlist_to_pointer(vlistID); + var_t *varptr = vlistptr_get_varptr(__func__, vlistptr, varID); + + int nlevs1 = zaxisInqSize(varptr->zaxisID); + int nlevs2 = zaxisInqSize(zaxisID); + + if (nlevs1 != nlevs2) Error("Number of levels must not change!"); + + int nvars = vlistptr->nvars; + int found = 0; + int oldZaxisID = varptr->zaxisID; + for (int i = 0; i < varID; ++i) found |= (vlistptr->vars[i].zaxisID == oldZaxisID); + for (int i = varID + 1; i < nvars; ++i) found |= (vlistptr->vars[i].zaxisID == oldZaxisID); + + if (found) + { + int nzaxis = vlistptr->nzaxis; + for (int i = 0; i < nzaxis; ++i) + if (vlistptr->zaxisIDs[i] == oldZaxisID) vlistptr->zaxisIDs[i] = zaxisID; + } + else + vlistAdd2ZaxisIDs(vlistptr, zaxisID); + + varptr->zaxisID = zaxisID; + reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE); +} + +void +vlistChangeVarGrid(int vlistID, int varID, int gridID) +{ + vlist_t *vlistptr = vlist_to_pointer(vlistID); + var_t *varptr = vlistptr_get_varptr(__func__, vlistptr, varID); + + int nvars = vlistptr->nvars; + int index; + for (index = 0; index < nvars; index++) + if (index != varID) + if (vlistptr->vars[index].gridID == vlistptr->vars[varID].gridID) break; + + if (index == nvars) + { + for (index = 0; index < vlistptr->ngrids; index++) + if (vlistptr->gridIDs[index] == vlistptr->vars[varID].gridID) vlistptr->gridIDs[index] = gridID; + } + else + vlistAdd2GridIDs(vlistptr, gridID); + + varptr->gridID = gridID; + reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE); +} + +void +vlistDefVarCompType(int vlistID, int varID, int comptype) +{ + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + + if (varptr->comptype != comptype) + { + varptr->comptype = comptype; + reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE); + } +} + +int +vlistInqVarCompType(int vlistID, int varID) +{ + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + return varptr->comptype; +} + +void +vlistDefVarCompLevel(int vlistID, int varID, int complevel) +{ + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + + if (varptr->complevel != complevel) + { + varptr->complevel = complevel; + reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE); + } +} + +int +vlistInqVarCompLevel(int vlistID, int varID) +{ + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + return varptr->complevel; +} + +void +vlistDefVarNSB(int vlistID, int varID, int nsb) +{ + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + if (varptr->nsb != nsb) + { + varptr->nsb = nsb; + reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE); + } +} + +int +vlistInqVarNSB(int vlistID, int varID) +{ + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + return varptr->nsb; +} + +static int +vlistEncodeXyz(const int dimorder[3]) +{ + return (short) (dimorder[0] * 100 + dimorder[1] * 10 + dimorder[2]); +} + +static void +vlistDecodeXyz(int xyz, int outDimorder[3]) +{ + outDimorder[0] = xyz / 100, xyz = xyz % 100; + outDimorder[1] = xyz / 10; + outDimorder[2] = xyz % 10; +} + +static const short xyzStorVals[] = { 123, 132, 213, 231, 312, 321 }; +enum +{ + numXYZStorVals = sizeof(xyzStorVals) / sizeof(xyzStorVals[0]) +}; + +void +vlistDefVarXYZ(int vlistID, int varID, int xyz) +{ + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + + if (xyz == 3) xyz = 321; + + // check xyz dimension order + { + int dimorder[3]; + vlistDecodeXyz(xyz, dimorder); + int dimx = 0, dimy = 0, dimz = 0; + for (int id = 0; id < 3; ++id) + { + switch (dimorder[id]) + { + case 1: dimx++; break; + case 2: dimy++; break; + case 3: dimz++; break; + default: dimorder[id] = 0; break; // Ensure that we assign a valid dimension to this position. + } + } + if (dimz > 1 || dimy > 1 || dimx > 1) + xyz = 321; // ZYX + else + { + // clang-format off + if (dimz == 0) for (int id = 0; id < 3; ++id) if (dimorder[id] == 0) { dimorder[id] = 3; break; } + if (dimy == 0) for (int id = 0; id < 3; ++id) if (dimorder[id] == 0) { dimorder[id] = 2; break; } + if (dimx == 0) for (int id = 0; id < 3; ++id) if (dimorder[id] == 0) { dimorder[id] = 1; break; } + // clang-format on + xyz = vlistEncodeXyz(dimorder); + } + } + + assert(xyz == 123 || xyz == 312 || xyz == 231 || xyz == 321 || xyz == 132 || xyz == 213); + + for (size_t i = 0; i < numXYZStorVals; ++i) + if (xyz == xyzStorVals[i]) + { + xyz = (int) i; + break; + } + varptr->xyz = (signed char) xyz; + reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE); +} + +void +vlistInqVarDimorder(int vlistID, int varID, int outDimorder[3]) +{ + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + vlistDecodeXyz(xyzStorVals[varptr->xyz], outDimorder); +} + +int +vlistInqVarXYZ(int vlistID, int varID) +{ + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + return xyzStorVals[varptr->xyz]; +} + +int +vlistVarCompare(vlist_t *a, int varIDA, vlist_t *b, int varIDB) +{ + xassert(a && b && varIDA >= 0 && varIDA < a->nvars && varIDB >= 0 && varIDB < b->nvars); + var_t *pva = a->vars + varIDA, *pvb = b->vars + varIDB; +#define FCMP(f) ((pva->f) != (pvb->f)) +#define FCMPFLT(f) (IS_NOT_EQUAL((pva->f), (pvb->f))) +#define FCMPSTR(fs) ((pva->fs) != (pvb->fs) && strcmp((pva->fs), (pvb->fs))) +#define FCMP2(f) (namespaceResHDecode(pva->f).idx != namespaceResHDecode(pvb->f).idx) + int diff = (int) FCMP(fvarID) | FCMP(mvarID) | FCMP(flag) | FCMP(param) | FCMP(datatype) | FCMP(timetype) | FCMP(tsteptype) + | FCMP(xyz) | FCMP2(gridID) | FCMP2(zaxisID) | FCMP2(instID) | FCMP2(modelID) | FCMP2(tableID) | FCMP(missvalused) + | FCMPFLT(missval) | FCMP(comptype) | FCMP(complevel) | FCMP(lvalidrange) | FCMPFLT(validrange[0]) + | FCMPFLT(validrange[1]); +#undef FCMP +#undef FCMPFLT +#undef FCMPSTR +#undef FCMP2 + if ((diff |= ((pva->levinfo == NULL) ^ (pvb->levinfo == NULL)))) return 1; + + if (pva->levinfo) + { + int zaxisID = pva->zaxisID; + size_t nlevs = (size_t) zaxisInqSize(zaxisID); + diff |= (memcmp(pva->levinfo, pvb->levinfo, sizeof(levinfo_t) * nlevs) != 0); + if (diff) return 1; + } + + size_t natts = a->vars[varIDA].atts.nelems; + if (natts != b->vars[varIDB].atts.nelems) return 1; + for (size_t attID = 0; attID < natts; ++attID) diff |= cdi_att_compare(&a->vars[varIDA].atts, &b->vars[varIDB].atts, (int) attID); + + size_t nkeys = a->vars[varIDA].keys.nelems; + if (nkeys != b->vars[varIDB].keys.nelems) return 1; + for (size_t keyID = 0; keyID < nkeys; ++keyID) diff |= cdi_key_compare(&a->vars[varIDA].keys, &b->vars[varIDB].keys, (int) keyID); + + return diff; +} + +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ + +enum +{ + VLISTVAR_PACK_INT_IDX_FLAG, + VLISTVAR_PACK_INT_IDX_GRIDID, + VLISTVAR_PACK_INT_IDX_ZAXISID, + VLISTVAR_PACK_INT_IDX_TIMETYPE, + VLISTVAR_PACK_INT_IDX_DATATYPE, + VLISTVAR_PACK_INT_IDX_PARAM, + VLISTVAR_PACK_INT_IDX_INSTID, + VLISTVAR_PACK_INT_IDX_MODELID, + VLISTVAR_PACK_INT_IDX_TABLEID, + VLISTVAR_PACK_INT_IDX_MISSVALUSED, + VLISTVAR_PACK_INT_IDX_COMPTYPE, + VLISTVAR_PACK_INT_IDX_COMPLEVEL, + VLISTVAR_PACK_INT_IDX_NLEVS, + vlistvarNint +}; + +enum +{ + VLIST_VAR_PACK_DBL_MISSVAL, + vlistvar_ndbls, +}; + +int +vlistVarGetPackSize(vlist_t *p, int varID, void *context) +{ + var_t *var = p->vars + varID; + int varsize + = serializeGetSize(vlistvarNint, CDI_DATATYPE_INT, context) + serializeGetSize(vlistvar_ndbls, CDI_DATATYPE_FLT64, context); + + if (var->levinfo) varsize += serializeGetSize(4 * zaxisInqSize(var->zaxisID), CDI_DATATYPE_INT, context); + varsize += serializeKeysGetPackSize(&var->keys, context); + varsize += cdiAttsGetSize(p, varID, context); + + return varsize; +} + +void +vlistVarPack(vlist_t *p, int varID, char *buf, int size, int *position, void *context) +{ + var_t *var = p->vars + varID; + int nlevs; + { + int tempbuf[vlistvarNint]; + tempbuf[VLISTVAR_PACK_INT_IDX_FLAG] = var->flag; + tempbuf[VLISTVAR_PACK_INT_IDX_GRIDID] = var->gridID; + tempbuf[VLISTVAR_PACK_INT_IDX_ZAXISID] = var->zaxisID; + tempbuf[VLISTVAR_PACK_INT_IDX_TIMETYPE] = var->timetype; + tempbuf[VLISTVAR_PACK_INT_IDX_DATATYPE] = var->datatype; + tempbuf[VLISTVAR_PACK_INT_IDX_PARAM] = var->param; + tempbuf[VLISTVAR_PACK_INT_IDX_INSTID] = var->instID; + tempbuf[VLISTVAR_PACK_INT_IDX_MODELID] = var->modelID; + tempbuf[VLISTVAR_PACK_INT_IDX_TABLEID] = var->tableID; + tempbuf[VLISTVAR_PACK_INT_IDX_MISSVALUSED] = (int) var->missvalused; + tempbuf[VLISTVAR_PACK_INT_IDX_COMPTYPE] = var->comptype; + tempbuf[VLISTVAR_PACK_INT_IDX_COMPLEVEL] = var->complevel; + nlevs = var->levinfo ? zaxisInqSize(var->zaxisID) : 0; + tempbuf[VLISTVAR_PACK_INT_IDX_NLEVS] = nlevs; + serializePack(tempbuf, vlistvarNint, CDI_DATATYPE_INT, buf, size, position, context); + } + { + double dtempbuf[vlistvar_ndbls]; + dtempbuf[VLIST_VAR_PACK_DBL_MISSVAL] = var->missval; + serializePack(dtempbuf, vlistvar_ndbls, CDI_DATATYPE_FLT64, buf, size, position, context); + } + if (nlevs) + { + int *levbuf = (int *) malloc(nlevs * sizeof(int)); + for (int levID = 0; levID < nlevs; ++levID) levbuf[levID] = var->levinfo[levID].flag; + serializePack(levbuf, nlevs, CDI_DATATYPE_INT, buf, size, position, context); + for (int levID = 0; levID < nlevs; ++levID) levbuf[levID] = var->levinfo[levID].index; + serializePack(levbuf, nlevs, CDI_DATATYPE_INT, buf, size, position, context); + for (int levID = 0; levID < nlevs; ++levID) levbuf[levID] = var->levinfo[levID].mlevelID; + serializePack(levbuf, nlevs, CDI_DATATYPE_INT, buf, size, position, context); + for (int levID = 0; levID < nlevs; ++levID) levbuf[levID] = var->levinfo[levID].flevelID; + free(levbuf); + } + + serializeKeysPack(&var->keys, buf, size, position, context); + + cdiAttsPack(p, varID, buf, size, position, context); +} + +void +vlistVarUnpack(int vlistID, char *buf, int size, int *position, int originNamespace, void *context) +{ +#define adaptKey(key) (namespaceAdaptKey((key), originNamespace)) + double dtempbuf[vlistvar_ndbls]; + int tempbuf[vlistvarNint]; + vlist_t *vlistptr = vlist_to_pointer(vlistID); + serializeUnpack(buf, size, position, tempbuf, vlistvarNint, CDI_DATATYPE_INT, context); + serializeUnpack(buf, size, position, dtempbuf, vlistvar_ndbls, CDI_DATATYPE_FLT64, context); + + /* ------------------------------------------- */ + /* NOTE: Tile sets currently not supported!!! */ + /* ------------------------------------------- */ + + int newvar = vlistDefVar(vlistID, adaptKey(tempbuf[VLISTVAR_PACK_INT_IDX_GRIDID]), + adaptKey(tempbuf[VLISTVAR_PACK_INT_IDX_ZAXISID]), tempbuf[VLISTVAR_PACK_INT_IDX_TIMETYPE]); + vlistDefVarDatatype(vlistID, newvar, tempbuf[VLISTVAR_PACK_INT_IDX_DATATYPE]); + vlistDefVarInstitut(vlistID, newvar, adaptKey(tempbuf[VLISTVAR_PACK_INT_IDX_INSTID])); + vlistDefVarModel(vlistID, newvar, adaptKey(tempbuf[VLISTVAR_PACK_INT_IDX_MODELID])); + vlistDefVarTable(vlistID, newvar, tempbuf[VLISTVAR_PACK_INT_IDX_TABLEID]); + // FIXME: changing the table might change the param code + vlistDefVarParam(vlistID, newvar, tempbuf[VLISTVAR_PACK_INT_IDX_PARAM]); + if (tempbuf[VLISTVAR_PACK_INT_IDX_MISSVALUSED]) vlistDefVarMissval(vlistID, newvar, dtempbuf[VLIST_VAR_PACK_DBL_MISSVAL]); + vlistDefVarCompType(vlistID, newvar, tempbuf[VLISTVAR_PACK_INT_IDX_COMPTYPE]); + vlistDefVarCompLevel(vlistID, newvar, tempbuf[VLISTVAR_PACK_INT_IDX_COMPLEVEL]); + const int nlevs = tempbuf[VLISTVAR_PACK_INT_IDX_NLEVS]; + var_t *var = vlistptr->vars + newvar; + if (nlevs) + { + int i, flagSetLev = 0; + cdiVlistCreateVarLevInfo(vlistptr, newvar); + + int *levbuf = (int *) malloc(nlevs * sizeof(int)); + serializeUnpack(buf, size, position, levbuf, nlevs, CDI_DATATYPE_INT, context); + for (i = 0; i < nlevs; ++i) vlistDefFlag(vlistID, newvar, i, levbuf[i]); + for (i = 0; i < nlevs; ++i) + if (levbuf[i] == tempbuf[0]) flagSetLev = i; + vlistDefFlag(vlistID, newvar, flagSetLev, levbuf[flagSetLev]); + serializeUnpack(buf, size, position, levbuf, nlevs, CDI_DATATYPE_INT, context); + for (i = 0; i < nlevs; ++i) vlistDefIndex(vlistID, newvar, i, levbuf[i]); + serializeUnpack(buf, size, position, levbuf, nlevs, CDI_DATATYPE_INT, context); + for (i = 0; i < nlevs; ++i) var->levinfo[i].mlevelID = levbuf[i]; + serializeUnpack(buf, size, position, levbuf, nlevs, CDI_DATATYPE_INT, context); + for (i = 0; i < nlevs; ++i) var->levinfo[i].flevelID = levbuf[i]; + free(levbuf); + } + + serializeKeysUnpack(buf, size, position, &var->keys, context); + + cdiAttsUnpack(vlistID, newvar, buf, size, position, context); +#undef adaptKey +} + +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#ifdef HAVE_CONFIG_H +#endif + + +/* vlistDefVarIntKey: Set an arbitrary keyword/integer value pair for GRIB API */ +void +vlistDefVarIntKey(int vlistID, int varID, const char *name, int value) +{ +#ifdef HAVE_LIBGRIB_API + vlist_t *vlistptr = vlist_to_pointer(vlistID); + if (vlistptr == NULL) Error("Internal error!"); + int idx; + + if (vlistptr->immutable) + Error("vlistDefVarIntKey() was called on an immutable vlist object (vlistID = %d)\n" + "Either call vlistDefVarIntKey() before passing the vlist object to streamDefVlist(),\n" + "or use the stream-internal vlist by calling streamInqVlist().", + vlistID); + + for (idx = 0; idx < vlistptr->vars[varID].opt_grib_nentries; idx++) + if (str_is_equal(name, vlistptr->vars[varID].opt_grib_kvpair[idx].keyword) + && (vlistptr->vars[varID].opt_grib_kvpair[idx].data_type == t_int)) + break; + + if (idx < vlistptr->vars[varID].opt_grib_nentries) + { + vlistptr->vars[varID].opt_grib_kvpair[idx].int_val = value; + vlistptr->vars[varID].opt_grib_kvpair[idx].update = true; + } + else + { + resize_opt_grib_entries(&vlistptr->vars[varID], vlistptr->vars[varID].opt_grib_nentries + 1); + vlistptr->vars[varID].opt_grib_nentries += 1; + idx = vlistptr->vars[varID].opt_grib_nentries - 1; + vlistptr->vars[varID].opt_grib_kvpair[idx].data_type = t_int; + vlistptr->vars[varID].opt_grib_kvpair[idx].int_val = value; + vlistptr->vars[varID].opt_grib_kvpair[idx].update = true; + if (name) + vlistptr->vars[varID].opt_grib_kvpair[idx].keyword = strdupx(name); + else + Error("Internal error, name undefined!"); + } + + if (CDI_Debug) + { + Message("define additional GRIB2 key \"%s\" (integer): %d", name, value); + Message("total list of registered, additional GRIB2 keys (total: %d):", vlistptr->vars[varID].opt_grib_nentries); + for (idx = 0; idx < vlistptr->vars[varID].opt_grib_nentries; idx++) + if (vlistptr->vars[varID].opt_grib_kvpair[idx].data_type == t_int) + Message("%s -> integer %d", vlistptr->vars[varID].opt_grib_kvpair[idx].keyword, + vlistptr->vars[varID].opt_grib_kvpair[idx].int_val); + else if (vlistptr->vars[varID].opt_grib_kvpair[idx].data_type == t_double) + Message("%s -> double %d", vlistptr->vars[varID].opt_grib_kvpair[idx].keyword, + vlistptr->vars[varID].opt_grib_kvpair[idx].dbl_val); + else + Message("%s -> unknown", vlistptr->vars[varID].opt_grib_kvpair[idx].keyword); + } + + reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE); +#else + (void) vlistID; + (void) varID; + (void) name; + (void) value; +#endif +} + +/* vlistDefVarDblKey: Set an arbitrary keyword/double value pair for GRIB API */ +void +vlistDefVarDblKey(int vlistID, int varID, const char *name, double value) +{ +#ifdef HAVE_LIBGRIB_API + vlist_t *vlistptr = vlist_to_pointer(vlistID); + if (vlistptr == NULL) Error("Internal error!"); + int idx; + + if (vlistptr->immutable) + Error("vlistDefVarDblKey() was called on an immutable vlist object (vlistID = %d)\n" + "Either call vlistDefVarIntKey() before passing the vlist object to streamDefVlist(),\n" + "or use the stream-internal vlist by calling streamInqVlist().", + vlistID); + + for (idx = 0; idx < vlistptr->vars[varID].opt_grib_nentries; idx++) + if (str_is_equal(name, vlistptr->vars[varID].opt_grib_kvpair[idx].keyword) + && (vlistptr->vars[varID].opt_grib_kvpair[idx].data_type == t_double)) + break; + + if (idx < vlistptr->vars[varID].opt_grib_nentries) + { + vlistptr->vars[varID].opt_grib_kvpair[idx].dbl_val = value; + vlistptr->vars[varID].opt_grib_kvpair[idx].update = true; + } + else + { + resize_opt_grib_entries(&vlistptr->vars[varID], vlistptr->vars[varID].opt_grib_nentries + 1); + vlistptr->vars[varID].opt_grib_nentries += 1; + idx = vlistptr->vars[varID].opt_grib_nentries - 1; + vlistptr->vars[varID].opt_grib_kvpair[idx].data_type = t_double; + vlistptr->vars[varID].opt_grib_kvpair[idx].dbl_val = value; + vlistptr->vars[varID].opt_grib_kvpair[idx].update = true; + if (name) + vlistptr->vars[varID].opt_grib_kvpair[idx].keyword = strdupx(name); + else + Error("Internal error, name undefined!"); + } + + if (CDI_Debug) + { + Message("define additional GRIB2 key \"%s\" (double): %d", name, value); + Message("total list of registered, additional GRIB2 keys (total: %d):", vlistptr->vars[varID].opt_grib_nentries); + for (idx = 0; idx < vlistptr->vars[varID].opt_grib_nentries; idx++) + if (vlistptr->vars[varID].opt_grib_kvpair[idx].data_type == t_int) + Message("%s -> integer %d", vlistptr->vars[varID].opt_grib_kvpair[idx].keyword, + vlistptr->vars[varID].opt_grib_kvpair[idx].int_val); + else if (vlistptr->vars[varID].opt_grib_kvpair[idx].data_type == t_double) + Message("%s -> double %d", vlistptr->vars[varID].opt_grib_kvpair[idx].keyword, + vlistptr->vars[varID].opt_grib_kvpair[idx].dbl_val); + else + Message("%s -> unknown", vlistptr->vars[varID].opt_grib_kvpair[idx].keyword); + } + + reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE); +#else + (void) vlistID; + (void) varID; + (void) name; + (void) value; +#endif +} + +/* cdiClearAdditionalKeys: Clears the list of additional GRIB keys. */ +void +cdiClearAdditionalKeys() +{ +#ifdef HAVE_LIBGRIB_API + for (int i = 0; i < cdiNAdditionalGRIBKeys; ++i) free(cdiAdditionalGRIBKeys[i]); + cdiNAdditionalGRIBKeys = 0; +#endif +} + +/* cdiDefAdditionalKey: Register an additional GRIB key which is read when file is opened. */ +void +cdiDefAdditionalKey(const char *name) +{ +#ifdef HAVE_LIBGRIB_API + int idx = cdiNAdditionalGRIBKeys; + cdiNAdditionalGRIBKeys++; + if (idx >= MAX_OPT_GRIB_ENTRIES) Error("Too many additional keywords!"); + if (name) + cdiAdditionalGRIBKeys[idx] = strdupx(name); + else + Error("Internal error!"); +#else + (void) name; +#endif +} + +/* vlistHasVarKey: returns 1 if meta-data key was read, 0 otherwise. */ +int +vlistHasVarKey(int vlistID, int varID, const char *name) +{ +#ifdef HAVE_LIBGRIB_API + /* check if the GRIB key was previously read and is stored */ + vlist_t *vlistptr = vlist_to_pointer(vlistID); + + for (int i = 0; i < vlistptr->vars[varID].opt_grib_nentries; ++i) + { + if (str_is_equal(name, vlistptr->vars[varID].opt_grib_kvpair[i].keyword)) return 1; + } +#else + (void) vlistID; + (void) varID; + (void) name; +#endif + return 0; +} + +/* vlistInqVarDblKey: raw access to GRIB meta-data */ +double +vlistInqVarDblKey(int vlistID, int varID, const char *name) +{ + double value = 0; +#ifdef HAVE_LIBGRIB_API + /* check if the GRIB key was previously read and is stored in "opt_grib_dbl_val" */ + vlist_t *vlistptr = vlist_to_pointer(vlistID); + + for (int i = 0; i < vlistptr->vars[varID].opt_grib_nentries; ++i) + { + int isub = subtypeInqActiveIndex(vlistptr->vars[varID].subtypeID); + if (str_is_equal(name, vlistptr->vars[varID].opt_grib_kvpair[i].keyword) + && (vlistptr->vars[varID].opt_grib_kvpair[i].data_type == t_double) + && (vlistptr->vars[varID].opt_grib_kvpair[i].subtype_index == isub)) + return vlistptr->vars[varID].opt_grib_kvpair[i].dbl_val; + } +#else + (void) vlistID; + (void) varID; + (void) name; +#endif + return value; +} + +/* vlistInqVarIntKey: raw access to GRIB meta-data */ +int +vlistInqVarIntKey(int vlistID, int varID, const char *name) +{ + long value = 0; +#ifdef HAVE_LIBGRIB_API + /* check if the GRIB key was previously read and is stored in "opt_grib_int_val" */ + vlist_t *vlistptr = vlist_to_pointer(vlistID); + + for (int i = 0; i < vlistptr->vars[varID].opt_grib_nentries; ++i) + { + int isub = subtypeInqActiveIndex(vlistptr->vars[varID].subtypeID); + if (str_is_equal(name, vlistptr->vars[varID].opt_grib_kvpair[i].keyword) + && (vlistptr->vars[varID].opt_grib_kvpair[i].data_type == t_int) + && (vlistptr->vars[varID].opt_grib_kvpair[i].subtype_index == isub)) + return vlistptr->vars[varID].opt_grib_kvpair[i].int_val; + } + +#else + (void) vlistID; + (void) varID; + (void) name; +#endif + return (int) value; +} + +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +#include <string.h> +#include <math.h> +#include <float.h> + + + +#define LevelUp 1 +#define LevelDown 2 + +// clang-format off +static const struct +{ + unsigned char positive; // 1: up; 2: down + const char *name; + const char *longname; + const char *stdname; + const char *units; +} +ZaxistypeEntry[] = { + { /* 0 */ 0, "sfc", "surface", "", ""}, + { /* 1 */ 0, "lev", "generic", "", ""}, + { /* 2 */ 2, "lev", "hybrid", "", "level"}, + { /* 3 */ 2, "lev", "hybrid_half", "", "level"}, + { /* 4 */ 2, "plev", "pressure", "air_pressure", "Pa"}, + { /* 5 */ 1, "height", "height", "height", "m"}, + { /* 6 */ 2, "depth", "depth_below_sea", "depth", "m"}, + { /* 7 */ 2, "depth", "depth_below_land", "", "cm"}, + { /* 8 */ 0, "lev", "isentropic", "", "K"}, + { /* 9 */ 0, "lev", "trajectory", "", ""}, + { /* 10 */ 1, "alt", "height above mean sea level", "altitude", "m"}, + { /* 11 */ 0, "lev", "sigma", "", "level"}, + { /* 12 */ 0, "lev", "meansea", "", "level"}, + { /* 13 */ 0, "toa", "top_of_atmosphere", "", ""}, + { /* 14 */ 0, "seabottom", "sea_bottom", "", ""}, + { /* 15 */ 0, "atmosphere", "atmosphere", "", ""}, + { /* 16 */ 0, "cloudbase", "cloud_base", "", ""}, + { /* 17 */ 0, "cloudtop", "cloud_top", "", ""}, + { /* 18 */ 0, "isotherm0", "isotherm_zero", "", ""}, + { /* 19 */ 0, "snow", "snow", "", ""}, + { /* 20 */ 0, "lakebottom", "lake_bottom", "", ""}, + { /* 21 */ 0, "sedimentbottom", "sediment_bottom", "", ""}, + { /* 22 */ 0, "sedimentbottomta", "sediment_bottom_ta", "", ""}, + { /* 23 */ 0, "sedimentbottomtw", "sediment_bottom_tw", "", ""}, + { /* 24 */ 0, "mixlayer", "mix_layer", "", ""}, + { /* 25 */ 0, "height", "generalized_height", "height", ""}, + { /* 26 */ 0, "character", "area_type", "", ""}, + { /* 27 */ 0, "tropopause", "tropopause", "", ""}, +}; +// clang-format on + +enum +{ + CDI_NumZaxistype = sizeof(ZaxistypeEntry) / sizeof(ZaxistypeEntry[0]), +}; + +static int zaxisCompareP(zaxis_t *z1, zaxis_t *z2); +static void zaxisDestroyP(void *zaxisptr); +static void zaxisPrintP(void *zaxisptr, FILE *fp); +static int zaxisGetPackSize(void *zaxisptr, void *context); +static void zaxisPack(void *zaxisptr, void *buffer, int size, int *pos, void *context); +static int zaxisTxCode(void *zaxisptr); + +static const resOps zaxisOps + = { (int (*)(void *, void *)) zaxisCompareP, zaxisDestroyP, zaxisPrintP, zaxisGetPackSize, zaxisPack, zaxisTxCode }; + +const resOps * +getZaxisOps(void) +{ + return &zaxisOps; +} + +void +zaxisGetTypeDescription(int zaxisType, int *outPositive, const char **outName, const char **outLongName, const char **outStdName, + const char **outUnit) +{ + if (zaxisType < 0 || zaxisType >= CDI_NumZaxistype) + { + if (outPositive) *outPositive = 0; + if (outName) *outName = NULL; + if (outLongName) *outLongName = NULL; + if (outStdName) *outStdName = NULL; + if (outUnit) *outUnit = NULL; + } + else + { + if (outPositive) *outPositive = ZaxistypeEntry[zaxisType].positive; + if (outName) *outName = ZaxistypeEntry[zaxisType].name; + if (outLongName && zaxisType != ZAXIS_GENERIC) *outLongName = ZaxistypeEntry[zaxisType].longname; + if (outStdName) *outStdName = ZaxistypeEntry[zaxisType].stdname; + if (outUnit) *outUnit = ZaxistypeEntry[zaxisType].units; + } +} + +zaxis_t * +zaxis_to_pointer(int id) +{ + return (zaxis_t *) reshGetVal(id, &zaxisOps); +} + +static void +zaxis_init(zaxis_t *zaxisptr) +{ + zaxisptr->self = CDI_UNDEFID; + zaxisptr->vals = NULL; +#ifndef USE_MPI + zaxisptr->cvals = NULL; + zaxisptr->clength = 0; +#endif + zaxisptr->ubounds = NULL; + zaxisptr->lbounds = NULL; + zaxisptr->weights = NULL; + zaxisptr->type = CDI_UNDEFID; + zaxisptr->positive = 0; + zaxisptr->scalar = 0; + zaxisptr->direction = 0; + zaxisptr->size = 0; + zaxisptr->vctsize = 0; + zaxisptr->vct = NULL; + + cdiInitKeys(&zaxisptr->keys); + zaxisptr->atts.nalloc = MAX_ATTRIBUTES; + zaxisptr->atts.nelems = 0; + + cdiDefVarKeyInt(&zaxisptr->keys, CDI_KEY_DATATYPE, CDI_DATATYPE_FLT64); +} + +static zaxis_t * +zaxisNewEntry(int id) +{ + zaxis_t *zaxisptr = (zaxis_t *) Malloc(sizeof(zaxis_t)); + zaxis_init(zaxisptr); + + if (id == CDI_UNDEFID) + zaxisptr->self = reshPut(zaxisptr, &zaxisOps); + else + { + zaxisptr->self = id; + reshReplace(id, zaxisptr, &zaxisOps); + } + + return zaxisptr; +} + +static void +zaxisInit(void) +{ + static bool zaxisInitialized = false; + if (zaxisInitialized) return; + zaxisInitialized = true; +} + +static void +zaxis_copy(zaxis_t *zaxisptr2, zaxis_t *zaxisptr1) +{ + int zaxisID2 = zaxisptr2->self; + memcpy(zaxisptr2, zaxisptr1, sizeof(zaxis_t)); + zaxisptr2->self = zaxisID2; + cdiInitKeys(&zaxisptr2->keys); + cdiCopyVarKeys(&zaxisptr1->keys, &zaxisptr2->keys); +} + +unsigned +cdiZaxisCount(void) +{ + return reshCountType(&zaxisOps); +} + +static int +zaxisCreate_(int zaxistype, int size, int id) +{ + zaxis_t *zaxisptr = zaxisNewEntry(id); + + xassert(size >= 0); + zaxisptr->type = zaxistype; + zaxisptr->size = size; + + if (zaxistype >= CDI_NumZaxistype || zaxistype < 0) + Error("Internal problem! zaxistype=%d out of range (min=0/max=%d)!", zaxistype, CDI_NumZaxistype - 1); + + int zaxisID = zaxisptr->self; + cdiDefKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_NAME, ZaxistypeEntry[zaxistype].name); + if (zaxistype != ZAXIS_GENERIC) zaxisDefLongname(zaxisID, ZaxistypeEntry[zaxistype].longname); + cdiDefKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_UNITS, ZaxistypeEntry[zaxistype].units); + + const char *stdname = ZaxistypeEntry[zaxistype].stdname; + if (*stdname) cdiDefVarKeyBytes(&zaxisptr->keys, CDI_KEY_STDNAME, (const unsigned char *) stdname, (int) strlen(stdname) + 1); + + zaxisptr->positive = ZaxistypeEntry[zaxistype].positive; + + return zaxisID; +} + +/* +@Function zaxisCreate +@Title Create a vertical Z-axis + +@Prototype int zaxisCreate(int zaxistype, int size) +@Parameter + @Item zaxistype The type of the Z-axis, one of the set of predefined CDI Z-axis types. + The valid CDI Z-axis types are @func{ZAXIS_GENERIC}, @func{ZAXIS_SURFACE}, + @func{ZAXIS_HYBRID}, @func{ZAXIS_SIGMA}, @func{ZAXIS_PRESSURE}, @func{ZAXIS_HEIGHT}, + @func{ZAXIS_ISENTROPIC}, @func{ZAXIS_ALTITUDE}, @func{ZAXIS_MEANSEA}, @func{ZAXIS_TOA}, + @func{ZAXIS_SEA_BOTTOM}, @func{ZAXIS_ATMOSPHERE}, @func{ZAXIS_CLOUD_BASE}, + @func{ZAXIS_CLOUD_TOP}, @func{ZAXIS_ISOTHERM_ZERO}, @func{ZAXIS_SNOW}, + @func{ZAXIS_LAKE_BOTTOM}, @func{ZAXIS_SEDIMENT_BOTTOM}, @func{ZAXIS_SEDIMENT_BOTTOM_TA}, + @func{ZAXIS_SEDIMENT_BOTTOM_TW}, @func{ZAXIS_MIX_LAYER}, + @func{ZAXIS_DEPTH_BELOW_SEA} and @func{ZAXIS_DEPTH_BELOW_LAND}. + @Item size Number of levels. + +@Description +The function @func{zaxisCreate} creates a vertical Z-axis. + +@Result +@func{zaxisCreate} returns an identifier to the Z-axis. + +@Example +Here is an example using @func{zaxisCreate} to create a pressure level Z-axis: + +@Source + ... +#define nlev 5 + ... +double levs[nlev] = {101300, 92500, 85000, 50000, 20000}; +int zaxisID; + ... +zaxisID = zaxisCreate(ZAXIS_PRESSURE, nlev); +zaxisDefLevels(zaxisID, levs); + ... +@EndSource +@EndFunction +*/ +int +zaxisCreate(int zaxistype, int size) +{ + if (CDI_Debug) Message("zaxistype: %d size: %d ", zaxistype, size); + + xassert(size); + zaxisInit(); + + return zaxisCreate_(zaxistype, size, CDI_UNDEFID); +} + +static void +zaxisDestroyKernel(zaxis_t *zaxisptr) +{ + xassert(zaxisptr); + + if (zaxisptr->vals) Free(zaxisptr->vals); +#ifndef USE_MPI + if (zaxisptr->cvals) + { + for (int i = 0; i < zaxisptr->size; i++) Free(zaxisptr->cvals[i]); + Free(zaxisptr->cvals); + } +#endif + if (zaxisptr->lbounds) Free(zaxisptr->lbounds); + if (zaxisptr->ubounds) Free(zaxisptr->ubounds); + if (zaxisptr->weights) Free(zaxisptr->weights); + if (zaxisptr->vct) Free(zaxisptr->vct); + + int zaxisID = zaxisptr->self; + cdiDeleteKeys(zaxisID, CDI_GLOBAL); + cdiDeleteAtts(zaxisID, CDI_GLOBAL); + + Free(zaxisptr); +} + +/* +@Function zaxisDestroy +@Title Destroy a vertical Z-axis + +@Prototype void zaxisDestroy(int zaxisID) +@Parameter + @Item zaxisID Z-axis ID, from a previous call to @fref{zaxisCreate}. + +@EndFunction +*/ +void +zaxisDestroy(int zaxisID) +{ + zaxis_t *zaxisptr = zaxis_to_pointer(zaxisID); + zaxisDestroyKernel(zaxisptr); + reshRemove(zaxisID, &zaxisOps); +} + +static void +zaxisDestroyP(void *zaxisptr) +{ + zaxisDestroyKernel((zaxis_t *) zaxisptr); +} + +const char * +zaxisNamePtr(int zaxistype) +{ + const char *name = (zaxistype >= 0 && zaxistype < CDI_NumZaxistype) ? ZaxistypeEntry[zaxistype].longname + : ZaxistypeEntry[ZAXIS_GENERIC].longname; + return name; +} + +void +zaxisName(int zaxistype, char *zaxisname) +{ + strcpy(zaxisname, zaxisNamePtr(zaxistype)); +} + +// obsolete function +void +zaxisDefLtype(int zaxisID, int ltype) +{ + static bool printInfo = true; + if (printInfo) printInfo = cdiObsoleteInfo(__func__, "cdiDefKeyInt"); + + (void) cdiDefKeyInt(zaxisID, CDI_GLOBAL, CDI_KEY_TYPEOFFIRSTFIXEDSURFACE, ltype); +} + +/* +@Function zaxisDefName +@Title Define the name of a Z-axis + +@Prototype void zaxisDefName(int zaxisID, const char *name) +@Parameter + @Item zaxisID Z-axis ID, from a previous call to @fref{zaxisCreate}. + @Item name Name of the Z-axis. + +@Description +The function @func{zaxisDefName} defines the name of a Z-axis. + +@EndFunction +*/ +void +zaxisDefName(int zaxisID, const char *name) +{ + (void) cdiDefKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_NAME, name); +} + +/* +@Function zaxisDefLongname +@Title Define the longname of a Z-axis + +@Prototype void zaxisDefLongname(int zaxisID, const char *longname) +@Parameter + @Item zaxisID Z-axis ID, from a previous call to @fref{zaxisCreate}. + @Item longname Longname of the Z-axis. + +@Description +The function @func{zaxisDefLongname} defines the longname of a Z-axis. + +@EndFunction +*/ +void +zaxisDefLongname(int zaxisID, const char *longname) +{ + (void) cdiDefKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_LONGNAME, longname); +} + +/* +@Function zaxisDefUnits +@Title Define the units of a Z-axis + +@Prototype void zaxisDefUnits(int zaxisID, const char *units) +@Parameter + @Item zaxisID Z-axis ID, from a previous call to @fref{zaxisCreate}. + @Item units Units of the Z-axis. + +@Description +The function @func{zaxisDefUnits} defines the units of a Z-axis. + +@EndFunction +*/ +void +zaxisDefUnits(int zaxisID, const char *units) +{ + (void) cdiDefKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_UNITS, units); +} + +/* +@Function zaxisInqName +@Title Get the name of a Z-axis + +@Prototype void zaxisInqName(int zaxisID, char *name) +@Parameter + @Item zaxisID Z-axis ID, from a previous call to @fref{zaxisCreate} or @fref{vlistInqVarZaxis}. + @Item name Name of the Z-axis. The caller must allocate space for the + returned string. The maximum possible length, in characters, of + the string is given by the predefined constant @func{CDI_MAX_NAME}. + +@Description +The function @func{zaxisInqName} returns the name of a Z-axis. + +@Result +@func{zaxisInqName} returns the name of the Z-axis to the parameter name. + +@EndFunction +*/ +void +zaxisInqName(int zaxisID, char *name) +{ + int length = CDI_MAX_NAME; + (void) cdiInqKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_NAME, name, &length); +} + +const char * +zaxisInqNamePtr(int zaxisID) +{ + zaxis_t *zaxisptr = zaxis_to_pointer(zaxisID); + return cdiInqVarKeyString(&zaxisptr->keys, CDI_KEY_NAME); +} + +/* +@Function zaxisInqLongname +@Title Get the longname of a Z-axis + +@Prototype void zaxisInqLongname(int zaxisID, char *longname) +@Parameter + @Item zaxisID Z-axis ID, from a previous call to @fref{zaxisCreate} or @fref{vlistInqVarZaxis}. + @Item longname Longname of the Z-axis. The caller must allocate space for the + returned string. The maximum possible length, in characters, of + the string is given by the predefined constant @func{CDI_MAX_NAME}. + +@Description +The function @func{zaxisInqLongname} returns the longname of a Z-axis. + +@Result +@func{zaxisInqLongname} returns the longname of the Z-axis to the parameter longname. + +@EndFunction +*/ +void +zaxisInqLongname(int zaxisID, char *longname) +{ + int length = CDI_MAX_NAME; + (void) cdiInqKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_LONGNAME, longname, &length); +} + +/* +@Function zaxisInqUnits +@Title Get the units of a Z-axis + +@Prototype void zaxisInqUnits(int zaxisID, char *units) +@Parameter + @Item zaxisID Z-axis ID, from a previous call to @fref{zaxisCreate} or @fref{vlistInqVarZaxis}. + @Item units Units of the Z-axis. The caller must allocate space for the + returned string. The maximum possible length, in characters, of + the string is given by the predefined constant @func{CDI_MAX_NAME}. + +@Description +The function @func{zaxisInqUnits} returns the units of a Z-axis. + +@Result +@func{zaxisInqUnits} returns the units of the Z-axis to the parameter units. + +@EndFunction +*/ +void +zaxisInqUnits(int zaxisID, char *units) +{ + int length = CDI_MAX_NAME; + (void) cdiInqKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_UNITS, units, &length); +} + +void +zaxisInqStdname(int zaxisID, char *stdname) +{ + int length = CDI_MAX_NAME; + (void) cdiInqKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_STDNAME, stdname, &length); +} + +void +zaxisDefDatatype(int zaxisID, int datatype) +{ + cdiDefKeyInt(zaxisID, CDI_GLOBAL, CDI_KEY_DATATYPE, datatype); +} + +int +zaxisInqDatatype(int zaxisID) +{ + int datatype = 0; + cdiInqKeyInt(zaxisID, CDI_GLOBAL, CDI_KEY_DATATYPE, &datatype); + return datatype; +} + +void +zaxisDefPositive(int zaxisID, int positive) +{ + zaxis_t *zaxisptr = zaxis_to_pointer(zaxisID); + + if (zaxisptr->positive != (unsigned) positive) + { + zaxisptr->positive = (unsigned) positive; + reshSetStatus(zaxisID, &zaxisOps, RESH_DESYNC_IN_USE); + } +} + +int +zaxisInqPositive(int zaxisID) +{ + zaxis_t *zaxisptr = zaxis_to_pointer(zaxisID); + return (int) zaxisptr->positive; +} + +void +zaxisDefScalar(int zaxisID) +{ + zaxis_t *zaxisptr = zaxis_to_pointer(zaxisID); + + zaxisptr->scalar = 1; + reshSetStatus(zaxisID, &zaxisOps, RESH_DESYNC_IN_USE); +} + +int +zaxisInqScalar(int zaxisID) +{ + zaxis_t *zaxisptr = zaxis_to_pointer(zaxisID); + return zaxisptr->scalar; +} + +/* +@Function zaxisDefLevels +@Title Define the levels of a Z-axis + +@Prototype void zaxisDefLevels(int zaxisID, const double *levels) +@Parameter + @Item zaxisID Z-axis ID, from a previous call to @fref{zaxisCreate}. + @Item levels All levels of the Z-axis. + +@Description +The function @func{zaxisDefLevels} defines the levels of a Z-axis. + +@EndFunction +*/ +void +zaxisDefLevels(int zaxisID, const double *levels) +{ + if (levels) + { + zaxis_t *zaxisptr = zaxis_to_pointer(zaxisID); + const size_t size = (size_t) zaxisptr->size; + xassert(size); + + if (zaxisptr->vals == NULL && size) zaxisptr->vals = (double *) Malloc(size * sizeof(double)); + + double *vals = zaxisptr->vals; + + for (size_t ilev = 0; ilev < size; ++ilev) vals[ilev] = levels[ilev]; + + reshSetStatus(zaxisID, &zaxisOps, RESH_DESYNC_IN_USE); + } +} + +void +zaxisDefCvals(int zaxisID, const char **cvals, int clen) +{ +#ifndef USE_MPI + if (cvals && clen) + { + zaxis_t *zaxisptr = zaxis_to_pointer(zaxisID); + const size_t size = zaxisptr->size; + xassert(size); + + zaxisptr->clength = clen; + if (size) zaxisptr->cvals = (char **) Malloc(size * sizeof(char *)); + + for (size_t ilev = 0; ilev < size; ++ilev) + { + zaxisptr->cvals[ilev] = (char *) Malloc(clen * sizeof(char)); + memcpy(zaxisptr->cvals[ilev], cvals[ilev], clen * sizeof(char)); + } + reshSetStatus(zaxisID, &zaxisOps, RESH_DESYNC_IN_USE); + } +#else + Error("This function was disabled!"); +#endif +} + +/* +@Function zaxisDefLevel +@Title Define one level of a Z-axis + +@Prototype void zaxisDefLevel(int zaxisID, int levelID, double level) +@Parameter + @Item zaxisID Z-axis ID, from a previous call to @fref{zaxisCreate}. + @Item levelID Level identifier. + @Item level Level. + +@Description +The function @func{zaxisDefLevel} defines one level of a Z-axis. + +@EndFunction +*/ +void +zaxisDefLevel(int zaxisID, int levelID, double level) +{ + zaxis_t *zaxisptr = zaxis_to_pointer(zaxisID); + int size = zaxisptr->size; + xassert(size); + xassert(levelID >= 0 && levelID < size); + + if (zaxisptr->vals == NULL && size) zaxisptr->vals = (double *) Malloc((size_t) size * sizeof(double)); + + if (levelID >= 0 && levelID < size) zaxisptr->vals[levelID] = level; + + reshSetStatus(zaxisID, &zaxisOps, RESH_DESYNC_IN_USE); +} + +void +zaxisDefNlevRef(int zaxisID, int nlev) +{ + cdiDefKeyInt(zaxisID, CDI_GLOBAL, CDI_KEY_NLEV, nlev); +} + +int +zaxisInqNlevRef(int zaxisID) +{ + int nlev = 0; + cdiInqKeyInt(zaxisID, CDI_GLOBAL, CDI_KEY_NLEV, &nlev); + return nlev; +} + +/* +@Function zaxisDefNumber +@Title Define the reference number for a generalized Z-axis + +@Prototype void zaxisDefNumber(int zaxisID, int number) +@Parameter + @Item zaxisID Z-axis ID, from a previous call to @fref{zaxisCreate}. + @Item number Reference number for a generalized Z-axis. + +@Description +The function @func{zaxisDefNumber} defines the reference number for a generalized Z-axis. + +@EndFunction +*/ +void +zaxisDefNumber(int zaxisID, int number) +{ + cdiDefKeyInt(zaxisID, CDI_GLOBAL, CDI_KEY_NUMBEROFVGRIDUSED, number); +} + +/* +@Function zaxisInqNumber +@Title Get the reference number to a generalized Z-axis + +@Prototype int zaxisInqNumber(int zaxisID) +@Parameter + @Item zaxisID Z-axis ID, from a previous call to @fref{zaxisCreate} or @fref{vlistInqVarZaxis}. + +@Description +The function @func{zaxisInqNumber} returns the reference number to a generalized Z-axis. + +@Result +@func{zaxisInqNumber} returns the reference number to a generalized Z-axis. +@EndFunction +*/ +int +zaxisInqNumber(int zaxisID) +{ + int referenceNumber = 0; + cdiInqKeyInt(zaxisID, CDI_GLOBAL, CDI_KEY_NUMBEROFVGRIDUSED, &referenceNumber); + return referenceNumber; +} + +/* +@Function zaxisDefUUID +@Title Define the UUID for a genralized Z-axis + +@Prototype void zaxisDefUUID(int zaxisID, const char *uuid) +@Parameter + @Item zaxisID Z-axis ID, from a previous call to @fref{zaxisCreate}. + @Item uuid UUID for a generalized Z-axis. + +@Description +The function @func{zaxisDefUUID} defines the UUID for a generalized Z-axis. + +@EndFunction +*/ +void +zaxisDefUUID(int zaxisID, const unsigned char uuid[CDI_UUID_SIZE]) +{ + cdiDefKeyBytes(zaxisID, CDI_GLOBAL, CDI_KEY_UUID, uuid, CDI_UUID_SIZE); + + reshSetStatus(zaxisID, &zaxisOps, RESH_DESYNC_IN_USE); +} + +/* +@Function zaxisInqUUID +@Title Get the uuid to a generalized Z-axis + +@Prototype void zaxisInqUUID(int zaxisID, char *uuid) +@Parameter + @Item zaxisID Z-axis ID, from a previous call to @fref{zaxisCreate} or @fref{vlistInqVarZaxis}. + @Item uuid A user supplied buffer of at least 16 bytes. + +@Description +The function @func{zaxisInqUUID} returns the UUID to a generalized Z-axis. + +@Result +@func{zaxisInqUUID} returns the UUID to a generalized Z-axis to the parameter uuid. +@EndFunction +*/ +void +zaxisInqUUID(int zaxisID, unsigned char uuid[CDI_UUID_SIZE]) +{ + memset(uuid, 0, CDI_UUID_SIZE); + int length = CDI_UUID_SIZE; + cdiInqKeyBytes(zaxisID, CDI_GLOBAL, CDI_KEY_UUID, uuid, &length); +} + +/* +@Function zaxisInqLevel +@Title Get one level of a Z-axis + +@Prototype double zaxisInqLevel(int zaxisID, int levelID) +@Parameter + @Item zaxisID Z-axis ID, from a previous call to @fref{zaxisCreate} or @fref{vlistInqVarZaxis}. + @Item levelID Level index (range: 0 to nlevel-1). + +@Description +The function @func{zaxisInqLevel} returns one level of a Z-axis. + +@Result +@func{zaxisInqLevel} returns the level of a Z-axis. +@EndFunction +*/ +double +zaxisInqLevel(int zaxisID, int levelID) +{ + double level = 0; + zaxis_t *zaxisptr = zaxis_to_pointer(zaxisID); + if (zaxisptr->vals && levelID >= 0 && levelID < zaxisptr->size) level = zaxisptr->vals[levelID]; + + return level; +} + +double +zaxisInqLbound(int zaxisID, int levelID) +{ + double level = 0; + zaxis_t *zaxisptr = zaxis_to_pointer(zaxisID); + if (zaxisptr->lbounds && levelID >= 0 && levelID < zaxisptr->size) level = zaxisptr->lbounds[levelID]; + + return level; +} + +double +zaxisInqUbound(int zaxisID, int levelID) +{ + double level = 0; + zaxis_t *zaxisptr = zaxis_to_pointer(zaxisID); + if (zaxisptr->ubounds && levelID >= 0 && levelID < zaxisptr->size) level = zaxisptr->ubounds[levelID]; + + return level; +} + +const double * +zaxisInqLevelsPtr(int zaxisID) +{ + zaxis_t *zaxisptr = zaxis_to_pointer(zaxisID); + return zaxisptr->vals; +} + +#ifndef USE_MPI +char ** +zaxisInqCValsPtr(int zaxisID) +{ + zaxis_t *zaxisptr = zaxis_to_pointer(zaxisID); + return zaxisptr->cvals; +} +#endif + +/* +@Function zaxisInqLevels +@Title Get all levels of a Z-axis + +@Prototype void zaxisInqLevels(int zaxisID, double *levels) +@Parameter + @Item zaxisID Z-axis ID, from a previous call to @fref{zaxisCreate} or @fref{vlistInqVarZaxis}. + @Item levels Pointer to the location into which the levels are read. + The caller must allocate space for the returned values. + +@Description +The function @func{zaxisInqLevels} returns all levels of a Z-axis. + +@Result +@func{zaxisInqLevels} saves all levels to the parameter @func{levels}. +@EndFunction +*/ +int +zaxisInqLevels(int zaxisID, double *levels) +{ + zaxis_t *zaxisptr = zaxis_to_pointer(zaxisID); + + int size = 0; + if (zaxisptr->vals) + { + size = zaxisptr->size; + + if (levels) + for (int i = 0; i < size; i++) levels[i] = zaxisptr->vals[i]; + } + + return size; +} + +int +zaxisInqCLen(int zaxisID) +{ + int clen = 0; +#ifndef USE_MPI + zaxis_t *zaxisptr = zaxis_to_pointer(zaxisID); + if (zaxisptr->cvals && zaxisptr->clength) clen = zaxisptr->clength; +#endif + + return clen; +} + +int +zaxisInqCVals(int zaxisID, char ***clevels) +{ + int size = 0; +#ifndef USE_MPI + zaxis_t *zaxisptr = zaxis_to_pointer(zaxisID); + if (zaxisptr->cvals) + { + size = zaxisptr->size; + const size_t clen = zaxisptr->clength; + if (size && clen) + { + (*clevels) = (char **) Malloc(size * sizeof(char *)); + for (int i = 0; i < size; i++) + { + (*clevels)[i] = (char *) Malloc(clen * sizeof(char)); + memcpy((*clevels)[i], zaxisptr->cvals[i], clen * sizeof(char)); + } + } + } +#endif + + return size; +} + +int +zaxisInqLbounds(int zaxisID, double *lbounds) +{ + int size = 0; + zaxis_t *zaxisptr = zaxis_to_pointer(zaxisID); + if (zaxisptr->lbounds) + { + size = zaxisptr->size; + + if (lbounds) + for (int i = 0; i < size; i++) lbounds[i] = zaxisptr->lbounds[i]; + } + + return size; +} + +int +zaxisInqUbounds(int zaxisID, double *ubounds) +{ + int size = 0; + zaxis_t *zaxisptr = zaxis_to_pointer(zaxisID); + if (zaxisptr->ubounds) + { + size = zaxisptr->size; + + if (ubounds) + for (int i = 0; i < size; i++) ubounds[i] = zaxisptr->ubounds[i]; + } + + return size; +} + +int +zaxisInqWeights(int zaxisID, double *weights) +{ + int size = 0; + zaxis_t *zaxisptr = zaxis_to_pointer(zaxisID); + if (zaxisptr->weights) + { + size = zaxisptr->size; + + if (weights) + for (int i = 0; i < size; i++) weights[i] = zaxisptr->weights[i]; + } + + return size; +} + +int +zaxisInqLevelID(int zaxisID, double level) +{ + int levelID = CDI_UNDEFID; + zaxis_t *zaxisptr = zaxis_to_pointer(zaxisID); + if (zaxisptr->vals) + { + int size = zaxisptr->size; + for (int i = 0; i < size; i++) + if (fabs(level - zaxisptr->vals[i]) < DBL_EPSILON) + { + levelID = i; + break; + } + } + + return levelID; +} + +/* +@Function zaxisInqType +@Title Get the type of a Z-axis + +@Prototype int zaxisInqType(int zaxisID) +@Parameter + @Item zaxisID Z-axis ID, from a previous call to @fref{zaxisCreate} or @fref{vlistInqVarZaxis}. + +@Description +The function @func{zaxisInqType} returns the type of a Z-axis. + +@Result +@func{zaxisInqType} returns the type of the Z-axis, +one of the set of predefined CDI Z-axis types. +The valid CDI Z-axis types are @func{ZAXIS_GENERIC}, @func{ZAXIS_SURFACE}, +@func{ZAXIS_HYBRID}, @func{ZAXIS_SIGMA}, @func{ZAXIS_PRESSURE}, @func{ZAXIS_HEIGHT}, +@func{ZAXIS_ISENTROPIC}, @func{ZAXIS_ALTITUDE}, @func{ZAXIS_MEANSEA}, @func{ZAXIS_TOA}, +@func{ZAXIS_SEA_BOTTOM}, @func{ZAXIS_ATMOSPHERE}, @func{ZAXIS_CLOUD_BASE}, +@func{ZAXIS_CLOUD_TOP}, @func{ZAXIS_ISOTHERM_ZERO}, @func{ZAXIS_SNOW}, +@func{ZAXIS_LAKE_BOTTOM}, @func{ZAXIS_SEDIMENT_BOTTOM}, @func{ZAXIS_SEDIMENT_BOTTOM_TA}, +@func{ZAXIS_SEDIMENT_BOTTOM_TW}, @func{ZAXIS_MIX_LAYER}, +@func{ZAXIS_DEPTH_BELOW_SEA} and @func{ZAXIS_DEPTH_BELOW_LAND}. + +@EndFunction +*/ +int +zaxisInqType(int zaxisID) +{ + zaxis_t *zaxisptr = zaxis_to_pointer(zaxisID); + return zaxisptr->type; +} + +/* +@Function zaxisInqSize +@Title Get the size of a Z-axis + +@Prototype int zaxisInqSize(int zaxisID) +@Parameter + @Item zaxisID Z-axis ID, from a previous call to @fref{zaxisCreate} or @fref{vlistInqVarZaxis}. + +@Description +The function @func{zaxisInqSize} returns the size of a Z-axis. + +@Result +@func{zaxisInqSize} returns the number of levels of a Z-axis. + +@EndFunction +*/ +int +zaxisInqSize(int zaxisID) +{ + zaxis_t *zaxisptr = zaxis_to_pointer(zaxisID); + return zaxisptr->size; +} + +void +cdiCheckZaxis(int zaxisID) +{ + zaxis_t *zaxisptr = zaxis_to_pointer(zaxisID); + + if (zaxisInqType(zaxisID) == ZAXIS_GENERIC && zaxisptr->vals) + { + int size = zaxisptr->size; + if (size > 1) + { + /* check direction */ + if (!zaxisptr->direction) + { + int ups = 0, downs = 0; + for (int i = 1; i < size; i++) + { + ups += (zaxisptr->vals[i] > zaxisptr->vals[i - 1]); + downs += (zaxisptr->vals[i] < zaxisptr->vals[i - 1]); + } + if (ups == size - 1) + { + zaxisptr->direction = LevelUp; + } + else if (downs == size - 1) + { + zaxisptr->direction = LevelDown; + } + else /* !zaxisptr->direction */ + { + Warning("Direction undefined for zaxisID %d", zaxisID); + } + } + } + } +} + +void +zaxisDefVct(int zaxisID, int size, const double *vct) +{ + zaxis_t *zaxisptr = zaxis_to_pointer(zaxisID); + + if (zaxisptr->vct == 0 || zaxisptr->vctsize != size) + { + zaxisptr->vctsize = size; + zaxisptr->vct = (double *) Realloc(zaxisptr->vct, (size_t) size * sizeof(double)); + } + + if (vct) memcpy(zaxisptr->vct, vct, (size_t) size * sizeof(double)); + reshSetStatus(zaxisID, &zaxisOps, RESH_DESYNC_IN_USE); +} + +void +zaxisInqVct(int zaxisID, double *vct) +{ + zaxis_t *zaxisptr = zaxis_to_pointer(zaxisID); + memcpy(vct, zaxisptr->vct, (size_t) zaxisptr->vctsize * sizeof(double)); +} + +int +zaxisInqVctSize(int zaxisID) +{ + zaxis_t *zaxisptr = zaxis_to_pointer(zaxisID); + return zaxisptr->vctsize; +} + +const double * +zaxisInqVctPtr(int zaxisID) +{ + zaxis_t *zaxisptr = zaxis_to_pointer(zaxisID); + return zaxisptr->vct; +} + +void +zaxisDefLbounds(int zaxisID, const double *lbounds) +{ + zaxis_t *zaxisptr = zaxis_to_pointer(zaxisID); + + const size_t size = (size_t) zaxisptr->size; + + if (CDI_Debug) + if (zaxisptr->lbounds) Warning("Lower bounds already defined for zaxisID = %d", zaxisID); + + if (zaxisptr->lbounds == NULL) zaxisptr->lbounds = (double *) Malloc(size * sizeof(double)); + + if (lbounds) memcpy(zaxisptr->lbounds, lbounds, size * sizeof(double)); + reshSetStatus(zaxisID, &zaxisOps, RESH_DESYNC_IN_USE); +} + +void +zaxisDefUbounds(int zaxisID, const double *ubounds) +{ + zaxis_t *zaxisptr = zaxis_to_pointer(zaxisID); + + const size_t size = (size_t) zaxisptr->size; + + if (CDI_Debug) + if (zaxisptr->ubounds) Warning("Upper bounds already defined for zaxisID = %d", zaxisID); + + if (zaxisptr->ubounds == NULL) zaxisptr->ubounds = (double *) Malloc(size * sizeof(double)); + + if (ubounds) memcpy(zaxisptr->ubounds, ubounds, size * sizeof(double)); + reshSetStatus(zaxisID, &zaxisOps, RESH_DESYNC_IN_USE); +} + +void +zaxisDefWeights(int zaxisID, const double *weights) +{ + zaxis_t *zaxisptr = zaxis_to_pointer(zaxisID); + + const size_t size = (size_t) zaxisptr->size; + + if (CDI_Debug) + if (zaxisptr->weights != NULL) Warning("Weights already defined for zaxisID = %d", zaxisID); + + if (zaxisptr->weights == NULL) zaxisptr->weights = (double *) Malloc(size * sizeof(double)); + + memcpy(zaxisptr->weights, weights, size * sizeof(double)); + reshSetStatus(zaxisID, &zaxisOps, RESH_DESYNC_IN_USE); +} + +void +zaxisChangeType(int zaxisID, int zaxistype) +{ + zaxis_t *zaxisptr = zaxis_to_pointer(zaxisID); + zaxisptr->type = zaxistype; +} + +void +zaxisResize(int zaxisID, int size) +{ + zaxis_t *zaxisptr = zaxis_to_pointer(zaxisID); + + xassert(size >= 0); + + zaxisptr->size = size; + + if (zaxisptr->vals) zaxisptr->vals = (double *) Realloc(zaxisptr->vals, (size_t) size * sizeof(double)); +} + +static inline void +zaxisCopyKeyStr(zaxis_t *zaxisptr1, zaxis_t *zaxisptr2, int key) +{ + cdi_key_t *keyp = find_key(&zaxisptr1->keys, key); + if (keyp && keyp->type == KEY_BYTES) + cdiDefVarKeyBytes(&zaxisptr2->keys, key, (const unsigned char *) keyp->v.s, (int) keyp->length); +} + +int +zaxisDuplicate(int zaxisID) +{ + zaxis_t *zaxisptr = zaxis_to_pointer(zaxisID); + + int zaxistype = zaxisInqType(zaxisID); + int zaxissize = zaxisInqSize(zaxisID); + + int zaxisIDnew = zaxisCreate(zaxistype, zaxissize); + zaxis_t *zaxisptrnew = zaxis_to_pointer(zaxisIDnew); + + zaxis_copy(zaxisptrnew, zaxisptr); + + zaxisCopyKeyStr(zaxisptr, zaxisptrnew, CDI_KEY_NAME); + zaxisCopyKeyStr(zaxisptr, zaxisptrnew, CDI_KEY_LONGNAME); + zaxisCopyKeyStr(zaxisptr, zaxisptrnew, CDI_KEY_UNITS); + + if (zaxisptr->vals) + { + const size_t size = (size_t) zaxissize; + zaxisptrnew->vals = (double *) Malloc(size * sizeof(double)); + memcpy(zaxisptrnew->vals, zaxisptr->vals, size * sizeof(double)); + } + + if (zaxisptr->lbounds) + { + const size_t size = (size_t) zaxissize; + zaxisptrnew->lbounds = (double *) Malloc(size * sizeof(double)); + memcpy(zaxisptrnew->lbounds, zaxisptr->lbounds, size * sizeof(double)); + } + + if (zaxisptr->ubounds) + { + const size_t size = (size_t) zaxissize; + zaxisptrnew->ubounds = (double *) Malloc(size * sizeof(double)); + memcpy(zaxisptrnew->ubounds, zaxisptr->ubounds, size * sizeof(double)); + } + + if (zaxisptr->vct) + { + const size_t size = (size_t) zaxisptr->vctsize; + if (size) + { + zaxisptrnew->vctsize = (int) size; + zaxisptrnew->vct = (double *) Malloc(size * sizeof(double)); + memcpy(zaxisptrnew->vct, zaxisptr->vct, size * sizeof(double)); + } + } + + zaxisptrnew->atts.nelems = 0; + cdiCopyAtts(zaxisID, CDI_GLOBAL, zaxisIDnew, CDI_GLOBAL); + + return zaxisIDnew; +} + +static void +zaxisPrintKernel(zaxis_t *zaxisptr, FILE *fp) +{ + xassert(zaxisptr); + + int zaxisID = zaxisptr->self; + int datatype = CDI_UNDEFID; + cdiInqKeyInt(zaxisID, CDI_GLOBAL, CDI_KEY_DATATYPE, &datatype); + + int type = zaxisptr->type; + int nlevels = zaxisptr->size; + + int dig = (datatype == CDI_DATATYPE_FLT64) ? 15 : 7; + + fprintf(fp, "zaxistype = %s\n", zaxisNamePtr(type)); + fprintf(fp, "size = %d\n", nlevels); + if (nlevels == 1) + { + const bool zscalar = (bool) zaxisptr->scalar; + if (zscalar) fprintf(fp, "scalar = true\n"); + } + + const char *string = cdiInqVarKeyString(&zaxisptr->keys, CDI_KEY_NAME); + if (string[0]) fprintf(fp, "name = %s\n", string); + string = cdiInqVarKeyString(&zaxisptr->keys, CDI_KEY_LONGNAME); + if (string[0]) fprintf(fp, "longname = %s\n", string); + string = cdiInqVarKeyString(&zaxisptr->keys, CDI_KEY_UNITS); + if (string[0]) fprintf(fp, "units = %s\n", string); + + if (zaxisptr->vals) + { + int nbyte0 = fprintf(fp, "levels = "); + int nbyte = nbyte0; + for (int levelID = 0; levelID < nlevels; levelID++) + { + if (nbyte > 80) + { + fprintf(fp, "\n"); + fprintf(fp, "%*s", nbyte0, ""); + nbyte = nbyte0; + } + nbyte += fprintf(fp, "%.*g ", dig, zaxisptr->vals[levelID]); + } + fprintf(fp, "\n"); + } + + if (zaxisptr->lbounds && zaxisptr->ubounds) + { + int nbyte0 = fprintf(fp, "lbounds = "); + int nbyte = nbyte0; + for (int levelID = 0; levelID < nlevels; levelID++) + { + if (nbyte > 80) + { + fprintf(fp, "\n"); + fprintf(fp, "%*s", nbyte0, ""); + nbyte = nbyte0; + } + nbyte += fprintf(fp, "%.*g ", dig, zaxisptr->lbounds[levelID]); + } + fprintf(fp, "\n"); + + nbyte0 = fprintf(fp, "ubounds = "); + nbyte = nbyte0; + for (int levelID = 0; levelID < nlevels; levelID++) + { + if (nbyte > 80) + { + fprintf(fp, "\n"); + fprintf(fp, "%*s", nbyte0, ""); + nbyte = nbyte0; + } + nbyte += fprintf(fp, "%.*g ", dig, zaxisptr->ubounds[levelID]); + } + fprintf(fp, "\n"); + } + + if (type == ZAXIS_HYBRID || type == ZAXIS_HYBRID_HALF) + { + int vctsize = zaxisptr->vctsize; + const double *vct = zaxisptr->vct; + fprintf(fp, "vctsize = %d\n", vctsize); + if (vctsize) + { + int nbyte0 = fprintf(fp, "vct = "); + int nbyte = nbyte0; + for (int i = 0; i < vctsize; i++) + { + if (nbyte > 70 || i == vctsize / 2) + { + fprintf(fp, "\n%*s", nbyte0, ""); + nbyte = nbyte0; + } + nbyte += fprintf(fp, "%.15g ", vct[i]); + } + fprintf(fp, "\n"); + } + } +} + +static void +zaxisPrintP(void *voidptr, FILE *fp) +{ + zaxis_t *zaxisptr = (zaxis_t *) voidptr; + + xassert(zaxisptr); + + zaxisPrintKernel(zaxisptr, fp); +} + +static int +zaxisCompareP(zaxis_t *z1, zaxis_t *z2) +{ + enum + { + differ = 1 + }; + int diff = 0; + xassert(z1 && z2); + + diff |= (z1->type != z2->type) + | (cdiInqVarKeyInt(&z1->keys, CDI_KEY_TYPEOFFIRSTFIXEDSURFACE) + != cdiInqVarKeyInt(&z2->keys, CDI_KEY_TYPEOFFIRSTFIXEDSURFACE)) + | (cdiInqVarKeyInt(&z1->keys, CDI_KEY_DATATYPE) != cdiInqVarKeyInt(&z2->keys, CDI_KEY_DATATYPE)) + | (z1->direction != z2->direction) | (z1->size != z2->size) | (z1->vctsize != z2->vctsize) + | (z1->positive != z2->positive); + + if (diff) return differ; + + int size = z1->size; + int anyPresent = 0; + int present = (z1->vals != NULL); + diff |= (present ^ (z2->vals != NULL)); + anyPresent |= present; + if (!diff && present) + { + const double *p = z1->vals, *q = z2->vals; + for (int i = 0; i < size; i++) diff |= IS_NOT_EQUAL(p[i], q[i]); + } + + present = (z1->lbounds != NULL); + diff |= (present ^ (z2->lbounds != NULL)); + anyPresent |= present; + if (!diff && present) + { + const double *p = z1->lbounds, *q = z2->lbounds; + for (int i = 0; i < size; i++) diff |= IS_NOT_EQUAL(p[i], q[i]); + } + + present = (z1->ubounds != NULL); + diff |= (present ^ (z2->ubounds != NULL)); + anyPresent |= present; + if (!diff && present) + { + const double *p = z1->ubounds, *q = z2->ubounds; + for (int i = 0; i < size; ++i) diff |= IS_NOT_EQUAL(p[i], q[i]); + } + + present = (z1->weights != NULL); + diff |= (present ^ (z2->weights != NULL)); + anyPresent |= present; + if (!diff && present) + { + const double *p = z1->weights, *q = z2->weights; + for (int i = 0; i < size; ++i) diff |= IS_NOT_EQUAL(p[i], q[i]); + } + + present = (z1->vct != NULL); + diff |= (present ^ (z2->vct != NULL)); + if (!diff && present) + { + int vctsize = z1->vctsize; + xassert(vctsize); + const double *p = z1->vct, *q = z2->vct; + for (int i = 0; i < vctsize; ++i) diff |= IS_NOT_EQUAL(p[i], q[i]); + } + + if (anyPresent) xassert(size); + + diff |= strcmp(cdiInqVarKeyString(&z1->keys, CDI_KEY_NAME), cdiInqVarKeyString(&z2->keys, CDI_KEY_NAME)) + | strcmp(cdiInqVarKeyString(&z1->keys, CDI_KEY_LONGNAME), cdiInqVarKeyString(&z2->keys, CDI_KEY_LONGNAME)) + | strcmp(cdiInqVarKeyString(&z1->keys, CDI_KEY_STDNAME), cdiInqVarKeyString(&z2->keys, CDI_KEY_STDNAME)) + | strcmp(cdiInqVarKeyString(&z1->keys, CDI_KEY_UNITS), cdiInqVarKeyString(&z2->keys, CDI_KEY_UNITS)); + + return diff != 0; +} + +static int +zaxisTxCode(void *zaxisPtr) +{ + (void) zaxisPtr; + return ZAXIS; +} + +enum +{ + ZAXIS_PACK_INT_SELF, + ZAXIS_PACK_INT_TYPE, + ZAXIS_PACK_INT_SIZE, + ZAXIS_PACK_INT_DIRECTION, + ZAXIS_PACK_INT_VCTSIZE, + ZAXIS_PACK_INT_MEMBERMASK, + zaxisNint +}; + +enum +{ + vals = 1 << 0, + lbounds = 1 << 1, + ubounds = 1 << 2, + weights = 1 << 3, + vct = 1 << 4, +}; + +static int +zaxisGetMemberMask(zaxis_t *zaxisP) +{ + int memberMask = 0; + + if (zaxisP->vals) memberMask |= vals; + if (zaxisP->lbounds) memberMask |= lbounds; + if (zaxisP->ubounds) memberMask |= ubounds; + if (zaxisP->weights) memberMask |= weights; + if (zaxisP->vct) memberMask |= vct; + + return memberMask; +} + +static int +zaxisGetPackSize(void *voidP, void *context) +{ + zaxis_t *zaxisP = (zaxis_t *) voidP; + int packBufferSize = serializeGetSize(zaxisNint, CDI_DATATYPE_INT, context) + serializeGetSize(1, CDI_DATATYPE_UINT32, context); + + if (zaxisP->vals || zaxisP->lbounds || zaxisP->ubounds || zaxisP->weights) xassert(zaxisP->size); + + if (zaxisP->vals) + packBufferSize + += serializeGetSize(zaxisP->size, CDI_DATATYPE_FLT64, context) + serializeGetSize(1, CDI_DATATYPE_UINT32, context); + + if (zaxisP->lbounds) + packBufferSize + += serializeGetSize(zaxisP->size, CDI_DATATYPE_FLT64, context) + serializeGetSize(1, CDI_DATATYPE_UINT32, context); + + if (zaxisP->ubounds) + packBufferSize + += serializeGetSize(zaxisP->size, CDI_DATATYPE_FLT64, context) + serializeGetSize(1, CDI_DATATYPE_UINT32, context); + + if (zaxisP->weights) + packBufferSize + += serializeGetSize(zaxisP->size, CDI_DATATYPE_FLT64, context) + serializeGetSize(1, CDI_DATATYPE_UINT32, context); + + if (zaxisP->vct) + { + xassert(zaxisP->vctsize); + packBufferSize + += serializeGetSize(zaxisP->vctsize, CDI_DATATYPE_FLT64, context) + serializeGetSize(1, CDI_DATATYPE_UINT32, context); + } + + packBufferSize += serializeKeysGetPackSize(&zaxisP->keys, context); + + packBufferSize += serializeGetSize(1, CDI_DATATYPE_UINT, context); + + return packBufferSize; +} + +int +zaxisUnpack(char *unpackBuffer, int unpackBufferSize, int *unpackBufferPos, int originNamespace, void *context, int force_id) +{ + int intBuffer[zaxisNint], memberMask; + uint32_t d; + + serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, intBuffer, zaxisNint, CDI_DATATYPE_INT, context); + serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, &d, 1, CDI_DATATYPE_UINT32, context); + + xassert(cdiCheckSum(CDI_DATATYPE_INT, zaxisNint, intBuffer) == d); + + zaxisInit(); + + zaxis_t *zaxisP = zaxisNewEntry(force_id ? namespaceAdaptKey(intBuffer[ZAXIS_PACK_INT_SELF], originNamespace) : CDI_UNDEFID); + + zaxisP->type = intBuffer[ZAXIS_PACK_INT_TYPE]; + zaxisP->size = intBuffer[ZAXIS_PACK_INT_SIZE]; + zaxisP->direction = intBuffer[ZAXIS_PACK_INT_DIRECTION]; + zaxisP->vctsize = intBuffer[ZAXIS_PACK_INT_VCTSIZE]; + memberMask = intBuffer[ZAXIS_PACK_INT_MEMBERMASK]; + + if (memberMask & vals) + { + int size = zaxisP->size; + xassert(size >= 0); + + zaxisP->vals = (double *) Malloc((size_t) size * sizeof(double)); + serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, zaxisP->vals, size, CDI_DATATYPE_FLT64, context); + serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, &d, 1, CDI_DATATYPE_UINT32, context); + xassert(cdiCheckSum(CDI_DATATYPE_FLT, size, zaxisP->vals) == d); + } + + if (memberMask & lbounds) + { + int size = zaxisP->size; + xassert(size >= 0); + + zaxisP->lbounds = (double *) Malloc((size_t) size * sizeof(double)); + serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, zaxisP->lbounds, size, CDI_DATATYPE_FLT64, context); + serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, &d, 1, CDI_DATATYPE_UINT32, context); + xassert(cdiCheckSum(CDI_DATATYPE_FLT, size, zaxisP->lbounds) == d); + } + + if (memberMask & ubounds) + { + int size = zaxisP->size; + xassert(size >= 0); + + zaxisP->ubounds = (double *) Malloc((size_t) size * sizeof(double)); + serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, zaxisP->ubounds, size, CDI_DATATYPE_FLT64, context); + serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, &d, 1, CDI_DATATYPE_UINT32, context); + xassert(cdiCheckSum(CDI_DATATYPE_FLT, size, zaxisP->ubounds) == d); + } + + if (memberMask & weights) + { + int size = zaxisP->size; + xassert(size >= 0); + + zaxisP->weights = (double *) Malloc((size_t) size * sizeof(double)); + serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, zaxisP->weights, size, CDI_DATATYPE_FLT64, context); + serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, &d, 1, CDI_DATATYPE_UINT32, context); + xassert(cdiCheckSum(CDI_DATATYPE_FLT, size, zaxisP->weights) == d); + } + + if (memberMask & vct) + { + int size = zaxisP->vctsize; + xassert(size >= 0); + + zaxisP->vct = (double *) Malloc((size_t) size * sizeof(double)); + serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, zaxisP->vct, size, CDI_DATATYPE_FLT64, context); + serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, &d, 1, CDI_DATATYPE_UINT32, context); + xassert(cdiCheckSum(CDI_DATATYPE_FLT64, size, zaxisP->vct) == d); + } + + serializeKeysUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, &zaxisP->keys, context); + + serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, &zaxisP->positive, 1, CDI_DATATYPE_UINT, context); + + reshSetStatus(zaxisP->self, &zaxisOps, reshGetStatus(zaxisP->self, &zaxisOps) & ~RESH_SYNC_BIT); + return zaxisP->self; +} + +static void +zaxisPack(void *voidP, void *packBuffer, int packBufferSize, int *packBufferPos, void *context) +{ + zaxis_t *zaxisP = (zaxis_t *) voidP; + int intBuffer[zaxisNint]; + int memberMask; + uint32_t d; + + intBuffer[ZAXIS_PACK_INT_SELF] = zaxisP->self; + intBuffer[ZAXIS_PACK_INT_TYPE] = zaxisP->type; + intBuffer[ZAXIS_PACK_INT_SIZE] = zaxisP->size; + intBuffer[ZAXIS_PACK_INT_DIRECTION] = zaxisP->direction; + intBuffer[ZAXIS_PACK_INT_VCTSIZE] = zaxisP->vctsize; + intBuffer[ZAXIS_PACK_INT_MEMBERMASK] = memberMask = zaxisGetMemberMask(zaxisP); + + serializePack(intBuffer, zaxisNint, CDI_DATATYPE_INT, packBuffer, packBufferSize, packBufferPos, context); + d = cdiCheckSum(CDI_DATATYPE_INT, zaxisNint, intBuffer); + serializePack(&d, 1, CDI_DATATYPE_UINT32, packBuffer, packBufferSize, packBufferPos, context); + + if (memberMask & vals) + { + xassert(zaxisP->size); + serializePack(zaxisP->vals, zaxisP->size, CDI_DATATYPE_FLT64, packBuffer, packBufferSize, packBufferPos, context); + d = cdiCheckSum(CDI_DATATYPE_FLT, zaxisP->size, zaxisP->vals); + serializePack(&d, 1, CDI_DATATYPE_UINT32, packBuffer, packBufferSize, packBufferPos, context); + } + + if (memberMask & lbounds) + { + xassert(zaxisP->size); + serializePack(zaxisP->lbounds, zaxisP->size, CDI_DATATYPE_FLT64, packBuffer, packBufferSize, packBufferPos, context); + d = cdiCheckSum(CDI_DATATYPE_FLT, zaxisP->size, zaxisP->lbounds); + serializePack(&d, 1, CDI_DATATYPE_UINT32, packBuffer, packBufferSize, packBufferPos, context); + } + + if (memberMask & ubounds) + { + xassert(zaxisP->size); + + serializePack(zaxisP->ubounds, zaxisP->size, CDI_DATATYPE_FLT64, packBuffer, packBufferSize, packBufferPos, context); + d = cdiCheckSum(CDI_DATATYPE_FLT, zaxisP->size, zaxisP->ubounds); + serializePack(&d, 1, CDI_DATATYPE_UINT32, packBuffer, packBufferSize, packBufferPos, context); + } + + if (memberMask & weights) + { + xassert(zaxisP->size); + + serializePack(zaxisP->weights, zaxisP->size, CDI_DATATYPE_FLT64, packBuffer, packBufferSize, packBufferPos, context); + d = cdiCheckSum(CDI_DATATYPE_FLT, zaxisP->size, zaxisP->weights); + serializePack(&d, 1, CDI_DATATYPE_UINT32, packBuffer, packBufferSize, packBufferPos, context); + } + + if (memberMask & vct) + { + xassert(zaxisP->vctsize); + + serializePack(zaxisP->vct, zaxisP->vctsize, CDI_DATATYPE_FLT64, packBuffer, packBufferSize, packBufferPos, context); + d = cdiCheckSum(CDI_DATATYPE_FLT64, zaxisP->vctsize, zaxisP->vct); + serializePack(&d, 1, CDI_DATATYPE_UINT32, packBuffer, packBufferSize, packBufferPos, context); + } + + serializeKeysPack(&zaxisP->keys, packBuffer, packBufferSize, packBufferPos, context); + + serializePack(&zaxisP->positive, 1, CDI_DATATYPE_UINT, packBuffer, packBufferSize, packBufferPos, context); +} + +void +cdiZaxisGetIndexList(unsigned nzaxis, int *zaxisResHs) +{ + reshGetResHListOfType(nzaxis, zaxisResHs, &zaxisOps); +} + +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ +static const char cdi_libvers[] = "2.2.0"; +const char * +cdiLibraryVersion(void) +{ + return cdi_libvers; +} +#if defined (HAVE_CF_INTERFACE) +#undef realloc +#undef malloc +#undef calloc +#undef free +#undef DOUBLE_PRECISION +/* cfortran.h 4.4 */ +/* http://www-zeus.desy.de/~burow/cfortran/ */ +/* Burkhard Burow burow@desy.de 1990 - 2002. */ + +#ifndef __CFORTRAN_LOADED +#define __CFORTRAN_LOADED + +// clang-format off + +/* + 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. +*/ + +/* THIS PACKAGE, I.E. CFORTRAN.H, THIS DOCUMENT, AND THE CFORTRAN.H EXAMPLE +PROGRAMS ARE PROPERTY OF THE AUTHOR WHO RESERVES ALL RIGHTS. THIS PACKAGE AND +THE CODE IT PRODUCES MAY BE FREELY DISTRIBUTED WITHOUT FEES, SUBJECT +(AT YOUR CHOICE) EITHER TO THE GNU LIBRARY GENERAL PUBLIC LICENSE +AT http://www.gnu.org/licenses/lgpl.html OR TO THE FOLLOWING RESTRICTIONS: +- YOU MUST ACCOMPANY ANY COPIES OR DISTRIBUTION WITH THIS (UNALTERED) NOTICE. +- YOU MAY NOT RECEIVE MONEY FOR THE DISTRIBUTION OR FOR ITS MEDIA + (E.G. TAPE, DISK, COMPUTER, PAPER.) +- YOU MAY NOT PREVENT OTHERS FROM COPYING IT FREELY. +- YOU MAY NOT DISTRIBUTE MODIFIED VERSIONS WITHOUT CLEARLY DOCUMENTING YOUR + CHANGES AND NOTIFYING THE AUTHOR. +- YOU MAY NOT MISREPRESENTED THE ORIGIN OF THIS SOFTWARE, EITHER BY EXPLICIT + CLAIM OR BY OMISSION. + +THE INTENT OF THE ABOVE TERMS IS TO ENSURE THAT THE CFORTRAN.H PACKAGE NOT BE +USED FOR PROFIT MAKING ACTIVITIES UNLESS SOME ROYALTY ARRANGEMENT IS ENTERED +INTO WITH ITS AUTHOR. + +THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER +EXPRESSED OR IMPLIED. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST +OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. THE AUTHOR IS NOT RESPONSIBLE +FOR ANY SUPPORT OR SERVICE OF THE CFORTRAN.H PACKAGE. + + Burkhard Burow + burow@desy.de +*/ + +/* The following modifications were made by the authors of CFITSIO or by me. + * They are flagged below with CFITSIO, the author's initials, or KMCCARTY. + * PDW = Peter Wilson + * DM = Doug Mink + * LEB = Lee E Brotzman + * MR = Martin Reinecke + * WDP = William D Pence + * BR = Bastien ROUCARIES + * -- Kevin McCarty, for Debian (19 Dec. 2005) */ + +/******* + Modifications: + Oct 1997: Changed symbol name extname to appendus (PDW/HSTX) + (Conflicted with a common variable name in FTOOLS) + Nov 1997: If g77Fortran defined, also define f2cFortran (PDW/HSTX) + Feb 1998: Let VMS see the NUM_ELEMS code. Lets programs treat + single strings as vectors with single elements + Nov 1999: If macintoxh defined, also define f2cfortran (for Mac OS-X) + Apr 2000: If WIN32 defined, also define PowerStationFortran and + VISUAL_CPLUSPLUS (Visual C++) + Jun 2000: If __GNUC__ and linux defined, also define f2cFortran + (linux/gcc environment detection) + Apr 2002: If __CYGWIN__ is defined, also define f2cFortran + Nov 2002: If __APPLE__ defined, also define f2cfortran (for Mac OS-X) + + Nov 2003: If __INTEL_COMPILER or INTEL_COMPILER defined, also define + f2cFortran (KMCCARTY) + Dec 2005: If f2cFortran is defined, enforce REAL functions in FORTRAN + returning "double" in C. This was one of the items on + Burkhard's TODO list. (KMCCARTY) + Dec 2005: Modifications to support 8-byte integers. (MR) + USE AT YOUR OWN RISK! + Feb 2006 Added logic to typedef the symbol 'LONGLONG' to an appropriate + intrinsic 8-byte integer datatype (WDP) + Apr 2006: Modifications to support gfortran (and g77 with -fno-f2c flag) + since by default it returns "float" for FORTRAN REAL function. + (KMCCARTY) + May 2008: Revert commenting out of "extern" in COMMON_BLOCK_DEF macro. + Add braces around do-nothing ";" in 3 empty while blocks to + get rid of compiler warnings. Thanks to ROOT developers + Jacek Holeczek and Rene Brun for these suggestions. (KMCCARTY) + Aug 2008: If __GNUC__ is defined and no FORTRAN compiler is specified + via a #define or -D, default to gfortran behavior rather than + g77 behavior. (KMCCARTY) + Oct 2009: Add warning if guessing default fortran. Move g77 above guessing bloc + *******/ + +/* + Avoid symbols already used by compilers and system *.h: + __ - OSF1 zukal06 V3.0 347 alpha, cc -c -std1 cfortest.c + +*/ + +/* + Determine what 8-byte integer data type is available. + 'long long' is now supported by most compilers, but older + MS Visual C++ compilers before V7.0 use '__int64' instead. (WDP) +*/ + +#ifndef LONGLONG_TYPE /* this may have been previously defined */ +#if defined(_MSC_VER) /* Microsoft Visual C++ */ + +#if (_MSC_VER < 1300) /* versions earlier than V7.0 do not have 'long long' */ + typedef __int64 LONGLONG; +#else /* newer versions do support 'long long' */ + typedef long long LONGLONG; +#endif + +#else + typedef long long LONGLONG; +#endif + +#define LONGLONG_TYPE +#endif + + +/* First prepare for the C compiler. */ + +#ifndef ANSI_C_preprocessor /* i.e. user can override. */ +#ifdef __CF__KnR +#define ANSI_C_preprocessor 0 +#else +#ifdef __STDC__ +#define ANSI_C_preprocessor 1 +#else +#define _cfleft 1 +#define _cfright +#define _cfleft_cfright 0 +#define ANSI_C_preprocessor _cfleft/**/_cfright +#endif +#endif +#endif + +#if ANSI_C_preprocessor +#define _0(A,B) A##B +#define _(A,B) _0(A,B) /* see cat,xcat of K&R ANSI C p. 231 */ +#define _2(A,B) A##B /* K&R ANSI C p.230: .. identifier is not replaced */ +#define _3(A,B,C) _(A,_(B,C)) +#else /* if it turns up again during rescanning. */ +#define _(A,B) A/**/B +#define _2(A,B) A/**/B +#define _3(A,B,C) A/**/B/**/C +#endif + +#if (defined(vax)&&defined(unix)) || (defined(__vax__)&&defined(__unix__)) +#define VAXUltrix +#endif + +#include <stdio.h> /* NULL [in all machines stdio.h] */ +#include <string.h> /* strlen, memset, memcpy, memchr. */ +#if !( defined(VAXUltrix) || defined(sun) || (defined(apollo)&&!defined(__STDCPP__)) ) +#include <stdlib.h> /* malloc,free */ +#else +#include <malloc.h> /* Had to be removed for DomainOS h105 10.4 sys5.3 425t*/ +#ifdef apollo +#define __CF__APOLLO67 /* __STDCPP__ is in Apollo 6.8 (i.e. ANSI) and onwards */ +#endif +#endif + +#if !defined(__GNUC__) && !defined(__sun) && (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. */ + +/* 11/29/2003 (KMCCARTY): add *INTEL_COMPILER symbols here */ +/* 04/05/2006 (KMCCARTY): add gFortran symbol here */ +#if defined(CLIPPERFortran) || defined(pgiFortran) || defined(__INTEL_COMPILER) || defined(INTEL_COMPILER) || defined(gFortran) +#define f2cFortran +#endif + +#if defined(g77Fortran) /* 11/03/97 PDW (CFITSIO) */ +#define f2cFortran +#endif + +/* VAX/VMS does not let us \-split long #if lines. */ +/* Split #if into 2 because some HP-UX can't handle long #if */ +#if !(defined(NAGf90Fortran)||defined(f2cFortran)||defined(hpuxFortran)||defined(apolloFortran)||defined(sunFortran)||defined(IBMR2Fortran)||defined(CRAYFortran)) +#if !(defined(mipsFortran)||defined(DECFortran)||defined(vmsFortran)||defined(CONVEXFortran)||defined(PowerStationFortran)||defined(AbsoftUNIXFortran)||defined(AbsoftProFortran)||defined(SXFortran)) +/* If no Fortran compiler is given, we choose one for the machines we know. */ +#if defined(__GNUC__) || defined(WIN32) /* 10/2009 BR: warm if guess */ +#warning "Please specify the fortran compiler using -D flags. Try to guess the compiler used" +#endif +#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 +/* 04/13/00 DM (CFITSIO): Add these lines for NT */ +/* with PowerStationFortran and and Visual C++ */ +#if defined(WIN32) && !defined(__CYGWIN__) +#define PowerStationFortran +#define VISUAL_CPLUSPLUS +#endif +#if defined(__CYGWIN__) /* 04/11/02 LEB (CFITSIO) */ +#define f2cFortran +#define gFortran /* 8/26/08 (KMCCARTY) */ +#endif +#if defined(__GNUC__) && defined(linux) /* 06/21/00 PDW (CFITSIO) */ +#define f2cFortran +#define gFortran /* 8/26/08 (KMCCARTY) */ +#endif +#if defined(macintosh) /* 11/1999 (CFITSIO) */ +#define f2cFortran +#define gFortran /* 8/26/08 (KMCCARTY) */ +#endif +#if defined(__APPLE__) /* 11/2002 (CFITSIO) */ +#define f2cFortran +#define gFortran /* 8/26/08 (KMCCARTY) */ +#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 also defines some behavior. */ +#endif +#if defined(sun) || defined(__sun) +#define sunFortran +#endif +#if defined(_IBMR2) +#define IBMR2Fortran +#endif +#if defined(_CRAY) +#define CRAYFortran /* _CRAYT3E also defines some behavior. */ +#endif +#if defined(_SX) +#define SXFortran +#endif +#if defined(__NEC__) +#define SXFortran +#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 +#if defined(__convex__) +#define CONVEXFortran +#endif +#if defined(VISUAL_CPLUSPLUS) +#define PowerStationFortran +#endif +#endif /* ...Fortran */ +#endif /* ...Fortran */ + +/* Split #if into 2 because some HP-UX can't handle long #if */ +#if !(defined(NAGf90Fortran)||defined(f2cFortran)||defined(hpuxFortran)||defined(apolloFortran)||defined(sunFortran)||defined(IBMR2Fortran)||defined(CRAYFortran)) +#if !(defined(mipsFortran)||defined(DECFortran)||defined(vmsFortran)||defined(CONVEXFortran)||defined(PowerStationFortran)||defined(AbsoftUNIXFortran)||defined(AbsoftProFortran)||defined(SXFortran)) +/* If your compiler barfs on ' #error', replace # with the trigraph for # */ + #error "cfortran.h: Can't find your environment among:\ + - GNU gcc (gfortran) on Linux. \ + - MIPS cc and f77 2.0. (e.g. Silicon Graphics, DECstations, ...) \ + - IBM AIX XL C and FORTRAN Compiler/6000 Version 01.01.0000.0000 \ + - VAX VMS CC 3.1 and FORTRAN 5.4. \ + - Alpha VMS DEC C 1.3 and DEC FORTRAN 6.0. \ + - Alpha OSF DEC C and DEC Fortran for OSF/1 AXP Version 1.2 \ + - Apollo DomainOS 10.2 (sys5.3) with f77 10.7 and cc 6.7. \ + - CRAY \ + - NEC SX-4 SUPER-UX \ + - CONVEX \ + - Sun \ + - PowerStation Fortran with Visual C++ \ + - HP9000s300/s700/s800 Latest test with: HP-UX A.08.07 A 9000/730 \ + - LynxOS: cc or gcc with f2c. \ + - VAXUltrix: vcc,cc or gcc with f2c. gcc or cc with f77. \ + - f77 with vcc works; but missing link magic for f77 I/O. \ + - NO fort. None of gcc, cc or vcc generate required names.\ + - f2c/g77: Use #define f2cFortran, or cc -Df2cFortran \ + - gfortran: Use #define gFortran, or cc -DgFortran \ + (also necessary for g77 with -fno-f2c option) \ + - NAG f90: Use #define NAGf90Fortran, or cc -DNAGf90Fortran \ + - Absoft UNIX F77: Use #define AbsoftUNIXFortran or cc -DAbsoftUNIXFortran \ + - Absoft Pro Fortran: Use #define AbsoftProFortran \ + - Portland Group Fortran: Use #define pgiFortran \ + - Intel Fortran: Use #define INTEL_COMPILER" +/* Compiler must throw us out at this point! */ +#endif +#endif + + +#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. */ + +/* "extname" changed to "appendus" below (CFITSIO) */ +#if defined(f2cFortran) || defined(NAGf90Fortran) || defined(DECFortran) || defined(mipsFortran) || defined(apolloFortran) || defined(sunFortran) || defined(CONVEXFortran) || defined(SXFortran) || defined(appendus) +#define CFC_(UN,LN) _(LN,_) /* Lowercase FORTRAN symbols. */ +#define orig_fcallsc(UN,LN) CFC_(UN,LN) +#else +#if defined(CRAYFortran) || defined(PowerStationFortran) || defined(AbsoftProFortran) +#ifdef _CRAY /* (UN), not UN, circumvents CRAY preprocessor bug. */ +#define CFC_(UN,LN) (UN) /* Uppercase FORTRAN symbols. */ +#else /* At least VISUAL_CPLUSPLUS barfs on (UN), so need UN. */ +#define CFC_(UN,LN) UN /* Uppercase FORTRAN symbols. */ +#endif +#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(UN,LN) CFC_(UN,LN) +#endif /* vmsFortran */ +#endif /* CRAYFortran PowerStationFortran */ +#endif /* ....Fortran */ + +#define fcallsc(UN,LN) orig_fcallsc(UN,LN) +#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(UN,LN) fcallsc(UN,LN) +#define FORTRAN_FUNCTION(UN,LN) CFC_(UN,LN) + +#ifndef COMMON_BLOCK +#ifndef CONVEXFortran +#ifndef CLIPPERFortran +#if !(defined(AbsoftUNIXFortran)||defined(AbsoftProFortran)) +#define COMMON_BLOCK(UN,LN) CFC_(UN,LN) +#else +#define COMMON_BLOCK(UN,LN) _(_C,LN) +#endif /* AbsoftUNIXFortran or AbsoftProFortran */ +#else +#define COMMON_BLOCK(UN,LN) _(LN,__) +#endif /* CLIPPERFortran */ +#else +#define COMMON_BLOCK(UN,LN) _3(_,LN,_) +#endif /* CONVEXFortran */ +#endif /* COMMON_BLOCK */ + +#ifndef DOUBLE_PRECISION +#if defined(CRAYFortran) && !defined(_CRAYT3E) +#define DOUBLE_PRECISION long double +#else +#define DOUBLE_PRECISION double +#endif +#endif + +#ifndef FORTRAN_REAL +#if defined(CRAYFortran) && defined(_CRAYT3E) +#define FORTRAN_REAL double +#else +#define FORTRAN_REAL float +#endif +#endif + +#ifdef CRAYFortran +#ifdef _CRAY +#include <fortran.h> +#else +#include "fortran.h" /* i.e. if crosscompiling assume user has file. */ +#endif +#define FLOATVVVVVVV_cfPP (FORTRAN_REAL *) /* Used for C calls FORTRAN. */ +/* CRAY's double==float but CRAY says pointers to doubles and floats are diff.*/ +#define VOIDP (void *) /* When FORTRAN calls C, we don't know if C routine + arg.'s have been declared float *, or double *. */ +#else +#define FLOATVVVVVVV_cfPP +#define VOIDP +#endif + +#ifdef vmsFortran +#if defined(vms) || defined(__vms) +#include <descrip.h> +#else +#include "descrip.h" /* i.e. if crosscompiling assume user has file. */ +#endif +#endif + +#ifdef sunFortran +#if defined(sun) || defined(__sun) +#include <math.h> /* Sun's FLOATFUNCTIONTYPE, ASSIGNFLOAT, RETURNFLOAT. */ +#else +#include "math.h" /* i.e. if crosscompiling assume user has file. */ +#endif +/* At least starting with the default C compiler SC3.0.1 of SunOS 5.3, + * FLOATFUNCTIONTYPE, ASSIGNFLOAT, RETURNFLOAT are not required and not in + * <math.h>, since sun C no longer promotes C float return values to doubles. + * Therefore, only use them if defined. + * Even if gcc is being used, assume that it exhibits the Sun C compiler + * behavior in order to be able to use *.o from the Sun C compiler. + * i.e. If FLOATFUNCTIONTYPE, etc. are in math.h, they required by gcc. + */ +#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 __cplusplus +#undef CF_NULL_PROTO +#define CF_NULL_PROTO ... +#endif + + +#ifndef USE_NEW_DELETE +#ifdef __cplusplus +#define USE_NEW_DELETE 1 +#else +#define USE_NEW_DELETE 0 +#endif +#endif +#if USE_NEW_DELETE +#define _cf_malloc(N) new char[N] +#define _cf_free(P) delete[] P +#else +#define _cf_malloc(N) (char *)malloc(N) +#define _cf_free(P) free(P) +#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 AcfCOMMA , +#define AcfCOLON ; + +/*-------------------------------------------------------------------------*/ + +/* UTILITIES USED WITHIN CFORTRAN.H */ + +#define _cfMIN(A,B) (A<B?A:B) + +/* 970211 - XIX.145: + firstindexlength - better name is all_but_last_index_lengths + secondindexlength - better name is last_index_length + */ +#define firstindexlength(A) (sizeof(A[0])==1 ? 1 : (sizeof(A) / sizeof(A[0])) ) +#define secondindexlength(A) (sizeof(A[0])==1 ? sizeof(A) : sizeof(A[0]) ) + +/* Behavior of FORTRAN LOGICAL. All machines' LOGICAL is same size as C's int. +Conversion is automatic except for arrays which require F2CLOGICALV/C2FLOGICALV. +f2c, MIPS f77 [DECstation, SGI], VAX Ultrix f77, +HP-UX f77 : as in C. +VAX/VMS FORTRAN, VAX Ultrix fort, +Absoft Unix Fortran, IBM RS/6000 xlf : LS Bit = 0/1 = TRUE/FALSE. +Apollo : neg. = TRUE, else FALSE. +[Apollo accepts -1 as TRUE for function values, but NOT all other neg. values.] +[DECFortran for Ultrix RISC is also called f77 but is the same as VAX/VMS.] +[MIPS f77 treats .eqv./.neqv. as .eq./.ne. and hence requires LOGICAL_STRICT.]*/ + +#if defined(NAGf90Fortran) || defined(f2cFortran) || defined(mipsFortran) || defined(PowerStationFortran) || defined(hpuxFortran800) || defined(AbsoftUNIXFortran) || defined(AbsoftProFortran) || defined(SXFortran) +/* SX/PowerStationFortran have 0 and 1 defined, others are neither T nor F. */ +/* hpuxFortran800 has 0 and 0x01000000 defined. Others are unknown. */ +#define LOGICAL_STRICT /* Other Fortran have .eqv./.neqv. == .eq./.ne. */ +#endif + +#define C2FLOGICALV(A,I) \ + do {int __i; for(__i=0;__i<I;__i++) A[__i]=C2FLOGICAL(A[__i]); } while (0) +#define F2CLOGICALV(A,I) \ + do {int __i; for(__i=0;__i<I;__i++) A[__i]=F2CLOGICAL(A[__i]); } while (0) + +#if defined(apolloFortran) +#define C2FLOGICAL(L) ((L)?-1:(L)&~((unsigned)1<<sizeof(int)*8-1)) +#define F2CLOGICAL(L) ((L)<0?(L):0) +#else +#if defined(CRAYFortran) +#define C2FLOGICAL(L) _btol(L) +#define F2CLOGICAL(L) _ltob(&(L)) /* Strangely _ltob() expects a pointer. */ +#else +#if defined(IBMR2Fortran) || defined(vmsFortran) || defined(DECFortran) || defined(AbsoftUNIXFortran) +/* How come no AbsoftProFortran ? */ +#define C2FLOGICAL(L) ((L)?(L)|1:(L)&~(int)1) +#define F2CLOGICAL(L) ((L)&1?(L):0) +#else +#if defined(CONVEXFortran) +#define C2FLOGICAL(L) ((L) ? ~0 : 0 ) +#define F2CLOGICAL(L) (L) +#else /* others evaluate LOGICALs as for C. */ +#define C2FLOGICAL(L) (L) +#define F2CLOGICAL(L) (L) +#ifndef LOGICAL_STRICT +#undef C2FLOGICALV +#undef F2CLOGICALV +#define C2FLOGICALV(A,I) +#define F2CLOGICALV(A,I) +#endif /* LOGICAL_STRICT */ +#endif /* CONVEXFortran || All Others */ +#endif /* IBMR2Fortran vmsFortran DECFortran AbsoftUNIXFortran */ +#endif /* CRAYFortran */ +#endif /* apolloFortran */ + +/* 970514 - In addition to CRAY, there may be other machines + for which LOGICAL_STRICT makes no sense. */ +#if defined(LOGICAL_STRICT) && !defined(CRAYFortran) +/* Force C2FLOGICAL to generate only the values for either .TRUE. or .FALSE. + SX/PowerStationFortran only have 0 and 1 defined. + Elsewhere, only needed if you want to do: + logical lvariable + if (lvariable .eq. .true.) then ! (1) + instead of + if (lvariable .eqv. .true.) then ! (2) + - (1) may not even be FORTRAN/77 and that Apollo's f77 and IBM's xlf + refuse to compile (1), so you are probably well advised to stay away from + (1) and from LOGICAL_STRICT. + - You pay a (slight) performance penalty for using LOGICAL_STRICT. */ +#undef C2FLOGICAL +#ifdef hpuxFortran800 +#define C2FLOGICAL(L) ((L)?0x01000000:0) +#else +#if defined(apolloFortran) || defined(vmsFortran) || defined(DECFortran) +#define C2FLOGICAL(L) ((L)?-1:0) /* These machines use -1/0 for .true./.false.*/ +#else +#define C2FLOGICAL(L) ((L)? 1:0) /* All others use +1/0 for .true./.false.*/ +#endif +#endif +#endif /* LOGICAL_STRICT */ + +/* Convert a vector of C strings into FORTRAN strings. */ +#ifndef __CF__KnR +static char *c2fstrv(char* cstr, char *fstr, int elem_len, int sizeofcstr) +#else +static char *c2fstrv( cstr, fstr, elem_len, sizeofcstr) + char* cstr; char *fstr; int elem_len; int sizeofcstr; +#endif +{ int i,j; +/* elem_len includes \0 for C strings. Fortran strings don't have term. \0. + Useful size of string must be the same in both languages. */ +for (i=0; i<sizeofcstr/elem_len; i++) { + for (j=1; j<elem_len && *cstr; j++) *fstr++ = *cstr++; + cstr += 1+elem_len-j; + for (; j<elem_len; j++) *fstr++ = ' '; +} /* 95109 - Seems to be returning the original fstr. */ +return fstr-sizeofcstr+sizeofcstr/elem_len; } + +/* Convert a vector of FORTRAN strings into C strings. */ +#ifndef __CF__KnR +static char *f2cstrv(char *fstr, char* cstr, int elem_len, int sizeofcstr) +#else +static char *f2cstrv( fstr, cstr, elem_len, sizeofcstr) + char *fstr; char* cstr; int elem_len; int sizeofcstr; +#endif +{ int i,j; +/* elem_len includes \0 for C strings. Fortran strings don't have term. \0. + Useful size of string must be the same in both languages. */ +cstr += sizeofcstr; +fstr += sizeofcstr - sizeofcstr/elem_len; +for (i=0; i<sizeofcstr/elem_len; i++) { + *--cstr = '\0'; + for (j=1; j<elem_len; j++) *--cstr = *--fstr; +} return cstr; } + +/* kill the trailing char t's in string s. */ +#ifndef __CF__KnR +static char *kill_trailing(char *s, char t) +#else +static char *kill_trailing( s, t) char *s; char t; +#endif +{char *e; +e = s + strlen(s); +if (e>s) { /* 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; } + +#ifndef __CF__KnR +static int num_elem(const char *strv, unsigned elem_len, int term_char, int num_term); +#endif +/* 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 e<s string s is left unchanged. */ +#ifndef __CF__KnR +static char *kill_trailingn(char *s, char t, char *e) +#else +static char *kill_trailingn( s, t, e) char *s; char t; char *e; +#endif +{ +if (e==s) *e = '\0'; /* Kill the string makes sense here.*/ +else if (e>s) { /* 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. */ +} +(void)num_elem; /* to prevent not used warnings in gcc (added by TJ) */ + + 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<sizeofcstr/elem_len; i++) /* elem_len includes \0 for C strings. */ + kill_trailingn(cstr+elem_len*i,t,cstr+elem_len*(i+1)-1); +return cstr; } + +#ifdef vmsFortran +typedef struct dsc$descriptor_s fstring; +#define DSC$DESCRIPTOR_A(DIMCT) \ +struct { \ + unsigned short dsc$w_length; unsigned char dsc$b_dtype; \ + unsigned char dsc$b_class; char *dsc$a_pointer; \ + char dsc$b_scale; unsigned char dsc$b_digits; \ + struct { \ + unsigned : 3; unsigned dsc$v_fl_binscale : 1; \ + unsigned dsc$v_fl_redim : 1; unsigned dsc$v_fl_column : 1; \ + unsigned dsc$v_fl_coeff : 1; unsigned dsc$v_fl_bounds : 1; \ + } dsc$b_aflags; \ + unsigned char dsc$b_dimct; unsigned long dsc$l_arsize; \ + char *dsc$a_a0; long dsc$l_m [DIMCT]; \ + struct { \ + long dsc$l_l; long dsc$l_u; \ + } dsc$bounds [DIMCT]; \ +} +typedef DSC$DESCRIPTOR_A(1) fstringvector; +/*typedef DSC$DESCRIPTOR_A(2) fstringarrarr; + typedef DSC$DESCRIPTOR_A(3) fstringarrarrarr;*/ +#define initfstr(F,C,ELEMNO,ELEMLEN) \ +( (F).dsc$l_arsize= ( (F).dsc$w_length =(ELEMLEN) ) \ + *( (F).dsc$l_m[0]=(F).dsc$bounds[0].dsc$l_u=(ELEMNO) ), \ + (F).dsc$a_a0 = ( (F).dsc$a_pointer=(C) ) - (F).dsc$w_length ,(F)) + +#endif /* PDW: 2/10/98 (CFITSIO) -- Let VMS see NUM_ELEMS definitions */ +#define _NUM_ELEMS -1 +#define _NUM_ELEM_ARG -2 +#define NUM_ELEMS(A) A,_NUM_ELEMS +#define NUM_ELEM_ARG(B) *_2(A,B),_NUM_ELEM_ARG +#define TERM_CHARS(A,B) A,B +#ifndef __CF__KnR +static int num_elem(const char *strv, unsigned elem_len, int term_char, int num_term) +#else +static int num_elem( strv, elem_len, term_char, num_term) + char *strv; unsigned elem_len; int term_char; int num_term; +#endif +/* elem_len is the number of characters in each element of strv, the FORTRAN +vector of strings. The last element of the vector must begin with at least +num_term term_char characters, so that this routine can determine how +many elements are in the vector. */ +{ +unsigned num,i; +if (num_term == _NUM_ELEMS || num_term == _NUM_ELEM_ARG) + return term_char; +if (num_term <=0) num_term = (int)elem_len; +for (num=0; ; num++) { + for (i=0; i<(unsigned)num_term && *strv==term_char; i++,strv++){;} + if (i==(unsigned)num_term) break; + else strv += elem_len-i; +} +/* to prevent not used warnings in gcc (added by ROOT, changed by TJ + * because of unreachable warnings from clang) */ +(void)c2fstrv; (void)f2cstrv; (void)kill_trailing; +(void)vkill_trailing; (void)num_elem; +return (int)num; +} +/* #endif removed 2/10/98 (CFITSIO) */ + +/*-------------------------------------------------------------------------*/ + +/* UTILITIES FOR C TO USE STRINGS IN FORTRAN COMMON BLOCKS */ + +/* C string TO Fortran Common Block STRing. */ +/* DIM is the number of DIMensions of the array in terms of strings, not + characters. e.g. char a[12] has DIM = 0, char a[12][4] has DIM = 1, etc. */ +#define C2FCBSTR(CSTR,FSTR,DIM) \ + c2fstrv((char *)CSTR, (char *)FSTR, sizeof(FSTR)/cfelementsof(FSTR,DIM)+1, \ + sizeof(FSTR)+cfelementsof(FSTR,DIM)) + +/* Fortran Common Block string TO C STRing. */ +#define FCB2CSTR(FSTR,CSTR,DIM) \ + vkill_trailing(f2cstrv((char *)FSTR, (char *)CSTR, \ + sizeof(FSTR)/cfelementsof(FSTR,DIM)+1, \ + sizeof(FSTR)+cfelementsof(FSTR,DIM)), \ + sizeof(FSTR)/cfelementsof(FSTR,DIM)+1, \ + sizeof(FSTR)+cfelementsof(FSTR,DIM), ' ') + +#define cfDEREFERENCE0 +#define cfDEREFERENCE1 * +#define cfDEREFERENCE2 ** +#define cfDEREFERENCE3 *** +#define cfDEREFERENCE4 **** +#define cfDEREFERENCE5 ***** +#define cfelementsof(A,D) (sizeof(A)/sizeof(_(cfDEREFERENCE,D)(A))) + +/*-------------------------------------------------------------------------*/ + +/* UTILITIES FOR C TO CALL FORTRAN SUBROUTINES */ + +/* Define lookup tables for how to handle the various types of variables. */ + +#ifdef OLD_VAXC /* Prevent %CC-I-PARAMNOTUSED. */ +#pragma nostandard +#endif + +#define ZTRINGV_NUM(I) I +#define ZTRINGV_ARGFP(I) (*(_2(A,I))) /* Undocumented. For PINT, etc. */ +#define ZTRINGV_ARGF(I) _2(A,I) +#ifdef CFSUBASFUN +#define ZTRINGV_ARGS(I) ZTRINGV_ARGF(I) +#else +#define ZTRINGV_ARGS(I) _2(B,I) +#endif + +#define PBYTE_cfVP(A,B) PINT_cfVP(A,B) +#define PDOUBLE_cfVP(A,B) +#define PFLOAT_cfVP(A,B) +#ifdef ZTRINGV_ARGS_allows_Pvariables +/* This allows Pvariables for ARGS. ARGF machinery is above ARGFP. + * B is not needed because the variable may be changed by the Fortran routine, + * but because B is the only way to access an arbitrary macro argument. */ +#define PINT_cfVP(A,B) int B = (int)A; /* For ZSTRINGV_ARGS */ +#else +#define PINT_cfVP(A,B) +#endif +#define PLOGICAL_cfVP(A,B) int *B; /* Returning LOGICAL in FUNn and SUBn */ +#define PLONG_cfVP(A,B) PINT_cfVP(A,B) +#define PSHORT_cfVP(A,B) PINT_cfVP(A,B) + +#define VCF_INT_S(T,A,B) _(T,VVVVVVV_cfTYPE) B = A; +#define VCF_INT_F(T,A,B) _(T,_cfVCF)(A,B) +/* _cfVCF table is directly mapped to _cfCCC table. */ +#define BYTE_cfVCF(A,B) +#define DOUBLE_cfVCF(A,B) +#if !defined(__CF__KnR) +#define FLOAT_cfVCF(A,B) +#else +#define FLOAT_cfVCF(A,B) FORTRAN_REAL B = A; +#endif +#define INT_cfVCF(A,B) +#define LOGICAL_cfVCF(A,B) +#define LONG_cfVCF(A,B) +#define SHORT_cfVCF(A,B) + +/* 980416 + Cast (void (*)(CF_NULL_PROTO)) causes SunOS CC 4.2 occasionally to barf, + while the following equivalent typedef is fine. + For consistency use the typedef on all machines. + */ +typedef void (*cfCAST_FUNCTION)(CF_NULL_PROTO); + +#define VCF(TN,I) _Icf4(4,V,TN,_(A,I),_(B,I),F) +#define VVCF(TN,AI,BI) _Icf4(4,V,TN,AI,BI,S) +#define INT_cfV(T,A,B,F) _(VCF_INT_,F)(T,A,B) +#define INTV_cfV(T,A,B,F) +#define INTVV_cfV(T,A,B,F) +#define INTVVV_cfV(T,A,B,F) +#define INTVVVV_cfV(T,A,B,F) +#define INTVVVVV_cfV(T,A,B,F) +#define INTVVVVVV_cfV(T,A,B,F) +#define INTVVVVVVV_cfV(T,A,B,F) +#define PINT_cfV( T,A,B,F) _(T,_cfVP)(A,B) +#define PVOID_cfV( T,A,B,F) +#if defined(apolloFortran) || defined(hpuxFortran800) || defined(AbsoftUNIXFortran) || defined(AbsoftProFortran) +#define ROUTINE_cfV(T,A,B,F) void (*B)(CF_NULL_PROTO) = (cfCAST_FUNCTION)A; +#else +#define ROUTINE_cfV(T,A,B,F) +#endif +#define SIMPLE_cfV(T,A,B,F) +#ifdef vmsFortran +#define STRING_cfV(T,A,B,F) static struct {fstring f; unsigned clen;} B = \ + {{0,DSC$K_DTYPE_T,DSC$K_CLASS_S,NULL},0}; +#define PSTRING_cfV(T,A,B,F) static fstring B={0,DSC$K_DTYPE_T,DSC$K_CLASS_S,NULL}; +#define STRINGV_cfV(T,A,B,F) 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 PSTRINGV_cfV(T,A,B,F) 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 STRING_cfV(T,A,B,F) struct {unsigned int clen, flen; char *nombre;} B; +#define STRINGV_cfV(T,A,B,F) struct {char *s, *fs; unsigned flen; char *nombre;} B; +#define PSTRING_cfV(T,A,B,F) int B; +#define PSTRINGV_cfV(T,A,B,F) struct{char *fs; unsigned int sizeofA,flen;}B; +#endif +#define ZTRINGV_cfV(T,A,B,F) STRINGV_cfV(T,A,B,F) +#define PZTRINGV_cfV(T,A,B,F) PSTRINGV_cfV(T,A,B,F) + +/* 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) _(TN,_cfSTR)(4,A,NAME,I,AI,_(B,I),0) +#define DEFAULT_cfA(M,I,A,B) +#define LOGICAL_cfA(M,I,A,B) B=C2FLOGICAL(B); +#define PLOGICAL_cfA(M,I,A,B) A=C2FLOGICAL(A); +#define STRING_cfA(M,I,A,B) STRING_cfC(M,I,A,B,sizeof(A)) +#define PSTRING_cfA(M,I,A,B) PSTRING_cfC(M,I,A,B,sizeof(A)) +#ifdef vmsFortran +#define AATRINGV_cfA( A,B, sA,filA,silA) \ + initfstr(B,_cf_malloc((sA)-(filA)),(filA),(silA)-1), \ + c2fstrv(A,B.dsc$a_pointer,(silA),(sA)); +#define APATRINGV_cfA( A,B, sA,filA,silA) \ + initfstr(B,A,(filA),(silA)-1),c2fstrv(A,A,(silA),(sA)); +#else +#define AATRINGV_cfA( A,B, sA,filA,silA) \ + (B.s=_cf_malloc((sA)-(filA)),B.fs=c2fstrv(A,B.s,(B.flen=(silA)-1)+1,(sA))); +#define APATRINGV_cfA( A,B, sA,filA,silA) \ + B.fs=c2fstrv(A,A,(B.flen=(silA)-1)+1,B.sizeofA=(sA)); +#endif +#define STRINGV_cfA(M,I,A,B) \ + AATRINGV_cfA((char *)A,B,sizeof(A),firstindexlength(A),secondindexlength(A)) +#define PSTRINGV_cfA(M,I,A,B) \ + APATRINGV_cfA((char *)A,B,sizeof(A),firstindexlength(A),secondindexlength(A)) +#define ZTRINGV_cfA(M,I,A,B) AATRINGV_cfA( (char *)A,B, \ + (_3(M,_ELEMS_,I))*(( _3(M,_ELEMLEN_,I))+1), \ + (_3(M,_ELEMS_,I)),(_3(M,_ELEMLEN_,I))+1) +#define PZTRINGV_cfA(M,I,A,B) APATRINGV_cfA( (char *)A,B, \ + (_3(M,_ELEMS_,I))*(( _3(M,_ELEMLEN_,I))+1), \ + (_3(M,_ELEMS_,I)),(_3(M,_ELEMLEN_,I))+1) + +#define PBYTE_cfAAP(A,B) &A +#define PDOUBLE_cfAAP(A,B) &A +#define PFLOAT_cfAAP(A,B) FLOATVVVVVVV_cfPP &A +#define PINT_cfAAP(A,B) &A +#define PLOGICAL_cfAAP(A,B) B= &A /* B used to keep a common W table. */ +#define PLONG_cfAAP(A,B) &A +#define PSHORT_cfAAP(A,B) &A + +#define AACF(TN,AI,I,C) _SEP_(TN,C,cfCOMMA) _Icf(3,AA,TN,AI,_(B,I)) +#define INT_cfAA(T,A,B) &B +#define INTV_cfAA(T,A,B) _(T,VVVVVV_cfPP) A +#define INTVV_cfAA(T,A,B) _(T,VVVVV_cfPP) A[0] +#define INTVVV_cfAA(T,A,B) _(T,VVVV_cfPP) A[0][0] +#define INTVVVV_cfAA(T,A,B) _(T,VVV_cfPP) A[0][0][0] +#define INTVVVVV_cfAA(T,A,B) _(T,VV_cfPP) A[0][0][0][0] +#define INTVVVVVV_cfAA(T,A,B) _(T,V_cfPP) A[0][0][0][0][0] +#define INTVVVVVVV_cfAA(T,A,B) _(T,_cfPP) A[0][0][0][0][0][0] +#define PINT_cfAA(T,A,B) _(T,_cfAAP)(A,B) +#define PVOID_cfAA(T,A,B) (void *) A +#if defined(apolloFortran) || defined(hpuxFortran800) || defined(AbsoftUNIXFortran) +#define ROUTINE_cfAA(T,A,B) &B +#else +#define ROUTINE_cfAA(T,A,B) (cfCAST_FUNCTION)A +#endif +#define STRING_cfAA(T,A,B) STRING_cfCC(T,A,B) +#define PSTRING_cfAA(T,A,B) PSTRING_cfCC(T,A,B) +#ifdef vmsFortran +#define STRINGV_cfAA(T,A,B) &B +#else +#ifdef CRAYFortran +#define STRINGV_cfAA(T,A,B) _cptofcd(B.fs,B.flen) +#else +#define STRINGV_cfAA(T,A,B) B.fs +#endif +#endif +#define PSTRINGV_cfAA(T,A,B) STRINGV_cfAA(T,A,B) +#define ZTRINGV_cfAA(T,A,B) STRINGV_cfAA(T,A,B) +#define PZTRINGV_cfAA(T,A,B) STRINGV_cfAA(T,A,B) + +#if defined(vmsFortran) || defined(CRAYFortran) +#define JCF(TN,I) +#define KCF(TN,I) +#else +#define JCF(TN,I) _(TN,_cfSTR)(1,J,_(B,I), 0,0,0,0) +#if defined(AbsoftUNIXFortran) +#define DEFAULT_cfJ(B) ,0 +#else +#define DEFAULT_cfJ(B) +#endif +#define LOGICAL_cfJ(B) DEFAULT_cfJ(B) +#define PLOGICAL_cfJ(B) DEFAULT_cfJ(B) +#define STRING_cfJ(B) ,B.flen +#define PSTRING_cfJ(B) ,B +#define STRINGV_cfJ(B) STRING_cfJ(B) +#define PSTRINGV_cfJ(B) STRING_cfJ(B) +#define ZTRINGV_cfJ(B) STRING_cfJ(B) +#define PZTRINGV_cfJ(B) STRING_cfJ(B) + +/* KCF is identical to DCF, except that KCF ZTRING is not empty. */ +#define KCF(TN,I) _(TN,_cfSTR)(1,KK,_(B,I), 0,0,0,0) +#if defined(AbsoftUNIXFortran) +#define DEFAULT_cfKK(B) , unsigned B +#else +#define DEFAULT_cfKK(B) +#endif +#define LOGICAL_cfKK(B) DEFAULT_cfKK(B) +#define PLOGICAL_cfKK(B) DEFAULT_cfKK(B) +#define STRING_cfKK(B) , unsigned B +#define PSTRING_cfKK(B) STRING_cfKK(B) +#define STRINGV_cfKK(B) STRING_cfKK(B) +#define PSTRINGV_cfKK(B) STRING_cfKK(B) +#define ZTRINGV_cfKK(B) STRING_cfKK(B) +#define PZTRINGV_cfKK(B) STRING_cfKK(B) +#endif + +#define WCF(TN,AN,I) _(TN,_cfSTR)(2,W,AN,_(B,I), 0,0,0) +#define DEFAULT_cfW(A,B) +#define LOGICAL_cfW(A,B) +#define PLOGICAL_cfW(A,B) *B=F2CLOGICAL(*B); +#define STRING_cfW(A,B) (B.nombre=A,B.nombre[B.clen]!='\0'?B.nombre[B.clen]='\0':0); /* A?="constnt"*/ +#define PSTRING_cfW(A,B) kill_trailing(A,' '); +#ifdef vmsFortran +#define STRINGV_cfW(A,B) _cf_free(B.dsc$a_pointer); +#define PSTRINGV_cfW(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 STRINGV_cfW(A,B) _cf_free(B.s); +#define PSTRINGV_cfW(A,B) vkill_trailing( \ + f2cstrv((char*)A,(char*)A,B.flen+1,B.sizeofA), B.flen+1,B.sizeofA,' '); +#endif +#define ZTRINGV_cfW(A,B) STRINGV_cfW(A,B) +#define PZTRINGV_cfW(A,B) PSTRINGV_cfW(A,B) + +#define NCF(TN,I,C) _SEP_(TN,C,cfCOMMA) _Icf(2,N,TN,_(A,I),0) +#define NNCF(TN,I,C) UUCF(TN,I,C) +#define NNNCF(TN,I,C) _SEP_(TN,C,cfCOLON) _Icf(2,N,TN,_(A,I),0) +#define INT_cfN(T,A) _(T,VVVVVVV_cfTYPE) * A +#define INTV_cfN(T,A) _(T,VVVVVV_cfTYPE) * A +#define INTVV_cfN(T,A) _(T,VVVVV_cfTYPE) * A +#define INTVVV_cfN(T,A) _(T,VVVV_cfTYPE) * A +#define INTVVVV_cfN(T,A) _(T,VVV_cfTYPE) * A +#define INTVVVVV_cfN(T,A) _(T,VV_cfTYPE) * A +#define INTVVVVVV_cfN(T,A) _(T,V_cfTYPE) * A +#define INTVVVVVVV_cfN(T,A) _(T,_cfTYPE) * A +#define PINT_cfN(T,A) _(T,_cfTYPE) * A +#define PVOID_cfN(T,A) void * A +#if defined(apolloFortran) || defined(hpuxFortran800) || defined(AbsoftUNIXFortran) +#define ROUTINE_cfN(T,A) void (**A)(CF_NULL_PROTO) +#else +#define ROUTINE_cfN(T,A) void ( *A)(CF_NULL_PROTO) +#endif +#ifdef vmsFortran +#define STRING_cfN(T,A) fstring * A +#define STRINGV_cfN(T,A) fstringvector * A +#else +#ifdef CRAYFortran +#define STRING_cfN(T,A) _fcd A +#define STRINGV_cfN(T,A) _fcd A +#else +#define STRING_cfN(T,A) char * A +#define STRINGV_cfN(T,A) char * A +#endif +#endif +#define PSTRING_cfN(T,A) STRING_cfN(T,A) /* CRAY insists on arg.'s here. */ +#define PNSTRING_cfN(T,A) STRING_cfN(T,A) /* CRAY insists on arg.'s here. */ +#define PPSTRING_cfN(T,A) STRING_cfN(T,A) /* CRAY insists on arg.'s here. */ +#define PSTRINGV_cfN(T,A) STRINGV_cfN(T,A) +#define ZTRINGV_cfN(T,A) STRINGV_cfN(T,A) +#define PZTRINGV_cfN(T,A) PSTRINGV_cfN(T,A) + + +/* Apollo 6.7, CRAY, old Sun, VAX/Ultrix vcc/cc and new ultrix + can't hack more than 31 arg's. + e.g. ultrix >= 4.3 gives message: + zow35> cc -c -DDECFortran cfortest.c + cfe: Fatal: Out of memory: cfortest.c + zow35> + Old __hpux had the problem, but new 'HP-UX A.09.03 A 9000/735' is fine + if using -Aa, otherwise we have a problem. + */ +#ifndef MAX_PREPRO_ARGS +#if !defined(__GNUC__) && (defined(VAXUltrix) || defined(__CF__APOLLO67) || (defined(sun)&&!defined(__sun)) || defined(_CRAY) || defined(__ultrix__) || (defined(__hpux)&&defined(__CF__KnR))) +#define MAX_PREPRO_ARGS 31 +#else +#define MAX_PREPRO_ARGS 99 +#endif +#endif + +#if defined(AbsoftUNIXFortran) || defined(AbsoftProFortran) +/* In addition to explicit Absoft stuff, only Absoft requires: + - DEFAULT coming from _cfSTR. + DEFAULT could have been called e.g. INT, but keep it for clarity. + - M term in CFARGT14 and CFARGT14FS. + */ +#define ABSOFT_cf1(T0) _(T0,_cfSTR)(0,ABSOFT1,0,0,0,0,0) +#define ABSOFT_cf2(T0) _(T0,_cfSTR)(0,ABSOFT2,0,0,0,0,0) +#define ABSOFT_cf3(T0) _(T0,_cfSTR)(0,ABSOFT3,0,0,0,0,0) +#define DEFAULT_cfABSOFT1 +#define LOGICAL_cfABSOFT1 +#define STRING_cfABSOFT1 ,MAX_LEN_FORTRAN_FUNCTION_STRING +#define DEFAULT_cfABSOFT2 +#define LOGICAL_cfABSOFT2 +#define STRING_cfABSOFT2 ,unsigned D0 +#define DEFAULT_cfABSOFT3 +#define LOGICAL_cfABSOFT3 +#define STRING_cfABSOFT3 ,D0 +#else +#define ABSOFT_cf1(T0) +#define ABSOFT_cf2(T0) +#define ABSOFT_cf3(T0) +#endif + +/* _Z introduced to cicumvent IBM and HP silly preprocessor warning. + e.g. "Macro CFARGT14 invoked with a null argument." + */ +#define _Z + +#define CFARGT14S(S,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE) \ + S(T1,1) S(T2,2) S(T3,3) S(T4,4) S(T5,5) S(T6,6) S(T7,7) \ + S(T8,8) S(T9,9) S(TA,10) S(TB,11) S(TC,12) S(TD,13) S(TE,14) +#define CFARGT27S(S,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM,TN,TO,TP,TQ,TR) \ + S(T1,1) S(T2,2) S(T3,3) S(T4,4) S(T5,5) S(T6,6) S(T7,7) \ + S(T8,8) S(T9,9) S(TA,10) S(TB,11) S(TC,12) S(TD,13) S(TE,14) \ + S(TF,15) S(TG,16) S(TH,17) S(TI,18) S(TJ,19) S(TK,20) S(TL,21) \ + S(TM,22) S(TN,23) S(TO,24) S(TP,25) S(TQ,26) S(TR,27) + +#define CFARGT14FS(F,S,M,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE) \ + F(T1,1,0) F(T2,2,1) F(T3,3,1) F(T4,4,1) F(T5,5,1) F(T6,6,1) F(T7,7,1) \ + F(T8,8,1) F(T9,9,1) F(TA,10,1) F(TB,11,1) F(TC,12,1) F(TD,13,1) F(TE,14,1) \ + M CFARGT14S(S,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE) +#define CFARGT27FS(F,S,M,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM,TN,TO,TP,TQ,TR) \ + F(T1,1,0) F(T2,2,1) F(T3,3,1) F(T4,4,1) F(T5,5,1) F(T6,6,1) F(T7,7,1) \ + F(T8,8,1) F(T9,9,1) F(TA,10,1) F(TB,11,1) F(TC,12,1) F(TD,13,1) F(TE,14,1) \ + F(TF,15,1) F(TG,16,1) F(TH,17,1) F(TI,18,1) F(TJ,19,1) F(TK,20,1) F(TL,21,1) \ + F(TM,22,1) F(TN,23,1) F(TO,24,1) F(TP,25,1) F(TQ,26,1) F(TR,27,1) \ + M CFARGT27S(S,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM,TN,TO,TP,TQ,TR) + +#if !(defined(PowerStationFortran)||defined(hpuxFortran800)) +/* Old CFARGT14 -> CFARGT14FS as seen below, for Absoft cross-compile yields: + SunOS> cc -c -Xa -DAbsoftUNIXFortran c.c + "c.c", line 406: warning: argument mismatch + Haven't checked if this is ANSI C or a SunOS bug. SunOS -Xs works ok. + Behavior is most clearly seen in example: + #define A 1 , 2 + #define C(X,Y,Z) x=X. y=Y. z=Z. + #define D(X,Y,Z) C(X,Y,Z) + D(x,A,z) + Output from preprocessor is: x = x . y = 1 . z = 2 . + #define CFARGT14(F,S,M,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE) \ + CFARGT14FS(F,S,M,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE) +*/ +#define CFARGT14(F,S,M,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE) \ + F(T1,1,0) F(T2,2,1) F(T3,3,1) F(T4,4,1) F(T5,5,1) F(T6,6,1) F(T7,7,1) \ + F(T8,8,1) F(T9,9,1) F(TA,10,1) F(TB,11,1) F(TC,12,1) F(TD,13,1) F(TE,14,1) \ + M CFARGT14S(S,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE) +#define CFARGT27(F,S,M,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM,TN,TO,TP,TQ,TR) \ + F(T1,1,0) F(T2,2,1) F(T3,3,1) F(T4,4,1) F(T5,5,1) F(T6,6,1) F(T7,7,1) \ + F(T8,8,1) F(T9,9,1) F(TA,10,1) F(TB,11,1) F(TC,12,1) F(TD,13,1) F(TE,14,1) \ + F(TF,15,1) F(TG,16,1) F(TH,17,1) F(TI,18,1) F(TJ,19,1) F(TK,20,1) F(TL,21,1) \ + F(TM,22,1) F(TN,23,1) F(TO,24,1) F(TP,25,1) F(TQ,26,1) F(TR,27,1) \ + M CFARGT27S(S,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM,TN,TO,TP,TQ,TR) + +#define CFARGT20(F,S,M,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK) \ + F(T1,1,0) F(T2,2,1) F(T3,3,1) F(T4,4,1) F(T5,5,1) F(T6,6,1) F(T7,7,1) \ + F(T8,8,1) F(T9,9,1) F(TA,10,1) F(TB,11,1) F(TC,12,1) F(TD,13,1) F(TE,14,1) \ + F(TF,15,1) F(TG,16,1) F(TH,17,1) F(TI,18,1) F(TJ,19,1) F(TK,20,1) \ + S(T1,1) S(T2,2) S(T3,3) S(T4,4) S(T5,5) S(T6,6) S(T7,7) \ + S(T8,8) S(T9,9) S(TA,10) S(TB,11) S(TC,12) S(TD,13) S(TE,14) \ + S(TF,15) S(TG,16) S(TH,17) S(TI,18) S(TJ,19) S(TK,20) +#define CFARGTA14(F,S,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) \ + F(T1,A1,1,0) F(T2,A2,2,1) F(T3,A3,3,1) F(T4,A4,4,1) F(T5,A5,5,1) F(T6,A6,6,1) \ + F(T7,A7,7,1) F(T8,A8,8,1) F(T9,A9,9,1) F(TA,AA,10,1) F(TB,AB,11,1) F(TC,AC,12,1) \ + F(TD,AD,13,1) F(TE,AE,14,1) S(T1,1) S(T2,2) S(T3,3) S(T4,4) \ + S(T5,5) S(T6,6) S(T7,7) S(T8,8) S(T9,9) S(TA,10) \ + S(TB,11) S(TC,12) S(TD,13) S(TE,14) +#if MAX_PREPRO_ARGS>31 +#define CFARGTA20(F,S,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) \ + F(T1,A1,1,0) F(T2,A2,2,1) F(T3,A3,3,1) F(T4,A4,4,1) F(T5,A5,5,1) F(T6,A6,6,1) \ + F(T7,A7,7,1) F(T8,A8,8,1) F(T9,A9,9,1) F(TA,AA,10,1) F(TB,AB,11,1) F(TC,AC,12,1) \ + F(TD,AD,13,1) F(TE,AE,14,1) F(TF,AF,15,1) F(TG,AG,16,1) F(TH,AH,17,1) F(TI,AI,18,1) \ + F(TJ,AJ,19,1) F(TK,AK,20,1) S(T1,1) S(T2,2) S(T3,3) S(T4,4) \ + S(T5,5) S(T6,6) S(T7,7) S(T8,8) S(T9,9) S(TA,10) \ + S(TB,11) S(TC,12) S(TD,13) S(TE,14) S(TF,15) S(TG,16) \ + S(TH,17) S(TI,18) S(TJ,19) S(TK,20) +#define CFARGTA27(F,S,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM,TN,TO,TP,TQ,TR,A1,A2,A3,A4,A5,A6,A7,A8,A9,AA,AB,AC,AD,AE,AF,AG,AH,AI,AJ,AK,AL,AM,AN,AO,AP,AQ,AR) \ + F(T1,A1,1,0) F(T2,A2,2,1) F(T3,A3,3,1) F(T4,A4,4,1) F(T5,A5,5,1) F(T6,A6,6,1) \ + F(T7,A7,7,1) F(T8,A8,8,1) F(T9,A9,9,1) F(TA,AA,10,1) F(TB,AB,11,1) F(TC,AC,12,1) \ + F(TD,AD,13,1) F(TE,AE,14,1) F(TF,AF,15,1) F(TG,AG,16,1) F(TH,AH,17,1) F(TI,AI,18,1) \ + F(TJ,AJ,19,1) F(TK,AK,20,1) F(TL,AL,21,1) F(TM,AM,22,1) F(TN,AN,23,1) F(TO,AO,24,1) \ + F(TP,AP,25,1) F(TQ,AQ,26,1) F(TR,AR,27,1) S(T1,1) S(T2,2) S(T3,3) \ + S(T4,4) S(T5,5) S(T6,6) S(T7,7) S(T8,8) S(T9,9) \ + S(TA,10) S(TB,11) S(TC,12) S(TD,13) S(TE,14) S(TF,15) \ + S(TG,16) S(TH,17) S(TI,18) S(TJ,19) S(TK,20) S(TL,21) \ + S(TM,22) S(TN,23) S(TO,24) S(TP,25) S(TQ,26) S(TR,27) +#endif +#else +#define CFARGT14(F,S,M,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE) \ + F(T1,1,0) S(T1,1) F(T2,2,1) S(T2,2) F(T3,3,1) S(T3,3) F(T4,4,1) S(T4,4) \ + F(T5,5,1) S(T5,5) F(T6,6,1) S(T6,6) F(T7,7,1) S(T7,7) F(T8,8,1) S(T8,8) \ + F(T9,9,1) S(T9,9) F(TA,10,1) S(TA,10) F(TB,11,1) S(TB,11) F(TC,12,1) S(TC,12) \ + F(TD,13,1) S(TD,13) F(TE,14,1) S(TE,14) +#define CFARGT27(F,S,M,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM,TN,TO,TP,TQ,TR) \ + F(T1,1,0) S(T1,1) F(T2,2,1) S(T2,2) F(T3,3,1) S(T3,3) F(T4,4,1) S(T4,4) \ + F(T5,5,1) S(T5,5) F(T6,6,1) S(T6,6) F(T7,7,1) S(T7,7) F(T8,8,1) S(T8,8) \ + F(T9,9,1) S(T9,9) F(TA,10,1) S(TA,10) F(TB,11,1) S(TB,11) F(TC,12,1) S(TC,12) \ + F(TD,13,1) S(TD,13) F(TE,14,1) S(TE,14) F(TF,15,1) S(TF,15) F(TG,16,1) S(TG,16) \ + F(TH,17,1) S(TH,17) F(TI,18,1) S(TI,18) F(TJ,19,1) S(TJ,19) F(TK,20,1) S(TK,20) \ + F(TL,21,1) S(TL,21) F(TM,22,1) S(TM,22) F(TN,23,1) S(TN,23) F(TO,24,1) S(TO,24) \ + F(TP,25,1) S(TP,25) F(TQ,26,1) S(TQ,26) F(TR,27,1) S(TR,27) + +#define CFARGT20(F,S,M,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK) \ + F(T1,1,0) S(T1,1) F(T2,2,1) S(T2,2) F(T3,3,1) S(T3,3) F(T4,4,1) S(T4,4) \ + F(T5,5,1) S(T5,5) F(T6,6,1) S(T6,6) F(T7,7,1) S(T7,7) F(T8,8,1) S(T8,8) \ + F(T9,9,1) S(T9,9) F(TA,10,1) S(TA,10) F(TB,11,1) S(TB,11) F(TC,12,1) S(TC,12) \ + F(TD,13,1) S(TD,13) F(TE,14,1) S(TE,14) F(TF,15,1) S(TF,15) F(TG,16,1) S(TG,16) \ + F(TH,17,1) S(TH,17) F(TI,18,1) S(TI,18) F(TJ,19,1) S(TJ,19) F(TK,20,1) S(TK,20) +#define CFARGTA14(F,S,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) \ + F(T1,A1,1,0) S(T1,1) F(T2,A2,2,1) S(T2,2) F(T3,A3,3,1) S(T3,3) \ + F(T4,A4,4,1) S(T4,4) F(T5,A5,5,1) S(T5,5) F(T6,A6,6,1) S(T6,6) \ + F(T7,A7,7,1) S(T7,7) F(T8,A8,8,1) S(T8,8) F(T9,A9,9,1) S(T9,9) \ + F(TA,AA,10,1) S(TA,10) F(TB,AB,11,1) S(TB,11) F(TC,AC,12,1) S(TC,12) \ + F(TD,AD,13,1) S(TD,13) F(TE,AE,14,1) S(TE,14) +#if MAX_PREPRO_ARGS>31 +#define CFARGTA20(F,S,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) \ + F(T1,A1,1,0) S(T1,1) F(T2,A2,2,1) S(T2,2) F(T3,A3,3,1) S(T3,3) \ + F(T4,A4,4,1) S(T4,4) F(T5,A5,5,1) S(T5,5) F(T6,A6,6,1) S(T6,6) \ + F(T7,A7,7,1) S(T7,7) F(T8,A8,8,1) S(T8,8) F(T9,A9,9,1) S(T9,9) \ + F(TA,AA,10,1) S(TA,10) F(TB,AB,11,1) S(TB,11) F(TC,AC,12,1) S(TC,12) \ + F(TD,AD,13,1) S(TD,13) F(TE,AE,14,1) S(TE,14) F(TF,AF,15,1) S(TF,15) \ + F(TG,AG,16,1) S(TG,16) F(TH,AH,17,1) S(TH,17) F(TI,AI,18,1) S(TI,18) \ + F(TJ,AJ,19,1) S(TJ,19) F(TK,AK,20,1) S(TK,20) +#define CFARGTA27(F,S,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM,TN,TO,TP,TQ,TR,A1,A2,A3,A4,A5,A6,A7,A8,A9,AA,AB,AC,AD,AE,AF,AG,AH,AI,AJ,AK,AL,AM,AN,AO,AP,AQ,AR) \ + F(T1,A1,1,0) S(T1,1) F(T2,A2,2,1) S(T2,2) F(T3,A3,3,1) S(T3,3) \ + F(T4,A4,4,1) S(T4,4) F(T5,A5,5,1) S(T5,5) F(T6,A6,6,1) S(T6,6) \ + F(T7,A7,7,1) S(T7,7) F(T8,A8,8,1) S(T8,8) F(T9,A9,9,1) S(T9,9) \ + F(TA,AA,10,1) S(TA,10) F(TB,AB,11,1) S(TB,11) F(TC,AC,12,1) S(TC,12) \ + F(TD,AD,13,1) S(TD,13) F(TE,AE,14,1) S(TE,14) F(TF,AF,15,1) S(TF,15) \ + F(TG,AG,16,1) S(TG,16) F(TH,AH,17,1) S(TH,17) F(TI,AI,18,1) S(TI,18) \ + F(TJ,AJ,19,1) S(TJ,19) F(TK,AK,20,1) S(TK,20) F(TL,AL,21,1) S(TL,21) \ + F(TM,AM,22,1) S(TM,22) F(TN,AN,23,1) S(TN,23) F(TO,AO,24,1) S(TO,24) \ + F(TP,AP,25,1) S(TP,25) F(TQ,AQ,26,1) S(TQ,26) F(TR,AR,27,1) S(TR,27) +#endif +#endif + + +#define PROTOCCALLSFSUB1( UN,LN,T1) \ + PROTOCCALLSFSUB14(UN,LN,T1,CF_0,CF_0,CF_0,CF_0,CF_0,CF_0,CF_0,CF_0,CF_0,CF_0,CF_0,CF_0,CF_0) +#define PROTOCCALLSFSUB2( UN,LN,T1,T2) \ + PROTOCCALLSFSUB14(UN,LN,T1,T2,CF_0,CF_0,CF_0,CF_0,CF_0,CF_0,CF_0,CF_0,CF_0,CF_0,CF_0,CF_0) +#define PROTOCCALLSFSUB3( UN,LN,T1,T2,T3) \ + PROTOCCALLSFSUB14(UN,LN,T1,T2,T3,CF_0,CF_0,CF_0,CF_0,CF_0,CF_0,CF_0,CF_0,CF_0,CF_0,CF_0) +#define PROTOCCALLSFSUB4( UN,LN,T1,T2,T3,T4) \ + PROTOCCALLSFSUB14(UN,LN,T1,T2,T3,T4,CF_0,CF_0,CF_0,CF_0,CF_0,CF_0,CF_0,CF_0,CF_0,CF_0) +#define PROTOCCALLSFSUB5( UN,LN,T1,T2,T3,T4,T5) \ + PROTOCCALLSFSUB14(UN,LN,T1,T2,T3,T4,T5,CF_0,CF_0,CF_0,CF_0,CF_0,CF_0,CF_0,CF_0,CF_0) +#define PROTOCCALLSFSUB6( UN,LN,T1,T2,T3,T4,T5,T6) \ + PROTOCCALLSFSUB14(UN,LN,T1,T2,T3,T4,T5,T6,CF_0,CF_0,CF_0,CF_0,CF_0,CF_0,CF_0,CF_0) +#define PROTOCCALLSFSUB7( UN,LN,T1,T2,T3,T4,T5,T6,T7) \ + PROTOCCALLSFSUB14(UN,LN,T1,T2,T3,T4,T5,T6,T7,CF_0,CF_0,CF_0,CF_0,CF_0,CF_0,CF_0) +#define PROTOCCALLSFSUB8( UN,LN,T1,T2,T3,T4,T5,T6,T7,T8) \ + PROTOCCALLSFSUB14(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,CF_0,CF_0,CF_0,CF_0,CF_0,CF_0) +#define PROTOCCALLSFSUB9( UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9) \ + PROTOCCALLSFSUB14(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,CF_0,CF_0,CF_0,CF_0,CF_0) +#define PROTOCCALLSFSUB10(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA) \ + PROTOCCALLSFSUB14(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,CF_0,CF_0,CF_0,CF_0) +#define PROTOCCALLSFSUB11(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB) \ + PROTOCCALLSFSUB14(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,CF_0,CF_0,CF_0) +#define PROTOCCALLSFSUB12(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC) \ + PROTOCCALLSFSUB14(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,CF_0,CF_0) +#define PROTOCCALLSFSUB13(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD) \ + PROTOCCALLSFSUB14(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,CF_0) + + +#define PROTOCCALLSFSUB15(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF) \ + PROTOCCALLSFSUB20(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) +#define PROTOCCALLSFSUB16(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG) \ + PROTOCCALLSFSUB20(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) +#define PROTOCCALLSFSUB17(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH) \ + PROTOCCALLSFSUB20(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) +#define PROTOCCALLSFSUB18(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI) \ + PROTOCCALLSFSUB20(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,CF_0,CF_0) +#define PROTOCCALLSFSUB19(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ) \ + PROTOCCALLSFSUB20(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,CF_0) + +#define PROTOCCALLSFSUB21(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL) \ + PROTOCCALLSFSUB27(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,CF_0,CF_0,CF_0,CF_0,CF_0,CF_0) +#define PROTOCCALLSFSUB22(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM) \ + PROTOCCALLSFSUB27(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM,CF_0,CF_0,CF_0,CF_0,CF_0) +#define PROTOCCALLSFSUB23(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM,TN) \ + PROTOCCALLSFSUB27(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM,TN,CF_0,CF_0,CF_0,CF_0) +#define PROTOCCALLSFSUB24(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM,TN,TO) \ + PROTOCCALLSFSUB27(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM,TN,TO,CF_0,CF_0,CF_0) +#define PROTOCCALLSFSUB25(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM,TN,TO,TP) \ + PROTOCCALLSFSUB27(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM,TN,TO,TP,CF_0,CF_0) +#define PROTOCCALLSFSUB26(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM,TN,TO,TP,TQ) \ + PROTOCCALLSFSUB27(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM,TN,TO,TP,TQ,CF_0) + + +#ifndef FCALLSC_QUALIFIER +#ifdef VISUAL_CPLUSPLUS +#define FCALLSC_QUALIFIER __stdcall +#else +#define FCALLSC_QUALIFIER +#endif +#endif + +#ifdef __cplusplus +#define CFextern extern "C" +#else +#define CFextern extern +#endif + + +#ifdef CFSUBASFUN +#define PROTOCCALLSFSUB0(UN,LN) \ + PROTOCCALLSFFUN0( VOID,UN,LN) +#define PROTOCCALLSFSUB14(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE) \ + PROTOCCALLSFFUN14(VOID,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)\ + PROTOCCALLSFFUN20(VOID,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK) +#define PROTOCCALLSFSUB27(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM,TN,TO,TP,TQ,TR)\ + PROTOCCALLSFFUN27(VOID,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM,TN,TO,TP,TQ,TR) +#else +/* 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. */ +#define PROTOCCALLSFSUB0(UN,LN) _(VOID,_cfPU)(CFC_(UN,LN))(); +#ifndef __CF__KnR +#define PROTOCCALLSFSUB14(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE) \ + _(VOID,_cfPU)(CFC_(UN,LN))( CFARGT14(NCF,KCF,_Z,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)\ + _(VOID,_cfPU)(CFC_(UN,LN))( CFARGT20(NCF,KCF,_Z,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK) ); +#define PROTOCCALLSFSUB27(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM,TN,TO,TP,TQ,TR)\ + _(VOID,_cfPU)(CFC_(UN,LN))( CFARGT27(NCF,KCF,_Z,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM,TN,TO,TP,TQ,TR) ); +#else +#define PROTOCCALLSFSUB14(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE) \ + PROTOCCALLSFSUB0(UN,LN) +#define PROTOCCALLSFSUB20(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK) \ + PROTOCCALLSFSUB0(UN,LN) +#define PROTOCCALLSFSUB27(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM,TN,TO,TP,TQ,TR) \ + PROTOCCALLSFSUB0(UN,LN) +#endif +#endif + + +#ifdef OLD_VAXC /* Allow %CC-I-PARAMNOTUSED. */ +#pragma standard +#endif + + +#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) + +#ifdef __cplusplus +#define CPPPROTOCLSFSUB0( UN,LN) +#define CPPPROTOCLSFSUB14(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE) +#define CPPPROTOCLSFSUB20(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK) +#define CPPPROTOCLSFSUB27(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM,TN,TO,TP,TQ,TR) +#else +#define CPPPROTOCLSFSUB0(UN,LN) \ + PROTOCCALLSFSUB0(UN,LN) +#define CPPPROTOCLSFSUB14(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE) \ + PROTOCCALLSFSUB14(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE) +#define CPPPROTOCLSFSUB20(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK) \ + PROTOCCALLSFSUB20(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK) +#define CPPPROTOCLSFSUB27(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM,TN,TO,TP,TQ,TR) \ + PROTOCCALLSFSUB27(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM,TN,TO,TP,TQ,TR) +#endif + +#ifdef CFSUBASFUN +#define CCALLSFSUB0(UN,LN) CCALLSFFUN0(UN,LN) +#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)\ + CCALLSFFUN14(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) +#else +/* do{...}while(0) allows if(a==b) FORT(); else BORT(); */ +#define CCALLSFSUB0( UN,LN) do{CPPPROTOCLSFSUB0(UN,LN) CFC_(UN,LN)();}while(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,B10) \ + VVCF(TB,AB,B11) VVCF(TC,AC,B12) VVCF(TD,AD,B13) VVCF(TE,AE,B14) \ + CPPPROTOCLSFSUB14(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,10) ACF(LN,TB,AB,11) \ + ACF(LN,TC,AC,12) ACF(LN,TD,AD,13) ACF(LN,TE,AE,14) \ + CFC_(UN,LN)( CFARGTA14(AACF,JCF,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) );\ + 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,10) \ + WCF(TB,AB,11) WCF(TC,AC,12) WCF(TD,AD,13) WCF(TE,AE,14) }while(0) +#endif + + +#if MAX_PREPRO_ARGS>31 +#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) + +#ifdef CFSUBASFUN +#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) \ + CCALLSFFUN20(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) +#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,B10) \ + VVCF(TB,AB,B11) VVCF(TC,AC,B12) VVCF(TD,AD,B13) VVCF(TE,AE,B14) VVCF(TF,AF,B15) \ + VVCF(TG,AG,B16) VVCF(TH,AH,B17) VVCF(TI,AI,B18) VVCF(TJ,AJ,B19) VVCF(TK,AK,B20) \ + CPPPROTOCLSFSUB20(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,10) ACF(LN,TB,AB,11) ACF(LN,TC,AC,12) \ + ACF(LN,TD,AD,13) ACF(LN,TE,AE,14) ACF(LN,TF,AF,15) ACF(LN,TG,AG,16) \ + ACF(LN,TH,AH,17) ACF(LN,TI,AI,18) ACF(LN,TJ,AJ,19) ACF(LN,TK,AK,20) \ + CFC_(UN,LN)( CFARGTA20(AACF,JCF,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) ); \ + 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,10) WCF(TB,AB,11) WCF(TC,AC,12) \ + WCF(TD,AD,13) WCF(TE,AE,14) WCF(TF,AF,15) WCF(TG,AG,16) WCF(TH,AH,17) WCF(TI,AI,18) \ + WCF(TJ,AJ,19) WCF(TK,AK,20) }while(0) +#endif +#endif /* MAX_PREPRO_ARGS */ + +#if MAX_PREPRO_ARGS>31 +#define CCALLSFSUB21(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,A1,A2,A3,A4,A5,A6,A7,A8,A9,AA,AB,AC,AD,AE,AF,AG,AH,AI,AJ,AK,AL)\ + CCALLSFSUB27(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,CF_0,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,AG,AH,AI,AJ,AK,AL,0,0,0,0,0,0) +#define CCALLSFSUB22(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM,A1,A2,A3,A4,A5,A6,A7,A8,A9,AA,AB,AC,AD,AE,AF,AG,AH,AI,AJ,AK,AL,AM)\ + CCALLSFSUB27(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM,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,AG,AH,AI,AJ,AK,AL,AM,0,0,0,0,0) +#define CCALLSFSUB23(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM,TN,A1,A2,A3,A4,A5,A6,A7,A8,A9,AA,AB,AC,AD,AE,AF,AG,AH,AI,AJ,AK,AL,AM,AN)\ + CCALLSFSUB27(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM,TN,CF_0,CF_0,CF_0,CF_0,A1,A2,A3,A4,A5,A6,A7,A8,A9,AA,AB,AC,AD,AE,AF,AG,AH,AI,AJ,AK,AL,AM,AN,0,0,0,0) +#define CCALLSFSUB24(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM,TN,TO,A1,A2,A3,A4,A5,A6,A7,A8,A9,AA,AB,AC,AD,AE,AF,AG,AH,AI,AJ,AK,AL,AM,AN,AO)\ + CCALLSFSUB27(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM,TN,TO,CF_0,CF_0,CF_0,A1,A2,A3,A4,A5,A6,A7,A8,A9,AA,AB,AC,AD,AE,AF,AG,AH,AI,AJ,AK,AL,AM,AN,AO,0,0,0) +#define CCALLSFSUB25(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM,TN,TO,TP,A1,A2,A3,A4,A5,A6,A7,A8,A9,AA,AB,AC,AD,AE,AF,AG,AH,AI,AJ,AK,AL,AM,AN,AO,AP)\ + CCALLSFSUB27(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM,TN,TO,TP,CF_0,CF_0,A1,A2,A3,A4,A5,A6,A7,A8,A9,AA,AB,AC,AD,AE,AF,AG,AH,AI,AJ,AK,AL,AM,AN,AO,AP,0,0) +#define CCALLSFSUB26(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM,TN,TO,TP,TQ,A1,A2,A3,A4,A5,A6,A7,A8,A9,AA,AB,AC,AD,AE,AF,AG,AH,AI,AJ,AK,AL,AM,AN,AO,AP,AQ)\ + CCALLSFSUB27(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM,TN,TO,TP,TQ,CF_0,A1,A2,A3,A4,A5,A6,A7,A8,A9,AA,AB,AC,AD,AE,AF,AG,AH,AI,AJ,AK,AL,AM,AN,AO,AP,AQ,0) + +#ifdef CFSUBASFUN +#define CCALLSFSUB27(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM,TN,TO,TP,TQ,TR, \ + A1,A2,A3,A4,A5,A6,A7,A8,A9,AA,AB,AC,AD,AE,AF,AG,AH,AI,AJ,AK,AL,AM,AN,AO,AP,AQ,AR) \ + CCALLSFFUN27(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM,TN,TO,TP,TQ,TR, \ + A1,A2,A3,A4,A5,A6,A7,A8,A9,AA,AB,AC,AD,AE,AF,AG,AH,AI,AJ,AK,AL,AM,AN,AO,AP,AQ,AR) +#else +#define CCALLSFSUB27(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM,TN,TO,TP,TQ,TR, \ + A1,A2,A3,A4,A5,A6,A7,A8,A9,AA,AB,AC,AD,AE,AF,AG,AH,AI,AJ,AK,AL,AM,AN,AO,AP,AQ,AR) \ +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,B10) \ + VVCF(TB,AB,B11) VVCF(TC,AC,B12) VVCF(TD,AD,B13) VVCF(TE,AE,B14) VVCF(TF,AF,B15) \ + VVCF(TG,AG,B16) VVCF(TH,AH,B17) VVCF(TI,AI,B18) VVCF(TJ,AJ,B19) VVCF(TK,AK,B20) \ + VVCF(TL,AL,B21) VVCF(TM,AM,B22) VVCF(TN,AN,B23) VVCF(TO,AO,B24) VVCF(TP,AP,B25) \ + VVCF(TQ,AQ,B26) VVCF(TR,AR,B27) \ + CPPPROTOCLSFSUB27(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM,TN,TO,TP,TQ,TR) \ + 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,10) ACF(LN,TB,AB,11) ACF(LN,TC,AC,12) \ + ACF(LN,TD,AD,13) ACF(LN,TE,AE,14) ACF(LN,TF,AF,15) ACF(LN,TG,AG,16) \ + ACF(LN,TH,AH,17) ACF(LN,TI,AI,18) ACF(LN,TJ,AJ,19) ACF(LN,TK,AK,20) \ + ACF(LN,TL,AL,21) ACF(LN,TM,AM,22) ACF(LN,TN,AN,23) ACF(LN,TO,AO,24) \ + ACF(LN,TP,AP,25) ACF(LN,TQ,AQ,26) ACF(LN,TR,AR,27) \ + CFC_(UN,LN)( CFARGTA27(AACF,JCF,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM,TN,TO,TP,TQ,TR,\ + A1,A2,A3,A4,A5,A6,A7,A8,A9,AA,AB,AC,AD,AE,AF,AG,AH,AI,AJ,AK,AL,AM,AN,AO,AP,AQ,AR) ); \ + 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,10) WCF(TB,AB,11) WCF(TC,AC,12) \ + WCF(TD,AD,13) WCF(TE,AE,14) WCF(TF,AF,15) WCF(TG,AG,16) WCF(TH,AH,17) WCF(TI,AI,18) \ + WCF(TJ,AJ,19) WCF(TK,AK,20) WCF(TL,AL,21) WCF(TM,AM,22) WCF(TN,AN,23) WCF(TO,AO,24) \ + WCF(TP,AP,25) WCF(TQ,AQ,26) WCF(TR,AR,27) }while(0) +#endif +#endif /* MAX_PREPRO_ARGS */ + +/*-------------------------------------------------------------------------*/ + +/* 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,cfCOMMA) _(__SEP_,C)(TN,cfCOMMA) +#define __SEP_0(TN,cfCOMMA) +#define __SEP_1(TN,cfCOMMA) _Icf(2,SEP,TN,cfCOMMA,0) +#define INT_cfSEP(T,B) _(A,B) +#define INTV_cfSEP(T,B) INT_cfSEP(T,B) +#define INTVV_cfSEP(T,B) INT_cfSEP(T,B) +#define INTVVV_cfSEP(T,B) INT_cfSEP(T,B) +#define INTVVVV_cfSEP(T,B) INT_cfSEP(T,B) +#define INTVVVVV_cfSEP(T,B) INT_cfSEP(T,B) +#define INTVVVVVV_cfSEP(T,B) INT_cfSEP(T,B) +#define INTVVVVVVV_cfSEP(T,B) INT_cfSEP(T,B) +#define PINT_cfSEP(T,B) INT_cfSEP(T,B) +#define PVOID_cfSEP(T,B) INT_cfSEP(T,B) +#define ROUTINE_cfSEP(T,B) INT_cfSEP(T,B) +#define SIMPLE_cfSEP(T,B) INT_cfSEP(T,B) +#define VOID_cfSEP(T,B) INT_cfSEP(T,B) /* For FORTRAN calls C subr.s.*/ +#define STRING_cfSEP(T,B) INT_cfSEP(T,B) +#define STRINGV_cfSEP(T,B) INT_cfSEP(T,B) +#define PSTRING_cfSEP(T,B) INT_cfSEP(T,B) +#define PSTRINGV_cfSEP(T,B) INT_cfSEP(T,B) +#define PNSTRING_cfSEP(T,B) INT_cfSEP(T,B) +#define PPSTRING_cfSEP(T,B) INT_cfSEP(T,B) +#define ZTRINGV_cfSEP(T,B) INT_cfSEP(T,B) +#define PZTRINGV_cfSEP(T,B) INT_cfSEP(T,B) + +#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 BYTEVVVVVVV_cfTYPE INTEGER_BYTE +#define DOUBLEVVVVVVV_cfTYPE DOUBLE_PRECISION +#define FLOATVVVVVVV_cfTYPE FORTRAN_REAL +#define INTVVVVVVV_cfTYPE int +#define LOGICALVVVVVVV_cfTYPE int +#define LONGVVVVVVV_cfTYPE long +#define LONGLONGVVVVVVV_cfTYPE LONGLONG /* added by MR December 2005 */ +#define SHORTVVVVVVV_cfTYPE short +#define PBYTE_cfTYPE INTEGER_BYTE +#define PDOUBLE_cfTYPE DOUBLE_PRECISION +#define PFLOAT_cfTYPE FORTRAN_REAL +#define PINT_cfTYPE int +#define PLOGICAL_cfTYPE int +#define PLONG_cfTYPE long +#define PLONGLONG_cfTYPE LONGLONG /* added by MR December 2005 */ +#define PSHORT_cfTYPE short + +#define CFARGS0(A,T,V,W,X,Y,Z) _3(T,_cf,A) +#define CFARGS1(A,T,V,W,X,Y,Z) _3(T,_cf,A)(V) +#define CFARGS2(A,T,V,W,X,Y,Z) _3(T,_cf,A)(V,W) +#define CFARGS3(A,T,V,W,X,Y,Z) _3(T,_cf,A)(V,W,X) +#define CFARGS4(A,T,V,W,X,Y,Z) _3(T,_cf,A)(V,W,X,Y) +#define CFARGS5(A,T,V,W,X,Y,Z) _3(T,_cf,A)(V,W,X,Y,Z) + +#define _Icf(N,T,I,X,Y) _(I,_cfINT)(N,T,I,X,Y,0) +#define _Icf4(N,T,I,X,Y,Z) _(I,_cfINT)(N,T,I,X,Y,Z) +#define BYTE_cfINT(N,A,B,X,Y,Z) DOUBLE_cfINT(N,A,B,X,Y,Z) +#define DOUBLE_cfINT(N,A,B,X,Y,Z) _(CFARGS,N)(A,INT,B,X,Y,Z,0) +#define FLOAT_cfINT(N,A,B,X,Y,Z) DOUBLE_cfINT(N,A,B,X,Y,Z) +#define INT_cfINT(N,A,B,X,Y,Z) DOUBLE_cfINT(N,A,B,X,Y,Z) +#define LOGICAL_cfINT(N,A,B,X,Y,Z) DOUBLE_cfINT(N,A,B,X,Y,Z) +#define LONG_cfINT(N,A,B,X,Y,Z) DOUBLE_cfINT(N,A,B,X,Y,Z) +#define LONGLONG_cfINT(N,A,B,X,Y,Z) DOUBLE_cfINT(N,A,B,X,Y,Z) /* added by MR December 2005 */ +#define SHORT_cfINT(N,A,B,X,Y,Z) DOUBLE_cfINT(N,A,B,X,Y,Z) +#define PBYTE_cfINT(N,A,B,X,Y,Z) PDOUBLE_cfINT(N,A,B,X,Y,Z) +#define PDOUBLE_cfINT(N,A,B,X,Y,Z) _(CFARGS,N)(A,PINT,B,X,Y,Z,0) +#define PFLOAT_cfINT(N,A,B,X,Y,Z) PDOUBLE_cfINT(N,A,B,X,Y,Z) +#define PINT_cfINT(N,A,B,X,Y,Z) PDOUBLE_cfINT(N,A,B,X,Y,Z) +#define PLOGICAL_cfINT(N,A,B,X,Y,Z) PDOUBLE_cfINT(N,A,B,X,Y,Z) +#define PLONG_cfINT(N,A,B,X,Y,Z) PDOUBLE_cfINT(N,A,B,X,Y,Z) +#define PLONGLONG_cfINT(N,A,B,X,Y,Z) PDOUBLE_cfINT(N,A,B,X,Y,Z) /* added by MR December 2005 */ +#define PSHORT_cfINT(N,A,B,X,Y,Z) PDOUBLE_cfINT(N,A,B,X,Y,Z) +#define BYTEV_cfINT(N,A,B,X,Y,Z) DOUBLEV_cfINT(N,A,B,X,Y,Z) +#define BYTEVV_cfINT(N,A,B,X,Y,Z) DOUBLEVV_cfINT(N,A,B,X,Y,Z) +#define BYTEVVV_cfINT(N,A,B,X,Y,Z) DOUBLEVVV_cfINT(N,A,B,X,Y,Z) +#define BYTEVVVV_cfINT(N,A,B,X,Y,Z) DOUBLEVVVV_cfINT(N,A,B,X,Y,Z) +#define BYTEVVVVV_cfINT(N,A,B,X,Y,Z) DOUBLEVVVVV_cfINT(N,A,B,X,Y,Z) +#define BYTEVVVVVV_cfINT(N,A,B,X,Y,Z) DOUBLEVVVVVV_cfINT(N,A,B,X,Y,Z) +#define BYTEVVVVVVV_cfINT(N,A,B,X,Y,Z) DOUBLEVVVVVVV_cfINT(N,A,B,X,Y,Z) +#define DOUBLEV_cfINT(N,A,B,X,Y,Z) _(CFARGS,N)(A,INTV,B,X,Y,Z,0) +#define DOUBLEVV_cfINT(N,A,B,X,Y,Z) _(CFARGS,N)(A,INTVV,B,X,Y,Z,0) +#define DOUBLEVVV_cfINT(N,A,B,X,Y,Z) _(CFARGS,N)(A,INTVVV,B,X,Y,Z,0) +#define DOUBLEVVVV_cfINT(N,A,B,X,Y,Z) _(CFARGS,N)(A,INTVVVV,B,X,Y,Z,0) +#define DOUBLEVVVVV_cfINT(N,A,B,X,Y,Z) _(CFARGS,N)(A,INTVVVVV,B,X,Y,Z,0) +#define DOUBLEVVVVVV_cfINT(N,A,B,X,Y,Z) _(CFARGS,N)(A,INTVVVVVV,B,X,Y,Z,0) +#define DOUBLEVVVVVVV_cfINT(N,A,B,X,Y,Z) _(CFARGS,N)(A,INTVVVVVVV,B,X,Y,Z,0) +#define FLOATV_cfINT(N,A,B,X,Y,Z) DOUBLEV_cfINT(N,A,B,X,Y,Z) +#define FLOATVV_cfINT(N,A,B,X,Y,Z) DOUBLEVV_cfINT(N,A,B,X,Y,Z) +#define FLOATVVV_cfINT(N,A,B,X,Y,Z) DOUBLEVVV_cfINT(N,A,B,X,Y,Z) +#define FLOATVVVV_cfINT(N,A,B,X,Y,Z) DOUBLEVVVV_cfINT(N,A,B,X,Y,Z) +#define FLOATVVVVV_cfINT(N,A,B,X,Y,Z) DOUBLEVVVVV_cfINT(N,A,B,X,Y,Z) +#define FLOATVVVVVV_cfINT(N,A,B,X,Y,Z) DOUBLEVVVVVV_cfINT(N,A,B,X,Y,Z) +#define FLOATVVVVVVV_cfINT(N,A,B,X,Y,Z) DOUBLEVVVVVVV_cfINT(N,A,B,X,Y,Z) +#define INTV_cfINT(N,A,B,X,Y,Z) DOUBLEV_cfINT(N,A,B,X,Y,Z) +#define INTVV_cfINT(N,A,B,X,Y,Z) DOUBLEVV_cfINT(N,A,B,X,Y,Z) +#define INTVVV_cfINT(N,A,B,X,Y,Z) DOUBLEVVV_cfINT(N,A,B,X,Y,Z) +#define INTVVVV_cfINT(N,A,B,X,Y,Z) DOUBLEVVVV_cfINT(N,A,B,X,Y,Z) +#define INTVVVVV_cfINT(N,A,B,X,Y,Z) DOUBLEVVVVV_cfINT(N,A,B,X,Y,Z) +#define INTVVVVVV_cfINT(N,A,B,X,Y,Z) DOUBLEVVVVVV_cfINT(N,A,B,X,Y,Z) +#define INTVVVVVVV_cfINT(N,A,B,X,Y,Z) DOUBLEVVVVVVV_cfINT(N,A,B,X,Y,Z) +#define LOGICALV_cfINT(N,A,B,X,Y,Z) DOUBLEV_cfINT(N,A,B,X,Y,Z) +#define LOGICALVV_cfINT(N,A,B,X,Y,Z) DOUBLEVV_cfINT(N,A,B,X,Y,Z) +#define LOGICALVVV_cfINT(N,A,B,X,Y,Z) DOUBLEVVV_cfINT(N,A,B,X,Y,Z) +#define LOGICALVVVV_cfINT(N,A,B,X,Y,Z) DOUBLEVVVV_cfINT(N,A,B,X,Y,Z) +#define LOGICALVVVVV_cfINT(N,A,B,X,Y,Z) DOUBLEVVVVV_cfINT(N,A,B,X,Y,Z) +#define LOGICALVVVVVV_cfINT(N,A,B,X,Y,Z) DOUBLEVVVVVV_cfINT(N,A,B,X,Y,Z) +#define LOGICALVVVVVVV_cfINT(N,A,B,X,Y,Z) DOUBLEVVVVVVV_cfINT(N,A,B,X,Y,Z) +#define LONGV_cfINT(N,A,B,X,Y,Z) DOUBLEV_cfINT(N,A,B,X,Y,Z) +#define LONGVV_cfINT(N,A,B,X,Y,Z) DOUBLEVV_cfINT(N,A,B,X,Y,Z) +#define LONGVVV_cfINT(N,A,B,X,Y,Z) DOUBLEVVV_cfINT(N,A,B,X,Y,Z) +#define LONGVVVV_cfINT(N,A,B,X,Y,Z) DOUBLEVVVV_cfINT(N,A,B,X,Y,Z) +#define LONGVVVVV_cfINT(N,A,B,X,Y,Z) DOUBLEVVVVV_cfINT(N,A,B,X,Y,Z) +#define LONGVVVVVV_cfINT(N,A,B,X,Y,Z) DOUBLEVVVVVV_cfINT(N,A,B,X,Y,Z) +#define LONGVVVVVVV_cfINT(N,A,B,X,Y,Z) DOUBLEVVVVVVV_cfINT(N,A,B,X,Y,Z) +#define LONGLONGV_cfINT(N,A,B,X,Y,Z) DOUBLEV_cfINT(N,A,B,X,Y,Z) /* added by MR December 2005 */ +#define LONGLONGVV_cfINT(N,A,B,X,Y,Z) DOUBLEVV_cfINT(N,A,B,X,Y,Z) /* added by MR December 2005 */ +#define LONGLONGVVV_cfINT(N,A,B,X,Y,Z) DOUBLEVVV_cfINT(N,A,B,X,Y,Z) /* added by MR December 2005 */ +#define LONGLONGVVVV_cfINT(N,A,B,X,Y,Z) DOUBLEVVVV_cfINT(N,A,B,X,Y,Z) /* added by MR December 2005 */ +#define LONGLONGVVVVV_cfINT(N,A,B,X,Y,Z) DOUBLEVVVVV_cfINT(N,A,B,X,Y,Z) /* added by MR December 2005 */ +#define LONGLONGVVVVVV_cfINT(N,A,B,X,Y,Z) DOUBLEVVVVVV_cfINT(N,A,B,X,Y,Z) /* added by MR December 2005 */ +#define LONGLONGVVVVVVV_cfINT(N,A,B,X,Y,Z) DOUBLEVVVVVVV_cfINT(N,A,B,X,Y,Z) /* added by MR December 2005 */ +#define SHORTV_cfINT(N,A,B,X,Y,Z) DOUBLEV_cfINT(N,A,B,X,Y,Z) +#define SHORTVV_cfINT(N,A,B,X,Y,Z) DOUBLEVV_cfINT(N,A,B,X,Y,Z) +#define SHORTVVV_cfINT(N,A,B,X,Y,Z) DOUBLEVVV_cfINT(N,A,B,X,Y,Z) +#define SHORTVVVV_cfINT(N,A,B,X,Y,Z) DOUBLEVVVV_cfINT(N,A,B,X,Y,Z) +#define SHORTVVVVV_cfINT(N,A,B,X,Y,Z) DOUBLEVVVVV_cfINT(N,A,B,X,Y,Z) +#define SHORTVVVVVV_cfINT(N,A,B,X,Y,Z) DOUBLEVVVVVV_cfINT(N,A,B,X,Y,Z) +#define SHORTVVVVVVV_cfINT(N,A,B,X,Y,Z) DOUBLEVVVVVVV_cfINT(N,A,B,X,Y,Z) +#define PVOID_cfINT(N,A,B,X,Y,Z) _(CFARGS,N)(A,B,B,X,Y,Z,0) +#define ROUTINE_cfINT(N,A,B,X,Y,Z) PVOID_cfINT(N,A,B,X,Y,Z) +/*CRAY coughs on the first, + i.e. the usual trouble of not being able to + define macros to macros with arguments. + New ultrix is worse, it coughs on all such uses. + */ +/*#define SIMPLE_cfINT PVOID_cfINT*/ +#define SIMPLE_cfINT(N,A,B,X,Y,Z) PVOID_cfINT(N,A,B,X,Y,Z) +#define VOID_cfINT(N,A,B,X,Y,Z) PVOID_cfINT(N,A,B,X,Y,Z) +#define STRING_cfINT(N,A,B,X,Y,Z) PVOID_cfINT(N,A,B,X,Y,Z) +#define STRINGV_cfINT(N,A,B,X,Y,Z) PVOID_cfINT(N,A,B,X,Y,Z) +#define PSTRING_cfINT(N,A,B,X,Y,Z) PVOID_cfINT(N,A,B,X,Y,Z) +#define PSTRINGV_cfINT(N,A,B,X,Y,Z) PVOID_cfINT(N,A,B,X,Y,Z) +#define PNSTRING_cfINT(N,A,B,X,Y,Z) PVOID_cfINT(N,A,B,X,Y,Z) +#define PPSTRING_cfINT(N,A,B,X,Y,Z) PVOID_cfINT(N,A,B,X,Y,Z) +#define ZTRINGV_cfINT(N,A,B,X,Y,Z) PVOID_cfINT(N,A,B,X,Y,Z) +#define PZTRINGV_cfINT(N,A,B,X,Y,Z) PVOID_cfINT(N,A,B,X,Y,Z) +#define CF_0_cfINT(N,A,B,X,Y,Z) + + +#define UCF(TN,I,C) _SEP_(TN,C,cfCOMMA) _Icf(2,U,TN,_(A,I),0) +#define UUCF(TN,I,C) _SEP_(TN,C,cfCOMMA) _SEP_(TN,1,I) +#define UUUCF(TN,I,C) _SEP_(TN,C,cfCOLON) _Icf(2,U,TN,_(A,I),0) +#define INT_cfU(T,A) _(T,VVVVVVV_cfTYPE) A +#define INTV_cfU(T,A) _(T,VVVVVV_cfTYPE) * A +#define INTVV_cfU(T,A) _(T,VVVVV_cfTYPE) * A +#define INTVVV_cfU(T,A) _(T,VVVV_cfTYPE) * A +#define INTVVVV_cfU(T,A) _(T,VVV_cfTYPE) * A +#define INTVVVVV_cfU(T,A) _(T,VV_cfTYPE) * A +#define INTVVVVVV_cfU(T,A) _(T,V_cfTYPE) * A +#define INTVVVVVVV_cfU(T,A) _(T,_cfTYPE) * A +#define PINT_cfU(T,A) _(T,_cfTYPE) * A +#define PVOID_cfU(T,A) void *A +#define ROUTINE_cfU(T,A) void (*A)(CF_NULL_PROTO) +#define VOID_cfU(T,A) void A /* Needed for C calls FORTRAN sub.s. */ +#define STRING_cfU(T,A) char *A /* via VOID and wrapper. */ +#define STRINGV_cfU(T,A) char *A +#define PSTRING_cfU(T,A) char *A +#define PSTRINGV_cfU(T,A) char *A +#define ZTRINGV_cfU(T,A) char *A +#define PZTRINGV_cfU(T,A) char *A + +/* VOID breaks U into U and UU. */ +#define INT_cfUU(T,A) _(T,VVVVVVV_cfTYPE) A +#define VOID_cfUU(T,A) /* Needed for FORTRAN calls C sub.s. */ +#define STRING_cfUU(T,A) const char *A + + +#define BYTE_cfPU(A) CFextern INTEGER_BYTE FCALLSC_QUALIFIER A +#define DOUBLE_cfPU(A) CFextern DOUBLE_PRECISION FCALLSC_QUALIFIER A +#if ! (defined(FLOATFUNCTIONTYPE)&&defined(ASSIGNFLOAT)&&defined(RETURNFLOAT)) +#if defined (f2cFortran) && ! defined (gFortran) +/* f2c/g77 return double from FORTRAN REAL functions. (KMCCARTY, 2005/12/09) */ +#define FLOAT_cfPU(A) CFextern DOUBLE_PRECISION FCALLSC_QUALIFIER A +#else +#define FLOAT_cfPU(A) CFextern FORTRAN_REAL FCALLSC_QUALIFIER A +#endif +#else +#define FLOAT_cfPU(A) CFextern FLOATFUNCTIONTYPE FCALLSC_QUALIFIER A +#endif +#define INT_cfPU(A) CFextern int FCALLSC_QUALIFIER A +#define LOGICAL_cfPU(A) CFextern int FCALLSC_QUALIFIER A +#define LONG_cfPU(A) CFextern long FCALLSC_QUALIFIER A +#define SHORT_cfPU(A) CFextern short FCALLSC_QUALIFIER A +#define STRING_cfPU(A) CFextern void FCALLSC_QUALIFIER A +#define VOID_cfPU(A) CFextern void FCALLSC_QUALIFIER A + +#define BYTE_cfE INTEGER_BYTE A0; +#define DOUBLE_cfE DOUBLE_PRECISION A0; +#if ! (defined(FLOATFUNCTIONTYPE)&&defined(ASSIGNFLOAT)&&defined(RETURNFLOAT)) +#define FLOAT_cfE FORTRAN_REAL A0; +#else +#define FLOAT_cfE FORTRAN_REAL AA0; FLOATFUNCTIONTYPE A0; +#endif +#define INT_cfE int A0; +#define LOGICAL_cfE int A0; +#define LONG_cfE long A0; +#define SHORT_cfE short A0; +#define VOID_cfE +#ifdef vmsFortran +#define STRING_cfE static char AA0[1+MAX_LEN_FORTRAN_FUNCTION_STRING]; \ + 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 STRING_cfE static char AA0[1+MAX_LEN_FORTRAN_FUNCTION_STRING]; \ + 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 +/* 'cc: SC3.0.1 13 Jul 1994' barfs on char A0[0x4FE+1]; + * char A0[0x4FE +1]; char A0[1+0x4FE]; are both OK. */ +#define STRING_cfE static char A0[1+MAX_LEN_FORTRAN_FUNCTION_STRING]; \ + 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 INT_cfGZ(T,UN,LN) A0=CFC_(UN,LN)( +#define VOID_cfGZ(T,UN,LN) CFC_(UN,LN)( +#ifdef vmsFortran +#define STRING_cfGZ(T,UN,LN) CFC_(UN,LN)(&A0 +#else +#if defined(CRAYFortran) || defined(AbsoftUNIXFortran) || defined(AbsoftProFortran) +#define STRING_cfGZ(T,UN,LN) CFC_(UN,LN)( A0 +#else +#define STRING_cfGZ(T,UN,LN) CFC_(UN,LN)( A0,MAX_LEN_FORTRAN_FUNCTION_STRING +#endif +#endif + +#define INT_cfG(T,UN,LN) INT_cfGZ(T,UN,LN) +#define VOID_cfG(T,UN,LN) VOID_cfGZ(T,UN,LN) +#define STRING_cfG(T,UN,LN) STRING_cfGZ(T,UN,LN), /*, is only diff. from _cfG*/ + +#define BYTEVVVVVVV_cfPP +#define INTVVVVVVV_cfPP /* These complement FLOATVVVVVVV_cfPP. */ +#define DOUBLEVVVVVVV_cfPP +#define LOGICALVVVVVVV_cfPP +#define LONGVVVVVVV_cfPP +#define SHORTVVVVVVV_cfPP +#define PBYTE_cfPP +#define PINT_cfPP +#define PDOUBLE_cfPP +#define PLOGICAL_cfPP +#define PLONG_cfPP +#define PSHORT_cfPP +#define PFLOAT_cfPP FLOATVVVVVVV_cfPP + +#define BCF(TN,AN,C) _SEP_(TN,C,cfCOMMA) _Icf(2,B,TN,AN,0) +#define INT_cfB(T,A) (_(T,VVVVVVV_cfTYPE)) A +#define INTV_cfB(T,A) A +#define INTVV_cfB(T,A) (A)[0] +#define INTVVV_cfB(T,A) (A)[0][0] +#define INTVVVV_cfB(T,A) (A)[0][0][0] +#define INTVVVVV_cfB(T,A) (A)[0][0][0][0] +#define INTVVVVVV_cfB(T,A) (A)[0][0][0][0][0] +#define INTVVVVVVV_cfB(T,A) (A)[0][0][0][0][0][0] +#define PINT_cfB(T,A) _(T,_cfPP)&A +#define STRING_cfB(T,A) (char *) A +#define STRINGV_cfB(T,A) (char *) A +#define PSTRING_cfB(T,A) (char *) A +#define PSTRINGV_cfB(T,A) (char *) A +#define PVOID_cfB(T,A) (void *) A +#define ROUTINE_cfB(T,A) (cfCAST_FUNCTION)A +#define ZTRINGV_cfB(T,A) (char *) A +#define PZTRINGV_cfB(T,A) (char *) A + +#define SCF(TN,NAME,I,A) _(TN,_cfSTR)(3,S,NAME,I,A,0,0) +#define DEFAULT_cfS(M,I,A) +#define LOGICAL_cfS(M,I,A) +#define PLOGICAL_cfS(M,I,A) +#define STRING_cfS(M,I,A) ,sizeof(A) +#define STRINGV_cfS(M,I,A) ,( (unsigned)0xFFFF*firstindexlength(A) \ + +secondindexlength(A)) +#define PSTRING_cfS(M,I,A) ,sizeof(A) +#define PSTRINGV_cfS(M,I,A) STRINGV_cfS(M,I,A) +#define ZTRINGV_cfS(M,I,A) +#define PZTRINGV_cfS(M,I,A) + +#define HCF(TN,I) _(TN,_cfSTR)(3,H,cfCOMMA, H,_(C,I),0,0) +#define HHCF(TN,I) _(TN,_cfSTR)(3,H,cfCOMMA,HH,_(C,I),0,0) +#define HHHCF(TN,I) _(TN,_cfSTR)(3,H,cfCOLON, H,_(C,I),0,0) +#define H_CF_SPECIAL unsigned +#define HH_CF_SPECIAL +#define DEFAULT_cfH(M,I,A) +#define LOGICAL_cfH(S,U,B) +#define PLOGICAL_cfH(S,U,B) +#define STRING_cfH(S,U,B) _(A,S) _(U,_CF_SPECIAL) B +#define STRINGV_cfH(S,U,B) STRING_cfH(S,U,B) +#define PSTRING_cfH(S,U,B) STRING_cfH(S,U,B) +#define PSTRINGV_cfH(S,U,B) STRING_cfH(S,U,B) +#define PNSTRING_cfH(S,U,B) STRING_cfH(S,U,B) +#define PPSTRING_cfH(S,U,B) STRING_cfH(S,U,B) +#define ZTRINGV_cfH(S,U,B) +#define PZTRINGV_cfH(S,U,B) + +/* Need VOID_cfSTR because Absoft forced function types go through _cfSTR. */ +/* No spaces inside expansion. They screws up macro catenation kludge. */ +#define VOID_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) +#define BYTE_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) +#define DOUBLE_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) +#define FLOAT_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) +#define INT_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) +#define LOGICAL_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,LOGICAL,A,B,C,D,E) +#define LONG_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) +#define LONGLONG_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) /* added by MR December 2005 */ +#define SHORT_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) +#define BYTEV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) +#define BYTEVV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) +#define BYTEVVV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) +#define BYTEVVVV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) +#define BYTEVVVVV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) +#define BYTEVVVVVV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) +#define BYTEVVVVVVV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) +#define DOUBLEV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) +#define DOUBLEVV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) +#define DOUBLEVVV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) +#define DOUBLEVVVV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) +#define DOUBLEVVVVV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) +#define DOUBLEVVVVVV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) +#define DOUBLEVVVVVVV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) +#define FLOATV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) +#define FLOATVV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) +#define FLOATVVV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) +#define FLOATVVVV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) +#define FLOATVVVVV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) +#define FLOATVVVVVV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) +#define FLOATVVVVVVV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) +#define INTV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) +#define INTVV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) +#define INTVVV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) +#define INTVVVV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) +#define INTVVVVV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) +#define INTVVVVVV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) +#define INTVVVVVVV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) +#define LOGICALV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) +#define LOGICALVV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) +#define LOGICALVVV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) +#define LOGICALVVVV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) +#define LOGICALVVVVV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) +#define LOGICALVVVVVV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) +#define LOGICALVVVVVVV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) +#define LONGV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) +#define LONGVV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) +#define LONGVVV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) +#define LONGVVVV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) +#define LONGVVVVV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) +#define LONGVVVVVV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) +#define LONGVVVVVVV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) +#define LONGLONGV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) /* added by MR December 2005 */ +#define LONGLONGVV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) /* added by MR December 2005 */ +#define LONGLONGVVV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) /* added by MR December 2005 */ +#define LONGLONGVVVV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) /* added by MR December 2005 */ +#define LONGLONGVVVVV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) /* added by MR December 2005 */ +#define LONGLONGVVVVVV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) /* added by MR December 2005 */ +#define LONGLONGVVVVVVV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) /* added by MR December 2005 */ +#define SHORTV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) +#define SHORTVV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) +#define SHORTVVV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) +#define SHORTVVVV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) +#define SHORTVVVVV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) +#define SHORTVVVVVV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) +#define SHORTVVVVVVV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) +#define PBYTE_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) +#define PDOUBLE_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) +#define PFLOAT_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) +#define PINT_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) +#define PLOGICAL_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,PLOGICAL,A,B,C,D,E) +#define PLONG_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) +#define PLONGLONG_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) /* added by MR December 2005 */ +#define PSHORT_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) +#define STRING_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,STRING,A,B,C,D,E) +#define PSTRING_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,PSTRING,A,B,C,D,E) +#define STRINGV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,STRINGV,A,B,C,D,E) +#define PSTRINGV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,PSTRINGV,A,B,C,D,E) +#define PNSTRING_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,PNSTRING,A,B,C,D,E) +#define PPSTRING_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,PPSTRING,A,B,C,D,E) +#define PVOID_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) +#define ROUTINE_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) +#define SIMPLE_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E) +#define ZTRINGV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,ZTRINGV,A,B,C,D,E) +#define PZTRINGV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,PZTRINGV,A,B,C,D,E) +#define CF_0_cfSTR(N,T,A,B,C,D,E) + +/* See ACF table comments, which explain why CCF was split into two. */ +#define CCF(NAME,TN,I) _(TN,_cfSTR)(5,C,NAME,I,_(A,I),_(B,I),_(C,I)) +#define DEFAULT_cfC(M,I,A,B,C) +#define LOGICAL_cfC(M,I,A,B,C) A=C2FLOGICAL( A); +#define PLOGICAL_cfC(M,I,A,B,C) *A=C2FLOGICAL(*A); +#ifdef vmsFortran +#define STRING_cfC(M,I,A,B,C) (B.clen=strlen(A),B.f.dsc$a_pointer=A, \ + C==sizeof(char*)||C==(unsigned)(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')); + /* PSTRING_cfC to beware of array A which does not contain any \0. */ +#define PSTRING_cfC(M,I,A,B,C) (B.dsc$a_pointer=A, C==sizeof(char*) ? \ + B.dsc$w_length=strlen(A): (A[C-1]='\0',B.dsc$w_length=strlen(A), \ + (unsigned)memset((A)+B.dsc$w_length,' ',C-B.dsc$w_length-1), B.dsc$w_length=C-1)); +#else +#define STRING_cfC(M,I,A,B,C) (B.nombre=A,B.clen=(unsigned)strlen(A), \ + C==sizeof(char*)||C==(unsigned)(B.clen+1)?B.flen=B.clen: \ + (unsigned)(memset(B.nombre+B.clen,' ',C-B.clen-1),B.nombre[B.flen=C-1]='\0')); +#define PSTRING_cfC(M,I,A,B,C) (C==sizeof(char*)? B=strlen(A): \ + (A[C-1]='\0',B=strlen(A),memset((A)+B,' ',C-B-1),B=C-1)); +#endif + /* For CRAYFortran for (P)STRINGV_cfC, B.fs is set, but irrelevant. */ +#define STRINGV_cfC(M,I,A,B,C) \ + AATRINGV_cfA( A,B,(C/0xFFFF)*(C%0xFFFF),C/0xFFFF,C%0xFFFF) +#define PSTRINGV_cfC(M,I,A,B,C) \ + APATRINGV_cfA( A,B,(C/0xFFFF)*(C%0xFFFF),C/0xFFFF,C%0xFFFF) +#define ZTRINGV_cfC(M,I,A,B,C) \ + AATRINGV_cfA( A,B, (_3(M,_ELEMS_,I))*((_3(M,_ELEMLEN_,I))+1), \ + (_3(M,_ELEMS_,I)), (_3(M,_ELEMLEN_,I))+1 ) +#define PZTRINGV_cfC(M,I,A,B,C) \ + APATRINGV_cfA( A,B, (_3(M,_ELEMS_,I))*((_3(M,_ELEMLEN_,I))+1), \ + (_3(M,_ELEMS_,I)), (_3(M,_ELEMLEN_,I))+1 ) + +#define BYTE_cfCCC(A,B) &A +#define DOUBLE_cfCCC(A,B) &A +#if !defined(__CF__KnR) +#define FLOAT_cfCCC(A,B) &A + /* Although the VAX doesn't, at least the */ +#else /* HP and K&R mips promote float arg.'s of */ +#define FLOAT_cfCCC(A,B) &B /* unprototyped functions to double. Cannot */ +#endif /* use A here to pass the argument to FORTRAN. */ +#define INT_cfCCC(A,B) &A +#define LOGICAL_cfCCC(A,B) &A +#define LONG_cfCCC(A,B) &A +#define SHORT_cfCCC(A,B) &A +#define PBYTE_cfCCC(A,B) A +#define PDOUBLE_cfCCC(A,B) A +#define PFLOAT_cfCCC(A,B) A +#define PINT_cfCCC(A,B) A +#define PLOGICAL_cfCCC(A,B) B=A /* B used to keep a common W table. */ +#define PLONG_cfCCC(A,B) A +#define PSHORT_cfCCC(A,B) A + +#define CCCF(TN,I,M) _SEP_(TN,M,cfCOMMA) _Icf(3,CC,TN,_(A,I),_(B,I)) +#define INT_cfCC(T,A,B) _(T,_cfCCC)(A,B) +#define INTV_cfCC(T,A,B) A +#define INTVV_cfCC(T,A,B) A +#define INTVVV_cfCC(T,A,B) A +#define INTVVVV_cfCC(T,A,B) A +#define INTVVVVV_cfCC(T,A,B) A +#define INTVVVVVV_cfCC(T,A,B) A +#define INTVVVVVVV_cfCC(T,A,B) A +#define PINT_cfCC(T,A,B) _(T,_cfCCC)(A,B) +#define PVOID_cfCC(T,A,B) A +#if defined(apolloFortran) || defined(hpuxFortran800) || defined(AbsoftUNIXFortran) +#define ROUTINE_cfCC(T,A,B) &A +#else +#define ROUTINE_cfCC(T,A,B) A +#endif +#define SIMPLE_cfCC(T,A,B) A +#ifdef vmsFortran +#define STRING_cfCC(T,A,B) &B.f +#define STRINGV_cfCC(T,A,B) &B +#define PSTRING_cfCC(T,A,B) &B +#define PSTRINGV_cfCC(T,A,B) &B +#else +#ifdef CRAYFortran +#define STRING_cfCC(T,A,B) _cptofcd(A,B.flen) +#define STRINGV_cfCC(T,A,B) _cptofcd(B.s,B.flen) +#define PSTRING_cfCC(T,A,B) _cptofcd(A,B) +#define PSTRINGV_cfCC(T,A,B) _cptofcd(A,B.flen) +#else +#define STRING_cfCC(T,A,B) A +#define STRINGV_cfCC(T,A,B) B.fs +#define PSTRING_cfCC(T,A,B) A +#define PSTRINGV_cfCC(T,A,B) B.fs +#endif +#endif +#define ZTRINGV_cfCC(T,A,B) STRINGV_cfCC(T,A,B) +#define PZTRINGV_cfCC(T,A,B) PSTRINGV_cfCC(T,A,B) + +#define BYTE_cfX return A0; +#define DOUBLE_cfX return A0; +#if ! (defined(FLOATFUNCTIONTYPE)&&defined(ASSIGNFLOAT)&&defined(RETURNFLOAT)) +#define FLOAT_cfX return A0; +#else +#define FLOAT_cfX ASSIGNFLOAT(AA0,A0); return AA0; +#endif +#define INT_cfX return A0; +#define LOGICAL_cfX return F2CLOGICAL(A0); +#define LONG_cfX return A0; +#define SHORT_cfX return A0; +#define VOID_cfX return ; +#if defined(vmsFortran) || defined(CRAYFortran) +#define STRING_cfX return kill_trailing( \ + kill_trailing(AA0,CFORTRAN_NON_CHAR),' '); +#else +#define STRING_cfX 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)\ + CCALLSFFUN14(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 CCALLSFFUN11(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,A1,A2,A3,A4,A5,A6,A7,A8,A9,AA,AB)\ + CCALLSFFUN14(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 CCALLSFFUN12(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)\ + CCALLSFFUN14(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 CCALLSFFUN13(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)\ + CCALLSFFUN14(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 CCALLSFFUN14(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)\ +((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) \ + BCF(TB,AB,1) BCF(TC,AC,1) BCF(TD,AD,1) BCF(TE,AE,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,10,AA) SCF(TB,LN,11,AB) SCF(TC,LN,12,AC) \ + SCF(TD,LN,13,AD) SCF(TE,LN,14,AE)))) + +/* 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) \ +_(F,_cfPU)( CFC_(UN,LN))(CF_NULL_PROTO); \ +static _Icf(2,U,F,CFFUN(UN),0)() {_(F,_cfE) _Icf(3,GZ,F,UN,LN) ABSOFT_cf1(F));_(F,_cfX)} + +#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) +#define PROTOCCALLSFFUN10(T0,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA) \ + PROTOCCALLSFFUN14(T0,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,CF_0,CF_0,CF_0,CF_0) +#define PROTOCCALLSFFUN11(T0,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB) \ + PROTOCCALLSFFUN14(T0,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,CF_0,CF_0,CF_0) +#define PROTOCCALLSFFUN12(T0,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC) \ + PROTOCCALLSFFUN14(T0,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,CF_0,CF_0) +#define PROTOCCALLSFFUN13(T0,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD) \ + PROTOCCALLSFFUN14(T0,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,CF_0) + +/* HP/UX 9.01 cc requires the blank between '_Icf(3,G,T0,UN,LN) CCCF(T1,1,0)' */ + +#ifndef __CF__KnR +#define PROTOCCALLSFFUN14(T0,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE) \ + _(T0,_cfPU)(CFC_(UN,LN))(CF_NULL_PROTO); static _Icf(2,U,T0,CFFUN(UN),0)( \ + CFARGT14FS(UCF,HCF,_Z,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE) ) \ +{ CFARGT14S(VCF,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE) _(T0,_cfE) \ + CCF(LN,T1,1) CCF(LN,T2,2) CCF(LN,T3,3) CCF(LN,T4,4) CCF(LN,T5,5) \ + CCF(LN,T6,6) CCF(LN,T7,7) CCF(LN,T8,8) CCF(LN,T9,9) CCF(LN,TA,10) \ + CCF(LN,TB,11) CCF(LN,TC,12) CCF(LN,TD,13) CCF(LN,TE,14) _Icf(3,G,T0,UN,LN) \ + CFARGT14(CCCF,JCF,ABSOFT_cf1(T0),T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE)); \ + 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,A10,10) \ + WCF(TB,A11,11) WCF(TC,A12,12) WCF(TD,A13,13) WCF(TE,A14,14) _(T0,_cfX)} +#else +#define PROTOCCALLSFFUN14(T0,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE) \ + _(T0,_cfPU)(CFC_(UN,LN))(CF_NULL_PROTO); static _Icf(2,U,T0,CFFUN(UN),0)( \ + CFARGT14FS(UUCF,HHCF,_Z,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE) ) \ + CFARGT14FS(UUUCF,HHHCF,_Z,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE) ; \ +{ CFARGT14S(VCF,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE) _(T0,_cfE) \ + CCF(LN,T1,1) CCF(LN,T2,2) CCF(LN,T3,3) CCF(LN,T4,4) CCF(LN,T5,5) \ + CCF(LN,T6,6) CCF(LN,T7,7) CCF(LN,T8,8) CCF(LN,T9,9) CCF(LN,TA,10) \ + CCF(LN,TB,11) CCF(LN,TC,12) CCF(LN,TD,13) CCF(LN,TE,14) _Icf(3,G,T0,UN,LN) \ + CFARGT14(CCCF,JCF,ABSOFT_cf1(T0),T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE)); \ + 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,A10,10) \ + WCF(TB,A11,11) WCF(TC,A12,12) WCF(TD,A13,13) WCF(TE,A14,14) _(T0,_cfX)} +#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(TN,I) HCF(TN,I) +#define DDCF(TN,I) HHCF(TN,I) +#define DDDCF(TN,I) HHHCF(TN,I) +#endif + +#define QCF(TN,I) _(TN,_cfSTR)(1,Q,_(B,I), 0,0,0,0) +#define DEFAULT_cfQ(B) +#define LOGICAL_cfQ(B) +#define PLOGICAL_cfQ(B) +#define STRINGV_cfQ(B) char *B; unsigned int _(B,N); +#define STRING_cfQ(B) char *B=NULL; +#define PSTRING_cfQ(B) char *B=NULL; +#define PSTRINGV_cfQ(B) STRINGV_cfQ(B) +#define PNSTRING_cfQ(B) char *B=NULL; +#define PPSTRING_cfQ(B) + +#ifdef __sgi /* Else SGI gives warning 182 contrary to its C LRM A.17.7 */ +#define ROUTINE_orig *(void**)& +#else +#define ROUTINE_orig (void *) +#endif + +#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 ROUTINE_16 ROUTINE_orig +#define ROUTINE_17 ROUTINE_orig +#define ROUTINE_18 ROUTINE_orig +#define ROUTINE_19 ROUTINE_orig +#define ROUTINE_20 ROUTINE_orig +#define ROUTINE_21 ROUTINE_orig +#define ROUTINE_22 ROUTINE_orig +#define ROUTINE_23 ROUTINE_orig +#define ROUTINE_24 ROUTINE_orig +#define ROUTINE_25 ROUTINE_orig +#define ROUTINE_26 ROUTINE_orig +#define ROUTINE_27 ROUTINE_orig + +#define TCF(NAME,TN,I,M) _SEP_(TN,M,cfCOMMA) _(TN,_cfT)(NAME,I,_(A,I),_(B,I),_(C,I)) +#define BYTE_cfT(M,I,A,B,D) *A +#define DOUBLE_cfT(M,I,A,B,D) *A +#define FLOAT_cfT(M,I,A,B,D) *A +#define INT_cfT(M,I,A,B,D) *A +#define LOGICAL_cfT(M,I,A,B,D) F2CLOGICAL(*A) +#define LONG_cfT(M,I,A,B,D) *A +#define LONGLONG_cfT(M,I,A,B,D) *A /* added by MR December 2005 */ +#define SHORT_cfT(M,I,A,B,D) *A +#define BYTEV_cfT(M,I,A,B,D) A +#define DOUBLEV_cfT(M,I,A,B,D) A +#define FLOATV_cfT(M,I,A,B,D) VOIDP A +#define INTV_cfT(M,I,A,B,D) A +#define LOGICALV_cfT(M,I,A,B,D) A +#define LONGV_cfT(M,I,A,B,D) A +#define LONGLONGV_cfT(M,I,A,B,D) A /* added by MR December 2005 */ +#define SHORTV_cfT(M,I,A,B,D) A +#define BYTEVV_cfT(M,I,A,B,D) (void *)A /* We have to cast to void *,*/ +#define BYTEVVV_cfT(M,I,A,B,D) (void *)A /* since we don't know the */ +#define BYTEVVVV_cfT(M,I,A,B,D) (void *)A /* dimensions of the array. */ +#define BYTEVVVVV_cfT(M,I,A,B,D) (void *)A /* i.e. Unfortunately, can't */ +#define BYTEVVVVVV_cfT(M,I,A,B,D) (void *)A /* check that the type */ +#define BYTEVVVVVVV_cfT(M,I,A,B,D) (void *)A /* matches the prototype. */ +#define DOUBLEVV_cfT(M,I,A,B,D) (void *)A +#define DOUBLEVVV_cfT(M,I,A,B,D) (void *)A +#define DOUBLEVVVV_cfT(M,I,A,B,D) (void *)A +#define DOUBLEVVVVV_cfT(M,I,A,B,D) (void *)A +#define DOUBLEVVVVVV_cfT(M,I,A,B,D) (void *)A +#define DOUBLEVVVVVVV_cfT(M,I,A,B,D) (void *)A +#define FLOATVV_cfT(M,I,A,B,D) (void *)A +#define FLOATVVV_cfT(M,I,A,B,D) (void *)A +#define FLOATVVVV_cfT(M,I,A,B,D) (void *)A +#define FLOATVVVVV_cfT(M,I,A,B,D) (void *)A +#define FLOATVVVVVV_cfT(M,I,A,B,D) (void *)A +#define FLOATVVVVVVV_cfT(M,I,A,B,D) (void *)A +#define INTVV_cfT(M,I,A,B,D) (void *)A +#define INTVVV_cfT(M,I,A,B,D) (void *)A +#define INTVVVV_cfT(M,I,A,B,D) (void *)A +#define INTVVVVV_cfT(M,I,A,B,D) (void *)A +#define INTVVVVVV_cfT(M,I,A,B,D) (void *)A +#define INTVVVVVVV_cfT(M,I,A,B,D) (void *)A +#define LOGICALVV_cfT(M,I,A,B,D) (void *)A +#define LOGICALVVV_cfT(M,I,A,B,D) (void *)A +#define LOGICALVVVV_cfT(M,I,A,B,D) (void *)A +#define LOGICALVVVVV_cfT(M,I,A,B,D) (void *)A +#define LOGICALVVVVVV_cfT(M,I,A,B,D) (void *)A +#define LOGICALVVVVVVV_cfT(M,I,A,B,D) (void *)A +#define LONGVV_cfT(M,I,A,B,D) (void *)A +#define LONGVVV_cfT(M,I,A,B,D) (void *)A +#define LONGVVVV_cfT(M,I,A,B,D) (void *)A +#define LONGVVVVV_cfT(M,I,A,B,D) (void *)A +#define LONGVVVVVV_cfT(M,I,A,B,D) (void *)A +#define LONGVVVVVVV_cfT(M,I,A,B,D) (void *)A +#define LONGLONGVV_cfT(M,I,A,B,D) (void *)A /* added by MR December 2005 */ +#define LONGLONGVVV_cfT(M,I,A,B,D) (void *)A /* added by MR December 2005 */ +#define LONGLONGVVVV_cfT(M,I,A,B,D) (void *)A /* added by MR December 2005 */ +#define LONGLONGVVVVV_cfT(M,I,A,B,D) (void *)A /* added by MR December 2005 */ +#define LONGLONGVVVVVV_cfT(M,I,A,B,D) (void *)A /* added by MR December 2005 */ +#define LONGLONGVVVVVVV_cfT(M,I,A,B,D) (void *)A /* added by MR December 2005 */ +#define SHORTVV_cfT(M,I,A,B,D) (void *)A +#define SHORTVVV_cfT(M,I,A,B,D) (void *)A +#define SHORTVVVV_cfT(M,I,A,B,D) (void *)A +#define SHORTVVVVV_cfT(M,I,A,B,D) (void *)A +#define SHORTVVVVVV_cfT(M,I,A,B,D) (void *)A +#define SHORTVVVVVVV_cfT(M,I,A,B,D) (void *)A +#define PBYTE_cfT(M,I,A,B,D) A +#define PDOUBLE_cfT(M,I,A,B,D) A +#define PFLOAT_cfT(M,I,A,B,D) VOIDP A +#define PINT_cfT(M,I,A,B,D) A +#define PLOGICAL_cfT(M,I,A,B,D) ((*A=F2CLOGICAL(*A)),A) +#define PLONG_cfT(M,I,A,B,D) A +#define PLONGLONG_cfT(M,I,A,B,D) A /* added by MR December 2005 */ +#define PSHORT_cfT(M,I,A,B,D) A +#define PVOID_cfT(M,I,A,B,D) A +#if defined(apolloFortran) || defined(hpuxFortran800) || defined(AbsoftUNIXFortran) +#define ROUTINE_cfT(M,I,A,B,D) _(ROUTINE_,I) (*A) +#else +#define ROUTINE_cfT(M,I,A,B,D) _(ROUTINE_,I) A +#endif +/* 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=_cf_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=_cf_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 STRING_cfT(M,I,A,B,D) TTTTSTR( A->dsc$a_pointer,B,A->dsc$w_length) +#define STRINGV_cfT(M,I,A,B,D) TTTTSTRV(A->dsc$a_pointer, B, \ + A->dsc$w_length , A->dsc$l_m[0]) +#define PSTRING_cfT(M,I,A,B,D) TTSTR( A->dsc$a_pointer,B,A->dsc$w_length) +#define PPSTRING_cfT(M,I,A,B,D) A->dsc$a_pointer +#else +#ifdef CRAYFortran +#define STRING_cfT(M,I,A,B,D) TTTTSTR( _fcdtocp(A),B,_fcdlen(A)) +#define STRINGV_cfT(M,I,A,B,D) TTTTSTRV(_fcdtocp(A),B,_fcdlen(A), \ + num_elem(_fcdtocp(A),_fcdlen(A),_3(M,_STRV_A,I))) +#define PSTRING_cfT(M,I,A,B,D) TTSTR( _fcdtocp(A),B,_fcdlen(A)) +#define PPSTRING_cfT(M,I,A,B,D) _fcdtocp(A) +#else +#define STRING_cfT(M,I,A,B,D) TTTTSTR( A,B,D) +#define STRINGV_cfT(M,I,A,B,D) TTTTSTRV(A,B,D, num_elem(A,D,_3(M,_STRV_A,I))) +#define PSTRING_cfT(M,I,A,B,D) TTSTR( A,B,D) +#define PPSTRING_cfT(M,I,A,B,D) ((void)D, A) +#endif +#endif +#define PNSTRING_cfT(M,I,A,B,D) STRING_cfT(M,I,A,B,D) +#define PSTRINGV_cfT(M,I,A,B,D) STRINGV_cfT(M,I,A,B,D) +#define CF_0_cfT(M,I,A,B,D) + +#define RCF(TN,I) _(TN,_cfSTR)(3,R,_(A,I),_(B,I),_(C,I),0,0) +#define DEFAULT_cfR(A,B,D) +#define LOGICAL_cfR(A,B,D) +#define PLOGICAL_cfR(A,B,D) *A=C2FLOGICAL(*A); +#define STRING_cfR(A,B,D) if (B) _cf_free(B); +#define STRINGV_cfR(A,B,D) _cf_free(B); +/* A and D as defined above for TSTRING(V) */ +#define RRRRPSTR( A,B,D) if (B) memcpy(A,B, _cfMIN(strlen(B),D)), \ + (D>strlen(B)?memset(A+strlen(B),' ', D-strlen(B)):0), _cf_free(B); +#define RRRRPSTRV(A,B,D) c2fstrv(B,A,D+1,(D+1)*_(B,N)), _cf_free(B); +#ifdef vmsFortran +#define PSTRING_cfR(A,B,D) RRRRPSTR( A->dsc$a_pointer,B,A->dsc$w_length) +#define PSTRINGV_cfR(A,B,D) RRRRPSTRV(A->dsc$a_pointer,B,A->dsc$w_length) +#else +#ifdef CRAYFortran +#define PSTRING_cfR(A,B,D) RRRRPSTR( _fcdtocp(A),B,_fcdlen(A)) +#define PSTRINGV_cfR(A,B,D) RRRRPSTRV(_fcdtocp(A),B,_fcdlen(A)) +#else +#define PSTRING_cfR(A,B,D) RRRRPSTR( A,B,D) +#define PSTRINGV_cfR(A,B,D) RRRRPSTRV(A,B,D) +#endif +#endif +#define PNSTRING_cfR(A,B,D) PSTRING_cfR(A,B,D) +#define PPSTRING_cfR(A,B,D) + +#define BYTE_cfFZ(UN,LN) INTEGER_BYTE FCALLSC_QUALIFIER fcallsc(UN,LN)( +#define DOUBLE_cfFZ(UN,LN) DOUBLE_PRECISION FCALLSC_QUALIFIER fcallsc(UN,LN)( +#define INT_cfFZ(UN,LN) int FCALLSC_QUALIFIER fcallsc(UN,LN)( +#define LOGICAL_cfFZ(UN,LN) int FCALLSC_QUALIFIER fcallsc(UN,LN)( +#define LONG_cfFZ(UN,LN) long FCALLSC_QUALIFIER fcallsc(UN,LN)( +#define LONGLONG_cfFZ(UN,LN) LONGLONG FCALLSC_QUALIFIER fcallsc(UN,LN)( /* added by MR December 2005 */ +#define SHORT_cfFZ(UN,LN) short FCALLSC_QUALIFIER fcallsc(UN,LN)( +#define VOID_cfFZ(UN,LN) void FCALLSC_QUALIFIER 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. */ +#if defined (f2cFortran) && ! defined (gFortran) +/* f2c/g77 return double from FORTRAN REAL functions. (KMCCARTY, 2005/12/09) */ +#define FLOAT_cfFZ(UN,LN) DOUBLE_PRECISION FCALLSC_QUALIFIER fcallsc(UN,LN)(void +#else +#define FLOAT_cfFZ(UN,LN) FORTRAN_REAL FCALLSC_QUALIFIER fcallsc(UN,LN)(void +#endif +#ifdef vmsFortran +#define STRING_cfFZ(UN,LN) void FCALLSC_QUALIFIER fcallsc(UN,LN)(fstring *AS +#else +#ifdef CRAYFortran +#define STRING_cfFZ(UN,LN) void FCALLSC_QUALIFIER fcallsc(UN,LN)(_fcd AS +#else +#if defined(AbsoftUNIXFortran) || defined(AbsoftProFortran) +#define STRING_cfFZ(UN,LN) void FCALLSC_QUALIFIER fcallsc(UN,LN)(char *AS +#else +#define STRING_cfFZ(UN,LN) void FCALLSC_QUALIFIER fcallsc(UN,LN)(char *AS, unsigned D0 +#endif +#endif +#endif +#else +#if ! (defined(FLOATFUNCTIONTYPE)&&defined(ASSIGNFLOAT)&&defined(RETURNFLOAT)) +#if defined (f2cFortran) && ! defined (gFortran) +/* f2c/g77 return double from FORTRAN REAL functions. (KMCCARTY, 2005/12/09) */ +#define FLOAT_cfFZ(UN,LN) DOUBLE_PRECISION FCALLSC_QUALIFIER fcallsc(UN,LN)( +#else +#define FLOAT_cfFZ(UN,LN) FORTRAN_REAL FCALLSC_QUALIFIER fcallsc(UN,LN)( +#endif +#else +#define FLOAT_cfFZ(UN,LN) FLOATFUNCTIONTYPE FCALLSC_QUALIFIER fcallsc(UN,LN)( +#endif +#if defined(vmsFortran) || defined(CRAYFortran) || defined(AbsoftUNIXFortran) +#define STRING_cfFZ(UN,LN) void FCALLSC_QUALIFIER fcallsc(UN,LN)(AS +#else +#define STRING_cfFZ(UN,LN) void FCALLSC_QUALIFIER fcallsc(UN,LN)(AS, D0 +#endif +#endif + +#define BYTE_cfF(UN,LN) BYTE_cfFZ(UN,LN) +#define DOUBLE_cfF(UN,LN) DOUBLE_cfFZ(UN,LN) +#ifndef __CF_KnR +#if defined (f2cFortran) && ! defined (gFortran) +/* f2c/g77 return double from FORTRAN REAL functions. (KMCCARTY, 2005/12/09) */ +#define FLOAT_cfF(UN,LN) DOUBLE_PRECISION FCALLSC_QUALIFIER fcallsc(UN,LN)( +#else +#define FLOAT_cfF(UN,LN) FORTRAN_REAL FCALLSC_QUALIFIER fcallsc(UN,LN)( +#endif +#else +#define FLOAT_cfF(UN,LN) FLOAT_cfFZ(UN,LN) +#endif +#define INT_cfF(UN,LN) INT_cfFZ(UN,LN) +#define LOGICAL_cfF(UN,LN) LOGICAL_cfFZ(UN,LN) +#define LONG_cfF(UN,LN) LONG_cfFZ(UN,LN) +#define LONGLONG_cfF(UN,LN) LONGLONG_cfFZ(UN,LN) /* added by MR December 2005 */ +#define SHORT_cfF(UN,LN) SHORT_cfFZ(UN,LN) +#define VOID_cfF(UN,LN) VOID_cfFZ(UN,LN) +#define STRING_cfF(UN,LN) STRING_cfFZ(UN,LN), + +#define INT_cfFF +#define VOID_cfFF +#ifdef vmsFortran +#define STRING_cfFF fstring *AS; +#else +#ifdef CRAYFortran +#define STRING_cfFF _fcd AS; +#else +#define STRING_cfFF char *AS; unsigned D0; +#endif +#endif + +#define INT_cfL A0= +#define STRING_cfL A0= +#define VOID_cfL + +#define INT_cfK +#define VOID_cfK +/* KSTRING copies the string into the position provided by the caller. */ +#ifdef vmsFortran +#define STRING_cfK \ + memcpy(AS->dsc$a_pointer,A0,_cfMIN(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 STRING_cfK \ + memcpy(_fcdtocp(AS),A0, _cfMIN(_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 STRING_cfK memcpy(AS,A0, _cfMIN(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 BYTE_cfI return A0; +#define DOUBLE_cfI return A0; +#if ! (defined(FLOATFUNCTIONTYPE)&&defined(ASSIGNFLOAT)&&defined(RETURNFLOAT)) +#define FLOAT_cfI return A0; +#else +#define FLOAT_cfI RETURNFLOAT(A0); +#endif +#define INT_cfI return A0; +#ifdef hpuxFortran800 +/* Incredibly, functions must return true as 1, elsewhere .true.==0x01000000. */ +#define LOGICAL_cfI return ((A0)?1:0); +#else +#define LOGICAL_cfI return C2FLOGICAL(A0); +#endif +#define LONG_cfI return A0; +#define LONGLONG_cfI return A0; /* added by MR December 2005 */ +#define SHORT_cfI return A0; +#define STRING_cfI return ; +#define VOID_cfI 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 FCALLSCSUB16(CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG) \ + FCALLSCFUN16(VOID,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG) +#define FCALLSCSUB17(CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH) \ + FCALLSCFUN17(VOID,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH) +#define FCALLSCSUB18(CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI) \ + FCALLSCFUN18(VOID,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI) +#define FCALLSCSUB19(CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ) \ + FCALLSCFUN19(VOID,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ) +#define FCALLSCSUB20(CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK) \ + FCALLSCFUN20(VOID,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK) +#define FCALLSCSUB21(CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL) \ + FCALLSCFUN21(VOID,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL) +#define FCALLSCSUB22(CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM) \ + FCALLSCFUN22(VOID,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM) +#define FCALLSCSUB23(CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM,TN) \ + FCALLSCFUN23(VOID,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM,TN) +#define FCALLSCSUB24(CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM,TN,TO) \ + FCALLSCFUN24(VOID,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM,TN,TO) +#define FCALLSCSUB25(CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM,TN,TO,TP) \ + FCALLSCFUN25(VOID,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM,TN,TO,TP) +#define FCALLSCSUB26(CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM,TN,TO,TP,TQ) \ + FCALLSCFUN26(VOID,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM,TN,TO,TP,TQ) +#define FCALLSCSUB27(CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM,TN,TO,TP,TQ,TR) \ + FCALLSCFUN27(VOID,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM,TN,TO,TP,TQ,TR) + + +#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) \ + FCALLSCFUN14(T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,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) \ + FCALLSCFUN14(T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,CF_0,CF_0,CF_0) +#define FCALLSCFUN12(T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC) \ + FCALLSCFUN14(T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,CF_0,CF_0) +#define FCALLSCFUN13(T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD) \ + FCALLSCFUN14(T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,CF_0) + + +#define FCALLSCFUN15(T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF) \ + FCALLSCFUN20(T0,CN,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) +#define FCALLSCFUN16(T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG) \ + FCALLSCFUN20(T0,CN,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) +#define FCALLSCFUN17(T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH) \ + FCALLSCFUN20(T0,CN,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) +#define FCALLSCFUN18(T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI) \ + FCALLSCFUN20(T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,CF_0,CF_0) +#define FCALLSCFUN19(T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ) \ + FCALLSCFUN20(T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,CF_0) +#define FCALLSCFUN20(T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK) \ + FCALLSCFUN27(T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,CF_0,CF_0,CF_0,CF_0,CF_0,CF_0,CF_0) +#define FCALLSCFUN21(T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL) \ + FCALLSCFUN27(T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,CF_0,CF_0,CF_0,CF_0,CF_0,CF_0) +#define FCALLSCFUN22(T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM) \ + FCALLSCFUN27(T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM,CF_0,CF_0,CF_0,CF_0,CF_0) +#define FCALLSCFUN23(T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM,TN) \ + FCALLSCFUN27(T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM,TN,CF_0,CF_0,CF_0,CF_0) +#define FCALLSCFUN24(T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM,TN,TO) \ + FCALLSCFUN27(T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM,TN,TO,CF_0,CF_0,CF_0) +#define FCALLSCFUN25(T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM,TN,TO,TP) \ + FCALLSCFUN27(T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM,TN,TO,TP,CF_0,CF_0) +#define FCALLSCFUN26(T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM,TN,TO,TP,TQ) \ + FCALLSCFUN27(T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM,TN,TO,TP,TQ,CF_0) + + +#ifndef __CF__KnR +#define FCALLSCFUN0(T0,CN,UN,LN) CFextern _(T0,_cfFZ)(UN,LN) ABSOFT_cf2(T0)) \ + {_Icf(2,UU,T0,A0,0); _Icf(0,L,T0,0,0) CN(); _Icf(0,K,T0,0,0) _(T0,_cfI)} + +#define FCALLSCFUN14(T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE) \ + CFextern _(T0,_cfF)(UN,LN) \ + CFARGT14(NCF,DCF,ABSOFT_cf2(T0),T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE) ) \ + { CFARGT14S(QCF,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE) \ + _Icf(2,UU,T0,A0,0); _Icf(0,L,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,10,1) TCF(LN,TB,11,1) TCF(LN,TC,12,1) \ + TCF(LN,TD,13,1) TCF(LN,TE,14,1) ); _Icf(0,K,T0,0,0) \ + CFARGT14S(RCF,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE) _(T0,_cfI) } + +#define FCALLSCFUN27(T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM,TN,TO,TP,TQ,TR) \ + CFextern _(T0,_cfF)(UN,LN) \ + CFARGT27(NCF,DCF,ABSOFT_cf2(T0),T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM,TN,TO,TP,TQ,TR) ) \ + { CFARGT27S(QCF,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM,TN,TO,TP,TQ,TR) \ + _Icf(2,UU,T0,A0,0); _Icf(0,L,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,10,1) TCF(LN,TB,11,1) TCF(LN,TC,12,1) \ + TCF(LN,TD,13,1) TCF(LN,TE,14,1) TCF(LN,TF,15,1) TCF(LN,TG,16,1) TCF(LN,TH,17,1) \ + TCF(LN,TI,18,1) TCF(LN,TJ,19,1) TCF(LN,TK,20,1) TCF(LN,TL,21,1) TCF(LN,TM,22,1) \ + TCF(LN,TN,23,1) TCF(LN,TO,24,1) TCF(LN,TP,25,1) TCF(LN,TQ,26,1) TCF(LN,TR,27,1) ); _Icf(0,K,T0,0,0) \ + CFARGT27S(RCF,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM,TN,TO,TP,TQ,TR) _(T0,_cfI) } + +#else +#define FCALLSCFUN0(T0,CN,UN,LN) CFextern _(T0,_cfFZ)(UN,LN) ABSOFT_cf3(T0)) _Icf(0,FF,T0,0,0)\ + {_Icf(2,UU,T0,A0,0); _Icf(0,L,T0,0,0) CN(); _Icf(0,K,T0,0,0) _(T0,_cfI)} + +#define FCALLSCFUN14(T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE) \ + CFextern _(T0,_cfF)(UN,LN) \ + CFARGT14(NNCF,DDCF,ABSOFT_cf3(T0),T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE)) _Icf(0,FF,T0,0,0) \ + CFARGT14FS(NNNCF,DDDCF,_Z,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE); \ + { CFARGT14S(QCF,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE) \ + _Icf(2,UU,T0,A0,0); _Icf(0,L,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,10,1) TCF(LN,TB,11,1) TCF(LN,TC,12,1) \ + TCF(LN,TD,13,1) TCF(LN,TE,14,1) ); _Icf(0,K,T0,0,0) \ + CFARGT14S(RCF,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE) _(T0,_cfI)} + +#define FCALLSCFUN27(T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM,TN,TO,TP,TQ,TR) \ + CFextern _(T0,_cfF)(UN,LN) \ + CFARGT27(NNCF,DDCF,ABSOFT_cf3(T0),T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM,TN,TO,TP,TQ,TR)) _Icf(0,FF,T0,0,0) \ + CFARGT27FS(NNNCF,DDDCF,_Z,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM,TN,TO,TP,TQ,TR); \ + { CFARGT27S(QCF,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM,TN,TO,TP,TQ,TR) \ + _Icf(2,UU,T0,A0,0); _Icf(0,L,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,10,1) TCF(LN,TB,11,1) TCF(LN,TC,12,1) \ + TCF(LN,TD,13,1) TCF(LN,TE,14,1) TCF(LN,TF,15,1) TCF(LN,TG,16,1) TCF(LN,TH,17,1) \ + TCF(LN,TI,18,1) TCF(LN,TJ,19,1) TCF(LN,TK,20,1) TCF(LN,TL,21,1) TCF(LN,TM,22,1) \ + TCF(LN,TN,23,1) TCF(LN,TO,24,1) TCF(LN,TP,25,1) TCF(LN,TQ,26,1) TCF(LN,TR,27,1) ); _Icf(0,K,T0,0,0) \ + CFARGT27S(RCF,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK,TL,TM,TN,TO,TP,TQ,TR) _(T0,_cfI)} + +#endif + +// clang-format on + +#endif /* __CFORTRAN_LOADED */ +#endif +// Automatically generated by make_fint.c, don't edit! + +// clang-format off + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifndef CDI_H_ +#include "cdi.h" +#endif + +#ifdef HAVE_CF_INTERFACE + +#include <limits.h> +#include <assert.h> + +#ifndef __CFORTRAN_LOADED +# if defined __clang__ +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wreserved-id-macro" +# endif +# include "cfortran.h" +# if defined __clang__ +# pragma GCC diagnostic pop +# endif +#endif +/* These functions are meant to be called from Fortran and don't + * need an interface declaration in a C header. */ +#ifdef __clang__ +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + +#ifdef CDI_H_ + +static inline +int SizeType_c2f(SizeType value_SizeType) +{ + assert(value_SizeType < INT_MAX); + return (int) value_SizeType; +} + +#endif + +/* Start of fortran interface for the following routines (make_fint.c) */ + + +/* Byte order */ + + +/* Error identifier */ + + +/* File types */ + + +/* Compatibility defines for release 1.8.3 (obsolete defines) */ + + +/* Protocols (in filename/URI) */ + + +/* Compress types */ + + +/* external data types */ + + +/* Compatibility defines for release 1.8.3 (obsolete defines) */ + + +/* internal data types */ + + +/* Chunk types */ + + +/* GRID types */ + + +/* ZAXIS types */ + + +/* SUBTYPE types */ + + +/* Data structure defining a key-value search, possibly with multiple + key-value pairs in combination. + + Currently, only multiple pairs combined by AND are supported. */ + + +/* TIME types */ + + +/* TSTEP types */ + + +/* TAXIS types */ + + +/* TUNIT types */ + + +/* CALENDAR types */ + + +/* number of unsigned char needed to store UUID */ + + +/* Structs that are used to return data to the user */ + + +/* Opaque types */ + + +/* CDI control routines */ + +FCALLSCSUB0 (cdiReset, CDIRESET, cdireset) +FCALLSCFUN1 (STRING, cdiStringError, CDISTRINGERROR, cdistringerror, INT) +FCALLSCSUB1 (cdiDebug, CDIDEBUG, cdidebug, INT) +FCALLSCFUN0 (STRING, cdiLibraryVersion, CDILIBRARYVERSION, cdilibraryversion) +FCALLSCSUB0 (cdiPrintVersion, CDIPRINTVERSION, cdiprintversion) +FCALLSCFUN1 (INT, cdiHaveFiletype, CDIHAVEFILETYPE, cdihavefiletype, INT) +FCALLSCSUB1 (cdiDefMissval, CDIDEFMISSVAL, cdidefmissval, DOUBLE) +FCALLSCFUN0 (DOUBLE, cdiInqMissval, CDIINQMISSVAL, cdiinqmissval) +FCALLSCSUB2 (cdiDefGlobal, CDIDEFGLOBAL, cdidefglobal, STRING, INT) +FCALLSCFUN0 (INT, namespaceNew, NAMESPACENEW, namespacenew) +FCALLSCSUB1 (namespaceSetActive, NAMESPACESETACTIVE, namespacesetactive, INT) +FCALLSCFUN0 (INT, namespaceGetActive, NAMESPACEGETACTIVE, namespacegetactive) +FCALLSCSUB1 (namespaceDelete, NAMESPACEDELETE, namespacedelete, INT) + +/* CDI converter routines */ + + +/* parameter */ + +FCALLSCSUB3 (cdiParamToString, CDIPARAMTOSTRING, cdiparamtostring, INT, PSTRING, INT) +FCALLSCSUB4 (cdiDecodeParam, CDIDECODEPARAM, cdidecodeparam, INT, PINT, PINT, PINT) +FCALLSCFUN3 (INT, cdiEncodeParam, CDIENCODEPARAM, cdiencodeparam, INT, INT, INT) + +/* date format: YYYYMMDD */ + + +/* time format: hhmmss */ + +FCALLSCSUB4 (cdiDecodeDate, CDIDECODEDATE, cdidecodedate, INT, PINT, PINT, PINT) +FCALLSCFUN3 (INT, cdiEncodeDate, CDIENCODEDATE, cdiencodedate, INT, INT, INT) +FCALLSCSUB4 (cdiDecodeTime, CDIDECODETIME, cdidecodetime, INT, PINT, PINT, PINT) +FCALLSCFUN3 (INT, cdiEncodeTime, CDIENCODETIME, cdiencodetime, INT, INT, INT) + +/* STREAM control routines */ + +FCALLSCFUN2 (INT, cdiGetFiletype, CDIGETFILETYPE, cdigetfiletype, STRING, PINT) +FCALLSCFUN1 (INT, streamOpenRead, STREAMOPENREAD, streamopenread, STRING) +FCALLSCFUN2 (INT, streamOpenWrite, STREAMOPENWRITE, streamopenwrite, STRING, INT) +FCALLSCFUN1 (INT, streamOpenAppend, STREAMOPENAPPEND, streamopenappend, STRING) +FCALLSCSUB1 (streamClose, STREAMCLOSE, streamclose, INT) +FCALLSCSUB1 (streamSync, STREAMSYNC, streamsync, INT) +FCALLSCSUB2 (streamDefMaxSteps, STREAMDEFMAXSTEPS, streamdefmaxsteps, INT, INT) +FCALLSCSUB2 (streamDefNumWorker, STREAMDEFNUMWORKER, streamdefnumworker, INT, INT) +FCALLSCSUB2 (streamDefVlist, STREAMDEFVLIST, streamdefvlist, INT, INT) +FCALLSCFUN1 (INT, streamInqVlist, STREAMINQVLIST, streaminqvlist, INT) +FCALLSCFUN1 (INT, streamInqFiletype, STREAMINQFILETYPE, streaminqfiletype, INT) +FCALLSCSUB2 (streamDefByteorder, STREAMDEFBYTEORDER, streamdefbyteorder, INT, INT) +FCALLSCFUN1 (INT, streamInqByteorder, STREAMINQBYTEORDER, streaminqbyteorder, INT) +FCALLSCSUB4 (streamDefFilter, STREAMDEFFILTER, streamdeffilter, INT, INT, INT, PINT) +FCALLSCSUB2 (streamDefCompType, STREAMDEFCOMPTYPE, streamdefcomptype, INT, INT) +FCALLSCFUN1 (INT, streamInqCompType, STREAMINQCOMPTYPE, streaminqcomptype, INT) +FCALLSCSUB2 (streamDefCompLevel, STREAMDEFCOMPLEVEL, streamdefcomplevel, INT, INT) +FCALLSCFUN1 (INT, streamInqCompLevel, STREAMINQCOMPLEVEL, streaminqcomplevel, INT) +FCALLSCFUN2 (INT, streamDefTimestep, STREAMDEFTIMESTEP, streamdeftimestep, INT, INT) +FCALLSCFUN2 (INT, streamInqTimestep, STREAMINQTIMESTEP, streaminqtimestep, INT, INT) +FCALLSCFUN1 (INT, streamInqCurTimestepID, STREAMINQCURTIMESTEPID, streaminqcurtimestepid, INT) +FCALLSCFUN1 (STRING, streamFilename, STREAMFILENAME, streamfilename, INT) +FCALLSCFUN1 (STRING, streamFilesuffix, STREAMFILESUFFIX, streamfilesuffix, INT) +static int streamNvals_fwrap(int streamID) +{ + SizeType v; + v = streamNvals(streamID); + return SizeType_c2f(v); +} +FCALLSCFUN1 (INT, streamNvals_fwrap, STREAMNVALS, streamnvals, INT) +FCALLSCFUN1 (INT, streamInqNvars, STREAMINQNVARS, streaminqnvars, INT) + +/* STREAM var I/O routines (random access) */ + +static void streamWriteVar_fwrap(int streamID, int varID, const double data[], int nmiss) +{ + streamWriteVar(streamID, varID, data, (SizeType)nmiss); +} +FCALLSCSUB4 (streamWriteVar_fwrap, STREAMWRITEVAR, streamwritevar, INT, INT, DOUBLEV, INT) +static void streamWriteVarF_fwrap(int streamID, int varID, const float data[], int nmiss) +{ + streamWriteVarF(streamID, varID, data, (SizeType)nmiss); +} +FCALLSCSUB4 (streamWriteVarF_fwrap, STREAMWRITEVARF, streamwritevarf, INT, INT, FLOATV, INT) +static void streamReadVar_fwrap(int streamID, int varID, double data[], int *nmiss) +{ + SizeType nmiss_SizeType; + streamReadVar(streamID, varID, data, &nmiss_SizeType); + assert(nmiss_SizeType < INT_MAX); + *nmiss = nmiss_SizeType; +} +FCALLSCSUB4 (streamReadVar_fwrap, STREAMREADVAR, streamreadvar, INT, INT, DOUBLEV, PINT) +static void streamReadVarF_fwrap(int streamID, int varID, float data[], int *nmiss) +{ + SizeType nmiss_SizeType; + streamReadVarF(streamID, varID, data, &nmiss_SizeType); + assert(nmiss_SizeType < INT_MAX); + *nmiss = nmiss_SizeType; +} +FCALLSCSUB4 (streamReadVarF_fwrap, STREAMREADVARF, streamreadvarf, INT, INT, FLOATV, PINT) +static void streamWriteVarSlice_fwrap(int streamID, int varID, int levelID, const double data[], int nmiss) +{ + streamWriteVarSlice(streamID, varID, levelID, data, (SizeType)nmiss); +} +FCALLSCSUB5 (streamWriteVarSlice_fwrap, STREAMWRITEVARSLICE, streamwritevarslice, INT, INT, INT, DOUBLEV, INT) +static void streamWriteVarSliceF_fwrap(int streamID, int varID, int levelID, const float data[], int nmiss) +{ + streamWriteVarSliceF(streamID, varID, levelID, data, (SizeType)nmiss); +} +FCALLSCSUB5 (streamWriteVarSliceF_fwrap, STREAMWRITEVARSLICEF, streamwritevarslicef, INT, INT, INT, FLOATV, INT) +static void streamReadVarSlice_fwrap(int streamID, int varID, int levelID, double data[], int *nmiss) +{ + SizeType nmiss_SizeType; + streamReadVarSlice(streamID, varID, levelID, data, &nmiss_SizeType); + assert(nmiss_SizeType < INT_MAX); + *nmiss = nmiss_SizeType; +} +FCALLSCSUB5 (streamReadVarSlice_fwrap, STREAMREADVARSLICE, streamreadvarslice, INT, INT, INT, DOUBLEV, PINT) +static void streamReadVarSliceF_fwrap(int streamID, int varID, int levelID, float data[], int *nmiss) +{ + SizeType nmiss_SizeType; + streamReadVarSliceF(streamID, varID, levelID, data, &nmiss_SizeType); + assert(nmiss_SizeType < INT_MAX); + *nmiss = nmiss_SizeType; +} +FCALLSCSUB5 (streamReadVarSliceF_fwrap, STREAMREADVARSLICEF, streamreadvarslicef, INT, INT, INT, FLOATV, PINT) +static void streamWriteVarChunk_fwrap(int streamID, int varID, const int rect[][2], const double data[], int nmiss) +{ + streamWriteVarChunk(streamID, varID, rect, data, (SizeType)nmiss); +} +FCALLSCSUB5 (streamWriteVarChunk_fwrap, STREAMWRITEVARCHUNK, streamwritevarchunk, INT, INT, INTVV, DOUBLEV, INT) +static void streamWriteVarChunkF_fwrap(int streamID, int varID, const int rect[][2], const float data[], int nmiss) +{ + streamWriteVarChunkF(streamID, varID, rect, data, (SizeType)nmiss); +} +FCALLSCSUB5 (streamWriteVarChunkF_fwrap, STREAMWRITEVARCHUNKF, streamwritevarchunkf, INT, INT, INTVV, FLOATV, INT) + +/* STREAM record I/O routines (sequential access) */ + +FCALLSCSUB3 (streamDefRecord, STREAMDEFRECORD, streamdefrecord, INT, INT, INT) +FCALLSCSUB3 (streamInqRecord, STREAMINQRECORD, streaminqrecord, INT, PINT, PINT) +static void streamWriteRecord_fwrap(int streamID, const double data[], int nmiss) +{ + streamWriteRecord(streamID, data, (SizeType)nmiss); +} +FCALLSCSUB3 (streamWriteRecord_fwrap, STREAMWRITERECORD, streamwriterecord, INT, DOUBLEV, INT) +static void streamWriteRecordF_fwrap(int streamID, const float data[], int nmiss) +{ + streamWriteRecordF(streamID, data, (SizeType)nmiss); +} +FCALLSCSUB3 (streamWriteRecordF_fwrap, STREAMWRITERECORDF, streamwriterecordf, INT, FLOATV, INT) +static void streamReadRecord_fwrap(int streamID, double data[], int *nmiss) +{ + SizeType nmiss_SizeType; + streamReadRecord(streamID, data, &nmiss_SizeType); + assert(nmiss_SizeType < INT_MAX); + *nmiss = nmiss_SizeType; +} +FCALLSCSUB3 (streamReadRecord_fwrap, STREAMREADRECORD, streamreadrecord, INT, DOUBLEV, PINT) +static void streamReadRecordF_fwrap(int streamID, float data[], int *nmiss) +{ + SizeType nmiss_SizeType; + streamReadRecordF(streamID, data, &nmiss_SizeType); + assert(nmiss_SizeType < INT_MAX); + *nmiss = nmiss_SizeType; +} +FCALLSCSUB3 (streamReadRecordF_fwrap, STREAMREADRECORDF, streamreadrecordf, INT, FLOATV, PINT) +FCALLSCSUB2 (streamCopyRecord, STREAMCOPYRECORD, streamcopyrecord, INT, INT) + +/* File driven I/O (may yield better performance than using the streamXXX functions) */ + + +/* Creation & Destruction */ + + +/* Advancing an iterator */ + + +/* Introspecting metadata */ + + +/* All outXXX arguments to these functions may be NULL. */ + + +/* Reading data */ + + +/* TODO[NH]: Add functions to read partial fields. */ + + +/* Direct access to grib fields */ + + +/* Callthroughs to GRIB-API */ + + +/* Convenience functions for accessing GRIB-API keys */ + + +/* VLIST routines */ + +FCALLSCFUN0 (INT, vlistCreate, VLISTCREATE, vlistcreate) +FCALLSCSUB1 (vlistDestroy, VLISTDESTROY, vlistdestroy, INT) +FCALLSCFUN1 (INT, vlistDuplicate, VLISTDUPLICATE, vlistduplicate, INT) +FCALLSCSUB2 (vlistCopy, VLISTCOPY, vlistcopy, INT, INT) +FCALLSCSUB2 (vlistCopyFlag, VLISTCOPYFLAG, vlistcopyflag, INT, INT) +FCALLSCSUB1 (vlistClearFlag, VLISTCLEARFLAG, vlistclearflag, INT) +FCALLSCSUB2 (vlistCat, VLISTCAT, vlistcat, INT, INT) +FCALLSCSUB2 (vlistMerge, VLISTMERGE, vlistmerge, INT, INT) +FCALLSCSUB1 (vlistPrint, VLISTPRINT, vlistprint, INT) +FCALLSCFUN1 (INT, vlistNumber, VLISTNUMBER, vlistnumber, INT) +FCALLSCFUN1 (INT, vlistNvars, VLISTNVARS, vlistnvars, INT) +FCALLSCFUN1 (INT, vlistNgrids, VLISTNGRIDS, vlistngrids, INT) +FCALLSCFUN1 (INT, vlistNzaxis, VLISTNZAXIS, vlistnzaxis, INT) +FCALLSCFUN1 (INT, vlistNsubtypes, VLISTNSUBTYPES, vlistnsubtypes, INT) +FCALLSCSUB2 (vlistDefNtsteps, VLISTDEFNTSTEPS, vlistdefntsteps, INT, INT) +FCALLSCFUN1 (INT, vlistNtsteps, VLISTNTSTEPS, vlistntsteps, INT) +static int vlistGridsizeMax_fwrap(int vlistID) +{ + SizeType v; + v = vlistGridsizeMax(vlistID); + return SizeType_c2f(v); +} +FCALLSCFUN1 (INT, vlistGridsizeMax_fwrap, VLISTGRIDSIZEMAX, vlistgridsizemax, INT) +FCALLSCFUN2 (INT, vlistGrid, VLISTGRID, vlistgrid, INT, INT) +FCALLSCFUN2 (INT, vlistGridIndex, VLISTGRIDINDEX, vlistgridindex, INT, INT) +FCALLSCSUB3 (vlistChangeGridIndex, VLISTCHANGEGRIDINDEX, vlistchangegridindex, INT, INT, INT) +FCALLSCSUB3 (vlistChangeGrid, VLISTCHANGEGRID, vlistchangegrid, INT, INT, INT) +FCALLSCFUN2 (INT, vlistZaxis, VLISTZAXIS, vlistzaxis, INT, INT) +FCALLSCFUN2 (INT, vlistZaxisIndex, VLISTZAXISINDEX, vlistzaxisindex, INT, INT) +FCALLSCSUB3 (vlistChangeZaxisIndex, VLISTCHANGEZAXISINDEX, vlistchangezaxisindex, INT, INT, INT) +FCALLSCSUB3 (vlistChangeZaxis, VLISTCHANGEZAXIS, vlistchangezaxis, INT, INT, INT) +FCALLSCFUN1 (INT, vlistNrecs, VLISTNRECS, vlistnrecs, INT) +FCALLSCFUN2 (INT, vlistSubtype, VLISTSUBTYPE, vlistsubtype, INT, INT) +FCALLSCFUN2 (INT, vlistSubtypeIndex, VLISTSUBTYPEINDEX, vlistsubtypeindex, INT, INT) +FCALLSCSUB2 (vlistDefTaxis, VLISTDEFTAXIS, vlistdeftaxis, INT, INT) +FCALLSCFUN1 (INT, vlistInqTaxis, VLISTINQTAXIS, vlistinqtaxis, INT) +FCALLSCSUB2 (vlistDefTable, VLISTDEFTABLE, vlistdeftable, INT, INT) +FCALLSCFUN1 (INT, vlistInqTable, VLISTINQTABLE, vlistinqtable, INT) +FCALLSCSUB2 (vlistDefInstitut, VLISTDEFINSTITUT, vlistdefinstitut, INT, INT) +FCALLSCFUN1 (INT, vlistInqInstitut, VLISTINQINSTITUT, vlistinqinstitut, INT) +FCALLSCSUB2 (vlistDefModel, VLISTDEFMODEL, vlistdefmodel, INT, INT) +FCALLSCFUN1 (INT, vlistInqModel, VLISTINQMODEL, vlistinqmodel, INT) + +/* VLIST VAR routines */ + +FCALLSCFUN5 (INT, vlistDefVarTiles, VLISTDEFVARTILES, vlistdefvartiles, INT, INT, INT, INT, INT) +FCALLSCFUN4 (INT, vlistDefVar, VLISTDEFVAR, vlistdefvar, INT, INT, INT, INT) +FCALLSCSUB3 (vlistChangeVarGrid, VLISTCHANGEVARGRID, vlistchangevargrid, INT, INT, INT) +FCALLSCSUB3 (vlistChangeVarZaxis, VLISTCHANGEVARZAXIS, vlistchangevarzaxis, INT, INT, INT) +FCALLSCSUB5 (vlistInqVar, VLISTINQVAR, vlistinqvar, INT, INT, PINT, PINT, PINT) +FCALLSCFUN2 (INT, vlistInqVarGrid, VLISTINQVARGRID, vlistinqvargrid, INT, INT) +FCALLSCFUN2 (INT, vlistInqVarZaxis, VLISTINQVARZAXIS, vlistinqvarzaxis, INT, INT) + +/* used in MPIOM */ + +FCALLSCFUN2 (INT, vlistInqVarID, VLISTINQVARID, vlistinqvarid, INT, INT) +FCALLSCSUB3 (vlistDefVarTimetype, VLISTDEFVARTIMETYPE, vlistdefvartimetype, INT, INT, INT) +FCALLSCFUN2 (INT, vlistInqVarTimetype, VLISTINQVARTIMETYPE, vlistinqvartimetype, INT, INT) +FCALLSCSUB3 (vlistDefVarTsteptype, VLISTDEFVARTSTEPTYPE, vlistdefvartsteptype, INT, INT, INT) +FCALLSCFUN2 (INT, vlistInqVarTsteptype, VLISTINQVARTSTEPTYPE, vlistinqvartsteptype, INT, INT) +FCALLSCSUB3 (vlistDefVarCompType, VLISTDEFVARCOMPTYPE, vlistdefvarcomptype, INT, INT, INT) +FCALLSCFUN2 (INT, vlistInqVarCompType, VLISTINQVARCOMPTYPE, vlistinqvarcomptype, INT, INT) +FCALLSCSUB3 (vlistDefVarCompLevel, VLISTDEFVARCOMPLEVEL, vlistdefvarcomplevel, INT, INT, INT) +FCALLSCFUN2 (INT, vlistInqVarCompLevel, VLISTINQVARCOMPLEVEL, vlistinqvarcomplevel, INT, INT) +FCALLSCSUB3 (vlistDefVarParam, VLISTDEFVARPARAM, vlistdefvarparam, INT, INT, INT) +FCALLSCFUN2 (INT, vlistInqVarParam, VLISTINQVARPARAM, vlistinqvarparam, INT, INT) +FCALLSCSUB3 (vlistDefVarCode, VLISTDEFVARCODE, vlistdefvarcode, INT, INT, INT) +FCALLSCFUN2 (INT, vlistInqVarCode, VLISTINQVARCODE, vlistinqvarcode, INT, INT) +FCALLSCSUB3 (vlistDefVarDatatype, VLISTDEFVARDATATYPE, vlistdefvardatatype, INT, INT, INT) +FCALLSCFUN2 (INT, vlistInqVarDatatype, VLISTINQVARDATATYPE, vlistinqvardatatype, INT, INT) +FCALLSCSUB3 (vlistDefVarXYZ, VLISTDEFVARXYZ, vlistdefvarxyz, INT, INT, INT) +FCALLSCFUN2 (INT, vlistInqVarXYZ, VLISTINQVARXYZ, vlistinqvarxyz, INT, INT) +FCALLSCSUB3 (vlistDefVarNSB, VLISTDEFVARNSB, vlistdefvarnsb, INT, INT, INT) +FCALLSCFUN2 (INT, vlistInqVarNSB, VLISTINQVARNSB, vlistinqvarnsb, INT, INT) +FCALLSCFUN2 (INT, vlistInqVarNumber, VLISTINQVARNUMBER, vlistinqvarnumber, INT, INT) +FCALLSCSUB3 (vlistDefVarInstitut, VLISTDEFVARINSTITUT, vlistdefvarinstitut, INT, INT, INT) +FCALLSCFUN2 (INT, vlistInqVarInstitut, VLISTINQVARINSTITUT, vlistinqvarinstitut, INT, INT) +FCALLSCSUB3 (vlistDefVarModel, VLISTDEFVARMODEL, vlistdefvarmodel, INT, INT, INT) +FCALLSCFUN2 (INT, vlistInqVarModel, VLISTINQVARMODEL, vlistinqvarmodel, INT, INT) +FCALLSCSUB3 (vlistDefVarTable, VLISTDEFVARTABLE, vlistdefvartable, INT, INT, INT) +FCALLSCFUN2 (INT, vlistInqVarTable, VLISTINQVARTABLE, vlistinqvartable, INT, INT) +FCALLSCSUB3 (vlistDefVarName, VLISTDEFVARNAME, vlistdefvarname, INT, INT, STRING) +FCALLSCSUB3 (vlistInqVarName, VLISTINQVARNAME, vlistinqvarname, INT, INT, PSTRING) +FCALLSCFUN2 (STRING, vlistCopyVarName, VLISTCOPYVARNAME, vlistcopyvarname, INT, INT) +FCALLSCSUB3 (vlistDefVarStdname, VLISTDEFVARSTDNAME, vlistdefvarstdname, INT, INT, STRING) +FCALLSCSUB3 (vlistInqVarStdname, VLISTINQVARSTDNAME, vlistinqvarstdname, INT, INT, PSTRING) +FCALLSCSUB3 (vlistDefVarLongname, VLISTDEFVARLONGNAME, vlistdefvarlongname, INT, INT, STRING) +FCALLSCSUB3 (vlistInqVarLongname, VLISTINQVARLONGNAME, vlistinqvarlongname, INT, INT, PSTRING) +FCALLSCSUB3 (vlistDefVarUnits, VLISTDEFVARUNITS, vlistdefvarunits, INT, INT, STRING) +FCALLSCSUB3 (vlistInqVarUnits, VLISTINQVARUNITS, vlistinqvarunits, INT, INT, PSTRING) +FCALLSCSUB3 (vlistDefVarMissval, VLISTDEFVARMISSVAL, vlistdefvarmissval, INT, INT, DOUBLE) +FCALLSCFUN2 (DOUBLE, vlistInqVarMissval, VLISTINQVARMISSVAL, vlistinqvarmissval, INT, INT) +static int vlistInqVarSize_fwrap(int vlistID, int varID) +{ + SizeType v; + v = vlistInqVarSize(vlistID, varID); + return SizeType_c2f(v); +} +FCALLSCFUN2 (INT, vlistInqVarSize_fwrap, VLISTINQVARSIZE, vlistinqvarsize, INT, INT) +FCALLSCSUB4 (vlistDefIndex, VLISTDEFINDEX, vlistdefindex, INT, INT, INT, INT) +FCALLSCFUN3 (INT, vlistInqIndex, VLISTINQINDEX, vlistinqindex, INT, INT, INT) +FCALLSCSUB4 (vlistDefFlag, VLISTDEFFLAG, vlistdefflag, INT, INT, INT, INT) +FCALLSCFUN3 (INT, vlistInqFlag, VLISTINQFLAG, vlistinqflag, INT, INT, INT) +FCALLSCFUN2 (INT, vlistFindVar, VLISTFINDVAR, vlistfindvar, INT, INT) +FCALLSCFUN3 (INT, vlistFindLevel, VLISTFINDLEVEL, vlistfindlevel, INT, INT, INT) +FCALLSCFUN2 (INT, vlistMergedVar, VLISTMERGEDVAR, vlistmergedvar, INT, INT) +FCALLSCFUN3 (INT, vlistMergedLevel, VLISTMERGEDLEVEL, vlistmergedlevel, INT, INT, INT) +FCALLSCSUB0 (cdiClearAdditionalKeys, CDICLEARADDITIONALKEYS, cdiclearadditionalkeys) +FCALLSCSUB1 (cdiDefAdditionalKey, CDIDEFADDITIONALKEY, cdidefadditionalkey, STRING) +FCALLSCSUB4 (vlistDefVarIntKey, VLISTDEFVARINTKEY, vlistdefvarintkey, INT, INT, STRING, INT) +FCALLSCSUB4 (vlistDefVarDblKey, VLISTDEFVARDBLKEY, vlistdefvardblkey, INT, INT, STRING, DOUBLE) +FCALLSCFUN3 (INT, vlistHasVarKey, VLISTHASVARKEY, vlisthasvarkey, INT, INT, STRING) +FCALLSCFUN3 (DOUBLE, vlistInqVarDblKey, VLISTINQVARDBLKEY, vlistinqvardblkey, INT, INT, STRING) +FCALLSCFUN3 (INT, vlistInqVarIntKey, VLISTINQVARINTKEY, vlistinqvarintkey, INT, INT, STRING) + +/* CDI attributes */ + +FCALLSCFUN3 (INT, cdiInqNatts, CDIINQNATTS, cdiinqnatts, INT, INT, PINT) +FCALLSCFUN6 (INT, cdiInqAtt, CDIINQATT, cdiinqatt, INT, INT, INT, PSTRING, PINT, PINT) +FCALLSCFUN3 (INT, cdiInqAttLen, CDIINQATTLEN, cdiinqattlen, INT, INT, STRING) +FCALLSCFUN3 (INT, cdiInqAttType, CDIINQATTTYPE, cdiinqatttype, INT, INT, STRING) +FCALLSCFUN3 (INT, cdiDelAtt, CDIDELATT, cdidelatt, INT, INT, STRING) +FCALLSCFUN4 (INT, cdiCopyAtts, CDICOPYATTS, cdicopyatts, INT, INT, INT, INT) +FCALLSCFUN6 (INT, cdiDefAttInt, CDIDEFATTINT, cdidefattint, INT, INT, STRING, INT, INT, INTV) +FCALLSCFUN6 (INT, cdiDefAttFlt, CDIDEFATTFLT, cdidefattflt, INT, INT, STRING, INT, INT, DOUBLEV) +FCALLSCFUN5 (INT, cdiDefAttTxt, CDIDEFATTTXT, cdidefatttxt, INT, INT, STRING, INT, PPSTRING) +FCALLSCFUN5 (INT, cdiInqAttInt, CDIINQATTINT, cdiinqattint, INT, INT, STRING, INT, INTV) +FCALLSCFUN5 (INT, cdiInqAttFlt, CDIINQATTFLT, cdiinqattflt, INT, INT, STRING, INT, DOUBLEV) +FCALLSCFUN5 (INT, cdiInqAttTxt, CDIINQATTTXT, cdiinqatttxt, INT, INT, STRING, INT, PPSTRING) + +/* GRID routines */ + +FCALLSCSUB2 (gridName, GRIDNAME, gridname, INT, PSTRING) +FCALLSCFUN1 (STRING, gridNamePtr, GRIDNAMEPTR, gridnameptr, INT) +FCALLSCSUB1 (gridCompress, GRIDCOMPRESS, gridcompress, INT) +FCALLSCSUB2 (gridDefMaskGME, GRIDDEFMASKGME, griddefmaskgme, INT, INTV) +FCALLSCFUN2 (INT, gridInqMaskGME, GRIDINQMASKGME, gridinqmaskgme, INT, INTV) +FCALLSCSUB2 (gridDefMask, GRIDDEFMASK, griddefmask, INT, INTV) +FCALLSCFUN2 (INT, gridInqMask, GRIDINQMASK, gridinqmask, INT, INTV) +static int gridCreate_fwrap(int gridtype, int size) +{ + int v; + v = gridCreate(gridtype, (SizeType)size); + return v; +} +FCALLSCFUN2 (INT, gridCreate_fwrap, GRIDCREATE, gridcreate, INT, INT) +FCALLSCSUB1 (gridDestroy, GRIDDESTROY, griddestroy, INT) +FCALLSCFUN1 (INT, gridDuplicate, GRIDDUPLICATE, gridduplicate, INT) +FCALLSCSUB2 (gridDefProj, GRIDDEFPROJ, griddefproj, INT, INT) +FCALLSCFUN1 (INT, gridInqProj, GRIDINQPROJ, gridinqproj, INT) +FCALLSCFUN1 (INT, gridInqProjType, GRIDINQPROJTYPE, gridinqprojtype, INT) +FCALLSCFUN1 (INT, gridInqType, GRIDINQTYPE, gridinqtype, INT) +static int gridInqSize_fwrap(int gridID) +{ + SizeType v; + v = gridInqSize(gridID); + return SizeType_c2f(v); +} +FCALLSCFUN1 (INT, gridInqSize_fwrap, GRIDINQSIZE, gridinqsize, INT) +static void gridDefXsize_fwrap(int gridID, int xsize) +{ + gridDefXsize(gridID, (SizeType)xsize); +} +FCALLSCSUB2 (gridDefXsize_fwrap, GRIDDEFXSIZE, griddefxsize, INT, INT) +static int gridInqXsize_fwrap(int gridID) +{ + SizeType v; + v = gridInqXsize(gridID); + return SizeType_c2f(v); +} +FCALLSCFUN1 (INT, gridInqXsize_fwrap, GRIDINQXSIZE, gridinqxsize, INT) +static void gridDefYsize_fwrap(int gridID, int ysize) +{ + gridDefYsize(gridID, (SizeType)ysize); +} +FCALLSCSUB2 (gridDefYsize_fwrap, GRIDDEFYSIZE, griddefysize, INT, INT) +static int gridInqYsize_fwrap(int gridID) +{ + SizeType v; + v = gridInqYsize(gridID); + return SizeType_c2f(v); +} +FCALLSCFUN1 (INT, gridInqYsize_fwrap, GRIDINQYSIZE, gridinqysize, INT) +FCALLSCSUB2 (gridDefNP, GRIDDEFNP, griddefnp, INT, INT) +FCALLSCFUN1 (INT, gridInqNP, GRIDINQNP, gridinqnp, INT) +FCALLSCSUB2 (gridDefXvals, GRIDDEFXVALS, griddefxvals, INT, DOUBLEV) +static int gridInqXvals_fwrap(int gridID, double xvals[]) +{ + SizeType v; + v = gridInqXvals(gridID, xvals); + return SizeType_c2f(v); +} +FCALLSCFUN2 (INT, gridInqXvals_fwrap, GRIDINQXVALS, gridinqxvals, INT, DOUBLEV) +static int gridInqXvalsPart_fwrap(int gridID, int start, int size, double xvals[]) +{ + SizeType v; + v = gridInqXvalsPart(gridID, start, (SizeType)size, xvals); + return SizeType_c2f(v); +} +FCALLSCFUN4 (INT, gridInqXvalsPart_fwrap, GRIDINQXVALSPART, gridinqxvalspart, INT, INT, INT, DOUBLEV) +FCALLSCFUN1 (INT, gridInqXIsc, GRIDINQXISC, gridinqxisc, INT) +FCALLSCSUB2 (gridDefYvals, GRIDDEFYVALS, griddefyvals, INT, DOUBLEV) +static int gridInqYvals_fwrap(int gridID, double yvals[]) +{ + SizeType v; + v = gridInqYvals(gridID, yvals); + return SizeType_c2f(v); +} +FCALLSCFUN2 (INT, gridInqYvals_fwrap, GRIDINQYVALS, gridinqyvals, INT, DOUBLEV) +static int gridInqYvalsPart_fwrap(int gridID, int start, int size, double yvals[]) +{ + SizeType v; + v = gridInqYvalsPart(gridID, start, (SizeType)size, yvals); + return SizeType_c2f(v); +} +FCALLSCFUN4 (INT, gridInqYvalsPart_fwrap, GRIDINQYVALSPART, gridinqyvalspart, INT, INT, INT, DOUBLEV) +FCALLSCFUN1 (INT, gridInqYIsc, GRIDINQYISC, gridinqyisc, INT) + +/* CDI var keys */ + + +/* String keys */ + + +/* Integer keys */ + + +/* Floating point keys */ + + +/* Byte array keys */ + +FCALLSCFUN4 (INT, cdiDefKeyInt, CDIDEFKEYINT, cdidefkeyint, INT, INT, INT, INT) +FCALLSCFUN4 (INT, cdiInqKeyInt, CDIINQKEYINT, cdiinqkeyint, INT, INT, INT, PINT) +FCALLSCFUN4 (INT, cdiDefKeyFloat, CDIDEFKEYFLOAT, cdidefkeyfloat, INT, INT, INT, DOUBLE) + +/* cdiInqKeyFloat Get a float value from a key */ + +FCALLSCFUN4 (INT, cdiInqKeyFloat, CDIINQKEYFLOAT, cdiinqkeyfloat, INT, INT, INT, PDOUBLE) +FCALLSCFUN4 (INT, cdiDefKeyString, CDIDEFKEYSTRING, cdidefkeystring, INT, INT, INT, STRING) +FCALLSCFUN5 (INT, cdiInqKeyString, CDIINQKEYSTRING, cdiinqkeystring, INT, INT, INT, PSTRING, PINT) +FCALLSCFUN4 (INT, cdiInqKeyLen, CDIINQKEYLEN, cdiinqkeylen, INT, INT, INT, PINT) +FCALLSCFUN4 (INT, cdiCopyKeys, CDICOPYKEYS, cdicopykeys, INT, INT, INT, INT) +FCALLSCFUN4 (INT, cdiCopyKey, CDICOPYKEY, cdicopykey, INT, INT, INT, INT) +FCALLSCFUN3 (INT, cdiDeleteKey, CDIDELETEKEY, cdideletekey, INT, INT, INT) + +/* GRID routines */ + +FCALLSCSUB2 (gridDefXname, GRIDDEFXNAME, griddefxname, INT, STRING) +FCALLSCSUB2 (gridInqXname, GRIDINQXNAME, gridinqxname, INT, PSTRING) +FCALLSCSUB2 (gridDefXlongname, GRIDDEFXLONGNAME, griddefxlongname, INT, STRING) +FCALLSCSUB2 (gridInqXlongname, GRIDINQXLONGNAME, gridinqxlongname, INT, PSTRING) +FCALLSCSUB2 (gridDefXunits, GRIDDEFXUNITS, griddefxunits, INT, STRING) +FCALLSCSUB2 (gridInqXunits, GRIDINQXUNITS, gridinqxunits, INT, PSTRING) +FCALLSCSUB2 (gridDefYname, GRIDDEFYNAME, griddefyname, INT, STRING) +FCALLSCSUB2 (gridInqYname, GRIDINQYNAME, gridinqyname, INT, PSTRING) +FCALLSCSUB2 (gridDefYlongname, GRIDDEFYLONGNAME, griddefylongname, INT, STRING) +FCALLSCSUB2 (gridInqYlongname, GRIDINQYLONGNAME, gridinqylongname, INT, PSTRING) +FCALLSCSUB2 (gridDefYunits, GRIDDEFYUNITS, griddefyunits, INT, STRING) +FCALLSCSUB2 (gridInqYunits, GRIDINQYUNITS, gridinqyunits, INT, PSTRING) +FCALLSCSUB2 (gridDefDatatype, GRIDDEFDATATYPE, griddefdatatype, INT, INT) +FCALLSCFUN1 (INT, gridInqDatatype, GRIDINQDATATYPE, gridinqdatatype, INT) +static double gridInqXval_fwrap(int gridID, int index) +{ + double v; + v = gridInqXval(gridID, (SizeType)index); + return v; +} +FCALLSCFUN2 (DOUBLE, gridInqXval_fwrap, GRIDINQXVAL, gridinqxval, INT, INT) +static double gridInqYval_fwrap(int gridID, int index) +{ + double v; + v = gridInqYval(gridID, (SizeType)index); + return v; +} +FCALLSCFUN2 (DOUBLE, gridInqYval_fwrap, GRIDINQYVAL, gridinqyval, INT, INT) +FCALLSCFUN1 (DOUBLE, gridInqXinc, GRIDINQXINC, gridinqxinc, INT) +FCALLSCFUN1 (DOUBLE, gridInqYinc, GRIDINQYINC, gridinqyinc, INT) +FCALLSCFUN1 (INT, gridIsCircular, GRIDISCIRCULAR, gridiscircular, INT) +FCALLSCFUN1 (INT, gridInqTrunc, GRIDINQTRUNC, gridinqtrunc, INT) +FCALLSCSUB2 (gridDefTrunc, GRIDDEFTRUNC, griddeftrunc, INT, INT) + +/* Reference of an unstructured grid */ + +FCALLSCSUB2 (gridDefNumber, GRIDDEFNUMBER, griddefnumber, INT, INT) +FCALLSCFUN1 (INT, gridInqNumber, GRIDINQNUMBER, gridinqnumber, INT) +FCALLSCSUB2 (gridDefPosition, GRIDDEFPOSITION, griddefposition, INT, INT) +FCALLSCFUN1 (INT, gridInqPosition, GRIDINQPOSITION, gridinqposition, INT) +FCALLSCSUB2 (gridDefReference, GRIDDEFREFERENCE, griddefreference, INT, STRING) +FCALLSCFUN2 (INT, gridInqReference, GRIDINQREFERENCE, gridinqreference, INT, PSTRING) +FCALLSCSUB2 (gridDefUUID, GRIDDEFUUID, griddefuuid, INT, PVOID) +FCALLSCSUB2 (gridInqUUID, GRIDINQUUID, gridinquuid, INT, PVOID) + +/* Rotated Lon/Lat grid */ + +FCALLSCSUB4 (gridDefParamRLL, GRIDDEFPARAMRLL, griddefparamrll, INT, DOUBLE, DOUBLE, DOUBLE) +FCALLSCSUB4 (gridInqParamRLL, GRIDINQPARAMRLL, gridinqparamrll, INT, PDOUBLE, PDOUBLE, PDOUBLE) + +/* Hexagonal GME grid */ + +FCALLSCSUB5 (gridDefParamGME, GRIDDEFPARAMGME, griddefparamgme, INT, INT, INT, INT, INT) +FCALLSCSUB5 (gridInqParamGME, GRIDINQPARAMGME, gridinqparamgme, INT, PINT, PINT, PINT, PINT) +FCALLSCSUB2 (gridDefArea, GRIDDEFAREA, griddefarea, INT, DOUBLEV) +FCALLSCSUB2 (gridInqArea, GRIDINQAREA, gridinqarea, INT, DOUBLEV) +FCALLSCFUN1 (INT, gridHasArea, GRIDHASAREA, gridhasarea, INT) +FCALLSCSUB2 (gridDefNvertex, GRIDDEFNVERTEX, griddefnvertex, INT, INT) +FCALLSCFUN1 (INT, gridInqNvertex, GRIDINQNVERTEX, gridinqnvertex, INT) +FCALLSCSUB2 (gridDefXbounds, GRIDDEFXBOUNDS, griddefxbounds, INT, DOUBLEV) +static int gridInqXbounds_fwrap(int gridID, double xbounds[]) +{ + SizeType v; + v = gridInqXbounds(gridID, xbounds); + return SizeType_c2f(v); +} +FCALLSCFUN2 (INT, gridInqXbounds_fwrap, GRIDINQXBOUNDS, gridinqxbounds, INT, DOUBLEV) +static int gridInqXboundsPart_fwrap(int gridID, int start, int size, double xbounds[]) +{ + SizeType v; + v = gridInqXboundsPart(gridID, start, (SizeType)size, xbounds); + return SizeType_c2f(v); +} +FCALLSCFUN4 (INT, gridInqXboundsPart_fwrap, GRIDINQXBOUNDSPART, gridinqxboundspart, INT, INT, INT, DOUBLEV) +FCALLSCSUB2 (gridDefYbounds, GRIDDEFYBOUNDS, griddefybounds, INT, DOUBLEV) +static int gridInqYbounds_fwrap(int gridID, double ybounds[]) +{ + SizeType v; + v = gridInqYbounds(gridID, ybounds); + return SizeType_c2f(v); +} +FCALLSCFUN2 (INT, gridInqYbounds_fwrap, GRIDINQYBOUNDS, gridinqybounds, INT, DOUBLEV) +static int gridInqYboundsPart_fwrap(int gridID, int start, int size, double ybounds[]) +{ + SizeType v; + v = gridInqYboundsPart(gridID, start, (SizeType)size, ybounds); + return SizeType_c2f(v); +} +FCALLSCFUN4 (INT, gridInqYboundsPart_fwrap, GRIDINQYBOUNDSPART, gridinqyboundspart, INT, INT, INT, DOUBLEV) +FCALLSCSUB3 (gridDefReducedPoints, GRIDDEFREDUCEDPOINTS, griddefreducedpoints, INT, INT, INTV) +FCALLSCSUB2 (gridInqReducedPoints, GRIDINQREDUCEDPOINTS, gridinqreducedpoints, INT, INTV) +FCALLSCSUB2 (gridChangeType, GRIDCHANGETYPE, gridchangetype, INT, INT) +FCALLSCSUB2 (gridDefComplexPacking, GRIDDEFCOMPLEXPACKING, griddefcomplexpacking, INT, INT) +FCALLSCFUN1 (INT, gridInqComplexPacking, GRIDINQCOMPLEXPACKING, gridinqcomplexpacking, INT) + +/* ZAXIS routines */ + +FCALLSCSUB2 (zaxisName, ZAXISNAME, zaxisname, INT, PSTRING) +FCALLSCFUN1 (STRING, zaxisNamePtr, ZAXISNAMEPTR, zaxisnameptr, INT) +FCALLSCFUN2 (INT, zaxisCreate, ZAXISCREATE, zaxiscreate, INT, INT) +FCALLSCSUB1 (zaxisDestroy, ZAXISDESTROY, zaxisdestroy, INT) +FCALLSCFUN1 (INT, zaxisInqType, ZAXISINQTYPE, zaxisinqtype, INT) +FCALLSCFUN1 (INT, zaxisInqSize, ZAXISINQSIZE, zaxisinqsize, INT) +FCALLSCFUN1 (INT, zaxisDuplicate, ZAXISDUPLICATE, zaxisduplicate, INT) +FCALLSCSUB2 (zaxisDefLevels, ZAXISDEFLEVELS, zaxisdeflevels, INT, DOUBLEV) +FCALLSCFUN2 (INT, zaxisInqLevels, ZAXISINQLEVELS, zaxisinqlevels, INT, DOUBLEV) +FCALLSCFUN1 (INT, zaxisInqCLen, ZAXISINQCLEN, zaxisinqclen, INT) +FCALLSCSUB3 (zaxisDefLevel, ZAXISDEFLEVEL, zaxisdeflevel, INT, INT, DOUBLE) +FCALLSCFUN2 (DOUBLE, zaxisInqLevel, ZAXISINQLEVEL, zaxisinqlevel, INT, INT) +FCALLSCSUB2 (zaxisDefNlevRef, ZAXISDEFNLEVREF, zaxisdefnlevref, INT, INT) +FCALLSCFUN1 (INT, zaxisInqNlevRef, ZAXISINQNLEVREF, zaxisinqnlevref, INT) +FCALLSCSUB2 (zaxisDefNumber, ZAXISDEFNUMBER, zaxisdefnumber, INT, INT) +FCALLSCFUN1 (INT, zaxisInqNumber, ZAXISINQNUMBER, zaxisinqnumber, INT) +FCALLSCSUB2 (zaxisDefUUID, ZAXISDEFUUID, zaxisdefuuid, INT, PVOID) +FCALLSCSUB2 (zaxisInqUUID, ZAXISINQUUID, zaxisinquuid, INT, PVOID) +FCALLSCSUB2 (zaxisDefName, ZAXISDEFNAME, zaxisdefname, INT, STRING) +FCALLSCSUB2 (zaxisInqName, ZAXISINQNAME, zaxisinqname, INT, PSTRING) +FCALLSCSUB2 (zaxisDefLongname, ZAXISDEFLONGNAME, zaxisdeflongname, INT, STRING) +FCALLSCSUB2 (zaxisInqLongname, ZAXISINQLONGNAME, zaxisinqlongname, INT, PSTRING) +FCALLSCSUB2 (zaxisDefUnits, ZAXISDEFUNITS, zaxisdefunits, INT, STRING) +FCALLSCSUB2 (zaxisInqUnits, ZAXISINQUNITS, zaxisinqunits, INT, PSTRING) +FCALLSCSUB2 (zaxisInqStdname, ZAXISINQSTDNAME, zaxisinqstdname, INT, PSTRING) +FCALLSCSUB2 (zaxisDefDatatype, ZAXISDEFDATATYPE, zaxisdefdatatype, INT, INT) +FCALLSCFUN1 (INT, zaxisInqDatatype, ZAXISINQDATATYPE, zaxisinqdatatype, INT) +FCALLSCSUB2 (zaxisDefPositive, ZAXISDEFPOSITIVE, zaxisdefpositive, INT, INT) +FCALLSCFUN1 (INT, zaxisInqPositive, ZAXISINQPOSITIVE, zaxisinqpositive, INT) +FCALLSCSUB1 (zaxisDefScalar, ZAXISDEFSCALAR, zaxisdefscalar, INT) +FCALLSCFUN1 (INT, zaxisInqScalar, ZAXISINQSCALAR, zaxisinqscalar, INT) +FCALLSCSUB3 (zaxisDefVct, ZAXISDEFVCT, zaxisdefvct, INT, INT, DOUBLEV) +FCALLSCSUB2 (zaxisInqVct, ZAXISINQVCT, zaxisinqvct, INT, DOUBLEV) +FCALLSCFUN1 (INT, zaxisInqVctSize, ZAXISINQVCTSIZE, zaxisinqvctsize, INT) +FCALLSCSUB2 (zaxisDefLbounds, ZAXISDEFLBOUNDS, zaxisdeflbounds, INT, DOUBLEV) +FCALLSCFUN2 (INT, zaxisInqLbounds, ZAXISINQLBOUNDS, zaxisinqlbounds, INT, DOUBLEV) +FCALLSCFUN2 (DOUBLE, zaxisInqLbound, ZAXISINQLBOUND, zaxisinqlbound, INT, INT) +FCALLSCSUB2 (zaxisDefUbounds, ZAXISDEFUBOUNDS, zaxisdefubounds, INT, DOUBLEV) +FCALLSCFUN2 (INT, zaxisInqUbounds, ZAXISINQUBOUNDS, zaxisinqubounds, INT, DOUBLEV) +FCALLSCFUN2 (DOUBLE, zaxisInqUbound, ZAXISINQUBOUND, zaxisinqubound, INT, INT) +FCALLSCSUB2 (zaxisDefWeights, ZAXISDEFWEIGHTS, zaxisdefweights, INT, DOUBLEV) +FCALLSCFUN2 (INT, zaxisInqWeights, ZAXISINQWEIGHTS, zaxisinqweights, INT, DOUBLEV) +FCALLSCSUB2 (zaxisChangeType, ZAXISCHANGETYPE, zaxischangetype, INT, INT) + +/* TAXIS routines */ + +FCALLSCFUN1 (INT, taxisCreate, TAXISCREATE, taxiscreate, INT) +FCALLSCSUB1 (taxisDestroy, TAXISDESTROY, taxisdestroy, INT) +FCALLSCFUN1 (INT, taxisDuplicate, TAXISDUPLICATE, taxisduplicate, INT) +FCALLSCSUB2 (taxisCopyTimestep, TAXISCOPYTIMESTEP, taxiscopytimestep, INT, INT) +FCALLSCSUB2 (taxisDefType, TAXISDEFTYPE, taxisdeftype, INT, INT) +FCALLSCFUN1 (INT, taxisInqType, TAXISINQTYPE, taxisinqtype, INT) +FCALLSCSUB2 (taxisDefVdate, TAXISDEFVDATE, taxisdefvdate, INT, INT) +FCALLSCSUB2 (taxisDefVtime, TAXISDEFVTIME, taxisdefvtime, INT, INT) +FCALLSCFUN1 (INT, taxisInqVdate, TAXISINQVDATE, taxisinqvdate, INT) +FCALLSCFUN1 (INT, taxisInqVtime, TAXISINQVTIME, taxisinqvtime, INT) +FCALLSCSUB2 (taxisDefRdate, TAXISDEFRDATE, taxisdefrdate, INT, INT) +FCALLSCSUB2 (taxisDefRtime, TAXISDEFRTIME, taxisdefrtime, INT, INT) +FCALLSCFUN1 (INT, taxisInqRdate, TAXISINQRDATE, taxisinqrdate, INT) +FCALLSCFUN1 (INT, taxisInqRtime, TAXISINQRTIME, taxisinqrtime, INT) +FCALLSCFUN1 (INT, taxisHasBounds, TAXISHASBOUNDS, taxishasbounds, INT) +FCALLSCSUB1 (taxisWithBounds, TAXISWITHBOUNDS, taxiswithbounds, INT) +FCALLSCSUB1 (taxisDeleteBounds, TAXISDELETEBOUNDS, taxisdeletebounds, INT) +FCALLSCSUB3 (taxisDefVdateBounds, TAXISDEFVDATEBOUNDS, taxisdefvdatebounds, INT, INT, INT) +FCALLSCSUB3 (taxisDefVtimeBounds, TAXISDEFVTIMEBOUNDS, taxisdefvtimebounds, INT, INT, INT) +FCALLSCSUB3 (taxisInqVdateBounds, TAXISINQVDATEBOUNDS, taxisinqvdatebounds, INT, PINT, PINT) +FCALLSCSUB3 (taxisInqVtimeBounds, TAXISINQVTIMEBOUNDS, taxisinqvtimebounds, INT, PINT, PINT) +FCALLSCSUB2 (taxisDefCalendar, TAXISDEFCALENDAR, taxisdefcalendar, INT, INT) +FCALLSCFUN1 (INT, taxisInqCalendar, TAXISINQCALENDAR, taxisinqcalendar, INT) +FCALLSCSUB2 (taxisDefTunit, TAXISDEFTUNIT, taxisdeftunit, INT, INT) +FCALLSCFUN1 (INT, taxisInqTunit, TAXISINQTUNIT, taxisinqtunit, INT) +FCALLSCSUB2 (taxisDefForecastTunit, TAXISDEFFORECASTTUNIT, taxisdefforecasttunit, INT, INT) +FCALLSCFUN1 (INT, taxisInqForecastTunit, TAXISINQFORECASTTUNIT, taxisinqforecasttunit, INT) +FCALLSCSUB2 (taxisDefForecastPeriod, TAXISDEFFORECASTPERIOD, taxisdefforecastperiod, INT, DOUBLE) +FCALLSCFUN1 (DOUBLE, taxisInqForecastPeriod, TAXISINQFORECASTPERIOD, taxisinqforecastperiod, INT) +FCALLSCSUB2 (taxisDefNumavg, TAXISDEFNUMAVG, taxisdefnumavg, INT, INT) +FCALLSCFUN1 (INT, taxisInqNumavg, TAXISINQNUMAVG, taxisinqnumavg, INT) +FCALLSCFUN1 (STRING, taxisNamePtr, TAXISNAMEPTR, taxisnameptr, INT) +FCALLSCFUN1 (STRING, tunitNamePtr, TUNITNAMEPTR, tunitnameptr, INT) + +/* Institut routines */ + +FCALLSCFUN4 (INT, institutDef, INSTITUTDEF, institutdef, INT, INT, STRING, STRING) +FCALLSCFUN4 (INT, institutInq, INSTITUTINQ, institutinq, INT, INT, STRING, STRING) +FCALLSCFUN0 (INT, institutInqNumber, INSTITUTINQNUMBER, institutinqnumber) +FCALLSCFUN1 (INT, institutInqCenter, INSTITUTINQCENTER, institutinqcenter, INT) +FCALLSCFUN1 (INT, institutInqSubcenter, INSTITUTINQSUBCENTER, institutinqsubcenter, INT) +FCALLSCFUN1 (STRING, institutInqNamePtr, INSTITUTINQNAMEPTR, institutinqnameptr, INT) +FCALLSCFUN1 (STRING, institutInqLongnamePtr, INSTITUTINQLONGNAMEPTR, institutinqlongnameptr, INT) + +/* Model routines */ + +FCALLSCFUN3 (INT, modelDef, MODELDEF, modeldef, INT, INT, STRING) +FCALLSCFUN3 (INT, modelInq, MODELINQ, modelinq, INT, INT, STRING) +FCALLSCFUN1 (INT, modelInqInstitut, MODELINQINSTITUT, modelinqinstitut, INT) +FCALLSCFUN1 (INT, modelInqGribID, MODELINQGRIBID, modelinqgribid, INT) +FCALLSCFUN1 (STRING, modelInqNamePtr, MODELINQNAMEPTR, modelinqnameptr, INT) + +/* Table routines */ + +FCALLSCSUB2 (tableWrite, TABLEWRITE, tablewrite, STRING, INT) +FCALLSCFUN1 (INT, tableRead, TABLEREAD, tableread, STRING) +FCALLSCFUN3 (INT, tableDef, TABLEDEF, tabledef, INT, INT, STRING) +FCALLSCFUN1 (STRING, tableInqNamePtr, TABLEINQNAMEPTR, tableinqnameptr, INT) +FCALLSCFUN3 (INT, tableInq, TABLEINQ, tableinq, INT, INT, STRING) +FCALLSCFUN0 (INT, tableInqNumber, TABLEINQNUMBER, tableinqnumber) +FCALLSCFUN1 (INT, tableInqNum, TABLEINQNUM, tableinqnum, INT) +FCALLSCFUN1 (INT, tableInqModel, TABLEINQMODEL, tableinqmodel, INT) +FCALLSCSUB6 (tableInqEntry, TABLEINQENTRY, tableinqentry, INT, INT, INT, PSTRING, PSTRING, PSTRING) + +/* Subtype routines */ + +FCALLSCFUN1 (INT, subtypeCreate, SUBTYPECREATE, subtypecreate, INT) + +/* Gives a textual summary of the variable subtype */ + +FCALLSCSUB1 (subtypePrint, SUBTYPEPRINT, subtypeprint, INT) + +/* Compares two subtype data structures */ + +FCALLSCFUN2 (INT, subtypeCompare, SUBTYPECOMPARE, subtypecompare, INT, INT) +FCALLSCFUN1 (INT, subtypeInqSize, SUBTYPEINQSIZE, subtypeinqsize, INT) +FCALLSCFUN1 (INT, subtypeInqActiveIndex, SUBTYPEINQACTIVEINDEX, subtypeinqactiveindex, INT) +FCALLSCSUB2 (subtypeDefActiveIndex, SUBTYPEDEFACTIVEINDEX, subtypedefactiveindex, INT, INT) + +/* Generate a "query object" out of a key-value pair */ + + +/* Generate an AND-combined "query object" out of two previous query objects */ + +FCALLSCFUN3 (INT, subtypeInqTile, SUBTYPEINQTILE, subtypeinqtile, INT, INT, INT) +FCALLSCFUN4 (INT, subtypeInqAttribute, SUBTYPEINQATTRIBUTE, subtypeinqattribute, INT, INT, STRING, PINT) +FCALLSCFUN2 (INT, vlistInqVarSubtype, VLISTINQVARSUBTYPE, vlistinqvarsubtype, INT, INT) +FCALLSCSUB3 (gribapiLibraryVersion, GRIBAPILIBRARYVERSION, gribapilibraryversion, PINT, PINT, PINT) + +/* Compatibility functions for release 1.8.3 (obsolete functions) */ + +FCALLSCSUB2 (zaxisDefLtype, ZAXISDEFLTYPE, zaxisdefltype, INT, INT) +FCALLSCFUN2 (INT, vlistInqVarTypeOfGeneratingProcess, VLISTINQVARTYPEOFGENERATINGPROCESS, vlistinqvartypeofgeneratingprocess, INT, INT) +FCALLSCSUB3 (vlistDefVarTypeOfGeneratingProcess, VLISTDEFVARTYPEOFGENERATINGPROCESS, vlistdefvartypeofgeneratingprocess, INT, INT, INT) +FCALLSCSUB3 (vlistDefVarProductDefinitionTemplate, VLISTDEFVARPRODUCTDEFINITIONTEMPLATE, vlistdefvarproductdefinitiontemplate, INT, INT, INT) + +/* End of fortran interface */ + + +#if defined __clang__ +# pragma GCC diagnostic pop +#endif + +// clang-format on + +#endif diff --git a/src/cdipio.inc b/src/cdipio.inc new file mode 100644 index 0000000000000000000000000000000000000000..b1b2e7ec801abc0eb375d045a396ef16aa7772ea --- /dev/null +++ b/src/cdipio.inc @@ -0,0 +1,318 @@ +! This file was automatically generated, don't edit! +! +! Fortran interface for CDI library version 2.2.0 +! +! Author: +! ------- +! Uwe Schulzweida, MPI-MET, Hamburg, February 2023 +! + +! +! Start of fortran interface for the following routines (make_fint.c) +! +! +! parallel IO IOMode +! + INTEGER PIO_NONE + PARAMETER (PIO_NONE = 0) + INTEGER PIO_MPI + PARAMETER (PIO_MPI = 1) + INTEGER PIO_WRITER + PARAMETER (PIO_WRITER = 2) + INTEGER PIO_ASYNCH + PARAMETER (PIO_ASYNCH = 3) + INTEGER PIO_FPGUARD + PARAMETER (PIO_FPGUARD = 4) + INTEGER PIO_MPI_FW_ORDERED + PARAMETER (PIO_MPI_FW_ORDERED = 5) + INTEGER PIO_MPI_FW_AT_ALL + PARAMETER (PIO_MPI_FW_AT_ALL = 6) + INTEGER PIO_MPI_FW_AT_REBLOCK + PARAMETER (PIO_MPI_FW_AT_REBLOCK = 7) + INTEGER PIO_MINIOMODE + PARAMETER (PIO_MINIOMODE = PIO_NONE) + INTEGER PIO_MAXIOMODE + PARAMETER (PIO_MAXIOMODE = PIO_MPI_FW_AT_REBLOCK) + INTEGER PIO_ROLE_CLIENT + PARAMETER (PIO_ROLE_CLIENT = 0) + INTEGER PIO_ROLE_COLLECTOR + PARAMETER (PIO_ROLE_COLLECTOR = 1) + INTEGER PIO_ROLE_WRITER + PARAMETER (PIO_ROLE_WRITER = 2) + INTEGER PIO_ROLE_WRITER_COLLECTOR + PARAMETER (PIO_ROLE_WRITER_COLLECTOR = 3) + INTEGER PIO_ROLE_FPGUARD + PARAMETER (PIO_ROLE_FPGUARD = 4) +! +! parallel IO routines +! +! pioEndDef + EXTERNAL pioEndDef + +! pioEndTimestepping + EXTERNAL pioEndTimestepping + +! pioFinalize + EXTERNAL pioFinalize + +! cdiPioNoPostCommSetup + EXTERNAL cdiPioNoPostCommSetup + + INTEGER pioInit +! (INTEGER commSuper, +! INTEGER nProcsIO, +! INTEGER IOMode, +! INTEGER pioNamespace, +! REAL partInflate, +! PROCEDURE postCommSetupActions) + EXTERNAL pioInit + + INTEGER cdiPioInit +! (INTEGER commSuper, +! INTEGER confResH, +! INTEGER pioNamespace) + EXTERNAL cdiPioInit + +! pioWriteTimestep + EXTERNAL pioWriteTimestep + +! cdiPioRDMAProgress + EXTERNAL cdiPioRDMAProgress + +! cdiPioStreamDefDecomposedVlist +! (INTEGER streamID, +! INTEGER vlistID, +! TYPE(XT_IDXLIST)partDesc(*), +! INTEGER conversion(*)) + EXTERNAL cdiPioStreamDefDecomposedVlist + +! streamWriteVarPart +! (INTEGER streamID, +! INTEGER varID, +! DOUBLEPRECISION data, +! INTEGER nmiss, +! TYPE(XT_IDXLIST)partDesc) + EXTERNAL streamWriteVarPart + +! streamWriteVarPartF +! (INTEGER streamID, +! INTEGER varID, +! REAL data, +! INTEGER nmiss, +! TYPE(XT_IDXLIST)partDesc) + EXTERNAL streamWriteVarPartF + +! streamWriteScatteredVarPart +! (INTEGER streamID, +! INTEGER varID, +! DOUBLEPRECISION data, +! INTEGER numBlocks, +! INTEGER blocklengths(*), +! INTEGER displacements(*), +! INTEGER nmiss, +! TYPE(XT_IDXLIST)partDesc) + EXTERNAL streamWriteScatteredVarPart + +! streamWriteScatteredVarPartF +! (INTEGER streamID, +! INTEGER varID, +! REAL data, +! INTEGER numBlocks, +! INTEGER blocklengths(*), +! INTEGER displacements(*), +! INTEGER nmiss, +! TYPE(XT_IDXLIST)partDesc) + EXTERNAL streamWriteScatteredVarPartF + + INTEGER cdiPioCSRLastN +! (INTEGER commSuper, +! INTEGER IOMode, +! INTEGER nProcsIO) + EXTERNAL cdiPioCSRLastN + + INTEGER cdiPioCSRFirstN +! (INTEGER commSuper, +! INTEGER IOMode, +! INTEGER nProcsIO) + EXTERNAL cdiPioCSRFirstN + + INTEGER cdiPioCSRBalanced +! (INTEGER commSuper, +! INTEGER IOMode, +! INTEGER nProcsIO) + EXTERNAL cdiPioCSRBalanced + + INTEGER cdiPioStr2IOMode +! (CHARACTER*(*) modeStr) + EXTERNAL cdiPioStr2IOMode + + CHARACTER(80) cdiPioIOMode2Str +! (INTEGER IOMode) + EXTERNAL cdiPioIOMode2Str + + INTEGER cdiPioConfCreate + EXTERNAL cdiPioConfCreate + +! cdiPioConfDestroy +! (INTEGER confResH) + EXTERNAL cdiPioConfDestroy + +! cdiPioConfSetPartInflate +! (INTEGER confResH, +! REAL partInflate) + EXTERNAL cdiPioConfSetPartInflate + + REAL cdiPioConfGetPartInflate +! (INTEGER confResH) + EXTERNAL cdiPioConfGetPartInflate + +! cdiPioConfSetIOMode +! (INTEGER confResH, +! INTEGER IOMode) + EXTERNAL cdiPioConfSetIOMode + + INTEGER cdiPioConfGetIOMode +! (INTEGER confResH) + EXTERNAL cdiPioConfGetIOMode + +! cdiPioConfSetCSRole +! (INTEGER confResH, +! INTEGER CSRole) + EXTERNAL cdiPioConfSetCSRole + + INTEGER cdiPioConfGetCSRole +! (INTEGER confResH) + EXTERNAL cdiPioConfGetCSRole + +! cdiPioConfSetPostCommSetupActions +! (INTEGER confResH, +! PROCEDURE postCommSetupActions) + EXTERNAL cdiPioConfSetPostCommSetupActions + + INTEGER CDIPIO_CALLBACK_POSTCOMMSETUP + PARAMETER (CDIPIO_CALLBACK_POSTCOMMSETUP = 0) + INTEGER CDIPIO_CALLBACK_POSTSTREAMCLOSE + PARAMETER (CDIPIO_CALLBACK_POSTSTREAMCLOSE = 1) + INTEGER CDIPIO_CALLBACK_POSTWRITEBATCH + PARAMETER (CDIPIO_CALLBACK_POSTWRITEBATCH = 2) +! cdiPioConfSetCallBackActions +! (INTEGER confResH, +! INTEGER trigger, +! PROCEDURE action) + EXTERNAL cdiPioConfSetCallBackActions + +! +! cdiPioConfSetLargePageAlign should block buffer be aligned to +! large pages instead of normal pages? +! +! cdiPioConfSetLargePageAlign +! (INTEGER confResH, +! INTEGER largePageAlign) + EXTERNAL cdiPioConfSetLargePageAlign + + INTEGER cdiPioConfGetLargePageAlign +! (INTEGER confResH) + EXTERNAL cdiPioConfGetLargePageAlign + +! cdiPioConfSetRecordAggBufLim +! (INTEGER confResH, +! INTEGER lim_mb) + EXTERNAL cdiPioConfSetRecordAggBufLim + + INTEGER cdiPioConfGetRecordAggBufLim +! (INTEGER confResH) + EXTERNAL cdiPioConfGetRecordAggBufLim + +! cdiPioConfSetWriteAggBufLim +! (INTEGER confResH, +! INTEGER lim_mb) + EXTERNAL cdiPioConfSetWriteAggBufLim + + INTEGER cdiPioConfGetWriteAggBufLim +! (INTEGER confResH) + EXTERNAL cdiPioConfGetWriteAggBufLim + +! cdiPioConfSetAioQueueDepth +! (INTEGER confResH, +! INTEGER queue_depth) + EXTERNAL cdiPioConfSetAioQueueDepth + + INTEGER cdiPioConfGetAioQueueDepth +! (INTEGER confResH) + EXTERNAL cdiPioConfGetAioQueueDepth + +! cdiPioConfSetMaxPathLen +! (INTEGER confResH, +! INTEGER max_path_len) + EXTERNAL cdiPioConfSetMaxPathLen + + INTEGER cdiPioConfGetMaxPathLen +! (INTEGER confResH) + EXTERNAL cdiPioConfGetMaxPathLen + +! cdiPioConfSetRedistCache +! (INTEGER confResH, +! INTEGER doCache) + EXTERNAL cdiPioConfSetRedistCache + + INTEGER cdiPioConfGetRedistCache +! (INTEGER confResH) + EXTERNAL cdiPioConfGetRedistCache + +! cdiPioConfSetXmapCache +! (INTEGER confResH, +! INTEGER doCache) + EXTERNAL cdiPioConfSetXmapCache + + INTEGER cdiPioConfGetXmapCache +! (INTEGER confResH) + EXTERNAL cdiPioConfGetXmapCache + +! cdiPioConfSetStripeConversion +! (INTEGER confResH, +! INTEGER doStripify) + EXTERNAL cdiPioConfSetStripeConversion + + INTEGER cdiPioConfGetStripeConversion +! (INTEGER confResH) + EXTERNAL cdiPioConfGetStripeConversion + +! cdiPioConfSetBatchedRMA +! (INTEGER confResH, +! INTEGER doBatchedRMA) + EXTERNAL cdiPioConfSetBatchedRMA + + INTEGER cdiPioConfGetBatchedRMA +! (INTEGER confResH) + EXTERNAL cdiPioConfGetBatchedRMA + + INTEGER cdiPioDistGridCreate +! (INTEGER gridtype, +! INTEGER size, +! INTEGER xsize, +! INTEGER ysize, +! INTEGER nvertex, +! INTEGER xy_decomposition_optional(2,*), +! TYPE(XT_IDXLIST)partDesc2D, +! TYPE(XT_IDXLIST)partDescX, +! TYPE(XT_IDXLIST)partDescY) + EXTERNAL cdiPioDistGridCreate + +! cdiPioDistGridEnableIndividualQueries +! (INTEGER gridID) + EXTERNAL cdiPioDistGridEnableIndividualQueries + +! cdiPioDistGridDisableIndividualQueries +! (INTEGER gridID) + EXTERNAL cdiPioDistGridDisableIndividualQueries + + LOGICAL cdiPioDistGridIndividualQueriesEnabled +! (INTEGER gridID) + EXTERNAL cdiPioDistGridIndividualQueriesEnabled + + INTEGER cdiPioInqInterComm + EXTERNAL cdiPioInqInterComm + +! +! End of fortran interface +! diff --git a/src/cdipioFortran.c b/src/cdipioFortran.c new file mode 100644 index 0000000000000000000000000000000000000000..1fba0d22d097215bd8b564c7cc0b9e047aad6522 --- /dev/null +++ b/src/cdipioFortran.c @@ -0,0 +1,186 @@ +// Automatically generated by make_fint.c, don't edit! + +// clang-format off + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifndef CDIPIO_H_ +#include "cdipio.h" +#endif + +#ifdef HAVE_CF_INTERFACE + +#include <limits.h> +#include <assert.h> + +#ifndef __CFORTRAN_LOADED +# if defined __clang__ +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wreserved-id-macro" +# endif +# include "cfortran.h" +# if defined __clang__ +# pragma GCC diagnostic pop +# endif +#endif +/* These functions are meant to be called from Fortran and don't + * need an interface declaration in a C header. */ +#ifdef __clang__ +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + +#ifdef CDI_H_ + +static inline +int SizeType_c2f(SizeType value_SizeType) +{ + assert(value_SizeType < INT_MAX); + return (int) value_SizeType; +} + +#endif + +/* Start of fortran interface for the following routines (make_fint.c) */ + + +/* parallel IO IOMode */ + + +/* parallel IO routines */ + +FCALLSCSUB0 (pioEndDef, PIOENDDEF, pioenddef) +FCALLSCSUB0 (pioEndTimestepping, PIOENDTIMESTEPPING, pioendtimestepping) +FCALLSCSUB0 (pioFinalize, PIOFINALIZE, piofinalize) +FCALLSCSUB0 (cdiPioNoPostCommSetup, CDIPIONOPOSTCOMMSETUP, cdipionopostcommsetup) + +#undef ROUTINE_6 +#define ROUTINE_6 (void (*)(void)) +static int pioInit_fwrap(int commSuper, int nProcsIO, int IOMode, int *pioNamespace, float partInflate, void (*postCommSetupActions)(void)) +{ + MPI_Comm v; + v = pioInit(MPI_Comm_f2c(commSuper), nProcsIO, IOMode, pioNamespace, partInflate, postCommSetupActions); + return MPI_Comm_c2f(v); +} +FCALLSCFUN6 (INT, pioInit_fwrap, PIOINIT, pioinit, INT, INT, INT, PINT, FLOAT, ROUTINE) +static int cdiPioInit_fwrap(int commSuper, int confResH, int *pioNamespace) +{ + MPI_Comm v; + v = cdiPioInit(MPI_Comm_f2c(commSuper), confResH, pioNamespace); + return MPI_Comm_c2f(v); +} +FCALLSCFUN3 (INT, cdiPioInit_fwrap, CDIPIOINIT, cdipioinit, INT, INT, PINT) +FCALLSCSUB0 (pioWriteTimestep, PIOWRITETIMESTEP, piowritetimestep) +FCALLSCSUB0 (cdiPioRDMAProgress, CDIPIORDMAPROGRESS, cdipiordmaprogress) +FCALLSCSUB4 (cdiPioStreamDefDecomposedVlist, CDIPIOSTREAMDEFDECOMPOSEDVLIST, cdipiostreamdefdecomposedvlist, INT, INT, PVOID, INTV) +static void streamWriteVarPart_fwrap(int streamID, int varID, double *data, int nmiss, void *partDesc) +{ + streamWriteVarPart(streamID, varID, data, nmiss, (*(Xt_idxlist *)partDesc)); +} +FCALLSCSUB5 (streamWriteVarPart_fwrap, STREAMWRITEVARPART, streamwritevarpart, INT, INT, PDOUBLE, INT, PVOID) +static void streamWriteVarPartF_fwrap(int streamID, int varID, float *data, int nmiss, void *partDesc) +{ + streamWriteVarPartF(streamID, varID, data, nmiss, (*(Xt_idxlist *)partDesc)); +} +FCALLSCSUB5 (streamWriteVarPartF_fwrap, STREAMWRITEVARPARTF, streamwritevarpartf, INT, INT, PFLOAT, INT, PVOID) +static void streamWriteScatteredVarPart_fwrap(int streamID, int varID, double *data, int numBlocks, const int blocklengths[], const int displacements[], int nmiss, void *partDesc) +{ + streamWriteScatteredVarPart(streamID, varID, data, numBlocks, blocklengths, displacements, nmiss, (*(Xt_idxlist *)partDesc)); +} +FCALLSCSUB8 (streamWriteScatteredVarPart_fwrap, STREAMWRITESCATTEREDVARPART, streamwritescatteredvarpart, INT, INT, PDOUBLE, INT, INTV, INTV, INT, PVOID) +static void streamWriteScatteredVarPartF_fwrap(int streamID, int varID, float *data, int numBlocks, const int blocklengths[], const int displacements[], int nmiss, void *partDesc) +{ + streamWriteScatteredVarPartF(streamID, varID, data, numBlocks, blocklengths, displacements, nmiss, (*(Xt_idxlist *)partDesc)); +} +FCALLSCSUB8 (streamWriteScatteredVarPartF_fwrap, STREAMWRITESCATTEREDVARPARTF, streamwritescatteredvarpartf, INT, INT, PFLOAT, INT, INTV, INTV, INT, PVOID) +static int cdiPioCSRLastN_fwrap(int commSuper, int IOMode, int nProcsIO) +{ + int v; + v = cdiPioCSRLastN(MPI_Comm_f2c(commSuper), IOMode, nProcsIO); + return v; +} +FCALLSCFUN3 (INT, cdiPioCSRLastN_fwrap, CDIPIOCSRLASTN, cdipiocsrlastn, INT, INT, INT) +static int cdiPioCSRFirstN_fwrap(int commSuper, int IOMode, int nProcsIO) +{ + int v; + v = cdiPioCSRFirstN(MPI_Comm_f2c(commSuper), IOMode, nProcsIO); + return v; +} +FCALLSCFUN3 (INT, cdiPioCSRFirstN_fwrap, CDIPIOCSRFIRSTN, cdipiocsrfirstn, INT, INT, INT) +static int cdiPioCSRBalanced_fwrap(int commSuper, int IOMode, int nProcsIO) +{ + int v; + v = cdiPioCSRBalanced(MPI_Comm_f2c(commSuper), IOMode, nProcsIO); + return v; +} +FCALLSCFUN3 (INT, cdiPioCSRBalanced_fwrap, CDIPIOCSRBALANCED, cdipiocsrbalanced, INT, INT, INT) +FCALLSCFUN1 (INT, cdiPioStr2IOMode, CDIPIOSTR2IOMODE, cdipiostr2iomode, STRING) +FCALLSCFUN1 (STRING, cdiPioIOMode2Str, CDIPIOIOMODE2STR, cdipioiomode2str, INT) +FCALLSCFUN0 (INT, cdiPioConfCreate, CDIPIOCONFCREATE, cdipioconfcreate) +FCALLSCSUB1 (cdiPioConfDestroy, CDIPIOCONFDESTROY, cdipioconfdestroy, INT) +FCALLSCSUB2 (cdiPioConfSetPartInflate, CDIPIOCONFSETPARTINFLATE, cdipioconfsetpartinflate, INT, FLOAT) +FCALLSCFUN1 (FLOAT, cdiPioConfGetPartInflate, CDIPIOCONFGETPARTINFLATE, cdipioconfgetpartinflate, INT) +FCALLSCSUB2 (cdiPioConfSetIOMode, CDIPIOCONFSETIOMODE, cdipioconfsetiomode, INT, INT) +FCALLSCFUN1 (INT, cdiPioConfGetIOMode, CDIPIOCONFGETIOMODE, cdipioconfgetiomode, INT) +FCALLSCSUB2 (cdiPioConfSetCSRole, CDIPIOCONFSETCSROLE, cdipioconfsetcsrole, INT, INT) +FCALLSCFUN1 (INT, cdiPioConfGetCSRole, CDIPIOCONFGETCSROLE, cdipioconfgetcsrole, INT) + +#undef ROUTINE_2 +#define ROUTINE_2 (void (*)(void)) +FCALLSCSUB2 (cdiPioConfSetPostCommSetupActions, CDIPIOCONFSETPOSTCOMMSETUPACTIONS, cdipioconfsetpostcommsetupactions, INT, ROUTINE) + +#undef ROUTINE_3 +#define ROUTINE_3 (void (*)(void)) +FCALLSCSUB3 (cdiPioConfSetCallBackActions, CDIPIOCONFSETCALLBACKACTIONS, cdipioconfsetcallbackactions, INT, INT, ROUTINE) + +/* cdiPioConfSetLargePageAlign should block buffer be aligned to + * large pages instead of normal pages? */ + +FCALLSCSUB2 (cdiPioConfSetLargePageAlign, CDIPIOCONFSETLARGEPAGEALIGN, cdipioconfsetlargepagealign, INT, INT) +FCALLSCFUN1 (INT, cdiPioConfGetLargePageAlign, CDIPIOCONFGETLARGEPAGEALIGN, cdipioconfgetlargepagealign, INT) +FCALLSCSUB2 (cdiPioConfSetRecordAggBufLim, CDIPIOCONFSETRECORDAGGBUFLIM, cdipioconfsetrecordaggbuflim, INT, INT) +FCALLSCFUN1 (INT, cdiPioConfGetRecordAggBufLim, CDIPIOCONFGETRECORDAGGBUFLIM, cdipioconfgetrecordaggbuflim, INT) +FCALLSCSUB2 (cdiPioConfSetWriteAggBufLim, CDIPIOCONFSETWRITEAGGBUFLIM, cdipioconfsetwriteaggbuflim, INT, INT) +FCALLSCFUN1 (INT, cdiPioConfGetWriteAggBufLim, CDIPIOCONFGETWRITEAGGBUFLIM, cdipioconfgetwriteaggbuflim, INT) +FCALLSCSUB2 (cdiPioConfSetAioQueueDepth, CDIPIOCONFSETAIOQUEUEDEPTH, cdipioconfsetaioqueuedepth, INT, INT) +FCALLSCFUN1 (INT, cdiPioConfGetAioQueueDepth, CDIPIOCONFGETAIOQUEUEDEPTH, cdipioconfgetaioqueuedepth, INT) +FCALLSCSUB2 (cdiPioConfSetMaxPathLen, CDIPIOCONFSETMAXPATHLEN, cdipioconfsetmaxpathlen, INT, INT) +FCALLSCFUN1 (INT, cdiPioConfGetMaxPathLen, CDIPIOCONFGETMAXPATHLEN, cdipioconfgetmaxpathlen, INT) +FCALLSCSUB2 (cdiPioConfSetRedistCache, CDIPIOCONFSETREDISTCACHE, cdipioconfsetredistcache, INT, INT) +FCALLSCFUN1 (INT, cdiPioConfGetRedistCache, CDIPIOCONFGETREDISTCACHE, cdipioconfgetredistcache, INT) +FCALLSCSUB2 (cdiPioConfSetXmapCache, CDIPIOCONFSETXMAPCACHE, cdipioconfsetxmapcache, INT, INT) +FCALLSCFUN1 (INT, cdiPioConfGetXmapCache, CDIPIOCONFGETXMAPCACHE, cdipioconfgetxmapcache, INT) +FCALLSCSUB2 (cdiPioConfSetStripeConversion, CDIPIOCONFSETSTRIPECONVERSION, cdipioconfsetstripeconversion, INT, INT) +FCALLSCFUN1 (INT, cdiPioConfGetStripeConversion, CDIPIOCONFGETSTRIPECONVERSION, cdipioconfgetstripeconversion, INT) +FCALLSCSUB2 (cdiPioConfSetBatchedRMA, CDIPIOCONFSETBATCHEDRMA, cdipioconfsetbatchedrma, INT, INT) +FCALLSCFUN1 (INT, cdiPioConfGetBatchedRMA, CDIPIOCONFGETBATCHEDRMA, cdipioconfgetbatchedrma, INT) +static int cdiPioDistGridCreate_fwrap(int gridtype, int size, int xsize, int ysize, int nvertex, const int xy_decomposition_optional[][2], void *partDesc2D, void *partDescX, void *partDescY) +{ + int v; + v = cdiPioDistGridCreate(gridtype, size, xsize, ysize, nvertex, xy_decomposition_optional, (*(Xt_idxlist *)partDesc2D), (*(Xt_idxlist *)partDescX), (*(Xt_idxlist *)partDescY)); + return v; +} +FCALLSCFUN9 (INT, cdiPioDistGridCreate_fwrap, CDIPIODISTGRIDCREATE, cdipiodistgridcreate, INT, INT, INT, INT, INT, INTVV, PVOID, PVOID, PVOID) +FCALLSCSUB1 (cdiPioDistGridEnableIndividualQueries, CDIPIODISTGRIDENABLEINDIVIDUALQUERIES, cdipiodistgridenableindividualqueries, INT) +FCALLSCSUB1 (cdiPioDistGridDisableIndividualQueries, CDIPIODISTGRIDDISABLEINDIVIDUALQUERIES, cdipiodistgriddisableindividualqueries, INT) +FCALLSCFUN1 (LOGICAL, cdiPioDistGridIndividualQueriesEnabled, CDIPIODISTGRIDINDIVIDUALQUERIESENABLED, cdipiodistgridindividualqueriesenabled, INT) +static int cdiPioInqInterComm_fwrap() +{ + MPI_Comm v; + v = cdiPioInqInterComm(); + return MPI_Comm_c2f(v); +} +FCALLSCFUN0 (INT, cdiPioInqInterComm_fwrap, CDIPIOINQINTERCOMM, cdipioinqintercomm) + +/* End of fortran interface */ + + +#if defined __clang__ +# pragma GCC diagnostic pop +#endif + +// clang-format on + +#endif diff --git a/src/config.h.in b/src/config.h.in new file mode 100644 index 0000000000000000000000000000000000000000..f4b52aef089ea323b24deb6ce780f10e9b4b6f5d --- /dev/null +++ b/src/config.h.in @@ -0,0 +1,337 @@ +/* src/config.h.in. Generated from configure.ac by autoheader. */ + +/* Define if building universal (internal helper macro) */ +#undef AC_APPLE_UNIVERSAL_BUILD + +/* CDI version */ +#undef CDI + +/* Compiler */ +#undef COMPILER + +/* Compiler version */ +#undef COMP_VERSION + +/* Define to 1 for ACROSS support */ +#undef HAVE_ACROSS + +/* Defined if backtrace() could be fully identified. */ +#undef HAVE_BACKTRACE + +/* Defined to 1 if C / Fortran interface cfortran.h works */ +#undef HAVE_CF_INTERFACE + +/* Define to 1 if you have the declaration of `isnan', and to 0 if you don't. + */ +#undef HAVE_DECL_ISNAN + +/* Define to 1 if you have the declaration of `MPI_UNSIGNED_LONG_LONG', and to + 0 if you don't. */ +#undef HAVE_DECL_MPI_UNSIGNED_LONG_LONG + +/* Define to 1 if you have the declaration of `nc_inq_format_extended', and to + 0 if you don't. */ +#undef HAVE_DECL_NC_INQ_FORMAT_EXTENDED + +/* Define to 1 if you have the declaration of `PAGESIZE', and to 0 if you + don't. */ +#undef HAVE_DECL_PAGESIZE + +/* Define to 1 if you have the declaration of `PAGE_SIZE', and to 0 if you + don't. */ +#undef HAVE_DECL_PAGE_SIZE + +/* Define to 1 if you have the declaration of `POSIX_REC_XFER_ALIGN', and to 0 + if you don't. */ +#undef HAVE_DECL_POSIX_REC_XFER_ALIGN + +/* Define to 1 if you have the declaration of `uuid_create', and to 0 if you + don't. */ +#undef HAVE_DECL_UUID_CREATE + +/* Define to 1 if you have the declaration of `uuid_generate', and to 0 if you + don't. */ +#undef HAVE_DECL_UUID_GENERATE + +/* Define to 1 if you have the declaration of `UUID_MAKE_V5', and to 0 if you + don't. */ +#undef HAVE_DECL_UUID_MAKE_V5 + +/* Define to 1 if you have the declaration of `_PC_REC_XFER_ALIGN', and to 0 + if you don't. */ +#undef HAVE_DECL__PC_REC_XFER_ALIGN + +/* Define to 1 if you have the declaration of `_SC_LARGE_PAGESIZE', and to 0 + if you don't. */ +#undef HAVE_DECL__SC_LARGE_PAGESIZE + +/* Define to 1 if you have the declaration of `_SC_PAGESIZE', and to 0 if you + don't. */ +#undef HAVE_DECL__SC_PAGESIZE + +/* Define to 1 if you have the declaration of `_SC_PAGE_SIZE', and to 0 if you + don't. */ +#undef HAVE_DECL__SC_PAGE_SIZE + +/* Define to 1 if __builtin_ctz is available, 0 if not */ +#undef HAVE_DECL___BUILTIN_CTZ + +/* Define to 1 if you have the <dlfcn.h> header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you have the <execinfo.h> header file. */ +#undef HAVE_EXECINFO_H + +/* Define to 1 if you have the <fdb5/api/fdb_c.h> header file. */ +#undef HAVE_FDB5_API_FDB_C_H + +/* Define to 1 if you have the `getline' function. */ +#undef HAVE_GETLINE + +/* Define to 1 if you have the `getpagesize' function. */ +#undef HAVE_GETPAGESIZE + +/* Define to 1 if you have the <grib_api.h> header file. */ +#undef HAVE_GRIB_API_H + +/* Define to 1 if you have the `grib_get_length' function. */ +#undef HAVE_GRIB_GET_LENGTH + +/* Define to 1 for H5get_libversion support */ +#undef HAVE_H5GET_LIBVERSION + +/* Define to 1 if you have the <inttypes.h> header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 for GRIB1 decoding/encoding with cgribex */ +#undef HAVE_LIBCGRIBEX + +/* Define to 1 for EXTRA interface */ +#undef HAVE_LIBEXTRA + +/* Define to 1 for FDB5 support */ +#undef HAVE_LIBFDB5 + +/* Define to 1 for GRIB support */ +#undef HAVE_LIBGRIB + +/* GRIB_API library is present if defined to 1 */ +#undef HAVE_LIBGRIB_API + +/* Define to 1 for IEG interface */ +#undef HAVE_LIBIEG + +/* Define to 1 for NetCDF OpenDAP */ +#undef HAVE_LIBNC_DAP + +/* Define to 1 for NetCDF support */ +#undef HAVE_LIBNETCDF + +/* Define to 1 if you have the `pthread' library (-lpthread). */ +#undef HAVE_LIBPTHREAD + +/* Define to 1 for SERVICE interface */ +#undef HAVE_LIBSERVICE + +/* Define to 1 for SZIP support */ +#undef HAVE_LIBSZ + +/* Define to 1 if you have the `mallinfo' function. */ +#undef HAVE_MALLINFO + +/* Define to 1 if you have the <malloc.h> header file. */ +#undef HAVE_MALLOC_H + +/* Define to 1 if you have the <memory.h> header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have a working `mmap' system call. */ +#undef HAVE_MMAP + +/* Define to 1 for NetCDF4/HDF5 support */ +#undef HAVE_NC4HDF5 + +/* Define to 1 for NetCDF4/HDF5 threadsafe support */ +#undef HAVE_NC4HDF5_THREADSAFE + +/* Define to 1 for NetCDF4/szlib support */ +#undef HAVE_NC4SZLIB + +/* Define to 1 for NetCDF Zarr */ +#undef HAVE_NCZARR + +/* Define to 1 for NetCDF4 nc_def_var_szip support */ +#undef HAVE_NC_DEF_VAR_SZIP + +/* Define to 1 for NetCDF2 support */ +#undef HAVE_NETCDF2 + +/* Define to 1 for NetCDF4 support */ +#undef HAVE_NETCDF4 + +/* Define to 1 if you have the <netcdf.h> header file. */ +#undef HAVE_NETCDF_H + +/* Define to 1 if you have the <netcdf_meta.h> header file. */ +#undef HAVE_NETCDF_META_H + +/* Define to 1 if you have the <netcdf_par.h> header file. */ +#undef HAVE_NETCDF_PAR_H + +/* Defined to 1 if NetCDF parallel open supports NC_PNETCDF */ +#undef HAVE_NETCDF_PAR_PNETCDF + +/* netCDF library does support MPI parallel invocations */ +#undef HAVE_PARALLEL_NC4 + +/* ScalES PPM C core library is available */ +#undef HAVE_PPM_CORE + +/* Define to 1 if you have the <ppm/dist_array.h> header file. */ +#undef HAVE_PPM_DIST_ARRAY_H + +/* Define to 1 if you have the <pthread.h> header file. */ +#undef HAVE_PTHREAD_H + +/* Have PTHREAD_PRIO_INHERIT. */ +#undef HAVE_PTHREAD_PRIO_INHERIT + +/* Define to 1 if you have the `pwrite' function. */ +#undef HAVE_PWRITE + +/* If available, contains the Python version number currently in use. */ +#undef HAVE_PYTHON + +/* Define to 1 if you have the <stdint.h> header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the <stdlib.h> header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the <strings.h> header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the <string.h> header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if `st_blksize' is a member of `struct stat'. */ +#undef HAVE_STRUCT_STAT_ST_BLKSIZE + +/* Define to 1 if you have the <sys/param.h> header file. */ +#undef HAVE_SYS_PARAM_H + +/* Define to 1 if you have the <sys/stat.h> header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the <sys/time.h> header file. */ +#undef HAVE_SYS_TIME_H + +/* Define to 1 if you have the <sys/types.h> header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the <szlib.h> header file. */ +#undef HAVE_SZLIB_H + +/* Define to 1 if you have the <unistd.h> header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if you have the <uuid.h> header file. */ +#undef HAVE_UUID_H + +/* Define to 1 if you have the <uuid/uuid.h> header file. */ +#undef HAVE_UUID_UUID_H + +/* Define to 1 for HIRLAM extensions */ +#undef HIRLAM_EXTENSIONS + +/* Define to the sub-directory where 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 + +/* Define to necessary symbol if this constant uses a non-standard name on + your system. */ +#undef PTHREAD_CREATE_JOINABLE + +/* The size of `unsigned long', as computed by sizeof. */ +#undef SIZEOF_UNSIGNED_LONG + +/* The size of `unsigned long long', as computed by sizeof. */ +#undef SIZEOF_UNSIGNED_LONG_LONG + +/* The size of `Xt_uid', as computed by sizeof. */ +#undef SIZEOF_XT_UID + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* System type */ +#undef SYSTEM_TYPE + +/* If the compiler supports a TLS storage class, define it to that here */ +#undef TLS + +/* 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 + +/* Defined to MPI datatype to be used for Xt_uid */ +#undef YAXT_UID_DT + +/* Enable large inode numbers on Mac OS X 10.5. */ +#ifndef _DARWIN_USE_64_BIT_INODE +# define _DARWIN_USE_64_BIT_INODE 1 +#endif + +/* Number of bits in a file offset, on hosts where this is settable. */ +#undef _FILE_OFFSET_BITS + +/* Define for large files, on AIX-style hosts. */ +#undef _LARGE_FILES + +/* Defined to return type of backtrace(). */ +#undef backtrace_size_t + +/* Define to the equivalent of the C99 'restrict' keyword, or to + nothing if this is not supported. Do not define if restrict is + supported directly. */ +#undef restrict +/* Work around a bug in Sun C++: it does not support _Restrict or + __restrict__, even though the corresponding Sun C compiler ends up with + "#define restrict _Restrict" or "#define restrict __restrict__" in the + previous line. Perhaps some future version of Sun C++ will work with + restrict; if so, hopefully it defines __RESTRICT like Sun C does. */ +#if defined __SUNPRO_CC && !defined __RESTRICT +# define _Restrict +# define __restrict__ +#endif diff --git a/src/mo_cdi.f90 b/src/mo_cdi.f90 new file mode 100644 index 0000000000000000000000000000000000000000..b8489890dc06b56836a94b5bf33e50d168138a4b --- /dev/null +++ b/src/mo_cdi.f90 @@ -0,0 +1,6105 @@ +! >>> Warning: This is a generated file. If you modify it, you get what you deserve. <<< +! +! Generated by "../interfaces/f2003/bindGen.rb" from input file "cdi.h". + +module mo_cdi + use iso_c_binding + implicit none + private + + public ctrim + public c_len + + interface + integer(c_size_t) function lib_strlen(charPtr) bind(c, name = "strlen") + import c_size_t, c_ptr + type(c_ptr), value :: charPtr + end function lib_strlen + + subroutine lib_free(ptr) bind(c, name = "free") + import c_ptr + type(c_ptr), value, intent(in) :: ptr + end subroutine lib_free + end interface + + integer(c_int), public, parameter :: CDI_MAX_NAME = 256 + integer(c_int), public, parameter :: CDI_UNDEFID = -1 + integer(c_int), public, parameter :: CDI_GLOBAL = -1 + integer(c_int), public, parameter :: CDI_XAXIS = 1 + integer(c_int), public, parameter :: CDI_YAXIS = 2 + integer(c_int), public, parameter :: CDI_BIGENDIAN = 0 + integer(c_int), public, parameter :: CDI_LITTLEENDIAN = 1 + integer(c_int), public, parameter :: CDI_PDPENDIAN = 2 + integer(c_int), public, parameter :: CDI_REAL = 1 + integer(c_int), public, parameter :: CDI_COMP = 2 + integer(c_int), public, parameter :: CDI_BOTH = 3 + integer(c_int), public, parameter :: CDI_NOERR = 0 + integer(c_int), public, parameter :: CDI_EEOF = -1 + integer(c_int), public, parameter :: CDI_ETMOF = -9 + integer(c_int), public, parameter :: CDI_ESYSTEM = -10 + integer(c_int), public, parameter :: CDI_EINVAL = -20 + integer(c_int), public, parameter :: CDI_EISDIR = -21 + integer(c_int), public, parameter :: CDI_EISEMPTY = -22 + integer(c_int), public, parameter :: CDI_EUFTYPE = -23 + integer(c_int), public, parameter :: CDI_ELIBNAVAIL = -24 + integer(c_int), public, parameter :: CDI_EUFSTRUCT = -25 + integer(c_int), public, parameter :: CDI_EUNC4 = -26 + integer(c_int), public, parameter :: CDI_EDIMSIZE = -27 + integer(c_int), public, parameter :: CDI_EQENF = -50 + integer(c_int), public, parameter :: CDI_EQNAVAIL = -51 + integer(c_int), public, parameter :: CDI_ELIMIT = -99 + integer(c_int), public, parameter :: CDI_FILETYPE_GRB = 1 + integer(c_int), public, parameter :: CDI_FILETYPE_GRB2 = 2 + integer(c_int), public, parameter :: CDI_FILETYPE_NC = 3 + integer(c_int), public, parameter :: CDI_FILETYPE_NC2 = 4 + integer(c_int), public, parameter :: CDI_FILETYPE_NC4 = 5 + integer(c_int), public, parameter :: CDI_FILETYPE_NC4C = 6 + integer(c_int), public, parameter :: CDI_FILETYPE_NC5 = 7 + integer(c_int), public, parameter :: CDI_FILETYPE_SRV = 8 + integer(c_int), public, parameter :: CDI_FILETYPE_EXT = 9 + integer(c_int), public, parameter :: CDI_FILETYPE_IEG = 10 + integer(c_int), public, parameter :: CDI_FILETYPE_NCZARR = 11 + integer(c_int), public, parameter :: FILETYPE_GRB = 1 + integer(c_int), public, parameter :: FILETYPE_GRB2 = 2 + integer(c_int), public, parameter :: FILETYPE_NC = 3 + integer(c_int), public, parameter :: FILETYPE_NC2 = 4 + integer(c_int), public, parameter :: FILETYPE_NC4 = 5 + integer(c_int), public, parameter :: CDI_PROTOCOL_OTHER = 0 + integer(c_int), public, parameter :: CDI_PROTOCOL_FILE = 1 + integer(c_int), public, parameter :: CDI_PROTOCOL_FDB = 2 + integer(c_int), public, parameter :: CDI_PROTOCOL_ACROSS = 3 + integer(c_int), public, parameter :: CDI_COMPRESS_NONE = 0 + integer(c_int), public, parameter :: CDI_COMPRESS_SZIP = 1 + integer(c_int), public, parameter :: CDI_COMPRESS_AEC = 2 + integer(c_int), public, parameter :: CDI_COMPRESS_ZIP = 3 + integer(c_int), public, parameter :: CDI_COMPRESS_JPEG = 4 + integer(c_int), public, parameter :: CDI_COMPRESS_FILTER = 5 + integer(c_int), public, parameter :: DATATYPE_PACK16 = 16 + integer(c_int), public, parameter :: DATATYPE_PACK24 = 24 + integer(c_int), public, parameter :: DATATYPE_FLT32 = 132 + integer(c_int), public, parameter :: DATATYPE_FLT64 = 164 + integer(c_int), public, parameter :: DATATYPE_INT32 = 232 + integer(c_int), public, parameter :: DATATYPE_INT = 251 + integer(c_int), public, parameter :: CDI_DATATYPE_PACK = 0 + integer(c_int), public, parameter :: CDI_DATATYPE_PACK1 = 1 + integer(c_int), public, parameter :: CDI_DATATYPE_PACK2 = 2 + integer(c_int), public, parameter :: CDI_DATATYPE_PACK3 = 3 + integer(c_int), public, parameter :: CDI_DATATYPE_PACK4 = 4 + integer(c_int), public, parameter :: CDI_DATATYPE_PACK5 = 5 + integer(c_int), public, parameter :: CDI_DATATYPE_PACK6 = 6 + integer(c_int), public, parameter :: CDI_DATATYPE_PACK7 = 7 + integer(c_int), public, parameter :: CDI_DATATYPE_PACK8 = 8 + integer(c_int), public, parameter :: CDI_DATATYPE_PACK9 = 9 + integer(c_int), public, parameter :: CDI_DATATYPE_PACK10 = 10 + integer(c_int), public, parameter :: CDI_DATATYPE_PACK11 = 11 + integer(c_int), public, parameter :: CDI_DATATYPE_PACK12 = 12 + integer(c_int), public, parameter :: CDI_DATATYPE_PACK13 = 13 + integer(c_int), public, parameter :: CDI_DATATYPE_PACK14 = 14 + integer(c_int), public, parameter :: CDI_DATATYPE_PACK15 = 15 + integer(c_int), public, parameter :: CDI_DATATYPE_PACK16 = 16 + integer(c_int), public, parameter :: CDI_DATATYPE_PACK17 = 17 + integer(c_int), public, parameter :: CDI_DATATYPE_PACK18 = 18 + integer(c_int), public, parameter :: CDI_DATATYPE_PACK19 = 19 + integer(c_int), public, parameter :: CDI_DATATYPE_PACK20 = 20 + integer(c_int), public, parameter :: CDI_DATATYPE_PACK21 = 21 + integer(c_int), public, parameter :: CDI_DATATYPE_PACK22 = 22 + integer(c_int), public, parameter :: CDI_DATATYPE_PACK23 = 23 + integer(c_int), public, parameter :: CDI_DATATYPE_PACK24 = 24 + integer(c_int), public, parameter :: CDI_DATATYPE_PACK25 = 25 + integer(c_int), public, parameter :: CDI_DATATYPE_PACK26 = 26 + integer(c_int), public, parameter :: CDI_DATATYPE_PACK27 = 27 + integer(c_int), public, parameter :: CDI_DATATYPE_PACK28 = 28 + integer(c_int), public, parameter :: CDI_DATATYPE_PACK29 = 29 + integer(c_int), public, parameter :: CDI_DATATYPE_PACK30 = 30 + integer(c_int), public, parameter :: CDI_DATATYPE_PACK31 = 31 + integer(c_int), public, parameter :: CDI_DATATYPE_PACK32 = 32 + integer(c_int), public, parameter :: CDI_DATATYPE_CPX32 = 64 + integer(c_int), public, parameter :: CDI_DATATYPE_CPX64 = 128 + integer(c_int), public, parameter :: CDI_DATATYPE_FLT32 = 132 + integer(c_int), public, parameter :: CDI_DATATYPE_FLT64 = 164 + integer(c_int), public, parameter :: CDI_DATATYPE_INT8 = 208 + integer(c_int), public, parameter :: CDI_DATATYPE_INT16 = 216 + integer(c_int), public, parameter :: CDI_DATATYPE_INT32 = 232 + integer(c_int), public, parameter :: CDI_DATATYPE_UINT8 = 308 + integer(c_int), public, parameter :: CDI_DATATYPE_UINT16 = 316 + integer(c_int), public, parameter :: CDI_DATATYPE_UINT32 = 332 + integer(c_int), public, parameter :: CDI_DATATYPE_INT = 251 + integer(c_int), public, parameter :: CDI_DATATYPE_FLT = 252 + integer(c_int), public, parameter :: CDI_DATATYPE_TXT = 253 + integer(c_int), public, parameter :: CDI_DATATYPE_CPX = 254 + integer(c_int), public, parameter :: CDI_DATATYPE_UCHAR = 255 + integer(c_int), public, parameter :: CDI_DATATYPE_LONG = 256 + integer(c_int), public, parameter :: CDI_DATATYPE_UINT = 257 + integer(c_int), public, parameter :: CDI_CHUNK_AUTO = 1 + integer(c_int), public, parameter :: CDI_CHUNK_GRID = 2 + integer(c_int), public, parameter :: CDI_CHUNK_LINES = 3 + integer(c_int), public, parameter :: GRID_GENERIC = 1 + integer(c_int), public, parameter :: GRID_GAUSSIAN = 2 + integer(c_int), public, parameter :: GRID_GAUSSIAN_REDUCED = 3 + integer(c_int), public, parameter :: GRID_LONLAT = 4 + integer(c_int), public, parameter :: GRID_SPECTRAL = 5 + integer(c_int), public, parameter :: GRID_FOURIER = 6 + integer(c_int), public, parameter :: GRID_GME = 7 + integer(c_int), public, parameter :: GRID_TRAJECTORY = 8 + integer(c_int), public, parameter :: GRID_UNSTRUCTURED = 9 + integer(c_int), public, parameter :: GRID_CURVILINEAR = 10 + integer(c_int), public, parameter :: GRID_PROJECTION = 12 + integer(c_int), public, parameter :: GRID_CHARXY = 13 + integer(c_int), public, parameter :: CDI_PROJ_RLL = 21 + integer(c_int), public, parameter :: CDI_PROJ_LCC = 22 + integer(c_int), public, parameter :: CDI_PROJ_LAEA = 23 + integer(c_int), public, parameter :: CDI_PROJ_SINU = 24 + integer(c_int), public, parameter :: CDI_PROJ_STERE = 25 + integer(c_int), public, parameter :: CDI_PROJ_HEALPIX = 26 + integer(c_int), public, parameter :: ZAXIS_SURFACE = 0 + integer(c_int), public, parameter :: ZAXIS_GENERIC = 1 + integer(c_int), public, parameter :: ZAXIS_HYBRID = 2 + integer(c_int), public, parameter :: ZAXIS_HYBRID_HALF = 3 + integer(c_int), public, parameter :: ZAXIS_PRESSURE = 4 + integer(c_int), public, parameter :: ZAXIS_HEIGHT = 5 + integer(c_int), public, parameter :: ZAXIS_DEPTH_BELOW_SEA = 6 + integer(c_int), public, parameter :: ZAXIS_DEPTH_BELOW_LAND = 7 + integer(c_int), public, parameter :: ZAXIS_ISENTROPIC = 8 + integer(c_int), public, parameter :: ZAXIS_TRAJECTORY = 9 + integer(c_int), public, parameter :: ZAXIS_ALTITUDE = 10 + integer(c_int), public, parameter :: ZAXIS_SIGMA = 11 + integer(c_int), public, parameter :: ZAXIS_MEANSEA = 12 + integer(c_int), public, parameter :: ZAXIS_TOA = 13 + integer(c_int), public, parameter :: ZAXIS_SEA_BOTTOM = 14 + integer(c_int), public, parameter :: ZAXIS_ATMOSPHERE = 15 + integer(c_int), public, parameter :: ZAXIS_CLOUD_BASE = 16 + integer(c_int), public, parameter :: ZAXIS_CLOUD_TOP = 17 + integer(c_int), public, parameter :: ZAXIS_ISOTHERM_ZERO = 18 + integer(c_int), public, parameter :: ZAXIS_SNOW = 19 + integer(c_int), public, parameter :: ZAXIS_LAKE_BOTTOM = 20 + integer(c_int), public, parameter :: ZAXIS_SEDIMENT_BOTTOM = 21 + integer(c_int), public, parameter :: ZAXIS_SEDIMENT_BOTTOM_TA = 22 + integer(c_int), public, parameter :: ZAXIS_SEDIMENT_BOTTOM_TW = 23 + integer(c_int), public, parameter :: ZAXIS_MIX_LAYER = 24 + integer(c_int), public, parameter :: ZAXIS_REFERENCE = 25 + integer(c_int), public, parameter :: ZAXIS_CHAR = 26 + integer(c_int), public, parameter :: ZAXIS_TROPOPAUSE = 27 + integer(c_int), public, parameter :: MAX_KV_PAIRS_MATCH = 10 + integer(c_int), public, parameter :: TIME_CONSTANT = 0 + integer(c_int), public, parameter :: TIME_VARYING = 1 + integer(c_int), public, parameter :: TIME_VARIABLE = 1 + integer(c_int), public, parameter :: TSTEP_CONSTANT = 0 + integer(c_int), public, parameter :: TSTEP_INSTANT = 1 + integer(c_int), public, parameter :: TSTEP_AVG = 2 + integer(c_int), public, parameter :: TSTEP_ACCUM = 3 + integer(c_int), public, parameter :: TSTEP_MAX = 4 + integer(c_int), public, parameter :: TSTEP_MIN = 5 + integer(c_int), public, parameter :: TSTEP_DIFF = 6 + integer(c_int), public, parameter :: TSTEP_RMS = 7 + integer(c_int), public, parameter :: TSTEP_SD = 8 + integer(c_int), public, parameter :: TSTEP_COV = 9 + integer(c_int), public, parameter :: TSTEP_RATIO = 10 + integer(c_int), public, parameter :: TSTEP_SUM = 11 + integer(c_int), public, parameter :: TSTEP_RANGE = 12 + integer(c_int), public, parameter :: TSTEP_INSTANT2 = 13 + integer(c_int), public, parameter :: TSTEP_INSTANT3 = 14 + integer(c_int), public, parameter :: TAXIS_ABSOLUTE = 1 + integer(c_int), public, parameter :: TAXIS_RELATIVE = 2 + integer(c_int), public, parameter :: TAXIS_FORECAST = 3 + integer(c_int), public, parameter :: TUNIT_SECOND = 1 + integer(c_int), public, parameter :: TUNIT_MINUTE = 2 + integer(c_int), public, parameter :: TUNIT_QUARTER = 3 + integer(c_int), public, parameter :: TUNIT_30MINUTES = 4 + integer(c_int), public, parameter :: TUNIT_HOUR = 5 + integer(c_int), public, parameter :: TUNIT_3HOURS = 6 + integer(c_int), public, parameter :: TUNIT_6HOURS = 7 + integer(c_int), public, parameter :: TUNIT_12HOURS = 8 + integer(c_int), public, parameter :: TUNIT_DAY = 9 + integer(c_int), public, parameter :: TUNIT_MONTH = 10 + integer(c_int), public, parameter :: TUNIT_YEAR = 11 + integer(c_int), public, parameter :: CALENDAR_STANDARD = 0 + integer(c_int), public, parameter :: CALENDAR_GREGORIAN = 1 + integer(c_int), public, parameter :: CALENDAR_PROLEPTIC = 2 + integer(c_int), public, parameter :: CALENDAR_360DAYS = 3 + integer(c_int), public, parameter :: CALENDAR_365DAYS = 4 + integer(c_int), public, parameter :: CALENDAR_366DAYS = 5 + integer(c_int), public, parameter :: CALENDAR_NONE = 6 + integer(c_int), public, parameter :: CDI_UUID_SIZE = 16 + + public t_CdiParam + type, bind(c) :: t_CdiParam + integer(c_int) :: discipline + integer(c_int) :: category + integer(c_int) :: number + end type t_CdiParam + + public :: t_CdiIterator + type :: t_CdiIterator + type(c_ptr) :: ptr + end type t_CdiIterator + + public :: t_CdiGribIterator + type :: t_CdiGribIterator + type(c_ptr) :: ptr + end type t_CdiGribIterator + public :: cdiReset + public :: cdiStringError + public :: cdiDebug + public :: cdiLibraryVersion + public :: cdiPrintVersion + public :: cdiHaveFiletype + public :: cdiDefMissval + public :: cdiInqMissval + public :: cdiDefGlobal + public :: namespaceNew + public :: namespaceSetActive + public :: namespaceGetActive + public :: namespaceDelete + public :: cdiParamToString + public :: cdiDecodeParam + public :: cdiEncodeParam + public :: cdiDecodeDate + public :: cdiEncodeDate + public :: cdiDecodeTime + public :: cdiEncodeTime + public :: cdiGetFiletype + public :: streamOpenRead + public :: streamOpenWrite + public :: streamOpenAppend + public :: streamClose + public :: streamSync + public :: streamDefMaxSteps + public :: streamDefNumWorker + public :: streamDefVlist + public :: streamInqVlist + public :: streamInqFiletype + public :: streamDefByteorder + public :: streamInqByteorder + public :: streamDefCompType + public :: streamInqCompType + public :: streamDefCompLevel + public :: streamInqCompLevel + public :: streamDefTimestep + public :: streamInqTimestep + public :: streamInqCurTimestepID + public :: streamFilename + public :: streamFilesuffix + public :: streamNvals + public :: streamInqNvars + public :: streamWriteVar + public :: streamWriteVarF + public :: streamReadVar + public :: streamReadVarF + public :: streamWriteVarSlice + public :: streamWriteVarSliceF + public :: streamReadVarSlice + public :: streamReadVarSliceF + public :: streamWriteVarChunk + public :: streamWriteVarChunkF + public :: streamDefRecord + public :: streamInqRecord + public :: streamWriteRecord + public :: streamWriteRecordF + public :: streamReadRecord + public :: streamReadRecordF + public :: streamCopyRecord + public :: cdiIterator_new + public :: cdiIterator_clone + public :: cdiIterator_serialize + public :: cdiIterator_deserialize + public :: cdiIterator_delete + public :: cdiIterator_nextField + public :: cdiIterator_inqStartTime + public :: cdiIterator_inqEndTime + public :: cdiIterator_inqRTime + public :: cdiIterator_inqVTime + public :: cdiIterator_inqLevelType + public :: cdiIterator_inqLevel + public :: cdiIterator_inqLevelUuid + public :: cdiIterator_inqTile + public :: cdiIterator_inqTileCount + public :: cdiIterator_inqParam + public :: cdiIterator_inqParamParts + public :: cdiIterator_inqDatatype + public :: cdiIterator_inqFiletype + public :: cdiIterator_inqTsteptype + public :: cdiIterator_inqVariableName + public :: cdiIterator_inqGridId + public :: cdiIterator_readField + public :: cdiIterator_readFieldF + public :: cdiGribIterator_clone + public :: cdiGribIterator_delete + public :: cdiGribIterator_getLong + public :: cdiGribIterator_getDouble + public :: cdiGribIterator_getLength + public :: cdiGribIterator_getString + public :: cdiGribIterator_getSize + public :: cdiGribIterator_getLongArray + public :: cdiGribIterator_getDoubleArray + public :: cdiGribIterator_inqEdition + public :: cdiGribIterator_inqLongValue + public :: cdiGribIterator_inqLongDefaultValue + public :: cdiGribIterator_inqDoubleValue + public :: cdiGribIterator_inqDoubleDefaultValue + public :: cdiGribIterator_inqStringValue + public :: vlistCreate + public :: vlistDestroy + public :: vlistDuplicate + public :: vlistCopy + public :: vlistCopyFlag + public :: vlistClearFlag + public :: vlistCat + public :: vlistMerge + public :: vlistPrint + public :: vlistNumber + public :: vlistNvars + public :: vlistNgrids + public :: vlistNzaxis + public :: vlistNsubtypes + public :: vlistDefNtsteps + public :: vlistNtsteps + public :: vlistGridsizeMax + public :: vlistGrid + public :: vlistGridIndex + public :: vlistChangeGridIndex + public :: vlistChangeGrid + public :: vlistZaxis + public :: vlistZaxisIndex + public :: vlistChangeZaxisIndex + public :: vlistChangeZaxis + public :: vlistNrecs + public :: vlistSubtype + public :: vlistSubtypeIndex + public :: vlistDefTaxis + public :: vlistInqTaxis + public :: vlistDefTable + public :: vlistInqTable + public :: vlistDefInstitut + public :: vlistInqInstitut + public :: vlistDefModel + public :: vlistInqModel + public :: vlistDefVarTiles + public :: vlistDefVar + public :: vlistChangeVarGrid + public :: vlistChangeVarZaxis + public :: vlistInqVar + public :: vlistInqVarGrid + public :: vlistInqVarZaxis + public :: vlistInqVarID + public :: vlistDefVarTimetype + public :: vlistInqVarTimetype + public :: vlistDefVarTsteptype + public :: vlistInqVarTsteptype + public :: vlistDefVarCompType + public :: vlistInqVarCompType + public :: vlistDefVarCompLevel + public :: vlistInqVarCompLevel + public :: vlistDefVarParam + public :: vlistInqVarParam + public :: vlistDefVarCode + public :: vlistInqVarCode + public :: vlistDefVarDatatype + public :: vlistInqVarDatatype + public :: vlistDefVarXYZ + public :: vlistInqVarXYZ + public :: vlistDefVarNSB + public :: vlistInqVarNSB + public :: vlistInqVarNumber + public :: vlistDefVarInstitut + public :: vlistInqVarInstitut + public :: vlistDefVarModel + public :: vlistInqVarModel + public :: vlistDefVarTable + public :: vlistInqVarTable + public :: vlistDefVarName + public :: vlistInqVarName + public :: vlistCopyVarName + public :: vlistDefVarStdname + public :: vlistInqVarStdname + public :: vlistDefVarLongname + public :: vlistInqVarLongname + public :: vlistDefVarUnits + public :: vlistInqVarUnits + public :: vlistDefVarMissval + public :: vlistInqVarMissval + public :: vlistInqVarSize + public :: vlistDefIndex + public :: vlistInqIndex + public :: vlistDefFlag + public :: vlistInqFlag + public :: vlistFindVar + public :: vlistFindLevel + public :: vlistMergedVar + public :: vlistMergedLevel + public :: cdiClearAdditionalKeys + public :: cdiDefAdditionalKey + public :: vlistDefVarIntKey + public :: vlistDefVarDblKey + public :: vlistHasVarKey + public :: vlistInqVarDblKey + public :: vlistInqVarIntKey + public :: cdiInqNatts + public :: cdiInqAtt + public :: cdiInqAttLen + public :: cdiInqAttType + public :: cdiDelAtt + public :: cdiCopyAtts + public :: cdiDefAttInt + public :: cdiDefAttFlt + public :: cdiDefAttTxt + public :: cdiInqAttInt + public :: cdiInqAttFlt + public :: cdiInqAttTxt + public :: gridName + public :: gridNamePtr + public :: gridCompress + public :: gridDefMaskGME + public :: gridInqMaskGME + public :: gridDefMask + public :: gridInqMask + public :: gridCreate + public :: gridDestroy + public :: gridDuplicate + public :: gridDefProj + public :: gridInqProj + public :: gridInqProjType + public :: gridInqType + public :: gridInqSize + public :: gridDefXsize + public :: gridInqXsize + public :: gridDefYsize + public :: gridInqYsize + public :: gridDefNP + public :: gridInqNP + public :: gridDefXvals + public :: gridInqXvals + public :: gridInqXvalsPart + public :: gridInqXvalsPtr + public :: gridInqXIsc + public :: gridDefYvals + public :: gridInqYvals + public :: gridInqYvalsPart + public :: gridInqYvalsPtr + public :: gridInqYIsc + integer(c_int), public, parameter :: CDI_KEY_NAME = 942 + integer(c_int), public, parameter :: CDI_KEY_LONGNAME = 943 + integer(c_int), public, parameter :: CDI_KEY_STDNAME = 944 + integer(c_int), public, parameter :: CDI_KEY_UNITS = 945 + integer(c_int), public, parameter :: CDI_KEY_DATATYPE = 946 + integer(c_int), public, parameter :: CDI_KEY_REFERENCEURI = 947 + integer(c_int), public, parameter :: CDI_KEY_CHUNKS = 948 + integer(c_int), public, parameter :: CDI_KEY_NUMBEROFGRIDUSED = 961 + integer(c_int), public, parameter :: CDI_KEY_NUMBEROFGRIDINREFERENCE = 962 + integer(c_int), public, parameter :: CDI_KEY_NUMBEROFVGRIDUSED = 963 + integer(c_int), public, parameter :: CDI_KEY_NLEV = 964 + integer(c_int), public, parameter :: CDI_KEY_CHUNKTYPE = 965 + integer(c_int), public, parameter :: CDI_KEY_CHUNKSIZE = 966 + integer(c_int), public, parameter :: CDI_KEY_MISSVAL = 701 + integer(c_int), public, parameter :: CDI_KEY_ADDOFFSET = 702 + integer(c_int), public, parameter :: CDI_KEY_SCALEFACTOR = 703 + integer(c_int), public, parameter :: CDI_KEY_UUID = 960 + integer(c_int), public, parameter :: CDI_KEY_DIMNAME = 941 + integer(c_int), public, parameter :: CDI_KEY_PSNAME = 950 + integer(c_int), public, parameter :: CDI_KEY_P0NAME = 951 + integer(c_int), public, parameter :: CDI_KEY_P0VALUE = 952 + integer(c_int), public, parameter :: CDI_KEY_TABLESVERSION = 801 + integer(c_int), public, parameter :: CDI_KEY_LOCALTABLESVERSION = 802 + integer(c_int), public, parameter :: CDI_KEY_TYPEOFGENERATINGPROCESS = 803 + integer(c_int), public, parameter :: CDI_KEY_PRODUCTDEFINITIONTEMPLATE = 804 + integer(c_int), public, parameter :: CDI_KEY_TYPEOFPROCESSEDDATA = 805 + integer(c_int), public, parameter :: CDI_KEY_SHAPEOFTHEEARTH = 806 + integer(c_int), public, parameter :: CDI_KEY_BACKGROUNDPROCESS = 807 + integer(c_int), public, parameter :: CDI_KEY_TYPEOFENSEMBLEFORECAST = 808 + integer(c_int), public, parameter :: CDI_KEY_NUMBEROFFORECASTSINENSEMBLE =& + & 809 + integer(c_int), public, parameter :: CDI_KEY_PERTURBATIONNUMBER = 810 + integer(c_int), public, parameter :: CDI_KEY_CENTRE = 811 + integer(c_int), public, parameter :: CDI_KEY_SUBCENTRE = 812 + integer(c_int), public, parameter :: CDI_KEY_MPIMTYPE = 813 + integer(c_int), public, parameter :: CDI_KEY_MPIMCLASS = 814 + integer(c_int), public, parameter :: CDI_KEY_MPIMUSER = 815 + integer(c_int), public, parameter :: CDI_KEY_REVSTATUS = 816 + integer(c_int), public, parameter :: CDI_KEY_REVNUMBER = 817 + integer(c_int), public, parameter :: CDI_KEY_GRIB2LOCALSECTIONNUMBER = 818 + integer(c_int), public, parameter :: CDI_KEY_SECTION2PADDINGLENGTH = 819 + integer(c_int), public, parameter :: CDI_KEY_SECTION2PADDING = 820 + integer(c_int), public, parameter :: CDI_KEY_CONSTITUENTTYPE = 821 + integer(c_int), public, parameter :: CDI_KEY_TYPEOFTIMEINCREMENT = 822 + integer(c_int), public, parameter :: CDI_KEY_TYPEOFFIRSTFIXEDSURFACE = 823 + integer(c_int), public, parameter :: CDI_KEY_TYPEOFSECONDFIXEDSURFACE = 824 + integer(c_int), public, parameter :: CDI_KEY_UVRELATIVETOGRID = 825 + integer(c_int), public, parameter :: CDI_KEY_SCANNINGMODE = 826 + integer(c_int), public, parameter :: CDI_KEY_VDIMNAME = 920 + integer(c_int), public, parameter :: CDI_KEY_GRIDMAP_VARTYPE = 921 + integer(c_int), public, parameter :: CDI_KEY_GRIDMAP_VARNAME = 922 + integer(c_int), public, parameter :: CDI_KEY_GRIDMAP_NAME = 923 + public :: cdiDefKeyInt + public :: cdiInqKeyInt + public :: cdiDefKeyFloat + public :: cdiInqKeyFloat + public :: cdiDefKeyBytes + public :: cdiInqKeyBytes + public :: cdiDefKeyString + public :: cdiInqKeyString + public :: cdiInqKeyLen + public :: cdiCopyKeys + public :: cdiCopyKey + public :: cdiDeleteKey + public :: gridDefXname + public :: gridInqXname + public :: gridDefXlongname + public :: gridInqXlongname + public :: gridDefXunits + public :: gridInqXunits + public :: gridDefYname + public :: gridInqYname + public :: gridDefYlongname + public :: gridInqYlongname + public :: gridDefYunits + public :: gridInqYunits + public :: gridDefDatatype + public :: gridInqDatatype + public :: gridInqXval + public :: gridInqYval + public :: gridInqXinc + public :: gridInqYinc + public :: gridIsCircular + public :: gridInqTrunc + public :: gridDefTrunc + public :: gridDefNumber + public :: gridInqNumber + public :: gridDefPosition + public :: gridInqPosition + public :: gridDefReference + public :: gridInqReference + public :: gridDefUUID + public :: gridInqUUID + public :: gridDefParamRLL + public :: gridInqParamRLL + public :: gridDefParamGME + public :: gridInqParamGME + public :: gridDefArea + public :: gridInqArea + public :: gridHasArea + public :: gridDefNvertex + public :: gridInqNvertex + public :: gridDefXbounds + public :: gridInqXbounds + public :: gridInqXboundsPart + public :: gridInqXboundsPtr + public :: gridDefYbounds + public :: gridInqYbounds + public :: gridInqYboundsPart + public :: gridInqYboundsPtr + public :: gridDefReducedPoints + public :: gridInqReducedPoints + public :: gridChangeType + public :: gridDefComplexPacking + public :: gridInqComplexPacking + public :: zaxisName + public :: zaxisNamePtr + public :: zaxisCreate + public :: zaxisDestroy + public :: zaxisInqType + public :: zaxisInqSize + public :: zaxisDuplicate + public :: zaxisDefLevels + public :: zaxisInqLevels + public :: zaxisInqCLen + public :: zaxisDefLevel + public :: zaxisInqLevel + public :: zaxisDefNlevRef + public :: zaxisInqNlevRef + public :: zaxisDefNumber + public :: zaxisInqNumber + public :: zaxisDefUUID + public :: zaxisInqUUID + public :: zaxisDefName + public :: zaxisInqName + public :: zaxisDefLongname + public :: zaxisInqLongname + public :: zaxisDefUnits + public :: zaxisInqUnits + public :: zaxisInqStdname + public :: zaxisDefDatatype + public :: zaxisInqDatatype + public :: zaxisDefPositive + public :: zaxisInqPositive + public :: zaxisDefScalar + public :: zaxisInqScalar + public :: zaxisDefVct + public :: zaxisInqVct + public :: zaxisInqVctSize + public :: zaxisInqVctPtr + public :: zaxisDefLbounds + public :: zaxisInqLbounds + public :: zaxisInqLbound + public :: zaxisDefUbounds + public :: zaxisInqUbounds + public :: zaxisInqUbound + public :: zaxisDefWeights + public :: zaxisInqWeights + public :: zaxisChangeType + public :: taxisCreate + public :: taxisDestroy + public :: taxisDuplicate + public :: taxisCopyTimestep + public :: taxisDefType + public :: taxisInqType + public :: taxisDefVdate + public :: taxisDefVtime + public :: taxisInqVdate + public :: taxisInqVtime + public :: taxisDefRdate + public :: taxisDefRtime + public :: taxisInqRdate + public :: taxisInqRtime + public :: taxisHasBounds + public :: taxisWithBounds + public :: taxisDeleteBounds + public :: taxisDefVdateBounds + public :: taxisDefVtimeBounds + public :: taxisInqVdateBounds + public :: taxisInqVtimeBounds + public :: taxisDefCalendar + public :: taxisInqCalendar + public :: taxisDefTunit + public :: taxisInqTunit + public :: taxisDefForecastTunit + public :: taxisInqForecastTunit + public :: taxisDefForecastPeriod + public :: taxisInqForecastPeriod + public :: taxisDefNumavg + public :: taxisInqNumavg + public :: taxisNamePtr + public :: tunitNamePtr + public :: institutDef + public :: institutInq + public :: institutInqNumber + public :: institutInqCenter + public :: institutInqSubcenter + public :: institutInqNamePtr + public :: institutInqLongnamePtr + public :: modelDef + public :: modelInq + public :: modelInqInstitut + public :: modelInqGribID + public :: modelInqNamePtr + public :: tableWrite + public :: tableRead + public :: tableDef + public :: tableInqNamePtr + public :: tableInq + public :: tableInqNumber + public :: tableInqNum + public :: tableInqModel + public :: tableInqEntry + public :: subtypeCreate + public :: subtypePrint + public :: subtypeCompare + public :: subtypeInqSize + public :: subtypeInqActiveIndex + public :: subtypeDefActiveIndex + public :: subtypeInqTile + public :: subtypeInqAttribute + public :: vlistInqVarSubtype + public :: gribapiLibraryVersion + public :: zaxisDefLtype + public :: vlistInqVarTypeOfGeneratingProcess + public :: vlistDefVarTypeOfGeneratingProcess + public :: vlistDefVarProductDefinitionTemplate + public :: date_to_julday + public :: julday_to_date + public :: time_to_sec + public :: sec_to_time + integer(c_int), public, parameter :: HAVE_CDI_PROJ_FUNCS = 1 + + interface + subroutine cdiReset() bind(c, name = 'cdiReset') + end subroutine cdiReset + + subroutine cdiDebug(debug_dummy) bind(c, name = 'cdiDebug') + import c_int + integer(c_int), value :: debug_dummy + end subroutine cdiDebug + + subroutine cdiPrintVersion() bind(c, name = 'cdiPrintVersion') + end subroutine cdiPrintVersion + + function cdiHaveFiletype(filetype_dummy) bind(c, name = 'cdiHaveFiletype')& + & result(f_result) + import c_int + integer(c_int), value :: filetype_dummy + integer(c_int) :: f_result + end function cdiHaveFiletype + + subroutine cdiDefMissval(missval_dummy) bind(c, name = 'cdiDefMissval') + import c_double + real(c_double), value :: missval_dummy + end subroutine cdiDefMissval + + function cdiInqMissval() bind(c, name = 'cdiInqMissval') result(f_result) + import c_double + real(c_double) :: f_result + end function cdiInqMissval + + function namespaceNew() bind(c, name = 'namespaceNew') result(f_result) + import c_int + integer(c_int) :: f_result + end function namespaceNew + + subroutine namespaceSetActive(namespaceID_dummy) bind(c, name =& + & 'namespaceSetActive') + import c_int + integer(c_int), value :: namespaceID_dummy + end subroutine namespaceSetActive + + function namespaceGetActive() bind(c, name = 'namespaceGetActive')& + & result(f_result) + import c_int + integer(c_int) :: f_result + end function namespaceGetActive + + subroutine namespaceDelete(namespaceID_dummy) bind(c, name =& + & 'namespaceDelete') + import c_int + integer(c_int), value :: namespaceID_dummy + end subroutine namespaceDelete + + subroutine cdiDecodeParam(param_dummy, pnum_dummy, pcat_dummy, pdis_dummy)& + & bind(c, name = 'cdiDecodeParam') + import c_int + integer(c_int), value :: param_dummy + integer(c_int), intent(inout) :: pnum_dummy + integer(c_int), intent(inout) :: pcat_dummy + integer(c_int), intent(inout) :: pdis_dummy + end subroutine cdiDecodeParam + + function cdiEncodeParam(pnum_dummy, pcat_dummy, pdis_dummy) bind(c, name =& + & 'cdiEncodeParam') result(f_result) + import c_int + integer(c_int), value :: pnum_dummy + integer(c_int), value :: pcat_dummy + integer(c_int), value :: pdis_dummy + integer(c_int) :: f_result + end function cdiEncodeParam + + subroutine cdiDecodeDate(date_dummy, year_dummy, month_dummy, day_dummy)& + & bind(c, name = 'cdiDecodeDate') + import c_int + integer(c_int), value :: date_dummy + integer(c_int), intent(inout) :: year_dummy + integer(c_int), intent(inout) :: month_dummy + integer(c_int), intent(inout) :: day_dummy + end subroutine cdiDecodeDate + + function cdiEncodeDate(year_dummy, month_dummy, day_dummy) bind(c, name =& + & 'cdiEncodeDate') result(f_result) + import c_int + integer(c_int), value :: year_dummy + integer(c_int), value :: month_dummy + integer(c_int), value :: day_dummy + integer(c_int) :: f_result + end function cdiEncodeDate + + subroutine cdiDecodeTime(time_dummy, hour_dummy, minute_dummy,& + & second_dummy) bind(c, name = 'cdiDecodeTime') + import c_int + integer(c_int), value :: time_dummy + integer(c_int), intent(inout) :: hour_dummy + integer(c_int), intent(inout) :: minute_dummy + integer(c_int), intent(inout) :: second_dummy + end subroutine cdiDecodeTime + + function cdiEncodeTime(hour_dummy, minute_dummy, second_dummy) bind(c, name& + & = 'cdiEncodeTime') result(f_result) + import c_int + integer(c_int), value :: hour_dummy + integer(c_int), value :: minute_dummy + integer(c_int), value :: second_dummy + integer(c_int) :: f_result + end function cdiEncodeTime + + subroutine streamClose(streamID_dummy) bind(c, name = 'streamClose') + import c_int + integer(c_int), value :: streamID_dummy + end subroutine streamClose + + subroutine streamSync(streamID_dummy) bind(c, name = 'streamSync') + import c_int + integer(c_int), value :: streamID_dummy + end subroutine streamSync + + subroutine streamDefMaxSteps(streamID_dummy, maxSteps_dummy) bind(c, name =& + & 'streamDefMaxSteps') + import c_int + integer(c_int), value :: streamID_dummy + integer(c_int), value :: maxSteps_dummy + end subroutine streamDefMaxSteps + + subroutine streamDefNumWorker(streamID_dummy, numWorker_dummy) bind(c, name& + & = 'streamDefNumWorker') + import c_int + integer(c_int), value :: streamID_dummy + integer(c_int), value :: numWorker_dummy + end subroutine streamDefNumWorker + + subroutine streamDefVlist(streamID_dummy, vlistID_dummy) bind(c, name =& + & 'streamDefVlist') + import c_int + integer(c_int), value :: streamID_dummy + integer(c_int), value :: vlistID_dummy + end subroutine streamDefVlist + + function streamInqVlist(streamID_dummy) bind(c, name = 'streamInqVlist')& + & result(f_result) + import c_int + integer(c_int), value :: streamID_dummy + integer(c_int) :: f_result + end function streamInqVlist + + function streamInqFiletype(streamID_dummy) bind(c, name =& + & 'streamInqFiletype') result(f_result) + import c_int + integer(c_int), value :: streamID_dummy + integer(c_int) :: f_result + end function streamInqFiletype + + subroutine streamDefByteorder(streamID_dummy, byteorder_dummy) bind(c, name& + & = 'streamDefByteorder') + import c_int + integer(c_int), value :: streamID_dummy + integer(c_int), value :: byteorder_dummy + end subroutine streamDefByteorder + + function streamInqByteorder(streamID_dummy) bind(c, name =& + & 'streamInqByteorder') result(f_result) + import c_int + integer(c_int), value :: streamID_dummy + integer(c_int) :: f_result + end function streamInqByteorder + + subroutine streamDefCompType(streamID_dummy, comptype_dummy) bind(c, name =& + & 'streamDefCompType') + import c_int + integer(c_int), value :: streamID_dummy + integer(c_int), value :: comptype_dummy + end subroutine streamDefCompType + + function streamInqCompType(streamID_dummy) bind(c, name =& + & 'streamInqCompType') result(f_result) + import c_int + integer(c_int), value :: streamID_dummy + integer(c_int) :: f_result + end function streamInqCompType + + subroutine streamDefCompLevel(streamID_dummy, complevel_dummy) bind(c, name& + & = 'streamDefCompLevel') + import c_int + integer(c_int), value :: streamID_dummy + integer(c_int), value :: complevel_dummy + end subroutine streamDefCompLevel + + function streamInqCompLevel(streamID_dummy) bind(c, name =& + & 'streamInqCompLevel') result(f_result) + import c_int + integer(c_int), value :: streamID_dummy + integer(c_int) :: f_result + end function streamInqCompLevel + + function streamDefTimestep(streamID_dummy, tsID_dummy) bind(c, name =& + & 'streamDefTimestep') result(f_result) + import c_int + integer(c_int), value :: streamID_dummy + integer(c_int), value :: tsID_dummy + integer(c_int) :: f_result + end function streamDefTimestep + + function streamInqTimestep(streamID_dummy, tsID_dummy) bind(c, name =& + & 'streamInqTimestep') result(f_result) + import c_int + integer(c_int), value :: streamID_dummy + integer(c_int), value :: tsID_dummy + integer(c_int) :: f_result + end function streamInqTimestep + + function streamInqCurTimestepID(streamID_dummy) bind(c, name =& + & 'streamInqCurTimestepID') result(f_result) + import c_int + integer(c_int), value :: streamID_dummy + integer(c_int) :: f_result + end function streamInqCurTimestepID + + function streamNvals(streamID_dummy) bind(c, name = 'streamNvals')& + & result(f_result) + import c_int + integer(c_int), value :: streamID_dummy + integer(c_int) :: f_result + end function streamNvals + + function streamInqNvars(streamID_dummy) bind(c, name = 'streamInqNvars')& + & result(f_result) + import c_int + integer(c_int), value :: streamID_dummy + integer(c_int) :: f_result + end function streamInqNvars + + subroutine streamWriteVar(streamID_dummy, varID_dummy, data_dummy,& + & nmiss_dummy) bind(c, name = 'streamWriteVar') + import c_double, c_int + integer(c_int), value :: streamID_dummy + integer(c_int), value :: varID_dummy + real(c_double), intent(in) :: data_dummy(*) + integer(c_int), value :: nmiss_dummy + end subroutine streamWriteVar + + subroutine streamWriteVarF(streamID_dummy, varID_dummy, data_dummy,& + & nmiss_dummy) bind(c, name = 'streamWriteVarF') + import c_float, c_int + integer(c_int), value :: streamID_dummy + integer(c_int), value :: varID_dummy + real(c_float), intent(in) :: data_dummy(*) + integer(c_int), value :: nmiss_dummy + end subroutine streamWriteVarF + + subroutine streamReadVar(streamID_dummy, varID_dummy, data_dummy,& + & nmiss_dummy) bind(c, name = 'streamReadVar') + import c_double, c_int + integer(c_int), value :: streamID_dummy + integer(c_int), value :: varID_dummy + real(c_double), intent(inout) :: data_dummy(*) + integer(c_int), intent(inout) :: nmiss_dummy + end subroutine streamReadVar + + subroutine streamReadVarF(streamID_dummy, varID_dummy, data_dummy,& + & nmiss_dummy) bind(c, name = 'streamReadVarF') + import c_float, c_int + integer(c_int), value :: streamID_dummy + integer(c_int), value :: varID_dummy + real(c_float), intent(inout) :: data_dummy(*) + integer(c_int), intent(inout) :: nmiss_dummy + end subroutine streamReadVarF + + subroutine streamWriteVarSlice(streamID_dummy, varID_dummy, levelID_dummy,& + & data_dummy, nmiss_dummy) bind(c, name = 'streamWriteVarSlice') + import c_double, c_int + integer(c_int), value :: streamID_dummy + integer(c_int), value :: varID_dummy + integer(c_int), value :: levelID_dummy + real(c_double), intent(in) :: data_dummy(*) + integer(c_int), value :: nmiss_dummy + end subroutine streamWriteVarSlice + + subroutine streamWriteVarSliceF(streamID_dummy, varID_dummy, levelID_dummy,& + & data_dummy, nmiss_dummy) bind(c, name = 'streamWriteVarSliceF') + import c_float, c_int + integer(c_int), value :: streamID_dummy + integer(c_int), value :: varID_dummy + integer(c_int), value :: levelID_dummy + real(c_float), intent(in) :: data_dummy(*) + integer(c_int), value :: nmiss_dummy + end subroutine streamWriteVarSliceF + + subroutine streamReadVarSlice(streamID_dummy, varID_dummy, levelID_dummy,& + & data_dummy, nmiss_dummy) bind(c, name = 'streamReadVarSlice') + import c_double, c_int + integer(c_int), value :: streamID_dummy + integer(c_int), value :: varID_dummy + integer(c_int), value :: levelID_dummy + real(c_double), intent(inout) :: data_dummy(*) + integer(c_int), intent(inout) :: nmiss_dummy + end subroutine streamReadVarSlice + + subroutine streamReadVarSliceF(streamID_dummy, varID_dummy, levelID_dummy,& + & data_dummy, nmiss_dummy) bind(c, name = 'streamReadVarSliceF') + import c_float, c_int + integer(c_int), value :: streamID_dummy + integer(c_int), value :: varID_dummy + integer(c_int), value :: levelID_dummy + real(c_float), intent(inout) :: data_dummy(*) + integer(c_int), intent(inout) :: nmiss_dummy + end subroutine streamReadVarSliceF + + subroutine streamWriteVarChunk(streamID_dummy, varID_dummy, rect_dummy,& + & data_dummy, nmiss_dummy) bind(c, name = 'streamWriteVarChunk') + import c_double, c_int + integer(c_int), value :: streamID_dummy + integer(c_int), value :: varID_dummy + integer(c_int), intent(in) :: rect_dummy(2, *) + real(c_double), intent(in) :: data_dummy(*) + integer(c_int), value :: nmiss_dummy + end subroutine streamWriteVarChunk + + subroutine streamWriteVarChunkF(streamID_dummy, varID_dummy, rect_dummy,& + & data_dummy, nmiss_dummy) bind(c, name = 'streamWriteVarChunkF') + import c_float, c_int + integer(c_int), value :: streamID_dummy + integer(c_int), value :: varID_dummy + integer(c_int), intent(in) :: rect_dummy(2, *) + real(c_float), intent(in) :: data_dummy(*) + integer(c_int), value :: nmiss_dummy + end subroutine streamWriteVarChunkF + + subroutine streamDefRecord(streamID_dummy, varID_dummy, levelID_dummy)& + & bind(c, name = 'streamDefRecord') + import c_int + integer(c_int), value :: streamID_dummy + integer(c_int), value :: varID_dummy + integer(c_int), value :: levelID_dummy + end subroutine streamDefRecord + + subroutine streamInqRecord(streamID_dummy, varID_dummy, levelID_dummy)& + & bind(c, name = 'streamInqRecord') + import c_int + integer(c_int), value :: streamID_dummy + integer(c_int), intent(inout) :: varID_dummy + integer(c_int), intent(inout) :: levelID_dummy + end subroutine streamInqRecord + + subroutine streamWriteRecord(streamID_dummy, data_dummy, nmiss_dummy)& + & bind(c, name = 'streamWriteRecord') + import c_double, c_int + integer(c_int), value :: streamID_dummy + real(c_double), intent(in) :: data_dummy(*) + integer(c_int), value :: nmiss_dummy + end subroutine streamWriteRecord + + subroutine streamWriteRecordF(streamID_dummy, data_dummy, nmiss_dummy)& + & bind(c, name = 'streamWriteRecordF') + import c_float, c_int + integer(c_int), value :: streamID_dummy + real(c_float), intent(in) :: data_dummy(*) + integer(c_int), value :: nmiss_dummy + end subroutine streamWriteRecordF + + subroutine streamReadRecord(streamID_dummy, data_dummy, nmiss_dummy)& + & bind(c, name = 'streamReadRecord') + import c_double, c_int + integer(c_int), value :: streamID_dummy + real(c_double), intent(inout) :: data_dummy(*) + integer(c_int), intent(inout) :: nmiss_dummy + end subroutine streamReadRecord + + subroutine streamReadRecordF(streamID_dummy, data_dummy, nmiss_dummy)& + & bind(c, name = 'streamReadRecordF') + import c_float, c_int + integer(c_int), value :: streamID_dummy + real(c_float), intent(inout) :: data_dummy(*) + integer(c_int), intent(inout) :: nmiss_dummy + end subroutine streamReadRecordF + + subroutine streamCopyRecord(streamIDdest_dummy, streamIDsrc_dummy) bind(c,& + & name = 'streamCopyRecord') + import c_int + integer(c_int), value :: streamIDdest_dummy + integer(c_int), value :: streamIDsrc_dummy + end subroutine streamCopyRecord + + function vlistCreate() bind(c, name = 'vlistCreate') result(f_result) + import c_int + integer(c_int) :: f_result + end function vlistCreate + + subroutine vlistDestroy(vlistID_dummy) bind(c, name = 'vlistDestroy') + import c_int + integer(c_int), value :: vlistID_dummy + end subroutine vlistDestroy + + function vlistDuplicate(vlistID_dummy) bind(c, name = 'vlistDuplicate')& + & result(f_result) + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int) :: f_result + end function vlistDuplicate + + subroutine vlistCopy(vlistID2_dummy, vlistID1_dummy) bind(c, name =& + & 'vlistCopy') + import c_int + integer(c_int), value :: vlistID2_dummy + integer(c_int), value :: vlistID1_dummy + end subroutine vlistCopy + + subroutine vlistCopyFlag(vlistID2_dummy, vlistID1_dummy) bind(c, name =& + & 'vlistCopyFlag') + import c_int + integer(c_int), value :: vlistID2_dummy + integer(c_int), value :: vlistID1_dummy + end subroutine vlistCopyFlag + + subroutine vlistClearFlag(vlistID_dummy) bind(c, name = 'vlistClearFlag') + import c_int + integer(c_int), value :: vlistID_dummy + end subroutine vlistClearFlag + + subroutine vlistCat(vlistID2_dummy, vlistID1_dummy) bind(c, name =& + & 'vlistCat') + import c_int + integer(c_int), value :: vlistID2_dummy + integer(c_int), value :: vlistID1_dummy + end subroutine vlistCat + + subroutine vlistMerge(vlistID2_dummy, vlistID1_dummy) bind(c, name =& + & 'vlistMerge') + import c_int + integer(c_int), value :: vlistID2_dummy + integer(c_int), value :: vlistID1_dummy + end subroutine vlistMerge + + subroutine vlistPrint(vlistID_dummy) bind(c, name = 'vlistPrint') + import c_int + integer(c_int), value :: vlistID_dummy + end subroutine vlistPrint + + function vlistNumber(vlistID_dummy) bind(c, name = 'vlistNumber')& + & result(f_result) + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int) :: f_result + end function vlistNumber + + function vlistNvars(vlistID_dummy) bind(c, name = 'vlistNvars')& + & result(f_result) + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int) :: f_result + end function vlistNvars + + function vlistNgrids(vlistID_dummy) bind(c, name = 'vlistNgrids')& + & result(f_result) + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int) :: f_result + end function vlistNgrids + + function vlistNzaxis(vlistID_dummy) bind(c, name = 'vlistNzaxis')& + & result(f_result) + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int) :: f_result + end function vlistNzaxis + + function vlistNsubtypes(vlistID_dummy) bind(c, name = 'vlistNsubtypes')& + & result(f_result) + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int) :: f_result + end function vlistNsubtypes + + subroutine vlistDefNtsteps(vlistID_dummy, nts_dummy) bind(c, name =& + & 'vlistDefNtsteps') + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: nts_dummy + end subroutine vlistDefNtsteps + + function vlistNtsteps(vlistID_dummy) bind(c, name = 'vlistNtsteps')& + & result(f_result) + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int) :: f_result + end function vlistNtsteps + + function vlistGridsizeMax(vlistID_dummy) bind(c, name = 'vlistGridsizeMax')& + & result(f_result) + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int) :: f_result + end function vlistGridsizeMax + + function vlistGrid(vlistID_dummy, index_dummy) bind(c, name = 'vlistGrid')& + & result(f_result) + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: index_dummy + integer(c_int) :: f_result + end function vlistGrid + + function vlistGridIndex(vlistID_dummy, gridID_dummy) bind(c, name =& + & 'vlistGridIndex') result(f_result) + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: gridID_dummy + integer(c_int) :: f_result + end function vlistGridIndex + + subroutine vlistChangeGridIndex(vlistID_dummy, index_dummy, gridID_dummy)& + & bind(c, name = 'vlistChangeGridIndex') + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: index_dummy + integer(c_int), value :: gridID_dummy + end subroutine vlistChangeGridIndex + + subroutine vlistChangeGrid(vlistID_dummy, gridID1_dummy, gridID2_dummy)& + & bind(c, name = 'vlistChangeGrid') + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: gridID1_dummy + integer(c_int), value :: gridID2_dummy + end subroutine vlistChangeGrid + + function vlistZaxis(vlistID_dummy, index_dummy) bind(c, name =& + & 'vlistZaxis') result(f_result) + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: index_dummy + integer(c_int) :: f_result + end function vlistZaxis + + function vlistZaxisIndex(vlistID_dummy, zaxisID_dummy) bind(c, name =& + & 'vlistZaxisIndex') result(f_result) + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: zaxisID_dummy + integer(c_int) :: f_result + end function vlistZaxisIndex + + subroutine vlistChangeZaxisIndex(vlistID_dummy, index_dummy, zaxisID_dummy)& + & bind(c, name = 'vlistChangeZaxisIndex') + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: index_dummy + integer(c_int), value :: zaxisID_dummy + end subroutine vlistChangeZaxisIndex + + subroutine vlistChangeZaxis(vlistID_dummy, zaxisID1_dummy, zaxisID2_dummy)& + & bind(c, name = 'vlistChangeZaxis') + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: zaxisID1_dummy + integer(c_int), value :: zaxisID2_dummy + end subroutine vlistChangeZaxis + + function vlistNrecs(vlistID_dummy) bind(c, name = 'vlistNrecs')& + & result(f_result) + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int) :: f_result + end function vlistNrecs + + function vlistSubtype(vlistID_dummy, index_dummy) bind(c, name =& + & 'vlistSubtype') result(f_result) + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: index_dummy + integer(c_int) :: f_result + end function vlistSubtype + + function vlistSubtypeIndex(vlistID_dummy, subtypeID_dummy) bind(c, name =& + & 'vlistSubtypeIndex') result(f_result) + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: subtypeID_dummy + integer(c_int) :: f_result + end function vlistSubtypeIndex + + subroutine vlistDefTaxis(vlistID_dummy, taxisID_dummy) bind(c, name =& + & 'vlistDefTaxis') + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: taxisID_dummy + end subroutine vlistDefTaxis + + function vlistInqTaxis(vlistID_dummy) bind(c, name = 'vlistInqTaxis')& + & result(f_result) + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int) :: f_result + end function vlistInqTaxis + + subroutine vlistDefTable(vlistID_dummy, tableID_dummy) bind(c, name =& + & 'vlistDefTable') + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: tableID_dummy + end subroutine vlistDefTable + + function vlistInqTable(vlistID_dummy) bind(c, name = 'vlistInqTable')& + & result(f_result) + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int) :: f_result + end function vlistInqTable + + subroutine vlistDefInstitut(vlistID_dummy, instID_dummy) bind(c, name =& + & 'vlistDefInstitut') + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: instID_dummy + end subroutine vlistDefInstitut + + function vlistInqInstitut(vlistID_dummy) bind(c, name = 'vlistInqInstitut')& + & result(f_result) + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int) :: f_result + end function vlistInqInstitut + + subroutine vlistDefModel(vlistID_dummy, modelID_dummy) bind(c, name =& + & 'vlistDefModel') + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: modelID_dummy + end subroutine vlistDefModel + + function vlistInqModel(vlistID_dummy) bind(c, name = 'vlistInqModel')& + & result(f_result) + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int) :: f_result + end function vlistInqModel + + function vlistDefVarTiles(vlistID_dummy, gridID_dummy, zaxisID_dummy,& + & timetype_dummy, tilesetID_dummy) bind(c, name = 'vlistDefVarTiles')& + & result(f_result) + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: gridID_dummy + integer(c_int), value :: zaxisID_dummy + integer(c_int), value :: timetype_dummy + integer(c_int), value :: tilesetID_dummy + integer(c_int) :: f_result + end function vlistDefVarTiles + + function vlistDefVar(vlistID_dummy, gridID_dummy, zaxisID_dummy,& + & timetype_dummy) bind(c, name = 'vlistDefVar') result(f_result) + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: gridID_dummy + integer(c_int), value :: zaxisID_dummy + integer(c_int), value :: timetype_dummy + integer(c_int) :: f_result + end function vlistDefVar + + subroutine vlistChangeVarGrid(vlistID_dummy, varID_dummy, gridID_dummy)& + & bind(c, name = 'vlistChangeVarGrid') + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + integer(c_int), value :: gridID_dummy + end subroutine vlistChangeVarGrid + + subroutine vlistChangeVarZaxis(vlistID_dummy, varID_dummy, zaxisID_dummy)& + & bind(c, name = 'vlistChangeVarZaxis') + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + integer(c_int), value :: zaxisID_dummy + end subroutine vlistChangeVarZaxis + + subroutine vlistInqVar(vlistID_dummy, varID_dummy, gridID_dummy,& + & zaxisID_dummy, timetype_dummy) bind(c, name = 'vlistInqVar') + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + integer(c_int), intent(inout) :: gridID_dummy + integer(c_int), intent(inout) :: zaxisID_dummy + integer(c_int), intent(inout) :: timetype_dummy + end subroutine vlistInqVar + + function vlistInqVarGrid(vlistID_dummy, varID_dummy) bind(c, name =& + & 'vlistInqVarGrid') result(f_result) + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + integer(c_int) :: f_result + end function vlistInqVarGrid + + function vlistInqVarZaxis(vlistID_dummy, varID_dummy) bind(c, name =& + & 'vlistInqVarZaxis') result(f_result) + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + integer(c_int) :: f_result + end function vlistInqVarZaxis + + function vlistInqVarID(vlistID_dummy, code_dummy) bind(c, name =& + & 'vlistInqVarID') result(f_result) + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: code_dummy + integer(c_int) :: f_result + end function vlistInqVarID + + subroutine vlistDefVarTimetype(vlistID_dummy, varID_dummy, timetype_dummy)& + & bind(c, name = 'vlistDefVarTimetype') + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + integer(c_int), value :: timetype_dummy + end subroutine vlistDefVarTimetype + + function vlistInqVarTimetype(vlistID_dummy, varID_dummy) bind(c, name =& + & 'vlistInqVarTimetype') result(f_result) + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + integer(c_int) :: f_result + end function vlistInqVarTimetype + + subroutine vlistDefVarTsteptype(vlistID_dummy, varID_dummy,& + & tsteptype_dummy) bind(c, name = 'vlistDefVarTsteptype') + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + integer(c_int), value :: tsteptype_dummy + end subroutine vlistDefVarTsteptype + + function vlistInqVarTsteptype(vlistID_dummy, varID_dummy) bind(c, name =& + & 'vlistInqVarTsteptype') result(f_result) + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + integer(c_int) :: f_result + end function vlistInqVarTsteptype + + subroutine vlistDefVarCompType(vlistID_dummy, varID_dummy, comptype_dummy)& + & bind(c, name = 'vlistDefVarCompType') + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + integer(c_int), value :: comptype_dummy + end subroutine vlistDefVarCompType + + function vlistInqVarCompType(vlistID_dummy, varID_dummy) bind(c, name =& + & 'vlistInqVarCompType') result(f_result) + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + integer(c_int) :: f_result + end function vlistInqVarCompType + + subroutine vlistDefVarCompLevel(vlistID_dummy, varID_dummy,& + & complevel_dummy) bind(c, name = 'vlistDefVarCompLevel') + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + integer(c_int), value :: complevel_dummy + end subroutine vlistDefVarCompLevel + + function vlistInqVarCompLevel(vlistID_dummy, varID_dummy) bind(c, name =& + & 'vlistInqVarCompLevel') result(f_result) + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + integer(c_int) :: f_result + end function vlistInqVarCompLevel + + subroutine vlistDefVarParam(vlistID_dummy, varID_dummy, param_dummy)& + & bind(c, name = 'vlistDefVarParam') + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + integer(c_int), value :: param_dummy + end subroutine vlistDefVarParam + + function vlistInqVarParam(vlistID_dummy, varID_dummy) bind(c, name =& + & 'vlistInqVarParam') result(f_result) + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + integer(c_int) :: f_result + end function vlistInqVarParam + + subroutine vlistDefVarCode(vlistID_dummy, varID_dummy, code_dummy) bind(c,& + & name = 'vlistDefVarCode') + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + integer(c_int), value :: code_dummy + end subroutine vlistDefVarCode + + function vlistInqVarCode(vlistID_dummy, varID_dummy) bind(c, name =& + & 'vlistInqVarCode') result(f_result) + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + integer(c_int) :: f_result + end function vlistInqVarCode + + subroutine vlistDefVarDatatype(vlistID_dummy, varID_dummy, datatype_dummy)& + & bind(c, name = 'vlistDefVarDatatype') + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + integer(c_int), value :: datatype_dummy + end subroutine vlistDefVarDatatype + + function vlistInqVarDatatype(vlistID_dummy, varID_dummy) bind(c, name =& + & 'vlistInqVarDatatype') result(f_result) + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + integer(c_int) :: f_result + end function vlistInqVarDatatype + + subroutine vlistDefVarXYZ(vlistID_dummy, varID_dummy, xyz_dummy) bind(c,& + & name = 'vlistDefVarXYZ') + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + integer(c_int), value :: xyz_dummy + end subroutine vlistDefVarXYZ + + function vlistInqVarXYZ(vlistID_dummy, varID_dummy) bind(c, name =& + & 'vlistInqVarXYZ') result(f_result) + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + integer(c_int) :: f_result + end function vlistInqVarXYZ + + subroutine vlistDefVarNSB(vlistID_dummy, varID_dummy, nsb_dummy) bind(c,& + & name = 'vlistDefVarNSB') + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + integer(c_int), value :: nsb_dummy + end subroutine vlistDefVarNSB + + function vlistInqVarNSB(vlistID_dummy, varID_dummy) bind(c, name =& + & 'vlistInqVarNSB') result(f_result) + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + integer(c_int) :: f_result + end function vlistInqVarNSB + + function vlistInqVarNumber(vlistID_dummy, varID_dummy) bind(c, name =& + & 'vlistInqVarNumber') result(f_result) + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + integer(c_int) :: f_result + end function vlistInqVarNumber + + subroutine vlistDefVarInstitut(vlistID_dummy, varID_dummy, instID_dummy)& + & bind(c, name = 'vlistDefVarInstitut') + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + integer(c_int), value :: instID_dummy + end subroutine vlistDefVarInstitut + + function vlistInqVarInstitut(vlistID_dummy, varID_dummy) bind(c, name =& + & 'vlistInqVarInstitut') result(f_result) + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + integer(c_int) :: f_result + end function vlistInqVarInstitut + + subroutine vlistDefVarModel(vlistID_dummy, varID_dummy, modelID_dummy)& + & bind(c, name = 'vlistDefVarModel') + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + integer(c_int), value :: modelID_dummy + end subroutine vlistDefVarModel + + function vlistInqVarModel(vlistID_dummy, varID_dummy) bind(c, name =& + & 'vlistInqVarModel') result(f_result) + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + integer(c_int) :: f_result + end function vlistInqVarModel + + subroutine vlistDefVarTable(vlistID_dummy, varID_dummy, tableID_dummy)& + & bind(c, name = 'vlistDefVarTable') + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + integer(c_int), value :: tableID_dummy + end subroutine vlistDefVarTable + + function vlistInqVarTable(vlistID_dummy, varID_dummy) bind(c, name =& + & 'vlistInqVarTable') result(f_result) + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + integer(c_int) :: f_result + end function vlistInqVarTable + + subroutine vlistDefVarMissval(vlistID_dummy, varID_dummy, missval_dummy)& + & bind(c, name = 'vlistDefVarMissval') + import c_double, c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + real(c_double), value :: missval_dummy + end subroutine vlistDefVarMissval + + function vlistInqVarMissval(vlistID_dummy, varID_dummy) bind(c, name =& + & 'vlistInqVarMissval') result(f_result) + import c_double, c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + real(c_double) :: f_result + end function vlistInqVarMissval + + function vlistInqVarSize(vlistID_dummy, varID_dummy) bind(c, name =& + & 'vlistInqVarSize') result(f_result) + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + integer(c_int) :: f_result + end function vlistInqVarSize + + subroutine vlistDefIndex(vlistID_dummy, varID_dummy, levID_dummy,& + & index_dummy) bind(c, name = 'vlistDefIndex') + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + integer(c_int), value :: levID_dummy + integer(c_int), value :: index_dummy + end subroutine vlistDefIndex + + function vlistInqIndex(vlistID_dummy, varID_dummy, levID_dummy) bind(c,& + & name = 'vlistInqIndex') result(f_result) + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + integer(c_int), value :: levID_dummy + integer(c_int) :: f_result + end function vlistInqIndex + + subroutine vlistDefFlag(vlistID_dummy, varID_dummy, levID_dummy,& + & flag_dummy) bind(c, name = 'vlistDefFlag') + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + integer(c_int), value :: levID_dummy + integer(c_int), value :: flag_dummy + end subroutine vlistDefFlag + + function vlistInqFlag(vlistID_dummy, varID_dummy, levID_dummy) bind(c, name& + & = 'vlistInqFlag') result(f_result) + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + integer(c_int), value :: levID_dummy + integer(c_int) :: f_result + end function vlistInqFlag + + function vlistFindVar(vlistID_dummy, fvarID_dummy) bind(c, name =& + & 'vlistFindVar') result(f_result) + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: fvarID_dummy + integer(c_int) :: f_result + end function vlistFindVar + + function vlistFindLevel(vlistID_dummy, fvarID_dummy, flevelID_dummy)& + & bind(c, name = 'vlistFindLevel') result(f_result) + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: fvarID_dummy + integer(c_int), value :: flevelID_dummy + integer(c_int) :: f_result + end function vlistFindLevel + + function vlistMergedVar(vlistID_dummy, varID_dummy) bind(c, name =& + & 'vlistMergedVar') result(f_result) + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + integer(c_int) :: f_result + end function vlistMergedVar + + function vlistMergedLevel(vlistID_dummy, varID_dummy, levelID_dummy)& + & bind(c, name = 'vlistMergedLevel') result(f_result) + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + integer(c_int), value :: levelID_dummy + integer(c_int) :: f_result + end function vlistMergedLevel + + subroutine cdiClearAdditionalKeys() bind(c, name =& + & 'cdiClearAdditionalKeys') + end subroutine cdiClearAdditionalKeys + + function cdiInqNatts(cdiID_dummy, varID_dummy, nattsp_dummy) bind(c, name =& + & 'cdiInqNatts') result(f_result) + import c_int + integer(c_int), value :: cdiID_dummy + integer(c_int), value :: varID_dummy + integer(c_int), intent(inout) :: nattsp_dummy + integer(c_int) :: f_result + end function cdiInqNatts + + function cdiCopyAtts(cdiID1_dummy, varID1_dummy, cdiID2_dummy,& + & varID2_dummy) bind(c, name = 'cdiCopyAtts') result(f_result) + import c_int + integer(c_int), value :: cdiID1_dummy + integer(c_int), value :: varID1_dummy + integer(c_int), value :: cdiID2_dummy + integer(c_int), value :: varID2_dummy + integer(c_int) :: f_result + end function cdiCopyAtts + + subroutine gridCompress(gridID_dummy) bind(c, name = 'gridCompress') + import c_int + integer(c_int), value :: gridID_dummy + end subroutine gridCompress + + subroutine gridDefMaskGME(gridID_dummy, mask_dummy) bind(c, name =& + & 'gridDefMaskGME') + import c_int + integer(c_int), value :: gridID_dummy + integer(c_int), intent(in) :: mask_dummy(*) + end subroutine gridDefMaskGME + + function gridInqMaskGME(gridID_dummy, mask_dummy) bind(c, name =& + & 'gridInqMaskGME') result(f_result) + import c_int + integer(c_int), value :: gridID_dummy + integer(c_int), intent(inout) :: mask_dummy(*) + integer(c_int) :: f_result + end function gridInqMaskGME + + subroutine gridDefMask(gridID_dummy, mask_dummy) bind(c, name =& + & 'gridDefMask') + import c_int + integer(c_int), value :: gridID_dummy + integer(c_int), intent(in) :: mask_dummy(*) + end subroutine gridDefMask + + function gridInqMask(gridID_dummy, mask_dummy) bind(c, name =& + & 'gridInqMask') result(f_result) + import c_int + integer(c_int), value :: gridID_dummy + integer(c_int), intent(inout) :: mask_dummy(*) + integer(c_int) :: f_result + end function gridInqMask + + function gridCreate(gridtype_dummy, size_dummy) bind(c, name =& + & 'gridCreate') result(f_result) + import c_int + integer(c_int), value :: gridtype_dummy + integer(c_int), value :: size_dummy + integer(c_int) :: f_result + end function gridCreate + + subroutine gridDestroy(gridID_dummy) bind(c, name = 'gridDestroy') + import c_int + integer(c_int), value :: gridID_dummy + end subroutine gridDestroy + + function gridDuplicate(gridID_dummy) bind(c, name = 'gridDuplicate')& + & result(f_result) + import c_int + integer(c_int), value :: gridID_dummy + integer(c_int) :: f_result + end function gridDuplicate + + subroutine gridDefProj(gridID_dummy, projID_dummy) bind(c, name =& + & 'gridDefProj') + import c_int + integer(c_int), value :: gridID_dummy + integer(c_int), value :: projID_dummy + end subroutine gridDefProj + + function gridInqProj(gridID_dummy) bind(c, name = 'gridInqProj')& + & result(f_result) + import c_int + integer(c_int), value :: gridID_dummy + integer(c_int) :: f_result + end function gridInqProj + + function gridInqProjType(gridID_dummy) bind(c, name = 'gridInqProjType')& + & result(f_result) + import c_int + integer(c_int), value :: gridID_dummy + integer(c_int) :: f_result + end function gridInqProjType + + function gridInqType(gridID_dummy) bind(c, name = 'gridInqType')& + & result(f_result) + import c_int + integer(c_int), value :: gridID_dummy + integer(c_int) :: f_result + end function gridInqType + + function gridInqSize(gridID_dummy) bind(c, name = 'gridInqSize')& + & result(f_result) + import c_int + integer(c_int), value :: gridID_dummy + integer(c_int) :: f_result + end function gridInqSize + + subroutine gridDefXsize(gridID_dummy, xsize_dummy) bind(c, name =& + & 'gridDefXsize') + import c_int + integer(c_int), value :: gridID_dummy + integer(c_int), value :: xsize_dummy + end subroutine gridDefXsize + + function gridInqXsize(gridID_dummy) bind(c, name = 'gridInqXsize')& + & result(f_result) + import c_int + integer(c_int), value :: gridID_dummy + integer(c_int) :: f_result + end function gridInqXsize + + subroutine gridDefYsize(gridID_dummy, ysize_dummy) bind(c, name =& + & 'gridDefYsize') + import c_int + integer(c_int), value :: gridID_dummy + integer(c_int), value :: ysize_dummy + end subroutine gridDefYsize + + function gridInqYsize(gridID_dummy) bind(c, name = 'gridInqYsize')& + & result(f_result) + import c_int + integer(c_int), value :: gridID_dummy + integer(c_int) :: f_result + end function gridInqYsize + + subroutine gridDefNP(gridID_dummy, np_dummy) bind(c, name = 'gridDefNP') + import c_int + integer(c_int), value :: gridID_dummy + integer(c_int), value :: np_dummy + end subroutine gridDefNP + + function gridInqNP(gridID_dummy) bind(c, name = 'gridInqNP')& + & result(f_result) + import c_int + integer(c_int), value :: gridID_dummy + integer(c_int) :: f_result + end function gridInqNP + + subroutine gridDefXvals(gridID_dummy, xvals_dummy) bind(c, name =& + & 'gridDefXvals') + import c_double, c_int + integer(c_int), value :: gridID_dummy + real(c_double), intent(in) :: xvals_dummy(*) + end subroutine gridDefXvals + + function gridInqXvals(gridID_dummy, xvals_dummy) bind(c, name =& + & 'gridInqXvals') result(f_result) + import c_double, c_int + integer(c_int), value :: gridID_dummy + real(c_double), intent(inout) :: xvals_dummy(*) + integer(c_int) :: f_result + end function gridInqXvals + + function gridInqXvalsPart(gridID_dummy, start_dummy, size_dummy,& + & xvals_dummy) bind(c, name = 'gridInqXvalsPart') result(f_result) + import c_double, c_int + integer(c_int), value :: gridID_dummy + integer(c_int), value :: start_dummy + integer(c_int), value :: size_dummy + real(c_double), intent(inout) :: xvals_dummy(*) + integer(c_int) :: f_result + end function gridInqXvalsPart + + function gridInqXvalsPtr(gridID_dummy) bind(c, name = 'gridInqXvalsPtr')& + & result(f_result) + import c_int, c_ptr + integer(c_int), value :: gridID_dummy + type(c_ptr) :: f_result + end function gridInqXvalsPtr + + function gridInqXIsc(gridID_dummy) bind(c, name = 'gridInqXIsc')& + & result(f_result) + import c_int + integer(c_int), value :: gridID_dummy + integer(c_int) :: f_result + end function gridInqXIsc + + subroutine gridDefYvals(gridID_dummy, yvals_dummy) bind(c, name =& + & 'gridDefYvals') + import c_double, c_int + integer(c_int), value :: gridID_dummy + real(c_double), intent(in) :: yvals_dummy(*) + end subroutine gridDefYvals + + function gridInqYvals(gridID_dummy, yvals_dummy) bind(c, name =& + & 'gridInqYvals') result(f_result) + import c_double, c_int + integer(c_int), value :: gridID_dummy + real(c_double), intent(inout) :: yvals_dummy(*) + integer(c_int) :: f_result + end function gridInqYvals + + function gridInqYvalsPart(gridID_dummy, start_dummy, size_dummy,& + & yvals_dummy) bind(c, name = 'gridInqYvalsPart') result(f_result) + import c_double, c_int + integer(c_int), value :: gridID_dummy + integer(c_int), value :: start_dummy + integer(c_int), value :: size_dummy + real(c_double), intent(inout) :: yvals_dummy(*) + integer(c_int) :: f_result + end function gridInqYvalsPart + + function gridInqYvalsPtr(gridID_dummy) bind(c, name = 'gridInqYvalsPtr')& + & result(f_result) + import c_int, c_ptr + integer(c_int), value :: gridID_dummy + type(c_ptr) :: f_result + end function gridInqYvalsPtr + + function gridInqYIsc(gridID_dummy) bind(c, name = 'gridInqYIsc')& + & result(f_result) + import c_int + integer(c_int), value :: gridID_dummy + integer(c_int) :: f_result + end function gridInqYIsc + + function cdiDefKeyInt(cdiID_dummy, varID_dummy, key_dummy, value_dummy)& + & bind(c, name = 'cdiDefKeyInt') result(f_result) + import c_int + integer(c_int), value :: cdiID_dummy + integer(c_int), value :: varID_dummy + integer(c_int), value :: key_dummy + integer(c_int), value :: value_dummy + integer(c_int) :: f_result + end function cdiDefKeyInt + + function cdiInqKeyInt(cdiID_dummy, varID_dummy, key_dummy, value_dummy)& + & bind(c, name = 'cdiInqKeyInt') result(f_result) + import c_int + integer(c_int), value :: cdiID_dummy + integer(c_int), value :: varID_dummy + integer(c_int), value :: key_dummy + integer(c_int), intent(inout) :: value_dummy + integer(c_int) :: f_result + end function cdiInqKeyInt + + function cdiDefKeyFloat(cdiID_dummy, varID_dummy, key_dummy, value_dummy)& + & bind(c, name = 'cdiDefKeyFloat') result(f_result) + import c_double, c_int + integer(c_int), value :: cdiID_dummy + integer(c_int), value :: varID_dummy + integer(c_int), value :: key_dummy + real(c_double), value :: value_dummy + integer(c_int) :: f_result + end function cdiDefKeyFloat + + function cdiInqKeyFloat(cdiID_dummy, varID_dummy, key_dummy, value_dummy)& + & bind(c, name = 'cdiInqKeyFloat') result(f_result) + import c_double, c_int + integer(c_int), value :: cdiID_dummy + integer(c_int), value :: varID_dummy + integer(c_int), value :: key_dummy + real(c_double), intent(inout) :: value_dummy + integer(c_int) :: f_result + end function cdiInqKeyFloat + + function cdiDefKeyBytes(cdiID_dummy, varID_dummy, key_dummy, bytes_dummy,& + & length_dummy) bind(c, name = 'cdiDefKeyBytes') result(f_result) + import c_int, c_signed_char + integer(c_int), value :: cdiID_dummy + integer(c_int), value :: varID_dummy + integer(c_int), value :: key_dummy + integer(kind = c_signed_char), intent(in) :: bytes_dummy(*) + integer(c_int), value :: length_dummy + integer(c_int) :: f_result + end function cdiDefKeyBytes + + function cdiInqKeyBytes(cdiID_dummy, varID_dummy, key_dummy, bytes_dummy,& + & length_dummy) bind(c, name = 'cdiInqKeyBytes') result(f_result) + import c_int, c_signed_char + integer(c_int), value :: cdiID_dummy + integer(c_int), value :: varID_dummy + integer(c_int), value :: key_dummy + integer(kind = c_signed_char), intent(inout) :: bytes_dummy(*) + integer(c_int), intent(inout) :: length_dummy + integer(c_int) :: f_result + end function cdiInqKeyBytes + + function cdiInqKeyLen(cdiID_dummy, varID_dummy, key_dummy, length_dummy)& + & bind(c, name = 'cdiInqKeyLen') result(f_result) + import c_int + integer(c_int), value :: cdiID_dummy + integer(c_int), value :: varID_dummy + integer(c_int), value :: key_dummy + integer(c_int), intent(inout) :: length_dummy + integer(c_int) :: f_result + end function cdiInqKeyLen + + function cdiCopyKeys(cdiID1_dummy, varID1_dummy, cdiID2_dummy,& + & varID2_dummy) bind(c, name = 'cdiCopyKeys') result(f_result) + import c_int + integer(c_int), value :: cdiID1_dummy + integer(c_int), value :: varID1_dummy + integer(c_int), value :: cdiID2_dummy + integer(c_int), value :: varID2_dummy + integer(c_int) :: f_result + end function cdiCopyKeys + + function cdiCopyKey(cdiID1_dummy, varID1_dummy, key_dummy, cdiID2_dummy)& + & bind(c, name = 'cdiCopyKey') result(f_result) + import c_int + integer(c_int), value :: cdiID1_dummy + integer(c_int), value :: varID1_dummy + integer(c_int), value :: key_dummy + integer(c_int), value :: cdiID2_dummy + integer(c_int) :: f_result + end function cdiCopyKey + + function cdiDeleteKey(cdiID_dummy, varID_dummy, key_dummy) bind(c, name =& + & 'cdiDeleteKey') result(f_result) + import c_int + integer(c_int), value :: cdiID_dummy + integer(c_int), value :: varID_dummy + integer(c_int), value :: key_dummy + integer(c_int) :: f_result + end function cdiDeleteKey + + subroutine gridDefDatatype(gridID_dummy, datatype_dummy) bind(c, name =& + & 'gridDefDatatype') + import c_int + integer(c_int), value :: gridID_dummy + integer(c_int), value :: datatype_dummy + end subroutine gridDefDatatype + + function gridInqDatatype(gridID_dummy) bind(c, name = 'gridInqDatatype')& + & result(f_result) + import c_int + integer(c_int), value :: gridID_dummy + integer(c_int) :: f_result + end function gridInqDatatype + + function gridInqXval(gridID_dummy, index_dummy) bind(c, name =& + & 'gridInqXval') result(f_result) + import c_double, c_int + integer(c_int), value :: gridID_dummy + integer(c_int), value :: index_dummy + real(c_double) :: f_result + end function gridInqXval + + function gridInqYval(gridID_dummy, index_dummy) bind(c, name =& + & 'gridInqYval') result(f_result) + import c_double, c_int + integer(c_int), value :: gridID_dummy + integer(c_int), value :: index_dummy + real(c_double) :: f_result + end function gridInqYval + + function gridInqXinc(gridID_dummy) bind(c, name = 'gridInqXinc')& + & result(f_result) + import c_double, c_int + integer(c_int), value :: gridID_dummy + real(c_double) :: f_result + end function gridInqXinc + + function gridInqYinc(gridID_dummy) bind(c, name = 'gridInqYinc')& + & result(f_result) + import c_double, c_int + integer(c_int), value :: gridID_dummy + real(c_double) :: f_result + end function gridInqYinc + + function gridIsCircular(gridID_dummy) bind(c, name = 'gridIsCircular')& + & result(f_result) + import c_int + integer(c_int), value :: gridID_dummy + integer(c_int) :: f_result + end function gridIsCircular + + function gridInqTrunc(gridID_dummy) bind(c, name = 'gridInqTrunc')& + & result(f_result) + import c_int + integer(c_int), value :: gridID_dummy + integer(c_int) :: f_result + end function gridInqTrunc + + subroutine gridDefTrunc(gridID_dummy, trunc_dummy) bind(c, name =& + & 'gridDefTrunc') + import c_int + integer(c_int), value :: gridID_dummy + integer(c_int), value :: trunc_dummy + end subroutine gridDefTrunc + + subroutine gridDefNumber(gridID_dummy, number_dummy) bind(c, name =& + & 'gridDefNumber') + import c_int + integer(c_int), value :: gridID_dummy + integer(c_int), value :: number_dummy + end subroutine gridDefNumber + + function gridInqNumber(gridID_dummy) bind(c, name = 'gridInqNumber')& + & result(f_result) + import c_int + integer(c_int), value :: gridID_dummy + integer(c_int) :: f_result + end function gridInqNumber + + subroutine gridDefPosition(gridID_dummy, position_dummy) bind(c, name =& + & 'gridDefPosition') + import c_int + integer(c_int), value :: gridID_dummy + integer(c_int), value :: position_dummy + end subroutine gridDefPosition + + function gridInqPosition(gridID_dummy) bind(c, name = 'gridInqPosition')& + & result(f_result) + import c_int + integer(c_int), value :: gridID_dummy + integer(c_int) :: f_result + end function gridInqPosition + + subroutine gridDefUUID(gridID_dummy, uuid_dummy) bind(c, name =& + & 'gridDefUUID') + import CDI_UUID_SIZE, c_int, c_signed_char + integer(c_int), value :: gridID_dummy + integer(kind = c_signed_char), intent(in) :: uuid_dummy(CDI_UUID_SIZE) + end subroutine gridDefUUID + + subroutine gridInqUUID(gridID_dummy, uuid_dummy) bind(c, name =& + & 'gridInqUUID') + import CDI_UUID_SIZE, c_int, c_signed_char + integer(c_int), value :: gridID_dummy + integer(kind = c_signed_char), intent(inout) :: uuid_dummy(CDI_UUID_SIZE) + end subroutine gridInqUUID + + subroutine gridDefParamRLL(gridID_dummy, xpole_dummy, ypole_dummy,& + & angle_dummy) bind(c, name = 'gridDefParamRLL') + import c_double, c_int + integer(c_int), value :: gridID_dummy + real(c_double), value :: xpole_dummy + real(c_double), value :: ypole_dummy + real(c_double), value :: angle_dummy + end subroutine gridDefParamRLL + + subroutine gridInqParamRLL(gridID_dummy, xpole_dummy, ypole_dummy,& + & angle_dummy) bind(c, name = 'gridInqParamRLL') + import c_double, c_int + integer(c_int), value :: gridID_dummy + real(c_double), intent(inout) :: xpole_dummy + real(c_double), intent(inout) :: ypole_dummy + real(c_double), intent(inout) :: angle_dummy + end subroutine gridInqParamRLL + + subroutine gridDefParamGME(gridID_dummy, nd_dummy, ni_dummy, ni2_dummy,& + & ni3_dummy) bind(c, name = 'gridDefParamGME') + import c_int + integer(c_int), value :: gridID_dummy + integer(c_int), value :: nd_dummy + integer(c_int), value :: ni_dummy + integer(c_int), value :: ni2_dummy + integer(c_int), value :: ni3_dummy + end subroutine gridDefParamGME + + subroutine gridInqParamGME(gridID_dummy, nd_dummy, ni_dummy, ni2_dummy,& + & ni3_dummy) bind(c, name = 'gridInqParamGME') + import c_int + integer(c_int), value :: gridID_dummy + integer(c_int), intent(inout) :: nd_dummy + integer(c_int), intent(inout) :: ni_dummy + integer(c_int), intent(inout) :: ni2_dummy + integer(c_int), intent(inout) :: ni3_dummy + end subroutine gridInqParamGME + + subroutine gridDefArea(gridID_dummy, area_dummy) bind(c, name =& + & 'gridDefArea') + import c_double, c_int + integer(c_int), value :: gridID_dummy + real(c_double), intent(in) :: area_dummy(*) + end subroutine gridDefArea + + subroutine gridInqArea(gridID_dummy, area_dummy) bind(c, name =& + & 'gridInqArea') + import c_double, c_int + integer(c_int), value :: gridID_dummy + real(c_double), intent(inout) :: area_dummy(*) + end subroutine gridInqArea + + function gridHasArea(gridID_dummy) bind(c, name = 'gridHasArea')& + & result(f_result) + import c_int + integer(c_int), value :: gridID_dummy + integer(c_int) :: f_result + end function gridHasArea + + subroutine gridDefNvertex(gridID_dummy, nvertex_dummy) bind(c, name =& + & 'gridDefNvertex') + import c_int + integer(c_int), value :: gridID_dummy + integer(c_int), value :: nvertex_dummy + end subroutine gridDefNvertex + + function gridInqNvertex(gridID_dummy) bind(c, name = 'gridInqNvertex')& + & result(f_result) + import c_int + integer(c_int), value :: gridID_dummy + integer(c_int) :: f_result + end function gridInqNvertex + + subroutine gridDefXbounds(gridID_dummy, xbounds_dummy) bind(c, name =& + & 'gridDefXbounds') + import c_double, c_int + integer(c_int), value :: gridID_dummy + real(c_double), intent(in) :: xbounds_dummy(*) + end subroutine gridDefXbounds + + function gridInqXbounds(gridID_dummy, xbounds_dummy) bind(c, name =& + & 'gridInqXbounds') result(f_result) + import c_double, c_int + integer(c_int), value :: gridID_dummy + real(c_double), intent(inout) :: xbounds_dummy(*) + integer(c_int) :: f_result + end function gridInqXbounds + + function gridInqXboundsPart(gridID_dummy, start_dummy, size_dummy,& + & xbounds_dummy) bind(c, name = 'gridInqXboundsPart') result(f_result) + import c_double, c_int + integer(c_int), value :: gridID_dummy + integer(c_int), value :: start_dummy + integer(c_int), value :: size_dummy + real(c_double), intent(inout) :: xbounds_dummy(*) + integer(c_int) :: f_result + end function gridInqXboundsPart + + function gridInqXboundsPtr(gridID_dummy) bind(c, name =& + & 'gridInqXboundsPtr') result(f_result) + import c_int, c_ptr + integer(c_int), value :: gridID_dummy + type(c_ptr) :: f_result + end function gridInqXboundsPtr + + subroutine gridDefYbounds(gridID_dummy, ybounds_dummy) bind(c, name =& + & 'gridDefYbounds') + import c_double, c_int + integer(c_int), value :: gridID_dummy + real(c_double), intent(in) :: ybounds_dummy(*) + end subroutine gridDefYbounds + + function gridInqYbounds(gridID_dummy, ybounds_dummy) bind(c, name =& + & 'gridInqYbounds') result(f_result) + import c_double, c_int + integer(c_int), value :: gridID_dummy + real(c_double), intent(inout) :: ybounds_dummy(*) + integer(c_int) :: f_result + end function gridInqYbounds + + function gridInqYboundsPart(gridID_dummy, start_dummy, size_dummy,& + & ybounds_dummy) bind(c, name = 'gridInqYboundsPart') result(f_result) + import c_double, c_int + integer(c_int), value :: gridID_dummy + integer(c_int), value :: start_dummy + integer(c_int), value :: size_dummy + real(c_double), intent(inout) :: ybounds_dummy(*) + integer(c_int) :: f_result + end function gridInqYboundsPart + + function gridInqYboundsPtr(gridID_dummy) bind(c, name =& + & 'gridInqYboundsPtr') result(f_result) + import c_int, c_ptr + integer(c_int), value :: gridID_dummy + type(c_ptr) :: f_result + end function gridInqYboundsPtr + + subroutine gridDefReducedPoints(gridID_dummy, reducedPointsSize_dummy,& + & reducedPoints_dummy) bind(c, name = 'gridDefReducedPoints') + import c_int + integer(c_int), value :: gridID_dummy + integer(c_int), value :: reducedPointsSize_dummy + integer(c_int), intent(in) :: reducedPoints_dummy(*) + end subroutine gridDefReducedPoints + + subroutine gridInqReducedPoints(gridID_dummy, reducedPoints_dummy) bind(c,& + & name = 'gridInqReducedPoints') + import c_int + integer(c_int), value :: gridID_dummy + integer(c_int), intent(inout) :: reducedPoints_dummy(*) + end subroutine gridInqReducedPoints + + subroutine gridChangeType(gridID_dummy, gridtype_dummy) bind(c, name =& + & 'gridChangeType') + import c_int + integer(c_int), value :: gridID_dummy + integer(c_int), value :: gridtype_dummy + end subroutine gridChangeType + + subroutine gridDefComplexPacking(gridID_dummy, lpack_dummy) bind(c, name =& + & 'gridDefComplexPacking') + import c_int + integer(c_int), value :: gridID_dummy + integer(c_int), value :: lpack_dummy + end subroutine gridDefComplexPacking + + function gridInqComplexPacking(gridID_dummy) bind(c, name =& + & 'gridInqComplexPacking') result(f_result) + import c_int + integer(c_int), value :: gridID_dummy + integer(c_int) :: f_result + end function gridInqComplexPacking + + function zaxisCreate(zaxistype_dummy, size_dummy) bind(c, name =& + & 'zaxisCreate') result(f_result) + import c_int + integer(c_int), value :: zaxistype_dummy + integer(c_int), value :: size_dummy + integer(c_int) :: f_result + end function zaxisCreate + + subroutine zaxisDestroy(zaxisID_dummy) bind(c, name = 'zaxisDestroy') + import c_int + integer(c_int), value :: zaxisID_dummy + end subroutine zaxisDestroy + + function zaxisInqType(zaxisID_dummy) bind(c, name = 'zaxisInqType')& + & result(f_result) + import c_int + integer(c_int), value :: zaxisID_dummy + integer(c_int) :: f_result + end function zaxisInqType + + function zaxisInqSize(zaxisID_dummy) bind(c, name = 'zaxisInqSize')& + & result(f_result) + import c_int + integer(c_int), value :: zaxisID_dummy + integer(c_int) :: f_result + end function zaxisInqSize + + function zaxisDuplicate(zaxisID_dummy) bind(c, name = 'zaxisDuplicate')& + & result(f_result) + import c_int + integer(c_int), value :: zaxisID_dummy + integer(c_int) :: f_result + end function zaxisDuplicate + + subroutine zaxisDefLevels(zaxisID_dummy, levels_dummy) bind(c, name =& + & 'zaxisDefLevels') + import c_double, c_int + integer(c_int), value :: zaxisID_dummy + real(c_double), intent(in) :: levels_dummy(*) + end subroutine zaxisDefLevels + + function zaxisInqLevels(zaxisID_dummy, levels_dummy) bind(c, name =& + & 'zaxisInqLevels') result(f_result) + import c_double, c_int + integer(c_int), value :: zaxisID_dummy + real(c_double), intent(inout) :: levels_dummy(*) + integer(c_int) :: f_result + end function zaxisInqLevels + + function zaxisInqCLen(zaxisID_dummy) bind(c, name = 'zaxisInqCLen')& + & result(f_result) + import c_int + integer(c_int), value :: zaxisID_dummy + integer(c_int) :: f_result + end function zaxisInqCLen + + subroutine zaxisDefLevel(zaxisID_dummy, levelID_dummy, levels_dummy)& + & bind(c, name = 'zaxisDefLevel') + import c_double, c_int + integer(c_int), value :: zaxisID_dummy + integer(c_int), value :: levelID_dummy + real(c_double), value :: levels_dummy + end subroutine zaxisDefLevel + + function zaxisInqLevel(zaxisID_dummy, levelID_dummy) bind(c, name =& + & 'zaxisInqLevel') result(f_result) + import c_double, c_int + integer(c_int), value :: zaxisID_dummy + integer(c_int), value :: levelID_dummy + real(c_double) :: f_result + end function zaxisInqLevel + + subroutine zaxisDefNlevRef(gridID_dummy, nhlev_dummy) bind(c, name =& + & 'zaxisDefNlevRef') + import c_int + integer(c_int), value :: gridID_dummy + integer(c_int), value :: nhlev_dummy + end subroutine zaxisDefNlevRef + + function zaxisInqNlevRef(gridID_dummy) bind(c, name = 'zaxisInqNlevRef')& + & result(f_result) + import c_int + integer(c_int), value :: gridID_dummy + integer(c_int) :: f_result + end function zaxisInqNlevRef + + subroutine zaxisDefNumber(gridID_dummy, number_dummy) bind(c, name =& + & 'zaxisDefNumber') + import c_int + integer(c_int), value :: gridID_dummy + integer(c_int), value :: number_dummy + end subroutine zaxisDefNumber + + function zaxisInqNumber(gridID_dummy) bind(c, name = 'zaxisInqNumber')& + & result(f_result) + import c_int + integer(c_int), value :: gridID_dummy + integer(c_int) :: f_result + end function zaxisInqNumber + + subroutine zaxisDefUUID(zaxisID_dummy, uuid_dummy) bind(c, name =& + & 'zaxisDefUUID') + import CDI_UUID_SIZE, c_int, c_signed_char + integer(c_int), value :: zaxisID_dummy + integer(kind = c_signed_char), intent(in) :: uuid_dummy(CDI_UUID_SIZE) + end subroutine zaxisDefUUID + + subroutine zaxisInqUUID(zaxisID_dummy, uuid_dummy) bind(c, name =& + & 'zaxisInqUUID') + import CDI_UUID_SIZE, c_int, c_signed_char + integer(c_int), value :: zaxisID_dummy + integer(kind = c_signed_char), intent(inout) :: uuid_dummy(CDI_UUID_SIZE) + end subroutine zaxisInqUUID + + subroutine zaxisDefDatatype(zaxisID_dummy, datatype_dummy) bind(c, name =& + & 'zaxisDefDatatype') + import c_int + integer(c_int), value :: zaxisID_dummy + integer(c_int), value :: datatype_dummy + end subroutine zaxisDefDatatype + + function zaxisInqDatatype(zaxisID_dummy) bind(c, name = 'zaxisInqDatatype')& + & result(f_result) + import c_int + integer(c_int), value :: zaxisID_dummy + integer(c_int) :: f_result + end function zaxisInqDatatype + + subroutine zaxisDefPositive(zaxisID_dummy, positive_dummy) bind(c, name =& + & 'zaxisDefPositive') + import c_int + integer(c_int), value :: zaxisID_dummy + integer(c_int), value :: positive_dummy + end subroutine zaxisDefPositive + + function zaxisInqPositive(zaxisID_dummy) bind(c, name = 'zaxisInqPositive')& + & result(f_result) + import c_int + integer(c_int), value :: zaxisID_dummy + integer(c_int) :: f_result + end function zaxisInqPositive + + subroutine zaxisDefScalar(zaxisID_dummy) bind(c, name = 'zaxisDefScalar') + import c_int + integer(c_int), value :: zaxisID_dummy + end subroutine zaxisDefScalar + + function zaxisInqScalar(zaxisID_dummy) bind(c, name = 'zaxisInqScalar')& + & result(f_result) + import c_int + integer(c_int), value :: zaxisID_dummy + integer(c_int) :: f_result + end function zaxisInqScalar + + subroutine zaxisDefVct(zaxisID_dummy, size_dummy, vct_dummy) bind(c, name =& + & 'zaxisDefVct') + import c_double, c_int + integer(c_int), value :: zaxisID_dummy + integer(c_int), value :: size_dummy + real(c_double), intent(in) :: vct_dummy(*) + end subroutine zaxisDefVct + + subroutine zaxisInqVct(zaxisID_dummy, vct_dummy) bind(c, name =& + & 'zaxisInqVct') + import c_double, c_int + integer(c_int), value :: zaxisID_dummy + real(c_double), intent(inout) :: vct_dummy(*) + end subroutine zaxisInqVct + + function zaxisInqVctSize(zaxisID_dummy) bind(c, name = 'zaxisInqVctSize')& + & result(f_result) + import c_int + integer(c_int), value :: zaxisID_dummy + integer(c_int) :: f_result + end function zaxisInqVctSize + + function zaxisInqVctPtr(zaxisID_dummy) bind(c, name = 'zaxisInqVctPtr')& + & result(f_result) + import c_int, c_ptr + integer(c_int), value :: zaxisID_dummy + type(c_ptr) :: f_result + end function zaxisInqVctPtr + + subroutine zaxisDefLbounds(zaxisID_dummy, lbounds_dummy) bind(c, name =& + & 'zaxisDefLbounds') + import c_double, c_int + integer(c_int), value :: zaxisID_dummy + real(c_double), intent(in) :: lbounds_dummy(*) + end subroutine zaxisDefLbounds + + function zaxisInqLbound(zaxisID_dummy, index_dummy) bind(c, name =& + & 'zaxisInqLbound') result(f_result) + import c_double, c_int + integer(c_int), value :: zaxisID_dummy + integer(c_int), value :: index_dummy + real(c_double) :: f_result + end function zaxisInqLbound + + subroutine zaxisDefUbounds(zaxisID_dummy, ubounds_dummy) bind(c, name =& + & 'zaxisDefUbounds') + import c_double, c_int + integer(c_int), value :: zaxisID_dummy + real(c_double), intent(in) :: ubounds_dummy(*) + end subroutine zaxisDefUbounds + + function zaxisInqUbound(zaxisID_dummy, index_dummy) bind(c, name =& + & 'zaxisInqUbound') result(f_result) + import c_double, c_int + integer(c_int), value :: zaxisID_dummy + integer(c_int), value :: index_dummy + real(c_double) :: f_result + end function zaxisInqUbound + + subroutine zaxisDefWeights(zaxisID_dummy, weights_dummy) bind(c, name =& + & 'zaxisDefWeights') + import c_double, c_int + integer(c_int), value :: zaxisID_dummy + real(c_double), intent(in) :: weights_dummy(*) + end subroutine zaxisDefWeights + + subroutine zaxisChangeType(zaxisID_dummy, zaxistype_dummy) bind(c, name =& + & 'zaxisChangeType') + import c_int + integer(c_int), value :: zaxisID_dummy + integer(c_int), value :: zaxistype_dummy + end subroutine zaxisChangeType + + function taxisCreate(taxistype_dummy) bind(c, name = 'taxisCreate')& + & result(f_result) + import c_int + integer(c_int), value :: taxistype_dummy + integer(c_int) :: f_result + end function taxisCreate + + subroutine taxisDestroy(taxisID_dummy) bind(c, name = 'taxisDestroy') + import c_int + integer(c_int), value :: taxisID_dummy + end subroutine taxisDestroy + + function taxisDuplicate(taxisID_dummy) bind(c, name = 'taxisDuplicate')& + & result(f_result) + import c_int + integer(c_int), value :: taxisID_dummy + integer(c_int) :: f_result + end function taxisDuplicate + + subroutine taxisCopyTimestep(taxisIDdes_dummy, taxisIDsrc_dummy) bind(c,& + & name = 'taxisCopyTimestep') + import c_int + integer(c_int), value :: taxisIDdes_dummy + integer(c_int), value :: taxisIDsrc_dummy + end subroutine taxisCopyTimestep + + subroutine taxisDefType(taxisID_dummy, taxistype_dummy) bind(c, name =& + & 'taxisDefType') + import c_int + integer(c_int), value :: taxisID_dummy + integer(c_int), value :: taxistype_dummy + end subroutine taxisDefType + + function taxisInqType(taxisID_dummy) bind(c, name = 'taxisInqType')& + & result(f_result) + import c_int + integer(c_int), value :: taxisID_dummy + integer(c_int) :: f_result + end function taxisInqType + + subroutine taxisDefVdate(taxisID_dummy, date_dummy) bind(c, name =& + & 'taxisDefVdate') + import c_int + integer(c_int), value :: taxisID_dummy + integer(c_int), value :: date_dummy + end subroutine taxisDefVdate + + subroutine taxisDefVtime(taxisID_dummy, time_dummy) bind(c, name =& + & 'taxisDefVtime') + import c_int + integer(c_int), value :: taxisID_dummy + integer(c_int), value :: time_dummy + end subroutine taxisDefVtime + + function taxisInqVdate(taxisID_dummy) bind(c, name = 'taxisInqVdate')& + & result(f_result) + import c_int + integer(c_int), value :: taxisID_dummy + integer(c_int) :: f_result + end function taxisInqVdate + + function taxisInqVtime(taxisID_dummy) bind(c, name = 'taxisInqVtime')& + & result(f_result) + import c_int + integer(c_int), value :: taxisID_dummy + integer(c_int) :: f_result + end function taxisInqVtime + + subroutine taxisDefRdate(taxisID_dummy, date_dummy) bind(c, name =& + & 'taxisDefRdate') + import c_int + integer(c_int), value :: taxisID_dummy + integer(c_int), value :: date_dummy + end subroutine taxisDefRdate + + subroutine taxisDefRtime(taxisID_dummy, time_dummy) bind(c, name =& + & 'taxisDefRtime') + import c_int + integer(c_int), value :: taxisID_dummy + integer(c_int), value :: time_dummy + end subroutine taxisDefRtime + + function taxisInqRdate(taxisID_dummy) bind(c, name = 'taxisInqRdate')& + & result(f_result) + import c_int + integer(c_int), value :: taxisID_dummy + integer(c_int) :: f_result + end function taxisInqRdate + + function taxisInqRtime(taxisID_dummy) bind(c, name = 'taxisInqRtime')& + & result(f_result) + import c_int + integer(c_int), value :: taxisID_dummy + integer(c_int) :: f_result + end function taxisInqRtime + + function taxisHasBounds(taxisID_dummy) bind(c, name = 'taxisHasBounds')& + & result(f_result) + import c_int + integer(c_int), value :: taxisID_dummy + integer(c_int) :: f_result + end function taxisHasBounds + + subroutine taxisWithBounds(taxisID_dummy) bind(c, name = 'taxisWithBounds') + import c_int + integer(c_int), value :: taxisID_dummy + end subroutine taxisWithBounds + + subroutine taxisDeleteBounds(taxisID_dummy) bind(c, name =& + & 'taxisDeleteBounds') + import c_int + integer(c_int), value :: taxisID_dummy + end subroutine taxisDeleteBounds + + subroutine taxisDefVdateBounds(taxisID_dummy, vdate_lb_dummy,& + & vdate_ub_dummy) bind(c, name = 'taxisDefVdateBounds') + import c_int + integer(c_int), value :: taxisID_dummy + integer(c_int), value :: vdate_lb_dummy + integer(c_int), value :: vdate_ub_dummy + end subroutine taxisDefVdateBounds + + subroutine taxisDefVtimeBounds(taxisID_dummy, vtime_lb_dummy,& + & vtime_ub_dummy) bind(c, name = 'taxisDefVtimeBounds') + import c_int + integer(c_int), value :: taxisID_dummy + integer(c_int), value :: vtime_lb_dummy + integer(c_int), value :: vtime_ub_dummy + end subroutine taxisDefVtimeBounds + + subroutine taxisInqVdateBounds(taxisID_dummy, vdate_lb_dummy,& + & vdate_ub_dummy) bind(c, name = 'taxisInqVdateBounds') + import c_int + integer(c_int), value :: taxisID_dummy + integer(c_int), intent(inout) :: vdate_lb_dummy + integer(c_int), intent(inout) :: vdate_ub_dummy + end subroutine taxisInqVdateBounds + + subroutine taxisInqVtimeBounds(taxisID_dummy, vtime_lb_dummy,& + & vtime_ub_dummy) bind(c, name = 'taxisInqVtimeBounds') + import c_int + integer(c_int), value :: taxisID_dummy + integer(c_int), intent(inout) :: vtime_lb_dummy + integer(c_int), intent(inout) :: vtime_ub_dummy + end subroutine taxisInqVtimeBounds + + subroutine taxisDefCalendar(taxisID_dummy, calendar_dummy) bind(c, name =& + & 'taxisDefCalendar') + import c_int + integer(c_int), value :: taxisID_dummy + integer(c_int), value :: calendar_dummy + end subroutine taxisDefCalendar + + function taxisInqCalendar(taxisID_dummy) bind(c, name = 'taxisInqCalendar')& + & result(f_result) + import c_int + integer(c_int), value :: taxisID_dummy + integer(c_int) :: f_result + end function taxisInqCalendar + + subroutine taxisDefTunit(taxisID_dummy, tunit_dummy) bind(c, name =& + & 'taxisDefTunit') + import c_int + integer(c_int), value :: taxisID_dummy + integer(c_int), value :: tunit_dummy + end subroutine taxisDefTunit + + function taxisInqTunit(taxisID_dummy) bind(c, name = 'taxisInqTunit')& + & result(f_result) + import c_int + integer(c_int), value :: taxisID_dummy + integer(c_int) :: f_result + end function taxisInqTunit + + subroutine taxisDefForecastTunit(taxisID_dummy, tunit_dummy) bind(c, name =& + & 'taxisDefForecastTunit') + import c_int + integer(c_int), value :: taxisID_dummy + integer(c_int), value :: tunit_dummy + end subroutine taxisDefForecastTunit + + function taxisInqForecastTunit(taxisID_dummy) bind(c, name =& + & 'taxisInqForecastTunit') result(f_result) + import c_int + integer(c_int), value :: taxisID_dummy + integer(c_int) :: f_result + end function taxisInqForecastTunit + + subroutine taxisDefForecastPeriod(taxisID_dummy, fc_period_dummy) bind(c,& + & name = 'taxisDefForecastPeriod') + import c_double, c_int + integer(c_int), value :: taxisID_dummy + real(c_double), value :: fc_period_dummy + end subroutine taxisDefForecastPeriod + + function taxisInqForecastPeriod(taxisID_dummy) bind(c, name =& + & 'taxisInqForecastPeriod') result(f_result) + import c_double, c_int + integer(c_int), value :: taxisID_dummy + real(c_double) :: f_result + end function taxisInqForecastPeriod + + subroutine taxisDefNumavg(taxisID_dummy, numavg_dummy) bind(c, name =& + & 'taxisDefNumavg') + import c_int + integer(c_int), value :: taxisID_dummy + integer(c_int), value :: numavg_dummy + end subroutine taxisDefNumavg + + function taxisInqNumavg(taxisID_dummy) bind(c, name = 'taxisInqNumavg')& + & result(f_result) + import c_int + integer(c_int), value :: taxisID_dummy + integer(c_int) :: f_result + end function taxisInqNumavg + + function institutInqNumber() bind(c, name = 'institutInqNumber')& + & result(f_result) + import c_int + integer(c_int) :: f_result + end function institutInqNumber + + function institutInqCenter(instID_dummy) bind(c, name =& + & 'institutInqCenter') result(f_result) + import c_int + integer(c_int), value :: instID_dummy + integer(c_int) :: f_result + end function institutInqCenter + + function institutInqSubcenter(instID_dummy) bind(c, name =& + & 'institutInqSubcenter') result(f_result) + import c_int + integer(c_int), value :: instID_dummy + integer(c_int) :: f_result + end function institutInqSubcenter + + function modelInqInstitut(modelID_dummy) bind(c, name = 'modelInqInstitut')& + & result(f_result) + import c_int + integer(c_int), value :: modelID_dummy + integer(c_int) :: f_result + end function modelInqInstitut + + function modelInqGribID(modelID_dummy) bind(c, name = 'modelInqGribID')& + & result(f_result) + import c_int + integer(c_int), value :: modelID_dummy + integer(c_int) :: f_result + end function modelInqGribID + + function tableInqNumber() bind(c, name = 'tableInqNumber') result(f_result) + import c_int + integer(c_int) :: f_result + end function tableInqNumber + + function tableInqNum(tableID_dummy) bind(c, name = 'tableInqNum')& + & result(f_result) + import c_int + integer(c_int), value :: tableID_dummy + integer(c_int) :: f_result + end function tableInqNum + + function tableInqModel(tableID_dummy) bind(c, name = 'tableInqModel')& + & result(f_result) + import c_int + integer(c_int), value :: tableID_dummy + integer(c_int) :: f_result + end function tableInqModel + + function subtypeCreate(subtype_dummy) bind(c, name = 'subtypeCreate')& + & result(f_result) + import c_int + integer(c_int), value :: subtype_dummy + integer(c_int) :: f_result + end function subtypeCreate + + subroutine subtypePrint(subtypeID_dummy) bind(c, name = 'subtypePrint') + import c_int + integer(c_int), value :: subtypeID_dummy + end subroutine subtypePrint + + function subtypeCompare(subtypeID1_dummy, subtypeID2_dummy) bind(c, name =& + & 'subtypeCompare') result(f_result) + import c_int + integer(c_int), value :: subtypeID1_dummy + integer(c_int), value :: subtypeID2_dummy + integer(c_int) :: f_result + end function subtypeCompare + + function subtypeInqSize(subtypeID_dummy) bind(c, name = 'subtypeInqSize')& + & result(f_result) + import c_int + integer(c_int), value :: subtypeID_dummy + integer(c_int) :: f_result + end function subtypeInqSize + + function subtypeInqActiveIndex(subtypeID_dummy) bind(c, name =& + & 'subtypeInqActiveIndex') result(f_result) + import c_int + integer(c_int), value :: subtypeID_dummy + integer(c_int) :: f_result + end function subtypeInqActiveIndex + + subroutine subtypeDefActiveIndex(subtypeID_dummy, index_dummy) bind(c, name& + & = 'subtypeDefActiveIndex') + import c_int + integer(c_int), value :: subtypeID_dummy + integer(c_int), value :: index_dummy + end subroutine subtypeDefActiveIndex + + function subtypeInqTile(subtypeID_dummy, tileindex_dummy, attribute_dummy)& + & bind(c, name = 'subtypeInqTile') result(f_result) + import c_int + integer(c_int), value :: subtypeID_dummy + integer(c_int), value :: tileindex_dummy + integer(c_int), value :: attribute_dummy + integer(c_int) :: f_result + end function subtypeInqTile + + function vlistInqVarSubtype(vlistID_dummy, varID_dummy) bind(c, name =& + & 'vlistInqVarSubtype') result(f_result) + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + integer(c_int) :: f_result + end function vlistInqVarSubtype + + subroutine gribapiLibraryVersion(major_version_dummy, minor_version_dummy,& + & revision_version_dummy) bind(c, name = 'gribapiLibraryVersion') + import c_int + integer(c_int), intent(inout) :: major_version_dummy + integer(c_int), intent(inout) :: minor_version_dummy + integer(c_int), intent(inout) :: revision_version_dummy + end subroutine gribapiLibraryVersion + + subroutine zaxisDefLtype(zaxisID_dummy, ltype_dummy) bind(c, name =& + & 'zaxisDefLtype') + import c_int + integer(c_int), value :: zaxisID_dummy + integer(c_int), value :: ltype_dummy + end subroutine zaxisDefLtype + + function vlistInqVarTypeOfGeneratingProcess(vlistID_dummy, varID_dummy)& + & bind(c, name = 'vlistInqVarTypeOfGeneratingProcess') result(f_result) + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + integer(c_int) :: f_result + end function vlistInqVarTypeOfGeneratingProcess + + subroutine vlistDefVarTypeOfGeneratingProcess(vlistID_dummy, varID_dummy,& + & typeOfGeneratingProcess_dummy) bind(c, name =& + & 'vlistDefVarTypeOfGeneratingProcess') + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + integer(c_int), value :: typeOfGeneratingProcess_dummy + end subroutine vlistDefVarTypeOfGeneratingProcess + + subroutine vlistDefVarProductDefinitionTemplate(vlistID_dummy, varID_dummy,& + & productDefinitionTemplate_dummy) bind(c, name =& + & 'vlistDefVarProductDefinitionTemplate') + import c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + integer(c_int), value :: productDefinitionTemplate_dummy + end subroutine vlistDefVarProductDefinitionTemplate + + function date_to_julday(calendar_dummy, date_dummy) bind(c, name =& + & 'date_to_julday') result(f_result) + import c_int, c_int64_t + integer(c_int), value :: calendar_dummy + integer(c_int64_t), value :: date_dummy + integer(c_int64_t) :: f_result + end function date_to_julday + + function julday_to_date(calendar_dummy, julday_dummy) bind(c, name =& + & 'julday_to_date') result(f_result) + import c_int, c_int64_t + integer(c_int), value :: calendar_dummy + integer(c_int64_t), value :: julday_dummy + integer(c_int64_t) :: f_result + end function julday_to_date + + function time_to_sec(time_dummy) bind(c, name = 'time_to_sec')& + & result(f_result) + import c_int + integer(c_int), value :: time_dummy + integer(c_int) :: f_result + end function time_to_sec + + function sec_to_time(secofday_dummy) bind(c, name = 'sec_to_time')& + & result(f_result) + import c_int + integer(c_int), value :: secofday_dummy + integer(c_int) :: f_result + end function sec_to_time + + end interface + +contains + + subroutine ctrim(str) + character(kind = c_char, len = *), intent(inout) :: str + integer :: i + + do i=1,len(str) + if (str(i:i) == c_null_char) then + str(i:len(str)) = ' ' + exit + end if + end do + end subroutine ctrim + + function c_len(s) result(i) + character(kind = c_char, len = *), intent(in) :: s + integer :: i + + do i = 1, len(s) + if (s(i:i) == c_null_char) exit + end do + i = i - 1 + end function + + function cdiStringError(cdiErrno_dummy) result(f_result) + character(kind = c_char), dimension(:), pointer :: f_result + integer(c_int), value :: cdiErrno_dummy + type(c_ptr) :: ptr + integer :: rv_shape(1) + interface + function lib_cdiStringError(cdiErrno_dummy) bind(c, name =& + & 'cdiStringError') result(c_result) + import c_int, c_ptr + type(c_ptr) :: c_result + integer(c_int), value :: cdiErrno_dummy + end function lib_cdiStringError + end interface + f_result => null() + ptr = lib_cdiStringError(cdiErrno_dummy) + if(c_associated(ptr)) then + rv_shape(1) = int(lib_strlen(ptr)) + call c_f_pointer(ptr, f_result, rv_shape) + end if + end function cdiStringError + + function cdiLibraryVersion() result(f_result) + character(kind = c_char), dimension(:), pointer :: f_result + type(c_ptr) :: ptr + integer :: rv_shape(1) + interface + function lib_cdiLibraryVersion() bind(c, name = 'cdiLibraryVersion')& + & result(c_result) + import c_ptr + type(c_ptr) :: c_result + end function lib_cdiLibraryVersion + end interface + f_result => null() + ptr = lib_cdiLibraryVersion() + if(c_associated(ptr)) then + rv_shape(1) = int(lib_strlen(ptr)) + call c_f_pointer(ptr, f_result, rv_shape) + end if + end function cdiLibraryVersion + + subroutine cdiDefGlobal(string_dummy, val_dummy) + character(kind = c_char, len = *), intent(in) :: string_dummy + integer(c_int), value :: val_dummy + character(kind = c_char) :: string_temp(len(string_dummy) + 1) + integer :: string_i + interface + subroutine lib_cdiDefGlobal(string_dummy, val_dummy) bind(c, name =& + & 'cdiDefGlobal') + import c_char, c_int + character(kind = c_char) :: string_dummy(*) + integer(c_int), value :: val_dummy + end subroutine lib_cdiDefGlobal + end interface + do string_i = 1, len(string_dummy) + string_temp(string_i) = string_dummy(string_i:string_i) + end do + string_temp(len(string_dummy) + 1) = c_null_char + call lib_cdiDefGlobal(string_temp, val_dummy) + end subroutine cdiDefGlobal + + subroutine cdiParamToString(param_dummy, paramstr_dummy, maxlen_dummy) + integer(c_int), value :: param_dummy + character(kind = c_char, len = *), intent(inout) :: paramstr_dummy + integer(c_int), value :: maxlen_dummy + character(kind = c_char) :: paramstr_temp(len(paramstr_dummy) + 1) + integer :: paramstr_i + interface + subroutine lib_cdiParamToString(param_dummy, paramstr_dummy,& + & maxlen_dummy) bind(c, name = 'cdiParamToString') + import c_char, c_int + integer(c_int), value :: param_dummy + character(kind = c_char) :: paramstr_dummy(*) + integer(c_int), value :: maxlen_dummy + end subroutine lib_cdiParamToString + end interface + paramstr_temp(len(paramstr_dummy) + 1) = c_null_char + do paramstr_i = len(paramstr_dummy), 1, -1 + if(paramstr_dummy(paramstr_i:paramstr_i) /= ' ') exit + paramstr_temp(paramstr_i) = c_null_char + end do + do paramstr_i = paramstr_i, 1, -1 + paramstr_temp(paramstr_i) = paramstr_dummy(paramstr_i:paramstr_i) + end do + call lib_cdiParamToString(param_dummy, paramstr_temp, maxlen_dummy) + do paramstr_i = 1, len(paramstr_dummy) + if(paramstr_temp(paramstr_i) == c_null_char) exit + paramstr_dummy(paramstr_i:paramstr_i) = paramstr_temp(paramstr_i) + end do + do paramstr_i = paramstr_i, len(paramstr_dummy) + paramstr_dummy(paramstr_i:paramstr_i) = ' ' + end do + end subroutine cdiParamToString + + function cdiGetFiletype(uri_dummy, byteorder_dummy) result(f_result) + integer(c_int) :: f_result + character(kind = c_char, len = *), intent(in) :: uri_dummy + integer(c_int), intent(inout) :: byteorder_dummy + character(kind = c_char) :: uri_temp(len(uri_dummy) + 1) + integer :: uri_i + interface + function lib_cdiGetFiletype(uri_dummy, byteorder_dummy) bind(c, name =& + & 'cdiGetFiletype') result(c_result) + import c_char, c_int + integer(c_int) :: c_result + character(kind = c_char) :: uri_dummy(*) + integer(c_int), intent(inout) :: byteorder_dummy + end function lib_cdiGetFiletype + end interface + do uri_i = 1, len(uri_dummy) + uri_temp(uri_i) = uri_dummy(uri_i:uri_i) + end do + uri_temp(len(uri_dummy) + 1) = c_null_char + f_result = lib_cdiGetFiletype(uri_temp, byteorder_dummy) + end function cdiGetFiletype + + function streamOpenRead(path_dummy) result(f_result) + integer(c_int) :: f_result + character(kind = c_char, len = *), intent(in) :: path_dummy + character(kind = c_char) :: path_temp(len(path_dummy) + 1) + integer :: path_i + interface + function lib_streamOpenRead(path_dummy) bind(c, name = 'streamOpenRead')& + & result(c_result) + import c_char, c_int + integer(c_int) :: c_result + character(kind = c_char) :: path_dummy(*) + end function lib_streamOpenRead + end interface + do path_i = 1, len(path_dummy) + path_temp(path_i) = path_dummy(path_i:path_i) + end do + path_temp(len(path_dummy) + 1) = c_null_char + f_result = lib_streamOpenRead(path_temp) + end function streamOpenRead + + function streamOpenWrite(path_dummy, filetype_dummy) result(f_result) + integer(c_int) :: f_result + character(kind = c_char, len = *), intent(in) :: path_dummy + integer(c_int), value :: filetype_dummy + character(kind = c_char) :: path_temp(len(path_dummy) + 1) + integer :: path_i + interface + function lib_streamOpenWrite(path_dummy, filetype_dummy) bind(c, name =& + & 'streamOpenWrite') result(c_result) + import c_char, c_int + integer(c_int) :: c_result + character(kind = c_char) :: path_dummy(*) + integer(c_int), value :: filetype_dummy + end function lib_streamOpenWrite + end interface + do path_i = 1, len(path_dummy) + path_temp(path_i) = path_dummy(path_i:path_i) + end do + path_temp(len(path_dummy) + 1) = c_null_char + f_result = lib_streamOpenWrite(path_temp, filetype_dummy) + end function streamOpenWrite + + function streamOpenAppend(path_dummy) result(f_result) + integer(c_int) :: f_result + character(kind = c_char, len = *), intent(in) :: path_dummy + character(kind = c_char) :: path_temp(len(path_dummy) + 1) + integer :: path_i + interface + function lib_streamOpenAppend(path_dummy) bind(c, name =& + & 'streamOpenAppend') result(c_result) + import c_char, c_int + integer(c_int) :: c_result + character(kind = c_char) :: path_dummy(*) + end function lib_streamOpenAppend + end interface + do path_i = 1, len(path_dummy) + path_temp(path_i) = path_dummy(path_i:path_i) + end do + path_temp(len(path_dummy) + 1) = c_null_char + f_result = lib_streamOpenAppend(path_temp) + end function streamOpenAppend + + function streamFilename(streamID_dummy) result(f_result) + character(kind = c_char), dimension(:), pointer :: f_result + integer(c_int), value :: streamID_dummy + type(c_ptr) :: ptr + integer :: rv_shape(1) + interface + function lib_streamFilename(streamID_dummy) bind(c, name =& + & 'streamFilename') result(c_result) + import c_int, c_ptr + type(c_ptr) :: c_result + integer(c_int), value :: streamID_dummy + end function lib_streamFilename + end interface + f_result => null() + ptr = lib_streamFilename(streamID_dummy) + if(c_associated(ptr)) then + rv_shape(1) = int(lib_strlen(ptr)) + call c_f_pointer(ptr, f_result, rv_shape) + end if + end function streamFilename + + function streamFilesuffix(filetype_dummy) result(f_result) + character(kind = c_char), dimension(:), pointer :: f_result + integer(c_int), value :: filetype_dummy + type(c_ptr) :: ptr + integer :: rv_shape(1) + interface + function lib_streamFilesuffix(filetype_dummy) bind(c, name =& + & 'streamFilesuffix') result(c_result) + import c_int, c_ptr + type(c_ptr) :: c_result + integer(c_int), value :: filetype_dummy + end function lib_streamFilesuffix + end interface + f_result => null() + ptr = lib_streamFilesuffix(filetype_dummy) + if(c_associated(ptr)) then + rv_shape(1) = int(lib_strlen(ptr)) + call c_f_pointer(ptr, f_result, rv_shape) + end if + end function streamFilesuffix + + function cdiIterator_new(path_dummy) result(f_result) + type(t_CdiIterator) :: f_result + character(kind = c_char, len = *), intent(in) :: path_dummy + character(kind = c_char) :: path_temp(len(path_dummy) + 1) + integer :: path_i + interface + function lib_cdiIterator_new(path_dummy) bind(c, name =& + & 'cdiIterator_new') result(c_result) + import c_char, c_ptr + type(c_ptr) :: c_result + character(kind = c_char) :: path_dummy(*) + end function lib_cdiIterator_new + end interface + do path_i = 1, len(path_dummy) + path_temp(path_i) = path_dummy(path_i:path_i) + end do + path_temp(len(path_dummy) + 1) = c_null_char + f_result%ptr = lib_cdiIterator_new(path_temp) + end function cdiIterator_new + + function cdiIterator_clone(me_dummy) result(f_result) + type(t_CdiIterator) :: f_result + type(t_CdiIterator), intent(in) :: me_dummy + interface + function lib_cdiIterator_clone(me_dummy) bind(c, name =& + & 'cdiIterator_clone') result(c_result) + import c_ptr + type(c_ptr) :: c_result + type(c_ptr), value :: me_dummy + end function lib_cdiIterator_clone + end interface + f_result%ptr = lib_cdiIterator_clone(me_dummy%ptr) + end function cdiIterator_clone + + function cdiIterator_serialize(me_dummy) result(f_result) + character(kind = c_char), dimension(:), pointer :: f_result + type(t_CdiIterator), intent(in) :: me_dummy + type(c_ptr) :: cString + integer :: rv_shape(1) + character(kind = c_char), dimension(:), pointer :: temp + interface + function lib_cdiIterator_serialize(me_dummy) bind(c, name =& + & 'cdiIterator_serialize') result(c_result) + import c_ptr + type(c_ptr) :: c_result + type(c_ptr), value :: me_dummy + end function lib_cdiIterator_serialize + end interface + cString = lib_cdiIterator_serialize(me_dummy%ptr) + if(c_associated(cString)) then + rv_shape(1) = int(lib_strlen(cString)) + call c_f_pointer(cString, temp, rv_shape) + allocate(f_result(rv_shape(1))) + f_result = temp + call lib_free(cString) + else + f_result => null() + end if + end function cdiIterator_serialize + + function cdiIterator_deserialize(description_dummy) result(f_result) + type(t_CdiIterator) :: f_result + character(kind = c_char, len = *), intent(in) :: description_dummy + character(kind = c_char) :: description_temp(len(description_dummy) + 1) + integer :: description_i + interface + function lib_cdiIterator_deserialize(description_dummy) bind(c, name =& + & 'cdiIterator_deserialize') result(c_result) + import c_char, c_ptr + type(c_ptr) :: c_result + character(kind = c_char) :: description_dummy(*) + end function lib_cdiIterator_deserialize + end interface + do description_i = 1, len(description_dummy) + description_temp(description_i) =& + & description_dummy(description_i:description_i) + end do + description_temp(len(description_dummy) + 1) = c_null_char + f_result%ptr = lib_cdiIterator_deserialize(description_temp) + end function cdiIterator_deserialize + + subroutine cdiIterator_delete(me_dummy) + type(t_CdiIterator), intent(in) :: me_dummy + interface + subroutine lib_cdiIterator_delete(me_dummy) bind(c, name =& + & 'cdiIterator_delete') + import c_ptr + type(c_ptr), value :: me_dummy + end subroutine lib_cdiIterator_delete + end interface + call lib_cdiIterator_delete(me_dummy%ptr) + end subroutine cdiIterator_delete + + function cdiIterator_nextField(me_dummy) result(f_result) + integer(c_int) :: f_result + type(t_CdiIterator), intent(in) :: me_dummy + interface + function lib_cdiIterator_nextField(me_dummy) bind(c, name =& + & 'cdiIterator_nextField') result(c_result) + import c_int, c_ptr + integer(c_int) :: c_result + type(c_ptr), value :: me_dummy + end function lib_cdiIterator_nextField + end interface + f_result = lib_cdiIterator_nextField(me_dummy%ptr) + end function cdiIterator_nextField + + function cdiIterator_inqStartTime(me_dummy) result(f_result) + character(kind = c_char), dimension(:), pointer :: f_result + type(t_CdiIterator), intent(in) :: me_dummy + type(c_ptr) :: cString + integer :: rv_shape(1) + character(kind = c_char), dimension(:), pointer :: temp + interface + function lib_cdiIterator_inqStartTime(me_dummy) bind(c, name =& + & 'cdiIterator_inqStartTime') result(c_result) + import c_ptr + type(c_ptr) :: c_result + type(c_ptr), value :: me_dummy + end function lib_cdiIterator_inqStartTime + end interface + cString = lib_cdiIterator_inqStartTime(me_dummy%ptr) + if(c_associated(cString)) then + rv_shape(1) = int(lib_strlen(cString)) + call c_f_pointer(cString, temp, rv_shape) + allocate(f_result(rv_shape(1))) + f_result = temp + call lib_free(cString) + else + f_result => null() + end if + end function cdiIterator_inqStartTime + + function cdiIterator_inqEndTime(me_dummy) result(f_result) + character(kind = c_char), dimension(:), pointer :: f_result + type(t_CdiIterator), intent(in) :: me_dummy + type(c_ptr) :: cString + integer :: rv_shape(1) + character(kind = c_char), dimension(:), pointer :: temp + interface + function lib_cdiIterator_inqEndTime(me_dummy) bind(c, name =& + & 'cdiIterator_inqEndTime') result(c_result) + import c_ptr + type(c_ptr) :: c_result + type(c_ptr), value :: me_dummy + end function lib_cdiIterator_inqEndTime + end interface + cString = lib_cdiIterator_inqEndTime(me_dummy%ptr) + if(c_associated(cString)) then + rv_shape(1) = int(lib_strlen(cString)) + call c_f_pointer(cString, temp, rv_shape) + allocate(f_result(rv_shape(1))) + f_result = temp + call lib_free(cString) + else + f_result => null() + end if + end function cdiIterator_inqEndTime + + function cdiIterator_inqRTime(me_dummy) result(f_result) + character(kind = c_char), dimension(:), pointer :: f_result + type(t_CdiIterator), intent(in) :: me_dummy + type(c_ptr) :: cString + integer :: rv_shape(1) + character(kind = c_char), dimension(:), pointer :: temp + interface + function lib_cdiIterator_inqRTime(me_dummy) bind(c, name =& + & 'cdiIterator_inqRTime') result(c_result) + import c_ptr + type(c_ptr) :: c_result + type(c_ptr), value :: me_dummy + end function lib_cdiIterator_inqRTime + end interface + cString = lib_cdiIterator_inqRTime(me_dummy%ptr) + if(c_associated(cString)) then + rv_shape(1) = int(lib_strlen(cString)) + call c_f_pointer(cString, temp, rv_shape) + allocate(f_result(rv_shape(1))) + f_result = temp + call lib_free(cString) + else + f_result => null() + end if + end function cdiIterator_inqRTime + + function cdiIterator_inqVTime(me_dummy) result(f_result) + character(kind = c_char), dimension(:), pointer :: f_result + type(t_CdiIterator), intent(in) :: me_dummy + type(c_ptr) :: cString + integer :: rv_shape(1) + character(kind = c_char), dimension(:), pointer :: temp + interface + function lib_cdiIterator_inqVTime(me_dummy) bind(c, name =& + & 'cdiIterator_inqVTime') result(c_result) + import c_ptr + type(c_ptr) :: c_result + type(c_ptr), value :: me_dummy + end function lib_cdiIterator_inqVTime + end interface + cString = lib_cdiIterator_inqVTime(me_dummy%ptr) + if(c_associated(cString)) then + rv_shape(1) = int(lib_strlen(cString)) + call c_f_pointer(cString, temp, rv_shape) + allocate(f_result(rv_shape(1))) + f_result = temp + call lib_free(cString) + else + f_result => null() + end if + end function cdiIterator_inqVTime + + function cdiIterator_inqLevelType(me_dummy, levelSelector_dummy, outName,& + & outLongName, outStdName, outUnit) result(f_result) + integer(c_int) :: f_result + type(t_CdiIterator), intent(in) :: me_dummy + integer(c_int), value :: levelSelector_dummy + character(kind = c_char), pointer, optional, intent(inout) :: outName(:) + character(kind = c_char), pointer, optional, intent(inout) ::& + & outLongName(:) + character(kind = c_char), pointer, optional, intent(inout) :: outStdName(:) + character(kind = c_char), pointer, optional, intent(inout) :: outUnit(:) + type(c_ptr), target :: outName_cptr + type(c_ptr) :: outName_handle + integer :: outName_shape(1) + character(kind = c_char), pointer :: outName_fptr(:) + type(c_ptr), target :: outLongName_cptr + type(c_ptr) :: outLongName_handle + integer :: outLongName_shape(1) + character(kind = c_char), pointer :: outLongName_fptr(:) + type(c_ptr), target :: outStdName_cptr + type(c_ptr) :: outStdName_handle + integer :: outStdName_shape(1) + character(kind = c_char), pointer :: outStdName_fptr(:) + type(c_ptr), target :: outUnit_cptr + type(c_ptr) :: outUnit_handle + integer :: outUnit_shape(1) + character(kind = c_char), pointer :: outUnit_fptr(:) + interface + function lib_cdiIterator_inqLevelType(me_dummy, levelSelector_dummy,& + & outName, outLongName, outStdName, outUnit) bind(c, name =& + & 'cdiIterator_inqLevelType') result(c_result) + import c_int, c_ptr + integer(c_int) :: c_result + type(c_ptr), value :: me_dummy + integer(c_int), value :: levelSelector_dummy + type(c_ptr), value :: outName + type(c_ptr), value :: outLongName + type(c_ptr), value :: outStdName + type(c_ptr), value :: outUnit + end function lib_cdiIterator_inqLevelType + end interface + outName_handle = c_null_ptr + if(present(outName)) outName_handle = c_loc(outName_cptr) + outLongName_handle = c_null_ptr + if(present(outLongName)) outLongName_handle = c_loc(outLongName_cptr) + outStdName_handle = c_null_ptr + if(present(outStdName)) outStdName_handle = c_loc(outStdName_cptr) + outUnit_handle = c_null_ptr + if(present(outUnit)) outUnit_handle = c_loc(outUnit_cptr) + f_result = lib_cdiIterator_inqLevelType(me_dummy%ptr, levelSelector_dummy,& + & outName_handle, outLongName_handle, outStdName_handle, outUnit_handle) + if(present(outName)) then + if(c_associated(outName_cptr)) then + outName_shape(1) = int(lib_strlen(outName_cptr)) + call c_f_pointer(outName_cptr, outName_fptr, outName_shape) + allocate(outName(outName_shape(1))) + outName = outName_fptr + call lib_free(outName_cptr) + else + outName => null() + end if + end if + if(present(outLongName)) then + if(c_associated(outLongName_cptr)) then + outLongName_shape(1) = int(lib_strlen(outLongName_cptr)) + call c_f_pointer(outLongName_cptr, outLongName_fptr, outLongName_shape) + allocate(outLongName(outLongName_shape(1))) + outLongName = outLongName_fptr + call lib_free(outLongName_cptr) + else + outLongName => null() + end if + end if + if(present(outStdName)) then + if(c_associated(outStdName_cptr)) then + outStdName_shape(1) = int(lib_strlen(outStdName_cptr)) + call c_f_pointer(outStdName_cptr, outStdName_fptr, outStdName_shape) + allocate(outStdName(outStdName_shape(1))) + outStdName = outStdName_fptr + call lib_free(outStdName_cptr) + else + outStdName => null() + end if + end if + if(present(outUnit)) then + if(c_associated(outUnit_cptr)) then + outUnit_shape(1) = int(lib_strlen(outUnit_cptr)) + call c_f_pointer(outUnit_cptr, outUnit_fptr, outUnit_shape) + allocate(outUnit(outUnit_shape(1))) + outUnit = outUnit_fptr + call lib_free(outUnit_cptr) + else + outUnit => null() + end if + end if + end function cdiIterator_inqLevelType + + function cdiIterator_inqLevel(me_dummy, levelSelector_dummy, outValue1,& + & outValue2) result(f_result) + integer(c_int) :: f_result + type(t_CdiIterator), intent(in) :: me_dummy + integer(c_int), value :: levelSelector_dummy + real(c_double), target, optional, intent(inout) :: outValue1 + real(c_double), target, optional, intent(inout) :: outValue2 + type(c_ptr) :: outValue1_cptr + type(c_ptr) :: outValue2_cptr + interface + function lib_cdiIterator_inqLevel(me_dummy, levelSelector_dummy,& + & outValue1, outValue2) bind(c, name = 'cdiIterator_inqLevel')& + & result(c_result) + import c_int, c_ptr + integer(c_int) :: c_result + type(c_ptr), value :: me_dummy + integer(c_int), value :: levelSelector_dummy + type(c_ptr), value :: outValue1 + type(c_ptr), value :: outValue2 + end function lib_cdiIterator_inqLevel + end interface + outValue1_cptr = c_null_ptr + if(present(outValue1)) outValue1_cptr = c_loc(outValue1) + outValue2_cptr = c_null_ptr + if(present(outValue2)) outValue2_cptr = c_loc(outValue2) + f_result = lib_cdiIterator_inqLevel(me_dummy%ptr, levelSelector_dummy,& + & outValue1_cptr, outValue2_cptr) + end function cdiIterator_inqLevel + + function cdiIterator_inqLevelUuid(me_dummy, outVgridNumber, outLevelCount,& + & outUuid) result(f_result) + integer(c_int) :: f_result + type(t_CdiIterator), intent(in) :: me_dummy + integer(c_int), optional, target, intent(inout) :: outVgridNumber + integer(c_int), optional, target, intent(inout) :: outLevelCount + integer(kind = c_signed_char), target, optional, intent(inout) ::& + & outUuid(CDI_UUID_SIZE) + type(c_ptr) :: outVgridNumber_cptr + type(c_ptr) :: outLevelCount_cptr + type(c_ptr) :: outUuid_cptr + interface + function lib_cdiIterator_inqLevelUuid(me_dummy, outVgridNumber,& + & outLevelCount, outUuid) bind(c, name = 'cdiIterator_inqLevelUuid')& + & result(c_result) + import c_int, c_ptr + integer(c_int) :: c_result + type(c_ptr), value :: me_dummy + type(c_ptr), value :: outVgridNumber + type(c_ptr), value :: outLevelCount + type(c_ptr), value :: outUuid + end function lib_cdiIterator_inqLevelUuid + end interface + outVgridNumber_cptr = c_null_ptr + if(present(outVgridNumber)) outVgridNumber_cptr = c_loc(outVgridNumber) + outLevelCount_cptr = c_null_ptr + if(present(outLevelCount)) outLevelCount_cptr = c_loc(outLevelCount) + outUuid_cptr = c_null_ptr + if(present(outUuid)) outUuid_cptr = c_loc(outUuid) + f_result = lib_cdiIterator_inqLevelUuid(me_dummy%ptr, outVgridNumber_cptr,& + & outLevelCount_cptr, outUuid_cptr) + end function cdiIterator_inqLevelUuid + + function cdiIterator_inqTile(me_dummy, outTileIndex_dummy,& + & outTileAttribute_dummy) result(f_result) + integer(c_int) :: f_result + type(t_CdiIterator), intent(in) :: me_dummy + integer(c_int), intent(inout) :: outTileIndex_dummy + integer(c_int), intent(inout) :: outTileAttribute_dummy + interface + function lib_cdiIterator_inqTile(me_dummy, outTileIndex_dummy,& + & outTileAttribute_dummy) bind(c, name = 'cdiIterator_inqTile')& + & result(c_result) + import c_int, c_ptr + integer(c_int) :: c_result + type(c_ptr), value :: me_dummy + integer(c_int), intent(inout) :: outTileIndex_dummy + integer(c_int), intent(inout) :: outTileAttribute_dummy + end function lib_cdiIterator_inqTile + end interface + f_result = lib_cdiIterator_inqTile(me_dummy%ptr, outTileIndex_dummy,& + & outTileAttribute_dummy) + end function cdiIterator_inqTile + + function cdiIterator_inqTileCount(me_dummy, outTileCount_dummy,& + & outTileAttributeCount_dummy) result(f_result) + integer(c_int) :: f_result + type(t_CdiIterator), intent(in) :: me_dummy + integer(c_int), intent(inout) :: outTileCount_dummy + integer(c_int), intent(inout) :: outTileAttributeCount_dummy + interface + function lib_cdiIterator_inqTileCount(me_dummy, outTileCount_dummy,& + & outTileAttributeCount_dummy) bind(c, name = 'cdiIterator_inqTileCount')& + & result(c_result) + import c_int, c_ptr + integer(c_int) :: c_result + type(c_ptr), value :: me_dummy + integer(c_int), intent(inout) :: outTileCount_dummy + integer(c_int), intent(inout) :: outTileAttributeCount_dummy + end function lib_cdiIterator_inqTileCount + end interface + f_result = lib_cdiIterator_inqTileCount(me_dummy%ptr, outTileCount_dummy,& + & outTileAttributeCount_dummy) + end function cdiIterator_inqTileCount + + function cdiIterator_inqParam(me_dummy) result(f_result) + type(t_CdiParam) :: f_result + type(t_CdiIterator), intent(in) :: me_dummy + interface + function lib_cdiIterator_inqParam(me_dummy) bind(c, name =& + & 'cdiIterator_inqParam') result(c_result) + import c_ptr, t_CdiParam + type(t_CdiParam) :: c_result + type(c_ptr), value :: me_dummy + end function lib_cdiIterator_inqParam + end interface + f_result = lib_cdiIterator_inqParam(me_dummy%ptr) + end function cdiIterator_inqParam + + subroutine cdiIterator_inqParamParts(me_dummy, outDiscipline_dummy,& + & outCategory_dummy, outNumber_dummy) + type(t_CdiIterator), intent(in) :: me_dummy + integer(c_int), intent(inout) :: outDiscipline_dummy + integer(c_int), intent(inout) :: outCategory_dummy + integer(c_int), intent(inout) :: outNumber_dummy + interface + subroutine lib_cdiIterator_inqParamParts(me_dummy, outDiscipline_dummy,& + & outCategory_dummy, outNumber_dummy) bind(c, name =& + & 'cdiIterator_inqParamParts') + import c_int, c_ptr + type(c_ptr), value :: me_dummy + integer(c_int), intent(inout) :: outDiscipline_dummy + integer(c_int), intent(inout) :: outCategory_dummy + integer(c_int), intent(inout) :: outNumber_dummy + end subroutine lib_cdiIterator_inqParamParts + end interface + call lib_cdiIterator_inqParamParts(me_dummy%ptr, outDiscipline_dummy,& + & outCategory_dummy, outNumber_dummy) + end subroutine cdiIterator_inqParamParts + + function cdiIterator_inqDatatype(me_dummy) result(f_result) + integer(c_int) :: f_result + type(t_CdiIterator), intent(in) :: me_dummy + interface + function lib_cdiIterator_inqDatatype(me_dummy) bind(c, name =& + & 'cdiIterator_inqDatatype') result(c_result) + import c_int, c_ptr + integer(c_int) :: c_result + type(c_ptr), value :: me_dummy + end function lib_cdiIterator_inqDatatype + end interface + f_result = lib_cdiIterator_inqDatatype(me_dummy%ptr) + end function cdiIterator_inqDatatype + + function cdiIterator_inqFiletype(me_dummy) result(f_result) + integer(c_int) :: f_result + type(t_CdiIterator), intent(in) :: me_dummy + interface + function lib_cdiIterator_inqFiletype(me_dummy) bind(c, name =& + & 'cdiIterator_inqFiletype') result(c_result) + import c_int, c_ptr + integer(c_int) :: c_result + type(c_ptr), value :: me_dummy + end function lib_cdiIterator_inqFiletype + end interface + f_result = lib_cdiIterator_inqFiletype(me_dummy%ptr) + end function cdiIterator_inqFiletype + + function cdiIterator_inqTsteptype(me_dummy) result(f_result) + integer(c_int) :: f_result + type(t_CdiIterator), intent(in) :: me_dummy + interface + function lib_cdiIterator_inqTsteptype(me_dummy) bind(c, name =& + & 'cdiIterator_inqTsteptype') result(c_result) + import c_int, c_ptr + integer(c_int) :: c_result + type(c_ptr), value :: me_dummy + end function lib_cdiIterator_inqTsteptype + end interface + f_result = lib_cdiIterator_inqTsteptype(me_dummy%ptr) + end function cdiIterator_inqTsteptype + + function cdiIterator_inqVariableName(me_dummy) result(f_result) + character(kind = c_char), dimension(:), pointer :: f_result + type(t_CdiIterator), intent(in) :: me_dummy + type(c_ptr) :: cString + integer :: rv_shape(1) + character(kind = c_char), dimension(:), pointer :: temp + interface + function lib_cdiIterator_inqVariableName(me_dummy) bind(c, name =& + & 'cdiIterator_inqVariableName') result(c_result) + import c_ptr + type(c_ptr) :: c_result + type(c_ptr), value :: me_dummy + end function lib_cdiIterator_inqVariableName + end interface + cString = lib_cdiIterator_inqVariableName(me_dummy%ptr) + if(c_associated(cString)) then + rv_shape(1) = int(lib_strlen(cString)) + call c_f_pointer(cString, temp, rv_shape) + allocate(f_result(rv_shape(1))) + f_result = temp + call lib_free(cString) + else + f_result => null() + end if + end function cdiIterator_inqVariableName + + function cdiIterator_inqGridId(me_dummy) result(f_result) + integer(c_int) :: f_result + type(t_CdiIterator), intent(in) :: me_dummy + interface + function lib_cdiIterator_inqGridId(me_dummy) bind(c, name =& + & 'cdiIterator_inqGridId') result(c_result) + import c_int, c_ptr + integer(c_int) :: c_result + type(c_ptr), value :: me_dummy + end function lib_cdiIterator_inqGridId + end interface + f_result = lib_cdiIterator_inqGridId(me_dummy%ptr) + end function cdiIterator_inqGridId + + subroutine cdiIterator_readField(me_dummy, data_dummy, nmiss) + type(t_CdiIterator), intent(in) :: me_dummy + real(c_double), intent(inout) :: data_dummy(*) + integer(c_int), optional, target, intent(inout) :: nmiss + type(c_ptr) :: nmiss_cptr + interface + subroutine lib_cdiIterator_readField(me_dummy, data_dummy, nmiss) bind(c,& + & name = 'cdiIterator_readField') + import c_double, c_ptr + type(c_ptr), value :: me_dummy + real(c_double), intent(inout) :: data_dummy(*) + type(c_ptr), value :: nmiss + end subroutine lib_cdiIterator_readField + end interface + nmiss_cptr = c_null_ptr + if(present(nmiss)) nmiss_cptr = c_loc(nmiss) + call lib_cdiIterator_readField(me_dummy%ptr, data_dummy, nmiss_cptr) + end subroutine cdiIterator_readField + + subroutine cdiIterator_readFieldF(me_dummy, data_dummy, nmiss) + type(t_CdiIterator), intent(in) :: me_dummy + real(c_float), intent(inout) :: data_dummy(*) + integer(c_int), optional, target, intent(inout) :: nmiss + type(c_ptr) :: nmiss_cptr + interface + subroutine lib_cdiIterator_readFieldF(me_dummy, data_dummy, nmiss)& + & bind(c, name = 'cdiIterator_readFieldF') + import c_float, c_ptr + type(c_ptr), value :: me_dummy + real(c_float), intent(inout) :: data_dummy(*) + type(c_ptr), value :: nmiss + end subroutine lib_cdiIterator_readFieldF + end interface + nmiss_cptr = c_null_ptr + if(present(nmiss)) nmiss_cptr = c_loc(nmiss) + call lib_cdiIterator_readFieldF(me_dummy%ptr, data_dummy, nmiss_cptr) + end subroutine cdiIterator_readFieldF + + function cdiGribIterator_clone(me_dummy) result(f_result) + type(t_CdiGribIterator) :: f_result + type(t_CdiIterator), intent(in) :: me_dummy + interface + function lib_cdiGribIterator_clone(me_dummy) bind(c, name =& + & 'cdiGribIterator_clone') result(c_result) + import c_ptr + type(c_ptr) :: c_result + type(c_ptr), value :: me_dummy + end function lib_cdiGribIterator_clone + end interface + f_result%ptr = lib_cdiGribIterator_clone(me_dummy%ptr) + end function cdiGribIterator_clone + + subroutine cdiGribIterator_delete(me_dummy) + type(t_CdiGribIterator), intent(in) :: me_dummy + interface + subroutine lib_cdiGribIterator_delete(me_dummy) bind(c, name =& + & 'cdiGribIterator_delete') + import c_ptr + type(c_ptr), value :: me_dummy + end subroutine lib_cdiGribIterator_delete + end interface + call lib_cdiGribIterator_delete(me_dummy%ptr) + end subroutine cdiGribIterator_delete + + function cdiGribIterator_getLong(me_dummy, key_dummy, value_dummy)& + & result(f_result) + integer(c_int) :: f_result + type(t_CdiGribIterator), intent(in) :: me_dummy + character(kind = c_char, len = *), intent(in) :: key_dummy + integer(c_long), intent(inout) :: value_dummy + character(kind = c_char) :: key_temp(len(key_dummy) + 1) + integer :: key_i + interface + function lib_cdiGribIterator_getLong(me_dummy, key_dummy, value_dummy)& + & bind(c, name = 'cdiGribIterator_getLong') result(c_result) + import c_char, c_int, c_long, c_ptr + integer(c_int) :: c_result + type(c_ptr), value :: me_dummy + character(kind = c_char) :: key_dummy(*) + integer(c_long), intent(inout) :: value_dummy + end function lib_cdiGribIterator_getLong + end interface + do key_i = 1, len(key_dummy) + key_temp(key_i) = key_dummy(key_i:key_i) + end do + key_temp(len(key_dummy) + 1) = c_null_char + f_result = lib_cdiGribIterator_getLong(me_dummy%ptr, key_temp, value_dummy) + end function cdiGribIterator_getLong + + function cdiGribIterator_getDouble(me_dummy, key_dummy, value_dummy)& + & result(f_result) + integer(c_int) :: f_result + type(t_CdiGribIterator), intent(in) :: me_dummy + character(kind = c_char, len = *), intent(in) :: key_dummy + real(c_double), intent(inout) :: value_dummy + character(kind = c_char) :: key_temp(len(key_dummy) + 1) + integer :: key_i + interface + function lib_cdiGribIterator_getDouble(me_dummy, key_dummy, value_dummy)& + & bind(c, name = 'cdiGribIterator_getDouble') result(c_result) + import c_char, c_double, c_int, c_ptr + integer(c_int) :: c_result + type(c_ptr), value :: me_dummy + character(kind = c_char) :: key_dummy(*) + real(c_double), intent(inout) :: value_dummy + end function lib_cdiGribIterator_getDouble + end interface + do key_i = 1, len(key_dummy) + key_temp(key_i) = key_dummy(key_i:key_i) + end do + key_temp(len(key_dummy) + 1) = c_null_char + f_result = lib_cdiGribIterator_getDouble(me_dummy%ptr, key_temp,& + & value_dummy) + end function cdiGribIterator_getDouble + + function cdiGribIterator_getLength(me_dummy, key_dummy, value_dummy)& + & result(f_result) + integer(c_int) :: f_result + type(t_CdiGribIterator), intent(in) :: me_dummy + character(kind = c_char, len = *), intent(in) :: key_dummy + integer(c_size_t), intent(inout) :: value_dummy + character(kind = c_char) :: key_temp(len(key_dummy) + 1) + integer :: key_i + interface + function lib_cdiGribIterator_getLength(me_dummy, key_dummy, value_dummy)& + & bind(c, name = 'cdiGribIterator_getLength') result(c_result) + import c_char, c_int, c_ptr, c_size_t + integer(c_int) :: c_result + type(c_ptr), value :: me_dummy + character(kind = c_char) :: key_dummy(*) + integer(c_size_t), intent(inout) :: value_dummy + end function lib_cdiGribIterator_getLength + end interface + do key_i = 1, len(key_dummy) + key_temp(key_i) = key_dummy(key_i:key_i) + end do + key_temp(len(key_dummy) + 1) = c_null_char + f_result = lib_cdiGribIterator_getLength(me_dummy%ptr, key_temp,& + & value_dummy) + end function cdiGribIterator_getLength + + function cdiGribIterator_getString(me_dummy, key_dummy, value_dummy,& + & length_dummy) result(f_result) + integer(c_int) :: f_result + type(t_CdiGribIterator), intent(in) :: me_dummy + character(kind = c_char, len = *), intent(in) :: key_dummy + character(kind = c_char, len = *), intent(inout) :: value_dummy + integer(c_size_t), intent(inout) :: length_dummy + character(kind = c_char) :: key_temp(len(key_dummy) + 1) + integer :: key_i + character(kind = c_char) :: value_temp(len(value_dummy) + 1) + integer :: value_i + interface + function lib_cdiGribIterator_getString(me_dummy, key_dummy, value_dummy,& + & length_dummy) bind(c, name = 'cdiGribIterator_getString')& + & result(c_result) + import c_char, c_int, c_ptr, c_size_t + integer(c_int) :: c_result + type(c_ptr), value :: me_dummy + character(kind = c_char) :: key_dummy(*) + character(kind = c_char) :: value_dummy(*) + integer(c_size_t), intent(inout) :: length_dummy + end function lib_cdiGribIterator_getString + end interface + do key_i = 1, len(key_dummy) + key_temp(key_i) = key_dummy(key_i:key_i) + end do + key_temp(len(key_dummy) + 1) = c_null_char + value_temp(len(value_dummy) + 1) = c_null_char + do value_i = len(value_dummy), 1, -1 + if(value_dummy(value_i:value_i) /= ' ') exit + value_temp(value_i) = c_null_char + end do + do value_i = value_i, 1, -1 + value_temp(value_i) = value_dummy(value_i:value_i) + end do + f_result = lib_cdiGribIterator_getString(me_dummy%ptr, key_temp,& + & value_temp, length_dummy) + do value_i = 1, len(value_dummy) + if(value_temp(value_i) == c_null_char) exit + value_dummy(value_i:value_i) = value_temp(value_i) + end do + do value_i = value_i, len(value_dummy) + value_dummy(value_i:value_i) = ' ' + end do + end function cdiGribIterator_getString + + function cdiGribIterator_getSize(me_dummy, key_dummy, value_dummy)& + & result(f_result) + integer(c_int) :: f_result + type(t_CdiGribIterator), intent(in) :: me_dummy + character(kind = c_char, len = *), intent(in) :: key_dummy + integer(c_size_t), intent(inout) :: value_dummy + character(kind = c_char) :: key_temp(len(key_dummy) + 1) + integer :: key_i + interface + function lib_cdiGribIterator_getSize(me_dummy, key_dummy, value_dummy)& + & bind(c, name = 'cdiGribIterator_getSize') result(c_result) + import c_char, c_int, c_ptr, c_size_t + integer(c_int) :: c_result + type(c_ptr), value :: me_dummy + character(kind = c_char) :: key_dummy(*) + integer(c_size_t), intent(inout) :: value_dummy + end function lib_cdiGribIterator_getSize + end interface + do key_i = 1, len(key_dummy) + key_temp(key_i) = key_dummy(key_i:key_i) + end do + key_temp(len(key_dummy) + 1) = c_null_char + f_result = lib_cdiGribIterator_getSize(me_dummy%ptr, key_temp, value_dummy) + end function cdiGribIterator_getSize + + function cdiGribIterator_getLongArray(me_dummy, key_dummy, value_dummy,& + & array_size_dummy) result(f_result) + integer(c_int) :: f_result + type(t_CdiGribIterator), intent(in) :: me_dummy + character(kind = c_char, len = *), intent(in) :: key_dummy + integer(c_long), intent(inout) :: value_dummy + integer(c_size_t), intent(inout) :: array_size_dummy + character(kind = c_char) :: key_temp(len(key_dummy) + 1) + integer :: key_i + interface + function lib_cdiGribIterator_getLongArray(me_dummy, key_dummy,& + & value_dummy, array_size_dummy) bind(c, name =& + & 'cdiGribIterator_getLongArray') result(c_result) + import c_char, c_int, c_long, c_ptr, c_size_t + integer(c_int) :: c_result + type(c_ptr), value :: me_dummy + character(kind = c_char) :: key_dummy(*) + integer(c_long), intent(inout) :: value_dummy + integer(c_size_t), intent(inout) :: array_size_dummy + end function lib_cdiGribIterator_getLongArray + end interface + do key_i = 1, len(key_dummy) + key_temp(key_i) = key_dummy(key_i:key_i) + end do + key_temp(len(key_dummy) + 1) = c_null_char + f_result = lib_cdiGribIterator_getLongArray(me_dummy%ptr, key_temp,& + & value_dummy, array_size_dummy) + end function cdiGribIterator_getLongArray + + function cdiGribIterator_getDoubleArray(me_dummy, key_dummy, value_dummy,& + & array_size_dummy) result(f_result) + integer(c_int) :: f_result + type(t_CdiGribIterator), intent(in) :: me_dummy + character(kind = c_char, len = *), intent(in) :: key_dummy + real(c_double), intent(inout) :: value_dummy + integer(c_size_t), intent(inout) :: array_size_dummy + character(kind = c_char) :: key_temp(len(key_dummy) + 1) + integer :: key_i + interface + function lib_cdiGribIterator_getDoubleArray(me_dummy, key_dummy,& + & value_dummy, array_size_dummy) bind(c, name =& + & 'cdiGribIterator_getDoubleArray') result(c_result) + import c_char, c_double, c_int, c_ptr, c_size_t + integer(c_int) :: c_result + type(c_ptr), value :: me_dummy + character(kind = c_char) :: key_dummy(*) + real(c_double), intent(inout) :: value_dummy + integer(c_size_t), intent(inout) :: array_size_dummy + end function lib_cdiGribIterator_getDoubleArray + end interface + do key_i = 1, len(key_dummy) + key_temp(key_i) = key_dummy(key_i:key_i) + end do + key_temp(len(key_dummy) + 1) = c_null_char + f_result = lib_cdiGribIterator_getDoubleArray(me_dummy%ptr, key_temp,& + & value_dummy, array_size_dummy) + end function cdiGribIterator_getDoubleArray + + function cdiGribIterator_inqEdition(me_dummy) result(f_result) + integer(c_int) :: f_result + type(t_CdiGribIterator), intent(in) :: me_dummy + interface + function lib_cdiGribIterator_inqEdition(me_dummy) bind(c, name =& + & 'cdiGribIterator_inqEdition') result(c_result) + import c_int, c_ptr + integer(c_int) :: c_result + type(c_ptr), value :: me_dummy + end function lib_cdiGribIterator_inqEdition + end interface + f_result = lib_cdiGribIterator_inqEdition(me_dummy%ptr) + end function cdiGribIterator_inqEdition + + function cdiGribIterator_inqLongValue(me_dummy, key_dummy) result(f_result) + integer(c_long) :: f_result + type(t_CdiGribIterator), intent(in) :: me_dummy + character(kind = c_char, len = *), intent(in) :: key_dummy + character(kind = c_char) :: key_temp(len(key_dummy) + 1) + integer :: key_i + interface + function lib_cdiGribIterator_inqLongValue(me_dummy, key_dummy) bind(c,& + & name = 'cdiGribIterator_inqLongValue') result(c_result) + import c_char, c_long, c_ptr + integer(c_long) :: c_result + type(c_ptr), value :: me_dummy + character(kind = c_char) :: key_dummy(*) + end function lib_cdiGribIterator_inqLongValue + end interface + do key_i = 1, len(key_dummy) + key_temp(key_i) = key_dummy(key_i:key_i) + end do + key_temp(len(key_dummy) + 1) = c_null_char + f_result = lib_cdiGribIterator_inqLongValue(me_dummy%ptr, key_temp) + end function cdiGribIterator_inqLongValue + + function cdiGribIterator_inqLongDefaultValue(me_dummy, key_dummy,& + & defaultValue_dummy) result(f_result) + integer(c_long) :: f_result + type(t_CdiGribIterator), intent(in) :: me_dummy + character(kind = c_char, len = *), intent(in) :: key_dummy + integer(c_long), value :: defaultValue_dummy + character(kind = c_char) :: key_temp(len(key_dummy) + 1) + integer :: key_i + interface + function lib_cdiGribIterator_inqLongDefaultValue(me_dummy, key_dummy,& + & defaultValue_dummy) bind(c, name =& + & 'cdiGribIterator_inqLongDefaultValue') result(c_result) + import c_char, c_long, c_ptr + integer(c_long) :: c_result + type(c_ptr), value :: me_dummy + character(kind = c_char) :: key_dummy(*) + integer(c_long), value :: defaultValue_dummy + end function lib_cdiGribIterator_inqLongDefaultValue + end interface + do key_i = 1, len(key_dummy) + key_temp(key_i) = key_dummy(key_i:key_i) + end do + key_temp(len(key_dummy) + 1) = c_null_char + f_result = lib_cdiGribIterator_inqLongDefaultValue(me_dummy%ptr, key_temp,& + & defaultValue_dummy) + end function cdiGribIterator_inqLongDefaultValue + + function cdiGribIterator_inqDoubleValue(me_dummy, key_dummy) result(f_result) + real(c_double) :: f_result + type(t_CdiGribIterator), intent(in) :: me_dummy + character(kind = c_char, len = *), intent(in) :: key_dummy + character(kind = c_char) :: key_temp(len(key_dummy) + 1) + integer :: key_i + interface + function lib_cdiGribIterator_inqDoubleValue(me_dummy, key_dummy) bind(c,& + & name = 'cdiGribIterator_inqDoubleValue') result(c_result) + import c_char, c_double, c_ptr + real(c_double) :: c_result + type(c_ptr), value :: me_dummy + character(kind = c_char) :: key_dummy(*) + end function lib_cdiGribIterator_inqDoubleValue + end interface + do key_i = 1, len(key_dummy) + key_temp(key_i) = key_dummy(key_i:key_i) + end do + key_temp(len(key_dummy) + 1) = c_null_char + f_result = lib_cdiGribIterator_inqDoubleValue(me_dummy%ptr, key_temp) + end function cdiGribIterator_inqDoubleValue + + function cdiGribIterator_inqDoubleDefaultValue(me_dummy, key_dummy,& + & defaultValue_dummy) result(f_result) + real(c_double) :: f_result + type(t_CdiGribIterator), intent(in) :: me_dummy + character(kind = c_char, len = *), intent(in) :: key_dummy + real(c_double), value :: defaultValue_dummy + character(kind = c_char) :: key_temp(len(key_dummy) + 1) + integer :: key_i + interface + function lib_cdiGribIterator_inqDoubleDefaultValue(me_dummy, key_dummy,& + & defaultValue_dummy) bind(c, name =& + & 'cdiGribIterator_inqDoubleDefaultValue') result(c_result) + import c_char, c_double, c_ptr + real(c_double) :: c_result + type(c_ptr), value :: me_dummy + character(kind = c_char) :: key_dummy(*) + real(c_double), value :: defaultValue_dummy + end function lib_cdiGribIterator_inqDoubleDefaultValue + end interface + do key_i = 1, len(key_dummy) + key_temp(key_i) = key_dummy(key_i:key_i) + end do + key_temp(len(key_dummy) + 1) = c_null_char + f_result = lib_cdiGribIterator_inqDoubleDefaultValue(me_dummy%ptr,& + & key_temp, defaultValue_dummy) + end function cdiGribIterator_inqDoubleDefaultValue + + function cdiGribIterator_inqStringValue(me_dummy, key_dummy) result(f_result) + character(kind = c_char), dimension(:), pointer :: f_result + type(t_CdiGribIterator), intent(in) :: me_dummy + character(kind = c_char, len = *), intent(in) :: key_dummy + character(kind = c_char) :: key_temp(len(key_dummy) + 1) + integer :: key_i + type(c_ptr) :: cString + integer :: rv_shape(1) + character(kind = c_char), dimension(:), pointer :: temp + interface + function lib_cdiGribIterator_inqStringValue(me_dummy, key_dummy) bind(c,& + & name = 'cdiGribIterator_inqStringValue') result(c_result) + import c_char, c_ptr + type(c_ptr) :: c_result + type(c_ptr), value :: me_dummy + character(kind = c_char) :: key_dummy(*) + end function lib_cdiGribIterator_inqStringValue + end interface + do key_i = 1, len(key_dummy) + key_temp(key_i) = key_dummy(key_i:key_i) + end do + key_temp(len(key_dummy) + 1) = c_null_char + cString = lib_cdiGribIterator_inqStringValue(me_dummy%ptr, key_temp) + if(c_associated(cString)) then + rv_shape(1) = int(lib_strlen(cString)) + call c_f_pointer(cString, temp, rv_shape) + allocate(f_result(rv_shape(1))) + f_result = temp + call lib_free(cString) + else + f_result => null() + end if + end function cdiGribIterator_inqStringValue + + subroutine vlistDefVarName(vlistID_dummy, varID_dummy, name_dummy) + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + character(kind = c_char, len = *), intent(in) :: name_dummy + character(kind = c_char) :: name_temp(len(name_dummy) + 1) + integer :: name_i + interface + subroutine lib_vlistDefVarName(vlistID_dummy, varID_dummy, name_dummy)& + & bind(c, name = 'vlistDefVarName') + import c_char, c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + character(kind = c_char) :: name_dummy(*) + end subroutine lib_vlistDefVarName + end interface + do name_i = 1, len(name_dummy) + name_temp(name_i) = name_dummy(name_i:name_i) + end do + name_temp(len(name_dummy) + 1) = c_null_char + call lib_vlistDefVarName(vlistID_dummy, varID_dummy, name_temp) + end subroutine vlistDefVarName + + subroutine vlistInqVarName(vlistID_dummy, varID_dummy, name_dummy) + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + character(kind = c_char, len = *), intent(inout) :: name_dummy + character(kind = c_char) :: name_temp(len(name_dummy) + 1) + integer :: name_i + interface + subroutine lib_vlistInqVarName(vlistID_dummy, varID_dummy, name_dummy)& + & bind(c, name = 'vlistInqVarName') + import c_char, c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + character(kind = c_char) :: name_dummy(*) + end subroutine lib_vlistInqVarName + end interface + name_temp(len(name_dummy) + 1) = c_null_char + do name_i = len(name_dummy), 1, -1 + if(name_dummy(name_i:name_i) /= ' ') exit + name_temp(name_i) = c_null_char + end do + do name_i = name_i, 1, -1 + name_temp(name_i) = name_dummy(name_i:name_i) + end do + call lib_vlistInqVarName(vlistID_dummy, varID_dummy, name_temp) + do name_i = 1, len(name_dummy) + if(name_temp(name_i) == c_null_char) exit + name_dummy(name_i:name_i) = name_temp(name_i) + end do + do name_i = name_i, len(name_dummy) + name_dummy(name_i:name_i) = ' ' + end do + end subroutine vlistInqVarName + + function vlistCopyVarName(vlistId_dummy, varId_dummy) result(f_result) + character(kind = c_char), dimension(:), pointer :: f_result + integer(c_int), value :: vlistId_dummy + integer(c_int), value :: varId_dummy + type(c_ptr) :: cString + integer :: rv_shape(1) + character(kind = c_char), dimension(:), pointer :: temp + interface + function lib_vlistCopyVarName(vlistId_dummy, varId_dummy) bind(c, name =& + & 'vlistCopyVarName') result(c_result) + import c_int, c_ptr + type(c_ptr) :: c_result + integer(c_int), value :: vlistId_dummy + integer(c_int), value :: varId_dummy + end function lib_vlistCopyVarName + end interface + cString = lib_vlistCopyVarName(vlistId_dummy, varId_dummy) + if(c_associated(cString)) then + rv_shape(1) = int(lib_strlen(cString)) + call c_f_pointer(cString, temp, rv_shape) + allocate(f_result(rv_shape(1))) + f_result = temp + call lib_free(cString) + else + f_result => null() + end if + end function vlistCopyVarName + + subroutine vlistDefVarStdname(vlistID_dummy, varID_dummy, stdname_dummy) + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + character(kind = c_char, len = *), intent(in) :: stdname_dummy + character(kind = c_char) :: stdname_temp(len(stdname_dummy) + 1) + integer :: stdname_i + interface + subroutine lib_vlistDefVarStdname(vlistID_dummy, varID_dummy,& + & stdname_dummy) bind(c, name = 'vlistDefVarStdname') + import c_char, c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + character(kind = c_char) :: stdname_dummy(*) + end subroutine lib_vlistDefVarStdname + end interface + do stdname_i = 1, len(stdname_dummy) + stdname_temp(stdname_i) = stdname_dummy(stdname_i:stdname_i) + end do + stdname_temp(len(stdname_dummy) + 1) = c_null_char + call lib_vlistDefVarStdname(vlistID_dummy, varID_dummy, stdname_temp) + end subroutine vlistDefVarStdname + + subroutine vlistInqVarStdname(vlistID_dummy, varID_dummy, stdname_dummy) + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + character(kind = c_char, len = *), intent(inout) :: stdname_dummy + character(kind = c_char) :: stdname_temp(len(stdname_dummy) + 1) + integer :: stdname_i + interface + subroutine lib_vlistInqVarStdname(vlistID_dummy, varID_dummy,& + & stdname_dummy) bind(c, name = 'vlistInqVarStdname') + import c_char, c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + character(kind = c_char) :: stdname_dummy(*) + end subroutine lib_vlistInqVarStdname + end interface + stdname_temp(len(stdname_dummy) + 1) = c_null_char + do stdname_i = len(stdname_dummy), 1, -1 + if(stdname_dummy(stdname_i:stdname_i) /= ' ') exit + stdname_temp(stdname_i) = c_null_char + end do + do stdname_i = stdname_i, 1, -1 + stdname_temp(stdname_i) = stdname_dummy(stdname_i:stdname_i) + end do + call lib_vlistInqVarStdname(vlistID_dummy, varID_dummy, stdname_temp) + do stdname_i = 1, len(stdname_dummy) + if(stdname_temp(stdname_i) == c_null_char) exit + stdname_dummy(stdname_i:stdname_i) = stdname_temp(stdname_i) + end do + do stdname_i = stdname_i, len(stdname_dummy) + stdname_dummy(stdname_i:stdname_i) = ' ' + end do + end subroutine vlistInqVarStdname + + subroutine vlistDefVarLongname(vlistID_dummy, varID_dummy, longname_dummy) + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + character(kind = c_char, len = *), intent(in) :: longname_dummy + character(kind = c_char) :: longname_temp(len(longname_dummy) + 1) + integer :: longname_i + interface + subroutine lib_vlistDefVarLongname(vlistID_dummy, varID_dummy,& + & longname_dummy) bind(c, name = 'vlistDefVarLongname') + import c_char, c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + character(kind = c_char) :: longname_dummy(*) + end subroutine lib_vlistDefVarLongname + end interface + do longname_i = 1, len(longname_dummy) + longname_temp(longname_i) = longname_dummy(longname_i:longname_i) + end do + longname_temp(len(longname_dummy) + 1) = c_null_char + call lib_vlistDefVarLongname(vlistID_dummy, varID_dummy, longname_temp) + end subroutine vlistDefVarLongname + + subroutine vlistInqVarLongname(vlistID_dummy, varID_dummy, longname_dummy) + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + character(kind = c_char, len = *), intent(inout) :: longname_dummy + character(kind = c_char) :: longname_temp(len(longname_dummy) + 1) + integer :: longname_i + interface + subroutine lib_vlistInqVarLongname(vlistID_dummy, varID_dummy,& + & longname_dummy) bind(c, name = 'vlistInqVarLongname') + import c_char, c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + character(kind = c_char) :: longname_dummy(*) + end subroutine lib_vlistInqVarLongname + end interface + longname_temp(len(longname_dummy) + 1) = c_null_char + do longname_i = len(longname_dummy), 1, -1 + if(longname_dummy(longname_i:longname_i) /= ' ') exit + longname_temp(longname_i) = c_null_char + end do + do longname_i = longname_i, 1, -1 + longname_temp(longname_i) = longname_dummy(longname_i:longname_i) + end do + call lib_vlistInqVarLongname(vlistID_dummy, varID_dummy, longname_temp) + do longname_i = 1, len(longname_dummy) + if(longname_temp(longname_i) == c_null_char) exit + longname_dummy(longname_i:longname_i) = longname_temp(longname_i) + end do + do longname_i = longname_i, len(longname_dummy) + longname_dummy(longname_i:longname_i) = ' ' + end do + end subroutine vlistInqVarLongname + + subroutine vlistDefVarUnits(vlistID_dummy, varID_dummy, units_dummy) + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + character(kind = c_char, len = *), intent(in) :: units_dummy + character(kind = c_char) :: units_temp(len(units_dummy) + 1) + integer :: units_i + interface + subroutine lib_vlistDefVarUnits(vlistID_dummy, varID_dummy, units_dummy)& + & bind(c, name = 'vlistDefVarUnits') + import c_char, c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + character(kind = c_char) :: units_dummy(*) + end subroutine lib_vlistDefVarUnits + end interface + do units_i = 1, len(units_dummy) + units_temp(units_i) = units_dummy(units_i:units_i) + end do + units_temp(len(units_dummy) + 1) = c_null_char + call lib_vlistDefVarUnits(vlistID_dummy, varID_dummy, units_temp) + end subroutine vlistDefVarUnits + + subroutine vlistInqVarUnits(vlistID_dummy, varID_dummy, units_dummy) + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + character(kind = c_char, len = *), intent(inout) :: units_dummy + character(kind = c_char) :: units_temp(len(units_dummy) + 1) + integer :: units_i + interface + subroutine lib_vlistInqVarUnits(vlistID_dummy, varID_dummy, units_dummy)& + & bind(c, name = 'vlistInqVarUnits') + import c_char, c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + character(kind = c_char) :: units_dummy(*) + end subroutine lib_vlistInqVarUnits + end interface + units_temp(len(units_dummy) + 1) = c_null_char + do units_i = len(units_dummy), 1, -1 + if(units_dummy(units_i:units_i) /= ' ') exit + units_temp(units_i) = c_null_char + end do + do units_i = units_i, 1, -1 + units_temp(units_i) = units_dummy(units_i:units_i) + end do + call lib_vlistInqVarUnits(vlistID_dummy, varID_dummy, units_temp) + do units_i = 1, len(units_dummy) + if(units_temp(units_i) == c_null_char) exit + units_dummy(units_i:units_i) = units_temp(units_i) + end do + do units_i = units_i, len(units_dummy) + units_dummy(units_i:units_i) = ' ' + end do + end subroutine vlistInqVarUnits + + subroutine cdiDefAdditionalKey(string_dummy) + character(kind = c_char, len = *), intent(in) :: string_dummy + character(kind = c_char) :: string_temp(len(string_dummy) + 1) + integer :: string_i + interface + subroutine lib_cdiDefAdditionalKey(string_dummy) bind(c, name =& + & 'cdiDefAdditionalKey') + import c_char + character(kind = c_char) :: string_dummy(*) + end subroutine lib_cdiDefAdditionalKey + end interface + do string_i = 1, len(string_dummy) + string_temp(string_i) = string_dummy(string_i:string_i) + end do + string_temp(len(string_dummy) + 1) = c_null_char + call lib_cdiDefAdditionalKey(string_temp) + end subroutine cdiDefAdditionalKey + + subroutine vlistDefVarIntKey(vlistID_dummy, varID_dummy, name_dummy,& + & value_dummy) + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + character(kind = c_char, len = *), intent(in) :: name_dummy + integer(c_int), value :: value_dummy + character(kind = c_char) :: name_temp(len(name_dummy) + 1) + integer :: name_i + interface + subroutine lib_vlistDefVarIntKey(vlistID_dummy, varID_dummy, name_dummy,& + & value_dummy) bind(c, name = 'vlistDefVarIntKey') + import c_char, c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + character(kind = c_char) :: name_dummy(*) + integer(c_int), value :: value_dummy + end subroutine lib_vlistDefVarIntKey + end interface + do name_i = 1, len(name_dummy) + name_temp(name_i) = name_dummy(name_i:name_i) + end do + name_temp(len(name_dummy) + 1) = c_null_char + call lib_vlistDefVarIntKey(vlistID_dummy, varID_dummy, name_temp,& + & value_dummy) + end subroutine vlistDefVarIntKey + + subroutine vlistDefVarDblKey(vlistID_dummy, varID_dummy, name_dummy,& + & value_dummy) + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + character(kind = c_char, len = *), intent(in) :: name_dummy + real(c_double), value :: value_dummy + character(kind = c_char) :: name_temp(len(name_dummy) + 1) + integer :: name_i + interface + subroutine lib_vlistDefVarDblKey(vlistID_dummy, varID_dummy, name_dummy,& + & value_dummy) bind(c, name = 'vlistDefVarDblKey') + import c_char, c_double, c_int + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + character(kind = c_char) :: name_dummy(*) + real(c_double), value :: value_dummy + end subroutine lib_vlistDefVarDblKey + end interface + do name_i = 1, len(name_dummy) + name_temp(name_i) = name_dummy(name_i:name_i) + end do + name_temp(len(name_dummy) + 1) = c_null_char + call lib_vlistDefVarDblKey(vlistID_dummy, varID_dummy, name_temp,& + & value_dummy) + end subroutine vlistDefVarDblKey + + function vlistHasVarKey(vlistID_dummy, varID_dummy, name_dummy)& + & result(f_result) + integer(c_int) :: f_result + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + character(kind = c_char, len = *), intent(in) :: name_dummy + character(kind = c_char) :: name_temp(len(name_dummy) + 1) + integer :: name_i + interface + function lib_vlistHasVarKey(vlistID_dummy, varID_dummy, name_dummy)& + & bind(c, name = 'vlistHasVarKey') result(c_result) + import c_char, c_int + integer(c_int) :: c_result + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + character(kind = c_char) :: name_dummy(*) + end function lib_vlistHasVarKey + end interface + do name_i = 1, len(name_dummy) + name_temp(name_i) = name_dummy(name_i:name_i) + end do + name_temp(len(name_dummy) + 1) = c_null_char + f_result = lib_vlistHasVarKey(vlistID_dummy, varID_dummy, name_temp) + end function vlistHasVarKey + + function vlistInqVarDblKey(vlistID_dummy, varID_dummy, name_dummy)& + & result(f_result) + real(c_double) :: f_result + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + character(kind = c_char, len = *), intent(in) :: name_dummy + character(kind = c_char) :: name_temp(len(name_dummy) + 1) + integer :: name_i + interface + function lib_vlistInqVarDblKey(vlistID_dummy, varID_dummy, name_dummy)& + & bind(c, name = 'vlistInqVarDblKey') result(c_result) + import c_char, c_double, c_int + real(c_double) :: c_result + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + character(kind = c_char) :: name_dummy(*) + end function lib_vlistInqVarDblKey + end interface + do name_i = 1, len(name_dummy) + name_temp(name_i) = name_dummy(name_i:name_i) + end do + name_temp(len(name_dummy) + 1) = c_null_char + f_result = lib_vlistInqVarDblKey(vlistID_dummy, varID_dummy, name_temp) + end function vlistInqVarDblKey + + function vlistInqVarIntKey(vlistID_dummy, varID_dummy, name_dummy)& + & result(f_result) + integer(c_int) :: f_result + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + character(kind = c_char, len = *), intent(in) :: name_dummy + character(kind = c_char) :: name_temp(len(name_dummy) + 1) + integer :: name_i + interface + function lib_vlistInqVarIntKey(vlistID_dummy, varID_dummy, name_dummy)& + & bind(c, name = 'vlistInqVarIntKey') result(c_result) + import c_char, c_int + integer(c_int) :: c_result + integer(c_int), value :: vlistID_dummy + integer(c_int), value :: varID_dummy + character(kind = c_char) :: name_dummy(*) + end function lib_vlistInqVarIntKey + end interface + do name_i = 1, len(name_dummy) + name_temp(name_i) = name_dummy(name_i:name_i) + end do + name_temp(len(name_dummy) + 1) = c_null_char + f_result = lib_vlistInqVarIntKey(vlistID_dummy, varID_dummy, name_temp) + end function vlistInqVarIntKey + + function cdiInqAtt(cdiID_dummy, varID_dummy, attrnum_dummy, name_dummy,& + & typep_dummy, lenp_dummy) result(f_result) + integer(c_int) :: f_result + integer(c_int), value :: cdiID_dummy + integer(c_int), value :: varID_dummy + integer(c_int), value :: attrnum_dummy + character(kind = c_char, len = *), intent(inout) :: name_dummy + integer(c_int), intent(inout) :: typep_dummy + integer(c_int), intent(inout) :: lenp_dummy + character(kind = c_char) :: name_temp(len(name_dummy) + 1) + integer :: name_i + interface + function lib_cdiInqAtt(cdiID_dummy, varID_dummy, attrnum_dummy,& + & name_dummy, typep_dummy, lenp_dummy) bind(c, name = 'cdiInqAtt')& + & result(c_result) + import c_char, c_int + integer(c_int) :: c_result + integer(c_int), value :: cdiID_dummy + integer(c_int), value :: varID_dummy + integer(c_int), value :: attrnum_dummy + character(kind = c_char) :: name_dummy(*) + integer(c_int), intent(inout) :: typep_dummy + integer(c_int), intent(inout) :: lenp_dummy + end function lib_cdiInqAtt + end interface + name_temp(len(name_dummy) + 1) = c_null_char + do name_i = len(name_dummy), 1, -1 + if(name_dummy(name_i:name_i) /= ' ') exit + name_temp(name_i) = c_null_char + end do + do name_i = name_i, 1, -1 + name_temp(name_i) = name_dummy(name_i:name_i) + end do + f_result = lib_cdiInqAtt(cdiID_dummy, varID_dummy, attrnum_dummy,& + & name_temp, typep_dummy, lenp_dummy) + do name_i = 1, len(name_dummy) + if(name_temp(name_i) == c_null_char) exit + name_dummy(name_i:name_i) = name_temp(name_i) + end do + do name_i = name_i, len(name_dummy) + name_dummy(name_i:name_i) = ' ' + end do + end function cdiInqAtt + + function cdiInqAttLen(cdiID_dummy, varID_dummy, name_dummy) result(f_result) + integer(c_int) :: f_result + integer(c_int), value :: cdiID_dummy + integer(c_int), value :: varID_dummy + character(kind = c_char, len = *), intent(in) :: name_dummy + character(kind = c_char) :: name_temp(len(name_dummy) + 1) + integer :: name_i + interface + function lib_cdiInqAttLen(cdiID_dummy, varID_dummy, name_dummy) bind(c,& + & name = 'cdiInqAttLen') result(c_result) + import c_char, c_int + integer(c_int) :: c_result + integer(c_int), value :: cdiID_dummy + integer(c_int), value :: varID_dummy + character(kind = c_char) :: name_dummy(*) + end function lib_cdiInqAttLen + end interface + do name_i = 1, len(name_dummy) + name_temp(name_i) = name_dummy(name_i:name_i) + end do + name_temp(len(name_dummy) + 1) = c_null_char + f_result = lib_cdiInqAttLen(cdiID_dummy, varID_dummy, name_temp) + end function cdiInqAttLen + + function cdiInqAttType(cdiID_dummy, varID_dummy, name_dummy) result(f_result) + integer(c_int) :: f_result + integer(c_int), value :: cdiID_dummy + integer(c_int), value :: varID_dummy + character(kind = c_char, len = *), intent(in) :: name_dummy + character(kind = c_char) :: name_temp(len(name_dummy) + 1) + integer :: name_i + interface + function lib_cdiInqAttType(cdiID_dummy, varID_dummy, name_dummy) bind(c,& + & name = 'cdiInqAttType') result(c_result) + import c_char, c_int + integer(c_int) :: c_result + integer(c_int), value :: cdiID_dummy + integer(c_int), value :: varID_dummy + character(kind = c_char) :: name_dummy(*) + end function lib_cdiInqAttType + end interface + do name_i = 1, len(name_dummy) + name_temp(name_i) = name_dummy(name_i:name_i) + end do + name_temp(len(name_dummy) + 1) = c_null_char + f_result = lib_cdiInqAttType(cdiID_dummy, varID_dummy, name_temp) + end function cdiInqAttType + + function cdiDelAtt(cdiID_dummy, varID_dummy, name_dummy) result(f_result) + integer(c_int) :: f_result + integer(c_int), value :: cdiID_dummy + integer(c_int), value :: varID_dummy + character(kind = c_char, len = *), intent(in) :: name_dummy + character(kind = c_char) :: name_temp(len(name_dummy) + 1) + integer :: name_i + interface + function lib_cdiDelAtt(cdiID_dummy, varID_dummy, name_dummy) bind(c, name& + & = 'cdiDelAtt') result(c_result) + import c_char, c_int + integer(c_int) :: c_result + integer(c_int), value :: cdiID_dummy + integer(c_int), value :: varID_dummy + character(kind = c_char) :: name_dummy(*) + end function lib_cdiDelAtt + end interface + do name_i = 1, len(name_dummy) + name_temp(name_i) = name_dummy(name_i:name_i) + end do + name_temp(len(name_dummy) + 1) = c_null_char + f_result = lib_cdiDelAtt(cdiID_dummy, varID_dummy, name_temp) + end function cdiDelAtt + + function cdiDefAttInt(cdiID_dummy, varID_dummy, name_dummy, type_dummy,& + & len_dummy, ip_dummy) result(f_result) + integer(c_int) :: f_result + integer(c_int), value :: cdiID_dummy + integer(c_int), value :: varID_dummy + character(kind = c_char, len = *), intent(in) :: name_dummy + integer(c_int), value :: type_dummy + integer(c_int), value :: len_dummy + integer(c_int), intent(in) :: ip_dummy(*) + character(kind = c_char) :: name_temp(len(name_dummy) + 1) + integer :: name_i + interface + function lib_cdiDefAttInt(cdiID_dummy, varID_dummy, name_dummy,& + & type_dummy, len_dummy, ip_dummy) bind(c, name = 'cdiDefAttInt')& + & result(c_result) + import c_char, c_int + integer(c_int) :: c_result + integer(c_int), value :: cdiID_dummy + integer(c_int), value :: varID_dummy + character(kind = c_char) :: name_dummy(*) + integer(c_int), value :: type_dummy + integer(c_int), value :: len_dummy + integer(c_int), intent(in) :: ip_dummy(*) + end function lib_cdiDefAttInt + end interface + do name_i = 1, len(name_dummy) + name_temp(name_i) = name_dummy(name_i:name_i) + end do + name_temp(len(name_dummy) + 1) = c_null_char + f_result = lib_cdiDefAttInt(cdiID_dummy, varID_dummy, name_temp,& + & type_dummy, len_dummy, ip_dummy) + end function cdiDefAttInt + + function cdiDefAttFlt(cdiID_dummy, varID_dummy, name_dummy, type_dummy,& + & len_dummy, dp_dummy) result(f_result) + integer(c_int) :: f_result + integer(c_int), value :: cdiID_dummy + integer(c_int), value :: varID_dummy + character(kind = c_char, len = *), intent(in) :: name_dummy + integer(c_int), value :: type_dummy + integer(c_int), value :: len_dummy + real(c_double), intent(in) :: dp_dummy(*) + character(kind = c_char) :: name_temp(len(name_dummy) + 1) + integer :: name_i + interface + function lib_cdiDefAttFlt(cdiID_dummy, varID_dummy, name_dummy,& + & type_dummy, len_dummy, dp_dummy) bind(c, name = 'cdiDefAttFlt')& + & result(c_result) + import c_char, c_double, c_int + integer(c_int) :: c_result + integer(c_int), value :: cdiID_dummy + integer(c_int), value :: varID_dummy + character(kind = c_char) :: name_dummy(*) + integer(c_int), value :: type_dummy + integer(c_int), value :: len_dummy + real(c_double), intent(in) :: dp_dummy(*) + end function lib_cdiDefAttFlt + end interface + do name_i = 1, len(name_dummy) + name_temp(name_i) = name_dummy(name_i:name_i) + end do + name_temp(len(name_dummy) + 1) = c_null_char + f_result = lib_cdiDefAttFlt(cdiID_dummy, varID_dummy, name_temp,& + & type_dummy, len_dummy, dp_dummy) + end function cdiDefAttFlt + + function cdiDefAttTxt(cdiID_dummy, varID_dummy, name_dummy, len_dummy,& + & tp_cbuf_dummy) result(f_result) + integer(c_int) :: f_result + integer(c_int), value :: cdiID_dummy + integer(c_int), value :: varID_dummy + character(kind = c_char, len = *), intent(in) :: name_dummy + integer(c_int), value :: len_dummy + character(kind = c_char, len = *), intent(in) :: tp_cbuf_dummy + character(kind = c_char) :: name_temp(len(name_dummy) + 1) + integer :: name_i + character(kind = c_char) :: tp_cbuf_temp(len(tp_cbuf_dummy) + 1) + integer :: tp_cbuf_i + interface + function lib_cdiDefAttTxt(cdiID_dummy, varID_dummy, name_dummy,& + & len_dummy, tp_cbuf_dummy) bind(c, name = 'cdiDefAttTxt')& + & result(c_result) + import c_char, c_int + integer(c_int) :: c_result + integer(c_int), value :: cdiID_dummy + integer(c_int), value :: varID_dummy + character(kind = c_char) :: name_dummy(*) + integer(c_int), value :: len_dummy + character(kind = c_char) :: tp_cbuf_dummy(*) + end function lib_cdiDefAttTxt + end interface + do name_i = 1, len(name_dummy) + name_temp(name_i) = name_dummy(name_i:name_i) + end do + name_temp(len(name_dummy) + 1) = c_null_char + do tp_cbuf_i = 1, len(tp_cbuf_dummy) + tp_cbuf_temp(tp_cbuf_i) = tp_cbuf_dummy(tp_cbuf_i:tp_cbuf_i) + end do + tp_cbuf_temp(len(tp_cbuf_dummy) + 1) = c_null_char + f_result = lib_cdiDefAttTxt(cdiID_dummy, varID_dummy, name_temp, len_dummy,& + & tp_cbuf_temp) + end function cdiDefAttTxt + + function cdiInqAttInt(cdiID_dummy, varID_dummy, name_dummy, mlen_dummy,& + & ip_dummy) result(f_result) + integer(c_int) :: f_result + integer(c_int), value :: cdiID_dummy + integer(c_int), value :: varID_dummy + character(kind = c_char, len = *), intent(in) :: name_dummy + integer(c_int), value :: mlen_dummy + integer(c_int), intent(inout) :: ip_dummy(*) + character(kind = c_char) :: name_temp(len(name_dummy) + 1) + integer :: name_i + interface + function lib_cdiInqAttInt(cdiID_dummy, varID_dummy, name_dummy,& + & mlen_dummy, ip_dummy) bind(c, name = 'cdiInqAttInt') result(c_result) + import c_char, c_int + integer(c_int) :: c_result + integer(c_int), value :: cdiID_dummy + integer(c_int), value :: varID_dummy + character(kind = c_char) :: name_dummy(*) + integer(c_int), value :: mlen_dummy + integer(c_int), intent(inout) :: ip_dummy(*) + end function lib_cdiInqAttInt + end interface + do name_i = 1, len(name_dummy) + name_temp(name_i) = name_dummy(name_i:name_i) + end do + name_temp(len(name_dummy) + 1) = c_null_char + f_result = lib_cdiInqAttInt(cdiID_dummy, varID_dummy, name_temp,& + & mlen_dummy, ip_dummy) + end function cdiInqAttInt + + function cdiInqAttFlt(cdiID_dummy, varID_dummy, name_dummy, mlen_dummy,& + & dp_dummy) result(f_result) + integer(c_int) :: f_result + integer(c_int), value :: cdiID_dummy + integer(c_int), value :: varID_dummy + character(kind = c_char, len = *), intent(in) :: name_dummy + integer(c_int), value :: mlen_dummy + real(c_double), intent(inout) :: dp_dummy(*) + character(kind = c_char) :: name_temp(len(name_dummy) + 1) + integer :: name_i + interface + function lib_cdiInqAttFlt(cdiID_dummy, varID_dummy, name_dummy,& + & mlen_dummy, dp_dummy) bind(c, name = 'cdiInqAttFlt') result(c_result) + import c_char, c_double, c_int + integer(c_int) :: c_result + integer(c_int), value :: cdiID_dummy + integer(c_int), value :: varID_dummy + character(kind = c_char) :: name_dummy(*) + integer(c_int), value :: mlen_dummy + real(c_double), intent(inout) :: dp_dummy(*) + end function lib_cdiInqAttFlt + end interface + do name_i = 1, len(name_dummy) + name_temp(name_i) = name_dummy(name_i:name_i) + end do + name_temp(len(name_dummy) + 1) = c_null_char + f_result = lib_cdiInqAttFlt(cdiID_dummy, varID_dummy, name_temp,& + & mlen_dummy, dp_dummy) + end function cdiInqAttFlt + + function cdiInqAttTxt(cdiID_dummy, varID_dummy, name_dummy, mlen_dummy,& + & tp_cbuf_dummy) result(f_result) + integer(c_int) :: f_result + integer(c_int), value :: cdiID_dummy + integer(c_int), value :: varID_dummy + character(kind = c_char, len = *), intent(in) :: name_dummy + integer(c_int), value :: mlen_dummy + character(kind = c_char, len = *), intent(inout) :: tp_cbuf_dummy + character(kind = c_char) :: name_temp(len(name_dummy) + 1) + integer :: name_i + character(kind = c_char) :: tp_cbuf_temp(len(tp_cbuf_dummy) + 1) + integer :: tp_cbuf_i + interface + function lib_cdiInqAttTxt(cdiID_dummy, varID_dummy, name_dummy,& + & mlen_dummy, tp_cbuf_dummy) bind(c, name = 'cdiInqAttTxt')& + & result(c_result) + import c_char, c_int + integer(c_int) :: c_result + integer(c_int), value :: cdiID_dummy + integer(c_int), value :: varID_dummy + character(kind = c_char) :: name_dummy(*) + integer(c_int), value :: mlen_dummy + character(kind = c_char) :: tp_cbuf_dummy(*) + end function lib_cdiInqAttTxt + end interface + do name_i = 1, len(name_dummy) + name_temp(name_i) = name_dummy(name_i:name_i) + end do + name_temp(len(name_dummy) + 1) = c_null_char + tp_cbuf_temp(len(tp_cbuf_dummy) + 1) = c_null_char + do tp_cbuf_i = len(tp_cbuf_dummy), 1, -1 + if(tp_cbuf_dummy(tp_cbuf_i:tp_cbuf_i) /= ' ') exit + tp_cbuf_temp(tp_cbuf_i) = c_null_char + end do + do tp_cbuf_i = tp_cbuf_i, 1, -1 + tp_cbuf_temp(tp_cbuf_i) = tp_cbuf_dummy(tp_cbuf_i:tp_cbuf_i) + end do + f_result = lib_cdiInqAttTxt(cdiID_dummy, varID_dummy, name_temp,& + & mlen_dummy, tp_cbuf_temp) + do tp_cbuf_i = 1, len(tp_cbuf_dummy) + if(tp_cbuf_temp(tp_cbuf_i) == c_null_char) exit + tp_cbuf_dummy(tp_cbuf_i:tp_cbuf_i) = tp_cbuf_temp(tp_cbuf_i) + end do + do tp_cbuf_i = tp_cbuf_i, len(tp_cbuf_dummy) + tp_cbuf_dummy(tp_cbuf_i:tp_cbuf_i) = ' ' + end do + end function cdiInqAttTxt + + subroutine gridName(gridtype_dummy, gridname_dummy) + integer(c_int), value :: gridtype_dummy + character(kind = c_char, len = *), intent(inout) :: gridname_dummy + character(kind = c_char) :: gridname_temp(len(gridname_dummy) + 1) + integer :: gridname_i + interface + subroutine lib_gridName(gridtype_dummy, gridname_dummy) bind(c, name =& + & 'gridName') + import c_char, c_int + integer(c_int), value :: gridtype_dummy + character(kind = c_char) :: gridname_dummy(*) + end subroutine lib_gridName + end interface + gridname_temp(len(gridname_dummy) + 1) = c_null_char + do gridname_i = len(gridname_dummy), 1, -1 + if(gridname_dummy(gridname_i:gridname_i) /= ' ') exit + gridname_temp(gridname_i) = c_null_char + end do + do gridname_i = gridname_i, 1, -1 + gridname_temp(gridname_i) = gridname_dummy(gridname_i:gridname_i) + end do + call lib_gridName(gridtype_dummy, gridname_temp) + do gridname_i = 1, len(gridname_dummy) + if(gridname_temp(gridname_i) == c_null_char) exit + gridname_dummy(gridname_i:gridname_i) = gridname_temp(gridname_i) + end do + do gridname_i = gridname_i, len(gridname_dummy) + gridname_dummy(gridname_i:gridname_i) = ' ' + end do + end subroutine gridName + + function gridNamePtr(gridtype_dummy) result(f_result) + character(kind = c_char), dimension(:), pointer :: f_result + integer(c_int), value :: gridtype_dummy + type(c_ptr) :: ptr + integer :: rv_shape(1) + interface + function lib_gridNamePtr(gridtype_dummy) bind(c, name = 'gridNamePtr')& + & result(c_result) + import c_int, c_ptr + type(c_ptr) :: c_result + integer(c_int), value :: gridtype_dummy + end function lib_gridNamePtr + end interface + f_result => null() + ptr = lib_gridNamePtr(gridtype_dummy) + if(c_associated(ptr)) then + rv_shape(1) = int(lib_strlen(ptr)) + call c_f_pointer(ptr, f_result, rv_shape) + end if + end function gridNamePtr + + function cdiDefKeyString(cdiID_dummy, varID_dummy, key_dummy, string_dummy)& + & result(f_result) + integer(c_int) :: f_result + integer(c_int), value :: cdiID_dummy + integer(c_int), value :: varID_dummy + integer(c_int), value :: key_dummy + character(kind = c_char, len = *), intent(in) :: string_dummy + character(kind = c_char) :: string_temp(len(string_dummy) + 1) + integer :: string_i + interface + function lib_cdiDefKeyString(cdiID_dummy, varID_dummy, key_dummy,& + & string_dummy) bind(c, name = 'cdiDefKeyString') result(c_result) + import c_char, c_int + integer(c_int) :: c_result + integer(c_int), value :: cdiID_dummy + integer(c_int), value :: varID_dummy + integer(c_int), value :: key_dummy + character(kind = c_char) :: string_dummy(*) + end function lib_cdiDefKeyString + end interface + do string_i = 1, len(string_dummy) + string_temp(string_i) = string_dummy(string_i:string_i) + end do + string_temp(len(string_dummy) + 1) = c_null_char + f_result = lib_cdiDefKeyString(cdiID_dummy, varID_dummy, key_dummy,& + & string_temp) + end function cdiDefKeyString + + function cdiInqKeyString(cdiID_dummy, varID_dummy, key_dummy, string_dummy,& + & length_dummy) result(f_result) + integer(c_int) :: f_result + integer(c_int), value :: cdiID_dummy + integer(c_int), value :: varID_dummy + integer(c_int), value :: key_dummy + character(kind = c_char, len = *), intent(inout) :: string_dummy + integer(c_int), intent(inout) :: length_dummy + character(kind = c_char) :: string_temp(len(string_dummy) + 1) + integer :: string_i + interface + function lib_cdiInqKeyString(cdiID_dummy, varID_dummy, key_dummy,& + & string_dummy, length_dummy) bind(c, name = 'cdiInqKeyString')& + & result(c_result) + import c_char, c_int + integer(c_int) :: c_result + integer(c_int), value :: cdiID_dummy + integer(c_int), value :: varID_dummy + integer(c_int), value :: key_dummy + character(kind = c_char) :: string_dummy(*) + integer(c_int), intent(inout) :: length_dummy + end function lib_cdiInqKeyString + end interface + string_temp(len(string_dummy) + 1) = c_null_char + do string_i = len(string_dummy), 1, -1 + if(string_dummy(string_i:string_i) /= ' ') exit + string_temp(string_i) = c_null_char + end do + do string_i = string_i, 1, -1 + string_temp(string_i) = string_dummy(string_i:string_i) + end do + f_result = lib_cdiInqKeyString(cdiID_dummy, varID_dummy, key_dummy,& + & string_temp, length_dummy) + do string_i = 1, len(string_dummy) + if(string_temp(string_i) == c_null_char) exit + string_dummy(string_i:string_i) = string_temp(string_i) + end do + do string_i = string_i, len(string_dummy) + string_dummy(string_i:string_i) = ' ' + end do + end function cdiInqKeyString + + subroutine gridDefXname(gridID_dummy, xname_dummy) + integer(c_int), value :: gridID_dummy + character(kind = c_char, len = *), intent(in) :: xname_dummy + character(kind = c_char) :: xname_temp(len(xname_dummy) + 1) + integer :: xname_i + interface + subroutine lib_gridDefXname(gridID_dummy, xname_dummy) bind(c, name =& + & 'gridDefXname') + import c_char, c_int + integer(c_int), value :: gridID_dummy + character(kind = c_char) :: xname_dummy(*) + end subroutine lib_gridDefXname + end interface + do xname_i = 1, len(xname_dummy) + xname_temp(xname_i) = xname_dummy(xname_i:xname_i) + end do + xname_temp(len(xname_dummy) + 1) = c_null_char + call lib_gridDefXname(gridID_dummy, xname_temp) + end subroutine gridDefXname + + subroutine gridInqXname(gridID_dummy, xname_dummy) + integer(c_int), value :: gridID_dummy + character(kind = c_char, len = *), intent(inout) :: xname_dummy + character(kind = c_char) :: xname_temp(len(xname_dummy) + 1) + integer :: xname_i + interface + subroutine lib_gridInqXname(gridID_dummy, xname_dummy) bind(c, name =& + & 'gridInqXname') + import c_char, c_int + integer(c_int), value :: gridID_dummy + character(kind = c_char) :: xname_dummy(*) + end subroutine lib_gridInqXname + end interface + xname_temp(len(xname_dummy) + 1) = c_null_char + do xname_i = len(xname_dummy), 1, -1 + if(xname_dummy(xname_i:xname_i) /= ' ') exit + xname_temp(xname_i) = c_null_char + end do + do xname_i = xname_i, 1, -1 + xname_temp(xname_i) = xname_dummy(xname_i:xname_i) + end do + call lib_gridInqXname(gridID_dummy, xname_temp) + do xname_i = 1, len(xname_dummy) + if(xname_temp(xname_i) == c_null_char) exit + xname_dummy(xname_i:xname_i) = xname_temp(xname_i) + end do + do xname_i = xname_i, len(xname_dummy) + xname_dummy(xname_i:xname_i) = ' ' + end do + end subroutine gridInqXname + + subroutine gridDefXlongname(gridID_dummy, xlongname_dummy) + integer(c_int), value :: gridID_dummy + character(kind = c_char, len = *), intent(in) :: xlongname_dummy + character(kind = c_char) :: xlongname_temp(len(xlongname_dummy) + 1) + integer :: xlongname_i + interface + subroutine lib_gridDefXlongname(gridID_dummy, xlongname_dummy) bind(c,& + & name = 'gridDefXlongname') + import c_char, c_int + integer(c_int), value :: gridID_dummy + character(kind = c_char) :: xlongname_dummy(*) + end subroutine lib_gridDefXlongname + end interface + do xlongname_i = 1, len(xlongname_dummy) + xlongname_temp(xlongname_i) = xlongname_dummy(xlongname_i:xlongname_i) + end do + xlongname_temp(len(xlongname_dummy) + 1) = c_null_char + call lib_gridDefXlongname(gridID_dummy, xlongname_temp) + end subroutine gridDefXlongname + + subroutine gridInqXlongname(gridID_dummy, xlongname_dummy) + integer(c_int), value :: gridID_dummy + character(kind = c_char, len = *), intent(inout) :: xlongname_dummy + character(kind = c_char) :: xlongname_temp(len(xlongname_dummy) + 1) + integer :: xlongname_i + interface + subroutine lib_gridInqXlongname(gridID_dummy, xlongname_dummy) bind(c,& + & name = 'gridInqXlongname') + import c_char, c_int + integer(c_int), value :: gridID_dummy + character(kind = c_char) :: xlongname_dummy(*) + end subroutine lib_gridInqXlongname + end interface + xlongname_temp(len(xlongname_dummy) + 1) = c_null_char + do xlongname_i = len(xlongname_dummy), 1, -1 + if(xlongname_dummy(xlongname_i:xlongname_i) /= ' ') exit + xlongname_temp(xlongname_i) = c_null_char + end do + do xlongname_i = xlongname_i, 1, -1 + xlongname_temp(xlongname_i) = xlongname_dummy(xlongname_i:xlongname_i) + end do + call lib_gridInqXlongname(gridID_dummy, xlongname_temp) + do xlongname_i = 1, len(xlongname_dummy) + if(xlongname_temp(xlongname_i) == c_null_char) exit + xlongname_dummy(xlongname_i:xlongname_i) = xlongname_temp(xlongname_i) + end do + do xlongname_i = xlongname_i, len(xlongname_dummy) + xlongname_dummy(xlongname_i:xlongname_i) = ' ' + end do + end subroutine gridInqXlongname + + subroutine gridDefXunits(gridID_dummy, xunits_dummy) + integer(c_int), value :: gridID_dummy + character(kind = c_char, len = *), intent(in) :: xunits_dummy + character(kind = c_char) :: xunits_temp(len(xunits_dummy) + 1) + integer :: xunits_i + interface + subroutine lib_gridDefXunits(gridID_dummy, xunits_dummy) bind(c, name =& + & 'gridDefXunits') + import c_char, c_int + integer(c_int), value :: gridID_dummy + character(kind = c_char) :: xunits_dummy(*) + end subroutine lib_gridDefXunits + end interface + do xunits_i = 1, len(xunits_dummy) + xunits_temp(xunits_i) = xunits_dummy(xunits_i:xunits_i) + end do + xunits_temp(len(xunits_dummy) + 1) = c_null_char + call lib_gridDefXunits(gridID_dummy, xunits_temp) + end subroutine gridDefXunits + + subroutine gridInqXunits(gridID_dummy, xunits_dummy) + integer(c_int), value :: gridID_dummy + character(kind = c_char, len = *), intent(inout) :: xunits_dummy + character(kind = c_char) :: xunits_temp(len(xunits_dummy) + 1) + integer :: xunits_i + interface + subroutine lib_gridInqXunits(gridID_dummy, xunits_dummy) bind(c, name =& + & 'gridInqXunits') + import c_char, c_int + integer(c_int), value :: gridID_dummy + character(kind = c_char) :: xunits_dummy(*) + end subroutine lib_gridInqXunits + end interface + xunits_temp(len(xunits_dummy) + 1) = c_null_char + do xunits_i = len(xunits_dummy), 1, -1 + if(xunits_dummy(xunits_i:xunits_i) /= ' ') exit + xunits_temp(xunits_i) = c_null_char + end do + do xunits_i = xunits_i, 1, -1 + xunits_temp(xunits_i) = xunits_dummy(xunits_i:xunits_i) + end do + call lib_gridInqXunits(gridID_dummy, xunits_temp) + do xunits_i = 1, len(xunits_dummy) + if(xunits_temp(xunits_i) == c_null_char) exit + xunits_dummy(xunits_i:xunits_i) = xunits_temp(xunits_i) + end do + do xunits_i = xunits_i, len(xunits_dummy) + xunits_dummy(xunits_i:xunits_i) = ' ' + end do + end subroutine gridInqXunits + + subroutine gridDefYname(gridID_dummy, yname_dummy) + integer(c_int), value :: gridID_dummy + character(kind = c_char, len = *), intent(in) :: yname_dummy + character(kind = c_char) :: yname_temp(len(yname_dummy) + 1) + integer :: yname_i + interface + subroutine lib_gridDefYname(gridID_dummy, yname_dummy) bind(c, name =& + & 'gridDefYname') + import c_char, c_int + integer(c_int), value :: gridID_dummy + character(kind = c_char) :: yname_dummy(*) + end subroutine lib_gridDefYname + end interface + do yname_i = 1, len(yname_dummy) + yname_temp(yname_i) = yname_dummy(yname_i:yname_i) + end do + yname_temp(len(yname_dummy) + 1) = c_null_char + call lib_gridDefYname(gridID_dummy, yname_temp) + end subroutine gridDefYname + + subroutine gridInqYname(gridID_dummy, yname_dummy) + integer(c_int), value :: gridID_dummy + character(kind = c_char, len = *), intent(inout) :: yname_dummy + character(kind = c_char) :: yname_temp(len(yname_dummy) + 1) + integer :: yname_i + interface + subroutine lib_gridInqYname(gridID_dummy, yname_dummy) bind(c, name =& + & 'gridInqYname') + import c_char, c_int + integer(c_int), value :: gridID_dummy + character(kind = c_char) :: yname_dummy(*) + end subroutine lib_gridInqYname + end interface + yname_temp(len(yname_dummy) + 1) = c_null_char + do yname_i = len(yname_dummy), 1, -1 + if(yname_dummy(yname_i:yname_i) /= ' ') exit + yname_temp(yname_i) = c_null_char + end do + do yname_i = yname_i, 1, -1 + yname_temp(yname_i) = yname_dummy(yname_i:yname_i) + end do + call lib_gridInqYname(gridID_dummy, yname_temp) + do yname_i = 1, len(yname_dummy) + if(yname_temp(yname_i) == c_null_char) exit + yname_dummy(yname_i:yname_i) = yname_temp(yname_i) + end do + do yname_i = yname_i, len(yname_dummy) + yname_dummy(yname_i:yname_i) = ' ' + end do + end subroutine gridInqYname + + subroutine gridDefYlongname(gridID_dummy, ylongname_dummy) + integer(c_int), value :: gridID_dummy + character(kind = c_char, len = *), intent(in) :: ylongname_dummy + character(kind = c_char) :: ylongname_temp(len(ylongname_dummy) + 1) + integer :: ylongname_i + interface + subroutine lib_gridDefYlongname(gridID_dummy, ylongname_dummy) bind(c,& + & name = 'gridDefYlongname') + import c_char, c_int + integer(c_int), value :: gridID_dummy + character(kind = c_char) :: ylongname_dummy(*) + end subroutine lib_gridDefYlongname + end interface + do ylongname_i = 1, len(ylongname_dummy) + ylongname_temp(ylongname_i) = ylongname_dummy(ylongname_i:ylongname_i) + end do + ylongname_temp(len(ylongname_dummy) + 1) = c_null_char + call lib_gridDefYlongname(gridID_dummy, ylongname_temp) + end subroutine gridDefYlongname + + subroutine gridInqYlongname(gridID_dummy, ylongname_dummy) + integer(c_int), value :: gridID_dummy + character(kind = c_char, len = *), intent(inout) :: ylongname_dummy + character(kind = c_char) :: ylongname_temp(len(ylongname_dummy) + 1) + integer :: ylongname_i + interface + subroutine lib_gridInqYlongname(gridID_dummy, ylongname_dummy) bind(c,& + & name = 'gridInqYlongname') + import c_char, c_int + integer(c_int), value :: gridID_dummy + character(kind = c_char) :: ylongname_dummy(*) + end subroutine lib_gridInqYlongname + end interface + ylongname_temp(len(ylongname_dummy) + 1) = c_null_char + do ylongname_i = len(ylongname_dummy), 1, -1 + if(ylongname_dummy(ylongname_i:ylongname_i) /= ' ') exit + ylongname_temp(ylongname_i) = c_null_char + end do + do ylongname_i = ylongname_i, 1, -1 + ylongname_temp(ylongname_i) = ylongname_dummy(ylongname_i:ylongname_i) + end do + call lib_gridInqYlongname(gridID_dummy, ylongname_temp) + do ylongname_i = 1, len(ylongname_dummy) + if(ylongname_temp(ylongname_i) == c_null_char) exit + ylongname_dummy(ylongname_i:ylongname_i) = ylongname_temp(ylongname_i) + end do + do ylongname_i = ylongname_i, len(ylongname_dummy) + ylongname_dummy(ylongname_i:ylongname_i) = ' ' + end do + end subroutine gridInqYlongname + + subroutine gridDefYunits(gridID_dummy, yunits_dummy) + integer(c_int), value :: gridID_dummy + character(kind = c_char, len = *), intent(in) :: yunits_dummy + character(kind = c_char) :: yunits_temp(len(yunits_dummy) + 1) + integer :: yunits_i + interface + subroutine lib_gridDefYunits(gridID_dummy, yunits_dummy) bind(c, name =& + & 'gridDefYunits') + import c_char, c_int + integer(c_int), value :: gridID_dummy + character(kind = c_char) :: yunits_dummy(*) + end subroutine lib_gridDefYunits + end interface + do yunits_i = 1, len(yunits_dummy) + yunits_temp(yunits_i) = yunits_dummy(yunits_i:yunits_i) + end do + yunits_temp(len(yunits_dummy) + 1) = c_null_char + call lib_gridDefYunits(gridID_dummy, yunits_temp) + end subroutine gridDefYunits + + subroutine gridInqYunits(gridID_dummy, yunits_dummy) + integer(c_int), value :: gridID_dummy + character(kind = c_char, len = *), intent(inout) :: yunits_dummy + character(kind = c_char) :: yunits_temp(len(yunits_dummy) + 1) + integer :: yunits_i + interface + subroutine lib_gridInqYunits(gridID_dummy, yunits_dummy) bind(c, name =& + & 'gridInqYunits') + import c_char, c_int + integer(c_int), value :: gridID_dummy + character(kind = c_char) :: yunits_dummy(*) + end subroutine lib_gridInqYunits + end interface + yunits_temp(len(yunits_dummy) + 1) = c_null_char + do yunits_i = len(yunits_dummy), 1, -1 + if(yunits_dummy(yunits_i:yunits_i) /= ' ') exit + yunits_temp(yunits_i) = c_null_char + end do + do yunits_i = yunits_i, 1, -1 + yunits_temp(yunits_i) = yunits_dummy(yunits_i:yunits_i) + end do + call lib_gridInqYunits(gridID_dummy, yunits_temp) + do yunits_i = 1, len(yunits_dummy) + if(yunits_temp(yunits_i) == c_null_char) exit + yunits_dummy(yunits_i:yunits_i) = yunits_temp(yunits_i) + end do + do yunits_i = yunits_i, len(yunits_dummy) + yunits_dummy(yunits_i:yunits_i) = ' ' + end do + end subroutine gridInqYunits + + subroutine gridDefReference(gridID_dummy, reference_dummy) + integer(c_int), value :: gridID_dummy + character(kind = c_char, len = *), intent(in) :: reference_dummy + character(kind = c_char) :: reference_temp(len(reference_dummy) + 1) + integer :: reference_i + interface + subroutine lib_gridDefReference(gridID_dummy, reference_dummy) bind(c,& + & name = 'gridDefReference') + import c_char, c_int + integer(c_int), value :: gridID_dummy + character(kind = c_char) :: reference_dummy(*) + end subroutine lib_gridDefReference + end interface + do reference_i = 1, len(reference_dummy) + reference_temp(reference_i) = reference_dummy(reference_i:reference_i) + end do + reference_temp(len(reference_dummy) + 1) = c_null_char + call lib_gridDefReference(gridID_dummy, reference_temp) + end subroutine gridDefReference + + function gridInqReference(gridID_dummy, reference_dummy) result(f_result) + integer(c_int) :: f_result + integer(c_int), value :: gridID_dummy + character(kind = c_char, len = *), intent(inout) :: reference_dummy + character(kind = c_char) :: reference_temp(len(reference_dummy) + 1) + integer :: reference_i + interface + function lib_gridInqReference(gridID_dummy, reference_dummy) bind(c, name& + & = 'gridInqReference') result(c_result) + import c_char, c_int + integer(c_int) :: c_result + integer(c_int), value :: gridID_dummy + character(kind = c_char) :: reference_dummy(*) + end function lib_gridInqReference + end interface + reference_temp(len(reference_dummy) + 1) = c_null_char + do reference_i = len(reference_dummy), 1, -1 + if(reference_dummy(reference_i:reference_i) /= ' ') exit + reference_temp(reference_i) = c_null_char + end do + do reference_i = reference_i, 1, -1 + reference_temp(reference_i) = reference_dummy(reference_i:reference_i) + end do + f_result = lib_gridInqReference(gridID_dummy, reference_temp) + do reference_i = 1, len(reference_dummy) + if(reference_temp(reference_i) == c_null_char) exit + reference_dummy(reference_i:reference_i) = reference_temp(reference_i) + end do + do reference_i = reference_i, len(reference_dummy) + reference_dummy(reference_i:reference_i) = ' ' + end do + end function gridInqReference + + subroutine zaxisName(zaxistype_dummy, zaxisname_dummy) + integer(c_int), value :: zaxistype_dummy + character(kind = c_char, len = *), intent(inout) :: zaxisname_dummy + character(kind = c_char) :: zaxisname_temp(len(zaxisname_dummy) + 1) + integer :: zaxisname_i + interface + subroutine lib_zaxisName(zaxistype_dummy, zaxisname_dummy) bind(c, name =& + & 'zaxisName') + import c_char, c_int + integer(c_int), value :: zaxistype_dummy + character(kind = c_char) :: zaxisname_dummy(*) + end subroutine lib_zaxisName + end interface + zaxisname_temp(len(zaxisname_dummy) + 1) = c_null_char + do zaxisname_i = len(zaxisname_dummy), 1, -1 + if(zaxisname_dummy(zaxisname_i:zaxisname_i) /= ' ') exit + zaxisname_temp(zaxisname_i) = c_null_char + end do + do zaxisname_i = zaxisname_i, 1, -1 + zaxisname_temp(zaxisname_i) = zaxisname_dummy(zaxisname_i:zaxisname_i) + end do + call lib_zaxisName(zaxistype_dummy, zaxisname_temp) + do zaxisname_i = 1, len(zaxisname_dummy) + if(zaxisname_temp(zaxisname_i) == c_null_char) exit + zaxisname_dummy(zaxisname_i:zaxisname_i) = zaxisname_temp(zaxisname_i) + end do + do zaxisname_i = zaxisname_i, len(zaxisname_dummy) + zaxisname_dummy(zaxisname_i:zaxisname_i) = ' ' + end do + end subroutine zaxisName + + function zaxisNamePtr(leveltype_dummy) result(f_result) + character(kind = c_char), dimension(:), pointer :: f_result + integer(c_int), value :: leveltype_dummy + type(c_ptr) :: ptr + integer :: rv_shape(1) + interface + function lib_zaxisNamePtr(leveltype_dummy) bind(c, name = 'zaxisNamePtr')& + & result(c_result) + import c_int, c_ptr + type(c_ptr) :: c_result + integer(c_int), value :: leveltype_dummy + end function lib_zaxisNamePtr + end interface + f_result => null() + ptr = lib_zaxisNamePtr(leveltype_dummy) + if(c_associated(ptr)) then + rv_shape(1) = int(lib_strlen(ptr)) + call c_f_pointer(ptr, f_result, rv_shape) + end if + end function zaxisNamePtr + + subroutine zaxisDefName(zaxisID_dummy, name) + integer(c_int), value :: zaxisID_dummy + character(kind = c_char, len = *), optional, intent(in) :: name + character(kind = c_char), allocatable, target :: name_temp(:) + integer :: name_i + type(c_ptr) :: name_cptr + interface + subroutine lib_zaxisDefName(zaxisID_dummy, name) bind(c, name =& + & 'zaxisDefName') + import c_int, c_ptr + integer(c_int), value :: zaxisID_dummy + type(c_ptr), value :: name + end subroutine lib_zaxisDefName + end interface + if (present(name)) then + allocate(name_temp(len(name) + 1)) + name_temp(len(name) + 1) = c_null_char + do name_i = len(name), 1, -1 + if(name(name_i:name_i) /= ' ') exit + name_temp(name_i) = c_null_char + end do + do name_i = name_i, 1, -1 + name_temp(name_i) = name(name_i:name_i) + end do + name_cptr = c_loc(name_temp) + else + name_cptr = c_null_ptr + end if + call lib_zaxisDefName(zaxisID_dummy, name_cptr) + end subroutine zaxisDefName + + subroutine zaxisInqName(zaxisID_dummy, name_dummy) + integer(c_int), value :: zaxisID_dummy + character(kind = c_char, len = *), intent(inout) :: name_dummy + character(kind = c_char) :: name_temp(len(name_dummy) + 1) + integer :: name_i + interface + subroutine lib_zaxisInqName(zaxisID_dummy, name_dummy) bind(c, name =& + & 'zaxisInqName') + import c_char, c_int + integer(c_int), value :: zaxisID_dummy + character(kind = c_char) :: name_dummy(*) + end subroutine lib_zaxisInqName + end interface + name_temp(len(name_dummy) + 1) = c_null_char + do name_i = len(name_dummy), 1, -1 + if(name_dummy(name_i:name_i) /= ' ') exit + name_temp(name_i) = c_null_char + end do + do name_i = name_i, 1, -1 + name_temp(name_i) = name_dummy(name_i:name_i) + end do + call lib_zaxisInqName(zaxisID_dummy, name_temp) + do name_i = 1, len(name_dummy) + if(name_temp(name_i) == c_null_char) exit + name_dummy(name_i:name_i) = name_temp(name_i) + end do + do name_i = name_i, len(name_dummy) + name_dummy(name_i:name_i) = ' ' + end do + end subroutine zaxisInqName + + subroutine zaxisDefLongname(zaxisID_dummy, longname) + integer(c_int), value :: zaxisID_dummy + character(kind = c_char, len = *), optional, intent(in) :: longname + character(kind = c_char), allocatable, target :: longname_temp(:) + integer :: longname_i + type(c_ptr) :: longname_cptr + interface + subroutine lib_zaxisDefLongname(zaxisID_dummy, longname) bind(c, name =& + & 'zaxisDefLongname') + import c_int, c_ptr + integer(c_int), value :: zaxisID_dummy + type(c_ptr), value :: longname + end subroutine lib_zaxisDefLongname + end interface + if (present(longname)) then + allocate(longname_temp(len(longname) + 1)) + longname_temp(len(longname) + 1) = c_null_char + do longname_i = len(longname), 1, -1 + if(longname(longname_i:longname_i) /= ' ') exit + longname_temp(longname_i) = c_null_char + end do + do longname_i = longname_i, 1, -1 + longname_temp(longname_i) = longname(longname_i:longname_i) + end do + longname_cptr = c_loc(longname_temp) + else + longname_cptr = c_null_ptr + end if + call lib_zaxisDefLongname(zaxisID_dummy, longname_cptr) + end subroutine zaxisDefLongname + + subroutine zaxisInqLongname(zaxisID_dummy, longname_dummy) + integer(c_int), value :: zaxisID_dummy + character(kind = c_char, len = *), intent(inout) :: longname_dummy + character(kind = c_char) :: longname_temp(len(longname_dummy) + 1) + integer :: longname_i + interface + subroutine lib_zaxisInqLongname(zaxisID_dummy, longname_dummy) bind(c,& + & name = 'zaxisInqLongname') + import c_char, c_int + integer(c_int), value :: zaxisID_dummy + character(kind = c_char) :: longname_dummy(*) + end subroutine lib_zaxisInqLongname + end interface + longname_temp(len(longname_dummy) + 1) = c_null_char + do longname_i = len(longname_dummy), 1, -1 + if(longname_dummy(longname_i:longname_i) /= ' ') exit + longname_temp(longname_i) = c_null_char + end do + do longname_i = longname_i, 1, -1 + longname_temp(longname_i) = longname_dummy(longname_i:longname_i) + end do + call lib_zaxisInqLongname(zaxisID_dummy, longname_temp) + do longname_i = 1, len(longname_dummy) + if(longname_temp(longname_i) == c_null_char) exit + longname_dummy(longname_i:longname_i) = longname_temp(longname_i) + end do + do longname_i = longname_i, len(longname_dummy) + longname_dummy(longname_i:longname_i) = ' ' + end do + end subroutine zaxisInqLongname + + subroutine zaxisDefUnits(zaxisID_dummy, units) + integer(c_int), value :: zaxisID_dummy + character(kind = c_char, len = *), optional, intent(in) :: units + character(kind = c_char), allocatable, target :: units_temp(:) + integer :: units_i + type(c_ptr) :: units_cptr + interface + subroutine lib_zaxisDefUnits(zaxisID_dummy, units) bind(c, name =& + & 'zaxisDefUnits') + import c_int, c_ptr + integer(c_int), value :: zaxisID_dummy + type(c_ptr), value :: units + end subroutine lib_zaxisDefUnits + end interface + if (present(units)) then + allocate(units_temp(len(units) + 1)) + units_temp(len(units) + 1) = c_null_char + do units_i = len(units), 1, -1 + if(units(units_i:units_i) /= ' ') exit + units_temp(units_i) = c_null_char + end do + do units_i = units_i, 1, -1 + units_temp(units_i) = units(units_i:units_i) + end do + units_cptr = c_loc(units_temp) + else + units_cptr = c_null_ptr + end if + call lib_zaxisDefUnits(zaxisID_dummy, units_cptr) + end subroutine zaxisDefUnits + + subroutine zaxisInqUnits(zaxisID_dummy, units_dummy) + integer(c_int), value :: zaxisID_dummy + character(kind = c_char, len = *), intent(inout) :: units_dummy + character(kind = c_char) :: units_temp(len(units_dummy) + 1) + integer :: units_i + interface + subroutine lib_zaxisInqUnits(zaxisID_dummy, units_dummy) bind(c, name =& + & 'zaxisInqUnits') + import c_char, c_int + integer(c_int), value :: zaxisID_dummy + character(kind = c_char) :: units_dummy(*) + end subroutine lib_zaxisInqUnits + end interface + units_temp(len(units_dummy) + 1) = c_null_char + do units_i = len(units_dummy), 1, -1 + if(units_dummy(units_i:units_i) /= ' ') exit + units_temp(units_i) = c_null_char + end do + do units_i = units_i, 1, -1 + units_temp(units_i) = units_dummy(units_i:units_i) + end do + call lib_zaxisInqUnits(zaxisID_dummy, units_temp) + do units_i = 1, len(units_dummy) + if(units_temp(units_i) == c_null_char) exit + units_dummy(units_i:units_i) = units_temp(units_i) + end do + do units_i = units_i, len(units_dummy) + units_dummy(units_i:units_i) = ' ' + end do + end subroutine zaxisInqUnits + + subroutine zaxisInqStdname(zaxisID_dummy, stdname_dummy) + integer(c_int), value :: zaxisID_dummy + character(kind = c_char, len = *), intent(inout) :: stdname_dummy + character(kind = c_char) :: stdname_temp(len(stdname_dummy) + 1) + integer :: stdname_i + interface + subroutine lib_zaxisInqStdname(zaxisID_dummy, stdname_dummy) bind(c, name& + & = 'zaxisInqStdname') + import c_char, c_int + integer(c_int), value :: zaxisID_dummy + character(kind = c_char) :: stdname_dummy(*) + end subroutine lib_zaxisInqStdname + end interface + stdname_temp(len(stdname_dummy) + 1) = c_null_char + do stdname_i = len(stdname_dummy), 1, -1 + if(stdname_dummy(stdname_i:stdname_i) /= ' ') exit + stdname_temp(stdname_i) = c_null_char + end do + do stdname_i = stdname_i, 1, -1 + stdname_temp(stdname_i) = stdname_dummy(stdname_i:stdname_i) + end do + call lib_zaxisInqStdname(zaxisID_dummy, stdname_temp) + do stdname_i = 1, len(stdname_dummy) + if(stdname_temp(stdname_i) == c_null_char) exit + stdname_dummy(stdname_i:stdname_i) = stdname_temp(stdname_i) + end do + do stdname_i = stdname_i, len(stdname_dummy) + stdname_dummy(stdname_i:stdname_i) = ' ' + end do + end subroutine zaxisInqStdname + + function zaxisInqLbounds(zaxisID_dummy, lbounds) result(f_result) + integer(c_int) :: f_result + integer(c_int), value :: zaxisID_dummy + real(c_double), target, optional, intent(inout) :: lbounds(*) + type(c_ptr) :: lbounds_cptr + interface + function lib_zaxisInqLbounds(zaxisID_dummy, lbounds) bind(c, name =& + & 'zaxisInqLbounds') result(c_result) + import c_int, c_ptr + integer(c_int) :: c_result + integer(c_int), value :: zaxisID_dummy + type(c_ptr), value :: lbounds + end function lib_zaxisInqLbounds + end interface + lbounds_cptr = c_null_ptr + if(present(lbounds)) lbounds_cptr = c_loc(lbounds) + f_result = lib_zaxisInqLbounds(zaxisID_dummy, lbounds_cptr) + end function zaxisInqLbounds + + function zaxisInqUbounds(zaxisID_dummy, ubounds) result(f_result) + integer(c_int) :: f_result + integer(c_int), value :: zaxisID_dummy + real(c_double), target, optional, intent(inout) :: ubounds(*) + type(c_ptr) :: ubounds_cptr + interface + function lib_zaxisInqUbounds(zaxisID_dummy, ubounds) bind(c, name =& + & 'zaxisInqUbounds') result(c_result) + import c_int, c_ptr + integer(c_int) :: c_result + integer(c_int), value :: zaxisID_dummy + type(c_ptr), value :: ubounds + end function lib_zaxisInqUbounds + end interface + ubounds_cptr = c_null_ptr + if(present(ubounds)) ubounds_cptr = c_loc(ubounds) + f_result = lib_zaxisInqUbounds(zaxisID_dummy, ubounds_cptr) + end function zaxisInqUbounds + + function zaxisInqWeights(zaxisID_dummy, weights) result(f_result) + integer(c_int) :: f_result + integer(c_int), value :: zaxisID_dummy + real(c_double), target, optional, intent(inout) :: weights(*) + type(c_ptr) :: weights_cptr + interface + function lib_zaxisInqWeights(zaxisID_dummy, weights) bind(c, name =& + & 'zaxisInqWeights') result(c_result) + import c_int, c_ptr + integer(c_int) :: c_result + integer(c_int), value :: zaxisID_dummy + type(c_ptr), value :: weights + end function lib_zaxisInqWeights + end interface + weights_cptr = c_null_ptr + if(present(weights)) weights_cptr = c_loc(weights) + f_result = lib_zaxisInqWeights(zaxisID_dummy, weights_cptr) + end function zaxisInqWeights + + function taxisNamePtr(taxisID_dummy) result(f_result) + character(kind = c_char), dimension(:), pointer :: f_result + integer(c_int), value :: taxisID_dummy + type(c_ptr) :: ptr + integer :: rv_shape(1) + interface + function lib_taxisNamePtr(taxisID_dummy) bind(c, name = 'taxisNamePtr')& + & result(c_result) + import c_int, c_ptr + type(c_ptr) :: c_result + integer(c_int), value :: taxisID_dummy + end function lib_taxisNamePtr + end interface + f_result => null() + ptr = lib_taxisNamePtr(taxisID_dummy) + if(c_associated(ptr)) then + rv_shape(1) = int(lib_strlen(ptr)) + call c_f_pointer(ptr, f_result, rv_shape) + end if + end function taxisNamePtr + + function tunitNamePtr(tunitID_dummy) result(f_result) + character(kind = c_char), dimension(:), pointer :: f_result + integer(c_int), value :: tunitID_dummy + type(c_ptr) :: ptr + integer :: rv_shape(1) + interface + function lib_tunitNamePtr(tunitID_dummy) bind(c, name = 'tunitNamePtr')& + & result(c_result) + import c_int, c_ptr + type(c_ptr) :: c_result + integer(c_int), value :: tunitID_dummy + end function lib_tunitNamePtr + end interface + f_result => null() + ptr = lib_tunitNamePtr(tunitID_dummy) + if(c_associated(ptr)) then + rv_shape(1) = int(lib_strlen(ptr)) + call c_f_pointer(ptr, f_result, rv_shape) + end if + end function tunitNamePtr + + function institutDef(center_dummy, subcenter_dummy, name_dummy,& + & longname_dummy) result(f_result) + integer(c_int) :: f_result + integer(c_int), value :: center_dummy + integer(c_int), value :: subcenter_dummy + character(kind = c_char, len = *), intent(in) :: name_dummy + character(kind = c_char, len = *), intent(in) :: longname_dummy + character(kind = c_char) :: name_temp(len(name_dummy) + 1) + integer :: name_i + character(kind = c_char) :: longname_temp(len(longname_dummy) + 1) + integer :: longname_i + interface + function lib_institutDef(center_dummy, subcenter_dummy, name_dummy,& + & longname_dummy) bind(c, name = 'institutDef') result(c_result) + import c_char, c_int + integer(c_int) :: c_result + integer(c_int), value :: center_dummy + integer(c_int), value :: subcenter_dummy + character(kind = c_char) :: name_dummy(*) + character(kind = c_char) :: longname_dummy(*) + end function lib_institutDef + end interface + do name_i = 1, len(name_dummy) + name_temp(name_i) = name_dummy(name_i:name_i) + end do + name_temp(len(name_dummy) + 1) = c_null_char + do longname_i = 1, len(longname_dummy) + longname_temp(longname_i) = longname_dummy(longname_i:longname_i) + end do + longname_temp(len(longname_dummy) + 1) = c_null_char + f_result = lib_institutDef(center_dummy, subcenter_dummy, name_temp,& + & longname_temp) + end function institutDef + + function institutInq(center_dummy, subcenter_dummy, name_dummy,& + & longname_dummy) result(f_result) + integer(c_int) :: f_result + integer(c_int), value :: center_dummy + integer(c_int), value :: subcenter_dummy + character(kind = c_char, len = *), intent(in) :: name_dummy + character(kind = c_char, len = *), intent(in) :: longname_dummy + character(kind = c_char) :: name_temp(len(name_dummy) + 1) + integer :: name_i + character(kind = c_char) :: longname_temp(len(longname_dummy) + 1) + integer :: longname_i + interface + function lib_institutInq(center_dummy, subcenter_dummy, name_dummy,& + & longname_dummy) bind(c, name = 'institutInq') result(c_result) + import c_char, c_int + integer(c_int) :: c_result + integer(c_int), value :: center_dummy + integer(c_int), value :: subcenter_dummy + character(kind = c_char) :: name_dummy(*) + character(kind = c_char) :: longname_dummy(*) + end function lib_institutInq + end interface + do name_i = 1, len(name_dummy) + name_temp(name_i) = name_dummy(name_i:name_i) + end do + name_temp(len(name_dummy) + 1) = c_null_char + do longname_i = 1, len(longname_dummy) + longname_temp(longname_i) = longname_dummy(longname_i:longname_i) + end do + longname_temp(len(longname_dummy) + 1) = c_null_char + f_result = lib_institutInq(center_dummy, subcenter_dummy, name_temp,& + & longname_temp) + end function institutInq + + function institutInqNamePtr(instID_dummy) result(f_result) + character(kind = c_char), dimension(:), pointer :: f_result + integer(c_int), value :: instID_dummy + type(c_ptr) :: ptr + integer :: rv_shape(1) + interface + function lib_institutInqNamePtr(instID_dummy) bind(c, name =& + & 'institutInqNamePtr') result(c_result) + import c_int, c_ptr + type(c_ptr) :: c_result + integer(c_int), value :: instID_dummy + end function lib_institutInqNamePtr + end interface + f_result => null() + ptr = lib_institutInqNamePtr(instID_dummy) + if(c_associated(ptr)) then + rv_shape(1) = int(lib_strlen(ptr)) + call c_f_pointer(ptr, f_result, rv_shape) + end if + end function institutInqNamePtr + + function institutInqLongnamePtr(instID_dummy) result(f_result) + character(kind = c_char), dimension(:), pointer :: f_result + integer(c_int), value :: instID_dummy + type(c_ptr) :: ptr + integer :: rv_shape(1) + interface + function lib_institutInqLongnamePtr(instID_dummy) bind(c, name =& + & 'institutInqLongnamePtr') result(c_result) + import c_int, c_ptr + type(c_ptr) :: c_result + integer(c_int), value :: instID_dummy + end function lib_institutInqLongnamePtr + end interface + f_result => null() + ptr = lib_institutInqLongnamePtr(instID_dummy) + if(c_associated(ptr)) then + rv_shape(1) = int(lib_strlen(ptr)) + call c_f_pointer(ptr, f_result, rv_shape) + end if + end function institutInqLongnamePtr + + function modelDef(instID_dummy, modelgribID_dummy, name_dummy)& + & result(f_result) + integer(c_int) :: f_result + integer(c_int), value :: instID_dummy + integer(c_int), value :: modelgribID_dummy + character(kind = c_char, len = *), intent(in) :: name_dummy + character(kind = c_char) :: name_temp(len(name_dummy) + 1) + integer :: name_i + interface + function lib_modelDef(instID_dummy, modelgribID_dummy, name_dummy)& + & bind(c, name = 'modelDef') result(c_result) + import c_char, c_int + integer(c_int) :: c_result + integer(c_int), value :: instID_dummy + integer(c_int), value :: modelgribID_dummy + character(kind = c_char) :: name_dummy(*) + end function lib_modelDef + end interface + do name_i = 1, len(name_dummy) + name_temp(name_i) = name_dummy(name_i:name_i) + end do + name_temp(len(name_dummy) + 1) = c_null_char + f_result = lib_modelDef(instID_dummy, modelgribID_dummy, name_temp) + end function modelDef + + function modelInq(instID_dummy, modelgribID_dummy, name_dummy)& + & result(f_result) + integer(c_int) :: f_result + integer(c_int), value :: instID_dummy + integer(c_int), value :: modelgribID_dummy + character(kind = c_char, len = *), intent(in) :: name_dummy + character(kind = c_char) :: name_temp(len(name_dummy) + 1) + integer :: name_i + interface + function lib_modelInq(instID_dummy, modelgribID_dummy, name_dummy)& + & bind(c, name = 'modelInq') result(c_result) + import c_char, c_int + integer(c_int) :: c_result + integer(c_int), value :: instID_dummy + integer(c_int), value :: modelgribID_dummy + character(kind = c_char) :: name_dummy(*) + end function lib_modelInq + end interface + do name_i = 1, len(name_dummy) + name_temp(name_i) = name_dummy(name_i:name_i) + end do + name_temp(len(name_dummy) + 1) = c_null_char + f_result = lib_modelInq(instID_dummy, modelgribID_dummy, name_temp) + end function modelInq + + function modelInqNamePtr(modelID_dummy) result(f_result) + character(kind = c_char), dimension(:), pointer :: f_result + integer(c_int), value :: modelID_dummy + type(c_ptr) :: ptr + integer :: rv_shape(1) + interface + function lib_modelInqNamePtr(modelID_dummy) bind(c, name =& + & 'modelInqNamePtr') result(c_result) + import c_int, c_ptr + type(c_ptr) :: c_result + integer(c_int), value :: modelID_dummy + end function lib_modelInqNamePtr + end interface + f_result => null() + ptr = lib_modelInqNamePtr(modelID_dummy) + if(c_associated(ptr)) then + rv_shape(1) = int(lib_strlen(ptr)) + call c_f_pointer(ptr, f_result, rv_shape) + end if + end function modelInqNamePtr + + subroutine tableWrite(filename_dummy, tableID_dummy) + character(kind = c_char, len = *), intent(in) :: filename_dummy + integer(c_int), value :: tableID_dummy + character(kind = c_char) :: filename_temp(len(filename_dummy) + 1) + integer :: filename_i + interface + subroutine lib_tableWrite(filename_dummy, tableID_dummy) bind(c, name =& + & 'tableWrite') + import c_char, c_int + character(kind = c_char) :: filename_dummy(*) + integer(c_int), value :: tableID_dummy + end subroutine lib_tableWrite + end interface + do filename_i = 1, len(filename_dummy) + filename_temp(filename_i) = filename_dummy(filename_i:filename_i) + end do + filename_temp(len(filename_dummy) + 1) = c_null_char + call lib_tableWrite(filename_temp, tableID_dummy) + end subroutine tableWrite + + function tableRead(tablefile_dummy) result(f_result) + integer(c_int) :: f_result + character(kind = c_char, len = *), intent(in) :: tablefile_dummy + character(kind = c_char) :: tablefile_temp(len(tablefile_dummy) + 1) + integer :: tablefile_i + interface + function lib_tableRead(tablefile_dummy) bind(c, name = 'tableRead')& + & result(c_result) + import c_char, c_int + integer(c_int) :: c_result + character(kind = c_char) :: tablefile_dummy(*) + end function lib_tableRead + end interface + do tablefile_i = 1, len(tablefile_dummy) + tablefile_temp(tablefile_i) = tablefile_dummy(tablefile_i:tablefile_i) + end do + tablefile_temp(len(tablefile_dummy) + 1) = c_null_char + f_result = lib_tableRead(tablefile_temp) + end function tableRead + + function tableDef(modelID_dummy, tablenum_dummy, tablename_dummy)& + & result(f_result) + integer(c_int) :: f_result + integer(c_int), value :: modelID_dummy + integer(c_int), value :: tablenum_dummy + character(kind = c_char, len = *), intent(in) :: tablename_dummy + character(kind = c_char) :: tablename_temp(len(tablename_dummy) + 1) + integer :: tablename_i + interface + function lib_tableDef(modelID_dummy, tablenum_dummy, tablename_dummy)& + & bind(c, name = 'tableDef') result(c_result) + import c_char, c_int + integer(c_int) :: c_result + integer(c_int), value :: modelID_dummy + integer(c_int), value :: tablenum_dummy + character(kind = c_char) :: tablename_dummy(*) + end function lib_tableDef + end interface + do tablename_i = 1, len(tablename_dummy) + tablename_temp(tablename_i) = tablename_dummy(tablename_i:tablename_i) + end do + tablename_temp(len(tablename_dummy) + 1) = c_null_char + f_result = lib_tableDef(modelID_dummy, tablenum_dummy, tablename_temp) + end function tableDef + + function tableInqNamePtr(tableID_dummy) result(f_result) + character(kind = c_char), dimension(:), pointer :: f_result + integer(c_int), value :: tableID_dummy + type(c_ptr) :: ptr + integer :: rv_shape(1) + interface + function lib_tableInqNamePtr(tableID_dummy) bind(c, name =& + & 'tableInqNamePtr') result(c_result) + import c_int, c_ptr + type(c_ptr) :: c_result + integer(c_int), value :: tableID_dummy + end function lib_tableInqNamePtr + end interface + f_result => null() + ptr = lib_tableInqNamePtr(tableID_dummy) + if(c_associated(ptr)) then + rv_shape(1) = int(lib_strlen(ptr)) + call c_f_pointer(ptr, f_result, rv_shape) + end if + end function tableInqNamePtr + + function tableInq(modelID_dummy, tablenum_dummy, tablename_dummy)& + & result(f_result) + integer(c_int) :: f_result + integer(c_int), value :: modelID_dummy + integer(c_int), value :: tablenum_dummy + character(kind = c_char, len = *), intent(in) :: tablename_dummy + character(kind = c_char) :: tablename_temp(len(tablename_dummy) + 1) + integer :: tablename_i + interface + function lib_tableInq(modelID_dummy, tablenum_dummy, tablename_dummy)& + & bind(c, name = 'tableInq') result(c_result) + import c_char, c_int + integer(c_int) :: c_result + integer(c_int), value :: modelID_dummy + integer(c_int), value :: tablenum_dummy + character(kind = c_char) :: tablename_dummy(*) + end function lib_tableInq + end interface + do tablename_i = 1, len(tablename_dummy) + tablename_temp(tablename_i) = tablename_dummy(tablename_i:tablename_i) + end do + tablename_temp(len(tablename_dummy) + 1) = c_null_char + f_result = lib_tableInq(modelID_dummy, tablenum_dummy, tablename_temp) + end function tableInq + + subroutine tableInqEntry(tableID_dummy, id_dummy, ltype_dummy, name_dummy,& + & longname_dummy, units_dummy) + integer(c_int), value :: tableID_dummy + integer(c_int), value :: id_dummy + integer(c_int), value :: ltype_dummy + character(kind = c_char, len = *), intent(inout) :: name_dummy + character(kind = c_char, len = *), intent(inout) :: longname_dummy + character(kind = c_char, len = *), intent(inout) :: units_dummy + character(kind = c_char) :: name_temp(len(name_dummy) + 1) + integer :: name_i + character(kind = c_char) :: longname_temp(len(longname_dummy) + 1) + integer :: longname_i + character(kind = c_char) :: units_temp(len(units_dummy) + 1) + integer :: units_i + interface + subroutine lib_tableInqEntry(tableID_dummy, id_dummy, ltype_dummy,& + & name_dummy, longname_dummy, units_dummy) bind(c, name =& + & 'tableInqEntry') + import c_char, c_int + integer(c_int), value :: tableID_dummy + integer(c_int), value :: id_dummy + integer(c_int), value :: ltype_dummy + character(kind = c_char) :: name_dummy(*) + character(kind = c_char) :: longname_dummy(*) + character(kind = c_char) :: units_dummy(*) + end subroutine lib_tableInqEntry + end interface + name_temp(len(name_dummy) + 1) = c_null_char + do name_i = len(name_dummy), 1, -1 + if(name_dummy(name_i:name_i) /= ' ') exit + name_temp(name_i) = c_null_char + end do + do name_i = name_i, 1, -1 + name_temp(name_i) = name_dummy(name_i:name_i) + end do + longname_temp(len(longname_dummy) + 1) = c_null_char + do longname_i = len(longname_dummy), 1, -1 + if(longname_dummy(longname_i:longname_i) /= ' ') exit + longname_temp(longname_i) = c_null_char + end do + do longname_i = longname_i, 1, -1 + longname_temp(longname_i) = longname_dummy(longname_i:longname_i) + end do + units_temp(len(units_dummy) + 1) = c_null_char + do units_i = len(units_dummy), 1, -1 + if(units_dummy(units_i:units_i) /= ' ') exit + units_temp(units_i) = c_null_char + end do + do units_i = units_i, 1, -1 + units_temp(units_i) = units_dummy(units_i:units_i) + end do + call lib_tableInqEntry(tableID_dummy, id_dummy, ltype_dummy, name_temp,& + & longname_temp, units_temp) + do name_i = 1, len(name_dummy) + if(name_temp(name_i) == c_null_char) exit + name_dummy(name_i:name_i) = name_temp(name_i) + end do + do name_i = name_i, len(name_dummy) + name_dummy(name_i:name_i) = ' ' + end do + do longname_i = 1, len(longname_dummy) + if(longname_temp(longname_i) == c_null_char) exit + longname_dummy(longname_i:longname_i) = longname_temp(longname_i) + end do + do longname_i = longname_i, len(longname_dummy) + longname_dummy(longname_i:longname_i) = ' ' + end do + do units_i = 1, len(units_dummy) + if(units_temp(units_i) == c_null_char) exit + units_dummy(units_i:units_i) = units_temp(units_i) + end do + do units_i = units_i, len(units_dummy) + units_dummy(units_i:units_i) = ' ' + end do + end subroutine tableInqEntry + + function subtypeInqAttribute(subtypeID_dummy, index_dummy, key_dummy,& + & outValue_dummy) result(f_result) + integer(c_int) :: f_result + integer(c_int), value :: subtypeID_dummy + integer(c_int), value :: index_dummy + character(kind = c_char, len = *), intent(in) :: key_dummy + integer(c_int), intent(inout) :: outValue_dummy + character(kind = c_char) :: key_temp(len(key_dummy) + 1) + integer :: key_i + interface + function lib_subtypeInqAttribute(subtypeID_dummy, index_dummy, key_dummy,& + & outValue_dummy) bind(c, name = 'subtypeInqAttribute') result(c_result) + import c_char, c_int + integer(c_int) :: c_result + integer(c_int), value :: subtypeID_dummy + integer(c_int), value :: index_dummy + character(kind = c_char) :: key_dummy(*) + integer(c_int), intent(inout) :: outValue_dummy + end function lib_subtypeInqAttribute + end interface + do key_i = 1, len(key_dummy) + key_temp(key_i) = key_dummy(key_i:key_i) + end do + key_temp(len(key_dummy) + 1) = c_null_char + f_result = lib_subtypeInqAttribute(subtypeID_dummy, index_dummy, key_temp,& + & outValue_dummy) + end function subtypeInqAttribute + +end module mo_cdi diff --git a/tests/Makefile.in b/tests/Makefile.in new file mode 100644 index 0000000000000000000000000000000000000000..670712ed9fc9f0c8ef4fd566e31b9f3b9fed4503 --- /dev/null +++ b/tests/Makefile.in @@ -0,0 +1,1680 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 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@ + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +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@ +TESTS = calendar_test1$(EXEEXT) cksum_verify$(EXEEXT) pio_write.run \ + pio_write_deco2d.run test_byteswap.run test_cdf_const.run \ + test_cdf_transformation.run test_cksum_ext.run \ + test_cksum_grb.run test_cksum_grb2.run test_cksum_ieg.run \ + test_cksum_nc.run test_cksum_nc2.run test_cksum_nc4.run \ + test_cksum_nc_chunk.run test_cksum_srv.run test_f2003.run \ + test_grib.run test_month_adjust$(EXEEXT) \ + test_resource_copy.run test_table.run pio_cksum_asynch.run \ + pio_cksum_fpguard.run pio_cksum_grb2.run \ + pio_cksum_mpi_fw_at_all.run pio_cksum_mpi_fw_at_reblock.run \ + pio_cksum_mpi_fw_ordered.run pio_cksum_mpinonb.run \ + pio_cksum_nc.run pio_cksum_nc2.run pio_cksum_nc4.run \ + pio_cksum_writer.run pio_write.parallel.run \ + pio_write_deco2d.parallel.run pio_write_dist_array.run \ + test_resource_copy.parallel.run +@ENABLE_NETCDF_TRUE@am__append_1 = \ +@ENABLE_NETCDF_TRUE@ test_cdf_read \ +@ENABLE_NETCDF_TRUE@ test_cdf_write + +@ENABLE_MPI_TRUE@am__append_2 = \ +@ENABLE_MPI_TRUE@ pio_write.parallel \ +@ENABLE_MPI_TRUE@ pio_write_deco2d.parallel \ +@ENABLE_MPI_TRUE@ test_resource_copy.parallel + +@with_on_demand_check_programs_TRUE@check_PROGRAMS = $(am__EXEEXT_3) +@with_on_demand_check_programs_FALSE@noinst_PROGRAMS = \ +@with_on_demand_check_programs_FALSE@ $(am__EXEEXT_3) +@ENABLE_ALL_STATIC_TRUE@am__append_3 = -all-static +subdir = tests +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = \ + $(top_srcdir)/m4/acx_assert_lang_is_fortran_variant.m4 \ + $(top_srcdir)/m4/acx_c_package.m4 \ + $(top_srcdir)/m4/acx_cfortran_flags.m4 \ + $(top_srcdir)/m4/acx_check_cfortran.m4 \ + $(top_srcdir)/m4/acx_check_strptr_convert.m4 \ + $(top_srcdir)/m4/acx_execinfo.m4 \ + $(top_srcdir)/m4/acx_fortran_check_include.m4 \ + $(top_srcdir)/m4/acx_fortran_include_flag.m4 \ + $(top_srcdir)/m4/acx_fortran_package.m4 \ + $(top_srcdir)/m4/acx_lang_check_include.m4 \ + $(top_srcdir)/m4/acx_lang_package.m4 \ + $(top_srcdir)/m4/acx_lt_problems.m4 \ + $(top_srcdir)/m4/acx_m4_list_to_quoted_strings.m4 \ + $(top_srcdir)/m4/acx_mpirun.m4 $(top_srcdir)/m4/acx_mv_obj.m4 \ + $(top_srcdir)/m4/acx_option_search_libs.m4 \ + $(top_srcdir)/m4/acx_options.m4 \ + $(top_srcdir)/m4/acx_prog_cc_posix.m4 \ + $(top_srcdir)/m4/acx_sl_fc_mod_path_flag.m4 \ + $(top_srcdir)/m4/acx_sl_mod_suffix.m4 \ + $(top_srcdir)/m4/acx_tls_xlc_retry.m4 \ + $(top_srcdir)/m4/acx_use_libtool_configuration.m4 \ + $(top_srcdir)/m4/acx_uuid.m4 $(top_srcdir)/m4/asx_tr_arg.m4 \ + $(top_srcdir)/m4/asx_unset.m4 $(top_srcdir)/m4/ax_pthread.m4 \ + $(top_srcdir)/m4/ax_python_devel.m4 $(top_srcdir)/m4/ax_tls.m4 \ + $(top_srcdir)/m4/kpse_libtool.m4 $(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/pkg.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/m4/ac_lang_program_fortran.m4 \ + $(top_srcdir)/m4/acx_lang_fortran_check_include.m4 \ + $(top_srcdir)/m4/acx_lang_c_check_include.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/src/config.h +CONFIG_CLEAN_FILES = test_cksum_base pio_cksum_asynch.run \ + pio_cksum_fpguard.run pio_cksum_grb2.run \ + pio_cksum_mpi_fw_at_all.run pio_cksum_mpi_fw_at_reblock.run \ + pio_cksum_mpi_fw_ordered.run pio_cksum_mpinonb.run \ + pio_cksum_nc.run pio_cksum_nc2.run pio_cksum_nc4.run \ + pio_cksum_writer.run pio_write.parallel.run pio_write.run \ + pio_write_deco2d.parallel.run pio_write_deco2d.run \ + pio_write_dist_array.run test_byteswap.run test_cdf_const.run \ + test_cdf_transformation.run test_cksum_ext.run \ + test_cksum_grb.run test_cksum_grb2.run test_cksum_ieg.run \ + test_cksum_nc.run test_cksum_nc2.run test_cksum_nc4.run \ + test_cksum_nc_chunk.run test_cksum_srv.run test_f2003.run \ + test_grib.run test_resource_copy.parallel.run \ + test_resource_copy.run test_table.run +CONFIG_CLEAN_VPATH_FILES = +@ENABLE_NETCDF_TRUE@am__EXEEXT_1 = test_cdf_read$(EXEEXT) \ +@ENABLE_NETCDF_TRUE@ test_cdf_write$(EXEEXT) +@ENABLE_MPI_TRUE@am__EXEEXT_2 = pio_write.parallel$(EXEEXT) \ +@ENABLE_MPI_TRUE@ pio_write_deco2d.parallel$(EXEEXT) \ +@ENABLE_MPI_TRUE@ test_resource_copy.parallel$(EXEEXT) +am__EXEEXT_3 = calendar_test1$(EXEEXT) cksum_read$(EXEEXT) \ + cksum_verify$(EXEEXT) cksum_write$(EXEEXT) \ + cksum_write_chunk$(EXEEXT) pio_write$(EXEEXT) \ + pio_write_deco2d$(EXEEXT) test_byteswap$(EXEEXT) \ + test_grib$(EXEEXT) test_month_adjust$(EXEEXT) \ + test_resource_copy$(EXEEXT) test_table$(EXEEXT) \ + $(am__EXEEXT_1) $(am__EXEEXT_2) +PROGRAMS = $(noinst_PROGRAMS) +am_calendar_test1_OBJECTS = calendar_test1.$(OBJEXT) +calendar_test1_OBJECTS = $(am_calendar_test1_OBJECTS) +calendar_test1_LDADD = $(LDADD) +calendar_test1_DEPENDENCIES = $(top_builddir)/src/libcdi.la +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_cksum_read_OBJECTS = cksum_read.$(OBJEXT) \ + ensure_array_size.$(OBJEXT) stream_cksum.$(OBJEXT) \ + var_cksum.$(OBJEXT) +cksum_read_OBJECTS = $(am_cksum_read_OBJECTS) +cksum_read_LDADD = $(LDADD) +cksum_read_DEPENDENCIES = $(top_builddir)/src/libcdi.la +am_cksum_verify_OBJECTS = cksum_verify.$(OBJEXT) +cksum_verify_OBJECTS = $(am_cksum_verify_OBJECTS) +cksum_verify_LDADD = $(LDADD) +cksum_verify_DEPENDENCIES = $(top_builddir)/src/libcdi.la +am_cksum_write_OBJECTS = cksum_write.$(OBJEXT) \ + simple_model_helper.$(OBJEXT) +cksum_write_OBJECTS = $(am_cksum_write_OBJECTS) +cksum_write_LDADD = $(LDADD) +cksum_write_DEPENDENCIES = $(top_builddir)/src/libcdi.la +am_cksum_write_chunk_OBJECTS = cksum_write_chunk.$(OBJEXT) \ + simple_model_helper.$(OBJEXT) +cksum_write_chunk_OBJECTS = $(am_cksum_write_chunk_OBJECTS) +cksum_write_chunk_LDADD = $(LDADD) +cksum_write_chunk_DEPENDENCIES = $(top_builddir)/src/libcdi.la +am_pio_write_OBJECTS = pio_write.$(OBJEXT) \ + pio_write_setup_grid.$(OBJEXT) simple_model.$(OBJEXT) \ + simple_model_helper.$(OBJEXT) +pio_write_OBJECTS = $(am_pio_write_OBJECTS) +pio_write_LDADD = $(LDADD) +pio_write_DEPENDENCIES = $(top_builddir)/src/libcdi.la +am__objects_1 = pio_write.parallel.$(OBJEXT) \ + pio_write_setup_grid.parallel.$(OBJEXT) \ + simple_model.parallel.$(OBJEXT) \ + simple_model_helper.parallel.$(OBJEXT) +nodist_pio_write_parallel_OBJECTS = $(am__objects_1) +pio_write_parallel_OBJECTS = $(nodist_pio_write_parallel_OBJECTS) +am__DEPENDENCIES_1 = +pio_write_parallel_DEPENDENCIES = $(top_builddir)/src/libcdipio.la \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) $(LDADD) +am_pio_write_deco2d_OBJECTS = deco2d_model.$(OBJEXT) \ + pio_write.$(OBJEXT) pio_write_setup_grid.$(OBJEXT) \ + simple_model_helper.$(OBJEXT) +pio_write_deco2d_OBJECTS = $(am_pio_write_deco2d_OBJECTS) +pio_write_deco2d_LDADD = $(LDADD) +pio_write_deco2d_DEPENDENCIES = $(top_builddir)/src/libcdi.la +am__objects_2 = deco2d_model.parallel.$(OBJEXT) \ + pio_write.parallel.$(OBJEXT) \ + pio_write_setup_grid.parallel.$(OBJEXT) \ + simple_model_helper.parallel.$(OBJEXT) +nodist_pio_write_deco2d_parallel_OBJECTS = $(am__objects_2) +pio_write_deco2d_parallel_OBJECTS = \ + $(nodist_pio_write_deco2d_parallel_OBJECTS) +pio_write_deco2d_parallel_DEPENDENCIES = \ + $(top_builddir)/src/libcdipio.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(LDADD) +am_test_byteswap_OBJECTS = test_byteswap.$(OBJEXT) +test_byteswap_OBJECTS = $(am_test_byteswap_OBJECTS) +test_byteswap_LDADD = $(LDADD) +test_byteswap_DEPENDENCIES = $(top_builddir)/src/libcdi.la +am_test_cdf_read_OBJECTS = test_cdf_read.$(OBJEXT) +test_cdf_read_OBJECTS = $(am_test_cdf_read_OBJECTS) +test_cdf_read_LDADD = $(LDADD) +test_cdf_read_DEPENDENCIES = $(top_builddir)/src/libcdi.la +am_test_cdf_write_OBJECTS = simple_model_helper.$(OBJEXT) \ + test_cdf_write.$(OBJEXT) +test_cdf_write_OBJECTS = $(am_test_cdf_write_OBJECTS) +test_cdf_write_LDADD = $(LDADD) +test_cdf_write_DEPENDENCIES = $(top_builddir)/src/libcdi.la +am_test_grib_OBJECTS = test_grib.$(OBJEXT) +test_grib_OBJECTS = $(am_test_grib_OBJECTS) +test_grib_LDADD = $(LDADD) +test_grib_DEPENDENCIES = $(top_builddir)/src/libcdi.la +am_test_month_adjust_OBJECTS = test_month_adjust.$(OBJEXT) +test_month_adjust_OBJECTS = $(am_test_month_adjust_OBJECTS) +test_month_adjust_LDADD = $(LDADD) +test_month_adjust_DEPENDENCIES = $(top_builddir)/src/libcdi.la +am_test_resource_copy_OBJECTS = test_resource_copy.$(OBJEXT) +test_resource_copy_OBJECTS = $(am_test_resource_copy_OBJECTS) +test_resource_copy_DEPENDENCIES = \ + $(top_builddir)/src/libcdiresunpack.la +am__objects_3 = test_resource_copy.parallel.$(OBJEXT) +nodist_test_resource_copy_parallel_OBJECTS = $(am__objects_3) +test_resource_copy_parallel_OBJECTS = \ + $(nodist_test_resource_copy_parallel_OBJECTS) +test_resource_copy_parallel_DEPENDENCIES = \ + $(top_builddir)/src/libcdipio.la $(LDADD) +am_test_table_OBJECTS = test_table.$(OBJEXT) +test_table_OBJECTS = $(am_test_table_OBJECTS) +test_table_LDADD = $(LDADD) +test_table_DEPENDENCIES = $(top_builddir)/src/libcdi.la +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)/src +depcomp = $(SHELL) $(top_srcdir)/config/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/calendar_test1.Po \ + ./$(DEPDIR)/cksum_read.Po ./$(DEPDIR)/cksum_verify.Po \ + ./$(DEPDIR)/cksum_write.Po ./$(DEPDIR)/cksum_write_chunk.Po \ + ./$(DEPDIR)/deco2d_model.Po \ + ./$(DEPDIR)/deco2d_model.parallel.Po \ + ./$(DEPDIR)/ensure_array_size.Po ./$(DEPDIR)/pio_write.Po \ + ./$(DEPDIR)/pio_write.parallel.Po \ + ./$(DEPDIR)/pio_write_setup_grid.Po \ + ./$(DEPDIR)/pio_write_setup_grid.parallel.Po \ + ./$(DEPDIR)/simple_model.Po \ + ./$(DEPDIR)/simple_model.parallel.Po \ + ./$(DEPDIR)/simple_model_helper.Po \ + ./$(DEPDIR)/simple_model_helper.parallel.Po \ + ./$(DEPDIR)/stream_cksum.Po ./$(DEPDIR)/test_byteswap.Po \ + ./$(DEPDIR)/test_cdf_read.Po ./$(DEPDIR)/test_cdf_write.Po \ + ./$(DEPDIR)/test_grib.Po ./$(DEPDIR)/test_month_adjust.Po \ + ./$(DEPDIR)/test_resource_copy.Po \ + ./$(DEPDIR)/test_resource_copy.parallel.Po \ + ./$(DEPDIR)/test_table.Po ./$(DEPDIR)/var_cksum.Po +am__mv = mv -f +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 = $(calendar_test1_SOURCES) $(cksum_read_SOURCES) \ + $(cksum_verify_SOURCES) $(cksum_write_SOURCES) \ + $(cksum_write_chunk_SOURCES) $(pio_write_SOURCES) \ + $(nodist_pio_write_parallel_SOURCES) \ + $(pio_write_deco2d_SOURCES) \ + $(nodist_pio_write_deco2d_parallel_SOURCES) \ + $(test_byteswap_SOURCES) $(test_cdf_read_SOURCES) \ + $(test_cdf_write_SOURCES) $(test_grib_SOURCES) \ + $(test_month_adjust_SOURCES) $(test_resource_copy_SOURCES) \ + $(nodist_test_resource_copy_parallel_SOURCES) \ + $(test_table_SOURCES) +DIST_SOURCES = $(calendar_test1_SOURCES) $(cksum_read_SOURCES) \ + $(cksum_verify_SOURCES) $(cksum_write_SOURCES) \ + $(cksum_write_chunk_SOURCES) $(pio_write_SOURCES) \ + $(pio_write_deco2d_SOURCES) $(test_byteswap_SOURCES) \ + $(test_cdf_read_SOURCES) $(test_cdf_write_SOURCES) \ + $(test_grib_SOURCES) $(test_month_adjust_SOURCES) \ + $(test_resource_copy_SOURCES) $(test_table_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__extra_recursive_targets = examples-recursive +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)` +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='[0;31m'; \ + grn='[0;32m'; \ + lgn='[1;32m'; \ + blu='[1;34m'; \ + mgn='[0;35m'; \ + brg='[1m'; \ + std='[m'; \ + 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` +AM_TESTSUITE_SUMMARY_HEADER = ' for $(PACKAGE_STRING)' +RECHECK_LOGS = $(TEST_LOGS) +AM_RECURSIVE_TARGETS = check recheck +TEST_SUITE_LOG = test-suite.log +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:.run.log=.log) +RUN_LOG_DRIVER = $(SHELL) $(top_srcdir)/config/test-driver +RUN_LOG_COMPILE = $(RUN_LOG_COMPILER) $(AM_RUN_LOG_FLAGS) \ + $(RUN_LOG_FLAGS) +am__DIST_COMMON = $(srcdir)/Makefile.in \ + $(srcdir)/pio_cksum_asynch.run.in \ + $(srcdir)/pio_cksum_fpguard.run.in \ + $(srcdir)/pio_cksum_grb2.run.in \ + $(srcdir)/pio_cksum_mpi_fw_at_all.run.in \ + $(srcdir)/pio_cksum_mpi_fw_at_reblock.run.in \ + $(srcdir)/pio_cksum_mpi_fw_ordered.run.in \ + $(srcdir)/pio_cksum_mpinonb.run.in \ + $(srcdir)/pio_cksum_nc.run.in $(srcdir)/pio_cksum_nc2.run.in \ + $(srcdir)/pio_cksum_nc4.run.in \ + $(srcdir)/pio_cksum_writer.run.in \ + $(srcdir)/pio_write.parallel.run.in $(srcdir)/pio_write.run.in \ + $(srcdir)/pio_write_deco2d.parallel.run.in \ + $(srcdir)/pio_write_deco2d.run.in \ + $(srcdir)/pio_write_dist_array.run.in \ + $(srcdir)/test_byteswap.run.in $(srcdir)/test_cdf_const.run.in \ + $(srcdir)/test_cdf_transformation.run.in \ + $(srcdir)/test_cksum_base.in $(srcdir)/test_cksum_ext.run.in \ + $(srcdir)/test_cksum_grb.run.in \ + $(srcdir)/test_cksum_grb2.run.in \ + $(srcdir)/test_cksum_ieg.run.in $(srcdir)/test_cksum_nc.run.in \ + $(srcdir)/test_cksum_nc2.run.in \ + $(srcdir)/test_cksum_nc4.run.in \ + $(srcdir)/test_cksum_nc_chunk.run.in \ + $(srcdir)/test_cksum_srv.run.in $(srcdir)/test_f2003.run.in \ + $(srcdir)/test_grib.run.in \ + $(srcdir)/test_resource_copy.parallel.run.in \ + $(srcdir)/test_resource_copy.run.in \ + $(srcdir)/test_table.run.in $(top_srcdir)/config/depcomp \ + $(top_srcdir)/config/test-driver +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@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DCE_UUIDROOT = @DCE_UUIDROOT@ +DCE_UUID_C_INCLUDE = @DCE_UUID_C_INCLUDE@ +DCE_UUID_C_LIB = @DCE_UUID_C_LIB@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECCODES_INCLUDE = @ECCODES_INCLUDE@ +ECCODES_LIBS = @ECCODES_LIBS@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ENABLE_ACROSS = @ENABLE_ACROSS@ +ENABLE_CDI_LIB = @ENABLE_CDI_LIB@ +ENABLE_CGRIBEX = @ENABLE_CGRIBEX@ +ENABLE_EXTRA = @ENABLE_EXTRA@ +ENABLE_GRIB = @ENABLE_GRIB@ +ENABLE_IEG = @ENABLE_IEG@ +ENABLE_MPI = @ENABLE_MPI@ +ENABLE_NC2 = @ENABLE_NC2@ +ENABLE_NC4 = @ENABLE_NC4@ +ENABLE_NC4HDF5 = @ENABLE_NC4HDF5@ +ENABLE_NC4SZLIB = @ENABLE_NC4SZLIB@ +ENABLE_NETCDF = @ENABLE_NETCDF@ +ENABLE_SERVICE = @ENABLE_SERVICE@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FC = @FC@ +FCFLAGS = @FCFLAGS@ +FCFLAGS_f90 = @FCFLAGS_f90@ +FCMODCASE = @FCMODCASE@ +FCMODEXT = @FCMODEXT@ +FC_DEFINE = @FC_DEFINE@ +FC_MOD_FLAG = @FC_MOD_FLAG@ +FC_OPTINC = @FC_OPTINC@ +FDB5_INCLUDE = @FDB5_INCLUDE@ +FDB5_LIBS = @FDB5_LIBS@ +FFLAGS = @FFLAGS@ +FGREP = @FGREP@ +GREP = @GREP@ +GRIB_API_INCLUDE = @GRIB_API_INCLUDE@ +GRIB_API_LIBS = @GRIB_API_LIBS@ +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@ +LIBRT = @LIBRT@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +MPIROOT = @MPIROOT@ +MPI_C_INCLUDE = @MPI_C_INCLUDE@ +MPI_C_LIB = @MPI_C_LIB@ +MPI_FC_LIB = @MPI_FC_LIB@ +MPI_FC_MOD = @MPI_FC_MOD@ +MPI_LAUNCH = @MPI_LAUNCH@ +NC_CONFIG = @NC_CONFIG@ +NETCDF_INCLUDE = @NETCDF_INCLUDE@ +NETCDF_LIBS = @NETCDF_LIBS@ +NETCDF_ROOT = @NETCDF_ROOT@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OPENMP_CFLAGS = @OPENMP_CFLAGS@ +OSSP_UUIDROOT = @OSSP_UUIDROOT@ +OSSP_UUID_C_INCLUDE = @OSSP_UUID_C_INCLUDE@ +OSSP_UUID_C_LIB = @OSSP_UUID_C_LIB@ +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@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PPM_CORE_C_INCLUDE = @PPM_CORE_C_INCLUDE@ +PPM_CORE_C_LIB = @PPM_CORE_C_LIB@ +PTHREAD_CC = @PTHREAD_CC@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +PYTHON = @PYTHON@ +PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ +PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ +PYTHON_LIBS = @PYTHON_LIBS@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PLATFORM_SITE_PKG = @PYTHON_PLATFORM_SITE_PKG@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +RUBY = @RUBY@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +SWIG = @SWIG@ +SYSTEM_TYPE = @SYSTEM_TYPE@ +SZLIB_INCLUDE = @SZLIB_INCLUDE@ +SZLIB_LIBS = @SZLIB_LIBS@ +THREADS_INCLUDE = @THREADS_INCLUDE@ +THREADS_LIBS = @THREADS_LIBS@ +UTIL_LINUX_UUIDROOT = @UTIL_LINUX_UUIDROOT@ +UTIL_LINUX_UUID_C_INCLUDE = @UTIL_LINUX_UUID_C_INCLUDE@ +UTIL_LINUX_UUID_C_LIB = @UTIL_LINUX_UUID_C_LIB@ +UUID_C_INCLUDE = @UUID_C_INCLUDE@ +UUID_C_LIB = @UUID_C_LIB@ +VERSION = @VERSION@ +YAXT_C_INCLUDE = @YAXT_C_INCLUDE@ +YAXT_C_LIB = @YAXT_C_LIB@ +YAXT_FC_LIB = @YAXT_FC_LIB@ +YAXT_FC_MOD = @YAXT_FC_MOD@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_F77 = @ac_ct_F77@ +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@ +ax_pthread_config = @ax_pthread_config@ +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@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ +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@ +TEST_EXTENSIONS = @EXEEXT@ .run + +# Update test_cksum_base before running tests that source it: +test_cksum_TEST_LOGS_ = \ + test_cksum_ext.log \ + test_cksum_grb.log \ + test_cksum_grb2.log \ + test_cksum_ieg.log \ + test_cksum_nc.log \ + test_cksum_nc2.log \ + test_cksum_nc4.log \ + test_cksum_srv.log + + +# Update pio_write_dist_array.run before running tests that source it: +pio_write_dist_array_TEST_LOGS_ = \ + pio_cksum_asynch.log \ + pio_cksum_fpguard.log \ + pio_cksum_grb2.log \ + pio_cksum_mpi_fw_at_all.log \ + pio_cksum_mpi_fw_at_reblock.log \ + pio_cksum_mpi_fw_ordered.log \ + pio_cksum_mpinonb.log \ + pio_cksum_nc.log \ + pio_cksum_nc2.log \ + pio_cksum_nc4.log \ + pio_cksum_writer.log + + +# Update pio_write.run before running tests that source it: +pio_write_TEST_LOGS_ = \ + $(pio_write_dist_array_TEST_LOGS_) \ + pio_write.parallel.log \ + pio_write_deco2d.log \ + pio_write_deco2d.parallel.log \ + pio_write_dist_array.log + +test_PROGRAMS_ = calendar_test1 cksum_read cksum_verify cksum_write \ + cksum_write_chunk pio_write pio_write_deco2d test_byteswap \ + test_grib test_month_adjust test_resource_copy test_table \ + $(am__append_1) $(am__append_2) +AM_CPPFLAGS = -I$(top_srcdir)/src + +# Avoid compiling twice by running Libtool with '-static' +# This is safe because all Libtool libraries in this directory are +# static-only and contain PIC objects: +AM_CFLAGS = $(PPM_CORE_C_INCLUDE) $(YAXT_C_INCLUDE) $(MPI_C_INCLUDE) \ + -static +AM_LDFLAGS = $(am__append_3) +LDADD = $(top_builddir)/src/libcdi.la +calendar_test1_SOURCES = calendar_test1.c +cksum_read_SOURCES = \ + cksum_read.c \ + ensure_array_size.c \ + ensure_array_size.h \ + stream_cksum.c \ + stream_cksum.h \ + var_cksum.c \ + var_cksum.h + +cksum_verify_SOURCES = cksum_verify.c +cksum_write_SOURCES = \ + cksum_write.c \ + simple_model_helper.c \ + simple_model_helper.h + +cksum_write_chunk_SOURCES = \ + cksum_write_chunk.c \ + simple_model_helper.c \ + simple_model_helper.h + +pio_write_SOURCES = \ + pio_write.c \ + pio_write.h \ + pio_write_setup_grid.c \ + pio_write_setup_grid.h \ + simple_model.c \ + simple_model_helper.c \ + simple_model_helper.h + +nodist_pio_write_parallel_SOURCES = $(pio_write_SOURCES:.c=.parallel.c) +pio_write_parallel_LDADD = $(top_builddir)/src/libcdipio.la $(PPM_CORE_C_LIB) $(YAXT_C_LIB) $(LDADD) +pio_write_deco2d_SOURCES = \ + deco2d_model.c \ + pio_write.c \ + pio_write.h \ + pio_write_setup_grid.c \ + pio_write_setup_grid.h \ + simple_model_helper.c \ + simple_model_helper.h + +nodist_pio_write_deco2d_parallel_SOURCES = $(pio_write_deco2d_SOURCES:.c=.parallel.c) +pio_write_deco2d_parallel_LDADD = $(top_builddir)/src/libcdipio.la $(PPM_CORE_C_LIB) $(YAXT_C_LIB) $(LDADD) +test_byteswap_SOURCES = test_byteswap.c +test_grib_SOURCES = test_grib.c +test_month_adjust_SOURCES = test_month_adjust.c +test_resource_copy_SOURCES = test_resource_copy.c +test_resource_copy_LDADD = $(top_builddir)/src/libcdiresunpack.la +nodist_test_resource_copy_parallel_SOURCES = $(test_resource_copy_SOURCES:.c=.parallel.c) +test_resource_copy_parallel_LDADD = $(top_builddir)/src/libcdipio.la $(LDADD) +test_table_SOURCES = test_table.c +test_cdf_read_SOURCES = test_cdf_read.c +test_cdf_write_SOURCES = \ + simple_model_helper.c \ + simple_model_helper.h \ + test_cdf_write.c + +AUTOMAKE_OPTIONS = color-tests + +# Compile programs using Libtool: +COMPILE = $(LTCOMPILE) +FCCOMPILE = $(LTFCCOMPILE) +PPFCCOMPILE = $(LTPPFCCOMPILE) +CXXCOMPILE = $(LTCXXCOMPILE) + +# Compile *.F90 without CPPFLAGS, which are normally meant for the C compiler +# and might not be compatible with the Fortran compiler: +LTPPFCCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=FC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) + +AM_FCFLAGS = -static +AM_CXXFLAGS = -static + +# Generate source files for parallel versions of the programs. We do this to +# avoid target-specific flags, which result into rules that do not use the +# compilation commands above. +SUFFIXES = .parallel.c +all: all-am + +.SUFFIXES: +.SUFFIXES: .parallel.c .c .lo .log .o .obj .run .run$(EXEEXT) .trs +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.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 tests/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign tests/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__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(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): +test_cksum_base: $(top_builddir)/config.status $(srcdir)/test_cksum_base.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +pio_cksum_asynch.run: $(top_builddir)/config.status $(srcdir)/pio_cksum_asynch.run.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +pio_cksum_fpguard.run: $(top_builddir)/config.status $(srcdir)/pio_cksum_fpguard.run.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +pio_cksum_grb2.run: $(top_builddir)/config.status $(srcdir)/pio_cksum_grb2.run.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +pio_cksum_mpi_fw_at_all.run: $(top_builddir)/config.status $(srcdir)/pio_cksum_mpi_fw_at_all.run.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +pio_cksum_mpi_fw_at_reblock.run: $(top_builddir)/config.status $(srcdir)/pio_cksum_mpi_fw_at_reblock.run.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +pio_cksum_mpi_fw_ordered.run: $(top_builddir)/config.status $(srcdir)/pio_cksum_mpi_fw_ordered.run.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +pio_cksum_mpinonb.run: $(top_builddir)/config.status $(srcdir)/pio_cksum_mpinonb.run.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +pio_cksum_nc.run: $(top_builddir)/config.status $(srcdir)/pio_cksum_nc.run.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +pio_cksum_nc2.run: $(top_builddir)/config.status $(srcdir)/pio_cksum_nc2.run.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +pio_cksum_nc4.run: $(top_builddir)/config.status $(srcdir)/pio_cksum_nc4.run.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +pio_cksum_writer.run: $(top_builddir)/config.status $(srcdir)/pio_cksum_writer.run.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +pio_write.parallel.run: $(top_builddir)/config.status $(srcdir)/pio_write.parallel.run.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +pio_write.run: $(top_builddir)/config.status $(srcdir)/pio_write.run.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +pio_write_deco2d.parallel.run: $(top_builddir)/config.status $(srcdir)/pio_write_deco2d.parallel.run.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +pio_write_deco2d.run: $(top_builddir)/config.status $(srcdir)/pio_write_deco2d.run.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +pio_write_dist_array.run: $(top_builddir)/config.status $(srcdir)/pio_write_dist_array.run.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +test_byteswap.run: $(top_builddir)/config.status $(srcdir)/test_byteswap.run.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +test_cdf_const.run: $(top_builddir)/config.status $(srcdir)/test_cdf_const.run.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +test_cdf_transformation.run: $(top_builddir)/config.status $(srcdir)/test_cdf_transformation.run.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +test_cksum_ext.run: $(top_builddir)/config.status $(srcdir)/test_cksum_ext.run.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +test_cksum_grb.run: $(top_builddir)/config.status $(srcdir)/test_cksum_grb.run.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +test_cksum_grb2.run: $(top_builddir)/config.status $(srcdir)/test_cksum_grb2.run.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +test_cksum_ieg.run: $(top_builddir)/config.status $(srcdir)/test_cksum_ieg.run.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +test_cksum_nc.run: $(top_builddir)/config.status $(srcdir)/test_cksum_nc.run.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +test_cksum_nc2.run: $(top_builddir)/config.status $(srcdir)/test_cksum_nc2.run.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +test_cksum_nc4.run: $(top_builddir)/config.status $(srcdir)/test_cksum_nc4.run.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +test_cksum_nc_chunk.run: $(top_builddir)/config.status $(srcdir)/test_cksum_nc_chunk.run.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +test_cksum_srv.run: $(top_builddir)/config.status $(srcdir)/test_cksum_srv.run.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +test_f2003.run: $(top_builddir)/config.status $(srcdir)/test_f2003.run.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +test_grib.run: $(top_builddir)/config.status $(srcdir)/test_grib.run.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +test_resource_copy.parallel.run: $(top_builddir)/config.status $(srcdir)/test_resource_copy.parallel.run.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +test_resource_copy.run: $(top_builddir)/config.status $(srcdir)/test_resource_copy.run.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +test_table.run: $(top_builddir)/config.status $(srcdir)/test_table.run.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ + +clean-checkPROGRAMS: + @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +calendar_test1$(EXEEXT): $(calendar_test1_OBJECTS) $(calendar_test1_DEPENDENCIES) $(EXTRA_calendar_test1_DEPENDENCIES) + @rm -f calendar_test1$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(calendar_test1_OBJECTS) $(calendar_test1_LDADD) $(LIBS) + +cksum_read$(EXEEXT): $(cksum_read_OBJECTS) $(cksum_read_DEPENDENCIES) $(EXTRA_cksum_read_DEPENDENCIES) + @rm -f cksum_read$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(cksum_read_OBJECTS) $(cksum_read_LDADD) $(LIBS) + +cksum_verify$(EXEEXT): $(cksum_verify_OBJECTS) $(cksum_verify_DEPENDENCIES) $(EXTRA_cksum_verify_DEPENDENCIES) + @rm -f cksum_verify$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(cksum_verify_OBJECTS) $(cksum_verify_LDADD) $(LIBS) + +cksum_write$(EXEEXT): $(cksum_write_OBJECTS) $(cksum_write_DEPENDENCIES) $(EXTRA_cksum_write_DEPENDENCIES) + @rm -f cksum_write$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(cksum_write_OBJECTS) $(cksum_write_LDADD) $(LIBS) + +cksum_write_chunk$(EXEEXT): $(cksum_write_chunk_OBJECTS) $(cksum_write_chunk_DEPENDENCIES) $(EXTRA_cksum_write_chunk_DEPENDENCIES) + @rm -f cksum_write_chunk$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(cksum_write_chunk_OBJECTS) $(cksum_write_chunk_LDADD) $(LIBS) + +pio_write$(EXEEXT): $(pio_write_OBJECTS) $(pio_write_DEPENDENCIES) $(EXTRA_pio_write_DEPENDENCIES) + @rm -f pio_write$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(pio_write_OBJECTS) $(pio_write_LDADD) $(LIBS) + +pio_write.parallel$(EXEEXT): $(pio_write_parallel_OBJECTS) $(pio_write_parallel_DEPENDENCIES) $(EXTRA_pio_write_parallel_DEPENDENCIES) + @rm -f pio_write.parallel$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(pio_write_parallel_OBJECTS) $(pio_write_parallel_LDADD) $(LIBS) + +pio_write_deco2d$(EXEEXT): $(pio_write_deco2d_OBJECTS) $(pio_write_deco2d_DEPENDENCIES) $(EXTRA_pio_write_deco2d_DEPENDENCIES) + @rm -f pio_write_deco2d$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(pio_write_deco2d_OBJECTS) $(pio_write_deco2d_LDADD) $(LIBS) + +pio_write_deco2d.parallel$(EXEEXT): $(pio_write_deco2d_parallel_OBJECTS) $(pio_write_deco2d_parallel_DEPENDENCIES) $(EXTRA_pio_write_deco2d_parallel_DEPENDENCIES) + @rm -f pio_write_deco2d.parallel$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(pio_write_deco2d_parallel_OBJECTS) $(pio_write_deco2d_parallel_LDADD) $(LIBS) + +test_byteswap$(EXEEXT): $(test_byteswap_OBJECTS) $(test_byteswap_DEPENDENCIES) $(EXTRA_test_byteswap_DEPENDENCIES) + @rm -f test_byteswap$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_byteswap_OBJECTS) $(test_byteswap_LDADD) $(LIBS) + +test_cdf_read$(EXEEXT): $(test_cdf_read_OBJECTS) $(test_cdf_read_DEPENDENCIES) $(EXTRA_test_cdf_read_DEPENDENCIES) + @rm -f test_cdf_read$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_cdf_read_OBJECTS) $(test_cdf_read_LDADD) $(LIBS) + +test_cdf_write$(EXEEXT): $(test_cdf_write_OBJECTS) $(test_cdf_write_DEPENDENCIES) $(EXTRA_test_cdf_write_DEPENDENCIES) + @rm -f test_cdf_write$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_cdf_write_OBJECTS) $(test_cdf_write_LDADD) $(LIBS) + +test_grib$(EXEEXT): $(test_grib_OBJECTS) $(test_grib_DEPENDENCIES) $(EXTRA_test_grib_DEPENDENCIES) + @rm -f test_grib$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_grib_OBJECTS) $(test_grib_LDADD) $(LIBS) + +test_month_adjust$(EXEEXT): $(test_month_adjust_OBJECTS) $(test_month_adjust_DEPENDENCIES) $(EXTRA_test_month_adjust_DEPENDENCIES) + @rm -f test_month_adjust$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_month_adjust_OBJECTS) $(test_month_adjust_LDADD) $(LIBS) + +test_resource_copy$(EXEEXT): $(test_resource_copy_OBJECTS) $(test_resource_copy_DEPENDENCIES) $(EXTRA_test_resource_copy_DEPENDENCIES) + @rm -f test_resource_copy$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_resource_copy_OBJECTS) $(test_resource_copy_LDADD) $(LIBS) + +test_resource_copy.parallel$(EXEEXT): $(test_resource_copy_parallel_OBJECTS) $(test_resource_copy_parallel_DEPENDENCIES) $(EXTRA_test_resource_copy_parallel_DEPENDENCIES) + @rm -f test_resource_copy.parallel$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_resource_copy_parallel_OBJECTS) $(test_resource_copy_parallel_LDADD) $(LIBS) + +test_table$(EXEEXT): $(test_table_OBJECTS) $(test_table_DEPENDENCIES) $(EXTRA_test_table_DEPENDENCIES) + @rm -f test_table$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_table_OBJECTS) $(test_table_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/calendar_test1.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cksum_read.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cksum_verify.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cksum_write.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cksum_write_chunk.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/deco2d_model.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/deco2d_model.parallel.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ensure_array_size.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pio_write.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pio_write.parallel.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pio_write_setup_grid.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pio_write_setup_grid.parallel.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/simple_model.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/simple_model.parallel.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/simple_model_helper.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/simple_model_helper.parallel.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stream_cksum.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_byteswap.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_cdf_read.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_cdf_write.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_grib.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_month_adjust.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_resource_copy.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_resource_copy.parallel.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_table.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/var_cksum.Po@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.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 -o $@ $< + +.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 -o $@ `$(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 +examples-local: + +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; \ + elif test -n "$$redo_logs"; then \ + 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"$(AM_TESTSUITE_SUMMARY_HEADER)"$${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: $(check_PROGRAMS) + @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 $$? +calendar_test1.log: calendar_test1$(EXEEXT) + @p='calendar_test1$(EXEEXT)'; \ + b='calendar_test1'; \ + $(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) +cksum_verify.log: cksum_verify$(EXEEXT) + @p='cksum_verify$(EXEEXT)'; \ + b='cksum_verify'; \ + $(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_month_adjust.log: test_month_adjust$(EXEEXT) + @p='test_month_adjust$(EXEEXT)'; \ + b='test_month_adjust'; \ + $(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) +.run.log: + @p='$<'; \ + $(am__set_b); \ + $(am__check_pre) $(RUN_LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_RUN_LOG_DRIVER_FLAGS) $(RUN_LOG_DRIVER_FLAGS) -- $(RUN_LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +@am__EXEEXT_TRUE@.run$(EXEEXT).log: +@am__EXEEXT_TRUE@ @p='$<'; \ +@am__EXEEXT_TRUE@ $(am__set_b); \ +@am__EXEEXT_TRUE@ $(am__check_pre) $(RUN_LOG_DRIVER) --test-name "$$f" \ +@am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ +@am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_RUN_LOG_DRIVER_FLAGS) $(RUN_LOG_DRIVER_FLAGS) -- $(RUN_LOG_COMPILE) \ +@am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) + $(MAKE) $(AM_MAKEFLAGS) check-TESTS +check: check-am +all-am: Makefile $(PROGRAMS) +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 clean-local \ + clean-noinstPROGRAMS mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/calendar_test1.Po + -rm -f ./$(DEPDIR)/cksum_read.Po + -rm -f ./$(DEPDIR)/cksum_verify.Po + -rm -f ./$(DEPDIR)/cksum_write.Po + -rm -f ./$(DEPDIR)/cksum_write_chunk.Po + -rm -f ./$(DEPDIR)/deco2d_model.Po + -rm -f ./$(DEPDIR)/deco2d_model.parallel.Po + -rm -f ./$(DEPDIR)/ensure_array_size.Po + -rm -f ./$(DEPDIR)/pio_write.Po + -rm -f ./$(DEPDIR)/pio_write.parallel.Po + -rm -f ./$(DEPDIR)/pio_write_setup_grid.Po + -rm -f ./$(DEPDIR)/pio_write_setup_grid.parallel.Po + -rm -f ./$(DEPDIR)/simple_model.Po + -rm -f ./$(DEPDIR)/simple_model.parallel.Po + -rm -f ./$(DEPDIR)/simple_model_helper.Po + -rm -f ./$(DEPDIR)/simple_model_helper.parallel.Po + -rm -f ./$(DEPDIR)/stream_cksum.Po + -rm -f ./$(DEPDIR)/test_byteswap.Po + -rm -f ./$(DEPDIR)/test_cdf_read.Po + -rm -f ./$(DEPDIR)/test_cdf_write.Po + -rm -f ./$(DEPDIR)/test_grib.Po + -rm -f ./$(DEPDIR)/test_month_adjust.Po + -rm -f ./$(DEPDIR)/test_resource_copy.Po + -rm -f ./$(DEPDIR)/test_resource_copy.parallel.Po + -rm -f ./$(DEPDIR)/test_table.Po + -rm -f ./$(DEPDIR)/var_cksum.Po + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +examples: examples-am + +examples-am: examples-local + +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 ./$(DEPDIR)/calendar_test1.Po + -rm -f ./$(DEPDIR)/cksum_read.Po + -rm -f ./$(DEPDIR)/cksum_verify.Po + -rm -f ./$(DEPDIR)/cksum_write.Po + -rm -f ./$(DEPDIR)/cksum_write_chunk.Po + -rm -f ./$(DEPDIR)/deco2d_model.Po + -rm -f ./$(DEPDIR)/deco2d_model.parallel.Po + -rm -f ./$(DEPDIR)/ensure_array_size.Po + -rm -f ./$(DEPDIR)/pio_write.Po + -rm -f ./$(DEPDIR)/pio_write.parallel.Po + -rm -f ./$(DEPDIR)/pio_write_setup_grid.Po + -rm -f ./$(DEPDIR)/pio_write_setup_grid.parallel.Po + -rm -f ./$(DEPDIR)/simple_model.Po + -rm -f ./$(DEPDIR)/simple_model.parallel.Po + -rm -f ./$(DEPDIR)/simple_model_helper.Po + -rm -f ./$(DEPDIR)/simple_model_helper.parallel.Po + -rm -f ./$(DEPDIR)/stream_cksum.Po + -rm -f ./$(DEPDIR)/test_byteswap.Po + -rm -f ./$(DEPDIR)/test_cdf_read.Po + -rm -f ./$(DEPDIR)/test_cdf_write.Po + -rm -f ./$(DEPDIR)/test_grib.Po + -rm -f ./$(DEPDIR)/test_month_adjust.Po + -rm -f ./$(DEPDIR)/test_resource_copy.Po + -rm -f ./$(DEPDIR)/test_resource_copy.parallel.Po + -rm -f ./$(DEPDIR)/test_table.Po + -rm -f ./$(DEPDIR)/var_cksum.Po + -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 am--depfiles check check-TESTS \ + check-am clean clean-checkPROGRAMS clean-generic clean-libtool \ + clean-local clean-noinstPROGRAMS cscopelist-am ctags ctags-am \ + distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am \ + examples-am examples-local 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 + +.PRECIOUS: Makefile + +$(test_cksum_TEST_LOGS_): test_cksum_base +$(pio_write_dist_array_TEST_LOGS_): pio_write_dist_array.run +$(pio_write_TEST_LOGS_): pio_write.run + +@with_concurrent_mpi_checks_FALSE@pio_cksum_fpguard.log: pio_cksum_asynch.log +@with_concurrent_mpi_checks_FALSE@pio_cksum_grb2.log: pio_cksum_fpguard.log +@with_concurrent_mpi_checks_FALSE@pio_cksum_mpi_fw_at_all.log: pio_cksum_grb2.log +@with_concurrent_mpi_checks_FALSE@pio_cksum_mpi_fw_at_reblock.log: pio_cksum_mpi_fw_at_all.log +@with_concurrent_mpi_checks_FALSE@pio_cksum_mpi_fw_ordered.log: pio_cksum_mpi_fw_at_reblock.log +@with_concurrent_mpi_checks_FALSE@pio_cksum_mpinonb.log: pio_cksum_mpi_fw_ordered.log +@with_concurrent_mpi_checks_FALSE@pio_cksum_nc.log: pio_cksum_mpinonb.log +@with_concurrent_mpi_checks_FALSE@pio_cksum_nc2.log: pio_cksum_nc.log +@with_concurrent_mpi_checks_FALSE@pio_cksum_nc4.log: pio_cksum_nc2.log +@with_concurrent_mpi_checks_FALSE@pio_cksum_writer.log: pio_cksum_nc4.log +@with_concurrent_mpi_checks_FALSE@pio_write.parallel.log: pio_cksum_writer.log +@with_concurrent_mpi_checks_FALSE@pio_write_deco2d.parallel.log: pio_write.parallel.log +@with_concurrent_mpi_checks_FALSE@pio_write_dist_array.log: pio_write_deco2d.parallel.log +@with_concurrent_mpi_checks_FALSE@test_resource_copy.parallel.log: pio_write_dist_array.log + +clean-local: + -rm -f *.parallel.c + -rm -f *.grb *.grb2 *.nc *.nc2 *.nc4 *.srv *.ext *.cksum *.ieg *.stderr *.stdout + -rm -rf *.dSYM + +.c.parallel.c: + $(AM_V_GEN):;{ \ + echo '#define USE_MPI 1'; \ + echo '#include "$<"'; \ + } >$@ + +# 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: