pax_global_header00006660000000000000000000000064147716433700014526gustar00rootroot0000000000000052 comment=34f9925dc5de17818a3de4ff773b271e46334f0c nco-5.3.3/000077500000000000000000000000001477164337000123155ustar00rootroot00000000000000nco-5.3.3/.appveyor.yml000066400000000000000000000033661477164337000147730ustar00rootroot00000000000000environment: CONDA_INSTALL_LOCN: C:\\Miniconda37-x64 TARGET_ARCH: x64 CONDA_PY: 37 SRC_DIR: C:\projects\nco platform: - x64 image: - Visual Studio 2022 init: - call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat" install: # If there is a newer build queued for the same PR, cancel this one. - ps: if ($env:APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_BUILD_NUMBER -ne ((Invoke-RestMethod ` https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/history?recordsNumber=50).builds | ` Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { ` throw "There are newer queued builds for this pull request, failing early." } # Add path, activate `conda` and update conda. - cmd: call %CONDA_INSTALL_LOCN%\Scripts\activate.bat - cmd: conda config --set always_yes yes --set changeps1 no --set show_channel_urls true - cmd: conda update conda - cmd: conda config --add channels conda-forge --force - cmd: conda config --set channel_priority strict - cmd: set PYTHONUNBUFFERED=1 - cmd: conda info --all - cmd: conda create --name TEST python=%PY% cmake antlr=2.7 curl expat gsl hdf5 libnetcdf udunits2 zlib - cmd: conda activate TEST # Skip .NET project specific build phase. build: off test_script: # Build - build.cmd # Tests - ncks --help - ncap2 --help - ncks -M "http://tds.marine.rutgers.edu/thredds/dodsC/roms/espresso/2013_da/his/ESPRESSO_Real-Time_v2_History_Best" || exit 1 - cd %SRC_DIR%\data - ncgen -o in.nc in.cdl || exit 1 - ncks -H --trd -v one in.nc || exit 1 - ncap2 -O -v -s "erf_one=float(gsl_sf_erf(1.0f));" in.nc foo.nc || exit 1 - ncks -v erf_one foo.nc || exit 1 nco-5.3.3/.gitignore000066400000000000000000000010251477164337000143030ustar00rootroot00000000000000# Git-ignore patterns for ~/nco # Autoconf/Automake Makefile.in .deps .libs *.o *.la *.lo /autom4te.cache /aclocal.m4 /compile /configure /depcomp /install-sh /missing /Makefile # CMake CMakeCache.txt CMakeFiles cmake_install.cmake # Odd files, litter gmon.out PET0.RegridWeightGen.Log texput.log # Editors *.~?~ *~ TAGS # NCO-generic *.nc *.hdf # Directory-specific /config.h /config.guess /config.log /config.sub /config.status /libtool /stamp-h* nco.config.log.*.foo nco.configure.*.foo nco.libtool.*.foo nco.make.*.foo nco-5.3.3/.travis.yml000066400000000000000000000011461477164337000144300ustar00rootroot00000000000000# Syntax-check Travis YAML .travis.yml files at http://lint.travis-ci.org # Force Travis to rebuild by commiting an increment to this counter: 5 language: c compiler: - gcc - clang - g++ before_install: - if [[ "${CC}" == "gcc" || "${CC}" == "g++" ]]; then export CXX=g++; fi - if [[ "${CC}" == "clang" || "${CC}" == "clang++" ]]; then export CXX=clang++; fi - sudo apt-get update -qq - sudo apt-get install -y -qq antlr libantlr-dev libnetcdf11 libnetcdf-dev netcdf-bin udunits-bin libudunits2-0 libudunits2-dev - ./configure - export DATA='/home/travis' script: - make -j 4 - make test nco-5.3.3/AUTHORS000066400000000000000000000044501477164337000133700ustar00rootroot00000000000000The User Guide documentation (nco.texi) contains the most up-to-date list of contributors to the NCO project, see http://nco.sf.net/nco.html#ppl Henry Butowsky Non-linear operations and 'min()', 'max()', 'total()' support in 'ncra' and 'ncwa'. Type conversion for arithmetic. Migration to netCDF3 API. 'ncap2' parser, lexer, GSL-support, and I/O. Multislabbing algorithm. Variable wildcarding. Numerous hacks. 'ncap2' language. Mesh intersection algorithms. Rorik Peterson Original autotool build support. Long command-line options. Original UDUnits support. Debianization. Numerous bug-fixes. Joe Hamman Python bindings (NCOpy). Daniel Wang Script Workflow Analysis for MultiProcessing (SWAMP). RPM support. Harry Mangalam Benchmarking. OPeNDAP configuration. Pedro Vicente Windows Visual Studio support. netCDF4 groups. Joseph O'Rourke Computational Geometry routines Russ Rew Advice on NCO structural algorithms Brian Mays Original packaging for Debian GNU/Linux, 'nroff' man pages. George Shapovalov Packaging for Gentoo GNU/Linux. Bill Kocik Memory management. Len Makin NEC SX architecture support. Jim Edwards AIX architecture support. Juliana Rew Compatibility with large PIDs. Karen Schuchardt Auxiliary coordinate support. Gayathri Venkitachalam MPI implementation. Scott Capps Large work-load testing Peter Campbell, Martin Dix, Mark Flanner, Markus Liebig, Keith Lindsay, Mike Page, Martin Schmidt, Michael Schulz, Lori Sentman, Gary Strand, George White Andrew Wittenberg, Remik Ziemlinski Excellent bug reports and feature requests. Daniel Baumann, Nick Bower, Luk Claebs, Barry deFreese, Aleksandar Jelenak, Francesco Lovergine, Matej Vela Debian packaging Patrice Dumas, Ed Hill, Orion Poplawski RedHat packaging George Shapavalov, Patrick Kursawe Gentoo packaging Filipe Fernandes OpenSuse packaging Takeshi Enomoto, Alexander Hansen Mac OS packaging Eric Blake Autoconf/M4 help Gavin Burris, Kyle Wilcox RHEL and CentOS build scripts and bug reports. Andrea Cimatoribus NCO Spiral Logo Martin Otte, Etienne Tourigny Single bug reports and fixes Wenshan Wang CMIP5 and MODIS processing documentation. Please let me know if your name was omitted! nco-5.3.3/CITATION000066400000000000000000000025541477164337000134600ustar00rootroot00000000000000NCO is three things: a geoscience data analysis toolkit, an open-source software project, and an academic enterprise that embodies fundamental new (research-level) algorithms for geoscience data analysis. Successful academic research depends upon peer-evaluation, dissemination, and explicit acknowledgement of prior work and original results. The accepted way to convey acknowledgement to NCO for ideas or assistance in workflow processing is to cite its peer-reviewed description and or its User Guide. We encourage users and data science researchers to cite NCO for another reason, too: it helps funding agencies track the impact of the work they fund. The recommended citation for NCO software is Zender, C. S. (2008), Analysis of Self-describing Gridded Geoscience Data with netCDF Operators (NCO), Environ. Modell. Softw., 23(10), 1338-1342, doi:10.1016/j.envsoft.2008.03.004. or Zender, C. S. (2014), netCDF Operator (NCO) User Guide, Version 4.4.3, http://nco.sf.net/nco.pdf. Use the former when referring to overall design, purpose, and optimization of NCO, and use the latter when referring to specific features and/or the Users Guide itself. Additional information on citing NCO is in the User Guide at http://nco.sf.net#ctt A complete list of NCO publications and presentations is at http://nco.sf.net#pub This list links to the full papers and seminars themselves. nco-5.3.3/CMakeLists.txt000066400000000000000000001220251477164337000150570ustar00rootroot00000000000000# CMake build, Pedro Vicente #///////////////////////////////////////////////////////////////////////////////////// # Mininum library dependencies: netCDF, HDF5, HDF5_HL, ZLIB (SZIP) #///////////////////////////////////////////////////////////////////////////////////// #-DNETCDF_INCLUDE:PATH= #-DNETCDF_LIBRARY:FILE= #-DHDF5_LIBRARY:FILE= #-DHDF5_HL_LIBRARY:FILE= #-DZLIB_LIBRARY:FILE= #-DSZIP_LIBRARY:FILE= #-DCURL_LIBRARY:FILE= #///////////////////////////////////////////////////////////////////////////////////// # Optional library dependencies (Antlr, UDUNITS, EXPAT, GSL) #///////////////////////////////////////////////////////////////////////////////////// #-DANTLR_INCLUDE:PATH= #-DANTLR_LIBRARY:FILE= #-DUDUNITS2_INCLUDE:PATH= #-DUDUNITS2_LIBRARY:FILE= #-DEXPAT_LIBRARY:FILE= #-DGSL_INCLUDE:PATH= #-DGSL_LIBRARY:FILE= #-DGSL_CBLAS_LIBRARY:FILE= cmake_minimum_required(VERSION 3.12) project (nco) include(CheckFunctionExists) include(CheckIncludeFile) include(CheckLibraryExists) #////////////////////////// # colorized output # red, fatal error, cannot build (missing netCDF, HDF5, CURL libraries) # magenta, "negative" warning (missing optional libraries, GSL, ANTLR, UDUNITS) # green, "positive" warning (opposite of magenta, optional libraries found) # blue, general information to take notice (SZIP/ZLIB were detected as needed, special NCO functions are defined) #////////////////////////// if(NOT WIN32) string(ASCII 27 Esc) set(color_reset "${Esc}[m") set(color_magenta "${Esc}[35m") set(color_red "${Esc}[31m") set(color_green "${Esc}[32m") set(color_blue "${Esc}[34m") endif() #///////////////////////////////////////////////////////////////////////////////////// #general C/C++ build flags #on single-configuration generators (Unix Makefiles, NMake Makefiles) use Debug as default #on multi-configuration generators (Visual Studio, Xcode) define only 2 types: Debug;Release #///////////////////////////////////////////////////////////////////////////////////// set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build.") if(CMAKE_CONFIGURATION_TYPES) set(CMAKE_CONFIGURATION_TYPES "Debug;Release") endif() set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build static libs.") if (NOT BUILD_SHARED_LIBS) add_definitions(-DENABLE_STATIC) endif() #////////////////////////// #detect minimum dependencies using #find_path() #find_library() #Notes: #1) list a static name first to avoid link errors in systems with multiple versions of the same libraries in PATH, used for libz.a #2) use option NO_SYSTEM_ENVIRONMENT_PATH #////////////////////////// set(find_opt NO_SYSTEM_ENVIRONMENT_PATH) #///////////////////////////////////////////////////////////////////////////////////// #netCDF #detect a user defined system environment variable NETCDF_ROOT #this sets the include path to NETCDF_INCLUDE directly #and a PATHS hint for NETCDF_LIBRARY (because the library name can be any legal combination of "netcdf" ) #For this case find_library(NETCDF_LIBRARY) MUST be called 2 times #First time it looks in NETCDF_LIBRARY_PATH if set, avoiding all other PATHS with NO_DEFAULT_PATH #If not found, business as usual #////////////////////////// # NETCDF_ROOT, if found in environment, will be searched after specific command line locations for NETCDF_INCLUDE # and NETCDF_LIBRARY set(netcdf_root "$ENV{NETCDF_ROOT}") if(netcdf_root) message("${color_blue}-- Using user-defined netCDF root location: ${netcdf_root}${color_reset}") endif() #////////////////////////// #a user defined -DNETCDF_INCLUDE was specified; check if it really exists :-) #////////////////////////// if(NETCDF_INCLUDE) if(EXISTS "${NETCDF_INCLUDE}/netcdf.h") message("-- Using ${NETCDF_INCLUDE}/netcdf.h") else() if(netcdf_root) set(NETCDF_INCLUDE "${netcdf_root}/include") endif() if(EXISTS "${NETCDF_INCLUDE}/netcdf.h") message("-- Using ${NETCDF_INCLUDE}/netcdf.h") else() message(FATAL_ERROR "${color_red}netcdf.h not found at ${NETCDF_INCLUDE}${color_reset}") endif() endif() endif() find_path(NETCDF_INCLUDE netcdf.h ${find_opt}) if(NOT NETCDF_INCLUDE) message(FATAL_ERROR "${color_red}netcdf.h header file not found${color_reset}") else() message("-- Found netcdf.h header file at: " ${NETCDF_INCLUDE}) endif() #////////////////////////// #a user defined -DNETCDF_LIBRARY was specified; check if it really exists :-) #////////////////////////// if(NETCDF_LIBRARY) if(EXISTS "${NETCDF_LIBRARY}") message("-- Using ${NETCDF_LIBRARY}") else() if(netcdf_root) set(NETCDF_LIBRARY_PATH "${netcdf_root}/lib") else() message(FATAL_ERROR "${color_red}Specified ${NETCDF_LIBRARY} does not exist${color_reset}") endif() endif() endif() find_library(NETCDF_LIBRARY NAMES netcdf PATHS ${NETCDF_LIBRARY_PATH} NO_DEFAULT_PATH) find_library(NETCDF_LIBRARY NAMES netcdf ${find_opt}) if(NOT NETCDF_LIBRARY) message(FATAL_ERROR "${color_red}netcdf library not found${color_reset}") else() message("-- Found netcdf library at: " ${NETCDF_LIBRARY}) endif() #///////////////////////////////////////////////////////////////////////////////////// #netCDF #Check for several functions in the netCDF library; define C macro accordingly #CMAKE_REQUIRED_LIBRARIES needs NETCDF_LIBRARY #check for header file netcdf_mem.h existence #///////////////////////////////////////////////////////////////////////////////////// check_library_exists(${NETCDF_LIBRARY} nc_set_log_level "" has_nc_set_log_level) if (has_nc_set_log_level) message("-- Found nc_set_log_level in: " ${NETCDF_LIBRARY}) add_definitions(-DHAVE_NC_SET_LOG_LEVEL) endif() check_library_exists(${NETCDF_LIBRARY} nc_rename_grp "" has_nc_rename_grp) if (has_nc_rename_grp) message("-- Found nc_rename_grp in: " ${NETCDF_LIBRARY}) add_definitions(-DNC_HAVE_RENAME_GRP) add_definitions(-DHAVE_NC_RENAME_GRP) endif() check_library_exists(${NETCDF_LIBRARY} nc_inq_path "" has_nc_inq_path) if (has_nc_inq_path) message("-- Found nc_inq_path in: " ${NETCDF_LIBRARY}) add_definitions(-DHAVE_NC_INQ_PATH) endif() check_library_exists(${NETCDF_LIBRARY} nc_inq_format "" has_nc_inq_format) if (has_nc_inq_format) message("-- Found nc_inq_format in: " ${NETCDF_LIBRARY}) add_definitions(-DHAVE_NC_INQ_FORMAT) endif() #///////////////////////////////////////////////////////////////////////////////////// # netcdf_meta.h defines NC_VERSION_MAJOR NC_VERSION_MINOR NC_VERSION_PATCH # NCO defines NC_LIB_VERSION ( NC_VERSION_MAJOR * 100 + NC_VERSION_MINOR * 10 + NC_VERSION_PATCH ) #///////////////////////////////////////////////////////////////////////////////////// find_path(path_netcdf_meta_h netcdf_meta.h PATHS ${NETCDF_INCLUDE}) if(path_netcdf_meta_h) message("-- Found netcdf_meta.h in " ${path_netcdf_meta_h}) # 20211021: Do not re-#define NC_HAVE_META_H if file is found # NC_HAVE_META_H will always be defined in netcdf.h if necessary # Re-defining it can trigger "macro-redefined" warnings # add_definitions(-DNC_HAVE_META_H) else() message("-- netcdf_meta.h was not found; defining NC_LIB_VERSION=360") add_definitions(-DNC_LIB_VERSION=360) endif() find_path(path_netcdf_filter_h netcdf_filter.h PATHS ${NETCDF_INCLUDE}) if (path_netcdf_filter_h) message("-- Found netcdf_filter.h in: " ${path_netcdf_filter_h}) endif() find_path(path_netcdf_mem_h netcdf_mem.h PATHS ${NETCDF_INCLUDE}) if (path_netcdf_mem_h) message("-- Found netcdf_mem.h in: " ${path_netcdf_mem_h}) endif() check_library_exists(${NETCDF_LIBRARY} nc_open_mem "" has_nc_open_mem) if (has_nc_open_mem) message("-- Found nc_open_mem in: " ${NETCDF_LIBRARY}) endif() if (has_nc_open_mem AND path_netcdf_mem_h) add_definitions(-DHAVE_NETCDF_MEM_H) message("-- netCDF diskless functionaliy enabled") else() message("-- netCDF diskless functionaliy not available, netcdf_mem.h or nc_open_mem() not found") endif() #if nc_def_var_filter() is available, nc_inq_path(), nc_inq_format() and has_nc_open_mem() are too if (has_nc_def_var_filter) message("-- Defining HAVE_NC_INQ_PATH, HAVE_NC_INQ_FORMAT, HAVE_NETCDF_MEM_H") add_definitions(-DHAVE_NC_INQ_PATH) add_definitions(-DHAVE_NC_INQ_FORMAT) add_definitions(-DHAVE_NETCDF_MEM_H) endif() set(NETCDF_REQUIRED_LIBRARIES ${NETCDF_LIBRARY} ${HDF5_HL_LIBRARY} ${HDF5_LIBRARY} ${ZLIB_LIBRARY} ${SZIP_LIBRARY}) # Replace backslashes with forward slashes because it can cause problems with Windows' paths string(REPLACE "\\" "/" NETCDF_REQUIRED_LIBRARIES ${NETCDF_REQUIRED_LIBRARIES}) set(CMAKE_REQUIRED_LIBRARIES ${NETCDF_REQUIRED_LIBRARIES}) #///////////////////////////////////////////////////////////////////////////////////// #HDF5 #///////////////////////////////////////////////////////////////////////////////////// find_library(HDF5_LIBRARY NAMES hdf5 PATHS "/usr/lib/x86_64-linux-gnu/hdf5/serial") if(NOT HDF5_LIBRARY) message(FATAL_ERROR "${color_red}hdf5 library not found${color_reset}") else() message("-- Found hdf5 library at: " ${HDF5_LIBRARY}) endif() find_library(HDF5_HL_LIBRARY NAMES hdf5_hl PATHS "/usr/lib/x86_64-linux-gnu/hdf5/serial") if(NOT HDF5_HL_LIBRARY) message(FATAL_ERROR "${color_red}hdf5 high level library not found${color_reset}") else() message("-- Found hdf5 high level library at: " ${HDF5_HL_LIBRARY}) endif() #////////////////////////// # HDF5 can be optionally linked with the SZIP library (Science Data Lossless Compression Program) and ZLIB # Symbol to detect in ZLIB can be only H5Z_DEFLATE, a structure only defined in H5Zdeflate.c if the filter is enabled # For SZIP the structure can be only H5Z_SZIP, defined in H5Zszip.c if the filter is enabled # check_library_exists() tries to link a temporary program with these symbols # On MSVC for this detection to work, the HDF5 library MUST HAVE as additional dependencies the ZLIB and SZIP libraries, # which is not a requirement for the library to build successfully #////////////////////////// set(HDF5_REQUIRED_LIBRARIES ${HDF5_HL_LIBRARY} ${HDF5_LIBRARY} ${ZLIB_LIBRARY} ${SZIP_LIBRARY}) # Replace backslashes with forward slashes because it can cause problems with Windows' paths string(REPLACE "\\" "/" HDF5_REQUIRED_LIBRARIES ${HDF5_REQUIRED_LIBRARIES}) set(CMAKE_REQUIRED_LIBRARIES ${HDF5_REQUIRED_LIBRARIES}) message("-- Detecting if HDF5 library ${HDF5_LIBRARY} needs the ZLIB library...") check_library_exists(${HDF5_LIBRARY} H5Z_DEFLATE "" NEED_ZLIB) if (NEED_ZLIB) message("${color_blue}-- ZLIB library is needed...${color_reset}") else() message("${color_blue}-- ZLIB library is not needed...${color_reset}") endif() message("-- Detecting if HDF5 library ${HDF5_LIBRARY} needs the SZIP library...") check_library_exists(${HDF5_LIBRARY} H5Z_SZIP "" NEED_SZIP) if (NEED_SZIP) message("${color_blue}-- SZIP library is needed...${color_reset}") else() message("${color_blue}-- SZIP library is not needed...${color_reset}") endif() if (NEED_SZIP) message("-- Trying to find the SZIP library...") find_library(SZIP_LIBRARY NAMES sz ${find_opt}) if(NOT SZIP_LIBRARY) message(FATAL_ERROR "${color_red}szip library not found${color_reset}") else() message("-- Found szip library at: " ${SZIP_LIBRARY}) endif() endif() if (NEED_ZLIB) message("-- Trying to find the ZLIB library...") find_library(ZLIB_LIBRARY NAMES libz.a z ${find_opt}) if(NOT ZLIB_LIBRARY) message(FATAL_ERROR "${color_red}zlib library not found${color_reset}") else() message("-- Found zlib library at: " ${ZLIB_LIBRARY}) endif() endif() find_library(CURL_LIBRARY NAMES curl ${find_opt}) if(NOT CURL_LIBRARY) message(FATAL_ERROR "${color_red}curl library not found${color_reset}") else() message("-- Found curl library at: " ${CURL_LIBRARY}) endif() #////////////////////////// #GSL_ROOT #detect a user defined system environment variable GSL_ROOT #this sets the include path to GSL_INCLUDE directly #and a PATHS hint for GSL_LIBRARY and GSL_CBLAS_LIBRARY #For this case find_library(GSL_LIBRARY/GSL_CBLAS_LIBRARY) MUST be called 2 times #First time it looks in GSL_LIBRARY_PATH if set, avoiding all other PATHS with NO_DEFAULT_PATH #////////////////////////// set(gsl_root "$ENV{GSL_ROOT}") if(gsl_root) set(GSL_INCLUDE "${gsl_root}/include") set(GSL_LIBRARY_PATH "${gsl_root}/lib") set(GSL_CBLAS_LIBRARY_PATH "${gsl_root}/lib") message("${color_blue}-- Using user defined GSL location: ${gsl_root}${color_reset}") set(GSL_CONFIG_PATH ${gsl_root}/bin/gsl-config) endif(gsl_root) #////////////////////////// #find gsl-config #////////////////////////// find_program(gsl_config NAMES gsl-config PATHS ${GSL_CONFIG_PATH} NO_DEFAULT_PATH) find_program(gsl_config NAMES gsl-config ${find_opt}) if (gsl_config) execute_process(COMMAND ${gsl_config} --prefix OUTPUT_VARIABLE gsl_prefix) if (gsl_prefix) string(REGEX REPLACE "\n$" "" gsl_prefix "${gsl_prefix}") message("${color_blue}-- Found GSL installation prefix at ${gsl_prefix}${color_reset}") endif(gsl_prefix) execute_process(COMMAND ${gsl_config} --version OUTPUT_VARIABLE gsl_version) if (gsl_version) string(REGEX REPLACE "\n$" "" gsl_version "${gsl_version}") message("${color_blue}-- Found GSL version ${gsl_version}${color_reset}") string(REPLACE "." ";" version_list ${gsl_version}) list(GET version_list 0 GSL_MAJOR) list(GET version_list 1 GSL_MINOR) if (GSL_MAJOR) add_definitions(-DNCO_GSL_MAJOR_VERSION=${GSL_MAJOR}) endif() if (GSL_MINOR) add_definitions(-DNCO_GSL_MINOR_VERSION=${GSL_MINOR}) endif() math(EXPR GSL_VER "${GSL_MAJOR} * 100 + ${GSL_MINOR}") if (GSL_VER) add_definitions(-DGSL_VER=${GSL_VER}) endif() endif(gsl_version) endif(gsl_config) find_path(GSL_INCLUDE gsl/gsl_sf_gamma.h ${find_opt}) if(NOT GSL_INCLUDE) message("${color_magenta}-- GSL header files not found${color_reset}") else() message("-- Found GSL header files at: " ${GSL_INCLUDE}) endif() find_library(GSL_LIBRARY NAMES gsl libgsl_d.lib PATHS ${GSL_LIBRARY_PATH} NO_DEFAULT_PATH) find_library(GSL_LIBRARY NAMES gsl libgsl_d.lib ${find_opt}) if(NOT GSL_LIBRARY) message("${color_magenta}-- GSL library not found${color_reset}") else() message("-- Found GSL library at: " ${GSL_LIBRARY}) endif() find_library(GSL_CBLAS_LIBRARY NAMES gslcblas libgslcblas_d.lib PATHS ${GSL_CBLAS_LIBRARY_PATH} NO_DEFAULT_PATH) find_library(GSL_CBLAS_LIBRARY NAMES gslcblas libgslcblas_d.lib ${find_opt}) if(NOT GSL_CBLAS_LIBRARY) message("${color_magenta}-- GSL CBLAS library not found${color_reset}") else() message("-- Found GSL CBLAS library at: " ${GSL_CBLAS_LIBRARY}) endif() if(GSL_INCLUDE AND GSL_LIBRARY AND GSL_CBLAS_LIBRARY) add_definitions(-DENABLE_GSL) include_directories(${GSL_INCLUDE}) set(LIB_DEP ${LIB_DEP} ${GSL_LIBRARY} ${GSL_CBLAS_LIBRARY}) message("${color_green}-- Building with GSL support${color_reset}") else() message("${color_magenta}-- Disabling GSL support${color_reset}") endif () #////////////////////////// #detect optional dependencies #////////////////////////// #////////////////////////// # UDUNITS2 (and EXPAT) # Add non standard UDUNITS2 header paths (Mac ports, Linux Fedora) #////////////////////////// set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH}) set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "/opt/local/include/udunits2") set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "/usr/include/udunits2") find_path(UDUNITS2_INCLUDE udunits2.h ${find_opt}) if(NOT UDUNITS2_INCLUDE) message("${color_magenta}-- Unidata units library header files not found${color_reset}") else() message("-- Found Unidata units library header files at: " ${UDUNITS2_INCLUDE}) endif() find_library(UDUNITS2_LIBRARY NAMES udunits2 ${find_opt}) if(NOT UDUNITS2_LIBRARY) message("${color_magenta}-- Unidata units library not found${color_reset}") else() message("-- Found Unidata units library at: " ${UDUNITS2_LIBRARY}) endif() #////////////////////////// # UDUnits depends on expat #////////////////////////// if (UDUNITS2_LIBRARY AND UDUNITS2_INCLUDE) find_library(EXPAT_LIBRARY NAMES libexpatMT expat ${find_opt}) if(NOT EXPAT_LIBRARY) message("${color_magenta}-- Expat library not found${color_reset}") message("-- Disabling UDUNITS support") else() message("-- Found Expat library at: " ${EXPAT_LIBRARY}) message("${color_green}-- Building with UDUNITS support${color_reset}") endif() endif() #////////////////////////// #compile as C++/static CRT on Visual Studio and as C99 on UNIX #////////////////////////// if (MSVC) set(MSVC_USE_STATIC_CRT ON CACHE BOOL "Use /MT flag (static CRT) when compiling in MSVC") if (MSVC_USE_STATIC_CRT) message("-- Using static CRT ${MSVC_USE_STATIC_CRT}") foreach(flag_var CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE) string(REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") endforeach() endif(MSVC_USE_STATIC_CRT) #////////////////////////// # Compile all of NCO as C++ Code (/TP) #////////////////////////// foreach(flag_var CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE) set(${flag_var} "/TP ${${flag_var}}") endforeach() #////////////////////////// # Visual Studio defines math symbols in math.h, avoid duplicate definition #////////////////////////// add_definitions(-D_MATH_DEFINES_DEFINED) else (MSVC) #////////////////////////// # Compile NCO as C99 #////////////////////////// if(CMAKE_VERSION VERSION_LESS "3.1") if(CMAKE_COMPILER_IS_GNUCC) set(CMAKE_C_FLAGS "--std=gnu99 ${CMAKE_C_FLAGS}") endif() else() set(CMAKE_C_STANDARD 99) endif() #////////////////////////// # other GCC flags #////////////////////////// if(CMAKE_COMPILER_IS_GNUCC) if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9) set(CMAKE_C_FLAGS "-D_BSD_SOURCE -D_POSIX_SOURCE ${CMAKE_C_FLAGS}") else() set(CMAKE_C_FLAGS "-D_DEFAULT_SOURCE ${CMAKE_C_FLAGS}") endif() endif() endif(MSVC) #////////////////////////// #link with libraries #LIB_DEP contains a cascade definition of all the libraries needed to link #////////////////////////// set(LIB_DEP ${LIB_DEP}) set(LIB_DEP ${LIB_DEP} ${NETCDF_LIBRARY}) set(LIB_DEP ${LIB_DEP} ${HDF5_HL_LIBRARY}) set(LIB_DEP ${LIB_DEP} ${HDF5_LIBRARY}) set(LIB_DEP ${LIB_DEP} ${CURL_LIBRARY}) if (NEED_ZLIB) set(LIB_DEP ${LIB_DEP} ${ZLIB_LIBRARY}) endif() if (NEED_SZIP) set(LIB_DEP ${LIB_DEP} ${SZIP_LIBRARY}) endif() #////////////////////////// #add definitions based on libraries found #////////////////////////// if(NETCDF_INCLUDE AND NETCDF_LIBRARY) add_definitions(-DHAVE_NETCDF4_H) add_definitions(-DENABLE_NETCDF4) include_directories(${NETCDF_INCLUDE}) endif() if(UDUNITS2_INCLUDE AND UDUNITS2_LIBRARY AND EXPAT_LIBRARY) add_definitions(-DENABLE_UDUNITS) add_definitions(-DHAVE_UDUNITS2_H) include_directories(${UDUNITS2_INCLUDE}) set(LIB_DEP ${LIB_DEP} ${UDUNITS2_LIBRARY} ${EXPAT_LIBRARY}) endif() #////////////////////////// # system specific libraries needed to link (assume existing) #////////////////////////// if(APPLE) set(LIB_DEP ${LIB_DEP} resolv) endif() # 20231107: Do these 32-bit libraries break compilation on 64-bit WINOS? if(MSVC) set(LIB_DEP ${LIB_DEP} ws2_32.lib winmm.lib wldap32.lib) endif() if(UNIX) set(LIB_DEP ${LIB_DEP} m) endif() #////////////////////////// #nco lib sources #////////////////////////// set(nco_SOURCES ${nco_SOURCES} src/nco/libnco.h) set(nco_SOURCES ${nco_SOURCES} src/nco/nco.h) set(nco_SOURCES ${nco_SOURCES} src/nco/nco_att_utl.c src/nco/nco_att_utl.h) set(nco_SOURCES ${nco_SOURCES} src/nco/nco_aux.c src/nco/nco_aux.h) set(nco_SOURCES ${nco_SOURCES} src/nco/nco_bnr.c src/nco/nco_bnr.h) set(nco_SOURCES ${nco_SOURCES} src/nco/nco_cln_utl.c src/nco/nco_cln_utl.h) set(nco_SOURCES ${nco_SOURCES} src/nco/nco_cnf_dmn.c src/nco/nco_cnf_dmn.h) set(nco_SOURCES ${nco_SOURCES} src/nco/nco_cnf_typ.c src/nco/nco_cnf_typ.h) set(nco_SOURCES ${nco_SOURCES} src/nco/nco_cnk.c src/nco/nco_cnk.h) set(nco_SOURCES ${nco_SOURCES} src/nco/nco_cnv_arm.c src/nco/nco_cnv_arm.h) set(nco_SOURCES ${nco_SOURCES} src/nco/nco_cnv_csm.c src/nco/nco_cnv_csm.h) set(nco_SOURCES ${nco_SOURCES} src/nco/nco_crt.c src/nco/nco_crt.h) set(nco_SOURCES ${nco_SOURCES} src/nco/nco_ctl.c src/nco/nco_ctl.h) set(nco_SOURCES ${nco_SOURCES} src/nco/nco_dbg.c src/nco/nco_dbg.h) set(nco_SOURCES ${nco_SOURCES} src/nco/nco_dmn_utl.c src/nco/nco_dmn_utl.h) set(nco_SOURCES ${nco_SOURCES} src/nco/nco_fl_utl.c src/nco/nco_fl_utl.h) set(nco_SOURCES ${nco_SOURCES} src/nco/nco_flt.c src/nco/nco_flt.h) set(nco_SOURCES ${nco_SOURCES} src/nco/nco_getopt.c src/nco/nco_getopt.h) set(nco_SOURCES ${nco_SOURCES} src/nco/nco_grp_trv.c src/nco/nco_grp_trv.h) set(nco_SOURCES ${nco_SOURCES} src/nco/nco_grp_utl.c src/nco/nco_grp_utl.h) set(nco_SOURCES ${nco_SOURCES} src/nco/nco_kd.c src/nco/nco_kd.h) set(nco_SOURCES ${nco_SOURCES} src/nco/nco_lmt.c src/nco/nco_lmt.h) set(nco_SOURCES ${nco_SOURCES} src/nco/nco_lst_utl.c src/nco/nco_lst_utl.h) set(nco_SOURCES ${nco_SOURCES} src/nco/nco_map.c src/nco/nco_map.h) set(nco_SOURCES ${nco_SOURCES} src/nco/nco_map.c src/nco/nco_map.h) set(nco_SOURCES ${nco_SOURCES} src/nco/nco_md5.c src/nco/nco_md5.h) set(nco_SOURCES ${nco_SOURCES} src/nco/nco_mmr.c src/nco/nco_mmr.h) set(nco_SOURCES ${nco_SOURCES} src/nco/nco_mpi.h) set(nco_SOURCES ${nco_SOURCES} src/nco/nco_msa.c src/nco/nco_msa.h) set(nco_SOURCES ${nco_SOURCES} src/nco/nco_mss_val.c src/nco/nco_mss_val.h) set(nco_SOURCES ${nco_SOURCES} src/nco/nco_mta.c src/nco/nco_mta.h) set(nco_SOURCES ${nco_SOURCES} src/nco/nco_netcdf.c src/nco/nco_netcdf.h) set(nco_SOURCES ${nco_SOURCES} src/nco/nco_omp.c src/nco/nco_omp.h) set(nco_SOURCES ${nco_SOURCES} src/nco/nco_pck.c src/nco/nco_pck.h) set(nco_SOURCES ${nco_SOURCES} src/nco/nco_ply.c src/nco/nco_ply.h) set(nco_SOURCES ${nco_SOURCES} src/nco/nco_ply_lst.c src/nco/nco_ply_lst.h) set(nco_SOURCES ${nco_SOURCES} src/nco/nco_ppc.c src/nco/nco_ppc.h) set(nco_SOURCES ${nco_SOURCES} src/nco/nco_prn.c src/nco/nco_prn.h) set(nco_SOURCES ${nco_SOURCES} src/nco/nco_rec_var.c src/nco/nco_rec_var.h) set(nco_SOURCES ${nco_SOURCES} src/nco/nco_rgr.c src/nco/nco_rgr.h) set(nco_SOURCES ${nco_SOURCES} src/nco/nco_rth_flt.c src/nco/nco_rth_flt.h) set(nco_SOURCES ${nco_SOURCES} src/nco/nco_rth_utl.c src/nco/nco_rth_utl.h) set(nco_SOURCES ${nco_SOURCES} src/nco/nco_s1d.c src/nco/nco_s1d.h) set(nco_SOURCES ${nco_SOURCES} src/nco/nco_scl_utl.c src/nco/nco_scl_utl.h) set(nco_SOURCES ${nco_SOURCES} src/nco/nco_scm.c src/nco/nco_scm.h) set(nco_SOURCES ${nco_SOURCES} src/nco/nco_sld.c src/nco/nco_sld.h) set(nco_SOURCES ${nco_SOURCES} src/nco/nco_sng_utl.c src/nco/nco_sng_utl.h) set(nco_SOURCES ${nco_SOURCES} src/nco/nco_sph.c src/nco/nco_sph.h) set(nco_SOURCES ${nco_SOURCES} src/nco/nco_srm.c src/nco/nco_srm.h) set(nco_SOURCES ${nco_SOURCES} src/nco/nco_typ.h) set(nco_SOURCES ${nco_SOURCES} src/nco/nco_uthash.h) set(nco_SOURCES ${nco_SOURCES} src/nco/nco_var_avg.c src/nco/nco_var_avg.h) set(nco_SOURCES ${nco_SOURCES} src/nco/nco_var_lst.c src/nco/nco_var_lst.h) set(nco_SOURCES ${nco_SOURCES} src/nco/nco_var_rth.c src/nco/nco_var_rth.h) set(nco_SOURCES ${nco_SOURCES} src/nco/nco_var_scv.c src/nco/nco_var_scv.h) set(nco_SOURCES ${nco_SOURCES} src/nco/nco_var_utl.c src/nco/nco_var_utl.h) # Type of library (SHARED, STATIC) is configured using BUILD_SHARED_LIBS add_library(nco ${nco_SOURCES}) add_executable(ncatted src/nco/ncatted.c) add_executable(ncbo src/nco/ncbo.c) add_executable(ncecat src/nco/ncecat.c) add_executable(ncflint src/nco/ncflint.c) add_executable(ncks src/nco/ncks.c) add_executable(ncpdq src/nco/ncpdq.c) add_executable(ncra src/nco/ncra.c) add_executable(ncrename src/nco/ncrename.c) #////////////////////////// #ncwa, flex, bison on UNIX #flex -Pnco_yy ncap_lex.l #mv lex.nco_yy.c ncap_lex.c #bison -d --name-prefix=nco_yy --output=ncap_yacc.c -d ncap_yacc.y #////////////////////////// set(ncwa_SOURCES ${ncwa_SOURCES}) set(ncwa_SOURCES ${ncwa_SOURCES} src/nco/ncwa.c) find_package(FLEX QUIET) if(FLEX_FOUND) add_definitions(-DHAVE_BISON_FLEX) message("-- Flex found at ${FLEX_EXECUTABLE}") FLEX_TARGET(nco_scanner src/nco/ncap_lex.l ${CMAKE_CURRENT_BINARY_DIR}/ncap_lex.c COMPILE_FLAGS "-Pnco_yy") include_directories(${CMAKE_CURRENT_BINARY_DIR}) include_directories(src/nco) message("-- Flex will generate ${FLEX_nco_scanner_OUTPUTS}") set(ncwa_SOURCES ${ncwa_SOURCES} ${FLEX_nco_scanner_OUTPUTS} src/nco/ncap_utl.c) else() message("${color_magenta}-- Flex not found${color_reset}") endif() add_executable(ncwa ${ncwa_SOURCES}) set(nco_LIB nco) target_link_libraries (ncatted ${nco_LIB} ${LIB_DEP}) target_link_libraries (ncbo ${nco_LIB} ${LIB_DEP}) target_link_libraries (ncecat ${nco_LIB} ${LIB_DEP}) target_link_libraries (ncflint ${nco_LIB} ${LIB_DEP}) target_link_libraries (ncks ${nco_LIB} ${LIB_DEP}) target_link_libraries (ncpdq ${nco_LIB} ${LIB_DEP}) target_link_libraries (ncra ${nco_LIB} ${LIB_DEP}) target_link_libraries (ncrename ${nco_LIB} ${LIB_DEP}) target_link_libraries (ncwa ${nco_LIB} ${LIB_DEP}) #////////////////////////// #ANTLR #cmake can detect relative paths, e.g, antlr/AST.hpp #detect a user defined system environment variable ANTLR_ROOT #this sets the include path to ANTLR_INCLUDE directly #and a PATHS hint for ANTLR_LIBRARY #For this case find_library(ANTLR_LIBRARY) MUST be called 2 times #First time it looks in ANTLR_LIBRARY_PATH if set, avoiding all other PATHS with NO_DEFAULT_PATH #////////////////////////// set(antlr_root "$ENV{ANTLR_ROOT}") if(antlr_root) set(ANTLR_INCLUDE "${antlr_root}/include") set(ANTLR_LIBRARY_PATH "${antlr_root}/lib") set(ANTLR_BIN "${antlr_root}/bin") set(ENV{PATH} "${ANTLR_BIN}:$ENV{PATH}") message("${color_blue}-- Using user defined antlr location: ${antlr_root}${color_reset}") endif() find_path(ANTLR_INCLUDE antlr/AST.hpp ${find_opt}) if(NOT ANTLR_INCLUDE) message("${color_magenta}-- ANTLR header files not found${color_reset}") else() message("-- Found ANTLR header files at: " ${ANTLR_INCLUDE}) endif() find_library(ANTLR_LIBRARY NAMES antlr PATHS ${ANTLR_LIBRARY_PATH} NO_DEFAULT_PATH) find_library(ANTLR_LIBRARY NAMES antlr ${find_opt}) if(NOT ANTLR_LIBRARY) message("${color_magenta}-- ANTLR library not found${color_reset}") else() message("-- Found ANTLR library at: " ${ANTLR_LIBRARY}) endif() if(ANTLR_INCLUDE AND ANTLR_LIBRARY) message("${color_green}-- Building ncap2, netCDF Arithmetic Processor${color_reset}") else() message("${color_magenta}-- Disabling ncap2, netCDF Arithmetic Processor${color_reset}") endif() set(ncap2_SOURCES ${ncap2_SOURCES} src/nco++/Invoke.cc) set(ncap2_SOURCES ${ncap2_SOURCES} src/nco++/Invoke.cc) set(ncap2_SOURCES ${ncap2_SOURCES} src/nco++/NcapVar.cc) set(ncap2_SOURCES ${ncap2_SOURCES} src/nco++/NcapVarVector.cc) set(ncap2_SOURCES ${ncap2_SOURCES} src/nco++/fmc_all_cls.cc) set(ncap2_SOURCES ${ncap2_SOURCES} src/nco++/fmc_cls.cc) set(ncap2_SOURCES ${ncap2_SOURCES} src/nco++/fmc_gsl_cls.cc) set(ncap2_SOURCES ${ncap2_SOURCES} src/nco++/ncap2.cc) set(ncap2_SOURCES ${ncap2_SOURCES} src/nco++/ncap2_att.cc) set(ncap2_SOURCES ${ncap2_SOURCES} src/nco++/ncap2_utl.cc) set(ncap2_SOURCES ${ncap2_SOURCES} src/nco++/ncoLexer.cpp) set(ncap2_SOURCES ${ncap2_SOURCES} src/nco++/ncoParser.cpp) set(ncap2_SOURCES ${ncap2_SOURCES} src/nco++/ncoTree.cpp) set(ncap2_SOURCES ${ncap2_SOURCES} src/nco++/nco_gsl.cc) set(ncap2_SOURCES ${ncap2_SOURCES} src/nco++/prs_cls.cc) set(ncap2_SOURCES ${ncap2_SOURCES} src/nco++/sdo_utl.cc) set(ncap2_SOURCES ${ncap2_SOURCES} src/nco++/sym_cls.cc) #////////////////////////// #GSL #GSL CBLAS needed for Linux Fedora; assuming here all gsl-dev packages have it #////////////////////////// #////////////////////////// # ncap2 #////////////////////////// if(ANTLR_INCLUDE AND ANTLR_LIBRARY) add_executable(ncap2 ${ncap2_SOURCES}) target_include_directories(ncap2 PRIVATE src/nco ${ANTLR_INCLUDE}) target_link_libraries (ncap2 ${nco_LIB} ${LIB_DEP} ${ANTLR_LIBRARY}) #////////////////////////// # macros used in ncap2 to use advanced math: erf, erfc, gamma # LINUX LINUXAMD64 MACOS #////////////////////////// if(APPLE) add_definitions(-DMACOS) endif() if(UNIX AND NOT APPLE) add_definitions(-DLINUX) endif() endif() #////////////////////////// # detect system specific functions used by NCO #////////////////////////// check_function_exists(mkstemp HAVE_mkstemp) if (HAVE_mkstemp) message("-- Found function mkstemp") add_definitions(-DHAVE_MKSTEMP) endif() check_function_exists(creat HAVE_creat) if (HAVE_creat) message("-- Found function creat") add_definitions(-DHAVE_CREAT) endif() #////////////////////////// #math functions, including float versions #NCO_CHECK_FUNCS([atan2]) #NCO_CHECK_FUNCS([acosf asinf atanf atan2f cosf expf fabsf fmodf log10f logf powf sinf sqrtf tanf]) #NCO_CHECK_FUNCS([erff erfcf gammaf]) #NCO_CHECK_FUNCS([acoshf asinhf atanhf coshf sinhf tanhf]) #NCO_CHECK_FUNCS([ceilf floorf]) #NCO_CHECK_FUNCS([nearbyint rint round trunc]) #NCO_CHECK_FUNCS([nearbyintf rintf roundf truncf]) #////////////////////////// find_library(MATH_LIBRARY NAMES m ${find_opt}) if(MATH_LIBRARY) message("-- Checking for math library functions at: " ${MATH_LIBRARY}) set(CMAKE_REQUIRED_LIBRARIES m) set(CMAKE_REQUIRED_QUIET 0) macro(nco_check_funcs func) unset(have_result CACHE) check_function_exists(${ARGV0} have_result) if (NOT have_result) message("${color_blue}-- Using NCO defined version of ${ARGV0}${color_reset}") string(TOUPPER ${ARGV0} def_fnc ) add_definitions(-DNEED_${def_fnc}) endif() endmacro(nco_check_funcs) nco_check_funcs(atan2) nco_check_funcs(acosf) nco_check_funcs(asinf) nco_check_funcs(atanf) nco_check_funcs(cosf) nco_check_funcs(expf) nco_check_funcs(fabsf) nco_check_funcs(fmodf) nco_check_funcs(log10f) nco_check_funcs(logf) nco_check_funcs(powf) nco_check_funcs(sinf) nco_check_funcs(sqrtf) nco_check_funcs(tanf) nco_check_funcs(erff) nco_check_funcs(erfcf) nco_check_funcs(gammaf) nco_check_funcs(acoshf) nco_check_funcs(asinhf) nco_check_funcs(atanhf) nco_check_funcs(coshf) nco_check_funcs(sinhf) nco_check_funcs(tanhf) nco_check_funcs(ceilf) nco_check_funcs(floorf) nco_check_funcs(nearbyint) nco_check_funcs(rint) nco_check_funcs(round) nco_check_funcs(trunc) nco_check_funcs(nearbyintf) nco_check_funcs(rintf) nco_check_funcs(roundf) nco_check_funcs(truncf) endif(MATH_LIBRARY) check_include_file(strings.h HAVE_STRINGS_H) if (HAVE_STRINGS_H) message("-- Found header strings.h") add_definitions(-DHAVE_STRINGS_H) endif() #////////////////////////// # regex #////////////////////////// check_include_file(regex.h HAVE_REGEX_H) check_function_exists(regexec HAVE_REGEXEC) check_function_exists(regcomp HAVE_REGCOMP) check_function_exists(regfree HAVE_REGFREE) if (HAVE_REGEX_H) message("-- Found header regex.h") add_definitions(-DHAVE_REGEX_H) endif() if (HAVE_REGEX_H AND HAVE_REGEXEC AND HAVE_REGCOMP AND HAVE_REGFREE) message("${color_green}-- Enabling Regex functionality...${color_reset}") add_definitions(-DNCO_HAVE_REGEX_FUNCTIONALITY) endif() #////////////////////////// # Additional definitions used by ncks -r #////////////////////////// if (CURL_LIBRARY) add_definitions(-DENABLE_DAP) endif() if (CMAKE_BUILD_TYPE MATCHES Debug) add_definitions(-DENABLE_DEBUG_SYMBOLS) endif() #////////////////////////// # USER, HOSTNAME, NCO_BUILDENGINE # HOSTNAME is a variable that is set by some shells like Bash, and not others # CMake for speed and consistency runs commands using the most basic UNIX shell, sh, which does not set HOSTNAME #////////////////////////// set(nco_user "$ENV{USER}") if(NOT nco_user) set(nco_user "$ENV{USERNAME}") endif() if(nco_user) message("-- USER is set to: " ${nco_user}) add_definitions(-DUSER=${nco_user}) endif() cmake_host_system_information(RESULT nco_hostname QUERY HOSTNAME) if(nco_hostname) message("-- HOSTNAME is set to: " ${nco_hostname}) add_definitions(-DHOSTNAME=${nco_hostname}) endif() set(NCO_BUILDENGINE "CMake") if(NCO_BUILDENGINE) message("-- NCO_BUILDENGINE is set to: " ${NCO_BUILDENGINE}) add_definitions(-DNCO_BUILDENGINE=${NCO_BUILDENGINE}) endif() #////////////////////////// # OpenMP #////////////////////////// if(NOT MSVC) find_package(OpenMP QUIET) if(OPENMP_FOUND) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") message("${color_green}-- Building with OpenMP support${color_reset}") else() message("-- Building without OpenMP support") endif() endif() #///////////////////////////////////////////////////////////////////////////////////// #install target #install prefix: detect test suite expected location; if present use it instead #///////////////////////////////////////////////////////////////////////////////////// set(test_dir "$ENV{MY_BIN_DIR}") if(test_dir) if(test_dir STREQUAL ${CMAKE_INSTALL_PREFIX}) else() message("${color_magenta}-- Modifying installation prefix to location expected by test suite : ${test_dir}${color_reset}") set(CMAKE_INSTALL_PREFIX ${test_dir}) endif() endif() set(nco_targets ${nco_targets}) set(nco_targets ${nco_targets} ncks ncbo ncecat ncflint ncpdq ncra ncrename ncatted ncwa) #////////////////////////// #make ncap2 build last #////////////////////////// if(ANTLR_INCLUDE AND ANTLR_LIBRARY) add_dependencies(ncap2 ${nco_targets}) set(nco_targets ${nco_targets} ncap2) endif() set(PERMISSIONS_DEFAULT OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) message("-- Building ${nco_targets}") install(TARGETS ${nco_targets} RUNTIME DESTINATION . PERMISSIONS ${PERMISSIONS_DEFAULT}) install(FILES data/ncremap data/ncclimo data/ncz2psx data/ncchecker DESTINATION . PERMISSIONS ${PERMISSIONS_DEFAULT}) message("-- Installing data/ncremap, data/ncclimo, data/ncz2psx, data/ncchecker to: " ${CMAKE_INSTALL_PREFIX}) #////////////////////////// # ncea->ncra # nces->ncra # ncrcat->ncra # ncdiff->ncbo # ncunpack->ncpdq # the following cmake -E commands are available only on UNIX: # create_symlink # create a symbolic link naming . #////////////////////////// macro(install_links target src dest) add_custom_command(TARGET ${target} POST_BUILD COMMAND ${CMAKE_COMMAND} -E create_symlink ${src} ${dest} COMMENT "Making symbolic link ${src} -> ${dest}") install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${dest} DESTINATION . PERMISSIONS ${PERMISSIONS_DEFAULT}) endmacro(install_links) if(UNIX) install_links(ncra ${CMAKE_INSTALL_PREFIX}/ncra ncea) install_links(ncra ${CMAKE_INSTALL_PREFIX}/ncra nces) install_links(ncra ${CMAKE_INSTALL_PREFIX}/ncra ncrcat) install_links(ncbo ${CMAKE_INSTALL_PREFIX}/ncbo ncdiff) install_links(ncpdq ${CMAKE_INSTALL_PREFIX}/ncpdq ncunpack) endif() message("-- Installing links ncea;nces;ncrcat;ncdiff;ncunpack to: " ${CMAKE_INSTALL_PREFIX}) #////////////////////////// # uninstall target #////////////////////////// configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY) add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) #////////////////////////// # 'data' target , 'make data', generate .nc files from .cdl # find ncgen (any ncgen will do) #////////////////////////// find_program(PATH_TO_NCGEN NAMES ncgen) if (PATH_TO_NCGEN) set(PATH_DATA ${CMAKE_CURRENT_SOURCE_DIR}/data) message("${color_blue}-- Generating data target, using the ncgen tool at ${PATH_TO_NCGEN}${color_reset}") add_custom_target(data COMMENT "${color_green}Creating sample netCDF data files for self-tests in ${PATH_DATA}${color_reset}" COMMAND ${PATH_TO_NCGEN} -b -o ${PATH_DATA}/in.nc ${PATH_DATA}/in.cdl COMMAND ${PATH_TO_NCGEN} -b -o ${PATH_DATA}/split.nc ${PATH_DATA}/split.cdl COMMAND ${PATH_TO_NCGEN} -k netCDF-4 -b -o ${PATH_DATA}/cmip5.nc ${PATH_DATA}/cmip5.cdl COMMAND ${PATH_TO_NCGEN} -k netCDF-4 -b -o ${PATH_DATA}/in_1.nc ${PATH_DATA}/in_1.cdl COMMAND ${PATH_TO_NCGEN} -k netCDF-4 -b -o ${PATH_DATA}/in_2.nc ${PATH_DATA}/in_2.cdl COMMAND ${PATH_TO_NCGEN} -k netCDF-4 -b -o ${PATH_DATA}/in_grp.nc ${PATH_DATA}/in_grp.cdl COMMAND ${PATH_TO_NCGEN} -k netCDF-4 -b -o ${PATH_DATA}/in_grp_1.nc ${PATH_DATA}/in_grp_1.cdl COMMAND ${PATH_TO_NCGEN} -k netCDF-4 -b -o ${PATH_DATA}/in_grp_2.nc ${PATH_DATA}/in_grp_2.cdl COMMAND ${PATH_TO_NCGEN} -k netCDF-4 -b -o ${PATH_DATA}/in_grp_3.nc ${PATH_DATA}/in_grp_3.cdl COMMAND ${PATH_TO_NCGEN} -k netCDF-4 -b -o ${PATH_DATA}/in_grp_4.nc ${PATH_DATA}/in_grp_4.cdl COMMAND ${PATH_TO_NCGEN} -k netCDF-4 -b -o ${PATH_DATA}/in_grp_5.nc ${PATH_DATA}/in_grp_5.cdl COMMAND ${PATH_TO_NCGEN} -k netCDF-4 -b -o ${PATH_DATA}/in_grp_6.nc ${PATH_DATA}/in_grp_6.cdl COMMAND ${PATH_TO_NCGEN} -k netCDF-4 -b -o ${PATH_DATA}/in_grp_7.nc ${PATH_DATA}/in_grp_7.cdl COMMAND ${PATH_TO_NCGEN} -k netCDF-4 -b -o ${PATH_DATA}/mdl_1.nc ${PATH_DATA}/mdl_1.cdl COMMAND ${PATH_TO_NCGEN} -k netCDF-4 -b -o ${PATH_DATA}/mdl_2.nc ${PATH_DATA}/mdl_2.cdl COMMAND ${PATH_TO_NCGEN} -k netCDF-4 -b -o ${PATH_DATA}/mdl_3.nc ${PATH_DATA}/mdl_3.cdl COMMAND ${PATH_TO_NCGEN} -k netCDF-4 -b -o ${PATH_DATA}/obs.nc ${PATH_DATA}/obs.cdl) #////////////////////////// #make data build last #////////////////////////// add_dependencies(data ${nco_targets}) endif() #////////////////////////// # check target , 'make check' # it depends on the NCO executables AND on the 'data' target # in NCO 'make check' depends on 'make install', so tests can only be done # if we can install to a writable directory, test -w /path; echo $? returns 0 if writable # the default install prefix (e.g /usr) requires 'sudo' previleges # and the target would FAIL for this case, on the 'make install' part # if CMAKE_INSTALL_PREFIX does not exist, it is created #////////////////////////// execute_process(COMMAND test -d ${CMAKE_INSTALL_PREFIX} RESULT_VARIABLE test_d) if (test_d) message("${color_blue}-- Creating directory: ${CMAKE_INSTALL_PREFIX}${color_reset}") execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_INSTALL_PREFIX} ERROR_QUIET) endif() execute_process(COMMAND test -w ${CMAKE_INSTALL_PREFIX} RESULT_VARIABLE test_w) if (NOT test_w) set(can_write 1) endif() if(can_write AND UNIX) message("${color_blue}-- Generating check/install target with executables at: ${CMAKE_INSTALL_PREFIX}${color_reset}") add_custom_target(check COMMENT "${color_green}Running self-tests with NCO executables in ${CMAKE_INSTALL_PREFIX}${color_reset}" COMMAND cmake --build . --target install COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/bm/nco_bm.pl --regress) add_dependencies(check ${nco_targets} data) endif() #////////////////////////// # install prefix #////////////////////////// message("${color_blue}-- Using installation path: ${CMAKE_INSTALL_PREFIX}${color_reset}") if (NOT can_write) message("${color_magenta}-- Installing NCO requires write permission to: ${CMAKE_INSTALL_PREFIX}; check target is disabled${color_reset}") endif() #////////////////////////// # generate 'path.sh' on build path, run with 'source path.sh' # sets $PATH to locate the binaries we just built #////////////////////////// if (UNIX) set(file_sh ${CMAKE_CURRENT_BINARY_DIR}/path.sh) set(path "${CMAKE_INSTALL_PREFIX}:$ENV{PATH}") file(WRITE ${file_sh} "#!/usr/bin/env bash\n") file(APPEND ${file_sh} "export PATH=\"${path}\"") execute_process(COMMAND chmod a+x ${file_sh} RESULT_VARIABLE res) endif() #////////////////////////// # Compiler/Linker Warnings #////////////////////////// if(MSVC) add_definitions(-DWINOS) add_definitions(-D_CRT_SECURE_NO_WARNINGS) add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE) set(MSVC_DEVELOPER ON CACHE BOOL "Disable MSVC warnings /wd4267 /wd4244 /wd4477") if (MSVC_DEVELOPER) set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /wd4267 /wd4244 /wd4477") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /wd4267 /wd4244 /wd4477") set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /wd4267 /wd4244 /wd4477") set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /wd4267 /wd4244 /wd4477") endif() endif() #////////////////////////// # disable .pdb not found warnings #////////////////////////// if (MSVC) set_target_properties(ncks PROPERTIES LINK_FLAGS "/ignore:4099") set_target_properties(ncbo PROPERTIES LINK_FLAGS "/ignore:4099") set_target_properties(ncecat PROPERTIES LINK_FLAGS "/ignore:4099") set_target_properties(ncflint PROPERTIES LINK_FLAGS "/ignore:4099") set_target_properties(ncpdq PROPERTIES LINK_FLAGS "/ignore:4099") set_target_properties(ncra PROPERTIES LINK_FLAGS "/ignore:4099") set_target_properties(ncrename PROPERTIES LINK_FLAGS "/ignore:4099") set_target_properties(ncatted PROPERTIES LINK_FLAGS "/ignore:4099") set_target_properties(ncwa PROPERTIES LINK_FLAGS "/ignore:4099") set_target_properties(ncap2 PROPERTIES LINK_FLAGS "/ignore:4099") endif (MSVC) #////////////////////////// # Use of strcasecmp() and strncasecmp() # UDUNITS2 defines strcasecmp #////////////////////////// if (UDUNITS2_LIBRARY AND UDUNITS2_INCLUDE) set(have_udunits) endif() if (MSVC) if (NOT ${have_udunits}) add_definitions(-DNEED_STRCASECMP) endif() add_definitions(-DNEED_STRNCASECMP) endif(MSVC) #ncra.exe to nces.exe and ncrcat.exe if (MSVC) set (out ${CMAKE_CURRENT_BINARY_DIR}) if (MSVC_IDE) set (out ${CMAKE_CURRENT_BINARY_DIR}/Debug) endif (MSVC_IDE) message("-- Renaming ncra.exe to nces.exe and ncrcat.exe in " ${output}) add_custom_command(TARGET ncra POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${out}/ncra.exe ${out}/nces.exe) add_custom_command(TARGET ncra POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${out}/ncra.exe ${out}/ncrcat.exe) endif (MSVC) nco-5.3.3/COPYING000066400000000000000000000027221477164337000133530ustar00rootroot00000000000000BSD 3-Clause License Copyright 1995--present Charlie Zender Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. nco-5.3.3/COPYRIGHT000066400000000000000000000016521477164337000136140ustar00rootroot00000000000000Charlie Zender wrote most of NCO and holds all NCO copyrights. He places NCO under the BSD 3-Clause license (see file COPYING). Advance permission must be sought from him for any usage or (re-)distribution of NCO code not compliant with the BSD. Contact him at . His surname is zender. All other NCO contributors either explicitly assigned their copyrights to Zender, or their contributions were not legally significant for copyright purposes. These contributors are all listed under "Contributors" in the User Guide documentation (nco.texi) at http://nco.sf.net/nco.html#ppl and in the file AUTHORS The original author of this software, Charlie Zender, seeks to improve it with your suggestions, contributions, bug-reports, and patches. Please contact the NCO project at http://nco.sf.net or write to Charlie Zender Department of Earth System Science University of California, Irvine Irvine, CA 92697-3100 nco-5.3.3/ChangeLog000077700000000000000000000000001477164337000164012doc/ChangeLogustar00rootroot00000000000000nco-5.3.3/INSTALL000066400000000000000000000366001477164337000133530ustar00rootroot00000000000000Installation Instructions ************************* Copyright (C) 1994-1996, 1999-2002, 2004-2011 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without warranty of any kind. Basic Installation ================== Briefly, the shell commands `./configure; make; make install' should configure, build, and install this package. The following more-detailed instructions are generic; see the `README' file for instructions specific to this package. Some packages provide this `INSTALL' file but do not implement all of the features documented below. The lack of an optional feature in a given package is not necessarily a bug. More recommendations for GNU packages can be found in *note Makefile Conventions: (standards)Makefile Conventions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. Caching is disabled by default to prevent problems with accidental use of stale cache files. If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. Running `configure' might take a while. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package, generally using the just-built uninstalled binaries. 4. Type `make install' to install the programs and any data files and documentation. When installing into a prefix owned by root, it is recommended that the package be configured and built as a regular user, and only the `make install' phase executed with root privileges. 5. Optionally, type `make installcheck' to repeat any self-tests, but this time using the binaries in their final installed location. This target does not install anything. Running this target as a regular user, particularly if the prior `make install' required root privileges, verifies that the installation completed correctly. 6. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. 7. Often, you can also type `make uninstall' to remove the installed files again. In practice, not all packages have tested that uninstallation works correctly, even though it is required by the GNU Coding Standards. 8. Some packages, particularly those that use Automake, provide `make distcheck', which can by used by developers to test that all other targets like `make install' and `make uninstall' work correctly. This target is generally not run by end users. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: ./configure CC=c99 CFLAGS=-g LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you can use GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. This is known as a "VPATH" build. With a non-GNU `make', it is safer to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. On MacOS X 10.5 and later systems, you can create libraries and executables that work on multiple system types--known as "fat" or "universal" binaries--by specifying multiple `-arch' options to the compiler but only a single `-arch' option to the preprocessor. Like this: ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CPP="gcc -E" CXXCPP="g++ -E" This is not guaranteed to produce working output in all cases, you may have to build one architecture at a time and combine the results using the `lipo' tool if you have problems. Installation Names ================== By default, `make install' installs the package's commands under `/usr/local/bin', include files under `/usr/local/include', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PREFIX', where PREFIX must be an absolute file name. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you pass the option `--exec-prefix=PREFIX' to `configure', the package uses PREFIX as the prefix for installing programs and libraries. Documentation and other data files still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=DIR' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. In general, the default for these options is expressed in terms of `${prefix}', so that specifying just `--prefix' will affect all of the other directory specifications that were not explicitly provided. The most portable way to affect installation locations is to pass the correct locations to `configure'; however, many packages provide one or both of the following shortcuts of passing variable assignments to the `make install' command line to change installation locations without having to reconfigure or recompile. The first method involves providing an override variable for each affected directory. For example, `make install prefix=/alternate/directory' will choose an alternate location for all directory configuration variables that were expressed in terms of `${prefix}'. Any directories that were specified during `configure', but not in terms of `${prefix}', must each be overridden at install time for the entire installation to be relocated. The approach of makefile variable overrides for each directory variable is required by the GNU Coding Standards, and ideally causes no recompilation. However, some platforms have known limitations with the semantics of shared libraries that end up requiring recompilation when using this method, particularly noticeable in packages that use GNU Libtool. The second method involves providing the `DESTDIR' variable. For example, `make install DESTDIR=/alternate/directory' will prepend `/alternate/directory' before all installation names. The approach of `DESTDIR' overrides is not required by the GNU Coding Standards, and does not work on platforms that have drive letters. On the other hand, it does better at avoiding recompilation issues, and works well even when some directory options were not specified in terms of `${prefix}' at `configure' time. Optional Features ================= If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Some packages offer the ability to configure how verbose the execution of `make' will be. For these packages, running `./configure --enable-silent-rules' sets the default to minimal output, which can be overridden with `make V=1'; while running `./configure --disable-silent-rules' sets the default to verbose, which can be overridden with `make V=0'. Particular systems ================== On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC is not installed, it is recommended to use the following options in order to use an ANSI C compiler: ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" and if that doesn't work, install pre-built binaries of GCC for HP-UX. HP-UX `make' updates targets which have the same time stamps as their prerequisites, which makes it generally unusable when shipped generated files such as `configure' are involved. Use GNU `make' instead. On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot parse its `' header file. The option `-nodtk' can be used as a workaround. If GNU CC is not installed, it is therefore recommended to try ./configure CC="cc" and if that doesn't work, try ./configure CC="cc -nodtk" On Solaris, don't put `/usr/ucb' early in your `PATH'. This directory contains several dysfunctional programs; working variants of these programs are available in `/usr/bin'. So, if you need `/usr/ucb' in your `PATH', put it _after_ `/usr/bin'. On Haiku, software installed for all users goes in `/boot/common', not `/usr/local'. It is recommended to use the following options: ./configure --prefix=/boot/common Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, `configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the option `--target=TYPE' to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc causes the specified `gcc' to be used as the C compiler (unless it is overridden in the site shell script). Unfortunately, this technique does not work for `CONFIG_SHELL' due to an Autoconf bug. Until the bug is fixed you can use this workaround: CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of all of the options to `configure', and exit. `--help=short' `--help=recursive' Print a summary of the options unique to this package's `configure', and exit. The `short' variant lists options used only in the top level, while the `recursive' variant lists options also present in any nested packages. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `--prefix=DIR' Use DIR as the installation prefix. *note Installation Names:: for more details, including other options available for fine-tuning the installation locations. `--no-create' `-n' Run the configure checks, but stop before creating any output files. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. nco-5.3.3/LICENSE000066400000000000000000000014011477164337000133160ustar00rootroot00000000000000All source code created by the NCO project and distributed with NCO is re-distributable under the terms of the 3-Clause BSD License. The full license text is at https://opensource.org/licenses/BSD-3-Clause and in the file COPYING. Copyright information is in the file COPYRIGHT. You are permitted to link NCO with the HDF, netCDF, OPeNDAP, and UDUnits libraries and to distribute the resulting executables under the terms of the BSD, but in addition obeying the extra stipulations of the HDF, netCDF, OPeNDAP, and UDUnits licenses. 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 3-Clause BSD License for more details. nco-5.3.3/Makefile.am000066400000000000000000000014711477164337000143540ustar00rootroot00000000000000# $Header$ -*-makefile-*- # 20151001: Sub-folder is by default, and not when configure --disable-docs is invoked SUBDIRS = data src man @DOC_FOLDER@ # Separately add desired files from nco/bld/ to distribution # Autoconf does not know about the bld directory # In particular, nco/bld/Makefile was created manually, not by autoconf bld_extras = bld/Makefile bld/pvmgetarch bld/nco.spec EXTRA_DIST = $(bld_extras) ACLOCAL_AMFLAGS = -I m4 # 20200917 Attempt to improve TAG-generation ETAGS_ARGS = CMakeLists.txt Makefile.am configure.ac TAGS_DEPENDENCIES = CMakeLists.txt Makefile.am configure.ac test: tst tst: $(MAKE) check cd data && $(MAKE) in_4c.nc && cd .. cd bm && ./nco_bm.pl --regress regress: rgr rgr: cd bm && ./nco_bm.pl --regress regress-mpi: rgr_mpi rgr_mpi: cd bm && ./nco_bm.pl --regress --mpi_prc=2 nco-5.3.3/Makefile.in000066400000000000000000000666401477164337000143760ustar00rootroot00000000000000# Makefile.in generated by automake 1.17 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2024 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@ # $Header$ -*-makefile-*- 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)) am__rm_f = rm -f $(am__rm_f_notfound) am__rm_rf = rm -rf $(am__rm_f_notfound) 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@ target_triplet = @target@ subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/acinclude.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 = $(SHELL) $(top_srcdir)/autobld/mkinstalldirs CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ cscope distdir distdir-am dist dist-all distcheck 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)` DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \ $(top_srcdir)/autobld/compile \ $(top_srcdir)/autobld/config.guess \ $(top_srcdir)/autobld/config.sub \ $(top_srcdir)/autobld/install-sh \ $(top_srcdir)/autobld/ltmain.sh $(top_srcdir)/autobld/missing \ $(top_srcdir)/autobld/mkinstalldirs AUTHORS COPYING ChangeLog \ INSTALL NEWS README autobld/compile autobld/config.guess \ autobld/config.sub autobld/depcomp autobld/install-sh \ autobld/ltmain.sh autobld/missing autobld/mkinstalldirs \ autobld/texinfo.tex autobld/ylwrap 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 -700 -exec chmod u+rwx {} ';' \ ; 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 = -9 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 -a \! \ \( -name .nfs* -o -name .smb* -o -name .__afs* \) \) -print ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ ANTLR_LIB = @ANTLR_LIB@ ANTLR_ROOT = @ANTLR_ROOT@ 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@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOC_FOLDER = @DOC_FOLDER@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ HAVE_ANTLR = @HAVE_ANTLR@ HAVE_MAKEINFO = @HAVE_MAKEINFO@ I18N_SHARE = @I18N_SHARE@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LFLAGS = @LFLAGS@ LIBOBJS = @LIBOBJS@ 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@ NCOXX = @NCOXX@ NCO_CXX = @NCO_CXX@ NCO_VERSION = @NCO_VERSION@ NETCDF_INC = @NETCDF_INC@ NETCDF_LIB = @NETCDF_LIB@ NETCDF_ROOT = @NETCDF_ROOT@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENMP_CFLAGS = @OPENMP_CFLAGS@ 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@ PATH_TO_NCGEN = @PATH_TO_NCGEN@ POW_LIB = @POW_LIB@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__rm_f_notfound = @am__rm_f_notfound@ am__tar = @am__tar@ am__untar = @am__untar@ am__xargs_n = @am__xargs_n@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ # 20151001: Sub-folder is by default, and not when configure --disable-docs is invoked SUBDIRS = data src man @DOC_FOLDER@ # Separately add desired files from nco/bld/ to distribution # Autoconf does not know about the bld directory # In particular, nco/bld/Makefile was created manually, not by autoconf bld_extras = bld/Makefile bld/pvmgetarch bld/nco.spec EXTRA_DIST = $(bld_extras) ACLOCAL_AMFLAGS = -I m4 # 20200917 Attempt to improve TAG-generation ETAGS_ARGS = CMakeLists.txt Makefile.am configure.ac TAGS_DEPENDENCIES = CMakeLists.txt Makefile.am configure.ac all: config.h $(MAKE) $(AM_MAKEFLAGS) 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): 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 $(AM_V_at)rm -f stamp-h1 $(AM_V_GEN)cd $(top_builddir) && $(SHELL) ./config.status config.h $(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) $(AM_V_GEN)($(am__cd) $(top_srcdir) && $(AUTOHEADER)) $(AM_V_at)rm -f stamp-h1 $(AM_V_at)touch $@ distclean-hdr: -rm -f config.h stamp-h1 mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool config.lt # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. # To change the values of 'make' variables: instead of editing Makefiles, # (1) if the variable is set in 'config.status', edit 'config.status' # (which will cause the Makefiles to be regenerated when you run 'make'); # (2) otherwise, pass the desired values on the 'make' command line. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscope: cscope.files test ! -s cscope.files \ || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS) clean-cscope: -rm -f cscope.files cscope.files: clean-cscope cscopelist cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -rm -f cscope.out cscope.in.out cscope.po.out cscope.files distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) $(am__remove_distdir) $(AM_V_at)$(MKDIR_P) "$(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 -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 -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 config.h 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: -$(am__rm_f) $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || $(am__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-hdr \ distclean-libtool distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: .MAKE: $(am__recursive_targets) all 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-hdr distclean-libtool \ distclean-tags distcleancheck distdir distuninstallcheck dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs installdirs-am \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am .PRECIOUS: Makefile test: tst tst: $(MAKE) check cd data && $(MAKE) in_4c.nc && cd .. cd bm && ./nco_bm.pl --regress regress: rgr rgr: cd bm && ./nco_bm.pl --regress regress-mpi: rgr_mpi rgr_mpi: cd bm && ./nco_bm.pl --regress --mpi_prc=2 # 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: # Tell GNU make to disable its built-in pattern rules. %:: %,v %:: RCS/%,v %:: RCS/% %:: s.% %:: SCCS/s.% nco-5.3.3/NEWS000066400000000000000000000016231477164337000130160ustar00rootroot00000000000000NCO NEWS -- history of user-visible changes. -------- * Changes in NCO version 1.2: ** Fortran compatibility has been dropped ** DODS support ** New operations: min,max,ttl,rms,rmssdn... ^L * Changes in NCO version 1.1: ^L ** New operator ncatted--netCDF Attribute Editor ** Windows NT supported ** Improved documentation ** ncrcat support for DOE ARM-style time=base_time+time_offset records ^L * Changes in NCO version 1.0: ^L ** All known bugs in version 0.9 have been fixed. ** The manual is nearly complete, and describes all operators. ** All operators should now work on machines with sizeof(long) > sizeof(int). ** Implemented ARM time=base_time+time_offset convention in ncrcat. ** Improved support for NCAR CSM conventions ** ncks allows specification of hyperslab stride ** ncks works with wrapped coordinates (e.g., longitude) ^L Local variables: mode: outline paragraph-separate: "[ ^L]*$" end: nco-5.3.3/README000066400000000000000000000072231477164337000132010ustar00rootroot00000000000000# $Header$ -*-text-*- # Purpose: NCO README file What is NCO? The netCDF Operators, NCO, are a suite of programs known as operators. The operators facilitate manipulation and analysis of self-describing data stored in the freely available netCDF and HDF formats (http://www.unidata.ucar.edu/packages/netcdf and http://hdfgroup.org, respectively). Each NCO operator (e.g., ncks) takes netCDF or HDF input file(s), performs an operation (e.g., averaging, hyperslabbing, or renaming), and outputs information, usually a processed netCDF file Although most users of netCDF and HDF data are involved in scientific research, these data formats, and thus NCO, are generic and are equally useful in fields from agriculture to zoology. The NCO Users Guide illustrates NCO use with examples from the field of climate modeling and analysis. The NCO homepage is http://nco.sf.net. Installation: NCO runs on all major UNIX systems and MS Windows. NCO (except ncap2) requires only an ANSI-compliant C99 compiler. NCO can be built and installed with the standard GNU autotools ./configure mechanism or with a custom Makefile. ncap2 requires an C++ compiler and can be hard to build. Please submit patches to help simplify the build system! Newer Autotools Configure Build Procedure: Try the newer ./configure mechanism first by using the configure command in the top-level NCO directory: `cd ~/nco;./configure;make;make install' or `cd ~/nco;./configure;make;make install-strip' if you to strip the executables and libraries. In this case, NCO will run at the same speed, but consume less memory and only about half the disk space since all debugging information is "stripped". If autotools do not work, please look at the slightly more complex (and realistic) examples that we use to test your machine architecture. These are in the configure.eg file in the top-level NCO directory. The output of these commands from our test machines is available at http://dust.ess.uci.edu/nco/rgr Please send us any modifications to the configure.ac script that might benefit other NCO users. Older Manual Makefile Build Procedure: If configure does not work for you, try the older build mechanism: `cd ~/nco/bld;make dir;make' `cd ~/nco/src/nco_c++;make -f Makefile.old dir;make -f Makefile.old' You must use GNU make, which reads `Makefile' by default. Makefile has some hardcoded switches which may be only valid at UCI or NCAR, but which can serve as a template for your environment. First, be sure to define NETCDF_INC and NETCDF_LIB variables either within your environment, or at the top of Makefile. Within Makefile, locate the block of code which corresponds to your machine type as defined by $PVM_ARCH and the pvmgetarch command. Within this block you may need to edit the CC, CPPFLAGS, and LDFLAGS arguments so they reflect the names of the compilers and linkers. Read ./bld/Makefile for useful user-specified switches. Compile with `make OPTS=D' to build debugging versions. Environment variables MY_OBJ_DIR, MY_INC_DIR, MY_LIB_DIR and MY_BIN_DIR control locations of object files, include files, libraries, and executables. Documentation and Bug Reports: Please read the NCO manual before you submit a bug report! It is supplied in many formats: Postscript (nco.ps), Texinfo (nco.texi), Info (nco.info), HTML (nco.html), and DVI (nco.dvi). If you got NCO from a CVS snapshot, you must generate these formats yourself with 'make nco.html', 'make nco.pdf', 'make nco.ps', etc. from within the doc/ directory. Sending me questions whose answers aren't in the manual is the best way to motivate me to write more documentation. Let me also accentuate the contrapositive of that suggestion. Good luck! Charlie nco-5.3.3/README.md000066400000000000000000000076741477164337000136120ustar00rootroot00000000000000NCO NetCDF Operators ==================== The NCO toolkit manipulates and analyzes data stored in [netCDF](http://www.unidata.ucar.edu/packages/netcdf)-accessible formats, including [DAP](http://opendap.org), [HDF4](http://hdfgroup.org/products/hdf4), and [HDF5](http://hdfgroup.org/HDF5). It exploits the geophysical expressivity of many [CF](http://cfconventions.org/1.6.html) (Climate & Forecast) metadata conventions, the flexible description of physical dimensions translated by [UDUnits](http://www.unidata.ucar.edu/packages/udunits), the network transparency of [OPeNDAP](http://opendap.org), the storage features (e.g., compression, chunking, groups) of [HDF](http://hdfgroup.org) (the Hierarchical Data Format), and many powerful mathematical and statistical algorithms of [GSL](http://www.gnu.org/software/gsl) (the GNU Scientific Library). NCO is [fast](http://dust.ess.uci.edu/ppr/ppr_ZeM07.pdf), [powerful](http://dust.ess.uci.edu/ppr/ppr_Zen08.pdf), and [free](http://www.gnu.org/licenses/gpl-3.0.html). What is NCO? ------------ The netCDF Operators (NCO) comprise a dozen standalone, command-line programs that take [netCDF](http://www.unidata.ucar.edu/packages/netcdf), [HDF](http://hdfgroup.org), and/or [DAP](http://opendap.org) files as input, then operate (e.g., derive new data, compute statistics, print, hyperslab, manipulate metadata) and output the results to screen or files in text, binary, or netCDF formats. NCO aids analysis of gridded scientific data. The shell-command style of NCO allows users to manipulate and analyze files interactively, or with expressive scripts that avoid some overhead of higher-level programming environments. Traditional geoscience data analysis requires users to work with numerous flat (data in one level or namespace) files. In that paradigm instruments or models produce, and then repositories archive and distribute, and then researchers request and analyze, collections of flat files. NCO works well with that paradigm, yet it also embodies the necessary algorithms to transition geoscience data analysis from relying solely on traditional (or “flat”) datasets to allowing newer hierarchical (or “nested”) datasets. | Operator | Full Name | Examples | -------- |:-------------------------- | :---------- | `ncap2` | netCDF Arithmetic Processor | [here](http://nco.sf.net/nco.html#ncap2) | | `ncatted` | netCDF ATTribute EDitor | [here](http://nco.sf.net/nco.html#ncatted) | | `ncbo` | netCDF Binary Operator | [here](http://nco.sf.net/nco.html#ncbo) | | `ncclimo` | netCDF CLIMatOlogy Generator | [here](http://nco.sf.net/nco.html#ncclimo) | | `nces` | netCDF Ensemble Statistics | [here](http://nco.sf.net/nco.html#nces) | | `ncecat` | netCDF Ensemble conCATenator | [here](http://nco.sf.net/nco.html#ncecat) | | `ncflint` | netCDF FiLe INTerpolator | [here](http://nco.sf.net/nco.html#ncflint) | | `ncks` | netCDF Kitchen Sink | [here](http://nco.sf.net/nco.html#ncks) | | `ncpdq` | netCDF Permute Dimensions Quickly, Pack Data Quietly | [here](http://nco.sf.net/nco.html#ncpdq) | | `ncra` | netCDF Record Averager | [here](http://nco.sf.net/nco.html#ncra) | | `ncrcat` | netCDF Record conCATenator | [here](http://nco.sf.net/nco.html#ncrcat) | | `ncremap` | netCDF REMAPer | [here](http://nco.sf.net/nco.html#ncremap) | | `ncrename` | netCDF RENAMEer | [here](http://nco.sf.net/nco.html#ncrename) | | `ncwa` | netCDF Weighted Averager | [here](http://nco.sf.net/nco.html#ncwa) | ### How to Contribute: Volunteer, Endorse, or Donate The NCO project [homepage](http://sf.net/projects/nco) points to mailing lists, discussion forums, and instructions to make contributing easy. ### Acknowledgements NCO has been supported by volunteers and professionals since 1995. External support from DOE, NASA, and NSF has sustained development and addition of its most powerful features. nco-5.3.3/acinclude.m4000066400000000000000000000026571477164337000145200ustar00rootroot00000000000000AC_DEFUN([AC_CXX_HAVE_VALARRAY], [AC_CACHE_CHECK(whether C++ compiler has working valarray, ac_cv_cxx_have_valarray, [AC_REQUIRE([AC_CXX_NAMESPACES]) AC_LANG_SAVE AC_LANG([C++]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include #ifdef HAVE_NAMESPACES using namespace std; #endif]], [[valarray x(100); return 0;]])],[ac_cv_cxx_have_valarray=yes],[ac_cv_cxx_have_valarray=no]) AC_LANG_RESTORE ]) if test "$ac_cv_cxx_have_valarray" = yes; then AC_DEFINE(HAVE_VALARRAY,,[Define if C++ compiler has working valarray]) fi ]) AC_DEFUN([AC_CXX_NAMESPACES], [AC_CACHE_CHECK(whether C++ compiler implements namespaces, ac_cv_cxx_namespaces, [AC_LANG_SAVE AC_LANG([C++]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[namespace Outer { namespace Inner { int i = 0; }}]], [[using namespace Outer::Inner; return i;]])],[ac_cv_cxx_namespaces=yes],[ac_cv_cxx_namespaces=no]) AC_LANG_RESTORE ]) if test "$ac_cv_cxx_namespaces" = yes; then AC_DEFINE(HAVE_NAMESPACES,,[Define if C++ compiler implements namespaces]) fi ]) dnl NCO_CHECK_FUNCS provided by Eric Blake of RedHat on autoconf USENET group 20100805 AC_DEFUN([NCO_CHECK_FUNCS], [m4_foreach_w([NCO_Func],[$1],[AC_CHECK_FUNC(NCO_Func, [AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_]NCO_Func), [1], [Define to 1 if compiler finds external `]NCO_Func[' function])], [AC_DEFINE_UNQUOTED(AS_TR_CPP([NEED_]NCO_Func), [1], [Define to 1 if compiler needs external `]NCO_Func[' function])]dnl )])]) nco-5.3.3/aclocal.m4000066400000000000000000001424551477164337000141700ustar00rootroot00000000000000# generated automatically by aclocal 1.17 -*- Autoconf -*- # Copyright (C) 1996-2024 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.72],, [m4_warning([this file was generated for autoconf 2.72. 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-2024 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.17' 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.17], [], [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.17])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-2024 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-2024 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-2024 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 thus: # 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-2024 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}"])]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996-2024 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: # # 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 AC_REQUIRE([_AM_PROG_RM_F]) AC_REQUIRE([_AM_PROG_XARGS_N]) 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-2024 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-2024 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-2024 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-2024 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-2024 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-2024 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-2024 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) 2022-2024 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_RM_F # --------------- # Check whether 'rm -f' without any arguments works. # https://bugs.gnu.org/10828 AC_DEFUN([_AM_PROG_RM_F], [am__rm_f_notfound= AS_IF([(rm -f && rm -fr && rm -rf) 2>/dev/null], [], [am__rm_f_notfound='""']) AC_SUBST(am__rm_f_notfound) ]) # Copyright (C) 2001-2024 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-2024 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_SLEEP_FRACTIONAL_SECONDS # ---------------------------- AC_DEFUN([_AM_SLEEP_FRACTIONAL_SECONDS], [dnl AC_CACHE_CHECK([whether sleep supports fractional seconds], am_cv_sleep_fractional_seconds, [dnl AS_IF([sleep 0.001 2>/dev/null], [am_cv_sleep_fractional_seconds=yes], [am_cv_sleep_fractional_seconds=no]) ])]) # _AM_FILESYSTEM_TIMESTAMP_RESOLUTION # ----------------------------------- # Determine the filesystem's resolution for file modification # timestamps. The coarsest we know of is FAT, with a resolution # of only two seconds, even with the most recent "exFAT" extensions. # The finest (e.g. ext4 with large inodes, XFS, ZFS) is one # nanosecond, matching clock_gettime. However, it is probably not # possible to delay execution of a shell script for less than one # millisecond, due to process creation overhead and scheduling # granularity, so we don't check for anything finer than that. (See below.) AC_DEFUN([_AM_FILESYSTEM_TIMESTAMP_RESOLUTION], [dnl AC_REQUIRE([_AM_SLEEP_FRACTIONAL_SECONDS]) AC_CACHE_CHECK([filesystem timestamp resolution], am_cv_filesystem_timestamp_resolution, [dnl # Default to the worst case. am_cv_filesystem_timestamp_resolution=2 # Only try to go finer than 1 sec if sleep can do it. # Don't try 1 sec, because if 0.01 sec and 0.1 sec don't work, # - 1 sec is not much of a win compared to 2 sec, and # - it takes 2 seconds to perform the test whether 1 sec works. # # Instead, just use the default 2s on platforms that have 1s resolution, # accept the extra 1s delay when using $sleep in the Automake tests, in # exchange for not incurring the 2s delay for running the test for all # packages. # am_try_resolutions= if test "$am_cv_sleep_fractional_seconds" = yes; then # Even a millisecond often causes a bunch of false positives, # so just try a hundredth of a second. The time saved between .001 and # .01 is not terribly consequential. am_try_resolutions="0.01 0.1 $am_try_resolutions" fi # In order to catch current-generation FAT out, we must *modify* files # that already exist; the *creation* timestamp is finer. Use names # that make ls -t sort them differently when they have equal # timestamps than when they have distinct timestamps, keeping # in mind that ls -t prints the *newest* file first. rm -f conftest.ts? : > conftest.ts1 : > conftest.ts2 : > conftest.ts3 # Make sure ls -t actually works. Do 'set' in a subshell so we don't # clobber the current shell's arguments. (Outer-level square brackets # are removed by m4; they're present so that m4 does not expand # ; be careful, easy to get confused.) if ( set X `[ls -t conftest.ts[12]]` && { test "$[]*" != "X conftest.ts1 conftest.ts2" || test "$[]*" != "X conftest.ts2 conftest.ts1"; } ); then :; else # 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_ECHO_UNQUOTED( ["Bad output from ls -t: \"`[ls -t conftest.ts[12]]`\""], [AS_MESSAGE_LOG_FD]) AC_MSG_FAILURE([ls -t produces unexpected output. Make sure there is not a broken ls alias in your environment.]) fi for am_try_res in $am_try_resolutions; do # Any one fine-grained sleep might happen to cross the boundary # between two values of a coarser actual resolution, but if we do # two fine-grained sleeps in a row, at least one of them will fall # entirely within a coarse interval. echo alpha > conftest.ts1 sleep $am_try_res echo beta > conftest.ts2 sleep $am_try_res echo gamma > conftest.ts3 # We assume that 'ls -t' will make use of high-resolution # timestamps if the operating system supports them at all. if (set X `ls -t conftest.ts?` && test "$[]2" = conftest.ts3 && test "$[]3" = conftest.ts2 && test "$[]4" = conftest.ts1); then # # Ok, ls -t worked. If we're at a resolution of 1 second, we're done, # because we don't need to test make. make_ok=true if test $am_try_res != 1; then # But if we've succeeded so far with a subsecond resolution, we # have one more thing to check: make. It can happen that # everything else supports the subsecond mtimes, but make doesn't; # notably on macOS, which ships make 3.81 from 2006 (the last one # released under GPLv2). https://bugs.gnu.org/68808 # # We test $MAKE if it is defined in the environment, else "make". # It might get overridden later, but our hope is that in practice # it does not matter: it is the system "make" which is (by far) # the most likely to be broken, whereas if the user overrides it, # probably they did so with a better, or at least not worse, make. # https://lists.gnu.org/archive/html/automake/2024-06/msg00051.html # # Create a Makefile (real tab character here): rm -f conftest.mk echo 'conftest.ts1: conftest.ts2' >conftest.mk echo ' touch conftest.ts2' >>conftest.mk # # Now, running # touch conftest.ts1; touch conftest.ts2; make # should touch ts1 because ts2 is newer. This could happen by luck, # but most often, it will fail if make's support is insufficient. So # test for several consecutive successes. # # (We reuse conftest.ts[12] because we still want to modify existing # files, not create new ones, per above.) n=0 make=${MAKE-make} until test $n -eq 3; do echo one > conftest.ts1 sleep $am_try_res echo two > conftest.ts2 # ts2 should now be newer than ts1 if $make -f conftest.mk | grep 'up to date' >/dev/null; then make_ok=false break # out of $n loop fi n=`expr $n + 1` done fi # if $make_ok; then # Everything we know to check worked out, so call this resolution good. am_cv_filesystem_timestamp_resolution=$am_try_res break # out of $am_try_res loop fi # Otherwise, we'll go on to check the next resolution. fi done rm -f conftest.ts? # (end _am_filesystem_timestamp_resolution) ])]) # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_REQUIRE([_AM_FILESYSTEM_TIMESTAMP_RESOLUTION]) # This check should not be cached, as it may vary across builds of # different projects. 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). am_build_env_is_sane=no am_has_slept=no rm -f conftest.file for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file if ( 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 test "$[]2" = conftest.file ); then am_build_env_is_sane=yes break fi # Just in case. sleep "$am_cv_filesystem_timestamp_resolution" am_has_slept=yes done AC_MSG_RESULT([$am_build_env_is_sane]) if test "$am_build_env_is_sane" = no; then AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= AS_IF([test -e conftest.file || grep 'slept: no' conftest.file >/dev/null 2>&1],, [dnl ( sleep "$am_cv_filesystem_timestamp_resolution" ) & am_sleep_pid=$! ]) 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-2024 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 # ---------------- # Enable less verbose build rules support. AC_DEFUN([_AM_SILENT_RULES], [AM_DEFAULT_VERBOSITY=1 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 ]) 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]) 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 dnl Delay evaluation of AM_DEFAULT_VERBOSITY to the end to allow multiple calls dnl to AM_SILENT_RULES to change the default value. AC_CONFIG_COMMANDS_PRE([dnl case $enable_silent_rules in @%:@ ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; esac 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 ])dnl ]) # AM_SILENT_RULES([DEFAULT]) # -------------------------- # Set the default verbosity level to DEFAULT ("yes" being less verbose, "no" or # empty being verbose). AC_DEFUN([AM_SILENT_RULES], [AC_REQUIRE([_AM_SILENT_RULES]) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1])]) # Copyright (C) 2001-2024 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-2024 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-2024 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 x$am_uid = xunknown; then AC_MSG_WARN([ancient id detected; assuming current UID is ok, but dist-ustar might not work]) elif 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 x$gm_gid = xunknown; then AC_MSG_WARN([ancient id detected; assuming current GID is ok, but dist-ustar might not work]) elif test $am_gid -le $am_max_gid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi], [pax], [], [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Go ahead even if we have the value already cached. We do so because we # need to set the values for the 'am__tar' and 'am__untar' variables. _am_tools=${am_cv_prog_tar_$1-$_am_tools} for _am_tool in $_am_tools; do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works. rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR # Copyright (C) 2022-2024 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_XARGS_N # ---------------- # Check whether 'xargs -n' works. It should work everywhere, so the fallback # is not optimized at all as we never expect to use it. AC_DEFUN([_AM_PROG_XARGS_N], [AC_CACHE_CHECK([xargs -n works], am_cv_xargs_n_works, [dnl AS_IF([test "`echo 1 2 3 | xargs -n2 echo`" = "1 2 3"], [am_cv_xargs_n_works=yes], [am_cv_xargs_n_works=no])]) AS_IF([test "$am_cv_xargs_n_works" = yes], [am__xargs_n='xargs -n'], [dnl am__xargs_n='am__xargs_n () { shift; sed "s/ /\\n/g" | while read am__xargs_n_arg; do "$@" "$am__xargs_n_arg"; done; }' ])dnl AC_SUBST(am__xargs_n) ]) 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([acinclude.m4]) nco-5.3.3/autobld/000077500000000000000000000000001477164337000137475ustar00rootroot00000000000000nco-5.3.3/autobld/compile000077500000000000000000000162451477164337000153350ustar00rootroot00000000000000#! /bin/sh # Wrapper for compilers which do not understand '-c -o'. scriptversion=2012-10-14.11; # UTC # Copyright (C) 1999-2013 Free Software Foundation, Inc. # Written by Tom Tromey . # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . nl=' ' # We need space, tab and new line, in precisely that order. Quoting is # there to prevent tools from complaining about whitespace usage. IFS=" "" $nl" file_conv= # func_file_conv build_file lazy # Convert a $build file to $host form and store it in $file # Currently only supports Windows hosts. If the determined conversion # type is listed in (the comma separated) LAZY, no conversion will # take place. func_file_conv () { file=$1 case $file in / | /[!/]*) # absolute file, and not a UNC file if test -z "$file_conv"; then # lazily determine how to convert abs files case `uname -s` in MINGW*) file_conv=mingw ;; CYGWIN*) file_conv=cygwin ;; *) file_conv=wine ;; esac fi case $file_conv/,$2, in *,$file_conv,*) ;; mingw/*) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; cygwin/*) file=`cygpath -m "$file" || echo "$file"` ;; wine/*) file=`winepath -w "$file" || echo "$file"` ;; esac ;; esac } # func_cl_dashL linkdir # Make cl look for libraries in LINKDIR func_cl_dashL () { func_file_conv "$1" if test -z "$lib_path"; then lib_path=$file else lib_path="$lib_path;$file" fi linker_opts="$linker_opts -LIBPATH:$file" } # func_cl_dashl library # Do a library search-path lookup for cl func_cl_dashl () { lib=$1 found=no save_IFS=$IFS IFS=';' for dir in $lib_path $LIB do IFS=$save_IFS if $shared && test -f "$dir/$lib.dll.lib"; then found=yes lib=$dir/$lib.dll.lib break fi if test -f "$dir/$lib.lib"; then found=yes lib=$dir/$lib.lib break fi if test -f "$dir/lib$lib.a"; then found=yes lib=$dir/lib$lib.a break fi done IFS=$save_IFS if test "$found" != yes; then lib=$lib.lib fi } # func_cl_wrapper cl arg... # Adjust compile command to suit cl func_cl_wrapper () { # Assume a capable shell lib_path= shared=: linker_opts= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. eat=1 case $2 in *.o | *.[oO][bB][jJ]) func_file_conv "$2" set x "$@" -Fo"$file" shift ;; *) func_file_conv "$2" set x "$@" -Fe"$file" shift ;; esac ;; -I) eat=1 func_file_conv "$2" mingw set x "$@" -I"$file" shift ;; -I*) func_file_conv "${1#-I}" mingw set x "$@" -I"$file" shift ;; -l) eat=1 func_cl_dashl "$2" set x "$@" "$lib" shift ;; -l*) func_cl_dashl "${1#-l}" set x "$@" "$lib" shift ;; -L) eat=1 func_cl_dashL "$2" ;; -L*) func_cl_dashL "${1#-L}" ;; -static) shared=false ;; -Wl,*) arg=${1#-Wl,} save_ifs="$IFS"; IFS=',' for flag in $arg; do IFS="$save_ifs" linker_opts="$linker_opts $flag" done IFS="$save_ifs" ;; -Xlinker) eat=1 linker_opts="$linker_opts $2" ;; -*) set x "$@" "$1" shift ;; *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) func_file_conv "$1" set x "$@" -Tp"$file" shift ;; *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) func_file_conv "$1" mingw set x "$@" "$file" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -n "$linker_opts"; then linker_opts="-link$linker_opts" fi exec "$@" $linker_opts exit 1 } eat= case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: compile [--help] [--version] PROGRAM [ARGS] Wrapper for compilers which do not understand '-c -o'. Remove '-o dest.o' from ARGS, run PROGRAM with the remaining arguments, and rename the output as expected. If you are trying to build a whole package this is not the right script to run: please start by reading the file 'INSTALL'. Report bugs to . EOF exit $? ;; -v | --v*) echo "compile $scriptversion" exit $? ;; cl | *[/\\]cl | cl.exe | *[/\\]cl.exe ) func_cl_wrapper "$@" # Doesn't return... ;; esac ofile= cfile= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. # So we strip '-o arg' only if arg is an object. eat=1 case $2 in *.o | *.obj) ofile=$2 ;; *) set x "$@" -o "$2" shift ;; esac ;; *.c) cfile=$1 set x "$@" "$1" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -z "$ofile" || test -z "$cfile"; then # If no '-o' option was seen then we might have been invoked from a # pattern rule where we don't need one. That is ok -- this is a # normal compilation that the losing compiler can handle. If no # '.c' file was seen then we are probably linking. That is also # ok. exec "$@" fi # Name of file we expect compiler to create. cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` # Create the lock directory. # Note: use '[/\\:.-]' here to ensure that we don't use the same name # that we are using for the .o file. Also, base the name on the expected # object file name, since that is what matters with a parallel build. lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d while true; do if mkdir "$lockdir" >/dev/null 2>&1; then break fi sleep 1 done # FIXME: race condition here if user kills between mkdir and trap. trap "rmdir '$lockdir'; exit 1" 1 2 15 # Run the compile. "$@" ret=$? if test -f "$cofile"; then test "$cofile" = "$ofile" || mv "$cofile" "$ofile" elif test -f "${cofile}bj"; then test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" fi rmdir "$lockdir" exit $ret # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: nco-5.3.3/autobld/config.guess000077500000000000000000001426761477164337000163070ustar00rootroot00000000000000#! /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-08-22' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # # Originally written by Per Bothner; 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 . # 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 ." 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" #if defined(__ANDROID__) LIBC=android #else #include #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc #elif defined(__GLIBC__) LIBC=gnu #else #include /* First heuristic to detect musl libc. */ #ifdef __DEFINED_va_list LIBC=musl #endif #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 /* 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 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 #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if 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 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=`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:*:*) 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 __ARM_EABI__ #ifdef __ARM_PCS_VFP ABI=eabihf #else ABI=eabi #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 eabi | eabihf) CPU=armv8l; LIBCABI=$LIBC$ABI ;; esac fi GUESS=$CPU-unknown-linux-$LIBCABI ;; 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 ;; kvx:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; kvx:cos:*:*) GUESS=$UNAME_MACHINE-unknown-cos ;; kvx:mbr:*:*) GUESS=$UNAME_MACHINE-unknown-mbr ;; 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' /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 GUESS=i586-unisys-sysv4 ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # 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" < #include #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 #if defined(_SIZE_T_) || defined(SIGLOST) #include #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 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 #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 <&2 <&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: nco-5.3.3/autobld/config.sub000077500000000000000000001072021477164337000157340ustar00rootroot00000000000000#! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2023 Free Software Foundation, Inc. # shellcheck disable=SC2006,SC2268 # see below for rationale timestamp='2023-09-19' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # Please send patches to . # # 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 ." 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 <&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-* \ | windows-* ) 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 <&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. obj= 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 <&2 fi ;; *) echo "Invalid configuration '$1': OS '$os' not recognized" 1>&2 exit 1 ;; esac case $obj in aout* | coff* | elf* | pe*) ;; '') # empty is fine ;; *) echo "Invalid configuration '$1': Machine code format '$obj' not recognized" 1>&2 exit 1 ;; esac # Here we handle the constraint that a (synthetic) cpu and os are # valid only in combination with each other and nowhere else. case $cpu-$os in # The "javascript-unknown-ghcjs" triple is used by GHC; we # accept it here in order to tolerate that, but reject any # variations. javascript-ghcjs) ;; javascript-* | *-ghcjs) echo "Invalid configuration '$1': cpu '$cpu' is not valid with os '$os$obj'" 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-$obj in linux-gnu*- | linux-dietlibc*- | linux-android*- | linux-newlib*- \ | linux-musl*- | linux-relibc*- | linux-uclibc*- | linux-mlibc*- ) ;; uclinux-uclibc*- ) ;; managarm-mlibc*- | managarm-kernel*- ) ;; windows*-msvc*-) ;; -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 ;; *-msvc*- ) echo "Invalid configuration '$1': '$os' needs 'windows'." 1>&2 exit 1 ;; kfreebsd*-gnu*- | kopensolaris*-gnu*-) ;; vxworks-simlinux- | vxworks-simwindows- | vxworks-spe-) ;; nto-qnx*-) ;; os2-emx-) ;; *-eabi*- | *-gnueabi*-) ;; none--*) # None (no kernel, i.e. freestanding / bare metal), # can be paired with an machine code file format ;; -*-) # Blank kernel with real OS is always fine. ;; --*) # Blank kernel and OS with real machine code file format 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:+-$os}${obj:+-$obj}" 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: nco-5.3.3/autobld/depcomp000077500000000000000000000475561477164337000153450ustar00rootroot00000000000000#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2011-12-04.11; # UTC # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010, # 2011 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try \`$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by `PROGRAMS ARGS'. object Object file output by `PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputting dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac 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" # 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 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 -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ## The second -e expression handles DOS-style file names with drive letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the `deleted header file' problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. tr ' ' ' ' < "$tmpdepfile" | ## Some versions of gcc put a space before the `:'. On the theory ## that the space means something, we add a space to the output as ## well. 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. 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 -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like `#:fec' to the end of the # dependency line. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ tr ' ' ' ' >> "$depfile" echo >> "$depfile" # The second pass generates a dummy entry for each header file. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. 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. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then tmpdepfile1=$dir$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 -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then # Each line is of the form `foo.o: dependent.h'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a tab and a space in the []. sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; icc) # Intel's C compiler understands `-MD -MF file'. However on # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c # ICC 7.0 will fill foo.d with something like # foo.o: sub/foo.c # foo.o: sub/foo.h # which is wrong. We want: # sub/foo.o: sub/foo.c # sub/foo.o: sub/foo.h # sub/foo.c: # sub/foo.h: # ICC 7.1 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using \ : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; 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. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d "$@" -Wc,+Maked else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d "$@" +Maked fi stat=$? if test $stat -eq 0; then : else 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,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" # Add `dependent.h:' lines. sed -ne '2,${ s/^ *// s/ \\*$// s/$/:/ p }' "$tmpdepfile" >> "$depfile" else echo "#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. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then # With Tru64 cc, shared objects can also be used to make a # static library. This mechanism is used in libtool 1.4 series to # handle both shared and static libraries in a single compilation. # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. # # With libtool 1.5 this exception was removed, and libtool now # 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.libs/$base.lo.d # libtool 1.4 tmpdepfile2=$dir$base.o.d # libtool 1.5 tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.o.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d tmpdepfile4=$dir$base.d "$@" -MD fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a tab and a space in the []. sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; 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" = 0; then : else 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/\(.*\)/ \1 \\/p s/.\(.*\) \\/\1:/ H $ { s/.*/ / G p }' >> "$depfile" 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:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" tr ' ' ' ' < "$tmpdepfile" | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test "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" sed '1,2d' "$tmpdepfile" | tr ' ' ' ' | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the 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:: \1 \\:p' >> "$depfile" echo " " >> "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; msvcmsys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: nco-5.3.3/autobld/install-sh000077500000000000000000000332561477164337000157640ustar00rootroot00000000000000#!/bin/sh # install - install a program, script, or datafile scriptversion=2011-01-19.21; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. nl=' ' IFS=" "" $nl" # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit=${DOITPROG-} if test -z "$doit"; then doit_exec=exec else doit_exec=$doit fi # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_glob='?' initialize_posix_glob=' test "$posix_glob" != "?" || { if (set -f) 2>/dev/null; then posix_glob= else posix_glob=: fi } ' posix_mkdir= # Desired mode of installed file. mode=0755 chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false no_target_directory= usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve the last data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *' '* | *' '* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; -t) dst_arg=$2 # Protect names problematic for `test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac shift;; -T) no_target_directory=true;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg # Protect names problematic for `test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call `install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then do_exit='(exit $ret); exit $ret' trap "ret=129; $do_exit" 1 trap "ret=130; $do_exit" 2 trap "ret=141; $do_exit" 13 trap "ret=143; $do_exit" 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names problematic for `test' and other utilities. case $src in -* | [=\(\)!]) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dst=$dstdir/`basename "$src"` dstdir_status=0 else # Prefer dirname, but fall back on a substitute if dirname fails. dstdir=` (dirname "$dst") 2>/dev/null || expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$dst" : 'X\(//\)[^/]' \| \ X"$dst" : 'X\(//\)$' \| \ X"$dst" : 'X\(/\)' \| . 2>/dev/null || echo X"$dst" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q' ` test -d "$dstdir" dstdir_status=$? fi fi obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # Create intermediate dirs using mode 755 as modified by the umask. # This is like FreeBSD 'install' as of 1997-10-28. umask=`umask` case $stripcmd.$umask in # Optimize common cases. *[2367][2367]) mkdir_umask=$umask;; .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; *[0-7]) mkdir_umask=`expr $umask + 22 \ - $umask % 100 % 40 + $umask % 20 \ - $umask % 10 % 4 + $umask % 2 `;; *) mkdir_umask=$umask,go-w;; esac # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false case $umask in *[123567][0-7][0-7]) # POSIX mkdir -p sets u+wx bits regardless of umask, which # is incompatible with FreeBSD 'install' when (umask & 300) != 0. ;; *) tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 if (umask $mkdir_umask && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writeable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. ls_ld_tmpdir=`ls -ld "$tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/d" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null fi trap '' 0;; esac;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # The umask is ridiculous, or mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; [-=\(\)!]*) prefix='./';; *) prefix='';; esac eval "$initialize_posix_glob" oIFS=$IFS IFS=/ $posix_glob set -f set fnord $dstdir shift $posix_glob set +f IFS=$oIFS prefixes= for d do test X"$d" = X && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask=$mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && eval "$initialize_posix_glob" && $posix_glob set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && $posix_glob set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd -f "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: nco-5.3.3/autobld/ltmain.sh000066400000000000000000011707711477164337000156050ustar00rootroot00000000000000#! /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 , 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 . 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 . # 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.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.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"} : ${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='' tc_bold=''; tc_standout='' tc_red=''; tc_green='' tc_blue=''; tc_cyan='' 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 . # 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 '_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 . GNU libtool home page: . General help using GNU software: ." 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 </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_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=$arg arg_mode=normal ;; target ) libobj=$arg arg_mode=normal continue ;; normal ) # Accept any command-line options. case $arg in -o) test -n "$libobj" && \ func_fatal_error "you cannot specify '-o' more than once" arg_mode=target continue ;; -pie | -fpie | -fPIE) func_append pie_flag " $arg" continue ;; -shared | -static | -prefer-pic | -prefer-non-pic) func_append later " $arg" continue ;; -no-suppress) suppress_opt=no continue ;; -Xcompiler) arg_mode=arg # the next one goes into the "base_compile" arg list continue # The current "srcfile" will either be retained or ;; # replaced later. I would guess that would be a bug. -Wc,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result lastarg= save_ifs=$IFS; IFS=, for arg in $args; do IFS=$save_ifs func_append_quoted lastarg "$arg" done IFS=$save_ifs func_stripname ' ' '' "$lastarg" lastarg=$func_stripname_result # Add the arguments to base_compile. func_append base_compile " $lastarg" continue ;; *) # Accept the current argument as the source file. # The previous "srcfile" becomes the current argument. # lastarg=$srcfile srcfile=$arg ;; esac # case $arg ;; esac # case $arg_mode # Aesthetically quote the previous argument. func_append_quoted base_compile "$lastarg" done # for arg case $arg_mode in arg) func_fatal_error "you must specify an argument for -Xcompile" ;; target) func_fatal_error "you must specify a target with '-o'" ;; *) # Get the name of the library object. test -z "$libobj" && { func_basename "$srcfile" libobj=$func_basename_result } ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo case $libobj in *.[cCFSifmso] | \ *.ada | *.adb | *.ads | *.asm | \ *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup) func_xform "$libobj" libobj=$func_xform_result ;; esac case $libobj in *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; *) func_fatal_error "cannot determine name of library object from '$libobj'" ;; esac func_infer_tag $base_compile for arg in $later; do case $arg in -shared) test 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 . $sharedlib_from_linklib_cmd "$dlprefile" dlprefile_dlbasename=$sharedlib_from_linklib_result fi fi $opt_dry_run || { if test -n "$dlprefile_dlbasename"; then eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' else func_warning "Could not compute DLL name from $name" eval '$ECHO ": $name " >> "$nlist"' fi func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" } else # not an import lib $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" } fi ;; *) $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" } ;; esac done $opt_dry_run || { # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $MV "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if $GREP -v "^: " < "$nlist" | if sort -k 3 /dev/null 2>&1; then sort -k 3 else sort +2 fi | uniq > "$nlist"S; then : else $GREP -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' else echo '/* NONE */' >> "$output_objdir/$my_dlsyms" fi 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 < #include #ifdef _MSC_VER # include # include # include #else # include # include # ifdef __CYGWIN__ # include # endif #endif #include #include #include #include #include #include #include #include #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 <= 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. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; =*) func_stripname '=' '' "$dir" dir=$lt_sysroot$func_stripname_result ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac case "$xrpath " in *" $dir "*) ;; *) func_append xrpath " $dir" ;; esac continue ;; -shared) # The effects of -shared are defined in a previous loop. continue ;; -shrext) prev=shrext continue ;; -static | -static-libtool-libs) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects # would be equivalent was wrong. It would break on at least # Digital Unix and AIX. continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; -version-number) prev=vinfo vinfo_number=yes continue ;; -weak) prev=weak continue ;; -Wc,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result arg= save_ifs=$IFS; IFS=, for flag in $args; do IFS=$save_ifs func_quote_for_eval "$flag" func_append arg " $func_quote_for_eval_result" func_append compiler_flags " $func_quote_for_eval_result" done IFS=$save_ifs func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Wl,*) func_stripname '-Wl,' '' "$arg" args=$func_stripname_result arg= save_ifs=$IFS; IFS=, for flag in $args; do IFS=$save_ifs func_quote_for_eval "$flag" func_append arg " $wl$func_quote_for_eval_result" func_append compiler_flags " $wl$func_quote_for_eval_result" func_append linker_flags " $func_quote_for_eval_result" done IFS=$save_ifs func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; -XCClinker) prev=xcclinker continue ;; # -msg_* for osf cc -msg_*) func_quote_for_eval "$arg" arg=$func_quote_for_eval_result ;; # Flags to be passed through unchanged, with rationale: # -64, -mips[0-9] enable 64-bit mode for the SGI compiler # -r[0-9][0-9]* specify processor for the SGI compiler # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler # +DA*, +DD* enable 64-bit mode for the HP compiler # -q* compiler args for the IBM compiler # -m*, -t[45]*, -txscale* architecture-specific flags for GCC # -F/path path to uninstalled frameworks, gcc on darwin # -p, -pg, --coverage, -fprofile-* profiling flags for GCC # -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 ;; 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'` 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*) ;; *) # 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 $CC in nagfor*) 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 </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 # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $deplibs " in *" -L$path/$objdir "*) func_append new_libs " -L$path/$objdir" ;; esac ;; esac done for deplib in $deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) func_append new_libs " $deplib" ;; esac ;; *) func_append new_libs " $deplib" ;; esac done deplibs=$new_libs # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test 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 ;; *) 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: nco-5.3.3/autobld/missing000077500000000000000000000153311477164337000153510ustar00rootroot00000000000000#! /bin/sh # Common wrapper for a few potentially missing GNU programs. scriptversion=2012-06-26.16; # UTC # Copyright (C) 1996-2013 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try '$0 --help' for more information" exit 1 fi case $1 in --is-lightweight) # Used by our autoconf macros to check whether the available missing # script is modern enough. exit 0 ;; --run) # Back-compat with the calling convention used by older automake. shift ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due to PROGRAM being missing or too old. Options: -h, --help display this help and exit -v, --version output version information and exit Supported PROGRAM values: aclocal autoconf autoheader autom4te automake makeinfo bison yacc flex lex help2man Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 'g' are ignored when checking the name. Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: unknown '$1' option" echo 1>&2 "Try '$0 --help' for more information" exit 1 ;; esac # Run the given program, remember its exit status. "$@"; st=$? # If it succeeded, we are done. test $st -eq 0 && exit 0 # Also exit now if we it failed (or wasn't found), and '--version' was # passed; such an option is passed most likely to detect whether the # program is present and works. case $2 in --version|--help) exit $st;; esac # Exit code 63 means version mismatch. This often happens when the user # tries to use an ancient version of a tool on a file that requires a # minimum version. if test $st -eq 63; then msg="probably too old" elif test $st -eq 127; then # Program was missing. msg="missing on your system" else # Program was found and executed, but failed. Give up. exit $st fi perl_URL=http://www.perl.org/ flex_URL=http://flex.sourceforge.net/ gnu_software_URL=http://www.gnu.org/software program_details () { case $1 in aclocal|automake) echo "The '$1' program is part of the GNU Automake package:" echo "<$gnu_software_URL/automake>" echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/autoconf>" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; autoconf|autom4te|autoheader) echo "The '$1' program is part of the GNU Autoconf package:" echo "<$gnu_software_URL/autoconf/>" echo "It also requires GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; esac } give_advice () { # Normalize program name to check for. normalized_program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` printf '%s\n' "'$1' is $msg." configure_deps="'configure.ac' or m4 files included by 'configure.ac'" case $normalized_program in autoconf*) echo "You should only need it if you modified 'configure.ac'," echo "or m4 files included by it." program_details 'autoconf' ;; autoheader*) echo "You should only need it if you modified 'acconfig.h' or" echo "$configure_deps." program_details 'autoheader' ;; automake*) echo "You should only need it if you modified 'Makefile.am' or" echo "$configure_deps." program_details 'automake' ;; aclocal*) echo "You should only need it if you modified 'acinclude.m4' or" echo "$configure_deps." program_details 'aclocal' ;; autom4te*) echo "You might have modified some maintainer files that require" echo "the 'automa4te' program to be rebuilt." program_details 'autom4te' ;; bison*|yacc*) echo "You should only need it if you modified a '.y' file." echo "You may want to install the GNU Bison package:" echo "<$gnu_software_URL/bison/>" ;; lex*|flex*) echo "You should only need it if you modified a '.l' file." echo "You may want to install the Fast Lexical Analyzer package:" echo "<$flex_URL>" ;; help2man*) echo "You should only need it if you modified a dependency" \ "of a man page." echo "You may want to install the GNU Help2man package:" echo "<$gnu_software_URL/help2man/>" ;; makeinfo*) echo "You should only need it if you modified a '.texi' file, or" echo "any other file indirectly affecting the aspect of the manual." echo "You might want to install the Texinfo package:" echo "<$gnu_software_URL/texinfo/>" echo "The spurious makeinfo call might also be the consequence of" echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" echo "want to install GNU make:" echo "<$gnu_software_URL/make/>" ;; *) echo "You might have modified some files without having the proper" echo "tools for further handling them. Check the 'README' file, it" echo "often tells you about the needed prerequisites for installing" echo "this package. You may also peek at any GNU archive site, in" echo "case some other package contains this missing '$1' program." ;; esac } give_advice "$1" | sed -e '1s/^/WARNING: /' \ -e '2,$s/^/ /' >&2 # Propagate the correct exit status (expected to be 127 for a program # not found, 63 for a program that failed due to version mismatch). exit $st # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: nco-5.3.3/autobld/mkinstalldirs000077500000000000000000000067221477164337000165640ustar00rootroot00000000000000#! /bin/sh # mkinstalldirs --- make directory hierarchy scriptversion=2009-04-28.21; # UTC # Original author: Noah Friedman # Created: 1993-05-16 # Public domain. # # This file is maintained in Automake, please report # bugs to or send patches to # . nl=' ' IFS=" "" $nl" errstatus=0 dirmode= usage="\ Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ... Create each directory DIR (with mode MODE, if specified), including all leading file name components. Report bugs to ." # process command line arguments while test $# -gt 0 ; do case $1 in -h | --help | --h*) # -h for help echo "$usage" exit $? ;; -m) # -m PERM arg shift test $# -eq 0 && { echo "$usage" 1>&2; exit 1; } dirmode=$1 shift ;; --version) echo "$0 $scriptversion" exit $? ;; --) # stop option processing shift break ;; -*) # unknown option echo "$usage" 1>&2 exit 1 ;; *) # first non-opt arg break ;; esac done for file do if test -d "$file"; then shift else break fi done case $# in 0) exit 0 ;; esac # Solaris 8's mkdir -p isn't thread-safe. If you mkdir -p a/b and # mkdir -p a/c at the same time, both will detect that a is missing, # one will create a, then the other will try to create a and die with # a "File exists" error. This is a problem when calling mkinstalldirs # from a parallel make. We use --version in the probe to restrict # ourselves to GNU mkdir, which is thread-safe. case $dirmode in '') if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then echo "mkdir -p -- $*" exec mkdir -p -- "$@" else # On NextStep and OpenStep, the `mkdir' command does not # recognize any option. It will interpret all options as # directories to create, and then abort because `.' already # exists. test -d ./-p && rmdir ./-p test -d ./--version && rmdir ./--version fi ;; *) if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 && test ! -d ./--version; then echo "mkdir -m $dirmode -p -- $*" exec mkdir -m "$dirmode" -p -- "$@" else # Clean up after NextStep and OpenStep mkdir. for d in ./-m ./-p ./--version "./$dirmode"; do test -d $d && rmdir $d done fi ;; esac for file do case $file in /*) pathcomp=/ ;; *) pathcomp= ;; esac oIFS=$IFS IFS=/ set fnord $file shift IFS=$oIFS for d do test "x$d" = x && continue pathcomp=$pathcomp$d case $pathcomp in -*) pathcomp=./$pathcomp ;; esac if test ! -d "$pathcomp"; then echo "mkdir $pathcomp" mkdir "$pathcomp" || lasterr=$? if test ! -d "$pathcomp"; then errstatus=$lasterr else if test ! -z "$dirmode"; then echo "chmod $dirmode $pathcomp" lasterr= chmod "$dirmode" "$pathcomp" || lasterr=$? if test ! -z "$lasterr"; then errstatus=$lasterr fi fi fi fi pathcomp=$pathcomp/ done done exit $errstatus # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: nco-5.3.3/autobld/test-driver000077500000000000000000000076111477164337000161520ustar00rootroot00000000000000#! /bin/sh # test-driver - basic testsuite driver script. scriptversion=2012-06-27.10; # UTC # Copyright (C) 2011-2013 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . # Make unconditional expansion of undefined variables an error. This # helps a lot in preventing typo-related bugs. set -u usage_error () { echo "$0: $*" >&2 print_usage >&2 exit 2 } print_usage () { cat <$log_file 2>&1 estatus=$? if test $enable_hard_errors = no && test $estatus -eq 99; then estatus=1 fi case $estatus:$expect_failure in 0:yes) col=$red res=XPASS recheck=yes gcopy=yes;; 0:*) col=$grn res=PASS recheck=no gcopy=no;; 77:*) col=$blu res=SKIP recheck=no gcopy=yes;; 99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;; *:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;; *:*) col=$red res=FAIL recheck=yes gcopy=yes;; esac # Report outcome to console. echo "${col}${res}${std}: $test_name" # Register the test result, and other relevant metadata. echo ":test-result: $res" > $trs_file echo ":global-test-result: $res" >> $trs_file echo ":recheck: $recheck" >> $trs_file echo ":copy-in-global-log: $gcopy" >> $trs_file # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: nco-5.3.3/autobld/texinfo.tex000066400000000000000000011721631477164337000161600ustar00rootroot00000000000000% texinfo.tex -- TeX macros to handle Texinfo files. % % Load plain if necessary, i.e., if running under initex. \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi % \def\texinfoversion{2013-09-10.16} % % Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, % 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc. % % This texinfo.tex file is free software: you can redistribute it and/or % modify it under the terms of the GNU General Public License as % published by the Free Software Foundation, either version 3 of the % License, or (at your option) any later version. % % This texinfo.tex file is distributed in the hope that it will be % useful, but WITHOUT ANY WARRANTY; without even the implied warranty % of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU % General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program. If not, see . % % As a special exception, when this file is read by TeX when processing % a Texinfo source document, you may use the result without % restriction. This Exception is an additional permission under section 7 % of the GNU General Public License, version 3 ("GPLv3"). % % Please try the latest version of texinfo.tex before submitting bug % reports; you can get the latest version from: % http://ftp.gnu.org/gnu/texinfo/ (the Texinfo release area), or % http://ftpmirror.gnu.org/texinfo/ (same, via a mirror), or % http://www.gnu.org/software/texinfo/ (the Texinfo home page) % The texinfo.tex in any given distribution could well be out % of date, so if that's what you're using, please check. % % Send bug reports to bug-texinfo@gnu.org. Please include including a % complete document in each bug report with which we can reproduce the % problem. Patches are, of course, greatly appreciated. % % To process a Texinfo manual with TeX, it's most reliable to use the % texi2dvi shell script that comes with the distribution. For a simple % manual foo.texi, however, you can get away with this: % tex foo.texi % texindex foo.?? % tex foo.texi % tex foo.texi % dvips foo.dvi -o # or whatever; this makes foo.ps. % The extra TeX runs get the cross-reference information correct. % Sometimes one run after texindex suffices, and sometimes you need more % than two; texi2dvi does it as many times as necessary. % % It is possible to adapt texinfo.tex for other languages, to some % extent. You can get the existing language-specific files from the % full Texinfo distribution. % % The GNU Texinfo home page is http://www.gnu.org/software/texinfo. \message{Loading texinfo [version \texinfoversion]:} % If in a .fmt file, print the version number % and turn on active characters that we couldn't do earlier because % they might have appeared in the input file name. \everyjob{\message{[Texinfo version \texinfoversion]}% \catcode`+=\active \catcode`\_=\active} \chardef\other=12 % We never want plain's \outer definition of \+ in Texinfo. % For @tex, we can use \tabalign. \let\+ = \relax % Save some plain tex macros whose names we will redefine. \let\ptexb=\b \let\ptexbullet=\bullet \let\ptexc=\c \let\ptexcomma=\, \let\ptexdot=\. \let\ptexdots=\dots \let\ptexend=\end \let\ptexequiv=\equiv \let\ptexexclam=\! \let\ptexfootnote=\footnote \let\ptexgtr=> \let\ptexhat=^ \let\ptexi=\i \let\ptexindent=\indent \let\ptexinsert=\insert \let\ptexlbrace=\{ \let\ptexless=< \let\ptexnewwrite\newwrite \let\ptexnoindent=\noindent \let\ptexplus=+ \let\ptexraggedright=\raggedright \let\ptexrbrace=\} \let\ptexslash=\/ \let\ptexstar=\* \let\ptext=\t \let\ptextop=\top {\catcode`\'=\active \global\let\ptexquoteright'}% active in plain's math mode % If this character appears in an error message or help string, it % starts a new line in the output. \newlinechar = `^^J % Use TeX 3.0's \inputlineno to get the line number, for better error % messages, but if we're using an old version of TeX, don't do anything. % \ifx\inputlineno\thisisundefined \let\linenumber = \empty % Pre-3.0. \else \def\linenumber{l.\the\inputlineno:\space} \fi % Set up fixed words for English if not already set. \ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi \ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi \ifx\putworderror\undefined \gdef\putworderror{error}\fi \ifx\putwordfile\undefined \gdef\putwordfile{file}\fi \ifx\putwordin\undefined \gdef\putwordin{in}\fi \ifx\putwordIndexIsEmpty\undefined \gdef\putwordIndexIsEmpty{(Index is empty)}\fi \ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi \ifx\putwordInfo\undefined \gdef\putwordInfo{Info}\fi \ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi \ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi \ifx\putwordNoTitle\undefined \gdef\putwordNoTitle{No Title}\fi \ifx\putwordof\undefined \gdef\putwordof{of}\fi \ifx\putwordon\undefined \gdef\putwordon{on}\fi \ifx\putwordpage\undefined \gdef\putwordpage{page}\fi \ifx\putwordsection\undefined \gdef\putwordsection{section}\fi \ifx\putwordSection\undefined \gdef\putwordSection{Section}\fi \ifx\putwordsee\undefined \gdef\putwordsee{see}\fi \ifx\putwordSee\undefined \gdef\putwordSee{See}\fi \ifx\putwordShortTOC\undefined \gdef\putwordShortTOC{Short Contents}\fi \ifx\putwordTOC\undefined \gdef\putwordTOC{Table of Contents}\fi % \ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi \ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi \ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi \ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi \ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi \ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi \ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi \ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi \ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi \ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi \ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi \ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi % \ifx\putwordDefmac\undefined \gdef\putwordDefmac{Macro}\fi \ifx\putwordDefspec\undefined \gdef\putwordDefspec{Special Form}\fi \ifx\putwordDefvar\undefined \gdef\putwordDefvar{Variable}\fi \ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi \ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi % Since the category of space is not known, we have to be careful. \chardef\spacecat = 10 \def\spaceisspace{\catcode`\ =\spacecat} % sometimes characters are active, so we need control sequences. \chardef\ampChar = `\& \chardef\colonChar = `\: \chardef\commaChar = `\, \chardef\dashChar = `\- \chardef\dotChar = `\. \chardef\exclamChar= `\! \chardef\hashChar = `\# \chardef\lquoteChar= `\` \chardef\questChar = `\? \chardef\rquoteChar= `\' \chardef\semiChar = `\; \chardef\slashChar = `\/ \chardef\underChar = `\_ % Ignore a token. % \def\gobble#1{} % The following is used inside several \edef's. \def\makecsname#1{\expandafter\noexpand\csname#1\endcsname} % Hyphenation fixes. \hyphenation{ Flor-i-da Ghost-script Ghost-view Mac-OS Post-Script ap-pen-dix bit-map bit-maps data-base data-bases eshell fall-ing half-way long-est man-u-script man-u-scripts mini-buf-fer mini-buf-fers over-view par-a-digm par-a-digms rath-er rec-tan-gu-lar ro-bot-ics se-vere-ly set-up spa-ces spell-ing spell-ings stand-alone strong-est time-stamp time-stamps which-ever white-space wide-spread wrap-around } % Margin to add to right of even pages, to left of odd pages. \newdimen\bindingoffset \newdimen\normaloffset \newdimen\pagewidth \newdimen\pageheight % For a final copy, take out the rectangles % that mark overfull boxes (in case you have decided % that the text looks ok even though it passes the margin). % \def\finalout{\overfullrule=0pt } % Sometimes it is convenient to have everything in the transcript file % and nothing on the terminal. We don't just call \tracingall here, % since that produces some useless output on the terminal. We also make % some effort to order the tracing commands to reduce output in the log % file; cf. trace.sty in LaTeX. % \def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}% \def\loggingall{% \tracingstats2 \tracingpages1 \tracinglostchars2 % 2 gives us more in etex \tracingparagraphs1 \tracingoutput1 \tracingmacros2 \tracingrestores1 \showboxbreadth\maxdimen \showboxdepth\maxdimen \ifx\eTeXversion\thisisundefined\else % etex gives us more logging \tracingscantokens1 \tracingifs1 \tracinggroups1 \tracingnesting2 \tracingassigns1 \fi \tracingcommands3 % 3 gives us more in etex \errorcontextlines16 }% % @errormsg{MSG}. Do the index-like expansions on MSG, but if things % aren't perfect, it's not the end of the world, being an error message, % after all. % \def\errormsg{\begingroup \indexnofonts \doerrormsg} \def\doerrormsg#1{\errmessage{#1}} % add check for \lastpenalty to plain's definitions. If the last thing % we did was a \nobreak, we don't want to insert more space. % \def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount \removelastskip\penalty-50\smallskip\fi\fi} \def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount \removelastskip\penalty-100\medskip\fi\fi} \def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount \removelastskip\penalty-200\bigskip\fi\fi} % Do @cropmarks to get crop marks. % \newif\ifcropmarks \let\cropmarks = \cropmarkstrue % % Dimensions to add cropmarks at corners. % Added by P. A. MacKay, 12 Nov. 1986 % \newdimen\outerhsize \newdimen\outervsize % set by the paper size routines \newdimen\cornerlong \cornerlong=1pc \newdimen\cornerthick \cornerthick=.3pt \newdimen\topandbottommargin \topandbottommargin=.75in % Output a mark which sets \thischapter, \thissection and \thiscolor. % We dump everything together because we only have one kind of mark. % This works because we only use \botmark / \topmark, not \firstmark. % % A mark contains a subexpression of the \ifcase ... \fi construct. % \get*marks macros below extract the needed part using \ifcase. % % Another complication is to let the user choose whether \thischapter % (\thissection) refers to the chapter (section) in effect at the top % of a page, or that at the bottom of a page. The solution is % described on page 260 of The TeXbook. It involves outputting two % marks for the sectioning macros, one before the section break, and % one after. I won't pretend I can describe this better than DEK... \def\domark{% \toks0=\expandafter{\lastchapterdefs}% \toks2=\expandafter{\lastsectiondefs}% \toks4=\expandafter{\prevchapterdefs}% \toks6=\expandafter{\prevsectiondefs}% \toks8=\expandafter{\lastcolordefs}% \mark{% \the\toks0 \the\toks2 % 0: top marks (\last...) \noexpand\or \the\toks4 \the\toks6 % 1: bottom marks (default, \prev...) \noexpand\else \the\toks8 % 2: color marks }% } % \topmark doesn't work for the very first chapter (after the title % page or the contents), so we use \firstmark there -- this gets us % the mark with the chapter defs, unless the user sneaks in, e.g., % @setcolor (or @url, or @link, etc.) between @contents and the very % first @chapter. \def\gettopheadingmarks{% \ifcase0\topmark\fi \ifx\thischapter\empty \ifcase0\firstmark\fi \fi } \def\getbottomheadingmarks{\ifcase1\botmark\fi} \def\getcolormarks{\ifcase2\topmark\fi} % Avoid "undefined control sequence" errors. \def\lastchapterdefs{} \def\lastsectiondefs{} \def\prevchapterdefs{} \def\prevsectiondefs{} \def\lastcolordefs{} % Main output routine. \chardef\PAGE = 255 \output = {\onepageout{\pagecontents\PAGE}} \newbox\headlinebox \newbox\footlinebox % \onepageout takes a vbox as an argument. Note that \pagecontents % does insertions, but you have to call it yourself. \def\onepageout#1{% \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi % \ifodd\pageno \advance\hoffset by \bindingoffset \else \advance\hoffset by -\bindingoffset\fi % % Do this outside of the \shipout so @code etc. will be expanded in % the headline as they should be, not taken literally (outputting ''code). \def\commmonheadfootline{\let\hsize=\pagewidth \texinfochars} % \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi \global\setbox\headlinebox = \vbox{\commmonheadfootline \makeheadline}% % \ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi \global\setbox\footlinebox = \vbox{\commmonheadfootline \makefootline}% % {% % Have to do this stuff outside the \shipout because we want it to % take effect in \write's, yet the group defined by the \vbox ends % before the \shipout runs. % \indexdummies % don't expand commands in the output. \normalturnoffactive % \ in index entries must not stay \, e.g., if % the page break happens to be in the middle of an example. % We don't want .vr (or whatever) entries like this: % \entry{{\tt \indexbackslash }acronym}{32}{\code {\acronym}} % "\acronym" won't work when it's read back in; % it needs to be % {\code {{\tt \backslashcurfont }acronym} \shipout\vbox{% % Do this early so pdf references go to the beginning of the page. \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi % \ifcropmarks \vbox to \outervsize\bgroup \hsize = \outerhsize \vskip-\topandbottommargin \vtop to0pt{% \line{\ewtop\hfil\ewtop}% \nointerlineskip \line{% \vbox{\moveleft\cornerthick\nstop}% \hfill \vbox{\moveright\cornerthick\nstop}% }% \vss}% \vskip\topandbottommargin \line\bgroup \hfil % center the page within the outer (page) hsize. \ifodd\pageno\hskip\bindingoffset\fi \vbox\bgroup \fi % \unvbox\headlinebox \pagebody{#1}% \ifdim\ht\footlinebox > 0pt % Only leave this space if the footline is nonempty. % (We lessened \vsize for it in \oddfootingyyy.) % The \baselineskip=24pt in plain's \makefootline has no effect. \vskip 24pt \unvbox\footlinebox \fi % \ifcropmarks \egroup % end of \vbox\bgroup \hfil\egroup % end of (centering) \line\bgroup \vskip\topandbottommargin plus1fill minus1fill \boxmaxdepth = \cornerthick \vbox to0pt{\vss \line{% \vbox{\moveleft\cornerthick\nsbot}% \hfill \vbox{\moveright\cornerthick\nsbot}% }% \nointerlineskip \line{\ewbot\hfil\ewbot}% }% \egroup % \vbox from first cropmarks clause \fi }% end of \shipout\vbox }% end of group with \indexdummies \advancepageno \ifnum\outputpenalty>-20000 \else\dosupereject\fi } \newinsert\margin \dimen\margin=\maxdimen \def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}} {\catcode`\@ =11 \gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi % marginal hacks, juha@viisa.uucp (Juha Takala) \ifvoid\margin\else % marginal info is present \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi \dimen@=\dp#1\relax \unvbox#1\relax \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi \ifr@ggedbottom \kern-\dimen@ \vfil \fi} } % Here are the rules for the cropmarks. Note that they are % offset so that the space between them is truly \outerhsize or \outervsize % (P. A. MacKay, 12 November, 1986) % \def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong} \def\nstop{\vbox {\hrule height\cornerthick depth\cornerlong width\cornerthick}} \def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong} \def\nsbot{\vbox {\hrule height\cornerlong depth\cornerthick width\cornerthick}} % Parse an argument, then pass it to #1. The argument is the rest of % the input line (except we remove a trailing comment). #1 should be a % macro which expects an ordinary undelimited TeX argument. % \def\parsearg{\parseargusing{}} \def\parseargusing#1#2{% \def\argtorun{#2}% \begingroup \obeylines \spaceisspace #1% \parseargline\empty% Insert the \empty token, see \finishparsearg below. } {\obeylines % \gdef\parseargline#1^^M{% \endgroup % End of the group started in \parsearg. \argremovecomment #1\comment\ArgTerm% }% } % First remove any @comment, then any @c comment. \def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm} \def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm} % Each occurrence of `\^^M' or `\^^M' is replaced by a single space. % % \argremovec might leave us with trailing space, e.g., % @end itemize @c foo % This space token undergoes the same procedure and is eventually removed % by \finishparsearg. % \def\argcheckspaces#1\^^M{\argcheckspacesX#1\^^M \^^M} \def\argcheckspacesX#1 \^^M{\argcheckspacesY#1\^^M} \def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{% \def\temp{#3}% \ifx\temp\empty % Do not use \next, perhaps the caller of \parsearg uses it; reuse \temp: \let\temp\finishparsearg \else \let\temp\argcheckspaces \fi % Put the space token in: \temp#1 #3\ArgTerm } % If a _delimited_ argument is enclosed in braces, they get stripped; so % to get _exactly_ the rest of the line, we had to prevent such situation. % We prepended an \empty token at the very beginning and we expand it now, % just before passing the control to \argtorun. % (Similarly, we have to think about #3 of \argcheckspacesY above: it is % either the null string, or it ends with \^^M---thus there is no danger % that a pair of braces would be stripped. % % But first, we have to remove the trailing space token. % \def\finishparsearg#1 \ArgTerm{\expandafter\argtorun\expandafter{#1}} % \parseargdef\foo{...} % is roughly equivalent to % \def\foo{\parsearg\Xfoo} % \def\Xfoo#1{...} % % Actually, I use \csname\string\foo\endcsname, ie. \\foo, as it is my % favourite TeX trick. --kasal, 16nov03 \def\parseargdef#1{% \expandafter \doparseargdef \csname\string#1\endcsname #1% } \def\doparseargdef#1#2{% \def#2{\parsearg#1}% \def#1##1% } % Several utility definitions with active space: { \obeyspaces \gdef\obeyedspace{ } % Make each space character in the input produce a normal interword % space in the output. Don't allow a line break at this space, as this % is used only in environments like @example, where each line of input % should produce a line of output anyway. % \gdef\sepspaces{\obeyspaces\let =\tie} % If an index command is used in an @example environment, any spaces % therein should become regular spaces in the raw index file, not the % expansion of \tie (\leavevmode \penalty \@M \ ). \gdef\unsepspaces{\let =\space} } \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next} % Define the framework for environments in texinfo.tex. It's used like this: % % \envdef\foo{...} % \def\Efoo{...} % % It's the responsibility of \envdef to insert \begingroup before the % actual body; @end closes the group after calling \Efoo. \envdef also % defines \thisenv, so the current environment is known; @end checks % whether the environment name matches. The \checkenv macro can also be % used to check whether the current environment is the one expected. % % Non-false conditionals (@iftex, @ifset) don't fit into this, so they % are not treated as environments; they don't open a group. (The % implementation of @end takes care not to call \endgroup in this % special case.) % At run-time, environments start with this: \def\startenvironment#1{\begingroup\def\thisenv{#1}} % initialize \let\thisenv\empty % ... but they get defined via ``\envdef\foo{...}'': \long\def\envdef#1#2{\def#1{\startenvironment#1#2}} \def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}} % Check whether we're in the right environment: \def\checkenv#1{% \def\temp{#1}% \ifx\thisenv\temp \else \badenverr \fi } % Environment mismatch, #1 expected: \def\badenverr{% \errhelp = \EMsimple \errmessage{This command can appear only \inenvironment\temp, not \inenvironment\thisenv}% } \def\inenvironment#1{% \ifx#1\empty outside of any environment% \else in environment \expandafter\string#1% \fi } % @end foo executes the definition of \Efoo. % But first, it executes a specialized version of \checkenv % \parseargdef\end{% \if 1\csname iscond.#1\endcsname \else % The general wording of \badenverr may not be ideal. \expandafter\checkenv\csname#1\endcsname \csname E#1\endcsname \endgroup \fi } \newhelp\EMsimple{Press RETURN to continue.} % Be sure we're in horizontal mode when doing a tie, since we make space % equivalent to this in @example-like environments. Otherwise, a space % at the beginning of a line will start with \penalty -- and % since \penalty is valid in vertical mode, we'd end up putting the % penalty on the vertical list instead of in the new paragraph. {\catcode`@ = 11 % Avoid using \@M directly, because that causes trouble % if the definition is written into an index file. \global\let\tiepenalty = \@M \gdef\tie{\leavevmode\penalty\tiepenalty\ } } % @: forces normal size whitespace following. \def\:{\spacefactor=1000 } % @* forces a line break. \def\*{\unskip\hfil\break\hbox{}\ignorespaces} % @/ allows a line break. \let\/=\allowbreak % @. is an end-of-sentence period. \def\.{.\spacefactor=\endofsentencespacefactor\space} % @! is an end-of-sentence bang. \def\!{!\spacefactor=\endofsentencespacefactor\space} % @? is an end-of-sentence query. \def\?{?\spacefactor=\endofsentencespacefactor\space} % @frenchspacing on|off says whether to put extra space after punctuation. % \def\onword{on} \def\offword{off} % \parseargdef\frenchspacing{% \def\temp{#1}% \ifx\temp\onword \plainfrenchspacing \else\ifx\temp\offword \plainnonfrenchspacing \else \errhelp = \EMsimple \errmessage{Unknown @frenchspacing option `\temp', must be on|off}% \fi\fi } % @w prevents a word break. Without the \leavevmode, @w at the % beginning of a paragraph, when TeX is still in vertical mode, would % produce a whole line of output instead of starting the paragraph. \def\w#1{\leavevmode\hbox{#1}} % @group ... @end group forces ... to be all on one page, by enclosing % it in a TeX vbox. We use \vtop instead of \vbox to construct the box % to keep its height that of a normal line. According to the rules for % \topskip (p.114 of the TeXbook), the glue inserted is % max (\topskip - \ht (first item), 0). If that height is large, % therefore, no glue is inserted, and the space between the headline and % the text is small, which looks bad. % % Another complication is that the group might be very large. This can % cause the glue on the previous page to be unduly stretched, because it % does not have much material. In this case, it's better to add an % explicit \vfill so that the extra space is at the bottom. The % threshold for doing this is if the group is more than \vfilllimit % percent of a page (\vfilllimit can be changed inside of @tex). % \newbox\groupbox \def\vfilllimit{0.7} % \envdef\group{% \ifnum\catcode`\^^M=\active \else \errhelp = \groupinvalidhelp \errmessage{@group invalid in context where filling is enabled}% \fi \startsavinginserts % \setbox\groupbox = \vtop\bgroup % Do @comment since we are called inside an environment such as % @example, where each end-of-line in the input causes an % end-of-line in the output. We don't want the end-of-line after % the `@group' to put extra space in the output. Since @group % should appear on a line by itself (according to the Texinfo % manual), we don't worry about eating any user text. \comment } % % The \vtop produces a box with normal height and large depth; thus, TeX puts % \baselineskip glue before it, and (when the next line of text is done) % \lineskip glue after it. Thus, space below is not quite equal to space % above. But it's pretty close. \def\Egroup{% % To get correct interline space between the last line of the group % and the first line afterwards, we have to propagate \prevdepth. \endgraf % Not \par, as it may have been set to \lisppar. \global\dimen1 = \prevdepth \egroup % End the \vtop. % \dimen0 is the vertical size of the group's box. \dimen0 = \ht\groupbox \advance\dimen0 by \dp\groupbox % \dimen2 is how much space is left on the page (more or less). \dimen2 = \pageheight \advance\dimen2 by -\pagetotal % if the group doesn't fit on the current page, and it's a big big % group, force a page break. \ifdim \dimen0 > \dimen2 \ifdim \pagetotal < \vfilllimit\pageheight \page \fi \fi \box\groupbox \prevdepth = \dimen1 \checkinserts } % % TeX puts in an \escapechar (i.e., `@') at the beginning of the help % message, so this ends up printing `@group can only ...'. % \newhelp\groupinvalidhelp{% group can only be used in environments such as @example,^^J% where each line of input produces a line of output.} % @need space-in-mils % forces a page break if there is not space-in-mils remaining. \newdimen\mil \mil=0.001in \parseargdef\need{% % Ensure vertical mode, so we don't make a big box in the middle of a % paragraph. \par % % If the @need value is less than one line space, it's useless. \dimen0 = #1\mil \dimen2 = \ht\strutbox \advance\dimen2 by \dp\strutbox \ifdim\dimen0 > \dimen2 % % Do a \strut just to make the height of this box be normal, so the % normal leading is inserted relative to the preceding line. % And a page break here is fine. \vtop to #1\mil{\strut\vfil}% % % TeX does not even consider page breaks if a penalty added to the % main vertical list is 10000 or more. But in order to see if the % empty box we just added fits on the page, we must make it consider % page breaks. On the other hand, we don't want to actually break the % page after the empty box. So we use a penalty of 9999. % % There is an extremely small chance that TeX will actually break the % page at this \penalty, if there are no other feasible breakpoints in % sight. (If the user is using lots of big @group commands, which % almost-but-not-quite fill up a page, TeX will have a hard time doing % good page breaking, for example.) However, I could not construct an % example where a page broke at this \penalty; if it happens in a real % document, then we can reconsider our strategy. \penalty9999 % % Back up by the size of the box, whether we did a page break or not. \kern -#1\mil % % Do not allow a page break right after this kern. \nobreak \fi } % @br forces paragraph break (and is undocumented). \let\br = \par % @page forces the start of a new page. % \def\page{\par\vfill\supereject} % @exdent text.... % outputs text on separate line in roman font, starting at standard page margin % This records the amount of indent in the innermost environment. % That's how much \exdent should take out. \newskip\exdentamount % This defn is used inside fill environments such as @defun. \parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break} % This defn is used inside nofill environments such as @example. \parseargdef\nofillexdent{{\advance \leftskip by -\exdentamount \leftline{\hskip\leftskip{\rm#1}}}} % @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current % paragraph. For more general purposes, use the \margin insertion % class. WHICH is `l' or `r'. Not documented, written for gawk manual. % \newskip\inmarginspacing \inmarginspacing=1cm \def\strutdepth{\dp\strutbox} % \def\doinmargin#1#2{\strut\vadjust{% \nobreak \kern-\strutdepth \vtop to \strutdepth{% \baselineskip=\strutdepth \vss % if you have multiple lines of stuff to put here, you'll need to % make the vbox yourself of the appropriate size. \ifx#1l% \llap{\ignorespaces #2\hskip\inmarginspacing}% \else \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}% \fi \null }% }} \def\inleftmargin{\doinmargin l} \def\inrightmargin{\doinmargin r} % % @inmargin{TEXT [, RIGHT-TEXT]} % (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right; % else use TEXT for both). % \def\inmargin#1{\parseinmargin #1,,\finish} \def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing. \setbox0 = \hbox{\ignorespaces #2}% \ifdim\wd0 > 0pt \def\lefttext{#1}% have both texts \def\righttext{#2}% \else \def\lefttext{#1}% have only one text \def\righttext{#1}% \fi % \ifodd\pageno \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin \else \def\temp{\inleftmargin\lefttext}% \fi \temp } % @| inserts a changebar to the left of the current line. It should % surround any changed text. This approach does *not* work if the % change spans more than two lines of output. To handle that, we would % have adopt a much more difficult approach (putting marks into the main % vertical list for the beginning and end of each change). This command % is not documented, not supported, and doesn't work. % \def\|{% % \vadjust can only be used in horizontal mode. \leavevmode % % Append this vertical mode material after the current line in the output. \vadjust{% % We want to insert a rule with the height and depth of the current % leading; that is exactly what \strutbox is supposed to record. \vskip-\baselineskip % % \vadjust-items are inserted at the left edge of the type. So % the \llap here moves out into the left-hand margin. \llap{% % % For a thicker or thinner bar, change the `1pt'. \vrule height\baselineskip width1pt % % This is the space between the bar and the text. \hskip 12pt }% }% } % @include FILE -- \input text of FILE. % \def\include{\parseargusing\filenamecatcodes\includezzz} \def\includezzz#1{% \pushthisfilestack \def\thisfile{#1}% {% \makevalueexpandable % we want to expand any @value in FILE. \turnoffactive % and allow special characters in the expansion \indexnofonts % Allow `@@' and other weird things in file names. \wlog{texinfo.tex: doing @include of #1^^J}% \edef\temp{\noexpand\input #1 }% % % This trickery is to read FILE outside of a group, in case it makes % definitions, etc. \expandafter }\temp \popthisfilestack } \def\filenamecatcodes{% \catcode`\\=\other \catcode`~=\other \catcode`^=\other \catcode`_=\other \catcode`|=\other \catcode`<=\other \catcode`>=\other \catcode`+=\other \catcode`-=\other \catcode`\`=\other \catcode`\'=\other } \def\pushthisfilestack{% \expandafter\pushthisfilestackX\popthisfilestack\StackTerm } \def\pushthisfilestackX{% \expandafter\pushthisfilestackY\thisfile\StackTerm } \def\pushthisfilestackY #1\StackTerm #2\StackTerm {% \gdef\popthisfilestack{\gdef\thisfile{#1}\gdef\popthisfilestack{#2}}% } \def\popthisfilestack{\errthisfilestackempty} \def\errthisfilestackempty{\errmessage{Internal error: the stack of filenames is empty.}} % \def\thisfile{} % @center line % outputs that line, centered. % \parseargdef\center{% \ifhmode \let\centersub\centerH \else \let\centersub\centerV \fi \centersub{\hfil \ignorespaces#1\unskip \hfil}% \let\centersub\relax % don't let the definition persist, just in case } \def\centerH#1{{% \hfil\break \advance\hsize by -\leftskip \advance\hsize by -\rightskip \line{#1}% \break }} % \newcount\centerpenalty \def\centerV#1{% % The idea here is the same as in \startdefun, \cartouche, etc.: if % @center is the first thing after a section heading, we need to wipe % out the negative parskip inserted by \sectionheading, but still % prevent a page break here. \centerpenalty = \lastpenalty \ifnum\centerpenalty>10000 \vskip\parskip \fi \ifnum\centerpenalty>9999 \penalty\centerpenalty \fi \line{\kern\leftskip #1\kern\rightskip}% } % @sp n outputs n lines of vertical space % \parseargdef\sp{\vskip #1\baselineskip} % @comment ...line which is ignored... % @c is the same as @comment % @ignore ... @end ignore is another way to write a comment % \def\comment{\begingroup \catcode`\^^M=\other% \catcode`\@=\other \catcode`\{=\other \catcode`\}=\other% \commentxxx} {\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}} % \let\c=\comment % @paragraphindent NCHARS % We'll use ems for NCHARS, close enough. % NCHARS can also be the word `asis' or `none'. % We cannot feasibly implement @paragraphindent asis, though. % \def\asisword{asis} % no translation, these are keywords \def\noneword{none} % \parseargdef\paragraphindent{% \def\temp{#1}% \ifx\temp\asisword \else \ifx\temp\noneword \defaultparindent = 0pt \else \defaultparindent = #1em \fi \fi \parindent = \defaultparindent } % @exampleindent NCHARS % We'll use ems for NCHARS like @paragraphindent. % It seems @exampleindent asis isn't necessary, but % I preserve it to make it similar to @paragraphindent. \parseargdef\exampleindent{% \def\temp{#1}% \ifx\temp\asisword \else \ifx\temp\noneword \lispnarrowing = 0pt \else \lispnarrowing = #1em \fi \fi } % @firstparagraphindent WORD % If WORD is `none', then suppress indentation of the first paragraph % after a section heading. If WORD is `insert', then do indent at such % paragraphs. % % The paragraph indentation is suppressed or not by calling % \suppressfirstparagraphindent, which the sectioning commands do. % We switch the definition of this back and forth according to WORD. % By default, we suppress indentation. % \def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent} \def\insertword{insert} % \parseargdef\firstparagraphindent{% \def\temp{#1}% \ifx\temp\noneword \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent \else\ifx\temp\insertword \let\suppressfirstparagraphindent = \relax \else \errhelp = \EMsimple \errmessage{Unknown @firstparagraphindent option `\temp'}% \fi\fi } % Here is how we actually suppress indentation. Redefine \everypar to % \kern backwards by \parindent, and then reset itself to empty. % % We also make \indent itself not actually do anything until the next % paragraph. % \gdef\dosuppressfirstparagraphindent{% \gdef\indent{% \restorefirstparagraphindent \indent }% \gdef\noindent{% \restorefirstparagraphindent \noindent }% \global\everypar = {% \kern -\parindent \restorefirstparagraphindent }% } \gdef\restorefirstparagraphindent{% \global \let \indent = \ptexindent \global \let \noindent = \ptexnoindent \global \everypar = {}% } % @refill is a no-op. \let\refill=\relax % If working on a large document in chapters, it is convenient to % be able to disable indexing, cross-referencing, and contents, for test runs. % This is done with @novalidate (before @setfilename). % \newif\iflinks \linkstrue % by default we want the aux files. \let\novalidate = \linksfalse % @setfilename is done at the beginning of every texinfo file. % So open here the files we need to have open while reading the input. % This makes it possible to make a .fmt file for texinfo. \def\setfilename{% \fixbackslash % Turn off hack to swallow `\input texinfo'. \iflinks \tryauxfile % Open the new aux file. TeX will close it automatically at exit. \immediate\openout\auxfile=\jobname.aux \fi % \openindices needs to do some work in any case. \openindices \let\setfilename=\comment % Ignore extra @setfilename cmds. % % If texinfo.cnf is present on the system, read it. % Useful for site-wide @afourpaper, etc. \openin 1 texinfo.cnf \ifeof 1 \else \input texinfo.cnf \fi \closein 1 % \comment % Ignore the actual filename. } % Called from \setfilename. % \def\openindices{% \newindex{cp}% \newcodeindex{fn}% \newcodeindex{vr}% \newcodeindex{tp}% \newcodeindex{ky}% \newcodeindex{pg}% } % @bye. \outer\def\bye{\pagealignmacro\tracingstats=1\ptexend} \message{pdf,} % adobe `portable' document format \newcount\tempnum \newcount\lnkcount \newtoks\filename \newcount\filenamelength \newcount\pgn \newtoks\toksA \newtoks\toksB \newtoks\toksC \newtoks\toksD \newbox\boxA \newcount\countA \newif\ifpdf \newif\ifpdfmakepagedest % when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1 % can be set). So we test for \relax and 0 as well as being undefined. \ifx\pdfoutput\thisisundefined \else \ifx\pdfoutput\relax \else \ifcase\pdfoutput \else \pdftrue \fi \fi \fi % PDF uses PostScript string constants for the names of xref targets, % for display in the outlines, and in other places. Thus, we have to % double any backslashes. Otherwise, a name like "\node" will be % interpreted as a newline (\n), followed by o, d, e. Not good. % % See http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html and % related messages. The final outcome is that it is up to the TeX user % to double the backslashes and otherwise make the string valid, so % that's what we do. pdftex 1.30.0 (ca.2005) introduced a primitive to % do this reliably, so we use it. % #1 is a control sequence in which to do the replacements, % which we \xdef. \def\txiescapepdf#1{% \ifx\pdfescapestring\thisisundefined % No primitive available; should we give a warning or log? % Many times it won't matter. \else % The expandable \pdfescapestring primitive escapes parentheses, % backslashes, and other special chars. \xdef#1{\pdfescapestring{#1}}% \fi } \newhelp\nopdfimagehelp{Texinfo supports .png, .jpg, .jpeg, and .pdf images with PDF output, and none of those formats could be found. (.eps cannot be supported due to the design of the PDF format; use regular TeX (DVI output) for that.)} \ifpdf % % Color manipulation macros based on pdfcolor.tex, % except using rgb instead of cmyk; the latter is said to render as a % very dark gray on-screen and a very dark halftone in print, instead % of actual black. \def\rgbDarkRed{0.50 0.09 0.12} \def\rgbBlack{0 0 0} % % k sets the color for filling (usual text, etc.); % K sets the color for stroking (thin rules, e.g., normal _'s). \def\pdfsetcolor#1{\pdfliteral{#1 rg #1 RG}} % % Set color, and create a mark which defines \thiscolor accordingly, % so that \makeheadline knows which color to restore. \def\setcolor#1{% \xdef\lastcolordefs{\gdef\noexpand\thiscolor{#1}}% \domark \pdfsetcolor{#1}% } % \def\maincolor{\rgbBlack} \pdfsetcolor{\maincolor} \edef\thiscolor{\maincolor} \def\lastcolordefs{} % \def\makefootline{% \baselineskip24pt \line{\pdfsetcolor{\maincolor}\the\footline}% } % \def\makeheadline{% \vbox to 0pt{% \vskip-22.5pt \line{% \vbox to8.5pt{}% % Extract \thiscolor definition from the marks. \getcolormarks % Typeset the headline with \maincolor, then restore the color. \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}% }% \vss }% \nointerlineskip } % % \pdfcatalog{/PageMode /UseOutlines} % % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto). \def\dopdfimage#1#2#3{% \def\pdfimagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}% \def\pdfimageheight{#3}\setbox2 = \hbox{\ignorespaces #3}% % % pdftex (and the PDF format) support .pdf, .png, .jpg (among % others). Let's try in that order, PDF first since if % someone has a scalable image, presumably better to use that than a % bitmap. \let\pdfimgext=\empty \begingroup \openin 1 #1.pdf \ifeof 1 \openin 1 #1.PDF \ifeof 1 \openin 1 #1.png \ifeof 1 \openin 1 #1.jpg \ifeof 1 \openin 1 #1.jpeg \ifeof 1 \openin 1 #1.JPG \ifeof 1 \errhelp = \nopdfimagehelp \errmessage{Could not find image file #1 for pdf}% \else \gdef\pdfimgext{JPG}% \fi \else \gdef\pdfimgext{jpeg}% \fi \else \gdef\pdfimgext{jpg}% \fi \else \gdef\pdfimgext{png}% \fi \else \gdef\pdfimgext{PDF}% \fi \else \gdef\pdfimgext{pdf}% \fi \closein 1 \endgroup % % without \immediate, ancient pdftex seg faults when the same image is % included twice. (Version 3.14159-pre-1.0-unofficial-20010704.) \ifnum\pdftexversion < 14 \immediate\pdfimage \else \immediate\pdfximage \fi \ifdim \wd0 >0pt width \pdfimagewidth \fi \ifdim \wd2 >0pt height \pdfimageheight \fi \ifnum\pdftexversion<13 #1.\pdfimgext \else {#1.\pdfimgext}% \fi \ifnum\pdftexversion < 14 \else \pdfrefximage \pdflastximage \fi} % \def\pdfmkdest#1{{% % We have to set dummies so commands such as @code, and characters % such as \, aren't expanded when present in a section title. \indexnofonts \turnoffactive \makevalueexpandable \def\pdfdestname{#1}% \txiescapepdf\pdfdestname \safewhatsit{\pdfdest name{\pdfdestname} xyz}% }} % % used to mark target names; must be expandable. \def\pdfmkpgn#1{#1} % % by default, use a color that is dark enough to print on paper as % nearly black, but still distinguishable for online viewing. \def\urlcolor{\rgbDarkRed} \def\linkcolor{\rgbDarkRed} \def\endlink{\setcolor{\maincolor}\pdfendlink} % % Adding outlines to PDF; macros for calculating structure of outlines % come from Petr Olsak \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0% \else \csname#1\endcsname \fi} \def\advancenumber#1{\tempnum=\expnumber{#1}\relax \advance\tempnum by 1 \expandafter\xdef\csname#1\endcsname{\the\tempnum}} % % #1 is the section text, which is what will be displayed in the % outline by the pdf viewer. #2 is the pdf expression for the number % of subentries (or empty, for subsubsections). #3 is the node text, % which might be empty if this toc entry had no corresponding node. % #4 is the page number % \def\dopdfoutline#1#2#3#4{% % Generate a link to the node text if that exists; else, use the % page number. We could generate a destination for the section % text in the case where a section has no node, but it doesn't % seem worth the trouble, since most documents are normally structured. \edef\pdfoutlinedest{#3}% \ifx\pdfoutlinedest\empty \def\pdfoutlinedest{#4}% \else \txiescapepdf\pdfoutlinedest \fi % % Also escape PDF chars in the display string. \edef\pdfoutlinetext{#1}% \txiescapepdf\pdfoutlinetext % \pdfoutline goto name{\pdfmkpgn{\pdfoutlinedest}}#2{\pdfoutlinetext}% } % \def\pdfmakeoutlines{% \begingroup % Read toc silently, to get counts of subentries for \pdfoutline. \def\partentry##1##2##3##4{}% ignore parts in the outlines \def\numchapentry##1##2##3##4{% \def\thischapnum{##2}% \def\thissecnum{0}% \def\thissubsecnum{0}% }% \def\numsecentry##1##2##3##4{% \advancenumber{chap\thischapnum}% \def\thissecnum{##2}% \def\thissubsecnum{0}% }% \def\numsubsecentry##1##2##3##4{% \advancenumber{sec\thissecnum}% \def\thissubsecnum{##2}% }% \def\numsubsubsecentry##1##2##3##4{% \advancenumber{subsec\thissubsecnum}% }% \def\thischapnum{0}% \def\thissecnum{0}% \def\thissubsecnum{0}% % % use \def rather than \let here because we redefine \chapentry et % al. a second time, below. \def\appentry{\numchapentry}% \def\appsecentry{\numsecentry}% \def\appsubsecentry{\numsubsecentry}% \def\appsubsubsecentry{\numsubsubsecentry}% \def\unnchapentry{\numchapentry}% \def\unnsecentry{\numsecentry}% \def\unnsubsecentry{\numsubsecentry}% \def\unnsubsubsecentry{\numsubsubsecentry}% \readdatafile{toc}% % % Read toc second time, this time actually producing the outlines. % The `-' means take the \expnumber as the absolute number of % subentries, which we calculated on our first read of the .toc above. % % We use the node names as the destinations. \def\numchapentry##1##2##3##4{% \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}% \def\numsecentry##1##2##3##4{% \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}% \def\numsubsecentry##1##2##3##4{% \dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}% \def\numsubsubsecentry##1##2##3##4{% count is always zero \dopdfoutline{##1}{}{##3}{##4}}% % % PDF outlines are displayed using system fonts, instead of % document fonts. Therefore we cannot use special characters, % since the encoding is unknown. For example, the eogonek from % Latin 2 (0xea) gets translated to a | character. Info from % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100. % % TODO this right, we have to translate 8-bit characters to % their "best" equivalent, based on the @documentencoding. Too % much work for too little return. Just use the ASCII equivalents % we use for the index sort strings. % \indexnofonts \setupdatafile % We can have normal brace characters in the PDF outlines, unlike % Texinfo index files. So set that up. \def\{{\lbracecharliteral}% \def\}{\rbracecharliteral}% \catcode`\\=\active \otherbackslash \input \tocreadfilename \endgroup } {\catcode`[=1 \catcode`]=2 \catcode`{=\other \catcode`}=\other \gdef\lbracecharliteral[{]% \gdef\rbracecharliteral[}]% ] % \def\skipspaces#1{\def\PP{#1}\def\D{|}% \ifx\PP\D\let\nextsp\relax \else\let\nextsp\skipspaces \addtokens{\filename}{\PP}% \advance\filenamelength by 1 \fi \nextsp} \def\getfilename#1{% \filenamelength=0 % If we don't expand the argument now, \skipspaces will get % snagged on things like "@value{foo}". \edef\temp{#1}% \expandafter\skipspaces\temp|\relax } \ifnum\pdftexversion < 14 \let \startlink \pdfannotlink \else \let \startlink \pdfstartlink \fi % make a live url in pdf output. \def\pdfurl#1{% \begingroup % it seems we really need yet another set of dummies; have not % tried to figure out what each command should do in the context % of @url. for now, just make @/ a no-op, that's the only one % people have actually reported a problem with. % \normalturnoffactive \def\@{@}% \let\/=\empty \makevalueexpandable % do we want to go so far as to use \indexnofonts instead of just % special-casing \var here? \def\var##1{##1}% % \leavevmode\setcolor{\urlcolor}% \startlink attr{/Border [0 0 0]}% user{/Subtype /Link /A << /S /URI /URI (#1) >>}% \endgroup} \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}} \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks} \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks} \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}} \def\maketoks{% \expandafter\poptoks\the\toksA|ENDTOKS|\relax \ifx\first0\adn0 \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3 \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6 \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9 \else \ifnum0=\countA\else\makelink\fi \ifx\first.\let\next=\done\else \let\next=\maketoks \addtokens{\toksB}{\the\toksD} \ifx\first,\addtokens{\toksB}{\space}\fi \fi \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi \next} \def\makelink{\addtokens{\toksB}% {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0} \def\pdflink#1{% \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}} \setcolor{\linkcolor}#1\endlink} \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st} \else % non-pdf mode \let\pdfmkdest = \gobble \let\pdfurl = \gobble \let\endlink = \relax \let\setcolor = \gobble \let\pdfsetcolor = \gobble \let\pdfmakeoutlines = \relax \fi % \ifx\pdfoutput \message{fonts,} % Change the current font style to #1, remembering it in \curfontstyle. % For now, we do not accumulate font styles: @b{@i{foo}} prints foo in % italics, not bold italics. % \def\setfontstyle#1{% \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd. \csname ten#1\endcsname % change the current font } % Select #1 fonts with the current style. % \def\selectfonts#1{\csname #1fonts\endcsname \csname\curfontstyle\endcsname} \def\rm{\fam=0 \setfontstyle{rm}} \def\it{\fam=\itfam \setfontstyle{it}} \def\sl{\fam=\slfam \setfontstyle{sl}} \def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf} \def\tt{\fam=\ttfam \setfontstyle{tt}} % Unfortunately, we have to override this for titles and the like, since % in those cases "rm" is bold. Sigh. \def\rmisbold{\rm\def\curfontstyle{bf}} % Texinfo sort of supports the sans serif font style, which plain TeX does not. % So we set up a \sf. \newfam\sffam \def\sf{\fam=\sffam \setfontstyle{sf}} \let\li = \sf % Sometimes we call it \li, not \sf. % We don't need math for this font style. \def\ttsl{\setfontstyle{ttsl}} % Set the baselineskip to #1, and the lineskip and strut size % correspondingly. There is no deep meaning behind these magic numbers % used as factors; they just match (closely enough) what Knuth defined. % \def\lineskipfactor{.08333} \def\strutheightpercent{.70833} \def\strutdepthpercent {.29167} % % can get a sort of poor man's double spacing by redefining this. \def\baselinefactor{1} % \newdimen\textleading \def\setleading#1{% \dimen0 = #1\relax \normalbaselineskip = \baselinefactor\dimen0 \normallineskip = \lineskipfactor\normalbaselineskip \normalbaselines \setbox\strutbox =\hbox{% \vrule width0pt height\strutheightpercent\baselineskip depth \strutdepthpercent \baselineskip }% } % PDF CMaps. See also LaTeX's t1.cmap. % % do nothing with this by default. \expandafter\let\csname cmapOT1\endcsname\gobble \expandafter\let\csname cmapOT1IT\endcsname\gobble \expandafter\let\csname cmapOT1TT\endcsname\gobble % if we are producing pdf, and we have \pdffontattr, then define cmaps. % (\pdffontattr was introduced many years ago, but people still run % older pdftex's; it's easy to conditionalize, so we do.) \ifpdf \ifx\pdffontattr\thisisundefined \else \begingroup \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char. \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap %%DocumentNeededResources: ProcSet (CIDInit) %%IncludeResource: ProcSet (CIDInit) %%BeginResource: CMap (TeX-OT1-0) %%Title: (TeX-OT1-0 TeX OT1 0) %%Version: 1.000 %%EndComments /CIDInit /ProcSet findresource begin 12 dict begin begincmap /CIDSystemInfo << /Registry (TeX) /Ordering (OT1) /Supplement 0 >> def /CMapName /TeX-OT1-0 def /CMapType 2 def 1 begincodespacerange <00> <7F> endcodespacerange 8 beginbfrange <00> <01> <0393> <09> <0A> <03A8> <23> <26> <0023> <28> <3B> <0028> <3F> <5B> <003F> <5D> <5E> <005D> <61> <7A> <0061> <7B> <7C> <2013> endbfrange 40 beginbfchar <02> <0398> <03> <039B> <04> <039E> <05> <03A0> <06> <03A3> <07> <03D2> <08> <03A6> <0B> <00660066> <0C> <00660069> <0D> <0066006C> <0E> <006600660069> <0F> <00660066006C> <10> <0131> <11> <0237> <12> <0060> <13> <00B4> <14> <02C7> <15> <02D8> <16> <00AF> <17> <02DA> <18> <00B8> <19> <00DF> <1A> <00E6> <1B> <0153> <1C> <00F8> <1D> <00C6> <1E> <0152> <1F> <00D8> <21> <0021> <22> <201D> <27> <2019> <3C> <00A1> <3D> <003D> <3E> <00BF> <5C> <201C> <5F> <02D9> <60> <2018> <7D> <02DD> <7E> <007E> <7F> <00A8> endbfchar endcmap CMapName currentdict /CMap defineresource pop end end %%EndResource %%EOF }\endgroup \expandafter\edef\csname cmapOT1\endcsname#1{% \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}% }% % % \cmapOT1IT \begingroup \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char. \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap %%DocumentNeededResources: ProcSet (CIDInit) %%IncludeResource: ProcSet (CIDInit) %%BeginResource: CMap (TeX-OT1IT-0) %%Title: (TeX-OT1IT-0 TeX OT1IT 0) %%Version: 1.000 %%EndComments /CIDInit /ProcSet findresource begin 12 dict begin begincmap /CIDSystemInfo << /Registry (TeX) /Ordering (OT1IT) /Supplement 0 >> def /CMapName /TeX-OT1IT-0 def /CMapType 2 def 1 begincodespacerange <00> <7F> endcodespacerange 8 beginbfrange <00> <01> <0393> <09> <0A> <03A8> <25> <26> <0025> <28> <3B> <0028> <3F> <5B> <003F> <5D> <5E> <005D> <61> <7A> <0061> <7B> <7C> <2013> endbfrange 42 beginbfchar <02> <0398> <03> <039B> <04> <039E> <05> <03A0> <06> <03A3> <07> <03D2> <08> <03A6> <0B> <00660066> <0C> <00660069> <0D> <0066006C> <0E> <006600660069> <0F> <00660066006C> <10> <0131> <11> <0237> <12> <0060> <13> <00B4> <14> <02C7> <15> <02D8> <16> <00AF> <17> <02DA> <18> <00B8> <19> <00DF> <1A> <00E6> <1B> <0153> <1C> <00F8> <1D> <00C6> <1E> <0152> <1F> <00D8> <21> <0021> <22> <201D> <23> <0023> <24> <00A3> <27> <2019> <3C> <00A1> <3D> <003D> <3E> <00BF> <5C> <201C> <5F> <02D9> <60> <2018> <7D> <02DD> <7E> <007E> <7F> <00A8> endbfchar endcmap CMapName currentdict /CMap defineresource pop end end %%EndResource %%EOF }\endgroup \expandafter\edef\csname cmapOT1IT\endcsname#1{% \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}% }% % % \cmapOT1TT \begingroup \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char. \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap %%DocumentNeededResources: ProcSet (CIDInit) %%IncludeResource: ProcSet (CIDInit) %%BeginResource: CMap (TeX-OT1TT-0) %%Title: (TeX-OT1TT-0 TeX OT1TT 0) %%Version: 1.000 %%EndComments /CIDInit /ProcSet findresource begin 12 dict begin begincmap /CIDSystemInfo << /Registry (TeX) /Ordering (OT1TT) /Supplement 0 >> def /CMapName /TeX-OT1TT-0 def /CMapType 2 def 1 begincodespacerange <00> <7F> endcodespacerange 5 beginbfrange <00> <01> <0393> <09> <0A> <03A8> <21> <26> <0021> <28> <5F> <0028> <61> <7E> <0061> endbfrange 32 beginbfchar <02> <0398> <03> <039B> <04> <039E> <05> <03A0> <06> <03A3> <07> <03D2> <08> <03A6> <0B> <2191> <0C> <2193> <0D> <0027> <0E> <00A1> <0F> <00BF> <10> <0131> <11> <0237> <12> <0060> <13> <00B4> <14> <02C7> <15> <02D8> <16> <00AF> <17> <02DA> <18> <00B8> <19> <00DF> <1A> <00E6> <1B> <0153> <1C> <00F8> <1D> <00C6> <1E> <0152> <1F> <00D8> <20> <2423> <27> <2019> <60> <2018> <7F> <00A8> endbfchar endcmap CMapName currentdict /CMap defineresource pop end end %%EndResource %%EOF }\endgroup \expandafter\edef\csname cmapOT1TT\endcsname#1{% \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}% }% \fi\fi % Set the font macro #1 to the font named \fontprefix#2. % #3 is the font's design size, #4 is a scale factor, #5 is the CMap % encoding (only OT1, OT1IT and OT1TT are allowed, or empty to omit). % Example: % #1 = \textrm % #2 = \rmshape % #3 = 10 % #4 = \mainmagstep % #5 = OT1 % \def\setfont#1#2#3#4#5{% \font#1=\fontprefix#2#3 scaled #4 \csname cmap#5\endcsname#1% } % This is what gets called when #5 of \setfont is empty. \let\cmap\gobble % % (end of cmaps) % Use cm as the default font prefix. % To specify the font prefix, you must define \fontprefix % before you read in texinfo.tex. \ifx\fontprefix\thisisundefined \def\fontprefix{cm} \fi % Support font families that don't use the same naming scheme as CM. \def\rmshape{r} \def\rmbshape{bx} % where the normal face is bold \def\bfshape{b} \def\bxshape{bx} \def\ttshape{tt} \def\ttbshape{tt} \def\ttslshape{sltt} \def\itshape{ti} \def\itbshape{bxti} \def\slshape{sl} \def\slbshape{bxsl} \def\sfshape{ss} \def\sfbshape{ss} \def\scshape{csc} \def\scbshape{csc} % Definitions for a main text size of 11pt. (The default in Texinfo.) % \def\definetextfontsizexi{% % Text fonts (11.2pt, magstep1). \def\textnominalsize{11pt} \edef\mainmagstep{\magstephalf} \setfont\textrm\rmshape{10}{\mainmagstep}{OT1} \setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT} \setfont\textbf\bfshape{10}{\mainmagstep}{OT1} \setfont\textit\itshape{10}{\mainmagstep}{OT1IT} \setfont\textsl\slshape{10}{\mainmagstep}{OT1} \setfont\textsf\sfshape{10}{\mainmagstep}{OT1} \setfont\textsc\scshape{10}{\mainmagstep}{OT1} \setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT} \font\texti=cmmi10 scaled \mainmagstep \font\textsy=cmsy10 scaled \mainmagstep \def\textecsize{1095} % A few fonts for @defun names and args. \setfont\defbf\bfshape{10}{\magstep1}{OT1} \setfont\deftt\ttshape{10}{\magstep1}{OT1TT} \setfont\defttsl\ttslshape{10}{\magstep1}{OT1TT} \def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf} % Fonts for indices, footnotes, small examples (9pt). \def\smallnominalsize{9pt} \setfont\smallrm\rmshape{9}{1000}{OT1} \setfont\smalltt\ttshape{9}{1000}{OT1TT} \setfont\smallbf\bfshape{10}{900}{OT1} \setfont\smallit\itshape{9}{1000}{OT1IT} \setfont\smallsl\slshape{9}{1000}{OT1} \setfont\smallsf\sfshape{9}{1000}{OT1} \setfont\smallsc\scshape{10}{900}{OT1} \setfont\smallttsl\ttslshape{10}{900}{OT1TT} \font\smalli=cmmi9 \font\smallsy=cmsy9 \def\smallecsize{0900} % Fonts for small examples (8pt). \def\smallernominalsize{8pt} \setfont\smallerrm\rmshape{8}{1000}{OT1} \setfont\smallertt\ttshape{8}{1000}{OT1TT} \setfont\smallerbf\bfshape{10}{800}{OT1} \setfont\smallerit\itshape{8}{1000}{OT1IT} \setfont\smallersl\slshape{8}{1000}{OT1} \setfont\smallersf\sfshape{8}{1000}{OT1} \setfont\smallersc\scshape{10}{800}{OT1} \setfont\smallerttsl\ttslshape{10}{800}{OT1TT} \font\smalleri=cmmi8 \font\smallersy=cmsy8 \def\smallerecsize{0800} % Fonts for title page (20.4pt): \def\titlenominalsize{20pt} \setfont\titlerm\rmbshape{12}{\magstep3}{OT1} \setfont\titleit\itbshape{10}{\magstep4}{OT1IT} \setfont\titlesl\slbshape{10}{\magstep4}{OT1} \setfont\titlett\ttbshape{12}{\magstep3}{OT1TT} \setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT} \setfont\titlesf\sfbshape{17}{\magstep1}{OT1} \let\titlebf=\titlerm \setfont\titlesc\scbshape{10}{\magstep4}{OT1} \font\titlei=cmmi12 scaled \magstep3 \font\titlesy=cmsy10 scaled \magstep4 \def\titleecsize{2074} % Chapter (and unnumbered) fonts (17.28pt). \def\chapnominalsize{17pt} \setfont\chaprm\rmbshape{12}{\magstep2}{OT1} \setfont\chapit\itbshape{10}{\magstep3}{OT1IT} \setfont\chapsl\slbshape{10}{\magstep3}{OT1} \setfont\chaptt\ttbshape{12}{\magstep2}{OT1TT} \setfont\chapttsl\ttslshape{10}{\magstep3}{OT1TT} \setfont\chapsf\sfbshape{17}{1000}{OT1} \let\chapbf=\chaprm \setfont\chapsc\scbshape{10}{\magstep3}{OT1} \font\chapi=cmmi12 scaled \magstep2 \font\chapsy=cmsy10 scaled \magstep3 \def\chapecsize{1728} % Section fonts (14.4pt). \def\secnominalsize{14pt} \setfont\secrm\rmbshape{12}{\magstep1}{OT1} \setfont\secit\itbshape{10}{\magstep2}{OT1IT} \setfont\secsl\slbshape{10}{\magstep2}{OT1} \setfont\sectt\ttbshape{12}{\magstep1}{OT1TT} \setfont\secttsl\ttslshape{10}{\magstep2}{OT1TT} \setfont\secsf\sfbshape{12}{\magstep1}{OT1} \let\secbf\secrm \setfont\secsc\scbshape{10}{\magstep2}{OT1} \font\seci=cmmi12 scaled \magstep1 \font\secsy=cmsy10 scaled \magstep2 \def\sececsize{1440} % Subsection fonts (13.15pt). \def\ssecnominalsize{13pt} \setfont\ssecrm\rmbshape{12}{\magstephalf}{OT1} \setfont\ssecit\itbshape{10}{1315}{OT1IT} \setfont\ssecsl\slbshape{10}{1315}{OT1} \setfont\ssectt\ttbshape{12}{\magstephalf}{OT1TT} \setfont\ssecttsl\ttslshape{10}{1315}{OT1TT} \setfont\ssecsf\sfbshape{12}{\magstephalf}{OT1} \let\ssecbf\ssecrm \setfont\ssecsc\scbshape{10}{1315}{OT1} \font\sseci=cmmi12 scaled \magstephalf \font\ssecsy=cmsy10 scaled 1315 \def\ssececsize{1200} % Reduced fonts for @acro in text (10pt). \def\reducednominalsize{10pt} \setfont\reducedrm\rmshape{10}{1000}{OT1} \setfont\reducedtt\ttshape{10}{1000}{OT1TT} \setfont\reducedbf\bfshape{10}{1000}{OT1} \setfont\reducedit\itshape{10}{1000}{OT1IT} \setfont\reducedsl\slshape{10}{1000}{OT1} \setfont\reducedsf\sfshape{10}{1000}{OT1} \setfont\reducedsc\scshape{10}{1000}{OT1} \setfont\reducedttsl\ttslshape{10}{1000}{OT1TT} \font\reducedi=cmmi10 \font\reducedsy=cmsy10 \def\reducedecsize{1000} \textleading = 13.2pt % line spacing for 11pt CM \textfonts % reset the current fonts \rm } % end of 11pt text font size definitions, \definetextfontsizexi % Definitions to make the main text be 10pt Computer Modern, with % section, chapter, etc., sizes following suit. This is for the GNU % Press printing of the Emacs 22 manual. Maybe other manuals in the % future. Used with @smallbook, which sets the leading to 12pt. % \def\definetextfontsizex{% % Text fonts (10pt). \def\textnominalsize{10pt} \edef\mainmagstep{1000} \setfont\textrm\rmshape{10}{\mainmagstep}{OT1} \setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT} \setfont\textbf\bfshape{10}{\mainmagstep}{OT1} \setfont\textit\itshape{10}{\mainmagstep}{OT1IT} \setfont\textsl\slshape{10}{\mainmagstep}{OT1} \setfont\textsf\sfshape{10}{\mainmagstep}{OT1} \setfont\textsc\scshape{10}{\mainmagstep}{OT1} \setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT} \font\texti=cmmi10 scaled \mainmagstep \font\textsy=cmsy10 scaled \mainmagstep \def\textecsize{1000} % A few fonts for @defun names and args. \setfont\defbf\bfshape{10}{\magstephalf}{OT1} \setfont\deftt\ttshape{10}{\magstephalf}{OT1TT} \setfont\defttsl\ttslshape{10}{\magstephalf}{OT1TT} \def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf} % Fonts for indices, footnotes, small examples (9pt). \def\smallnominalsize{9pt} \setfont\smallrm\rmshape{9}{1000}{OT1} \setfont\smalltt\ttshape{9}{1000}{OT1TT} \setfont\smallbf\bfshape{10}{900}{OT1} \setfont\smallit\itshape{9}{1000}{OT1IT} \setfont\smallsl\slshape{9}{1000}{OT1} \setfont\smallsf\sfshape{9}{1000}{OT1} \setfont\smallsc\scshape{10}{900}{OT1} \setfont\smallttsl\ttslshape{10}{900}{OT1TT} \font\smalli=cmmi9 \font\smallsy=cmsy9 \def\smallecsize{0900} % Fonts for small examples (8pt). \def\smallernominalsize{8pt} \setfont\smallerrm\rmshape{8}{1000}{OT1} \setfont\smallertt\ttshape{8}{1000}{OT1TT} \setfont\smallerbf\bfshape{10}{800}{OT1} \setfont\smallerit\itshape{8}{1000}{OT1IT} \setfont\smallersl\slshape{8}{1000}{OT1} \setfont\smallersf\sfshape{8}{1000}{OT1} \setfont\smallersc\scshape{10}{800}{OT1} \setfont\smallerttsl\ttslshape{10}{800}{OT1TT} \font\smalleri=cmmi8 \font\smallersy=cmsy8 \def\smallerecsize{0800} % Fonts for title page (20.4pt): \def\titlenominalsize{20pt} \setfont\titlerm\rmbshape{12}{\magstep3}{OT1} \setfont\titleit\itbshape{10}{\magstep4}{OT1IT} \setfont\titlesl\slbshape{10}{\magstep4}{OT1} \setfont\titlett\ttbshape{12}{\magstep3}{OT1TT} \setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT} \setfont\titlesf\sfbshape{17}{\magstep1}{OT1} \let\titlebf=\titlerm \setfont\titlesc\scbshape{10}{\magstep4}{OT1} \font\titlei=cmmi12 scaled \magstep3 \font\titlesy=cmsy10 scaled \magstep4 \def\titleecsize{2074} % Chapter fonts (14.4pt). \def\chapnominalsize{14pt} \setfont\chaprm\rmbshape{12}{\magstep1}{OT1} \setfont\chapit\itbshape{10}{\magstep2}{OT1IT} \setfont\chapsl\slbshape{10}{\magstep2}{OT1} \setfont\chaptt\ttbshape{12}{\magstep1}{OT1TT} \setfont\chapttsl\ttslshape{10}{\magstep2}{OT1TT} \setfont\chapsf\sfbshape{12}{\magstep1}{OT1} \let\chapbf\chaprm \setfont\chapsc\scbshape{10}{\magstep2}{OT1} \font\chapi=cmmi12 scaled \magstep1 \font\chapsy=cmsy10 scaled \magstep2 \def\chapecsize{1440} % Section fonts (12pt). \def\secnominalsize{12pt} \setfont\secrm\rmbshape{12}{1000}{OT1} \setfont\secit\itbshape{10}{\magstep1}{OT1IT} \setfont\secsl\slbshape{10}{\magstep1}{OT1} \setfont\sectt\ttbshape{12}{1000}{OT1TT} \setfont\secttsl\ttslshape{10}{\magstep1}{OT1TT} \setfont\secsf\sfbshape{12}{1000}{OT1} \let\secbf\secrm \setfont\secsc\scbshape{10}{\magstep1}{OT1} \font\seci=cmmi12 \font\secsy=cmsy10 scaled \magstep1 \def\sececsize{1200} % Subsection fonts (10pt). \def\ssecnominalsize{10pt} \setfont\ssecrm\rmbshape{10}{1000}{OT1} \setfont\ssecit\itbshape{10}{1000}{OT1IT} \setfont\ssecsl\slbshape{10}{1000}{OT1} \setfont\ssectt\ttbshape{10}{1000}{OT1TT} \setfont\ssecttsl\ttslshape{10}{1000}{OT1TT} \setfont\ssecsf\sfbshape{10}{1000}{OT1} \let\ssecbf\ssecrm \setfont\ssecsc\scbshape{10}{1000}{OT1} \font\sseci=cmmi10 \font\ssecsy=cmsy10 \def\ssececsize{1000} % Reduced fonts for @acro in text (9pt). \def\reducednominalsize{9pt} \setfont\reducedrm\rmshape{9}{1000}{OT1} \setfont\reducedtt\ttshape{9}{1000}{OT1TT} \setfont\reducedbf\bfshape{10}{900}{OT1} \setfont\reducedit\itshape{9}{1000}{OT1IT} \setfont\reducedsl\slshape{9}{1000}{OT1} \setfont\reducedsf\sfshape{9}{1000}{OT1} \setfont\reducedsc\scshape{10}{900}{OT1} \setfont\reducedttsl\ttslshape{10}{900}{OT1TT} \font\reducedi=cmmi9 \font\reducedsy=cmsy9 \def\reducedecsize{0900} \divide\parskip by 2 % reduce space between paragraphs \textleading = 12pt % line spacing for 10pt CM \textfonts % reset the current fonts \rm } % end of 10pt text font size definitions, \definetextfontsizex % We provide the user-level command % @fonttextsize 10 % (or 11) to redefine the text font size. pt is assumed. % \def\xiword{11} \def\xword{10} \def\xwordpt{10pt} % \parseargdef\fonttextsize{% \def\textsizearg{#1}% %\wlog{doing @fonttextsize \textsizearg}% % % Set \globaldefs so that documents can use this inside @tex, since % makeinfo 4.8 does not support it, but we need it nonetheless. % \begingroup \globaldefs=1 \ifx\textsizearg\xword \definetextfontsizex \else \ifx\textsizearg\xiword \definetextfontsizexi \else \errhelp=\EMsimple \errmessage{@fonttextsize only supports `10' or `11', not `\textsizearg'} \fi\fi \endgroup } % In order for the font changes to affect most math symbols and letters, % we have to define the \textfont of the standard families. Since % texinfo doesn't allow for producing subscripts and superscripts except % in the main text, we don't bother to reset \scriptfont and % \scriptscriptfont (which would also require loading a lot more fonts). % \def\resetmathfonts{% \textfont0=\tenrm \textfont1=\teni \textfont2=\tensy \textfont\itfam=\tenit \textfont\slfam=\tensl \textfont\bffam=\tenbf \textfont\ttfam=\tentt \textfont\sffam=\tensf } % The font-changing commands redefine the meanings of \tenSTYLE, instead % of just \STYLE. We do this because \STYLE needs to also set the % current \fam for math mode. Our \STYLE (e.g., \rm) commands hardwire % \tenSTYLE to set the current font. % % Each font-changing command also sets the names \lsize (one size lower) % and \lllsize (three sizes lower). These relative commands are used in % the LaTeX logo and acronyms. % % This all needs generalizing, badly. % \def\textfonts{% \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy \let\tenttsl=\textttsl \def\curfontsize{text}% \def\lsize{reduced}\def\lllsize{smaller}% \resetmathfonts \setleading{\textleading}} \def\titlefonts{% \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy \let\tenttsl=\titlettsl \def\curfontsize{title}% \def\lsize{chap}\def\lllsize{subsec}% \resetmathfonts \setleading{27pt}} \def\titlefont#1{{\titlefonts\rmisbold #1}} \def\chapfonts{% \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy \let\tenttsl=\chapttsl \def\curfontsize{chap}% \def\lsize{sec}\def\lllsize{text}% \resetmathfonts \setleading{19pt}} \def\secfonts{% \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy \let\tenttsl=\secttsl \def\curfontsize{sec}% \def\lsize{subsec}\def\lllsize{reduced}% \resetmathfonts \setleading{16pt}} \def\subsecfonts{% \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy \let\tenttsl=\ssecttsl \def\curfontsize{ssec}% \def\lsize{text}\def\lllsize{small}% \resetmathfonts \setleading{15pt}} \let\subsubsecfonts = \subsecfonts \def\reducedfonts{% \let\tenrm=\reducedrm \let\tenit=\reducedit \let\tensl=\reducedsl \let\tenbf=\reducedbf \let\tentt=\reducedtt \let\reducedcaps=\reducedsc \let\tensf=\reducedsf \let\teni=\reducedi \let\tensy=\reducedsy \let\tenttsl=\reducedttsl \def\curfontsize{reduced}% \def\lsize{small}\def\lllsize{smaller}% \resetmathfonts \setleading{10.5pt}} \def\smallfonts{% \let\tenrm=\smallrm \let\tenit=\smallit \let\tensl=\smallsl \let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc \let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy \let\tenttsl=\smallttsl \def\curfontsize{small}% \def\lsize{smaller}\def\lllsize{smaller}% \resetmathfonts \setleading{10.5pt}} \def\smallerfonts{% \let\tenrm=\smallerrm \let\tenit=\smallerit \let\tensl=\smallersl \let\tenbf=\smallerbf \let\tentt=\smallertt \let\smallcaps=\smallersc \let\tensf=\smallersf \let\teni=\smalleri \let\tensy=\smallersy \let\tenttsl=\smallerttsl \def\curfontsize{smaller}% \def\lsize{smaller}\def\lllsize{smaller}% \resetmathfonts \setleading{9.5pt}} % Fonts for short table of contents. \setfont\shortcontrm\rmshape{12}{1000}{OT1} \setfont\shortcontbf\bfshape{10}{\magstep1}{OT1} % no cmb12 \setfont\shortcontsl\slshape{12}{1000}{OT1} \setfont\shortconttt\ttshape{12}{1000}{OT1TT} % Define these just so they can be easily changed for other fonts. \def\angleleft{$\langle$} \def\angleright{$\rangle$} % Set the fonts to use with the @small... environments. \let\smallexamplefonts = \smallfonts % About \smallexamplefonts. If we use \smallfonts (9pt), @smallexample % can fit this many characters: % 8.5x11=86 smallbook=72 a4=90 a5=69 % If we use \scriptfonts (8pt), then we can fit this many characters: % 8.5x11=90+ smallbook=80 a4=90+ a5=77 % For me, subjectively, the few extra characters that fit aren't worth % the additional smallness of 8pt. So I'm making the default 9pt. % % By the way, for comparison, here's what fits with @example (10pt): % 8.5x11=71 smallbook=60 a4=75 a5=58 % --karl, 24jan03. % Set up the default fonts, so we can use them for creating boxes. % \definetextfontsizexi \message{markup,} % Check if we are currently using a typewriter font. Since all the % Computer Modern typewriter fonts have zero interword stretch (and % shrink), and it is reasonable to expect all typewriter fonts to have % this property, we can check that font parameter. % \def\ifmonospace{\ifdim\fontdimen3\font=0pt } % Markup style infrastructure. \defmarkupstylesetup\INITMACRO will % define and register \INITMACRO to be called on markup style changes. % \INITMACRO can check \currentmarkupstyle for the innermost % style and the set of \ifmarkupSTYLE switches for all styles % currently in effect. \newif\ifmarkupvar \newif\ifmarkupsamp \newif\ifmarkupkey %\newif\ifmarkupfile % @file == @samp. %\newif\ifmarkupoption % @option == @samp. \newif\ifmarkupcode \newif\ifmarkupkbd %\newif\ifmarkupenv % @env == @code. %\newif\ifmarkupcommand % @command == @code. \newif\ifmarkuptex % @tex (and part of @math, for now). \newif\ifmarkupexample \newif\ifmarkupverb \newif\ifmarkupverbatim \let\currentmarkupstyle\empty \def\setupmarkupstyle#1{% \csname markup#1true\endcsname \def\currentmarkupstyle{#1}% \markupstylesetup } \let\markupstylesetup\empty \def\defmarkupstylesetup#1{% \expandafter\def\expandafter\markupstylesetup \expandafter{\markupstylesetup #1}% \def#1% } % Markup style setup for left and right quotes. \defmarkupstylesetup\markupsetuplq{% \expandafter\let\expandafter \temp \csname markupsetuplq\currentmarkupstyle\endcsname \ifx\temp\relax \markupsetuplqdefault \else \temp \fi } \defmarkupstylesetup\markupsetuprq{% \expandafter\let\expandafter \temp \csname markupsetuprq\currentmarkupstyle\endcsname \ifx\temp\relax \markupsetuprqdefault \else \temp \fi } { \catcode`\'=\active \catcode`\`=\active \gdef\markupsetuplqdefault{\let`\lq} \gdef\markupsetuprqdefault{\let'\rq} \gdef\markupsetcodequoteleft{\let`\codequoteleft} \gdef\markupsetcodequoteright{\let'\codequoteright} } \let\markupsetuplqcode \markupsetcodequoteleft \let\markupsetuprqcode \markupsetcodequoteright % \let\markupsetuplqexample \markupsetcodequoteleft \let\markupsetuprqexample \markupsetcodequoteright % \let\markupsetuplqkbd \markupsetcodequoteleft \let\markupsetuprqkbd \markupsetcodequoteright % \let\markupsetuplqsamp \markupsetcodequoteleft \let\markupsetuprqsamp \markupsetcodequoteright % \let\markupsetuplqverb \markupsetcodequoteleft \let\markupsetuprqverb \markupsetcodequoteright % \let\markupsetuplqverbatim \markupsetcodequoteleft \let\markupsetuprqverbatim \markupsetcodequoteright % Allow an option to not use regular directed right quote/apostrophe % (char 0x27), but instead the undirected quote from cmtt (char 0x0d). % The undirected quote is ugly, so don't make it the default, but it % works for pasting with more pdf viewers (at least evince), the % lilypond developers report. xpdf does work with the regular 0x27. % \def\codequoteright{% \expandafter\ifx\csname SETtxicodequoteundirected\endcsname\relax \expandafter\ifx\csname SETcodequoteundirected\endcsname\relax '% \else \char'15 \fi \else \char'15 \fi } % % and a similar option for the left quote char vs. a grave accent. % Modern fonts display ASCII 0x60 as a grave accent, so some people like % the code environments to do likewise. % \def\codequoteleft{% \expandafter\ifx\csname SETtxicodequotebacktick\endcsname\relax \expandafter\ifx\csname SETcodequotebacktick\endcsname\relax % [Knuth] pp. 380,381,391 % \relax disables Spanish ligatures ?` and !` of \tt font. \relax`% \else \char'22 \fi \else \char'22 \fi } % Commands to set the quote options. % \parseargdef\codequoteundirected{% \def\temp{#1}% \ifx\temp\onword \expandafter\let\csname SETtxicodequoteundirected\endcsname = t% \else\ifx\temp\offword \expandafter\let\csname SETtxicodequoteundirected\endcsname = \relax \else \errhelp = \EMsimple \errmessage{Unknown @codequoteundirected value `\temp', must be on|off}% \fi\fi } % \parseargdef\codequotebacktick{% \def\temp{#1}% \ifx\temp\onword \expandafter\let\csname SETtxicodequotebacktick\endcsname = t% \else\ifx\temp\offword \expandafter\let\csname SETtxicodequotebacktick\endcsname = \relax \else \errhelp = \EMsimple \errmessage{Unknown @codequotebacktick value `\temp', must be on|off}% \fi\fi } % [Knuth] pp. 380,381,391, disable Spanish ligatures ?` and !` of \tt font. \def\noligaturesquoteleft{\relax\lq} % Count depth in font-changes, for error checks \newcount\fontdepth \fontdepth=0 % Font commands. % #1 is the font command (\sl or \it), #2 is the text to slant. % If we are in a monospaced environment, however, 1) always use \ttsl, % and 2) do not add an italic correction. \def\dosmartslant#1#2{% \ifusingtt {{\ttsl #2}\let\next=\relax}% {\def\next{{#1#2}\futurelet\next\smartitaliccorrection}}% \next } \def\smartslanted{\dosmartslant\sl} \def\smartitalic{\dosmartslant\it} % Output an italic correction unless \next (presumed to be the following % character) is such as not to need one. \def\smartitaliccorrection{% \ifx\next,% \else\ifx\next-% \else\ifx\next.% \else\ifx\next\.% \else\ifx\next\comma% \else\ptexslash \fi\fi\fi\fi\fi \aftersmartic } % Unconditional use \ttsl, and no ic. @var is set to this for defuns. \def\ttslanted#1{{\ttsl #1}} % @cite is like \smartslanted except unconditionally use \sl. We never want % ttsl for book titles, do we? \def\cite#1{{\sl #1}\futurelet\next\smartitaliccorrection} \def\aftersmartic{} \def\var#1{% \let\saveaftersmartic = \aftersmartic \def\aftersmartic{\null\let\aftersmartic=\saveaftersmartic}% \smartslanted{#1}% } \let\i=\smartitalic \let\slanted=\smartslanted \let\dfn=\smartslanted \let\emph=\smartitalic % Explicit font changes: @r, @sc, undocumented @ii. \def\r#1{{\rm #1}} % roman font \def\sc#1{{\smallcaps#1}} % smallcaps font \def\ii#1{{\it #1}} % italic font % @b, explicit bold. Also @strong. \def\b#1{{\bf #1}} \let\strong=\b % @sansserif, explicit sans. \def\sansserif#1{{\sf #1}} % We can't just use \exhyphenpenalty, because that only has effect at % the end of a paragraph. Restore normal hyphenation at the end of the % group within which \nohyphenation is presumably called. % \def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation} \def\restorehyphenation{\hyphenchar\font = `- } % Set sfcode to normal for the chars that usually have another value. % Can't use plain's \frenchspacing because it uses the `\x notation, and % sometimes \x has an active definition that messes things up. % \catcode`@=11 \def\plainfrenchspacing{% \sfcode\dotChar =\@m \sfcode\questChar=\@m \sfcode\exclamChar=\@m \sfcode\colonChar=\@m \sfcode\semiChar =\@m \sfcode\commaChar =\@m \def\endofsentencespacefactor{1000}% for @. and friends } \def\plainnonfrenchspacing{% \sfcode`\.3000\sfcode`\?3000\sfcode`\!3000 \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250 \def\endofsentencespacefactor{3000}% for @. and friends } \catcode`@=\other \def\endofsentencespacefactor{3000}% default % @t, explicit typewriter. \def\t#1{% {\tt \rawbackslash \plainfrenchspacing #1}% \null } % @samp. \def\samp#1{{\setupmarkupstyle{samp}\lq\tclose{#1}\rq\null}} % @indicateurl is \samp, that is, with quotes. \let\indicateurl=\samp % @code (and similar) prints in typewriter, but with spaces the same % size as normal in the surrounding text, without hyphenation, etc. % This is a subroutine for that. \def\tclose#1{% {% % Change normal interword space to be same as for the current font. \spaceskip = \fontdimen2\font % % Switch to typewriter. \tt % % But `\ ' produces the large typewriter interword space. \def\ {{\spaceskip = 0pt{} }}% % % Turn off hyphenation. \nohyphenation % \rawbackslash \plainfrenchspacing #1% }% \null % reset spacefactor to 1000 } % We *must* turn on hyphenation at `-' and `_' in @code. % (But see \codedashfinish below.) % Otherwise, it is too hard to avoid overfull hboxes % in the Emacs manual, the Library manual, etc. % % Unfortunately, TeX uses one parameter (\hyphenchar) to control % both hyphenation at - and hyphenation within words. % We must therefore turn them both off (\tclose does that) % and arrange explicitly to hyphenate at a dash. -- rms. { \catcode`\-=\active \catcode`\_=\active \catcode`\'=\active \catcode`\`=\active \global\let'=\rq \global\let`=\lq % default definitions % \global\def\code{\begingroup \setupmarkupstyle{code}% % The following should really be moved into \setupmarkupstyle handlers. \catcode\dashChar=\active \catcode\underChar=\active \ifallowcodebreaks \let-\codedash \let_\codeunder \else \let-\normaldash \let_\realunder \fi % Given -foo (with a single dash), we do not want to allow a break % after the hyphen. \global\let\codedashprev=\codedash % \codex } % \gdef\codedash{\futurelet\next\codedashfinish} \gdef\codedashfinish{% \normaldash % always output the dash character itself. % % Now, output a discretionary to allow a line break, unless % (a) the next character is a -, or % (b) the preceding character is a -. % E.g., given --posix, we do not want to allow a break after either -. % Given --foo-bar, we do want to allow a break between the - and the b. \ifx\next\codedash \else \ifx\codedashprev\codedash \else \discretionary{}{}{}\fi \fi % we need the space after the = for the case when \next itself is a % space token; it would get swallowed otherwise. As in @code{- a}. \global\let\codedashprev= \next } } \def\normaldash{-} % \def\codex #1{\tclose{#1}\endgroup} \def\codeunder{% % this is all so @math{@code{var_name}+1} can work. In math mode, _ % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.) % will therefore expand the active definition of _, which is us % (inside @code that is), therefore an endless loop. \ifusingtt{\ifmmode \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_. \else\normalunderscore \fi \discretionary{}{}{}}% {\_}% } % An additional complication: the above will allow breaks after, e.g., % each of the four underscores in __typeof__. This is bad. % @allowcodebreaks provides a document-level way to turn breaking at - % and _ on and off. % \newif\ifallowcodebreaks \allowcodebreakstrue \def\keywordtrue{true} \def\keywordfalse{false} \parseargdef\allowcodebreaks{% \def\txiarg{#1}% \ifx\txiarg\keywordtrue \allowcodebreakstrue \else\ifx\txiarg\keywordfalse \allowcodebreaksfalse \else \errhelp = \EMsimple \errmessage{Unknown @allowcodebreaks option `\txiarg', must be true|false}% \fi\fi } % For @command, @env, @file, @option quotes seem unnecessary, % so use \code rather than \samp. \let\command=\code \let\env=\code \let\file=\code \let\option=\code % @uref (abbreviation for `urlref') takes an optional (comma-separated) % second argument specifying the text to display and an optional third % arg as text to display instead of (rather than in addition to) the url % itself. First (mandatory) arg is the url. % (This \urefnobreak definition isn't used now, leaving it for a while % for comparison.) \def\urefnobreak#1{\dourefnobreak #1,,,\finish} \def\dourefnobreak#1,#2,#3,#4\finish{\begingroup \unsepspaces \pdfurl{#1}% \setbox0 = \hbox{\ignorespaces #3}% \ifdim\wd0 > 0pt \unhbox0 % third arg given, show only that \else \setbox0 = \hbox{\ignorespaces #2}% \ifdim\wd0 > 0pt \ifpdf \unhbox0 % PDF: 2nd arg given, show only it \else \unhbox0\ (\code{#1})% DVI: 2nd arg given, show both it and url \fi \else \code{#1}% only url given, so show it \fi \fi \endlink \endgroup} % This \urefbreak definition is the active one. \def\urefbreak{\begingroup \urefcatcodes \dourefbreak} \let\uref=\urefbreak \def\dourefbreak#1{\urefbreakfinish #1,,,\finish} \def\urefbreakfinish#1,#2,#3,#4\finish{% doesn't work in @example \unsepspaces \pdfurl{#1}% \setbox0 = \hbox{\ignorespaces #3}% \ifdim\wd0 > 0pt \unhbox0 % third arg given, show only that \else \setbox0 = \hbox{\ignorespaces #2}% \ifdim\wd0 > 0pt \ifpdf \unhbox0 % PDF: 2nd arg given, show only it \else \unhbox0\ (\urefcode{#1})% DVI: 2nd arg given, show both it and url \fi \else \urefcode{#1}% only url given, so show it \fi \fi \endlink \endgroup} % Allow line breaks around only a few characters (only). \def\urefcatcodes{% \catcode\ampChar=\active \catcode\dotChar=\active \catcode\hashChar=\active \catcode\questChar=\active \catcode\slashChar=\active } { \urefcatcodes % \global\def\urefcode{\begingroup \setupmarkupstyle{code}% \urefcatcodes \let&\urefcodeamp \let.\urefcodedot \let#\urefcodehash \let?\urefcodequest \let/\urefcodeslash \codex } % % By default, they are just regular characters. \global\def&{\normalamp} \global\def.{\normaldot} \global\def#{\normalhash} \global\def?{\normalquest} \global\def/{\normalslash} } % we put a little stretch before and after the breakable chars, to help % line breaking of long url's. The unequal skips make look better in % cmtt at least, especially for dots. \def\urefprestretch{\urefprebreak \hskip0pt plus.13em } \def\urefpoststretch{\urefpostbreak \hskip0pt plus.1em } % \def\urefcodeamp{\urefprestretch \&\urefpoststretch} \def\urefcodedot{\urefprestretch .\urefpoststretch} \def\urefcodehash{\urefprestretch \#\urefpoststretch} \def\urefcodequest{\urefprestretch ?\urefpoststretch} \def\urefcodeslash{\futurelet\next\urefcodeslashfinish} { \catcode`\/=\active \global\def\urefcodeslashfinish{% \urefprestretch \slashChar % Allow line break only after the final / in a sequence of % slashes, to avoid line break between the slashes in http://. \ifx\next/\else \urefpoststretch \fi } } % One more complication: by default we'll break after the special % characters, but some people like to break before the special chars, so % allow that. Also allow no breaking at all, for manual control. % \parseargdef\urefbreakstyle{% \def\txiarg{#1}% \ifx\txiarg\wordnone \def\urefprebreak{\nobreak}\def\urefpostbreak{\nobreak} \else\ifx\txiarg\wordbefore \def\urefprebreak{\allowbreak}\def\urefpostbreak{\nobreak} \else\ifx\txiarg\wordafter \def\urefprebreak{\nobreak}\def\urefpostbreak{\allowbreak} \else \errhelp = \EMsimple \errmessage{Unknown @urefbreakstyle setting `\txiarg'}% \fi\fi\fi } \def\wordafter{after} \def\wordbefore{before} \def\wordnone{none} \urefbreakstyle after % @url synonym for @uref, since that's how everyone uses it. % \let\url=\uref % rms does not like angle brackets --karl, 17may97. % So now @email is just like @uref, unless we are pdf. % %\def\email#1{\angleleft{\tt #1}\angleright} \ifpdf \def\email#1{\doemail#1,,\finish} \def\doemail#1,#2,#3\finish{\begingroup \unsepspaces \pdfurl{mailto:#1}% \setbox0 = \hbox{\ignorespaces #2}% \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi \endlink \endgroup} \else \let\email=\uref \fi % @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always), % `example' (@kbd uses ttsl only inside of @example and friends), % or `code' (@kbd uses normal tty font always). \parseargdef\kbdinputstyle{% \def\txiarg{#1}% \ifx\txiarg\worddistinct \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}% \else\ifx\txiarg\wordexample \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}% \else\ifx\txiarg\wordcode \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}% \else \errhelp = \EMsimple \errmessage{Unknown @kbdinputstyle setting `\txiarg'}% \fi\fi\fi } \def\worddistinct{distinct} \def\wordexample{example} \def\wordcode{code} % Default is `distinct'. \kbdinputstyle distinct % @kbd is like @code, except that if the argument is just one @key command, % then @kbd has no effect. \def\kbd#1{{\def\look{#1}\expandafter\kbdsub\look??\par}} \def\xkey{\key} \def\kbdsub#1#2#3\par{% \def\one{#1}\def\three{#3}\def\threex{??}% \ifx\one\xkey\ifx\threex\three \key{#2}% \else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi \else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi } % definition of @key that produces a lozenge. Doesn't adjust to text size. %\setfont\keyrm\rmshape{8}{1000}{OT1} %\font\keysy=cmsy9 %\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{% % \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{% % \vbox{\hrule\kern-0.4pt % \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}% % \kern-0.4pt\hrule}% % \kern-.06em\raise0.4pt\hbox{\angleright}}}} % definition of @key with no lozenge. If the current font is already % monospace, don't change it; that way, we respect @kbdinputstyle. But % if it isn't monospace, then use \tt. % \def\key#1{{\setupmarkupstyle{key}% \nohyphenation \ifmonospace\else\tt\fi #1}\null} % @clicksequence{File @click{} Open ...} \def\clicksequence#1{\begingroup #1\endgroup} % @clickstyle @arrow (by default) \parseargdef\clickstyle{\def\click{#1}} \def\click{\arrow} % Typeset a dimension, e.g., `in' or `pt'. The only reason for the % argument is to make the input look right: @dmn{pt} instead of @dmn{}pt. % \def\dmn#1{\thinspace #1} % @l was never documented to mean ``switch to the Lisp font'', % and it is not used as such in any manual I can find. We need it for % Polish suppressed-l. --karl, 22sep96. %\def\l#1{{\li #1}\null} % @acronym for "FBI", "NATO", and the like. % We print this one point size smaller, since it's intended for % all-uppercase. % \def\acronym#1{\doacronym #1,,\finish} \def\doacronym#1,#2,#3\finish{% {\selectfonts\lsize #1}% \def\temp{#2}% \ifx\temp\empty \else \space ({\unsepspaces \ignorespaces \temp \unskip})% \fi \null % reset \spacefactor=1000 } % @abbr for "Comput. J." and the like. % No font change, but don't do end-of-sentence spacing. % \def\abbr#1{\doabbr #1,,\finish} \def\doabbr#1,#2,#3\finish{% {\plainfrenchspacing #1}% \def\temp{#2}% \ifx\temp\empty \else \space ({\unsepspaces \ignorespaces \temp \unskip})% \fi \null % reset \spacefactor=1000 } % @asis just yields its argument. Used with @table, for example. % \def\asis#1{#1} % @math outputs its argument in math mode. % % One complication: _ usually means subscripts, but it could also mean % an actual _ character, as in @math{@var{some_variable} + 1}. So make % _ active, and distinguish by seeing if the current family is \slfam, % which is what @var uses. { \catcode`\_ = \active \gdef\mathunderscore{% \catcode`\_=\active \def_{\ifnum\fam=\slfam \_\else\sb\fi}% } } % Another complication: we want \\ (and @\) to output a math (or tt) \. % FYI, plain.tex uses \\ as a temporary control sequence (for no % particular reason), but this is not advertised and we don't care. % % The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\. \def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi} % \def\math{% \tex \mathunderscore \let\\ = \mathbackslash \mathactive % make the texinfo accent commands work in math mode \let\"=\ddot \let\'=\acute \let\==\bar \let\^=\hat \let\`=\grave \let\u=\breve \let\v=\check \let\~=\tilde \let\dotaccent=\dot $\finishmath } \def\finishmath#1{#1$\endgroup} % Close the group opened by \tex. % Some active characters (such as <) are spaced differently in math. % We have to reset their definitions in case the @math was an argument % to a command which sets the catcodes (such as @item or @section). % { \catcode`^ = \active \catcode`< = \active \catcode`> = \active \catcode`+ = \active \catcode`' = \active \gdef\mathactive{% \let^ = \ptexhat \let< = \ptexless \let> = \ptexgtr \let+ = \ptexplus \let' = \ptexquoteright } } % ctrl is no longer a Texinfo command, but leave this definition for fun. \def\ctrl #1{{\tt \rawbackslash \hat}#1} % @inlinefmt{FMTNAME,PROCESSED-TEXT} and @inlineraw{FMTNAME,RAW-TEXT}. % Ignore unless FMTNAME == tex; then it is like @iftex and @tex, % except specified as a normal braced arg, so no newlines to worry about. % \def\outfmtnametex{tex} % \long\def\inlinefmt#1{\doinlinefmt #1,\finish} \long\def\doinlinefmt#1,#2,\finish{% \def\inlinefmtname{#1}% \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\fi } % For raw, must switch into @tex before parsing the argument, to avoid % setting catcodes prematurely. Doing it this way means that, for % example, @inlineraw{html, foo{bar} gets a parse error instead of being % ignored. But this isn't important because if people want a literal % *right* brace they would have to use a command anyway, so they may as % well use a command to get a left brace too. We could re-use the % delimiter character idea from \verb, but it seems like overkill. % \long\def\inlineraw{\tex \doinlineraw} \long\def\doinlineraw#1{\doinlinerawtwo #1,\finish} \def\doinlinerawtwo#1,#2,\finish{% \def\inlinerawname{#1}% \ifx\inlinerawname\outfmtnametex \ignorespaces #2\fi \endgroup % close group opened by \tex. } \message{glyphs,} % and logos. % @@ prints an @, as does @atchar{}. \def\@{\char64 } \let\atchar=\@ % @{ @} @lbracechar{} @rbracechar{} all generate brace characters. % Unless we're in typewriter, use \ecfont because the CM text fonts do % not have braces, and we don't want to switch into math. \def\mylbrace{{\ifmonospace\else\ecfont\fi \char123}} \def\myrbrace{{\ifmonospace\else\ecfont\fi \char125}} \let\{=\mylbrace \let\lbracechar=\{ \let\}=\myrbrace \let\rbracechar=\} \begingroup % Definitions to produce \{ and \} commands for indices, % and @{ and @} for the aux/toc files. \catcode`\{ = \other \catcode`\} = \other \catcode`\[ = 1 \catcode`\] = 2 \catcode`\! = 0 \catcode`\\ = \other !gdef!lbracecmd[\{]% !gdef!rbracecmd[\}]% !gdef!lbraceatcmd[@{]% !gdef!rbraceatcmd[@}]% !endgroup % @comma{} to avoid , parsing problems. \let\comma = , % Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent % Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H. \let\, = \ptexc \let\dotaccent = \ptexdot \def\ringaccent#1{{\accent23 #1}} \let\tieaccent = \ptext \let\ubaraccent = \ptexb \let\udotaccent = \d % Other special characters: @questiondown @exclamdown @ordf @ordm % Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss. \def\questiondown{?`} \def\exclamdown{!`} \def\ordf{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{a}}} \def\ordm{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{o}}} % Dotless i and dotless j, used for accents. \def\imacro{i} \def\jmacro{j} \def\dotless#1{% \def\temp{#1}% \ifx\temp\imacro \ifmmode\imath \else\ptexi \fi \else\ifx\temp\jmacro \ifmmode\jmath \else\j \fi \else \errmessage{@dotless can be used only with i or j}% \fi\fi } % The \TeX{} logo, as in plain, but resetting the spacing so that a % period following counts as ending a sentence. (Idea found in latex.) % \edef\TeX{\TeX \spacefactor=1000 } % @LaTeX{} logo. Not quite the same results as the definition in % latex.ltx, since we use a different font for the raised A; it's most % convenient for us to use an explicitly smaller font, rather than using % the \scriptstyle font (since we don't reset \scriptstyle and % \scriptscriptstyle). % \def\LaTeX{% L\kern-.36em {\setbox0=\hbox{T}% \vbox to \ht0{\hbox{% \ifx\textnominalsize\xwordpt % for 10pt running text, \lllsize (8pt) is too small for the A in LaTeX. % Revert to plain's \scriptsize, which is 7pt. \count255=\the\fam $\fam\count255 \scriptstyle A$% \else % For 11pt, we can use our lllsize. \selectfonts\lllsize A% \fi }% \vss }}% \kern-.15em \TeX } % Some math mode symbols. \def\bullet{$\ptexbullet$} \def\geq{\ifmmode \ge\else $\ge$\fi} \def\leq{\ifmmode \le\else $\le$\fi} \def\minus{\ifmmode -\else $-$\fi} % @dots{} outputs an ellipsis using the current font. % We do .5em per period so that it has the same spacing in the cm % typewriter fonts as three actual period characters; on the other hand, % in other typewriter fonts three periods are wider than 1.5em. So do % whichever is larger. % \def\dots{% \leavevmode \setbox0=\hbox{...}% get width of three periods \ifdim\wd0 > 1.5em \dimen0 = \wd0 \else \dimen0 = 1.5em \fi \hbox to \dimen0{% \hskip 0pt plus.25fil .\hskip 0pt plus1fil .\hskip 0pt plus1fil .\hskip 0pt plus.5fil }% } % @enddots{} is an end-of-sentence ellipsis. % \def\enddots{% \dots \spacefactor=\endofsentencespacefactor } % @point{}, @result{}, @expansion{}, @print{}, @equiv{}. % % Since these characters are used in examples, they should be an even number of % \tt widths. Each \tt character is 1en, so two makes it 1em. % \def\point{$\star$} \def\arrow{\leavevmode\raise.05ex\hbox to 1em{\hfil$\rightarrow$\hfil}} \def\result{\leavevmode\raise.05ex\hbox to 1em{\hfil$\Rightarrow$\hfil}} \def\expansion{\leavevmode\hbox to 1em{\hfil$\mapsto$\hfil}} \def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}} \def\equiv{\leavevmode\hbox to 1em{\hfil$\ptexequiv$\hfil}} % The @error{} command. % Adapted from the TeXbook's \boxit. % \newbox\errorbox % {\tentt \global\dimen0 = 3em}% Width of the box. \dimen2 = .55pt % Thickness of rules % The text. (`r' is open on the right, `e' somewhat less so on the left.) \setbox0 = \hbox{\kern-.75pt \reducedsf \putworderror\kern-1.5pt} % \setbox\errorbox=\hbox to \dimen0{\hfil \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right. \advance\hsize by -2\dimen2 % Rules. \vbox{% \hrule height\dimen2 \hbox{\vrule width\dimen2 \kern3pt % Space to left of text. \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below. \kern3pt\vrule width\dimen2}% Space to right. \hrule height\dimen2} \hfil} % \def\error{\leavevmode\lower.7ex\copy\errorbox} % @pounds{} is a sterling sign, which Knuth put in the CM italic font. % \def\pounds{{\it\$}} % @euro{} comes from a separate font, depending on the current style. % We use the free feym* fonts from the eurosym package by Henrik % Theiling, which support regular, slanted, bold and bold slanted (and % "outlined" (blackboard board, sort of) versions, which we don't need). % It is available from http://www.ctan.org/tex-archive/fonts/eurosym. % % Although only regular is the truly official Euro symbol, we ignore % that. The Euro is designed to be slightly taller than the regular % font height. % % feymr - regular % feymo - slanted % feybr - bold % feybo - bold slanted % % There is no good (free) typewriter version, to my knowledge. % A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide. % Hmm. % % Also doesn't work in math. Do we need to do math with euro symbols? % Hope not. % % \def\euro{{\eurofont e}} \def\eurofont{% % We set the font at each command, rather than predefining it in % \textfonts and the other font-switching commands, so that % installations which never need the symbol don't have to have the % font installed. % % There is only one designed size (nominal 10pt), so we always scale % that to the current nominal size. % % By the way, simply using "at 1em" works for cmr10 and the like, but % does not work for cmbx10 and other extended/shrunken fonts. % \def\eurosize{\csname\curfontsize nominalsize\endcsname}% % \ifx\curfontstyle\bfstylename % bold: \font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize \else % regular: \font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize \fi \thiseurofont } % Glyphs from the EC fonts. We don't use \let for the aliases, because % sometimes we redefine the original macro, and the alias should reflect % the redefinition. % % Use LaTeX names for the Icelandic letters. \def\DH{{\ecfont \char"D0}} % Eth \def\dh{{\ecfont \char"F0}} % eth \def\TH{{\ecfont \char"DE}} % Thorn \def\th{{\ecfont \char"FE}} % thorn % \def\guillemetleft{{\ecfont \char"13}} \def\guillemotleft{\guillemetleft} \def\guillemetright{{\ecfont \char"14}} \def\guillemotright{\guillemetright} \def\guilsinglleft{{\ecfont \char"0E}} \def\guilsinglright{{\ecfont \char"0F}} \def\quotedblbase{{\ecfont \char"12}} \def\quotesinglbase{{\ecfont \char"0D}} % % This positioning is not perfect (see the ogonek LaTeX package), but % we have the precomposed glyphs for the most common cases. We put the % tests to use those glyphs in the single \ogonek macro so we have fewer % dummy definitions to worry about for index entries, etc. % % ogonek is also used with other letters in Lithuanian (IOU), but using % the precomposed glyphs for those is not so easy since they aren't in % the same EC font. \def\ogonek#1{{% \def\temp{#1}% \ifx\temp\macrocharA\Aogonek \else\ifx\temp\macrochara\aogonek \else\ifx\temp\macrocharE\Eogonek \else\ifx\temp\macrochare\eogonek \else \ecfont \setbox0=\hbox{#1}% \ifdim\ht0=1ex\accent"0C #1% \else\ooalign{\unhbox0\crcr\hidewidth\char"0C \hidewidth}% \fi \fi\fi\fi\fi }% } \def\Aogonek{{\ecfont \char"81}}\def\macrocharA{A} \def\aogonek{{\ecfont \char"A1}}\def\macrochara{a} \def\Eogonek{{\ecfont \char"86}}\def\macrocharE{E} \def\eogonek{{\ecfont \char"A6}}\def\macrochare{e} % % Use the ec* fonts (cm-super in outline format) for non-CM glyphs. \def\ecfont{% % We can't distinguish serif/sans and italic/slanted, but this % is used for crude hacks anyway (like adding French and German % quotes to documents typeset with CM, where we lose kerning), so % hopefully nobody will notice/care. \edef\ecsize{\csname\curfontsize ecsize\endcsname}% \edef\nominalsize{\csname\curfontsize nominalsize\endcsname}% \ifmonospace % typewriter: \font\thisecfont = ectt\ecsize \space at \nominalsize \else \ifx\curfontstyle\bfstylename % bold: \font\thisecfont = ecb\ifusingit{i}{x}\ecsize \space at \nominalsize \else % regular: \font\thisecfont = ec\ifusingit{ti}{rm}\ecsize \space at \nominalsize \fi \fi \thisecfont } % @registeredsymbol - R in a circle. The font for the R should really % be smaller yet, but lllsize is the best we can do for now. % Adapted from the plain.tex definition of \copyright. % \def\registeredsymbol{% $^{{\ooalign{\hfil\raise.07ex\hbox{\selectfonts\lllsize R}% \hfil\crcr\Orb}}% }$% } % @textdegree - the normal degrees sign. % \def\textdegree{$^\circ$} % Laurent Siebenmann reports \Orb undefined with: % Textures 1.7.7 (preloaded format=plain 93.10.14) (68K) 16 APR 2004 02:38 % so we'll define it if necessary. % \ifx\Orb\thisisundefined \def\Orb{\mathhexbox20D} \fi % Quotes. \chardef\quotedblleft="5C \chardef\quotedblright=`\" \chardef\quoteleft=`\` \chardef\quoteright=`\' \message{page headings,} \newskip\titlepagetopglue \titlepagetopglue = 1.5in \newskip\titlepagebottomglue \titlepagebottomglue = 2pc % First the title page. Must do @settitle before @titlepage. \newif\ifseenauthor \newif\iffinishedtitlepage % Do an implicit @contents or @shortcontents after @end titlepage if the % user says @setcontentsaftertitlepage or @setshortcontentsaftertitlepage. % \newif\ifsetcontentsaftertitlepage \let\setcontentsaftertitlepage = \setcontentsaftertitlepagetrue \newif\ifsetshortcontentsaftertitlepage \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue \parseargdef\shorttitlepage{% \begingroup \hbox{}\vskip 1.5in \chaprm \centerline{#1}% \endgroup\page\hbox{}\page} \envdef\titlepage{% % Open one extra group, as we want to close it in the middle of \Etitlepage. \begingroup \parindent=0pt \textfonts % Leave some space at the very top of the page. \vglue\titlepagetopglue % No rule at page bottom unless we print one at the top with @title. \finishedtitlepagetrue % % Most title ``pages'' are actually two pages long, with space % at the top of the second. We don't want the ragged left on the second. \let\oldpage = \page \def\page{% \iffinishedtitlepage\else \finishtitlepage \fi \let\page = \oldpage \page \null }% } \def\Etitlepage{% \iffinishedtitlepage\else \finishtitlepage \fi % It is important to do the page break before ending the group, % because the headline and footline are only empty inside the group. % If we use the new definition of \page, we always get a blank page % after the title page, which we certainly don't want. \oldpage \endgroup % % Need this before the \...aftertitlepage checks so that if they are % in effect the toc pages will come out with page numbers. \HEADINGSon % % If they want short, they certainly want long too. \ifsetshortcontentsaftertitlepage \shortcontents \contents \global\let\shortcontents = \relax \global\let\contents = \relax \fi % \ifsetcontentsaftertitlepage \contents \global\let\contents = \relax \global\let\shortcontents = \relax \fi } \def\finishtitlepage{% \vskip4pt \hrule height 2pt width \hsize \vskip\titlepagebottomglue \finishedtitlepagetrue } % Settings used for typesetting titles: no hyphenation, no indentation, % don't worry much about spacing, ragged right. This should be used % inside a \vbox, and fonts need to be set appropriately first. Because % it is always used for titles, nothing else, we call \rmisbold. \par % should be specified before the end of the \vbox, since a vbox is a group. % \def\raggedtitlesettings{% \rmisbold \hyphenpenalty=10000 \parindent=0pt \tolerance=5000 \ptexraggedright } % Macros to be used within @titlepage: \let\subtitlerm=\tenrm \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines} \parseargdef\title{% \checkenv\titlepage \vbox{\titlefonts \raggedtitlesettings #1\par}% % print a rule at the page bottom also. \finishedtitlepagefalse \vskip4pt \hrule height 4pt width \hsize \vskip4pt } \parseargdef\subtitle{% \checkenv\titlepage {\subtitlefont \rightline{#1}}% } % @author should come last, but may come many times. % It can also be used inside @quotation. % \parseargdef\author{% \def\temp{\quotation}% \ifx\thisenv\temp \def\quotationauthor{#1}% printed in \Equotation. \else \checkenv\titlepage \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi {\secfonts\rmisbold \leftline{#1}}% \fi } % Set up page headings and footings. \let\thispage=\folio \newtoks\evenheadline % headline on even pages \newtoks\oddheadline % headline on odd pages \newtoks\evenfootline % footline on even pages \newtoks\oddfootline % footline on odd pages % Now make TeX use those variables \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline \else \the\evenheadline \fi}} \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline \else \the\evenfootline \fi}\HEADINGShook} \let\HEADINGShook=\relax % Commands to set those variables. % For example, this is what @headings on does % @evenheading @thistitle|@thispage|@thischapter % @oddheading @thischapter|@thispage|@thistitle % @evenfooting @thisfile|| % @oddfooting ||@thisfile \def\evenheading{\parsearg\evenheadingxxx} \def\evenheadingxxx #1{\evenheadingyyy #1\|\|\|\|\finish} \def\evenheadingyyy #1\|#2\|#3\|#4\finish{% \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} \def\oddheading{\parsearg\oddheadingxxx} \def\oddheadingxxx #1{\oddheadingyyy #1\|\|\|\|\finish} \def\oddheadingyyy #1\|#2\|#3\|#4\finish{% \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} \parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}% \def\evenfooting{\parsearg\evenfootingxxx} \def\evenfootingxxx #1{\evenfootingyyy #1\|\|\|\|\finish} \def\evenfootingyyy #1\|#2\|#3\|#4\finish{% \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} \def\oddfooting{\parsearg\oddfootingxxx} \def\oddfootingxxx #1{\oddfootingyyy #1\|\|\|\|\finish} \def\oddfootingyyy #1\|#2\|#3\|#4\finish{% \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}% % % Leave some space for the footline. Hopefully ok to assume % @evenfooting will not be used by itself. \global\advance\pageheight by -12pt \global\advance\vsize by -12pt } \parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}} % @evenheadingmarks top \thischapter <- chapter at the top of a page % @evenheadingmarks bottom \thischapter <- chapter at the bottom of a page % % The same set of arguments for: % % @oddheadingmarks % @evenfootingmarks % @oddfootingmarks % @everyheadingmarks % @everyfootingmarks \def\evenheadingmarks{\headingmarks{even}{heading}} \def\oddheadingmarks{\headingmarks{odd}{heading}} \def\evenfootingmarks{\headingmarks{even}{footing}} \def\oddfootingmarks{\headingmarks{odd}{footing}} \def\everyheadingmarks#1 {\headingmarks{even}{heading}{#1} \headingmarks{odd}{heading}{#1} } \def\everyfootingmarks#1 {\headingmarks{even}{footing}{#1} \headingmarks{odd}{footing}{#1} } % #1 = even/odd, #2 = heading/footing, #3 = top/bottom. \def\headingmarks#1#2#3 {% \expandafter\let\expandafter\temp \csname get#3headingmarks\endcsname \global\expandafter\let\csname get#1#2marks\endcsname \temp } \everyheadingmarks bottom \everyfootingmarks bottom % @headings double turns headings on for double-sided printing. % @headings single turns headings on for single-sided printing. % @headings off turns them off. % @headings on same as @headings double, retained for compatibility. % @headings after turns on double-sided headings after this page. % @headings doubleafter turns on double-sided headings after this page. % @headings singleafter turns on single-sided headings after this page. % By default, they are off at the start of a document, % and turned `on' after @end titlepage. \def\headings #1 {\csname HEADINGS#1\endcsname} \def\headingsoff{% non-global headings elimination \evenheadline={\hfil}\evenfootline={\hfil}% \oddheadline={\hfil}\oddfootline={\hfil}% } \def\HEADINGSoff{{\globaldefs=1 \headingsoff}} % global setting \HEADINGSoff % it's the default % When we turn headings on, set the page number to 1. % For double-sided printing, put current file name in lower left corner, % chapter name on inside top of right hand pages, document % title on inside top of left hand pages, and page numbers on outside top % edge of all pages. \def\HEADINGSdouble{% \global\pageno=1 \global\evenfootline={\hfil} \global\oddfootline={\hfil} \global\evenheadline={\line{\folio\hfil\thistitle}} \global\oddheadline={\line{\thischapter\hfil\folio}} \global\let\contentsalignmacro = \chapoddpage } \let\contentsalignmacro = \chappager % For single-sided printing, chapter title goes across top left of page, % page number on top right. \def\HEADINGSsingle{% \global\pageno=1 \global\evenfootline={\hfil} \global\oddfootline={\hfil} \global\evenheadline={\line{\thischapter\hfil\folio}} \global\oddheadline={\line{\thischapter\hfil\folio}} \global\let\contentsalignmacro = \chappager } \def\HEADINGSon{\HEADINGSdouble} \def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex} \let\HEADINGSdoubleafter=\HEADINGSafter \def\HEADINGSdoublex{% \global\evenfootline={\hfil} \global\oddfootline={\hfil} \global\evenheadline={\line{\folio\hfil\thistitle}} \global\oddheadline={\line{\thischapter\hfil\folio}} \global\let\contentsalignmacro = \chapoddpage } \def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex} \def\HEADINGSsinglex{% \global\evenfootline={\hfil} \global\oddfootline={\hfil} \global\evenheadline={\line{\thischapter\hfil\folio}} \global\oddheadline={\line{\thischapter\hfil\folio}} \global\let\contentsalignmacro = \chappager } % Subroutines used in generating headings % This produces Day Month Year style of output. % Only define if not already defined, in case a txi-??.tex file has set % up a different format (e.g., txi-cs.tex does this). \ifx\today\thisisundefined \def\today{% \number\day\space \ifcase\month \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec \fi \space\number\year} \fi % @settitle line... specifies the title of the document, for headings. % It generates no output of its own. \def\thistitle{\putwordNoTitle} \def\settitle{\parsearg{\gdef\thistitle}} \message{tables,} % Tables -- @table, @ftable, @vtable, @item(x). % default indentation of table text \newdimen\tableindent \tableindent=.8in % default indentation of @itemize and @enumerate text \newdimen\itemindent \itemindent=.3in % margin between end of table item and start of table text. \newdimen\itemmargin \itemmargin=.1in % used internally for \itemindent minus \itemmargin \newdimen\itemmax % Note @table, @ftable, and @vtable define @item, @itemx, etc., with % these defs. % They also define \itemindex % to index the item name in whatever manner is desired (perhaps none). \newif\ifitemxneedsnegativevskip \def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi} \def\internalBitem{\smallbreak \parsearg\itemzzz} \def\internalBitemx{\itemxpar \parsearg\itemzzz} \def\itemzzz #1{\begingroup % \advance\hsize by -\rightskip \advance\hsize by -\tableindent \setbox0=\hbox{\itemindicate{#1}}% \itemindex{#1}% \nobreak % This prevents a break before @itemx. % % If the item text does not fit in the space we have, put it on a line % by itself, and do not allow a page break either before or after that % line. We do not start a paragraph here because then if the next % command is, e.g., @kindex, the whatsit would get put into the % horizontal list on a line by itself, resulting in extra blank space. \ifdim \wd0>\itemmax % % Make this a paragraph so we get the \parskip glue and wrapping, % but leave it ragged-right. \begingroup \advance\leftskip by-\tableindent \advance\hsize by\tableindent \advance\rightskip by0pt plus1fil\relax \leavevmode\unhbox0\par \endgroup % % We're going to be starting a paragraph, but we don't want the % \parskip glue -- logically it's part of the @item we just started. \nobreak \vskip-\parskip % % Stop a page break at the \parskip glue coming up. However, if % what follows is an environment such as @example, there will be no % \parskip glue; then the negative vskip we just inserted would % cause the example and the item to crash together. So we use this % bizarre value of 10001 as a signal to \aboveenvbreak to insert % \parskip glue after all. Section titles are handled this way also. % \penalty 10001 \endgroup \itemxneedsnegativevskipfalse \else % The item text fits into the space. Start a paragraph, so that the % following text (if any) will end up on the same line. \noindent % Do this with kerns and \unhbox so that if there is a footnote in % the item text, it can migrate to the main vertical list and % eventually be printed. \nobreak\kern-\tableindent \dimen0 = \itemmax \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0 \unhbox0 \nobreak\kern\dimen0 \endgroup \itemxneedsnegativevskiptrue \fi } \def\item{\errmessage{@item while not in a list environment}} \def\itemx{\errmessage{@itemx while not in a list environment}} % @table, @ftable, @vtable. \envdef\table{% \let\itemindex\gobble \tablecheck{table}% } \envdef\ftable{% \def\itemindex ##1{\doind {fn}{\code{##1}}}% \tablecheck{ftable}% } \envdef\vtable{% \def\itemindex ##1{\doind {vr}{\code{##1}}}% \tablecheck{vtable}% } \def\tablecheck#1{% \ifnum \the\catcode`\^^M=\active \endgroup \errmessage{This command won't work in this context; perhaps the problem is that we are \inenvironment\thisenv}% \def\next{\doignore{#1}}% \else \let\next\tablex \fi \next } \def\tablex#1{% \def\itemindicate{#1}% \parsearg\tabley } \def\tabley#1{% {% \makevalueexpandable \edef\temp{\noexpand\tablez #1\space\space\space}% \expandafter }\temp \endtablez } \def\tablez #1 #2 #3 #4\endtablez{% \aboveenvbreak \ifnum 0#1>0 \advance \leftskip by #1\mil \fi \ifnum 0#2>0 \tableindent=#2\mil \fi \ifnum 0#3>0 \advance \rightskip by #3\mil \fi \itemmax=\tableindent \advance \itemmax by -\itemmargin \advance \leftskip by \tableindent \exdentamount=\tableindent \parindent = 0pt \parskip = \smallskipamount \ifdim \parskip=0pt \parskip=2pt \fi \let\item = \internalBitem \let\itemx = \internalBitemx } \def\Etable{\endgraf\afterenvbreak} \let\Eftable\Etable \let\Evtable\Etable \let\Eitemize\Etable \let\Eenumerate\Etable % This is the counter used by @enumerate, which is really @itemize \newcount \itemno \envdef\itemize{\parsearg\doitemize} \def\doitemize#1{% \aboveenvbreak \itemmax=\itemindent \advance\itemmax by -\itemmargin \advance\leftskip by \itemindent \exdentamount=\itemindent \parindent=0pt \parskip=\smallskipamount \ifdim\parskip=0pt \parskip=2pt \fi % % Try typesetting the item mark that if the document erroneously says % something like @itemize @samp (intending @table), there's an error % right away at the @itemize. It's not the best error message in the % world, but it's better than leaving it to the @item. This means if % the user wants an empty mark, they have to say @w{} not just @w. \def\itemcontents{#1}% \setbox0 = \hbox{\itemcontents}% % % @itemize with no arg is equivalent to @itemize @bullet. \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi % \let\item=\itemizeitem } % Definition of @item while inside @itemize and @enumerate. % \def\itemizeitem{% \advance\itemno by 1 % for enumerations {\let\par=\endgraf \smallbreak}% reasonable place to break {% % If the document has an @itemize directly after a section title, a % \nobreak will be last on the list, and \sectionheading will have % done a \vskip-\parskip. In that case, we don't want to zero % parskip, or the item text will crash with the heading. On the % other hand, when there is normal text preceding the item (as there % usually is), we do want to zero parskip, or there would be too much % space. In that case, we won't have a \nobreak before. At least % that's the theory. \ifnum\lastpenalty<10000 \parskip=0in \fi \noindent \hbox to 0pt{\hss \itemcontents \kern\itemmargin}% % \vadjust{\penalty 1200}}% not good to break after first line of item. \flushcr } % \splitoff TOKENS\endmark defines \first to be the first token in % TOKENS, and \rest to be the remainder. % \def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}% % Allow an optional argument of an uppercase letter, lowercase letter, % or number, to specify the first label in the enumerated list. No % argument is the same as `1'. % \envparseargdef\enumerate{\enumeratey #1 \endenumeratey} \def\enumeratey #1 #2\endenumeratey{% % If we were given no argument, pretend we were given `1'. \def\thearg{#1}% \ifx\thearg\empty \def\thearg{1}\fi % % Detect if the argument is a single token. If so, it might be a % letter. Otherwise, the only valid thing it can be is a number. % (We will always have one token, because of the test we just made. % This is a good thing, since \splitoff doesn't work given nothing at % all -- the first parameter is undelimited.) \expandafter\splitoff\thearg\endmark \ifx\rest\empty % Only one token in the argument. It could still be anything. % A ``lowercase letter'' is one whose \lccode is nonzero. % An ``uppercase letter'' is one whose \lccode is both nonzero, and % not equal to itself. % Otherwise, we assume it's a number. % % We need the \relax at the end of the \ifnum lines to stop TeX from % continuing to look for a . % \ifnum\lccode\expandafter`\thearg=0\relax \numericenumerate % a number (we hope) \else % It's a letter. \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax \lowercaseenumerate % lowercase letter \else \uppercaseenumerate % uppercase letter \fi \fi \else % Multiple tokens in the argument. We hope it's a number. \numericenumerate \fi } % An @enumerate whose labels are integers. The starting integer is % given in \thearg. % \def\numericenumerate{% \itemno = \thearg \startenumeration{\the\itemno}% } % The starting (lowercase) letter is in \thearg. \def\lowercaseenumerate{% \itemno = \expandafter`\thearg \startenumeration{% % Be sure we're not beyond the end of the alphabet. \ifnum\itemno=0 \errmessage{No more lowercase letters in @enumerate; get a bigger alphabet}% \fi \char\lccode\itemno }% } % The starting (uppercase) letter is in \thearg. \def\uppercaseenumerate{% \itemno = \expandafter`\thearg \startenumeration{% % Be sure we're not beyond the end of the alphabet. \ifnum\itemno=0 \errmessage{No more uppercase letters in @enumerate; get a bigger alphabet} \fi \char\uccode\itemno }% } % Call \doitemize, adding a period to the first argument and supplying the % common last two arguments. Also subtract one from the initial value in % \itemno, since @item increments \itemno. % \def\startenumeration#1{% \advance\itemno by -1 \doitemize{#1.}\flushcr } % @alphaenumerate and @capsenumerate are abbreviations for giving an arg % to @enumerate. % \def\alphaenumerate{\enumerate{a}} \def\capsenumerate{\enumerate{A}} \def\Ealphaenumerate{\Eenumerate} \def\Ecapsenumerate{\Eenumerate} % @multitable macros % Amy Hendrickson, 8/18/94, 3/6/96 % % @multitable ... @end multitable will make as many columns as desired. % Contents of each column will wrap at width given in preamble. Width % can be specified either with sample text given in a template line, % or in percent of \hsize, the current width of text on page. % Table can continue over pages but will only break between lines. % To make preamble: % % Either define widths of columns in terms of percent of \hsize: % @multitable @columnfractions .25 .3 .45 % @item ... % % Numbers following @columnfractions are the percent of the total % current hsize to be used for each column. You may use as many % columns as desired. % Or use a template: % @multitable {Column 1 template} {Column 2 template} {Column 3 template} % @item ... % using the widest term desired in each column. % Each new table line starts with @item, each subsequent new column % starts with @tab. Empty columns may be produced by supplying @tab's % with nothing between them for as many times as empty columns are needed, % ie, @tab@tab@tab will produce two empty columns. % @item, @tab do not need to be on their own lines, but it will not hurt % if they are. % Sample multitable: % @multitable {Column 1 template} {Column 2 template} {Column 3 template} % @item first col stuff @tab second col stuff @tab third col % @item % first col stuff % @tab % second col stuff % @tab % third col % @item first col stuff @tab second col stuff % @tab Many paragraphs of text may be used in any column. % % They will wrap at the width determined by the template. % @item@tab@tab This will be in third column. % @end multitable % Default dimensions may be reset by user. % @multitableparskip is vertical space between paragraphs in table. % @multitableparindent is paragraph indent in table. % @multitablecolmargin is horizontal space to be left between columns. % @multitablelinespace is space to leave between table items, baseline % to baseline. % 0pt means it depends on current normal line spacing. % \newskip\multitableparskip \newskip\multitableparindent \newdimen\multitablecolspace \newskip\multitablelinespace \multitableparskip=0pt \multitableparindent=6pt \multitablecolspace=12pt \multitablelinespace=0pt % Macros used to set up halign preamble: % \let\endsetuptable\relax \def\xendsetuptable{\endsetuptable} \let\columnfractions\relax \def\xcolumnfractions{\columnfractions} \newif\ifsetpercent % #1 is the @columnfraction, usually a decimal number like .5, but might % be just 1. We just use it, whatever it is. % \def\pickupwholefraction#1 {% \global\advance\colcount by 1 \expandafter\xdef\csname col\the\colcount\endcsname{#1\hsize}% \setuptable } \newcount\colcount \def\setuptable#1{% \def\firstarg{#1}% \ifx\firstarg\xendsetuptable \let\go = \relax \else \ifx\firstarg\xcolumnfractions \global\setpercenttrue \else \ifsetpercent \let\go\pickupwholefraction \else \global\advance\colcount by 1 \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a % separator; typically that is always in the input, anyway. \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}% \fi \fi \ifx\go\pickupwholefraction % Put the argument back for the \pickupwholefraction call, so % we'll always have a period there to be parsed. \def\go{\pickupwholefraction#1}% \else \let\go = \setuptable \fi% \fi \go } % multitable-only commands. % % @headitem starts a heading row, which we typeset in bold. % Assignments have to be global since we are inside the implicit group % of an alignment entry. \everycr resets \everytab so we don't have to % undo it ourselves. \def\headitemfont{\b}% for people to use in the template row; not changeable \def\headitem{% \checkenv\multitable \crcr \global\everytab={\bf}% can't use \headitemfont since the parsing differs \the\everytab % for the first item }% % % A \tab used to include \hskip1sp. But then the space in a template % line is not enough. That is bad. So let's go back to just `&' until % we again encounter the problem the 1sp was intended to solve. % --karl, nathan@acm.org, 20apr99. \def\tab{\checkenv\multitable &\the\everytab}% % @multitable ... @end multitable definitions: % \newtoks\everytab % insert after every tab. % \envdef\multitable{% \vskip\parskip \startsavinginserts % % @item within a multitable starts a normal row. % We use \def instead of \let so that if one of the multitable entries % contains an @itemize, we don't choke on the \item (seen as \crcr aka % \endtemplate) expanding \doitemize. \def\item{\crcr}% % \tolerance=9500 \hbadness=9500 \setmultitablespacing \parskip=\multitableparskip \parindent=\multitableparindent \overfullrule=0pt \global\colcount=0 % \everycr = {% \noalign{% \global\everytab={}% \global\colcount=0 % Reset the column counter. % Check for saved footnotes, etc. \checkinserts % Keeps underfull box messages off when table breaks over pages. %\filbreak % Maybe so, but it also creates really weird page breaks when the % table breaks over pages. Wouldn't \vfil be better? Wait until the % problem manifests itself, so it can be fixed for real --karl. }% }% % \parsearg\domultitable } \def\domultitable#1{% % To parse everything between @multitable and @item: \setuptable#1 \endsetuptable % % This preamble sets up a generic column definition, which will % be used as many times as user calls for columns. % \vtop will set a single line and will also let text wrap and % continue for many paragraphs if desired. \halign\bgroup &% \global\advance\colcount by 1 \multistrut \vtop{% % Use the current \colcount to find the correct column width: \hsize=\expandafter\csname col\the\colcount\endcsname % % In order to keep entries from bumping into each other % we will add a \leftskip of \multitablecolspace to all columns after % the first one. % % If a template has been used, we will add \multitablecolspace % to the width of each template entry. % % If the user has set preamble in terms of percent of \hsize we will % use that dimension as the width of the column, and the \leftskip % will keep entries from bumping into each other. Table will start at % left margin and final column will justify at right margin. % % Make sure we don't inherit \rightskip from the outer environment. \rightskip=0pt \ifnum\colcount=1 % The first column will be indented with the surrounding text. \advance\hsize by\leftskip \else \ifsetpercent \else % If user has not set preamble in terms of percent of \hsize % we will advance \hsize by \multitablecolspace. \advance\hsize by \multitablecolspace \fi % In either case we will make \leftskip=\multitablecolspace: \leftskip=\multitablecolspace \fi % Ignoring space at the beginning and end avoids an occasional spurious % blank line, when TeX decides to break the line at the space before the % box from the multistrut, so the strut ends up on a line by itself. % For example: % @multitable @columnfractions .11 .89 % @item @code{#} % @tab Legal holiday which is valid in major parts of the whole country. % Is automatically provided with highlighting sequences respectively % marking characters. \noindent\ignorespaces##\unskip\multistrut }\cr } \def\Emultitable{% \crcr \egroup % end the \halign \global\setpercentfalse } \def\setmultitablespacing{% \def\multistrut{\strut}% just use the standard line spacing % % Compute \multitablelinespace (if not defined by user) for use in % \multitableparskip calculation. We used define \multistrut based on % this, but (ironically) that caused the spacing to be off. % See bug-texinfo report from Werner Lemberg, 31 Oct 2004 12:52:20 +0100. \ifdim\multitablelinespace=0pt \setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip \global\advance\multitablelinespace by-\ht0 \fi % Test to see if parskip is larger than space between lines of % table. If not, do nothing. % If so, set to same dimension as multitablelinespace. \ifdim\multitableparskip>\multitablelinespace \global\multitableparskip=\multitablelinespace \global\advance\multitableparskip-7pt % to keep parskip somewhat smaller % than skip between lines in the table. \fi% \ifdim\multitableparskip=0pt \global\multitableparskip=\multitablelinespace \global\advance\multitableparskip-7pt % to keep parskip somewhat smaller % than skip between lines in the table. \fi} \message{conditionals,} % @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotplaintext, % @ifnotxml always succeed. They currently do nothing; we don't % attempt to check whether the conditionals are properly nested. But we % have to remember that they are conditionals, so that @end doesn't % attempt to close an environment group. % \def\makecond#1{% \expandafter\let\csname #1\endcsname = \relax \expandafter\let\csname iscond.#1\endcsname = 1 } \makecond{iftex} \makecond{ifnotdocbook} \makecond{ifnothtml} \makecond{ifnotinfo} \makecond{ifnotplaintext} \makecond{ifnotxml} % Ignore @ignore, @ifhtml, @ifinfo, and the like. % \def\direntry{\doignore{direntry}} \def\documentdescription{\doignore{documentdescription}} \def\docbook{\doignore{docbook}} \def\html{\doignore{html}} \def\ifdocbook{\doignore{ifdocbook}} \def\ifhtml{\doignore{ifhtml}} \def\ifinfo{\doignore{ifinfo}} \def\ifnottex{\doignore{ifnottex}} \def\ifplaintext{\doignore{ifplaintext}} \def\ifxml{\doignore{ifxml}} \def\ignore{\doignore{ignore}} \def\menu{\doignore{menu}} \def\xml{\doignore{xml}} % Ignore text until a line `@end #1', keeping track of nested conditionals. % % A count to remember the depth of nesting. \newcount\doignorecount \def\doignore#1{\begingroup % Scan in ``verbatim'' mode: \obeylines \catcode`\@ = \other \catcode`\{ = \other \catcode`\} = \other % % Make sure that spaces turn into tokens that match what \doignoretext wants. \spaceisspace % % Count number of #1's that we've seen. \doignorecount = 0 % % Swallow text until we reach the matching `@end #1'. \dodoignore{#1}% } { \catcode`_=11 % We want to use \_STOP_ which cannot appear in texinfo source. \obeylines % % \gdef\dodoignore#1{% % #1 contains the command name as a string, e.g., `ifinfo'. % % Define a command to find the next `@end #1'. \long\def\doignoretext##1^^M@end #1{% \doignoretextyyy##1^^M@#1\_STOP_}% % % And this command to find another #1 command, at the beginning of a % line. (Otherwise, we would consider a line `@c @ifset', for % example, to count as an @ifset for nesting.) \long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}% % % And now expand that command. \doignoretext ^^M% }% } \def\doignoreyyy#1{% \def\temp{#1}% \ifx\temp\empty % Nothing found. \let\next\doignoretextzzz \else % Found a nested condition, ... \advance\doignorecount by 1 \let\next\doignoretextyyy % ..., look for another. % If we're here, #1 ends with ^^M\ifinfo (for example). \fi \next #1% the token \_STOP_ is present just after this macro. } % We have to swallow the remaining "\_STOP_". % \def\doignoretextzzz#1{% \ifnum\doignorecount = 0 % We have just found the outermost @end. \let\next\enddoignore \else % Still inside a nested condition. \advance\doignorecount by -1 \let\next\doignoretext % Look for the next @end. \fi \next } % Finish off ignored text. { \obeylines% % Ignore anything after the last `@end #1'; this matters in verbatim % environments, where otherwise the newline after an ignored conditional % would result in a blank line in the output. \gdef\enddoignore#1^^M{\endgroup\ignorespaces}% } % @set VAR sets the variable VAR to an empty value. % @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE. % % Since we want to separate VAR from REST-OF-LINE (which might be % empty), we can't just use \parsearg; we have to insert a space of our % own to delimit the rest of the line, and then take it out again if we % didn't need it. % We rely on the fact that \parsearg sets \catcode`\ =10. % \parseargdef\set{\setyyy#1 \endsetyyy} \def\setyyy#1 #2\endsetyyy{% {% \makevalueexpandable \def\temp{#2}% \edef\next{\gdef\makecsname{SET#1}}% \ifx\temp\empty \next{}% \else \setzzz#2\endsetzzz \fi }% } % Remove the trailing space \setxxx inserted. \def\setzzz#1 \endsetzzz{\next{#1}} % @clear VAR clears (i.e., unsets) the variable VAR. % \parseargdef\clear{% {% \makevalueexpandable \global\expandafter\let\csname SET#1\endcsname=\relax }% } % @value{foo} gets the text saved in variable foo. \def\value{\begingroup\makevalueexpandable\valuexxx} \def\valuexxx#1{\expandablevalue{#1}\endgroup} { \catcode`\- = \active \catcode`\_ = \active % \gdef\makevalueexpandable{% \let\value = \expandablevalue % We don't want these characters active, ... \catcode`\-=\other \catcode`\_=\other % ..., but we might end up with active ones in the argument if % we're called from @code, as @code{@value{foo-bar_}}, though. % So \let them to their normal equivalents. \let-\normaldash \let_\normalunderscore } } % We have this subroutine so that we can handle at least some @value's % properly in indexes (we call \makevalueexpandable in \indexdummies). % The command has to be fully expandable (if the variable is set), since % the result winds up in the index file. This means that if the % variable's value contains other Texinfo commands, it's almost certain % it will fail (although perhaps we could fix that with sufficient work % to do a one-level expansion on the result, instead of complete). % \def\expandablevalue#1{% \expandafter\ifx\csname SET#1\endcsname\relax {[No value for ``#1'']}% \message{Variable `#1', used in @value, is not set.}% \else \csname SET#1\endcsname \fi } % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined % with @set. % % To get the special treatment we need for `@end ifset,' we call % \makecond and then redefine. % \makecond{ifset} \def\ifset{\parsearg{\doifset{\let\next=\ifsetfail}}} \def\doifset#1#2{% {% \makevalueexpandable \let\next=\empty \expandafter\ifx\csname SET#2\endcsname\relax #1% If not set, redefine \next. \fi \expandafter }\next } \def\ifsetfail{\doignore{ifset}} % @ifclear VAR ... @end executes the `...' iff VAR has never been % defined with @set, or has been undefined with @clear. % % The `\else' inside the `\doifset' parameter is a trick to reuse the % above code: if the variable is not set, do nothing, if it is set, % then redefine \next to \ifclearfail. % \makecond{ifclear} \def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}} \def\ifclearfail{\doignore{ifclear}} % @ifcommandisdefined CMD ... @end executes the `...' if CMD (written % without the @) is in fact defined. We can only feasibly check at the % TeX level, so something like `mathcode' is going to considered % defined even though it is not a Texinfo command. % \makecond{ifcommanddefined} \def\ifcommanddefined{\parsearg{\doifcmddefined{\let\next=\ifcmddefinedfail}}} % \def\doifcmddefined#1#2{{% \makevalueexpandable \let\next=\empty \expandafter\ifx\csname #2\endcsname\relax #1% If not defined, \let\next as above. \fi \expandafter }\next } \def\ifcmddefinedfail{\doignore{ifcommanddefined}} % @ifcommandnotdefined CMD ... handled similar to @ifclear above. \makecond{ifcommandnotdefined} \def\ifcommandnotdefined{% \parsearg{\doifcmddefined{\else \let\next=\ifcmdnotdefinedfail}}} \def\ifcmdnotdefinedfail{\doignore{ifcommandnotdefined}} % Set the `txicommandconditionals' variable, so documents have a way to % test if the @ifcommand...defined conditionals are available. \set txicommandconditionals % @dircategory CATEGORY -- specify a category of the dir file % which this file should belong to. Ignore this in TeX. \let\dircategory=\comment % @defininfoenclose. \let\definfoenclose=\comment \message{indexing,} % Index generation facilities % Define \newwrite to be identical to plain tex's \newwrite % except not \outer, so it can be used within macros and \if's. \edef\newwrite{\makecsname{ptexnewwrite}} % \newindex {foo} defines an index named foo. % It automatically defines \fooindex such that % \fooindex ...rest of line... puts an entry in the index foo. % It also defines \fooindfile to be the number of the output channel for % the file that accumulates this index. The file's extension is foo. % The name of an index should be no more than 2 characters long % for the sake of vms. % \def\newindex#1{% \iflinks \expandafter\newwrite \csname#1indfile\endcsname \openout \csname#1indfile\endcsname \jobname.#1 % Open the file \fi \expandafter\xdef\csname#1index\endcsname{% % Define @#1index \noexpand\doindex{#1}} } % @defindex foo == \newindex{foo} % \def\defindex{\parsearg\newindex} % Define @defcodeindex, like @defindex except put all entries in @code. % \def\defcodeindex{\parsearg\newcodeindex} % \def\newcodeindex#1{% \iflinks \expandafter\newwrite \csname#1indfile\endcsname \openout \csname#1indfile\endcsname \jobname.#1 \fi \expandafter\xdef\csname#1index\endcsname{% \noexpand\docodeindex{#1}}% } % @synindex foo bar makes index foo feed into index bar. % Do this instead of @defindex foo if you don't want it as a separate index. % % @syncodeindex foo bar similar, but put all entries made for index foo % inside @code. % \def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}} \def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}} % #1 is \doindex or \docodeindex, #2 the index getting redefined (foo), % #3 the target index (bar). \def\dosynindex#1#2#3{% % Only do \closeout if we haven't already done it, else we'll end up % closing the target index. \expandafter \ifx\csname donesynindex#2\endcsname \relax % The \closeout helps reduce unnecessary open files; the limit on the % Acorn RISC OS is a mere 16 files. \expandafter\closeout\csname#2indfile\endcsname \expandafter\let\csname donesynindex#2\endcsname = 1 \fi % redefine \fooindfile: \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname \expandafter\let\csname#2indfile\endcsname=\temp % redefine \fooindex: \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}% } % Define \doindex, the driver for all \fooindex macros. % Argument #1 is generated by the calling \fooindex macro, % and it is "foo", the name of the index. % \doindex just uses \parsearg; it calls \doind for the actual work. % This is because \doind is more useful to call from other macros. % There is also \dosubind {index}{topic}{subtopic} % which makes an entry in a two-level index such as the operation index. \def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer} \def\singleindexer #1{\doind{\indexname}{#1}} % like the previous two, but they put @code around the argument. \def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer} \def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}} % Take care of Texinfo commands that can appear in an index entry. % Since there are some commands we want to expand, and others we don't, % we have to laboriously prevent expansion for those that we don't. % \def\indexdummies{% \escapechar = `\\ % use backslash in output files. \def\@{@}% change to @@ when we switch to @ as escape char in index files. \def\ {\realbackslash\space }% % % Need these unexpandable (because we define \tt as a dummy) % definitions when @{ or @} appear in index entry text. Also, more % complicated, when \tex is in effect and \{ is a \delimiter again. % We can't use \lbracecmd and \rbracecmd because texindex assumes % braces and backslashes are used only as delimiters. Perhaps we % should define @lbrace and @rbrace commands a la @comma. \def\{{{\tt\char123}}% \def\}{{\tt\char125}}% % % I don't entirely understand this, but when an index entry is % generated from a macro call, the \endinput which \scanmacro inserts % causes processing to be prematurely terminated. This is, % apparently, because \indexsorttmp is fully expanded, and \endinput % is an expandable command. The redefinition below makes \endinput % disappear altogether for that purpose -- although logging shows that % processing continues to some further point. On the other hand, it % seems \endinput does not hurt in the printed index arg, since that % is still getting written without apparent harm. % % Sample source (mac-idx3.tex, reported by Graham Percival to % help-texinfo, 22may06): % @macro funindex {WORD} % @findex xyz % @end macro % ... % @funindex commtest % % The above is not enough to reproduce the bug, but it gives the flavor. % % Sample whatsit resulting: % .@write3{\entry{xyz}{@folio }{@code {xyz@endinput }}} % % So: \let\endinput = \empty % % Do the redefinitions. \commondummies } % For the aux and toc files, @ is the escape character. So we want to % redefine everything using @ as the escape character (instead of % \realbackslash, still used for index files). When everything uses @, % this will be simpler. % \def\atdummies{% \def\@{@@}% \def\ {@ }% \let\{ = \lbraceatcmd \let\} = \rbraceatcmd % % Do the redefinitions. \commondummies \otherbackslash } % Called from \indexdummies and \atdummies. % \def\commondummies{% % % \definedummyword defines \#1 as \string\#1\space, thus effectively % preventing its expansion. This is used only for control words, % not control letters, because the \space would be incorrect for % control characters, but is needed to separate the control word % from whatever follows. % % For control letters, we have \definedummyletter, which omits the % space. % % These can be used both for control words that take an argument and % those that do not. If it is followed by {arg} in the input, then % that will dutifully get written to the index (or wherever). % \def\definedummyword ##1{\def##1{\string##1\space}}% \def\definedummyletter##1{\def##1{\string##1}}% \let\definedummyaccent\definedummyletter % \commondummiesnofonts % \definedummyletter\_% \definedummyletter\-% % % Non-English letters. \definedummyword\AA \definedummyword\AE \definedummyword\DH \definedummyword\L \definedummyword\O \definedummyword\OE \definedummyword\TH \definedummyword\aa \definedummyword\ae \definedummyword\dh \definedummyword\exclamdown \definedummyword\l \definedummyword\o \definedummyword\oe \definedummyword\ordf \definedummyword\ordm \definedummyword\questiondown \definedummyword\ss \definedummyword\th % % Although these internal commands shouldn't show up, sometimes they do. \definedummyword\bf \definedummyword\gtr \definedummyword\hat \definedummyword\less \definedummyword\sf \definedummyword\sl \definedummyword\tclose \definedummyword\tt % \definedummyword\LaTeX \definedummyword\TeX % % Assorted special characters. \definedummyword\arrow \definedummyword\bullet \definedummyword\comma \definedummyword\copyright \definedummyword\registeredsymbol \definedummyword\dots \definedummyword\enddots \definedummyword\entrybreak \definedummyword\equiv \definedummyword\error \definedummyword\euro \definedummyword\expansion \definedummyword\geq \definedummyword\guillemetleft \definedummyword\guillemetright \definedummyword\guilsinglleft \definedummyword\guilsinglright \definedummyword\lbracechar \definedummyword\leq \definedummyword\minus \definedummyword\ogonek \definedummyword\pounds \definedummyword\point \definedummyword\print \definedummyword\quotedblbase \definedummyword\quotedblleft \definedummyword\quotedblright \definedummyword\quoteleft \definedummyword\quoteright \definedummyword\quotesinglbase \definedummyword\rbracechar \definedummyword\result \definedummyword\textdegree % % We want to disable all macros so that they are not expanded by \write. \macrolist % \normalturnoffactive % % Handle some cases of @value -- where it does not contain any % (non-fully-expandable) commands. \makevalueexpandable } % \commondummiesnofonts: common to \commondummies and \indexnofonts. % \def\commondummiesnofonts{% % Control letters and accents. \definedummyletter\!% \definedummyaccent\"% \definedummyaccent\'% \definedummyletter\*% \definedummyaccent\,% \definedummyletter\.% \definedummyletter\/% \definedummyletter\:% \definedummyaccent\=% \definedummyletter\?% \definedummyaccent\^% \definedummyaccent\`% \definedummyaccent\~% \definedummyword\u \definedummyword\v \definedummyword\H \definedummyword\dotaccent \definedummyword\ogonek \definedummyword\ringaccent \definedummyword\tieaccent \definedummyword\ubaraccent \definedummyword\udotaccent \definedummyword\dotless % % Texinfo font commands. \definedummyword\b \definedummyword\i \definedummyword\r \definedummyword\sansserif \definedummyword\sc \definedummyword\slanted \definedummyword\t % % Commands that take arguments. \definedummyword\abbr \definedummyword\acronym \definedummyword\anchor \definedummyword\cite \definedummyword\code \definedummyword\command \definedummyword\dfn \definedummyword\dmn \definedummyword\email \definedummyword\emph \definedummyword\env \definedummyword\file \definedummyword\image \definedummyword\indicateurl \definedummyword\inforef \definedummyword\kbd \definedummyword\key \definedummyword\math \definedummyword\option \definedummyword\pxref \definedummyword\ref \definedummyword\samp \definedummyword\strong \definedummyword\tie \definedummyword\uref \definedummyword\url \definedummyword\var \definedummyword\verb \definedummyword\w \definedummyword\xref } % \indexnofonts is used when outputting the strings to sort the index % by, and when constructing control sequence names. It eliminates all % control sequences and just writes whatever the best ASCII sort string % would be for a given command (usually its argument). % \def\indexnofonts{% % Accent commands should become @asis. \def\definedummyaccent##1{\let##1\asis}% % We can just ignore other control letters. \def\definedummyletter##1{\let##1\empty}% % All control words become @asis by default; overrides below. \let\definedummyword\definedummyaccent % \commondummiesnofonts % % Don't no-op \tt, since it isn't a user-level command % and is used in the definitions of the active chars like <, >, |, etc. % Likewise with the other plain tex font commands. %\let\tt=\asis % \def\ { }% \def\@{@}% \def\_{\normalunderscore}% \def\-{}% @- shouldn't affect sorting % % Unfortunately, texindex is not prepared to handle braces in the % content at all. So for index sorting, we map @{ and @} to strings % starting with |, since that ASCII character is between ASCII { and }. \def\{{|a}% \def\lbracechar{|a}% % \def\}{|b}% \def\rbracechar{|b}% % % Non-English letters. \def\AA{AA}% \def\AE{AE}% \def\DH{DZZ}% \def\L{L}% \def\OE{OE}% \def\O{O}% \def\TH{ZZZ}% \def\aa{aa}% \def\ae{ae}% \def\dh{dzz}% \def\exclamdown{!}% \def\l{l}% \def\oe{oe}% \def\ordf{a}% \def\ordm{o}% \def\o{o}% \def\questiondown{?}% \def\ss{ss}% \def\th{zzz}% % \def\LaTeX{LaTeX}% \def\TeX{TeX}% % % Assorted special characters. % (The following {} will end up in the sort string, but that's ok.) \def\arrow{->}% \def\bullet{bullet}% \def\comma{,}% \def\copyright{copyright}% \def\dots{...}% \def\enddots{...}% \def\equiv{==}% \def\error{error}% \def\euro{euro}% \def\expansion{==>}% \def\geq{>=}% \def\guillemetleft{<<}% \def\guillemetright{>>}% \def\guilsinglleft{<}% \def\guilsinglright{>}% \def\leq{<=}% \def\minus{-}% \def\point{.}% \def\pounds{pounds}% \def\print{-|}% \def\quotedblbase{"}% \def\quotedblleft{"}% \def\quotedblright{"}% \def\quoteleft{`}% \def\quoteright{'}% \def\quotesinglbase{,}% \def\registeredsymbol{R}% \def\result{=>}% \def\textdegree{o}% % \expandafter\ifx\csname SETtxiindexlquoteignore\endcsname\relax \else \indexlquoteignore \fi % % We need to get rid of all macros, leaving only the arguments (if present). % Of course this is not nearly correct, but it is the best we can do for now. % makeinfo does not expand macros in the argument to @deffn, which ends up % writing an index entry, and texindex isn't prepared for an index sort entry % that starts with \. % % Since macro invocations are followed by braces, we can just redefine them % to take a single TeX argument. The case of a macro invocation that % goes to end-of-line is not handled. % \macrolist } % Undocumented (for FSFS 2nd ed.): @set txiindexlquoteignore makes us % ignore left quotes in the sort term. {\catcode`\`=\active \gdef\indexlquoteignore{\let`=\empty}} \let\indexbackslash=0 %overridden during \printindex. \let\SETmarginindex=\relax % put index entries in margin (undocumented)? % Most index entries go through here, but \dosubind is the general case. % #1 is the index name, #2 is the entry text. \def\doind#1#2{\dosubind{#1}{#2}{}} % Workhorse for all \fooindexes. % #1 is name of index, #2 is stuff to put there, #3 is subentry -- % empty if called from \doind, as we usually are (the main exception % is with most defuns, which call us directly). % \def\dosubind#1#2#3{% \iflinks {% % Store the main index entry text (including the third arg). \toks0 = {#2}% % If third arg is present, precede it with a space. \def\thirdarg{#3}% \ifx\thirdarg\empty \else \toks0 = \expandafter{\the\toks0 \space #3}% \fi % \edef\writeto{\csname#1indfile\endcsname}% % \safewhatsit\dosubindwrite }% \fi } % Write the entry in \toks0 to the index file: % \def\dosubindwrite{% % Put the index entry in the margin if desired. \ifx\SETmarginindex\relax\else \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \the\toks0}}% \fi % % Remember, we are within a group. \indexdummies % Must do this here, since \bf, etc expand at this stage \def\backslashcurfont{\indexbackslash}% \indexbackslash isn't defined now % so it will be output as is; and it will print as backslash. % % Process the index entry with all font commands turned off, to % get the string to sort by. {\indexnofonts \edef\temp{\the\toks0}% need full expansion \xdef\indexsorttmp{\temp}% }% % % Set up the complete index entry, with both the sort key and % the original text, including any font commands. We write % three arguments to \entry to the .?? file (four in the % subentry case), texindex reduces to two when writing the .??s % sorted result. \edef\temp{% \write\writeto{% \string\entry{\indexsorttmp}{\noexpand\folio}{\the\toks0}}% }% \temp } % Take care of unwanted page breaks/skips around a whatsit: % % If a skip is the last thing on the list now, preserve it % by backing up by \lastskip, doing the \write, then inserting % the skip again. Otherwise, the whatsit generated by the % \write or \pdfdest will make \lastskip zero. The result is that % sequences like this: % @end defun % @tindex whatever % @defun ... % will have extra space inserted, because the \medbreak in the % start of the @defun won't see the skip inserted by the @end of % the previous defun. % % But don't do any of this if we're not in vertical mode. We % don't want to do a \vskip and prematurely end a paragraph. % % Avoid page breaks due to these extra skips, too. % % But wait, there is a catch there: % We'll have to check whether \lastskip is zero skip. \ifdim is not % sufficient for this purpose, as it ignores stretch and shrink parts % of the skip. The only way seems to be to check the textual % representation of the skip. % % The following is almost like \def\zeroskipmacro{0.0pt} except that % the ``p'' and ``t'' characters have catcode \other, not 11 (letter). % \edef\zeroskipmacro{\expandafter\the\csname z@skip\endcsname} % \newskip\whatsitskip \newcount\whatsitpenalty % % ..., ready, GO: % \def\safewhatsit#1{\ifhmode #1% \else % \lastskip and \lastpenalty cannot both be nonzero simultaneously. \whatsitskip = \lastskip \edef\lastskipmacro{\the\lastskip}% \whatsitpenalty = \lastpenalty % % If \lastskip is nonzero, that means the last item was a % skip. And since a skip is discardable, that means this % -\whatsitskip glue we're inserting is preceded by a % non-discardable item, therefore it is not a potential % breakpoint, therefore no \nobreak needed. \ifx\lastskipmacro\zeroskipmacro \else \vskip-\whatsitskip \fi % #1% % \ifx\lastskipmacro\zeroskipmacro % If \lastskip was zero, perhaps the last item was a penalty, and % perhaps it was >=10000, e.g., a \nobreak. In that case, we want % to re-insert the same penalty (values >10000 are used for various % signals); since we just inserted a non-discardable item, any % following glue (such as a \parskip) would be a breakpoint. For example: % @deffn deffn-whatever % @vindex index-whatever % Description. % would allow a break between the index-whatever whatsit % and the "Description." paragraph. \ifnum\whatsitpenalty>9999 \penalty\whatsitpenalty \fi \else % On the other hand, if we had a nonzero \lastskip, % this make-up glue would be preceded by a non-discardable item % (the whatsit from the \write), so we must insert a \nobreak. \nobreak\vskip\whatsitskip \fi \fi} % The index entry written in the file actually looks like % \entry {sortstring}{page}{topic} % or % \entry {sortstring}{page}{topic}{subtopic} % The texindex program reads in these files and writes files % containing these kinds of lines: % \initial {c} % before the first topic whose initial is c % \entry {topic}{pagelist} % for a topic that is used without subtopics % \primary {topic} % for the beginning of a topic that is used with subtopics % \secondary {subtopic}{pagelist} % for each subtopic. % Define the user-accessible indexing commands % @findex, @vindex, @kindex, @cindex. \def\findex {\fnindex} \def\kindex {\kyindex} \def\cindex {\cpindex} \def\vindex {\vrindex} \def\tindex {\tpindex} \def\pindex {\pgindex} \def\cindexsub {\begingroup\obeylines\cindexsub} {\obeylines % \gdef\cindexsub "#1" #2^^M{\endgroup % \dosubind{cp}{#2}{#1}}} % Define the macros used in formatting output of the sorted index material. % @printindex causes a particular index (the ??s file) to get printed. % It does not print any chapter heading (usually an @unnumbered). % \parseargdef\printindex{\begingroup \dobreak \chapheadingskip{10000}% % \smallfonts \rm \tolerance = 9500 \plainfrenchspacing \everypar = {}% don't want the \kern\-parindent from indentation suppression. % % See if the index file exists and is nonempty. % Change catcode of @ here so that if the index file contains % \initial {@} % as its first line, TeX doesn't complain about mismatched braces % (because it thinks @} is a control sequence). \catcode`\@ = 11 \openin 1 \jobname.#1s \ifeof 1 % \enddoublecolumns gets confused if there is no text in the index, % and it loses the chapter title and the aux file entries for the % index. The easiest way to prevent this problem is to make sure % there is some text. \putwordIndexNonexistent \else % % If the index file exists but is empty, then \openin leaves \ifeof % false. We have to make TeX try to read something from the file, so % it can discover if there is anything in it. \read 1 to \temp \ifeof 1 \putwordIndexIsEmpty \else % Index files are almost Texinfo source, but we use \ as the escape % character. It would be better to use @, but that's too big a change % to make right now. \def\indexbackslash{\backslashcurfont}% \catcode`\\ = 0 \escapechar = `\\ \begindoublecolumns \input \jobname.#1s \enddoublecolumns \fi \fi \closein 1 \endgroup} % These macros are used by the sorted index file itself. % Change them to control the appearance of the index. \def\initial#1{{% % Some minor font changes for the special characters. \let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt % % Remove any glue we may have, we'll be inserting our own. \removelastskip % % We like breaks before the index initials, so insert a bonus. \nobreak \vskip 0pt plus 3\baselineskip \penalty 0 \vskip 0pt plus -3\baselineskip % % Typeset the initial. Making this add up to a whole number of % baselineskips increases the chance of the dots lining up from column % to column. It still won't often be perfect, because of the stretch % we need before each entry, but it's better. % % No shrink because it confuses \balancecolumns. \vskip 1.67\baselineskip plus .5\baselineskip \leftline{\secbf #1}% % Do our best not to break after the initial. \nobreak \vskip .33\baselineskip plus .1\baselineskip }} % \entry typesets a paragraph consisting of the text (#1), dot leaders, and % then page number (#2) flushed to the right margin. It is used for index % and table of contents entries. The paragraph is indented by \leftskip. % % A straightforward implementation would start like this: % \def\entry#1#2{... % But this freezes the catcodes in the argument, and can cause problems to % @code, which sets - active. This problem was fixed by a kludge--- % ``-'' was active throughout whole index, but this isn't really right. % The right solution is to prevent \entry from swallowing the whole text. % --kasal, 21nov03 \def\entry{% \begingroup % % Start a new paragraph if necessary, so our assignments below can't % affect previous text. \par % % Do not fill out the last line with white space. \parfillskip = 0in % % No extra space above this paragraph. \parskip = 0in % % Do not prefer a separate line ending with a hyphen to fewer lines. \finalhyphendemerits = 0 % % \hangindent is only relevant when the entry text and page number % don't both fit on one line. In that case, bob suggests starting the % dots pretty far over on the line. Unfortunately, a large % indentation looks wrong when the entry text itself is broken across % lines. So we use a small indentation and put up with long leaders. % % \hangafter is reset to 1 (which is the value we want) at the start % of each paragraph, so we need not do anything with that. \hangindent = 2em % % When the entry text needs to be broken, just fill out the first line % with blank space. \rightskip = 0pt plus1fil % % A bit of stretch before each entry for the benefit of balancing % columns. \vskip 0pt plus1pt % % When reading the text of entry, convert explicit line breaks % from @* into spaces. The user might give these in long section % titles, for instance. \def\*{\unskip\space\ignorespaces}% \def\entrybreak{\hfil\break}% % % Swallow the left brace of the text (first parameter): \afterassignment\doentry \let\temp = } \def\entrybreak{\unskip\space\ignorespaces}% \def\doentry{% \bgroup % Instead of the swallowed brace. \noindent \aftergroup\finishentry % And now comes the text of the entry. } \def\finishentry#1{% % #1 is the page number. % % The following is kludged to not output a line of dots in the index if % there are no page numbers. The next person who breaks this will be % cursed by a Unix daemon. \setbox\boxA = \hbox{#1}% \ifdim\wd\boxA = 0pt \ % \else % % If we must, put the page number on a line of its own, and fill out % this line with blank space. (The \hfil is overwhelmed with the % fill leaders glue in \indexdotfill if the page number does fit.) \hfil\penalty50 \null\nobreak\indexdotfill % Have leaders before the page number. % % The `\ ' here is removed by the implicit \unskip that TeX does as % part of (the primitive) \par. Without it, a spurious underfull % \hbox ensues. \ifpdf \pdfgettoks#1.% \ \the\toksA \else \ #1% \fi \fi \par \endgroup } % Like plain.tex's \dotfill, except uses up at least 1 em. \def\indexdotfill{\cleaders \hbox{$\mathsurround=0pt \mkern1.5mu.\mkern1.5mu$}\hskip 1em plus 1fill} \def\primary #1{\line{#1\hfil}} \newskip\secondaryindent \secondaryindent=0.5cm \def\secondary#1#2{{% \parfillskip=0in \parskip=0in \hangindent=1in \hangafter=1 \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill \ifpdf \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph. \else #2 \fi \par }} % Define two-column mode, which we use to typeset indexes. % Adapted from the TeXbook, page 416, which is to say, % the manmac.tex format used to print the TeXbook itself. \catcode`\@=11 \newbox\partialpage \newdimen\doublecolumnhsize \def\begindoublecolumns{\begingroup % ended by \enddoublecolumns % Grab any single-column material above us. \output = {% % % Here is a possibility not foreseen in manmac: if we accumulate a % whole lot of material, we might end up calling this \output % routine twice in a row (see the doublecol-lose test, which is % essentially a couple of indexes with @setchapternewpage off). In % that case we just ship out what is in \partialpage with the normal % output routine. Generally, \partialpage will be empty when this % runs and this will be a no-op. See the indexspread.tex test case. \ifvoid\partialpage \else \onepageout{\pagecontents\partialpage}% \fi % \global\setbox\partialpage = \vbox{% % Unvbox the main output page. \unvbox\PAGE \kern-\topskip \kern\baselineskip }% }% \eject % run that output routine to set \partialpage % % Use the double-column output routine for subsequent pages. \output = {\doublecolumnout}% % % Change the page size parameters. We could do this once outside this % routine, in each of @smallbook, @afourpaper, and the default 8.5x11 % format, but then we repeat the same computation. Repeating a couple % of assignments once per index is clearly meaningless for the % execution time, so we may as well do it in one place. % % First we halve the line length, less a little for the gutter between % the columns. We compute the gutter based on the line length, so it % changes automatically with the paper format. The magic constant % below is chosen so that the gutter has the same value (well, +-<1pt) % as it did when we hard-coded it. % % We put the result in a separate register, \doublecolumhsize, so we % can restore it in \pagesofar, after \hsize itself has (potentially) % been clobbered. % \doublecolumnhsize = \hsize \advance\doublecolumnhsize by -.04154\hsize \divide\doublecolumnhsize by 2 \hsize = \doublecolumnhsize % % Double the \vsize as well. (We don't need a separate register here, % since nobody clobbers \vsize.) \vsize = 2\vsize } % The double-column output routine for all double-column pages except % the last. % \def\doublecolumnout{% \splittopskip=\topskip \splitmaxdepth=\maxdepth % Get the available space for the double columns -- the normal % (undoubled) page height minus any material left over from the % previous page. \dimen@ = \vsize \divide\dimen@ by 2 \advance\dimen@ by -\ht\partialpage % % box0 will be the left-hand column, box2 the right. \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@ \onepageout\pagesofar \unvbox255 \penalty\outputpenalty } % % Re-output the contents of the output page -- any previous material, % followed by the two boxes we just split, in box0 and box2. \def\pagesofar{% \unvbox\partialpage % \hsize = \doublecolumnhsize \wd0=\hsize \wd2=\hsize \hbox to\pagewidth{\box0\hfil\box2}% } % % All done with double columns. \def\enddoublecolumns{% % The following penalty ensures that the page builder is exercised % _before_ we change the output routine. This is necessary in the % following situation: % % The last section of the index consists only of a single entry. % Before this section, \pagetotal is less than \pagegoal, so no % break occurs before the last section starts. However, the last % section, consisting of \initial and the single \entry, does not % fit on the page and has to be broken off. Without the following % penalty the page builder will not be exercised until \eject % below, and by that time we'll already have changed the output % routine to the \balancecolumns version, so the next-to-last % double-column page will be processed with \balancecolumns, which % is wrong: The two columns will go to the main vertical list, with % the broken-off section in the recent contributions. As soon as % the output routine finishes, TeX starts reconsidering the page % break. The two columns and the broken-off section both fit on the % page, because the two columns now take up only half of the page % goal. When TeX sees \eject from below which follows the final % section, it invokes the new output routine that we've set after % \balancecolumns below; \onepageout will try to fit the two columns % and the final section into the vbox of \pageheight (see % \pagebody), causing an overfull box. % % Note that glue won't work here, because glue does not exercise the % page builder, unlike penalties (see The TeXbook, pp. 280-281). \penalty0 % \output = {% % Split the last of the double-column material. Leave it on the % current page, no automatic page break. \balancecolumns % % If we end up splitting too much material for the current page, % though, there will be another page break right after this \output % invocation ends. Having called \balancecolumns once, we do not % want to call it again. Therefore, reset \output to its normal % definition right away. (We hope \balancecolumns will never be % called on to balance too much material, but if it is, this makes % the output somewhat more palatable.) \global\output = {\onepageout{\pagecontents\PAGE}}% }% \eject \endgroup % started in \begindoublecolumns % % \pagegoal was set to the doubled \vsize above, since we restarted % the current page. We're now back to normal single-column % typesetting, so reset \pagegoal to the normal \vsize (after the % \endgroup where \vsize got restored). \pagegoal = \vsize } % % Called at the end of the double column material. \def\balancecolumns{% \setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120. \dimen@ = \ht0 \advance\dimen@ by \topskip \advance\dimen@ by-\baselineskip \divide\dimen@ by 2 % target to split to %debug\message{final 2-column material height=\the\ht0, target=\the\dimen@.}% \splittopskip = \topskip % Loop until we get a decent breakpoint. {% \vbadness = 10000 \loop \global\setbox3 = \copy0 \global\setbox1 = \vsplit3 to \dimen@ \ifdim\ht3>\dimen@ \global\advance\dimen@ by 1pt \repeat }% %debug\message{split to \the\dimen@, column heights: \the\ht1, \the\ht3.}% \setbox0=\vbox to\dimen@{\unvbox1}% \setbox2=\vbox to\dimen@{\unvbox3}% % \pagesofar } \catcode`\@ = \other \message{sectioning,} % Chapters, sections, etc. % Let's start with @part. \outer\parseargdef\part{\partzzz{#1}} \def\partzzz#1{% \chapoddpage \null \vskip.3\vsize % move it down on the page a bit \begingroup \noindent \titlefonts\rmisbold #1\par % the text \let\lastnode=\empty % no node to associate with \writetocentry{part}{#1}{}% but put it in the toc \headingsoff % no headline or footline on the part page \chapoddpage \endgroup } % \unnumberedno is an oxymoron. But we count the unnumbered % sections so that we can refer to them unambiguously in the pdf % outlines by their "section number". We avoid collisions with chapter % numbers by starting them at 10000. (If a document ever has 10000 % chapters, we're in trouble anyway, I'm sure.) \newcount\unnumberedno \unnumberedno = 10000 \newcount\chapno \newcount\secno \secno=0 \newcount\subsecno \subsecno=0 \newcount\subsubsecno \subsubsecno=0 % This counter is funny since it counts through charcodes of letters A, B, ... \newcount\appendixno \appendixno = `\@ % % \def\appendixletter{\char\the\appendixno} % We do the following ugly conditional instead of the above simple % construct for the sake of pdftex, which needs the actual % letter in the expansion, not just typeset. % \def\appendixletter{% \ifnum\appendixno=`A A% \else\ifnum\appendixno=`B B% \else\ifnum\appendixno=`C C% \else\ifnum\appendixno=`D D% \else\ifnum\appendixno=`E E% \else\ifnum\appendixno=`F F% \else\ifnum\appendixno=`G G% \else\ifnum\appendixno=`H H% \else\ifnum\appendixno=`I I% \else\ifnum\appendixno=`J J% \else\ifnum\appendixno=`K K% \else\ifnum\appendixno=`L L% \else\ifnum\appendixno=`M M% \else\ifnum\appendixno=`N N% \else\ifnum\appendixno=`O O% \else\ifnum\appendixno=`P P% \else\ifnum\appendixno=`Q Q% \else\ifnum\appendixno=`R R% \else\ifnum\appendixno=`S S% \else\ifnum\appendixno=`T T% \else\ifnum\appendixno=`U U% \else\ifnum\appendixno=`V V% \else\ifnum\appendixno=`W W% \else\ifnum\appendixno=`X X% \else\ifnum\appendixno=`Y Y% \else\ifnum\appendixno=`Z Z% % The \the is necessary, despite appearances, because \appendixletter is % expanded while writing the .toc file. \char\appendixno is not % expandable, thus it is written literally, thus all appendixes come out % with the same letter (or @) in the toc without it. \else\char\the\appendixno \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi} % Each @chapter defines these (using marks) as the number+name, number % and name of the chapter. Page headings and footings can use % these. @section does likewise. \def\thischapter{} \def\thischapternum{} \def\thischaptername{} \def\thissection{} \def\thissectionnum{} \def\thissectionname{} \newcount\absseclevel % used to calculate proper heading level \newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count % @raisesections: treat @section as chapter, @subsection as section, etc. \def\raisesections{\global\advance\secbase by -1} \let\up=\raisesections % original BFox name % @lowersections: treat @chapter as section, @section as subsection, etc. \def\lowersections{\global\advance\secbase by 1} \let\down=\lowersections % original BFox name % we only have subsub. \chardef\maxseclevel = 3 % % A numbered section within an unnumbered changes to unnumbered too. % To achieve this, remember the "biggest" unnum. sec. we are currently in: \chardef\unnlevel = \maxseclevel % % Trace whether the current chapter is an appendix or not: % \chapheadtype is "N" or "A", unnumbered chapters are ignored. \def\chapheadtype{N} % Choose a heading macro % #1 is heading type % #2 is heading level % #3 is text for heading \def\genhead#1#2#3{% % Compute the abs. sec. level: \absseclevel=#2 \advance\absseclevel by \secbase % Make sure \absseclevel doesn't fall outside the range: \ifnum \absseclevel < 0 \absseclevel = 0 \else \ifnum \absseclevel > 3 \absseclevel = 3 \fi \fi % The heading type: \def\headtype{#1}% \if \headtype U% \ifnum \absseclevel < \unnlevel \chardef\unnlevel = \absseclevel \fi \else % Check for appendix sections: \ifnum \absseclevel = 0 \edef\chapheadtype{\headtype}% \else \if \headtype A\if \chapheadtype N% \errmessage{@appendix... within a non-appendix chapter}% \fi\fi \fi % Check for numbered within unnumbered: \ifnum \absseclevel > \unnlevel \def\headtype{U}% \else \chardef\unnlevel = 3 \fi \fi % Now print the heading: \if \headtype U% \ifcase\absseclevel \unnumberedzzz{#3}% \or \unnumberedseczzz{#3}% \or \unnumberedsubseczzz{#3}% \or \unnumberedsubsubseczzz{#3}% \fi \else \if \headtype A% \ifcase\absseclevel \appendixzzz{#3}% \or \appendixsectionzzz{#3}% \or \appendixsubseczzz{#3}% \or \appendixsubsubseczzz{#3}% \fi \else \ifcase\absseclevel \chapterzzz{#3}% \or \seczzz{#3}% \or \numberedsubseczzz{#3}% \or \numberedsubsubseczzz{#3}% \fi \fi \fi \suppressfirstparagraphindent } % an interface: \def\numhead{\genhead N} \def\apphead{\genhead A} \def\unnmhead{\genhead U} % @chapter, @appendix, @unnumbered. Increment top-level counter, reset % all lower-level sectioning counters to zero. % % Also set \chaplevelprefix, which we prepend to @float sequence numbers % (e.g., figures), q.v. By default (before any chapter), that is empty. \let\chaplevelprefix = \empty % \outer\parseargdef\chapter{\numhead0{#1}} % normally numhead0 calls chapterzzz \def\chapterzzz#1{% % section resetting is \global in case the chapter is in a group, such % as an @include file. \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 \global\advance\chapno by 1 % % Used for \float. \gdef\chaplevelprefix{\the\chapno.}% \resetallfloatnos % % \putwordChapter can contain complex things in translations. \toks0=\expandafter{\putwordChapter}% \message{\the\toks0 \space \the\chapno}% % % Write the actual heading. \chapmacro{#1}{Ynumbered}{\the\chapno}% % % So @section and the like are numbered underneath this chapter. \global\let\section = \numberedsec \global\let\subsection = \numberedsubsec \global\let\subsubsection = \numberedsubsubsec } \outer\parseargdef\appendix{\apphead0{#1}} % normally calls appendixzzz % \def\appendixzzz#1{% \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 \global\advance\appendixno by 1 \gdef\chaplevelprefix{\appendixletter.}% \resetallfloatnos % % \putwordAppendix can contain complex things in translations. \toks0=\expandafter{\putwordAppendix}% \message{\the\toks0 \space \appendixletter}% % \chapmacro{#1}{Yappendix}{\appendixletter}% % \global\let\section = \appendixsec \global\let\subsection = \appendixsubsec \global\let\subsubsection = \appendixsubsubsec } % normally unnmhead0 calls unnumberedzzz: \outer\parseargdef\unnumbered{\unnmhead0{#1}} \def\unnumberedzzz#1{% \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 \global\advance\unnumberedno by 1 % % Since an unnumbered has no number, no prefix for figures. \global\let\chaplevelprefix = \empty \resetallfloatnos % % This used to be simply \message{#1}, but TeX fully expands the % argument to \message. Therefore, if #1 contained @-commands, TeX % expanded them. For example, in `@unnumbered The @cite{Book}', TeX % expanded @cite (which turns out to cause errors because \cite is meant % to be executed, not expanded). % % Anyway, we don't want the fully-expanded definition of @cite to appear % as a result of the \message, we just want `@cite' itself. We use % \the to achieve this: TeX expands \the only once, % simply yielding the contents of . (We also do this for % the toc entries.) \toks0 = {#1}% \message{(\the\toks0)}% % \chapmacro{#1}{Ynothing}{\the\unnumberedno}% % \global\let\section = \unnumberedsec \global\let\subsection = \unnumberedsubsec \global\let\subsubsection = \unnumberedsubsubsec } % @centerchap is like @unnumbered, but the heading is centered. \outer\parseargdef\centerchap{% % Well, we could do the following in a group, but that would break % an assumption that \chapmacro is called at the outermost level. % Thus we are safer this way: --kasal, 24feb04 \let\centerparametersmaybe = \centerparameters \unnmhead0{#1}% \let\centerparametersmaybe = \relax } % @top is like @unnumbered. \let\top\unnumbered % Sections. % \outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz \def\seczzz#1{% \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}% } % normally calls appendixsectionzzz: \outer\parseargdef\appendixsection{\apphead1{#1}} \def\appendixsectionzzz#1{% \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}% } \let\appendixsec\appendixsection % normally calls unnumberedseczzz: \outer\parseargdef\unnumberedsec{\unnmhead1{#1}} \def\unnumberedseczzz#1{% \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}% } % Subsections. % % normally calls numberedsubseczzz: \outer\parseargdef\numberedsubsec{\numhead2{#1}} \def\numberedsubseczzz#1{% \global\subsubsecno=0 \global\advance\subsecno by 1 \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}% } % normally calls appendixsubseczzz: \outer\parseargdef\appendixsubsec{\apphead2{#1}} \def\appendixsubseczzz#1{% \global\subsubsecno=0 \global\advance\subsecno by 1 \sectionheading{#1}{subsec}{Yappendix}% {\appendixletter.\the\secno.\the\subsecno}% } % normally calls unnumberedsubseczzz: \outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}} \def\unnumberedsubseczzz#1{% \global\subsubsecno=0 \global\advance\subsecno by 1 \sectionheading{#1}{subsec}{Ynothing}% {\the\unnumberedno.\the\secno.\the\subsecno}% } % Subsubsections. % % normally numberedsubsubseczzz: \outer\parseargdef\numberedsubsubsec{\numhead3{#1}} \def\numberedsubsubseczzz#1{% \global\advance\subsubsecno by 1 \sectionheading{#1}{subsubsec}{Ynumbered}% {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}% } % normally appendixsubsubseczzz: \outer\parseargdef\appendixsubsubsec{\apphead3{#1}} \def\appendixsubsubseczzz#1{% \global\advance\subsubsecno by 1 \sectionheading{#1}{subsubsec}{Yappendix}% {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}% } % normally unnumberedsubsubseczzz: \outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}} \def\unnumberedsubsubseczzz#1{% \global\advance\subsubsecno by 1 \sectionheading{#1}{subsubsec}{Ynothing}% {\the\unnumberedno.\the\secno.\the\subsecno.\the\subsubsecno}% } % These macros control what the section commands do, according % to what kind of chapter we are in (ordinary, appendix, or unnumbered). % Define them by default for a numbered chapter. \let\section = \numberedsec \let\subsection = \numberedsubsec \let\subsubsection = \numberedsubsubsec % Define @majorheading, @heading and @subheading \def\majorheading{% {\advance\chapheadingskip by 10pt \chapbreak }% \parsearg\chapheadingzzz } \def\chapheading{\chapbreak \parsearg\chapheadingzzz} \def\chapheadingzzz#1{% \vbox{\chapfonts \raggedtitlesettings #1\par}% \nobreak\bigskip \nobreak \suppressfirstparagraphindent } % @heading, @subheading, @subsubheading. \parseargdef\heading{\sectionheading{#1}{sec}{Yomitfromtoc}{} \suppressfirstparagraphindent} \parseargdef\subheading{\sectionheading{#1}{subsec}{Yomitfromtoc}{} \suppressfirstparagraphindent} \parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{} \suppressfirstparagraphindent} % These macros generate a chapter, section, etc. heading only % (including whitespace, linebreaking, etc. around it), % given all the information in convenient, parsed form. % Args are the skip and penalty (usually negative) \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi} % Parameter controlling skip before chapter headings (if needed) \newskip\chapheadingskip % Define plain chapter starts, and page on/off switching for it. \def\chapbreak{\dobreak \chapheadingskip {-4000}} \def\chappager{\par\vfill\supereject} % Because \domark is called before \chapoddpage, the filler page will % get the headings for the next chapter, which is wrong. But we don't % care -- we just disable all headings on the filler page. \def\chapoddpage{% \chappager \ifodd\pageno \else \begingroup \headingsoff \null \chappager \endgroup \fi } \def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname} \def\CHAPPAGoff{% \global\let\contentsalignmacro = \chappager \global\let\pchapsepmacro=\chapbreak \global\let\pagealignmacro=\chappager} \def\CHAPPAGon{% \global\let\contentsalignmacro = \chappager \global\let\pchapsepmacro=\chappager \global\let\pagealignmacro=\chappager \global\def\HEADINGSon{\HEADINGSsingle}} \def\CHAPPAGodd{% \global\let\contentsalignmacro = \chapoddpage \global\let\pchapsepmacro=\chapoddpage \global\let\pagealignmacro=\chapoddpage \global\def\HEADINGSon{\HEADINGSdouble}} \CHAPPAGon % Chapter opening. % % #1 is the text, #2 is the section type (Ynumbered, Ynothing, % Yappendix, Yomitfromtoc), #3 the chapter number. % % To test against our argument. \def\Ynothingkeyword{Ynothing} \def\Yomitfromtockeyword{Yomitfromtoc} \def\Yappendixkeyword{Yappendix} % \def\chapmacro#1#2#3{% % Insert the first mark before the heading break (see notes for \domark). \let\prevchapterdefs=\lastchapterdefs \let\prevsectiondefs=\lastsectiondefs \gdef\lastsectiondefs{\gdef\thissectionname{}\gdef\thissectionnum{}% \gdef\thissection{}}% % \def\temptype{#2}% \ifx\temptype\Ynothingkeyword \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}% \gdef\thischapter{\thischaptername}}% \else\ifx\temptype\Yomitfromtockeyword \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}% \gdef\thischapter{}}% \else\ifx\temptype\Yappendixkeyword \toks0={#1}% \xdef\lastchapterdefs{% \gdef\noexpand\thischaptername{\the\toks0}% \gdef\noexpand\thischapternum{\appendixletter}% % \noexpand\putwordAppendix avoids expanding indigestible % commands in some of the translations. \gdef\noexpand\thischapter{\noexpand\putwordAppendix{} \noexpand\thischapternum: \noexpand\thischaptername}% }% \else \toks0={#1}% \xdef\lastchapterdefs{% \gdef\noexpand\thischaptername{\the\toks0}% \gdef\noexpand\thischapternum{\the\chapno}% % \noexpand\putwordChapter avoids expanding indigestible % commands in some of the translations. \gdef\noexpand\thischapter{\noexpand\putwordChapter{} \noexpand\thischapternum: \noexpand\thischaptername}% }% \fi\fi\fi % % Output the mark. Pass it through \safewhatsit, to take care of % the preceding space. \safewhatsit\domark % % Insert the chapter heading break. \pchapsepmacro % % Now the second mark, after the heading break. No break points % between here and the heading. \let\prevchapterdefs=\lastchapterdefs \let\prevsectiondefs=\lastsectiondefs \domark % {% \chapfonts \rmisbold % % Have to define \lastsection before calling \donoderef, because the % xref code eventually uses it. On the other hand, it has to be called % after \pchapsepmacro, or the headline will change too soon. \gdef\lastsection{#1}% % % Only insert the separating space if we have a chapter/appendix % number, and don't print the unnumbered ``number''. \ifx\temptype\Ynothingkeyword \setbox0 = \hbox{}% \def\toctype{unnchap}% \else\ifx\temptype\Yomitfromtockeyword \setbox0 = \hbox{}% contents like unnumbered, but no toc entry \def\toctype{omit}% \else\ifx\temptype\Yappendixkeyword \setbox0 = \hbox{\putwordAppendix{} #3\enspace}% \def\toctype{app}% \else \setbox0 = \hbox{#3\enspace}% \def\toctype{numchap}% \fi\fi\fi % % Write the toc entry for this chapter. Must come before the % \donoderef, because we include the current node name in the toc % entry, and \donoderef resets it to empty. \writetocentry{\toctype}{#1}{#3}% % % For pdftex, we have to write out the node definition (aka, make % the pdfdest) after any page break, but before the actual text has % been typeset. If the destination for the pdf outline is after the % text, then jumping from the outline may wind up with the text not % being visible, for instance under high magnification. \donoderef{#2}% % % Typeset the actual heading. \nobreak % Avoid page breaks at the interline glue. \vbox{\raggedtitlesettings \hangindent=\wd0 \centerparametersmaybe \unhbox0 #1\par}% }% \nobreak\bigskip % no page break after a chapter title \nobreak } % @centerchap -- centered and unnumbered. \let\centerparametersmaybe = \relax \def\centerparameters{% \advance\rightskip by 3\rightskip \leftskip = \rightskip \parfillskip = 0pt } % I don't think this chapter style is supported any more, so I'm not % updating it with the new noderef stuff. We'll see. --karl, 11aug03. % \def\setchapterstyle #1 {\csname CHAPF#1\endcsname} % \def\unnchfopen #1{% \chapoddpage \vbox{\chapfonts \raggedtitlesettings #1\par}% \nobreak\bigskip\nobreak } \def\chfopen #1#2{\chapoddpage {\chapfonts \vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}% \par\penalty 5000 % } \def\centerchfopen #1{% \chapoddpage \vbox{\chapfonts \raggedtitlesettings \hfill #1\hfill}% \nobreak\bigskip \nobreak } \def\CHAPFopen{% \global\let\chapmacro=\chfopen \global\let\centerchapmacro=\centerchfopen} % Section titles. These macros combine the section number parts and % call the generic \sectionheading to do the printing. % \newskip\secheadingskip \def\secheadingbreak{\dobreak \secheadingskip{-1000}} % Subsection titles. \newskip\subsecheadingskip \def\subsecheadingbreak{\dobreak \subsecheadingskip{-500}} % Subsubsection titles. \def\subsubsecheadingskip{\subsecheadingskip} \def\subsubsecheadingbreak{\subsecheadingbreak} % Print any size, any type, section title. % % #1 is the text, #2 is the section level (sec/subsec/subsubsec), #3 is % the section type for xrefs (Ynumbered, Ynothing, Yappendix), #4 is the % section number. % \def\seckeyword{sec} % \def\sectionheading#1#2#3#4{% {% \checkenv{}% should not be in an environment. % % Switch to the right set of fonts. \csname #2fonts\endcsname \rmisbold % \def\sectionlevel{#2}% \def\temptype{#3}% % % Insert first mark before the heading break (see notes for \domark). \let\prevsectiondefs=\lastsectiondefs \ifx\temptype\Ynothingkeyword \ifx\sectionlevel\seckeyword \gdef\lastsectiondefs{\gdef\thissectionname{#1}\gdef\thissectionnum{}% \gdef\thissection{\thissectionname}}% \fi \else\ifx\temptype\Yomitfromtockeyword % Don't redefine \thissection. \else\ifx\temptype\Yappendixkeyword \ifx\sectionlevel\seckeyword \toks0={#1}% \xdef\lastsectiondefs{% \gdef\noexpand\thissectionname{\the\toks0}% \gdef\noexpand\thissectionnum{#4}% % \noexpand\putwordSection avoids expanding indigestible % commands in some of the translations. \gdef\noexpand\thissection{\noexpand\putwordSection{} \noexpand\thissectionnum: \noexpand\thissectionname}% }% \fi \else \ifx\sectionlevel\seckeyword \toks0={#1}% \xdef\lastsectiondefs{% \gdef\noexpand\thissectionname{\the\toks0}% \gdef\noexpand\thissectionnum{#4}% % \noexpand\putwordSection avoids expanding indigestible % commands in some of the translations. \gdef\noexpand\thissection{\noexpand\putwordSection{} \noexpand\thissectionnum: \noexpand\thissectionname}% }% \fi \fi\fi\fi % % Go into vertical mode. Usually we'll already be there, but we % don't want the following whatsit to end up in a preceding paragraph % if the document didn't happen to have a blank line. \par % % Output the mark. Pass it through \safewhatsit, to take care of % the preceding space. \safewhatsit\domark % % Insert space above the heading. \csname #2headingbreak\endcsname % % Now the second mark, after the heading break. No break points % between here and the heading. \global\let\prevsectiondefs=\lastsectiondefs \domark % % Only insert the space after the number if we have a section number. \ifx\temptype\Ynothingkeyword \setbox0 = \hbox{}% \def\toctype{unn}% \gdef\lastsection{#1}% \else\ifx\temptype\Yomitfromtockeyword % for @headings -- no section number, don't include in toc, % and don't redefine \lastsection. \setbox0 = \hbox{}% \def\toctype{omit}% \let\sectionlevel=\empty \else\ifx\temptype\Yappendixkeyword \setbox0 = \hbox{#4\enspace}% \def\toctype{app}% \gdef\lastsection{#1}% \else \setbox0 = \hbox{#4\enspace}% \def\toctype{num}% \gdef\lastsection{#1}% \fi\fi\fi % % Write the toc entry (before \donoderef). See comments in \chapmacro. \writetocentry{\toctype\sectionlevel}{#1}{#4}% % % Write the node reference (= pdf destination for pdftex). % Again, see comments in \chapmacro. \donoderef{#3}% % % Interline glue will be inserted when the vbox is completed. % That glue will be a valid breakpoint for the page, since it'll be % preceded by a whatsit (usually from the \donoderef, or from the % \writetocentry if there was no node). We don't want to allow that % break, since then the whatsits could end up on page n while the % section is on page n+1, thus toc/etc. are wrong. Debian bug 276000. \nobreak % % Output the actual section heading. \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \ptexraggedright \hangindent=\wd0 % zero if no section number \unhbox0 #1}% }% % Add extra space after the heading -- half of whatever came above it. % Don't allow stretch, though. \kern .5 \csname #2headingskip\endcsname % % Do not let the kern be a potential breakpoint, as it would be if it % was followed by glue. \nobreak % % We'll almost certainly start a paragraph next, so don't let that % glue accumulate. (Not a breakpoint because it's preceded by a % discardable item.) However, when a paragraph is not started next % (\startdefun, \cartouche, \center, etc.), this needs to be wiped out % or the negative glue will cause weirdly wrong output, typically % obscuring the section heading with something else. \vskip-\parskip % % This is so the last item on the main vertical list is a known % \penalty > 10000, so \startdefun, etc., can recognize the situation % and do the needful. \penalty 10001 } \message{toc,} % Table of contents. \newwrite\tocfile % Write an entry to the toc file, opening it if necessary. % Called from @chapter, etc. % % Example usage: \writetocentry{sec}{Section Name}{\the\chapno.\the\secno} % We append the current node name (if any) and page number as additional % arguments for the \{chap,sec,...}entry macros which will eventually % read this. The node name is used in the pdf outlines as the % destination to jump to. % % We open the .toc file for writing here instead of at @setfilename (or % any other fixed time) so that @contents can be anywhere in the document. % But if #1 is `omit', then we don't do anything. This is used for the % table of contents chapter openings themselves. % \newif\iftocfileopened \def\omitkeyword{omit}% % \def\writetocentry#1#2#3{% \edef\writetoctype{#1}% \ifx\writetoctype\omitkeyword \else \iftocfileopened\else \immediate\openout\tocfile = \jobname.toc \global\tocfileopenedtrue \fi % \iflinks {\atdummies \edef\temp{% \write\tocfile{@#1entry{#2}{#3}{\lastnode}{\noexpand\folio}}}% \temp }% \fi \fi % % Tell \shipout to create a pdf destination on each page, if we're % writing pdf. These are used in the table of contents. We can't % just write one on every page because the title pages are numbered % 1 and 2 (the page numbers aren't printed), and so are the first % two pages of the document. Thus, we'd have two destinations named % `1', and two named `2'. \ifpdf \global\pdfmakepagedesttrue \fi } % These characters do not print properly in the Computer Modern roman % fonts, so we must take special care. This is more or less redundant % with the Texinfo input format setup at the end of this file. % \def\activecatcodes{% \catcode`\"=\active \catcode`\$=\active \catcode`\<=\active \catcode`\>=\active \catcode`\\=\active \catcode`\^=\active \catcode`\_=\active \catcode`\|=\active \catcode`\~=\active } % Read the toc file, which is essentially Texinfo input. \def\readtocfile{% \setupdatafile \activecatcodes \input \tocreadfilename } \newskip\contentsrightmargin \contentsrightmargin=1in \newcount\savepageno \newcount\lastnegativepageno \lastnegativepageno = -1 % Prepare to read what we've written to \tocfile. % \def\startcontents#1{% % If @setchapternewpage on, and @headings double, the contents should % start on an odd page, unlike chapters. Thus, we maintain % \contentsalignmacro in parallel with \pagealignmacro. % From: Torbjorn Granlund \contentsalignmacro \immediate\closeout\tocfile % % Don't need to put `Contents' or `Short Contents' in the headline. % It is abundantly clear what they are. \chapmacro{#1}{Yomitfromtoc}{}% % \savepageno = \pageno \begingroup % Set up to handle contents files properly. \raggedbottom % Worry more about breakpoints than the bottom. \advance\hsize by -\contentsrightmargin % Don't use the full line length. % % Roman numerals for page numbers. \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi } % redefined for the two-volume lispref. We always output on % \jobname.toc even if this is redefined. % \def\tocreadfilename{\jobname.toc} % Normal (long) toc. % \def\contents{% \startcontents{\putwordTOC}% \openin 1 \tocreadfilename\space \ifeof 1 \else \readtocfile \fi \vfill \eject \contentsalignmacro % in case @setchapternewpage odd is in effect \ifeof 1 \else \pdfmakeoutlines \fi \closein 1 \endgroup \lastnegativepageno = \pageno \global\pageno = \savepageno } % And just the chapters. \def\summarycontents{% \startcontents{\putwordShortTOC}% % \let\partentry = \shortpartentry \let\numchapentry = \shortchapentry \let\appentry = \shortchapentry \let\unnchapentry = \shortunnchapentry % We want a true roman here for the page numbers. \secfonts \let\rm=\shortcontrm \let\bf=\shortcontbf \let\sl=\shortcontsl \let\tt=\shortconttt \rm \hyphenpenalty = 10000 \advance\baselineskip by 1pt % Open it up a little. \def\numsecentry##1##2##3##4{} \let\appsecentry = \numsecentry \let\unnsecentry = \numsecentry \let\numsubsecentry = \numsecentry \let\appsubsecentry = \numsecentry \let\unnsubsecentry = \numsecentry \let\numsubsubsecentry = \numsecentry \let\appsubsubsecentry = \numsecentry \let\unnsubsubsecentry = \numsecentry \openin 1 \tocreadfilename\space \ifeof 1 \else \readtocfile \fi \closein 1 \vfill \eject \contentsalignmacro % in case @setchapternewpage odd is in effect \endgroup \lastnegativepageno = \pageno \global\pageno = \savepageno } \let\shortcontents = \summarycontents % Typeset the label for a chapter or appendix for the short contents. % The arg is, e.g., `A' for an appendix, or `3' for a chapter. % \def\shortchaplabel#1{% % This space should be enough, since a single number is .5em, and the % widest letter (M) is 1em, at least in the Computer Modern fonts. % But use \hss just in case. % (This space doesn't include the extra space that gets added after % the label; that gets put in by \shortchapentry above.) % % We'd like to right-justify chapter numbers, but that looks strange % with appendix letters. And right-justifying numbers and % left-justifying letters looks strange when there is less than 10 % chapters. Have to read the whole toc once to know how many chapters % there are before deciding ... \hbox to 1em{#1\hss}% } % These macros generate individual entries in the table of contents. % The first argument is the chapter or section name. % The last argument is the page number. % The arguments in between are the chapter number, section number, ... % Parts, in the main contents. Replace the part number, which doesn't % exist, with an empty box. Let's hope all the numbers have the same width. % Also ignore the page number, which is conventionally not printed. \def\numeralbox{\setbox0=\hbox{8}\hbox to \wd0{\hfil}} \def\partentry#1#2#3#4{\dochapentry{\numeralbox\labelspace#1}{}} % % Parts, in the short toc. \def\shortpartentry#1#2#3#4{% \penalty-300 \vskip.5\baselineskip plus.15\baselineskip minus.1\baselineskip \shortchapentry{{\bf #1}}{\numeralbox}{}{}% } % Chapters, in the main contents. \def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}} % % Chapters, in the short toc. % See comments in \dochapentry re vbox and related settings. \def\shortchapentry#1#2#3#4{% \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#4\egroup}% } % Appendices, in the main contents. % Need the word Appendix, and a fixed-size box. % \def\appendixbox#1{% % We use M since it's probably the widest letter. \setbox0 = \hbox{\putwordAppendix{} M}% \hbox to \wd0{\putwordAppendix{} #1\hss}} % \def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\labelspace#1}{#4}} % Unnumbered chapters. \def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}} \def\shortunnchapentry#1#2#3#4{\tocentry{#1}{\doshortpageno\bgroup#4\egroup}} % Sections. \def\numsecentry#1#2#3#4{\dosecentry{#2\labelspace#1}{#4}} \let\appsecentry=\numsecentry \def\unnsecentry#1#2#3#4{\dosecentry{#1}{#4}} % Subsections. \def\numsubsecentry#1#2#3#4{\dosubsecentry{#2\labelspace#1}{#4}} \let\appsubsecentry=\numsubsecentry \def\unnsubsecentry#1#2#3#4{\dosubsecentry{#1}{#4}} % And subsubsections. \def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#2\labelspace#1}{#4}} \let\appsubsubsecentry=\numsubsubsecentry \def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#4}} % This parameter controls the indentation of the various levels. % Same as \defaultparindent. \newdimen\tocindent \tocindent = 15pt % Now for the actual typesetting. In all these, #1 is the text and #2 is the % page number. % % If the toc has to be broken over pages, we want it to be at chapters % if at all possible; hence the \penalty. \def\dochapentry#1#2{% \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip \begingroup \chapentryfonts \tocentry{#1}{\dopageno\bgroup#2\egroup}% \endgroup \nobreak\vskip .25\baselineskip plus.1\baselineskip } \def\dosecentry#1#2{\begingroup \secentryfonts \leftskip=\tocindent \tocentry{#1}{\dopageno\bgroup#2\egroup}% \endgroup} \def\dosubsecentry#1#2{\begingroup \subsecentryfonts \leftskip=2\tocindent \tocentry{#1}{\dopageno\bgroup#2\egroup}% \endgroup} \def\dosubsubsecentry#1#2{\begingroup \subsubsecentryfonts \leftskip=3\tocindent \tocentry{#1}{\dopageno\bgroup#2\egroup}% \endgroup} % We use the same \entry macro as for the index entries. \let\tocentry = \entry % Space between chapter (or whatever) number and the title. \def\labelspace{\hskip1em \relax} \def\dopageno#1{{\rm #1}} \def\doshortpageno#1{{\rm #1}} \def\chapentryfonts{\secfonts \rm} \def\secentryfonts{\textfonts} \def\subsecentryfonts{\textfonts} \def\subsubsecentryfonts{\textfonts} \message{environments,} % @foo ... @end foo. % @tex ... @end tex escapes into raw TeX temporarily. % One exception: @ is still an escape character, so that @end tex works. % But \@ or @@ will get a plain @ character. \envdef\tex{% \setupmarkupstyle{tex}% \catcode `\\=0 \catcode `\{=1 \catcode `\}=2 \catcode `\$=3 \catcode `\&=4 \catcode `\#=6 \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie \catcode `\%=14 \catcode `\+=\other \catcode `\"=\other \catcode `\|=\other \catcode `\<=\other \catcode `\>=\other \catcode `\`=\other \catcode `\'=\other \escapechar=`\\ % % ' is active in math mode (mathcode"8000). So reset it, and all our % other math active characters (just in case), to plain's definitions. \mathactive % \let\b=\ptexb \let\bullet=\ptexbullet \let\c=\ptexc \let\,=\ptexcomma \let\.=\ptexdot \let\dots=\ptexdots \let\equiv=\ptexequiv \let\!=\ptexexclam \let\i=\ptexi \let\indent=\ptexindent \let\noindent=\ptexnoindent \let\{=\ptexlbrace \let\+=\tabalign \let\}=\ptexrbrace \let\/=\ptexslash \let\*=\ptexstar \let\t=\ptext \expandafter \let\csname top\endcsname=\ptextop % we've made it outer \let\frenchspacing=\plainfrenchspacing % \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}% \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}% \def\@{@}% } % There is no need to define \Etex. % Define @lisp ... @end lisp. % @lisp environment forms a group so it can rebind things, % including the definition of @end lisp (which normally is erroneous). % Amount to narrow the margins by for @lisp. \newskip\lispnarrowing \lispnarrowing=0.4in % This is the definition that ^^M gets inside @lisp, @example, and other % such environments. \null is better than a space, since it doesn't % have any width. \def\lisppar{\null\endgraf} % This space is always present above and below environments. \newskip\envskipamount \envskipamount = 0pt % Make spacing and below environment symmetrical. We use \parskip here % to help in doing that, since in @example-like environments \parskip % is reset to zero; thus the \afterenvbreak inserts no space -- but the % start of the next paragraph will insert \parskip. % \def\aboveenvbreak{{% % =10000 instead of <10000 because of a special case in \itemzzz and % \sectionheading, q.v. \ifnum \lastpenalty=10000 \else \advance\envskipamount by \parskip \endgraf \ifdim\lastskip<\envskipamount \removelastskip % it's not a good place to break if the last penalty was \nobreak % or better ... \ifnum\lastpenalty<10000 \penalty-50 \fi \vskip\envskipamount \fi \fi }} \let\afterenvbreak = \aboveenvbreak % \nonarrowing is a flag. If "set", @lisp etc don't narrow margins; it will % also clear it, so that its embedded environments do the narrowing again. \let\nonarrowing=\relax % @cartouche ... @end cartouche: draw rectangle w/rounded corners around % environment contents. \font\circle=lcircle10 \newdimen\circthick \newdimen\cartouter\newdimen\cartinner \newskip\normbskip\newskip\normpskip\newskip\normlskip \circthick=\fontdimen8\circle % \def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth \def\ctr{{\hskip 6pt\circle\char'010}} \def\cbl{{\circle\char'012\hskip -6pt}} \def\cbr{{\hskip 6pt\circle\char'011}} \def\carttop{\hbox to \cartouter{\hskip\lskip \ctl\leaders\hrule height\circthick\hfil\ctr \hskip\rskip}} \def\cartbot{\hbox to \cartouter{\hskip\lskip \cbl\leaders\hrule height\circthick\hfil\cbr \hskip\rskip}} % \newskip\lskip\newskip\rskip \envdef\cartouche{% \ifhmode\par\fi % can't be in the midst of a paragraph. \startsavinginserts \lskip=\leftskip \rskip=\rightskip \leftskip=0pt\rightskip=0pt % we want these *outside*. \cartinner=\hsize \advance\cartinner by-\lskip \advance\cartinner by-\rskip \cartouter=\hsize \advance\cartouter by 18.4pt % allow for 3pt kerns on either % side, and for 6pt waste from % each corner char, and rule thickness \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip % Flag to tell @lisp, etc., not to narrow margin. \let\nonarrowing = t% % % If this cartouche directly follows a sectioning command, we need the % \parskip glue (backspaced over by default) or the cartouche can % collide with the section heading. \ifnum\lastpenalty>10000 \vskip\parskip \penalty\lastpenalty \fi % \vbox\bgroup \baselineskip=0pt\parskip=0pt\lineskip=0pt \carttop \hbox\bgroup \hskip\lskip \vrule\kern3pt \vbox\bgroup \kern3pt \hsize=\cartinner \baselineskip=\normbskip \lineskip=\normlskip \parskip=\normpskip \vskip -\parskip \comment % For explanation, see the end of def\group. } \def\Ecartouche{% \ifhmode\par\fi \kern3pt \egroup \kern3pt\vrule \hskip\rskip \egroup \cartbot \egroup \checkinserts } % This macro is called at the beginning of all the @example variants, % inside a group. \newdimen\nonfillparindent \def\nonfillstart{% \aboveenvbreak \ifdim\hfuzz < 12pt \hfuzz = 12pt \fi % Don't be fussy \sepspaces % Make spaces be word-separators rather than space tokens. \let\par = \lisppar % don't ignore blank lines \obeylines % each line of input is a line of output \parskip = 0pt % Turn off paragraph indentation but redefine \indent to emulate % the normal \indent. \nonfillparindent=\parindent \parindent = 0pt \let\indent\nonfillindent % \emergencystretch = 0pt % don't try to avoid overfull boxes \ifx\nonarrowing\relax \advance \leftskip by \lispnarrowing \exdentamount=\lispnarrowing \else \let\nonarrowing = \relax \fi \let\exdent=\nofillexdent } \begingroup \obeyspaces % We want to swallow spaces (but not other tokens) after the fake % @indent in our nonfill-environments, where spaces are normally % active and set to @tie, resulting in them not being ignored after % @indent. \gdef\nonfillindent{\futurelet\temp\nonfillindentcheck}% \gdef\nonfillindentcheck{% \ifx\temp % \expandafter\nonfillindentgobble% \else% \leavevmode\nonfillindentbox% \fi% }% \endgroup \def\nonfillindentgobble#1{\nonfillindent} \def\nonfillindentbox{\hbox to \nonfillparindent{\hss}} % If you want all examples etc. small: @set dispenvsize small. % If you want even small examples the full size: @set dispenvsize nosmall. % This affects the following displayed environments: % @example, @display, @format, @lisp % \def\smallword{small} \def\nosmallword{nosmall} \let\SETdispenvsize\relax \def\setnormaldispenv{% \ifx\SETdispenvsize\smallword % end paragraph for sake of leading, in case document has no blank % line. This is redundant with what happens in \aboveenvbreak, but % we need to do it before changing the fonts, and it's inconvenient % to change the fonts afterward. \ifnum \lastpenalty=10000 \else \endgraf \fi \smallexamplefonts \rm \fi } \def\setsmalldispenv{% \ifx\SETdispenvsize\nosmallword \else \ifnum \lastpenalty=10000 \else \endgraf \fi \smallexamplefonts \rm \fi } % We often define two environments, @foo and @smallfoo. % Let's do it in one command. #1 is the env name, #2 the definition. \def\makedispenvdef#1#2{% \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2}% \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2}% \expandafter\let\csname E#1\endcsname \afterenvbreak \expandafter\let\csname Esmall#1\endcsname \afterenvbreak } % Define two environment synonyms (#1 and #2) for an environment. \def\maketwodispenvdef#1#2#3{% \makedispenvdef{#1}{#3}% \makedispenvdef{#2}{#3}% } % % @lisp: indented, narrowed, typewriter font; % @example: same as @lisp. % % @smallexample and @smalllisp: use smaller fonts. % Originally contributed by Pavel@xerox. % \maketwodispenvdef{lisp}{example}{% \nonfillstart \tt\setupmarkupstyle{example}% \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special. \gobble % eat return } % @display/@smalldisplay: same as @lisp except keep current font. % \makedispenvdef{display}{% \nonfillstart \gobble } % @format/@smallformat: same as @display except don't narrow margins. % \makedispenvdef{format}{% \let\nonarrowing = t% \nonfillstart \gobble } % @flushleft: same as @format, but doesn't obey \SETdispenvsize. \envdef\flushleft{% \let\nonarrowing = t% \nonfillstart \gobble } \let\Eflushleft = \afterenvbreak % @flushright. % \envdef\flushright{% \let\nonarrowing = t% \nonfillstart \advance\leftskip by 0pt plus 1fill\relax \gobble } \let\Eflushright = \afterenvbreak % @raggedright does more-or-less normal line breaking but no right % justification. From plain.tex. \envdef\raggedright{% \rightskip0pt plus2em \spaceskip.3333em \xspaceskip.5em\relax } \let\Eraggedright\par \envdef\raggedleft{% \parindent=0pt \leftskip0pt plus2em \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt \hbadness=10000 % Last line will usually be underfull, so turn off % badness reporting. } \let\Eraggedleft\par \envdef\raggedcenter{% \parindent=0pt \rightskip0pt plus1em \leftskip0pt plus1em \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt \hbadness=10000 % Last line will usually be underfull, so turn off % badness reporting. } \let\Eraggedcenter\par % @quotation does normal linebreaking (hence we can't use \nonfillstart) % and narrows the margins. We keep \parskip nonzero in general, since % we're doing normal filling. So, when using \aboveenvbreak and % \afterenvbreak, temporarily make \parskip 0. % \makedispenvdef{quotation}{\quotationstart} % \def\quotationstart{% \indentedblockstart % same as \indentedblock, but increase right margin too. \ifx\nonarrowing\relax \advance\rightskip by \lispnarrowing \fi \parsearg\quotationlabel } % We have retained a nonzero parskip for the environment, since we're % doing normal filling. % \def\Equotation{% \par \ifx\quotationauthor\thisisundefined\else % indent a bit. \leftline{\kern 2\leftskip \sl ---\quotationauthor}% \fi {\parskip=0pt \afterenvbreak}% } \def\Esmallquotation{\Equotation} % If we're given an argument, typeset it in bold with a colon after. \def\quotationlabel#1{% \def\temp{#1}% \ifx\temp\empty \else {\bf #1: }% \fi } % @indentedblock is like @quotation, but indents only on the left and % has no optional argument. % \makedispenvdef{indentedblock}{\indentedblockstart} % \def\indentedblockstart{% {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip \parindent=0pt % % @cartouche defines \nonarrowing to inhibit narrowing at next level down. \ifx\nonarrowing\relax \advance\leftskip by \lispnarrowing \exdentamount = \lispnarrowing \else \let\nonarrowing = \relax \fi } % Keep a nonzero parskip for the environment, since we're doing normal filling. % \def\Eindentedblock{% \par {\parskip=0pt \afterenvbreak}% } \def\Esmallindentedblock{\Eindentedblock} % LaTeX-like @verbatim...@end verbatim and @verb{...} % If we want to allow any as delimiter, % we need the curly braces so that makeinfo sees the @verb command, eg: % `@verbx...x' would look like the '@verbx' command. --janneke@gnu.org % % [Knuth]: Donald Ervin Knuth, 1996. The TeXbook. % % [Knuth] p.344; only we need to do the other characters Texinfo sets % active too. Otherwise, they get lost as the first character on a % verbatim line. \def\dospecials{% \do\ \do\\\do\{\do\}\do\$\do\&% \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~% \do\<\do\>\do\|\do\@\do+\do\"% % Don't do the quotes -- if we do, @set txicodequoteundirected and % @set txicodequotebacktick will not have effect on @verb and % @verbatim, and ?` and !` ligatures won't get disabled. %\do\`\do\'% } % % [Knuth] p. 380 \def\uncatcodespecials{% \def\do##1{\catcode`##1=\other}\dospecials} % % Setup for the @verb command. % % Eight spaces for a tab \begingroup \catcode`\^^I=\active \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }} \endgroup % \def\setupverb{% \tt % easiest (and conventionally used) font for verbatim \def\par{\leavevmode\endgraf}% \setupmarkupstyle{verb}% \tabeightspaces % Respect line breaks, % print special symbols as themselves, and % make each space count % must do in this order: \obeylines \uncatcodespecials \sepspaces } % Setup for the @verbatim environment % % Real tab expansion. \newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount % % We typeset each line of the verbatim in an \hbox, so we can handle % tabs. The \global is in case the verbatim line starts with an accent, % or some other command that starts with a begin-group. Otherwise, the % entire \verbbox would disappear at the corresponding end-group, before % it is typeset. Meanwhile, we can't have nested verbatim commands % (can we?), so the \global won't be overwriting itself. \newbox\verbbox \def\starttabbox{\global\setbox\verbbox=\hbox\bgroup} % \begingroup \catcode`\^^I=\active \gdef\tabexpand{% \catcode`\^^I=\active \def^^I{\leavevmode\egroup \dimen\verbbox=\wd\verbbox % the width so far, or since the previous tab \divide\dimen\verbbox by\tabw \multiply\dimen\verbbox by\tabw % compute previous multiple of \tabw \advance\dimen\verbbox by\tabw % advance to next multiple of \tabw \wd\verbbox=\dimen\verbbox \box\verbbox \starttabbox }% } \endgroup % start the verbatim environment. \def\setupverbatim{% \let\nonarrowing = t% \nonfillstart \tt % easiest (and conventionally used) font for verbatim % The \leavevmode here is for blank lines. Otherwise, we would % never \starttabox and the \egroup would end verbatim mode. \def\par{\leavevmode\egroup\box\verbbox\endgraf}% \tabexpand \setupmarkupstyle{verbatim}% % Respect line breaks, % print special symbols as themselves, and % make each space count. % Must do in this order: \obeylines \uncatcodespecials \sepspaces \everypar{\starttabbox}% } % Do the @verb magic: verbatim text is quoted by unique % delimiter characters. Before first delimiter expect a % right brace, after last delimiter expect closing brace: % % \def\doverb'{'#1'}'{#1} % % [Knuth] p. 382; only eat outer {} \begingroup \catcode`[=1\catcode`]=2\catcode`\{=\other\catcode`\}=\other \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next] \endgroup % \def\verb{\begingroup\setupverb\doverb} % % % Do the @verbatim magic: define the macro \doverbatim so that % the (first) argument ends when '@end verbatim' is reached, ie: % % \def\doverbatim#1@end verbatim{#1} % % For Texinfo it's a lot easier than for LaTeX, % because texinfo's \verbatim doesn't stop at '\end{verbatim}': % we need not redefine '\', '{' and '}'. % % Inspired by LaTeX's verbatim command set [latex.ltx] % \begingroup \catcode`\ =\active \obeylines % % ignore everything up to the first ^^M, that's the newline at the end % of the @verbatim input line itself. Otherwise we get an extra blank % line in the output. \xdef\doverbatim#1^^M#2@end verbatim{#2\noexpand\end\gobble verbatim}% % We really want {...\end verbatim} in the body of the macro, but % without the active space; thus we have to use \xdef and \gobble. \endgroup % \envdef\verbatim{% \setupverbatim\doverbatim } \let\Everbatim = \afterenvbreak % @verbatiminclude FILE - insert text of file in verbatim environment. % \def\verbatiminclude{\parseargusing\filenamecatcodes\doverbatiminclude} % \def\doverbatiminclude#1{% {% \makevalueexpandable \setupverbatim \indexnofonts % Allow `@@' and other weird things in file names. \wlog{texinfo.tex: doing @verbatiminclude of #1^^J}% \input #1 \afterenvbreak }% } % @copying ... @end copying. % Save the text away for @insertcopying later. % % We save the uninterpreted tokens, rather than creating a box. % Saving the text in a box would be much easier, but then all the % typesetting commands (@smallbook, font changes, etc.) have to be done % beforehand -- and a) we want @copying to be done first in the source % file; b) letting users define the frontmatter in as flexible order as % possible is very desirable. % \def\copying{\checkenv{}\begingroup\scanargctxt\docopying} \def\docopying#1@end copying{\endgroup\def\copyingtext{#1}} % \def\insertcopying{% \begingroup \parindent = 0pt % paragraph indentation looks wrong on title page \scanexp\copyingtext \endgroup } \message{defuns,} % @defun etc. \newskip\defbodyindent \defbodyindent=.4in \newskip\defargsindent \defargsindent=50pt \newskip\deflastargmargin \deflastargmargin=18pt \newcount\defunpenalty % Start the processing of @deffn: \def\startdefun{% \ifnum\lastpenalty<10000 \medbreak \defunpenalty=10003 % Will keep this @deffn together with the % following @def command, see below. \else % If there are two @def commands in a row, we'll have a \nobreak, % which is there to keep the function description together with its % header. But if there's nothing but headers, we need to allow a % break somewhere. Check specifically for penalty 10002, inserted % by \printdefunline, instead of 10000, since the sectioning % commands also insert a nobreak penalty, and we don't want to allow % a break between a section heading and a defun. % % As a further refinement, we avoid "club" headers by signalling % with penalty of 10003 after the very first @deffn in the % sequence (see above), and penalty of 10002 after any following % @def command. \ifnum\lastpenalty=10002 \penalty2000 \else \defunpenalty=10002 \fi % % Similarly, after a section heading, do not allow a break. % But do insert the glue. \medskip % preceded by discardable penalty, so not a breakpoint \fi % \parindent=0in \advance\leftskip by \defbodyindent \exdentamount=\defbodyindent } \def\dodefunx#1{% % First, check whether we are in the right environment: \checkenv#1% % % As above, allow line break if we have multiple x headers in a row. % It's not a great place, though. \ifnum\lastpenalty=10002 \penalty3000 \else \defunpenalty=10002 \fi % % And now, it's time to reuse the body of the original defun: \expandafter\gobbledefun#1% } \def\gobbledefun#1\startdefun{} % \printdefunline \deffnheader{text} % \def\printdefunline#1#2{% \begingroup % call \deffnheader: #1#2 \endheader % common ending: \interlinepenalty = 10000 \advance\rightskip by 0pt plus 1fil\relax \endgraf \nobreak\vskip -\parskip \penalty\defunpenalty % signal to \startdefun and \dodefunx % Some of the @defun-type tags do not enable magic parentheses, % rendering the following check redundant. But we don't optimize. \checkparencounts \endgroup } \def\Edefun{\endgraf\medbreak} % \makedefun{deffn} creates \deffn, \deffnx and \Edeffn; % the only thing remaining is to define \deffnheader. % \def\makedefun#1{% \expandafter\let\csname E#1\endcsname = \Edefun \edef\temp{\noexpand\domakedefun \makecsname{#1}\makecsname{#1x}\makecsname{#1header}}% \temp } % \domakedefun \deffn \deffnx \deffnheader % % Define \deffn and \deffnx, without parameters. % \deffnheader has to be defined explicitly. % \def\domakedefun#1#2#3{% \envdef#1{% \startdefun \doingtypefnfalse % distinguish typed functions from all else \parseargusing\activeparens{\printdefunline#3}% }% \def#2{\dodefunx#1}% \def#3% } \newif\ifdoingtypefn % doing typed function? \newif\ifrettypeownline % typeset return type on its own line? % @deftypefnnewline on|off says whether the return type of typed functions % are printed on their own line. This affects @deftypefn, @deftypefun, % @deftypeop, and @deftypemethod. % \parseargdef\deftypefnnewline{% \def\temp{#1}% \ifx\temp\onword \expandafter\let\csname SETtxideftypefnnl\endcsname = \empty \else\ifx\temp\offword \expandafter\let\csname SETtxideftypefnnl\endcsname = \relax \else \errhelp = \EMsimple \errmessage{Unknown @txideftypefnnl value `\temp', must be on|off}% \fi\fi } % Untyped functions: % @deffn category name args \makedefun{deffn}{\deffngeneral{}} % @deffn category class name args \makedefun{defop}#1 {\defopon{#1\ \putwordon}} % \defopon {category on}class name args \def\defopon#1#2 {\deffngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} } % \deffngeneral {subind}category name args % \def\deffngeneral#1#2 #3 #4\endheader{% % Remember that \dosubind{fn}{foo}{} is equivalent to \doind{fn}{foo}. \dosubind{fn}{\code{#3}}{#1}% \defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}% } % Typed functions: % @deftypefn category type name args \makedefun{deftypefn}{\deftypefngeneral{}} % @deftypeop category class type name args \makedefun{deftypeop}#1 {\deftypeopon{#1\ \putwordon}} % \deftypeopon {category on}class type name args \def\deftypeopon#1#2 {\deftypefngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} } % \deftypefngeneral {subind}category type name args % \def\deftypefngeneral#1#2 #3 #4 #5\endheader{% \dosubind{fn}{\code{#4}}{#1}% \doingtypefntrue \defname{#2}{#3}{#4}\defunargs{#5\unskip}% } % Typed variables: % @deftypevr category type var args \makedefun{deftypevr}{\deftypecvgeneral{}} % @deftypecv category class type var args \makedefun{deftypecv}#1 {\deftypecvof{#1\ \putwordof}} % \deftypecvof {category of}class type var args \def\deftypecvof#1#2 {\deftypecvgeneral{\putwordof\ \code{#2}}{#1\ \code{#2}} } % \deftypecvgeneral {subind}category type var args % \def\deftypecvgeneral#1#2 #3 #4 #5\endheader{% \dosubind{vr}{\code{#4}}{#1}% \defname{#2}{#3}{#4}\defunargs{#5\unskip}% } % Untyped variables: % @defvr category var args \makedefun{defvr}#1 {\deftypevrheader{#1} {} } % @defcv category class var args \makedefun{defcv}#1 {\defcvof{#1\ \putwordof}} % \defcvof {category of}class var args \def\defcvof#1#2 {\deftypecvof{#1}#2 {} } % Types: % @deftp category name args \makedefun{deftp}#1 #2 #3\endheader{% \doind{tp}{\code{#2}}% \defname{#1}{}{#2}\defunargs{#3\unskip}% } % Remaining @defun-like shortcuts: \makedefun{defun}{\deffnheader{\putwordDeffunc} } \makedefun{defmac}{\deffnheader{\putwordDefmac} } \makedefun{defspec}{\deffnheader{\putwordDefspec} } \makedefun{deftypefun}{\deftypefnheader{\putwordDeffunc} } \makedefun{defvar}{\defvrheader{\putwordDefvar} } \makedefun{defopt}{\defvrheader{\putwordDefopt} } \makedefun{deftypevar}{\deftypevrheader{\putwordDefvar} } \makedefun{defmethod}{\defopon\putwordMethodon} \makedefun{deftypemethod}{\deftypeopon\putwordMethodon} \makedefun{defivar}{\defcvof\putwordInstanceVariableof} \makedefun{deftypeivar}{\deftypecvof\putwordInstanceVariableof} % \defname, which formats the name of the @def (not the args). % #1 is the category, such as "Function". % #2 is the return type, if any. % #3 is the function name. % % We are followed by (but not passed) the arguments, if any. % \def\defname#1#2#3{% \par % Get the values of \leftskip and \rightskip as they were outside the @def... \advance\leftskip by -\defbodyindent % % Determine if we are typesetting the return type of a typed function % on a line by itself. \rettypeownlinefalse \ifdoingtypefn % doing a typed function specifically? % then check user option for putting return type on its own line: \expandafter\ifx\csname SETtxideftypefnnl\endcsname\relax \else \rettypeownlinetrue \fi \fi % % How we'll format the category name. Putting it in brackets helps % distinguish it from the body text that may end up on the next line % just below it. \def\temp{#1}% \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi} % % Figure out line sizes for the paragraph shape. We'll always have at % least two. \tempnum = 2 % % The first line needs space for \box0; but if \rightskip is nonzero, % we need only space for the part of \box0 which exceeds it: \dimen0=\hsize \advance\dimen0 by -\wd0 \advance\dimen0 by \rightskip % % If doing a return type on its own line, we'll have another line. \ifrettypeownline \advance\tempnum by 1 \def\maybeshapeline{0in \hsize}% \else \def\maybeshapeline{}% \fi % % The continuations: \dimen2=\hsize \advance\dimen2 by -\defargsindent % % The final paragraph shape: \parshape \tempnum 0in \dimen0 \maybeshapeline \defargsindent \dimen2 % % Put the category name at the right margin. \noindent \hbox to 0pt{% \hfil\box0 \kern-\hsize % \hsize has to be shortened this way: \kern\leftskip % Intentionally do not respect \rightskip, since we need the space. }% % % Allow all lines to be underfull without complaint: \tolerance=10000 \hbadness=10000 \exdentamount=\defbodyindent {% % defun fonts. We use typewriter by default (used to be bold) because: % . we're printing identifiers, they should be in tt in principle. % . in languages with many accents, such as Czech or French, it's % common to leave accents off identifiers. The result looks ok in % tt, but exceedingly strange in rm. % . we don't want -- and --- to be treated as ligatures. % . this still does not fix the ?` and !` ligatures, but so far no % one has made identifiers using them :). \df \tt \def\temp{#2}% text of the return type \ifx\temp\empty\else \tclose{\temp}% typeset the return type \ifrettypeownline % put return type on its own line; prohibit line break following: \hfil\vadjust{\nobreak}\break \else \space % type on same line, so just followed by a space \fi \fi % no return type #3% output function name }% {\rm\enskip}% hskip 0.5 em of \tenrm % \boldbrax % arguments will be output next, if any. } % Print arguments in slanted roman (not ttsl), inconsistently with using % tt for the name. This is because literal text is sometimes needed in % the argument list (groff manual), and ttsl and tt are not very % distinguishable. Prevent hyphenation at `-' chars. % \def\defunargs#1{% % use sl by default (not ttsl), % tt for the names. \df \sl \hyphenchar\font=0 % % On the other hand, if an argument has two dashes (for instance), we % want a way to get ttsl. We used to recommend @var for that, so % leave the code in, but it's strange for @var to lead to typewriter. % Nowadays we recommend @code, since the difference between a ttsl hyphen % and a tt hyphen is pretty tiny. @code also disables ?` !`. \def\var##1{{\setupmarkupstyle{var}\ttslanted{##1}}}% #1% \sl\hyphenchar\font=45 } % We want ()&[] to print specially on the defun line. % \def\activeparens{% \catcode`\(=\active \catcode`\)=\active \catcode`\[=\active \catcode`\]=\active \catcode`\&=\active } % Make control sequences which act like normal parenthesis chars. \let\lparen = ( \let\rparen = ) % Be sure that we always have a definition for `(', etc. For example, % if the fn name has parens in it, \boldbrax will not be in effect yet, % so TeX would otherwise complain about undefined control sequence. { \activeparens \global\let(=\lparen \global\let)=\rparen \global\let[=\lbrack \global\let]=\rbrack \global\let& = \& \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb} \gdef\magicamp{\let&=\amprm} } \newcount\parencount % If we encounter &foo, then turn on ()-hacking afterwards \newif\ifampseen \def\amprm#1 {\ampseentrue{\bf\ }} \def\parenfont{% \ifampseen % At the first level, print parens in roman, % otherwise use the default font. \ifnum \parencount=1 \rm \fi \else % The \sf parens (in \boldbrax) actually are a little bolder than % the contained text. This is especially needed for [ and ] . \sf \fi } \def\infirstlevel#1{% \ifampseen \ifnum\parencount=1 #1% \fi \fi } \def\bfafterword#1 {#1 \bf} \def\opnr{% \global\advance\parencount by 1 {\parenfont(}% \infirstlevel \bfafterword } \def\clnr{% {\parenfont)}% \infirstlevel \sl \global\advance\parencount by -1 } \newcount\brackcount \def\lbrb{% \global\advance\brackcount by 1 {\bf[}% } \def\rbrb{% {\bf]}% \global\advance\brackcount by -1 } \def\checkparencounts{% \ifnum\parencount=0 \else \badparencount \fi \ifnum\brackcount=0 \else \badbrackcount \fi } % these should not use \errmessage; the glibc manual, at least, actually % has such constructs (when documenting function pointers). \def\badparencount{% \message{Warning: unbalanced parentheses in @def...}% \global\parencount=0 } \def\badbrackcount{% \message{Warning: unbalanced square brackets in @def...}% \global\brackcount=0 } \message{macros,} % @macro. % To do this right we need a feature of e-TeX, \scantokens, % which we arrange to emulate with a temporary file in ordinary TeX. \ifx\eTeXversion\thisisundefined \newwrite\macscribble \def\scantokens#1{% \toks0={#1}% \immediate\openout\macscribble=\jobname.tmp \immediate\write\macscribble{\the\toks0}% \immediate\closeout\macscribble \input \jobname.tmp } \fi \def\scanmacro#1{\begingroup \newlinechar`\^^M \let\xeatspaces\eatspaces % % Undo catcode changes of \startcontents and \doprintindex % When called from @insertcopying or (short)caption, we need active % backslash to get it printed correctly. Previously, we had % \catcode`\\=\other instead. We'll see whether a problem appears % with macro expansion. --kasal, 19aug04 \catcode`\@=0 \catcode`\\=\active \escapechar=`\@ % % ... and for \example: \spaceisspace % % The \empty here causes a following catcode 5 newline to be eaten as % part of reading whitespace after a control sequence. It does not % eat a catcode 13 newline. There's no good way to handle the two % cases (untried: maybe e-TeX's \everyeof could help, though plain TeX % would then have different behavior). See the Macro Details node in % the manual for the workaround we recommend for macros and % line-oriented commands. % \scantokens{#1\empty}% \endgroup} \def\scanexp#1{% \edef\temp{\noexpand\scanmacro{#1}}% \temp } \newcount\paramno % Count of parameters \newtoks\macname % Macro name \newif\ifrecursive % Is it recursive? % List of all defined macros in the form % \definedummyword\macro1\definedummyword\macro2... % Currently is also contains all @aliases; the list can be split % if there is a need. \def\macrolist{} % Add the macro to \macrolist \def\addtomacrolist#1{\expandafter \addtomacrolistxxx \csname#1\endcsname} \def\addtomacrolistxxx#1{% \toks0 = \expandafter{\macrolist\definedummyword#1}% \xdef\macrolist{\the\toks0}% } % Utility routines. % This does \let #1 = #2, with \csnames; that is, % \let \csname#1\endcsname = \csname#2\endcsname % (except of course we have to play expansion games). % \def\cslet#1#2{% \expandafter\let \csname#1\expandafter\endcsname \csname#2\endcsname } % Trim leading and trailing spaces off a string. % Concepts from aro-bend problem 15 (see CTAN). {\catcode`\@=11 \gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }} \gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@} \gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @} \def\unbrace#1{#1} \unbrace{\gdef\trim@@@ #1 } #2@{#1} } % Trim a single trailing ^^M off a string. {\catcode`\^^M=\other \catcode`\Q=3% \gdef\eatcr #1{\eatcra #1Q^^MQ}% \gdef\eatcra#1^^MQ{\eatcrb#1Q}% \gdef\eatcrb#1Q#2Q{#1}% } % Macro bodies are absorbed as an argument in a context where % all characters are catcode 10, 11 or 12, except \ which is active % (as in normal texinfo). It is necessary to change the definition of \ % to recognize macro arguments; this is the job of \mbodybackslash. % % Non-ASCII encodings make 8-bit characters active, so un-activate % them to avoid their expansion. Must do this non-globally, to % confine the change to the current group. % % It's necessary to have hard CRs when the macro is executed. This is % done by making ^^M (\endlinechar) catcode 12 when reading the macro % body, and then making it the \newlinechar in \scanmacro. % \def\scanctxt{% used as subroutine \catcode`\"=\other \catcode`\+=\other \catcode`\<=\other \catcode`\>=\other \catcode`\@=\other \catcode`\^=\other \catcode`\_=\other \catcode`\|=\other \catcode`\~=\other \ifx\declaredencoding\ascii \else \setnonasciicharscatcodenonglobal\other \fi } \def\scanargctxt{% used for copying and captions, not macros. \scanctxt \catcode`\\=\other \catcode`\^^M=\other } \def\macrobodyctxt{% used for @macro definitions \scanctxt \catcode`\{=\other \catcode`\}=\other \catcode`\^^M=\other \usembodybackslash } \def\macroargctxt{% used when scanning invocations \scanctxt \catcode`\\=0 } % why catcode 0 for \ in the above? To recognize \\ \{ \} as "escapes" % for the single characters \ { }. Thus, we end up with the "commands" % that would be written @\ @{ @} in a Texinfo document. % % We already have @{ and @}. For @\, we define it here, and only for % this purpose, to produce a typewriter backslash (so, the @\ that we % define for @math can't be used with @macro calls): % \def\\{\normalbackslash}% % % We would like to do this for \, too, since that is what makeinfo does. % But it is not possible, because Texinfo already has a command @, for a % cedilla accent. Documents must use @comma{} instead. % % \anythingelse will almost certainly be an error of some kind. % \mbodybackslash is the definition of \ in @macro bodies. % It maps \foo\ => \csname macarg.foo\endcsname => #N % where N is the macro parameter number. % We define \csname macarg.\endcsname to be \realbackslash, so % \\ in macro replacement text gets you a backslash. % {\catcode`@=0 @catcode`@\=@active @gdef@usembodybackslash{@let\=@mbodybackslash} @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname} } \expandafter\def\csname macarg.\endcsname{\realbackslash} \def\margbackslash#1{\char`\#1 } \def\macro{\recursivefalse\parsearg\macroxxx} \def\rmacro{\recursivetrue\parsearg\macroxxx} \def\macroxxx#1{% \getargs{#1}% now \macname is the macname and \argl the arglist \ifx\argl\empty % no arguments \paramno=0\relax \else \expandafter\parsemargdef \argl;% \if\paramno>256\relax \ifx\eTeXversion\thisisundefined \errhelp = \EMsimple \errmessage{You need eTeX to compile a file with macros with more than 256 arguments} \fi \fi \fi \if1\csname ismacro.\the\macname\endcsname \message{Warning: redefining \the\macname}% \else \expandafter\ifx\csname \the\macname\endcsname \relax \else \errmessage{Macro name \the\macname\space already defined}\fi \global\cslet{macsave.\the\macname}{\the\macname}% \global\expandafter\let\csname ismacro.\the\macname\endcsname=1% \addtomacrolist{\the\macname}% \fi \begingroup \macrobodyctxt \ifrecursive \expandafter\parsermacbody \else \expandafter\parsemacbody \fi} \parseargdef\unmacro{% \if1\csname ismacro.#1\endcsname \global\cslet{#1}{macsave.#1}% \global\expandafter\let \csname ismacro.#1\endcsname=0% % Remove the macro name from \macrolist: \begingroup \expandafter\let\csname#1\endcsname \relax \let\definedummyword\unmacrodo \xdef\macrolist{\macrolist}% \endgroup \else \errmessage{Macro #1 not defined}% \fi } % Called by \do from \dounmacro on each macro. The idea is to omit any % macro definitions that have been changed to \relax. % \def\unmacrodo#1{% \ifx #1\relax % remove this \else \noexpand\definedummyword \noexpand#1% \fi } % This makes use of the obscure feature that if the last token of a % is #, then the preceding argument is delimited by % an opening brace, and that opening brace is not consumed. \def\getargs#1{\getargsxxx#1{}} \def\getargsxxx#1#{\getmacname #1 \relax\getmacargs} \def\getmacname#1 #2\relax{\macname={#1}} \def\getmacargs#1{\def\argl{#1}} % For macro processing make @ a letter so that we can make Texinfo private macro names. \edef\texiatcatcode{\the\catcode`\@} \catcode `@=11\relax % Parse the optional {params} list. Set up \paramno and \paramlist % so \defmacro knows what to do. Define \macarg.BLAH for each BLAH % in the params list to some hook where the argument si to be expanded. If % there are less than 10 arguments that hook is to be replaced by ##N where N % is the position in that list, that is to say the macro arguments are to be % defined `a la TeX in the macro body. % % That gets used by \mbodybackslash (above). % % We need to get `macro parameter char #' into several definitions. % The technique used is stolen from LaTeX: let \hash be something % unexpandable, insert that wherever you need a #, and then redefine % it to # just before using the token list produced. % % The same technique is used to protect \eatspaces till just before % the macro is used. % % If there are 10 or more arguments, a different technique is used, where the % hook remains in the body, and when macro is to be expanded the body is % processed again to replace the arguments. % % In that case, the hook is \the\toks N-1, and we simply set \toks N-1 to the % argument N value and then \edef the body (nothing else will expand because of % the catcode regime underwhich the body was input). % % If you compile with TeX (not eTeX), and you have macros with 10 or more % arguments, you need that no macro has more than 256 arguments, otherwise an % error is produced. \def\parsemargdef#1;{% \paramno=0\def\paramlist{}% \let\hash\relax \let\xeatspaces\relax \parsemargdefxxx#1,;,% % In case that there are 10 or more arguments we parse again the arguments % list to set new definitions for the \macarg.BLAH macros corresponding to % each BLAH argument. It was anyhow needed to parse already once this list % in order to count the arguments, and as macros with at most 9 arguments % are by far more frequent than macro with 10 or more arguments, defining % twice the \macarg.BLAH macros does not cost too much processing power. \ifnum\paramno<10\relax\else \paramno0\relax \parsemmanyargdef@@#1,;,% 10 or more arguments \fi } \def\parsemargdefxxx#1,{% \if#1;\let\next=\relax \else \let\next=\parsemargdefxxx \advance\paramno by 1 \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname {\xeatspaces{\hash\the\paramno}}% \edef\paramlist{\paramlist\hash\the\paramno,}% \fi\next} \def\parsemmanyargdef@@#1,{% \if#1;\let\next=\relax \else \let\next=\parsemmanyargdef@@ \edef\tempb{\eatspaces{#1}}% \expandafter\def\expandafter\tempa \expandafter{\csname macarg.\tempb\endcsname}% % Note that we need some extra \noexpand\noexpand, this is because we % don't want \the to be expanded in the \parsermacbody as it uses an % \xdef . \expandafter\edef\tempa {\noexpand\noexpand\noexpand\the\toks\the\paramno}% \advance\paramno by 1\relax \fi\next} % These two commands read recursive and nonrecursive macro bodies. % (They're different since rec and nonrec macros end differently.) % \catcode `\@\texiatcatcode \long\def\parsemacbody#1@end macro% {\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% \long\def\parsermacbody#1@end rmacro% {\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% \catcode `\@=11\relax \let\endargs@\relax \let\nil@\relax \def\nilm@{\nil@}% \long\def\nillm@{\nil@}% % This macro is expanded during the Texinfo macro expansion, not during its % definition. It gets all the arguments values and assigns them to macros % macarg.ARGNAME % % #1 is the macro name % #2 is the list of argument names % #3 is the list of argument values \def\getargvals@#1#2#3{% \def\macargdeflist@{}% \def\saveparamlist@{#2}% Need to keep a copy for parameter expansion. \def\paramlist{#2,\nil@}% \def\macroname{#1}% \begingroup \macroargctxt \def\argvaluelist{#3,\nil@}% \def\@tempa{#3}% \ifx\@tempa\empty \setemptyargvalues@ \else \getargvals@@ \fi } % \def\getargvals@@{% \ifx\paramlist\nilm@ % Some sanity check needed here that \argvaluelist is also empty. \ifx\argvaluelist\nillm@ \else \errhelp = \EMsimple \errmessage{Too many arguments in macro `\macroname'!}% \fi \let\next\macargexpandinbody@ \else \ifx\argvaluelist\nillm@ % No more arguments values passed to macro. Set remaining named-arg % macros to empty. \let\next\setemptyargvalues@ \else % pop current arg name into \@tempb \def\@tempa##1{\pop@{\@tempb}{\paramlist}##1\endargs@}% \expandafter\@tempa\expandafter{\paramlist}% % pop current argument value into \@tempc \def\@tempa##1{\longpop@{\@tempc}{\argvaluelist}##1\endargs@}% \expandafter\@tempa\expandafter{\argvaluelist}% % Here \@tempb is the current arg name and \@tempc is the current arg value. % First place the new argument macro definition into \@tempd \expandafter\macname\expandafter{\@tempc}% \expandafter\let\csname macarg.\@tempb\endcsname\relax \expandafter\def\expandafter\@tempe\expandafter{% \csname macarg.\@tempb\endcsname}% \edef\@tempd{\long\def\@tempe{\the\macname}}% \push@\@tempd\macargdeflist@ \let\next\getargvals@@ \fi \fi \next } \def\push@#1#2{% \expandafter\expandafter\expandafter\def \expandafter\expandafter\expandafter#2% \expandafter\expandafter\expandafter{% \expandafter#1#2}% } % Replace arguments by their values in the macro body, and place the result % in macro \@tempa \def\macvalstoargs@{% % To do this we use the property that token registers that are \the'ed % within an \edef expand only once. So we are going to place all argument % values into respective token registers. % % First we save the token context, and initialize argument numbering. \begingroup \paramno0\relax % Then, for each argument number #N, we place the corresponding argument % value into a new token list register \toks#N \expandafter\putargsintokens@\saveparamlist@,;,% % Then, we expand the body so that argument are replaced by their % values. The trick for values not to be expanded themselves is that they % are within tokens and that tokens expand only once in an \edef . \edef\@tempc{\csname mac.\macroname .body\endcsname}% % Now we restore the token stack pointer to free the token list registers % which we have used, but we make sure that expanded body is saved after % group. \expandafter \endgroup \expandafter\def\expandafter\@tempa\expandafter{\@tempc}% } \def\macargexpandinbody@{% %% Define the named-macro outside of this group and then close this group. \expandafter \endgroup \macargdeflist@ % First the replace in body the macro arguments by their values, the result % is in \@tempa . \macvalstoargs@ % Then we point at the \norecurse or \gobble (for recursive) macro value % with \@tempb . \expandafter\let\expandafter\@tempb\csname mac.\macroname .recurse\endcsname % Depending on whether it is recursive or not, we need some tailing % \egroup . \ifx\@tempb\gobble \let\@tempc\relax \else \let\@tempc\egroup \fi % And now we do the real job: \edef\@tempd{\noexpand\@tempb{\macroname}\noexpand\scanmacro{\@tempa}\@tempc}% \@tempd } \def\putargsintokens@#1,{% \if#1;\let\next\relax \else \let\next\putargsintokens@ % First we allocate the new token list register, and give it a temporary % alias \@tempb . \toksdef\@tempb\the\paramno % Then we place the argument value into that token list register. \expandafter\let\expandafter\@tempa\csname macarg.#1\endcsname \expandafter\@tempb\expandafter{\@tempa}% \advance\paramno by 1\relax \fi \next } % Save the token stack pointer into macro #1 \def\texisavetoksstackpoint#1{\edef#1{\the\@cclvi}} % Restore the token stack pointer from number in macro #1 \def\texirestoretoksstackpoint#1{\expandafter\mathchardef\expandafter\@cclvi#1\relax} % newtoks that can be used non \outer . \def\texinonouternewtoks{\alloc@ 5\toks \toksdef \@cclvi} % Tailing missing arguments are set to empty \def\setemptyargvalues@{% \ifx\paramlist\nilm@ \let\next\macargexpandinbody@ \else \expandafter\setemptyargvaluesparser@\paramlist\endargs@ \let\next\setemptyargvalues@ \fi \next } \def\setemptyargvaluesparser@#1,#2\endargs@{% \expandafter\def\expandafter\@tempa\expandafter{% \expandafter\def\csname macarg.#1\endcsname{}}% \push@\@tempa\macargdeflist@ \def\paramlist{#2}% } % #1 is the element target macro % #2 is the list macro % #3,#4\endargs@ is the list value \def\pop@#1#2#3,#4\endargs@{% \def#1{#3}% \def#2{#4}% } \long\def\longpop@#1#2#3,#4\endargs@{% \long\def#1{#3}% \long\def#2{#4}% } % This defines a Texinfo @macro. There are eight cases: recursive and % nonrecursive macros of zero, one, up to nine, and many arguments. % Much magic with \expandafter here. % \xdef is used so that macro definitions will survive the file % they're defined in; @include reads the file inside a group. % \def\defmacro{% \let\hash=##% convert placeholders to macro parameter chars \ifrecursive \ifcase\paramno % 0 \expandafter\xdef\csname\the\macname\endcsname{% \noexpand\scanmacro{\temp}}% \or % 1 \expandafter\xdef\csname\the\macname\endcsname{% \bgroup\noexpand\macroargctxt \noexpand\braceorline \expandafter\noexpand\csname\the\macname xxx\endcsname}% \expandafter\xdef\csname\the\macname xxx\endcsname##1{% \egroup\noexpand\scanmacro{\temp}}% \else \ifnum\paramno<10\relax % at most 9 \expandafter\xdef\csname\the\macname\endcsname{% \bgroup\noexpand\macroargctxt \noexpand\csname\the\macname xx\endcsname}% \expandafter\xdef\csname\the\macname xx\endcsname##1{% \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% \expandafter\expandafter \expandafter\xdef \expandafter\expandafter \csname\the\macname xxx\endcsname \paramlist{\egroup\noexpand\scanmacro{\temp}}% \else % 10 or more \expandafter\xdef\csname\the\macname\endcsname{% \noexpand\getargvals@{\the\macname}{\argl}% }% \global\expandafter\let\csname mac.\the\macname .body\endcsname\temp \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\gobble \fi \fi \else \ifcase\paramno % 0 \expandafter\xdef\csname\the\macname\endcsname{% \noexpand\norecurse{\the\macname}% \noexpand\scanmacro{\temp}\egroup}% \or % 1 \expandafter\xdef\csname\the\macname\endcsname{% \bgroup\noexpand\macroargctxt \noexpand\braceorline \expandafter\noexpand\csname\the\macname xxx\endcsname}% \expandafter\xdef\csname\the\macname xxx\endcsname##1{% \egroup \noexpand\norecurse{\the\macname}% \noexpand\scanmacro{\temp}\egroup}% \else % at most 9 \ifnum\paramno<10\relax \expandafter\xdef\csname\the\macname\endcsname{% \bgroup\noexpand\macroargctxt \expandafter\noexpand\csname\the\macname xx\endcsname}% \expandafter\xdef\csname\the\macname xx\endcsname##1{% \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% \expandafter\expandafter \expandafter\xdef \expandafter\expandafter \csname\the\macname xxx\endcsname \paramlist{% \egroup \noexpand\norecurse{\the\macname}% \noexpand\scanmacro{\temp}\egroup}% \else % 10 or more: \expandafter\xdef\csname\the\macname\endcsname{% \noexpand\getargvals@{\the\macname}{\argl}% }% \global\expandafter\let\csname mac.\the\macname .body\endcsname\temp \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\norecurse \fi \fi \fi} \catcode `\@\texiatcatcode\relax \def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}} % \braceorline decides whether the next nonwhitespace character is a % {. If so it reads up to the closing }, if not, it reads the whole % line. Whatever was read is then fed to the next control sequence % as an argument (by \parsebrace or \parsearg). % \def\braceorline#1{\let\macnamexxx=#1\futurelet\nchar\braceorlinexxx} \def\braceorlinexxx{% \ifx\nchar\bgroup\else \expandafter\parsearg \fi \macnamexxx} % @alias. % We need some trickery to remove the optional spaces around the equal % sign. Make them active and then expand them all to nothing. % \def\alias{\parseargusing\obeyspaces\aliasxxx} \def\aliasxxx #1{\aliasyyy#1\relax} \def\aliasyyy #1=#2\relax{% {% \expandafter\let\obeyedspace=\empty \addtomacrolist{#1}% \xdef\next{\global\let\makecsname{#1}=\makecsname{#2}}% }% \next } \message{cross references,} \newwrite\auxfile \newif\ifhavexrefs % True if xref values are known. \newif\ifwarnedxrefs % True if we warned once that they aren't known. % @inforef is relatively simple. \def\inforef #1{\inforefzzz #1,,,,**} \def\inforefzzz #1,#2,#3,#4**{% \putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}}, node \samp{\ignorespaces#1{}}} % @node's only job in TeX is to define \lastnode, which is used in % cross-references. The @node line might or might not have commas, and % might or might not have spaces before the first comma, like: % @node foo , bar , ... % We don't want such trailing spaces in the node name. % \parseargdef\node{\checkenv{}\donode #1 ,\finishnodeparse} % % also remove a trailing comma, in case of something like this: % @node Help-Cross, , , Cross-refs \def\donode#1 ,#2\finishnodeparse{\dodonode #1,\finishnodeparse} \def\dodonode#1,#2\finishnodeparse{\gdef\lastnode{#1}} \let\nwnode=\node \let\lastnode=\empty % Write a cross-reference definition for the current node. #1 is the % type (Ynumbered, Yappendix, Ynothing). % \def\donoderef#1{% \ifx\lastnode\empty\else \setref{\lastnode}{#1}% \global\let\lastnode=\empty \fi } % @anchor{NAME} -- define xref target at arbitrary point. % \newcount\savesfregister % \def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi} \def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi} \def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces} % \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an % anchor), which consists of three parts: % 1) NAME-title - the current sectioning name taken from \lastsection, % or the anchor name. % 2) NAME-snt - section number and type, passed as the SNT arg, or % empty for anchors. % 3) NAME-pg - the page number. % % This is called from \donoderef, \anchor, and \dofloat. In the case of % floats, there is an additional part, which is not written here: % 4) NAME-lof - the text as it should appear in a @listoffloats. % \def\setref#1#2{% \pdfmkdest{#1}% \iflinks {% \atdummies % preserve commands, but don't expand them \edef\writexrdef##1##2{% \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef ##1}{##2}}% these are parameters of \writexrdef }% \toks0 = \expandafter{\lastsection}% \immediate \writexrdef{title}{\the\toks0 }% \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc. \safewhatsit{\writexrdef{pg}{\folio}}% will be written later, at \shipout }% \fi } % @xrefautosectiontitle on|off says whether @section(ing) names are used % automatically in xrefs, if the third arg is not explicitly specified. % This was provided as a "secret" @set xref-automatic-section-title % variable, now it's official. % \parseargdef\xrefautomaticsectiontitle{% \def\temp{#1}% \ifx\temp\onword \expandafter\let\csname SETxref-automatic-section-title\endcsname = \empty \else\ifx\temp\offword \expandafter\let\csname SETxref-automatic-section-title\endcsname = \relax \else \errhelp = \EMsimple \errmessage{Unknown @xrefautomaticsectiontitle value `\temp', must be on|off}% \fi\fi } % % @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is % the node name, #2 the name of the Info cross-reference, #3 the printed % node name, #4 the name of the Info file, #5 the name of the printed % manual. All but the node name can be omitted. % \def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]} \def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]} \def\ref#1{\xrefX[#1,,,,,,,]} % \newbox\toprefbox \newbox\printedrefnamebox \newbox\infofilenamebox \newbox\printedmanualbox % \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup \unsepspaces % % Get args without leading/trailing spaces. \def\printedrefname{\ignorespaces #3}% \setbox\printedrefnamebox = \hbox{\printedrefname\unskip}% % \def\infofilename{\ignorespaces #4}% \setbox\infofilenamebox = \hbox{\infofilename\unskip}% % \def\printedmanual{\ignorespaces #5}% \setbox\printedmanualbox = \hbox{\printedmanual\unskip}% % % If the printed reference name (arg #3) was not explicitly given in % the @xref, figure out what we want to use. \ifdim \wd\printedrefnamebox = 0pt % No printed node name was explicitly given. \expandafter\ifx\csname SETxref-automatic-section-title\endcsname \relax % Not auto section-title: use node name inside the square brackets. \def\printedrefname{\ignorespaces #1}% \else % Auto section-title: use chapter/section title inside % the square brackets if we have it. \ifdim \wd\printedmanualbox > 0pt % It is in another manual, so we don't have it; use node name. \def\printedrefname{\ignorespaces #1}% \else \ifhavexrefs % We (should) know the real title if we have the xref values. \def\printedrefname{\refx{#1-title}{}}% \else % Otherwise just copy the Info node name. \def\printedrefname{\ignorespaces #1}% \fi% \fi \fi \fi % % Make link in pdf output. \ifpdf {\indexnofonts \turnoffactive \makevalueexpandable % This expands tokens, so do it after making catcode changes, so _ % etc. don't get their TeX definitions. This ignores all spaces in % #4, including (wrongly) those in the middle of the filename. \getfilename{#4}% % % This (wrongly) does not take account of leading or trailing % spaces in #1, which should be ignored. \edef\pdfxrefdest{#1}% \ifx\pdfxrefdest\empty \def\pdfxrefdest{Top}% no empty targets \else \txiescapepdf\pdfxrefdest % escape PDF special chars \fi % \leavevmode \startlink attr{/Border [0 0 0]}% \ifnum\filenamelength>0 goto file{\the\filename.pdf} name{\pdfxrefdest}% \else goto name{\pdfmkpgn{\pdfxrefdest}}% \fi }% \setcolor{\linkcolor}% \fi % % Float references are printed completely differently: "Figure 1.2" % instead of "[somenode], p.3". We distinguish them by the % LABEL-title being set to a magic string. {% % Have to otherify everything special to allow the \csname to % include an _ in the xref name, etc. \indexnofonts \turnoffactive \expandafter\global\expandafter\let\expandafter\Xthisreftitle \csname XR#1-title\endcsname }% \iffloat\Xthisreftitle % If the user specified the print name (third arg) to the ref, % print it instead of our usual "Figure 1.2". \ifdim\wd\printedrefnamebox = 0pt \refx{#1-snt}{}% \else \printedrefname \fi % % If the user also gave the printed manual name (fifth arg), append % "in MANUALNAME". \ifdim \wd\printedmanualbox > 0pt \space \putwordin{} \cite{\printedmanual}% \fi \else % node/anchor (non-float) references. % % If we use \unhbox to print the node names, TeX does not insert % empty discretionaries after hyphens, which means that it will not % find a line break at a hyphen in a node names. Since some manuals % are best written with fairly long node names, containing hyphens, % this is a loss. Therefore, we give the text of the node name % again, so it is as if TeX is seeing it for the first time. % \ifdim \wd\printedmanualbox > 0pt % Cross-manual reference with a printed manual name. % \crossmanualxref{\cite{\printedmanual\unskip}}% % \else\ifdim \wd\infofilenamebox > 0pt % Cross-manual reference with only an info filename (arg 4), no % printed manual name (arg 5). This is essentially the same as % the case above; we output the filename, since we have nothing else. % \crossmanualxref{\code{\infofilename\unskip}}% % \else % Reference within this manual. % % _ (for example) has to be the character _ for the purposes of the % control sequence corresponding to the node, but it has to expand % into the usual \leavevmode...\vrule stuff for purposes of % printing. So we \turnoffactive for the \refx-snt, back on for the % printing, back off for the \refx-pg. {\turnoffactive % Only output a following space if the -snt ref is nonempty; for % @unnumbered and @anchor, it won't be. \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}% \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi }% % output the `[mynode]' via the macro below so it can be overridden. \xrefprintnodename\printedrefname % % But we always want a comma and a space: ,\space % % output the `page 3'. \turnoffactive \putwordpage\tie\refx{#1-pg}{}% \fi\fi \fi \endlink \endgroup} % Output a cross-manual xref to #1. Used just above (twice). % % Only include the text "Section ``foo'' in" if the foo is neither % missing or Top. Thus, @xref{,,,foo,The Foo Manual} outputs simply % "see The Foo Manual", the idea being to refer to the whole manual. % % But, this being TeX, we can't easily compare our node name against the % string "Top" while ignoring the possible spaces before and after in % the input. By adding the arbitrary 7sp below, we make it much less % likely that a real node name would have the same width as "Top" (e.g., % in a monospaced font). Hopefully it will never happen in practice. % % For the same basic reason, we retypeset the "Top" at every % reference, since the current font is indeterminate. % \def\crossmanualxref#1{% \setbox\toprefbox = \hbox{Top\kern7sp}% \setbox2 = \hbox{\ignorespaces \printedrefname \unskip \kern7sp}% \ifdim \wd2 > 7sp % nonempty? \ifdim \wd2 = \wd\toprefbox \else % same as Top? \putwordSection{} ``\printedrefname'' \putwordin{}\space \fi \fi #1% } % This macro is called from \xrefX for the `[nodename]' part of xref % output. It's a separate macro only so it can be changed more easily, % since square brackets don't work well in some documents. Particularly % one that Bob is working on :). % \def\xrefprintnodename#1{[#1]} % Things referred to by \setref. % \def\Ynothing{} \def\Yomitfromtoc{} \def\Ynumbered{% \ifnum\secno=0 \putwordChapter@tie \the\chapno \else \ifnum\subsecno=0 \putwordSection@tie \the\chapno.\the\secno \else \ifnum\subsubsecno=0 \putwordSection@tie \the\chapno.\the\secno.\the\subsecno \else \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno \fi\fi\fi } \def\Yappendix{% \ifnum\secno=0 \putwordAppendix@tie @char\the\appendixno{}% \else \ifnum\subsecno=0 \putwordSection@tie @char\the\appendixno.\the\secno \else \ifnum\subsubsecno=0 \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno \else \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno \fi\fi\fi } % Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME. % If its value is nonempty, SUFFIX is output afterward. % \def\refx#1#2{% {% \indexnofonts \otherbackslash \expandafter\global\expandafter\let\expandafter\thisrefX \csname XR#1\endcsname }% \ifx\thisrefX\relax % If not defined, say something at least. \angleleft un\-de\-fined\angleright \iflinks \ifhavexrefs {\toks0 = {#1}% avoid expansion of possibly-complex value \message{\linenumber Undefined cross reference `\the\toks0'.}}% \else \ifwarnedxrefs\else \global\warnedxrefstrue \message{Cross reference values unknown; you must run TeX again.}% \fi \fi \fi \else % It's defined, so just use it. \thisrefX \fi #2% Output the suffix in any case. } % This is the macro invoked by entries in the aux file. Usually it's % just a \def (we prepend XR to the control sequence name to avoid % collisions). But if this is a float type, we have more work to do. % \def\xrdef#1#2{% {% The node name might contain 8-bit characters, which in our current % implementation are changed to commands like @'e. Don't let these % mess up the control sequence name. \indexnofonts \turnoffactive \xdef\safexrefname{#1}% }% % \expandafter\gdef\csname XR\safexrefname\endcsname{#2}% remember this xref % % Was that xref control sequence that we just defined for a float? \expandafter\iffloat\csname XR\safexrefname\endcsname % it was a float, and we have the (safe) float type in \iffloattype. \expandafter\let\expandafter\floatlist \csname floatlist\iffloattype\endcsname % % Is this the first time we've seen this float type? \expandafter\ifx\floatlist\relax \toks0 = {\do}% yes, so just \do \else % had it before, so preserve previous elements in list. \toks0 = \expandafter{\floatlist\do}% \fi % % Remember this xref in the control sequence \floatlistFLOATTYPE, % for later use in \listoffloats. \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0 {\safexrefname}}% \fi } % Read the last existing aux file, if any. No error if none exists. % \def\tryauxfile{% \openin 1 \jobname.aux \ifeof 1 \else \readdatafile{aux}% \global\havexrefstrue \fi \closein 1 } \def\setupdatafile{% \catcode`\^^@=\other \catcode`\^^A=\other \catcode`\^^B=\other \catcode`\^^C=\other \catcode`\^^D=\other \catcode`\^^E=\other \catcode`\^^F=\other \catcode`\^^G=\other \catcode`\^^H=\other \catcode`\^^K=\other \catcode`\^^L=\other \catcode`\^^N=\other \catcode`\^^P=\other \catcode`\^^Q=\other \catcode`\^^R=\other \catcode`\^^S=\other \catcode`\^^T=\other \catcode`\^^U=\other \catcode`\^^V=\other \catcode`\^^W=\other \catcode`\^^X=\other \catcode`\^^Z=\other \catcode`\^^[=\other \catcode`\^^\=\other \catcode`\^^]=\other \catcode`\^^^=\other \catcode`\^^_=\other % It was suggested to set the catcode of ^ to 7, which would allow ^^e4 etc. % in xref tags, i.e., node names. But since ^^e4 notation isn't % supported in the main text, it doesn't seem desirable. Furthermore, % that is not enough: for node names that actually contain a ^ % character, we would end up writing a line like this: 'xrdef {'hat % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first % argument, and \hat is not an expandable control sequence. It could % all be worked out, but why? Either we support ^^ or we don't. % % The other change necessary for this was to define \auxhat: % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter % and then to call \auxhat in \setq. % \catcode`\^=\other % % Special characters. Should be turned off anyway, but... \catcode`\~=\other \catcode`\[=\other \catcode`\]=\other \catcode`\"=\other \catcode`\_=\other \catcode`\|=\other \catcode`\<=\other \catcode`\>=\other \catcode`\$=\other \catcode`\#=\other \catcode`\&=\other \catcode`\%=\other \catcode`+=\other % avoid \+ for paranoia even though we've turned it off % % This is to support \ in node names and titles, since the \ % characters end up in a \csname. It's easier than % leaving it active and making its active definition an actual \ % character. What I don't understand is why it works in the *value* % of the xrdef. Seems like it should be a catcode12 \, and that % should not typeset properly. But it works, so I'm moving on for % now. --karl, 15jan04. \catcode`\\=\other % % Make the characters 128-255 be printing characters. {% \count1=128 \def\loop{% \catcode\count1=\other \advance\count1 by 1 \ifnum \count1<256 \loop \fi }% }% % % @ is our escape character in .aux files, and we need braces. \catcode`\{=1 \catcode`\}=2 \catcode`\@=0 } \def\readdatafile#1{% \begingroup \setupdatafile \input\jobname.#1 \endgroup} \message{insertions,} % including footnotes. \newcount \footnoteno % The trailing space in the following definition for supereject is % vital for proper filling; pages come out unaligned when you do a % pagealignmacro call if that space before the closing brace is % removed. (Generally, numeric constants should always be followed by a % space to prevent strange expansion errors.) \def\supereject{\par\penalty -20000\footnoteno =0 } % @footnotestyle is meaningful for Info output only. \let\footnotestyle=\comment {\catcode `\@=11 % % Auto-number footnotes. Otherwise like plain. \gdef\footnote{% \let\indent=\ptexindent \let\noindent=\ptexnoindent \global\advance\footnoteno by \@ne \edef\thisfootno{$^{\the\footnoteno}$}% % % In case the footnote comes at the end of a sentence, preserve the % extra spacing after we do the footnote number. \let\@sf\empty \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\ptexslash\fi % % Remove inadvertent blank space before typesetting the footnote number. \unskip \thisfootno\@sf \dofootnote }% % Don't bother with the trickery in plain.tex to not require the % footnote text as a parameter. Our footnotes don't need to be so general. % % Oh yes, they do; otherwise, @ifset (and anything else that uses % \parseargline) fails inside footnotes because the tokens are fixed when % the footnote is read. --karl, 16nov96. % \gdef\dofootnote{% \insert\footins\bgroup % We want to typeset this text as a normal paragraph, even if the % footnote reference occurs in (for example) a display environment. % So reset some parameters. \hsize=\pagewidth \interlinepenalty\interfootnotelinepenalty \splittopskip\ht\strutbox % top baseline for broken footnotes \splitmaxdepth\dp\strutbox \floatingpenalty\@MM \leftskip\z@skip \rightskip\z@skip \spaceskip\z@skip \xspaceskip\z@skip \parindent\defaultparindent % \smallfonts \rm % % Because we use hanging indentation in footnotes, a @noindent appears % to exdent this text, so make it be a no-op. makeinfo does not use % hanging indentation so @noindent can still be needed within footnote % text after an @example or the like (not that this is good style). \let\noindent = \relax % % Hang the footnote text off the number. Use \everypar in case the % footnote extends for more than one paragraph. \everypar = {\hang}% \textindent{\thisfootno}% % % Don't crash into the line above the footnote text. Since this % expands into a box, it must come within the paragraph, lest it % provide a place where TeX can split the footnote. \footstrut % % Invoke rest of plain TeX footnote routine. \futurelet\next\fo@t } }%end \catcode `\@=11 % In case a @footnote appears in a vbox, save the footnote text and create % the real \insert just after the vbox finished. Otherwise, the insertion % would be lost. % Similarly, if a @footnote appears inside an alignment, save the footnote % text to a box and make the \insert when a row of the table is finished. % And the same can be done for other insert classes. --kasal, 16nov03. % Replace the \insert primitive by a cheating macro. % Deeper inside, just make sure that the saved insertions are not spilled % out prematurely. % \def\startsavinginserts{% \ifx \insert\ptexinsert \let\insert\saveinsert \else \let\checkinserts\relax \fi } % This \insert replacement works for both \insert\footins{foo} and % \insert\footins\bgroup foo\egroup, but it doesn't work for \insert27{foo}. % \def\saveinsert#1{% \edef\next{\noexpand\savetobox \makeSAVEname#1}% \afterassignment\next % swallow the left brace \let\temp = } \def\makeSAVEname#1{\makecsname{SAVE\expandafter\gobble\string#1}} \def\savetobox#1{\global\setbox#1 = \vbox\bgroup \unvbox#1} \def\checksaveins#1{\ifvoid#1\else \placesaveins#1\fi} \def\placesaveins#1{% \ptexinsert \csname\expandafter\gobblesave\string#1\endcsname {\box#1}% } % eat @SAVE -- beware, all of them have catcode \other: { \def\dospecials{\do S\do A\do V\do E} \uncatcodespecials % ;-) \gdef\gobblesave @SAVE{} } % initialization: \def\newsaveins #1{% \edef\next{\noexpand\newsaveinsX \makeSAVEname#1}% \next } \def\newsaveinsX #1{% \csname newbox\endcsname #1% \expandafter\def\expandafter\checkinserts\expandafter{\checkinserts \checksaveins #1}% } % initialize: \let\checkinserts\empty \newsaveins\footins \newsaveins\margin % @image. We use the macros from epsf.tex to support this. % If epsf.tex is not installed and @image is used, we complain. % % Check for and read epsf.tex up front. If we read it only at @image % time, we might be inside a group, and then its definitions would get % undone and the next image would fail. \openin 1 = epsf.tex \ifeof 1 \else % Do not bother showing banner with epsf.tex v2.7k (available in % doc/epsf.tex and on ctan). \def\epsfannounce{\toks0 = }% \input epsf.tex \fi \closein 1 % % We will only complain once about lack of epsf.tex. \newif\ifwarnednoepsf \newhelp\noepsfhelp{epsf.tex must be installed for images to work. It is also included in the Texinfo distribution, or you can get it from ftp://tug.org/tex/epsf.tex.} % \def\image#1{% \ifx\epsfbox\thisisundefined \ifwarnednoepsf \else \errhelp = \noepsfhelp \errmessage{epsf.tex not found, images will be ignored}% \global\warnednoepsftrue \fi \else \imagexxx #1,,,,,\finish \fi } % % Arguments to @image: % #1 is (mandatory) image filename; we tack on .eps extension. % #2 is (optional) width, #3 is (optional) height. % #4 is (ignored optional) html alt text. % #5 is (ignored optional) extension. % #6 is just the usual extra ignored arg for parsing stuff. \newif\ifimagevmode \def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup \catcode`\^^M = 5 % in case we're inside an example \normalturnoffactive % allow _ et al. in names % If the image is by itself, center it. \ifvmode \imagevmodetrue \else \ifx\centersub\centerV % for @center @image, we need a vbox so we can have our vertical space \imagevmodetrue \vbox\bgroup % vbox has better behavior than vtop herev \fi\fi % \ifimagevmode \nobreak\medskip % Usually we'll have text after the image which will insert % \parskip glue, so insert it here too to equalize the space % above and below. \nobreak\vskip\parskip \nobreak \fi % % Leave vertical mode so that indentation from an enclosing % environment such as @quotation is respected. % However, if we're at the top level, we don't want the % normal paragraph indentation. % On the other hand, if we are in the case of @center @image, we don't % want to start a paragraph, which will create a hsize-width box and % eradicate the centering. \ifx\centersub\centerV\else \noindent \fi % % Output the image. \ifpdf \dopdfimage{#1}{#2}{#3}% \else % \epsfbox itself resets \epsf?size at each figure. \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi \setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi \epsfbox{#1.eps}% \fi % \ifimagevmode \medskip % space after a standalone image \fi \ifx\centersub\centerV \egroup \fi \endgroup} % @float FLOATTYPE,LABEL,LOC ... @end float for displayed figures, tables, % etc. We don't actually implement floating yet, we always include the % float "here". But it seemed the best name for the future. % \envparseargdef\float{\eatcommaspace\eatcommaspace\dofloat#1, , ,\finish} % There may be a space before second and/or third parameter; delete it. \def\eatcommaspace#1, {#1,} % #1 is the optional FLOATTYPE, the text label for this float, typically % "Figure", "Table", "Example", etc. Can't contain commas. If omitted, % this float will not be numbered and cannot be referred to. % % #2 is the optional xref label. Also must be present for the float to % be referable. % % #3 is the optional positioning argument; for now, it is ignored. It % will somehow specify the positions allowed to float to (here, top, bottom). % % We keep a separate counter for each FLOATTYPE, which we reset at each % chapter-level command. \let\resetallfloatnos=\empty % \def\dofloat#1,#2,#3,#4\finish{% \let\thiscaption=\empty \let\thisshortcaption=\empty % % don't lose footnotes inside @float. % % BEWARE: when the floats start float, we have to issue warning whenever an % insert appears inside a float which could possibly float. --kasal, 26may04 % \startsavinginserts % % We can't be used inside a paragraph. \par % \vtop\bgroup \def\floattype{#1}% \def\floatlabel{#2}% \def\floatloc{#3}% we do nothing with this yet. % \ifx\floattype\empty \let\safefloattype=\empty \else {% % the floattype might have accents or other special characters, % but we need to use it in a control sequence name. \indexnofonts \turnoffactive \xdef\safefloattype{\floattype}% }% \fi % % If label is given but no type, we handle that as the empty type. \ifx\floatlabel\empty \else % We want each FLOATTYPE to be numbered separately (Figure 1, % Table 1, Figure 2, ...). (And if no label, no number.) % \expandafter\getfloatno\csname\safefloattype floatno\endcsname \global\advance\floatno by 1 % {% % This magic value for \lastsection is output by \setref as the % XREFLABEL-title value. \xrefX uses it to distinguish float % labels (which have a completely different output format) from % node and anchor labels. And \xrdef uses it to construct the % lists of floats. % \edef\lastsection{\floatmagic=\safefloattype}% \setref{\floatlabel}{Yfloat}% }% \fi % % start with \parskip glue, I guess. \vskip\parskip % % Don't suppress indentation if a float happens to start a section. \restorefirstparagraphindent } % we have these possibilities: % @float Foo,lbl & @caption{Cap}: Foo 1.1: Cap % @float Foo,lbl & no caption: Foo 1.1 % @float Foo & @caption{Cap}: Foo: Cap % @float Foo & no caption: Foo % @float ,lbl & Caption{Cap}: 1.1: Cap % @float ,lbl & no caption: 1.1 % @float & @caption{Cap}: Cap % @float & no caption: % \def\Efloat{% \let\floatident = \empty % % In all cases, if we have a float type, it comes first. \ifx\floattype\empty \else \def\floatident{\floattype}\fi % % If we have an xref label, the number comes next. \ifx\floatlabel\empty \else \ifx\floattype\empty \else % if also had float type, need tie first. \appendtomacro\floatident{\tie}% \fi % the number. \appendtomacro\floatident{\chaplevelprefix\the\floatno}% \fi % % Start the printed caption with what we've constructed in % \floatident, but keep it separate; we need \floatident again. \let\captionline = \floatident % \ifx\thiscaption\empty \else \ifx\floatident\empty \else \appendtomacro\captionline{: }% had ident, so need a colon between \fi % % caption text. \appendtomacro\captionline{\scanexp\thiscaption}% \fi % % If we have anything to print, print it, with space before. % Eventually this needs to become an \insert. \ifx\captionline\empty \else \vskip.5\parskip \captionline % % Space below caption. \vskip\parskip \fi % % If have an xref label, write the list of floats info. Do this % after the caption, to avoid chance of it being a breakpoint. \ifx\floatlabel\empty \else % Write the text that goes in the lof to the aux file as % \floatlabel-lof. Besides \floatident, we include the short % caption if specified, else the full caption if specified, else nothing. {% \atdummies % % since we read the caption text in the macro world, where ^^M % is turned into a normal character, we have to scan it back, so % we don't write the literal three characters "^^M" into the aux file. \scanexp{% \xdef\noexpand\gtemp{% \ifx\thisshortcaption\empty \thiscaption \else \thisshortcaption \fi }% }% \immediate\write\auxfile{@xrdef{\floatlabel-lof}{\floatident \ifx\gtemp\empty \else : \gtemp \fi}}% }% \fi \egroup % end of \vtop % % place the captured inserts % % BEWARE: when the floats start floating, we have to issue warning % whenever an insert appears inside a float which could possibly % float. --kasal, 26may04 % \checkinserts } % Append the tokens #2 to the definition of macro #1, not expanding either. % \def\appendtomacro#1#2{% \expandafter\def\expandafter#1\expandafter{#1#2}% } % @caption, @shortcaption % \def\caption{\docaption\thiscaption} \def\shortcaption{\docaption\thisshortcaption} \def\docaption{\checkenv\float \bgroup\scanargctxt\defcaption} \def\defcaption#1#2{\egroup \def#1{#2}} % The parameter is the control sequence identifying the counter we are % going to use. Create it if it doesn't exist and assign it to \floatno. \def\getfloatno#1{% \ifx#1\relax % Haven't seen this figure type before. \csname newcount\endcsname #1% % % Remember to reset this floatno at the next chap. \expandafter\gdef\expandafter\resetallfloatnos \expandafter{\resetallfloatnos #1=0 }% \fi \let\floatno#1% } % \setref calls this to get the XREFLABEL-snt value. We want an @xref % to the FLOATLABEL to expand to "Figure 3.1". We call \setref when we % first read the @float command. % \def\Yfloat{\floattype@tie \chaplevelprefix\the\floatno}% % Magic string used for the XREFLABEL-title value, so \xrefX can % distinguish floats from other xref types. \def\floatmagic{!!float!!} % #1 is the control sequence we are passed; we expand into a conditional % which is true if #1 represents a float ref. That is, the magic % \lastsection value which we \setref above. % \def\iffloat#1{\expandafter\doiffloat#1==\finish} % % #1 is (maybe) the \floatmagic string. If so, #2 will be the % (safe) float type for this float. We set \iffloattype to #2. % \def\doiffloat#1=#2=#3\finish{% \def\temp{#1}% \def\iffloattype{#2}% \ifx\temp\floatmagic } % @listoffloats FLOATTYPE - print a list of floats like a table of contents. % \parseargdef\listoffloats{% \def\floattype{#1}% floattype {% % the floattype might have accents or other special characters, % but we need to use it in a control sequence name. \indexnofonts \turnoffactive \xdef\safefloattype{\floattype}% }% % % \xrdef saves the floats as a \do-list in \floatlistSAFEFLOATTYPE. \expandafter\ifx\csname floatlist\safefloattype\endcsname \relax \ifhavexrefs % if the user said @listoffloats foo but never @float foo. \message{\linenumber No `\safefloattype' floats to list.}% \fi \else \begingroup \leftskip=\tocindent % indent these entries like a toc \let\do=\listoffloatsdo \csname floatlist\safefloattype\endcsname \endgroup \fi } % This is called on each entry in a list of floats. We're passed the % xref label, in the form LABEL-title, which is how we save it in the % aux file. We strip off the -title and look up \XRLABEL-lof, which % has the text we're supposed to typeset here. % % Figures without xref labels will not be included in the list (since % they won't appear in the aux file). % \def\listoffloatsdo#1{\listoffloatsdoentry#1\finish} \def\listoffloatsdoentry#1-title\finish{{% % Can't fully expand XR#1-lof because it can contain anything. Just % pass the control sequence. On the other hand, XR#1-pg is just the % page number, and we want to fully expand that so we can get a link % in pdf output. \toksA = \expandafter{\csname XR#1-lof\endcsname}% % % use the same \entry macro we use to generate the TOC and index. \edef\writeentry{\noexpand\entry{\the\toksA}{\csname XR#1-pg\endcsname}}% \writeentry }} \message{localization,} % For single-language documents, @documentlanguage is usually given very % early, just after @documentencoding. Single argument is the language % (de) or locale (de_DE) abbreviation. % { \catcode`\_ = \active \globaldefs=1 \parseargdef\documentlanguage{\begingroup \let_=\normalunderscore % normal _ character for filenames \tex % read txi-??.tex file in plain TeX. % Read the file by the name they passed if it exists. \openin 1 txi-#1.tex \ifeof 1 \documentlanguagetrywithoutunderscore{#1_\finish}% \else \globaldefs = 1 % everything in the txi-LL files needs to persist \input txi-#1.tex \fi \closein 1 \endgroup % end raw TeX \endgroup} % % If they passed de_DE, and txi-de_DE.tex doesn't exist, % try txi-de.tex. % \gdef\documentlanguagetrywithoutunderscore#1_#2\finish{% \openin 1 txi-#1.tex \ifeof 1 \errhelp = \nolanghelp \errmessage{Cannot read language file txi-#1.tex}% \else \globaldefs = 1 % everything in the txi-LL files needs to persist \input txi-#1.tex \fi \closein 1 } }% end of special _ catcode % \newhelp\nolanghelp{The given language definition file cannot be found or is empty. Maybe you need to install it? Putting it in the current directory should work if nowhere else does.} % This macro is called from txi-??.tex files; the first argument is the % \language name to set (without the "\lang@" prefix), the second and % third args are \{left,right}hyphenmin. % % The language names to pass are determined when the format is built. % See the etex.log file created at that time, e.g., % /usr/local/texlive/2008/texmf-var/web2c/pdftex/etex.log. % % With TeX Live 2008, etex now includes hyphenation patterns for all % available languages. This means we can support hyphenation in % Texinfo, at least to some extent. (This still doesn't solve the % accented characters problem.) % \catcode`@=11 \def\txisetlanguage#1#2#3{% % do not set the language if the name is undefined in the current TeX. \expandafter\ifx\csname lang@#1\endcsname \relax \message{no patterns for #1}% \else \global\language = \csname lang@#1\endcsname \fi % but there is no harm in adjusting the hyphenmin values regardless. \global\lefthyphenmin = #2\relax \global\righthyphenmin = #3\relax } % Helpers for encodings. % Set the catcode of characters 128 through 255 to the specified number. % \def\setnonasciicharscatcode#1{% \count255=128 \loop\ifnum\count255<256 \global\catcode\count255=#1\relax \advance\count255 by 1 \repeat } \def\setnonasciicharscatcodenonglobal#1{% \count255=128 \loop\ifnum\count255<256 \catcode\count255=#1\relax \advance\count255 by 1 \repeat } % @documentencoding sets the definition of non-ASCII characters % according to the specified encoding. % \parseargdef\documentencoding{% % Encoding being declared for the document. \def\declaredencoding{\csname #1.enc\endcsname}% % % Supported encodings: names converted to tokens in order to be able % to compare them with \ifx. \def\ascii{\csname US-ASCII.enc\endcsname}% \def\latnine{\csname ISO-8859-15.enc\endcsname}% \def\latone{\csname ISO-8859-1.enc\endcsname}% \def\lattwo{\csname ISO-8859-2.enc\endcsname}% \def\utfeight{\csname UTF-8.enc\endcsname}% % \ifx \declaredencoding \ascii \asciichardefs % \else \ifx \declaredencoding \lattwo \setnonasciicharscatcode\active \lattwochardefs % \else \ifx \declaredencoding \latone \setnonasciicharscatcode\active \latonechardefs % \else \ifx \declaredencoding \latnine \setnonasciicharscatcode\active \latninechardefs % \else \ifx \declaredencoding \utfeight \setnonasciicharscatcode\active \utfeightchardefs % \else \message{Unknown document encoding #1, ignoring.}% % \fi % utfeight \fi % latnine \fi % latone \fi % lattwo \fi % ascii } % A message to be logged when using a character that isn't available % the default font encoding (OT1). % \def\missingcharmsg#1{\message{Character missing in OT1 encoding: #1.}} % Take account of \c (plain) vs. \, (Texinfo) difference. \def\cedilla#1{\ifx\c\ptexc\c{#1}\else\,{#1}\fi} % First, make active non-ASCII characters in order for them to be % correctly categorized when TeX reads the replacement text of % macros containing the character definitions. \setnonasciicharscatcode\active % % Latin1 (ISO-8859-1) character definitions. \def\latonechardefs{% \gdef^^a0{\tie} \gdef^^a1{\exclamdown} \gdef^^a2{\missingcharmsg{CENT SIGN}} \gdef^^a3{{\pounds}} \gdef^^a4{\missingcharmsg{CURRENCY SIGN}} \gdef^^a5{\missingcharmsg{YEN SIGN}} \gdef^^a6{\missingcharmsg{BROKEN BAR}} \gdef^^a7{\S} \gdef^^a8{\"{}} \gdef^^a9{\copyright} \gdef^^aa{\ordf} \gdef^^ab{\guillemetleft} \gdef^^ac{$\lnot$} \gdef^^ad{\-} \gdef^^ae{\registeredsymbol} \gdef^^af{\={}} % \gdef^^b0{\textdegree} \gdef^^b1{$\pm$} \gdef^^b2{$^2$} \gdef^^b3{$^3$} \gdef^^b4{\'{}} \gdef^^b5{$\mu$} \gdef^^b6{\P} % \gdef^^b7{$^.$} \gdef^^b8{\cedilla\ } \gdef^^b9{$^1$} \gdef^^ba{\ordm} % \gdef^^bb{\guillemetright} \gdef^^bc{$1\over4$} \gdef^^bd{$1\over2$} \gdef^^be{$3\over4$} \gdef^^bf{\questiondown} % \gdef^^c0{\`A} \gdef^^c1{\'A} \gdef^^c2{\^A} \gdef^^c3{\~A} \gdef^^c4{\"A} \gdef^^c5{\ringaccent A} \gdef^^c6{\AE} \gdef^^c7{\cedilla C} \gdef^^c8{\`E} \gdef^^c9{\'E} \gdef^^ca{\^E} \gdef^^cb{\"E} \gdef^^cc{\`I} \gdef^^cd{\'I} \gdef^^ce{\^I} \gdef^^cf{\"I} % \gdef^^d0{\DH} \gdef^^d1{\~N} \gdef^^d2{\`O} \gdef^^d3{\'O} \gdef^^d4{\^O} \gdef^^d5{\~O} \gdef^^d6{\"O} \gdef^^d7{$\times$} \gdef^^d8{\O} \gdef^^d9{\`U} \gdef^^da{\'U} \gdef^^db{\^U} \gdef^^dc{\"U} \gdef^^dd{\'Y} \gdef^^de{\TH} \gdef^^df{\ss} % \gdef^^e0{\`a} \gdef^^e1{\'a} \gdef^^e2{\^a} \gdef^^e3{\~a} \gdef^^e4{\"a} \gdef^^e5{\ringaccent a} \gdef^^e6{\ae} \gdef^^e7{\cedilla c} \gdef^^e8{\`e} \gdef^^e9{\'e} \gdef^^ea{\^e} \gdef^^eb{\"e} \gdef^^ec{\`{\dotless i}} \gdef^^ed{\'{\dotless i}} \gdef^^ee{\^{\dotless i}} \gdef^^ef{\"{\dotless i}} % \gdef^^f0{\dh} \gdef^^f1{\~n} \gdef^^f2{\`o} \gdef^^f3{\'o} \gdef^^f4{\^o} \gdef^^f5{\~o} \gdef^^f6{\"o} \gdef^^f7{$\div$} \gdef^^f8{\o} \gdef^^f9{\`u} \gdef^^fa{\'u} \gdef^^fb{\^u} \gdef^^fc{\"u} \gdef^^fd{\'y} \gdef^^fe{\th} \gdef^^ff{\"y} } % Latin9 (ISO-8859-15) encoding character definitions. \def\latninechardefs{% % Encoding is almost identical to Latin1. \latonechardefs % \gdef^^a4{\euro} \gdef^^a6{\v S} \gdef^^a8{\v s} \gdef^^b4{\v Z} \gdef^^b8{\v z} \gdef^^bc{\OE} \gdef^^bd{\oe} \gdef^^be{\"Y} } % Latin2 (ISO-8859-2) character definitions. \def\lattwochardefs{% \gdef^^a0{\tie} \gdef^^a1{\ogonek{A}} \gdef^^a2{\u{}} \gdef^^a3{\L} \gdef^^a4{\missingcharmsg{CURRENCY SIGN}} \gdef^^a5{\v L} \gdef^^a6{\'S} \gdef^^a7{\S} \gdef^^a8{\"{}} \gdef^^a9{\v S} \gdef^^aa{\cedilla S} \gdef^^ab{\v T} \gdef^^ac{\'Z} \gdef^^ad{\-} \gdef^^ae{\v Z} \gdef^^af{\dotaccent Z} % \gdef^^b0{\textdegree} \gdef^^b1{\ogonek{a}} \gdef^^b2{\ogonek{ }} \gdef^^b3{\l} \gdef^^b4{\'{}} \gdef^^b5{\v l} \gdef^^b6{\'s} \gdef^^b7{\v{}} \gdef^^b8{\cedilla\ } \gdef^^b9{\v s} \gdef^^ba{\cedilla s} \gdef^^bb{\v t} \gdef^^bc{\'z} \gdef^^bd{\H{}} \gdef^^be{\v z} \gdef^^bf{\dotaccent z} % \gdef^^c0{\'R} \gdef^^c1{\'A} \gdef^^c2{\^A} \gdef^^c3{\u A} \gdef^^c4{\"A} \gdef^^c5{\'L} \gdef^^c6{\'C} \gdef^^c7{\cedilla C} \gdef^^c8{\v C} \gdef^^c9{\'E} \gdef^^ca{\ogonek{E}} \gdef^^cb{\"E} \gdef^^cc{\v E} \gdef^^cd{\'I} \gdef^^ce{\^I} \gdef^^cf{\v D} % \gdef^^d0{\DH} \gdef^^d1{\'N} \gdef^^d2{\v N} \gdef^^d3{\'O} \gdef^^d4{\^O} \gdef^^d5{\H O} \gdef^^d6{\"O} \gdef^^d7{$\times$} \gdef^^d8{\v R} \gdef^^d9{\ringaccent U} \gdef^^da{\'U} \gdef^^db{\H U} \gdef^^dc{\"U} \gdef^^dd{\'Y} \gdef^^de{\cedilla T} \gdef^^df{\ss} % \gdef^^e0{\'r} \gdef^^e1{\'a} \gdef^^e2{\^a} \gdef^^e3{\u a} \gdef^^e4{\"a} \gdef^^e5{\'l} \gdef^^e6{\'c} \gdef^^e7{\cedilla c} \gdef^^e8{\v c} \gdef^^e9{\'e} \gdef^^ea{\ogonek{e}} \gdef^^eb{\"e} \gdef^^ec{\v e} \gdef^^ed{\'{\dotless{i}}} \gdef^^ee{\^{\dotless{i}}} \gdef^^ef{\v d} % \gdef^^f0{\dh} \gdef^^f1{\'n} \gdef^^f2{\v n} \gdef^^f3{\'o} \gdef^^f4{\^o} \gdef^^f5{\H o} \gdef^^f6{\"o} \gdef^^f7{$\div$} \gdef^^f8{\v r} \gdef^^f9{\ringaccent u} \gdef^^fa{\'u} \gdef^^fb{\H u} \gdef^^fc{\"u} \gdef^^fd{\'y} \gdef^^fe{\cedilla t} \gdef^^ff{\dotaccent{}} } % UTF-8 character definitions. % % This code to support UTF-8 is based on LaTeX's utf8.def, with some % changes for Texinfo conventions. It is included here under the GPL by % permission from Frank Mittelbach and the LaTeX team. % \newcount\countUTFx \newcount\countUTFy \newcount\countUTFz \gdef\UTFviiiTwoOctets#1#2{\expandafter \UTFviiiDefined\csname u8:#1\string #2\endcsname} % \gdef\UTFviiiThreeOctets#1#2#3{\expandafter \UTFviiiDefined\csname u8:#1\string #2\string #3\endcsname} % \gdef\UTFviiiFourOctets#1#2#3#4{\expandafter \UTFviiiDefined\csname u8:#1\string #2\string #3\string #4\endcsname} \gdef\UTFviiiDefined#1{% \ifx #1\relax \message{\linenumber Unicode char \string #1 not defined for Texinfo}% \else \expandafter #1% \fi } \begingroup \catcode`\~13 \catcode`\"12 \def\UTFviiiLoop{% \global\catcode\countUTFx\active \uccode`\~\countUTFx \uppercase\expandafter{\UTFviiiTmp}% \advance\countUTFx by 1 \ifnum\countUTFx < \countUTFy \expandafter\UTFviiiLoop \fi} \countUTFx = "C2 \countUTFy = "E0 \def\UTFviiiTmp{% \xdef~{\noexpand\UTFviiiTwoOctets\string~}} \UTFviiiLoop \countUTFx = "E0 \countUTFy = "F0 \def\UTFviiiTmp{% \xdef~{\noexpand\UTFviiiThreeOctets\string~}} \UTFviiiLoop \countUTFx = "F0 \countUTFy = "F4 \def\UTFviiiTmp{% \xdef~{\noexpand\UTFviiiFourOctets\string~}} \UTFviiiLoop \endgroup \begingroup \catcode`\"=12 \catcode`\<=12 \catcode`\.=12 \catcode`\,=12 \catcode`\;=12 \catcode`\!=12 \catcode`\~=13 \gdef\DeclareUnicodeCharacter#1#2{% \countUTFz = "#1\relax %\wlog{\space\space defining Unicode char U+#1 (decimal \the\countUTFz)}% \begingroup \parseXMLCharref \def\UTFviiiTwoOctets##1##2{% \csname u8:##1\string ##2\endcsname}% \def\UTFviiiThreeOctets##1##2##3{% \csname u8:##1\string ##2\string ##3\endcsname}% \def\UTFviiiFourOctets##1##2##3##4{% \csname u8:##1\string ##2\string ##3\string ##4\endcsname}% \expandafter\expandafter\expandafter\expandafter \expandafter\expandafter\expandafter \gdef\UTFviiiTmp{#2}% \endgroup} \gdef\parseXMLCharref{% \ifnum\countUTFz < "A0\relax \errhelp = \EMsimple \errmessage{Cannot define Unicode char value < 00A0}% \else\ifnum\countUTFz < "800\relax \parseUTFviiiA,% \parseUTFviiiB C\UTFviiiTwoOctets.,% \else\ifnum\countUTFz < "10000\relax \parseUTFviiiA;% \parseUTFviiiA,% \parseUTFviiiB E\UTFviiiThreeOctets.{,;}% \else \parseUTFviiiA;% \parseUTFviiiA,% \parseUTFviiiA!% \parseUTFviiiB F\UTFviiiFourOctets.{!,;}% \fi\fi\fi } \gdef\parseUTFviiiA#1{% \countUTFx = \countUTFz \divide\countUTFz by 64 \countUTFy = \countUTFz \multiply\countUTFz by 64 \advance\countUTFx by -\countUTFz \advance\countUTFx by 128 \uccode `#1\countUTFx \countUTFz = \countUTFy} \gdef\parseUTFviiiB#1#2#3#4{% \advance\countUTFz by "#10\relax \uccode `#3\countUTFz \uppercase{\gdef\UTFviiiTmp{#2#3#4}}} \endgroup \def\utfeightchardefs{% \DeclareUnicodeCharacter{00A0}{\tie} \DeclareUnicodeCharacter{00A1}{\exclamdown} \DeclareUnicodeCharacter{00A3}{\pounds} \DeclareUnicodeCharacter{00A8}{\"{ }} \DeclareUnicodeCharacter{00A9}{\copyright} \DeclareUnicodeCharacter{00AA}{\ordf} \DeclareUnicodeCharacter{00AB}{\guillemetleft} \DeclareUnicodeCharacter{00AD}{\-} \DeclareUnicodeCharacter{00AE}{\registeredsymbol} \DeclareUnicodeCharacter{00AF}{\={ }} \DeclareUnicodeCharacter{00B0}{\ringaccent{ }} \DeclareUnicodeCharacter{00B4}{\'{ }} \DeclareUnicodeCharacter{00B8}{\cedilla{ }} \DeclareUnicodeCharacter{00BA}{\ordm} \DeclareUnicodeCharacter{00BB}{\guillemetright} \DeclareUnicodeCharacter{00BF}{\questiondown} \DeclareUnicodeCharacter{00C0}{\`A} \DeclareUnicodeCharacter{00C1}{\'A} \DeclareUnicodeCharacter{00C2}{\^A} \DeclareUnicodeCharacter{00C3}{\~A} \DeclareUnicodeCharacter{00C4}{\"A} \DeclareUnicodeCharacter{00C5}{\AA} \DeclareUnicodeCharacter{00C6}{\AE} \DeclareUnicodeCharacter{00C7}{\cedilla{C}} \DeclareUnicodeCharacter{00C8}{\`E} \DeclareUnicodeCharacter{00C9}{\'E} \DeclareUnicodeCharacter{00CA}{\^E} \DeclareUnicodeCharacter{00CB}{\"E} \DeclareUnicodeCharacter{00CC}{\`I} \DeclareUnicodeCharacter{00CD}{\'I} \DeclareUnicodeCharacter{00CE}{\^I} \DeclareUnicodeCharacter{00CF}{\"I} \DeclareUnicodeCharacter{00D0}{\DH} \DeclareUnicodeCharacter{00D1}{\~N} \DeclareUnicodeCharacter{00D2}{\`O} \DeclareUnicodeCharacter{00D3}{\'O} \DeclareUnicodeCharacter{00D4}{\^O} \DeclareUnicodeCharacter{00D5}{\~O} \DeclareUnicodeCharacter{00D6}{\"O} \DeclareUnicodeCharacter{00D8}{\O} \DeclareUnicodeCharacter{00D9}{\`U} \DeclareUnicodeCharacter{00DA}{\'U} \DeclareUnicodeCharacter{00DB}{\^U} \DeclareUnicodeCharacter{00DC}{\"U} \DeclareUnicodeCharacter{00DD}{\'Y} \DeclareUnicodeCharacter{00DE}{\TH} \DeclareUnicodeCharacter{00DF}{\ss} \DeclareUnicodeCharacter{00E0}{\`a} \DeclareUnicodeCharacter{00E1}{\'a} \DeclareUnicodeCharacter{00E2}{\^a} \DeclareUnicodeCharacter{00E3}{\~a} \DeclareUnicodeCharacter{00E4}{\"a} \DeclareUnicodeCharacter{00E5}{\aa} \DeclareUnicodeCharacter{00E6}{\ae} \DeclareUnicodeCharacter{00E7}{\cedilla{c}} \DeclareUnicodeCharacter{00E8}{\`e} \DeclareUnicodeCharacter{00E9}{\'e} \DeclareUnicodeCharacter{00EA}{\^e} \DeclareUnicodeCharacter{00EB}{\"e} \DeclareUnicodeCharacter{00EC}{\`{\dotless{i}}} \DeclareUnicodeCharacter{00ED}{\'{\dotless{i}}} \DeclareUnicodeCharacter{00EE}{\^{\dotless{i}}} \DeclareUnicodeCharacter{00EF}{\"{\dotless{i}}} \DeclareUnicodeCharacter{00F0}{\dh} \DeclareUnicodeCharacter{00F1}{\~n} \DeclareUnicodeCharacter{00F2}{\`o} \DeclareUnicodeCharacter{00F3}{\'o} \DeclareUnicodeCharacter{00F4}{\^o} \DeclareUnicodeCharacter{00F5}{\~o} \DeclareUnicodeCharacter{00F6}{\"o} \DeclareUnicodeCharacter{00F8}{\o} \DeclareUnicodeCharacter{00F9}{\`u} \DeclareUnicodeCharacter{00FA}{\'u} \DeclareUnicodeCharacter{00FB}{\^u} \DeclareUnicodeCharacter{00FC}{\"u} \DeclareUnicodeCharacter{00FD}{\'y} \DeclareUnicodeCharacter{00FE}{\th} \DeclareUnicodeCharacter{00FF}{\"y} \DeclareUnicodeCharacter{0100}{\=A} \DeclareUnicodeCharacter{0101}{\=a} \DeclareUnicodeCharacter{0102}{\u{A}} \DeclareUnicodeCharacter{0103}{\u{a}} \DeclareUnicodeCharacter{0104}{\ogonek{A}} \DeclareUnicodeCharacter{0105}{\ogonek{a}} \DeclareUnicodeCharacter{0106}{\'C} \DeclareUnicodeCharacter{0107}{\'c} \DeclareUnicodeCharacter{0108}{\^C} \DeclareUnicodeCharacter{0109}{\^c} \DeclareUnicodeCharacter{0118}{\ogonek{E}} \DeclareUnicodeCharacter{0119}{\ogonek{e}} \DeclareUnicodeCharacter{010A}{\dotaccent{C}} \DeclareUnicodeCharacter{010B}{\dotaccent{c}} \DeclareUnicodeCharacter{010C}{\v{C}} \DeclareUnicodeCharacter{010D}{\v{c}} \DeclareUnicodeCharacter{010E}{\v{D}} \DeclareUnicodeCharacter{0112}{\=E} \DeclareUnicodeCharacter{0113}{\=e} \DeclareUnicodeCharacter{0114}{\u{E}} \DeclareUnicodeCharacter{0115}{\u{e}} \DeclareUnicodeCharacter{0116}{\dotaccent{E}} \DeclareUnicodeCharacter{0117}{\dotaccent{e}} \DeclareUnicodeCharacter{011A}{\v{E}} \DeclareUnicodeCharacter{011B}{\v{e}} \DeclareUnicodeCharacter{011C}{\^G} \DeclareUnicodeCharacter{011D}{\^g} \DeclareUnicodeCharacter{011E}{\u{G}} \DeclareUnicodeCharacter{011F}{\u{g}} \DeclareUnicodeCharacter{0120}{\dotaccent{G}} \DeclareUnicodeCharacter{0121}{\dotaccent{g}} \DeclareUnicodeCharacter{0124}{\^H} \DeclareUnicodeCharacter{0125}{\^h} \DeclareUnicodeCharacter{0128}{\~I} \DeclareUnicodeCharacter{0129}{\~{\dotless{i}}} \DeclareUnicodeCharacter{012A}{\=I} \DeclareUnicodeCharacter{012B}{\={\dotless{i}}} \DeclareUnicodeCharacter{012C}{\u{I}} \DeclareUnicodeCharacter{012D}{\u{\dotless{i}}} \DeclareUnicodeCharacter{0130}{\dotaccent{I}} \DeclareUnicodeCharacter{0131}{\dotless{i}} \DeclareUnicodeCharacter{0132}{IJ} \DeclareUnicodeCharacter{0133}{ij} \DeclareUnicodeCharacter{0134}{\^J} \DeclareUnicodeCharacter{0135}{\^{\dotless{j}}} \DeclareUnicodeCharacter{0139}{\'L} \DeclareUnicodeCharacter{013A}{\'l} \DeclareUnicodeCharacter{0141}{\L} \DeclareUnicodeCharacter{0142}{\l} \DeclareUnicodeCharacter{0143}{\'N} \DeclareUnicodeCharacter{0144}{\'n} \DeclareUnicodeCharacter{0147}{\v{N}} \DeclareUnicodeCharacter{0148}{\v{n}} \DeclareUnicodeCharacter{014C}{\=O} \DeclareUnicodeCharacter{014D}{\=o} \DeclareUnicodeCharacter{014E}{\u{O}} \DeclareUnicodeCharacter{014F}{\u{o}} \DeclareUnicodeCharacter{0150}{\H{O}} \DeclareUnicodeCharacter{0151}{\H{o}} \DeclareUnicodeCharacter{0152}{\OE} \DeclareUnicodeCharacter{0153}{\oe} \DeclareUnicodeCharacter{0154}{\'R} \DeclareUnicodeCharacter{0155}{\'r} \DeclareUnicodeCharacter{0158}{\v{R}} \DeclareUnicodeCharacter{0159}{\v{r}} \DeclareUnicodeCharacter{015A}{\'S} \DeclareUnicodeCharacter{015B}{\'s} \DeclareUnicodeCharacter{015C}{\^S} \DeclareUnicodeCharacter{015D}{\^s} \DeclareUnicodeCharacter{015E}{\cedilla{S}} \DeclareUnicodeCharacter{015F}{\cedilla{s}} \DeclareUnicodeCharacter{0160}{\v{S}} \DeclareUnicodeCharacter{0161}{\v{s}} \DeclareUnicodeCharacter{0162}{\cedilla{t}} \DeclareUnicodeCharacter{0163}{\cedilla{T}} \DeclareUnicodeCharacter{0164}{\v{T}} \DeclareUnicodeCharacter{0168}{\~U} \DeclareUnicodeCharacter{0169}{\~u} \DeclareUnicodeCharacter{016A}{\=U} \DeclareUnicodeCharacter{016B}{\=u} \DeclareUnicodeCharacter{016C}{\u{U}} \DeclareUnicodeCharacter{016D}{\u{u}} \DeclareUnicodeCharacter{016E}{\ringaccent{U}} \DeclareUnicodeCharacter{016F}{\ringaccent{u}} \DeclareUnicodeCharacter{0170}{\H{U}} \DeclareUnicodeCharacter{0171}{\H{u}} \DeclareUnicodeCharacter{0174}{\^W} \DeclareUnicodeCharacter{0175}{\^w} \DeclareUnicodeCharacter{0176}{\^Y} \DeclareUnicodeCharacter{0177}{\^y} \DeclareUnicodeCharacter{0178}{\"Y} \DeclareUnicodeCharacter{0179}{\'Z} \DeclareUnicodeCharacter{017A}{\'z} \DeclareUnicodeCharacter{017B}{\dotaccent{Z}} \DeclareUnicodeCharacter{017C}{\dotaccent{z}} \DeclareUnicodeCharacter{017D}{\v{Z}} \DeclareUnicodeCharacter{017E}{\v{z}} \DeclareUnicodeCharacter{01C4}{D\v{Z}} \DeclareUnicodeCharacter{01C5}{D\v{z}} \DeclareUnicodeCharacter{01C6}{d\v{z}} \DeclareUnicodeCharacter{01C7}{LJ} \DeclareUnicodeCharacter{01C8}{Lj} \DeclareUnicodeCharacter{01C9}{lj} \DeclareUnicodeCharacter{01CA}{NJ} \DeclareUnicodeCharacter{01CB}{Nj} \DeclareUnicodeCharacter{01CC}{nj} \DeclareUnicodeCharacter{01CD}{\v{A}} \DeclareUnicodeCharacter{01CE}{\v{a}} \DeclareUnicodeCharacter{01CF}{\v{I}} \DeclareUnicodeCharacter{01D0}{\v{\dotless{i}}} \DeclareUnicodeCharacter{01D1}{\v{O}} \DeclareUnicodeCharacter{01D2}{\v{o}} \DeclareUnicodeCharacter{01D3}{\v{U}} \DeclareUnicodeCharacter{01D4}{\v{u}} \DeclareUnicodeCharacter{01E2}{\={\AE}} \DeclareUnicodeCharacter{01E3}{\={\ae}} \DeclareUnicodeCharacter{01E6}{\v{G}} \DeclareUnicodeCharacter{01E7}{\v{g}} \DeclareUnicodeCharacter{01E8}{\v{K}} \DeclareUnicodeCharacter{01E9}{\v{k}} \DeclareUnicodeCharacter{01F0}{\v{\dotless{j}}} \DeclareUnicodeCharacter{01F1}{DZ} \DeclareUnicodeCharacter{01F2}{Dz} \DeclareUnicodeCharacter{01F3}{dz} \DeclareUnicodeCharacter{01F4}{\'G} \DeclareUnicodeCharacter{01F5}{\'g} \DeclareUnicodeCharacter{01F8}{\`N} \DeclareUnicodeCharacter{01F9}{\`n} \DeclareUnicodeCharacter{01FC}{\'{\AE}} \DeclareUnicodeCharacter{01FD}{\'{\ae}} \DeclareUnicodeCharacter{01FE}{\'{\O}} \DeclareUnicodeCharacter{01FF}{\'{\o}} \DeclareUnicodeCharacter{021E}{\v{H}} \DeclareUnicodeCharacter{021F}{\v{h}} \DeclareUnicodeCharacter{0226}{\dotaccent{A}} \DeclareUnicodeCharacter{0227}{\dotaccent{a}} \DeclareUnicodeCharacter{0228}{\cedilla{E}} \DeclareUnicodeCharacter{0229}{\cedilla{e}} \DeclareUnicodeCharacter{022E}{\dotaccent{O}} \DeclareUnicodeCharacter{022F}{\dotaccent{o}} \DeclareUnicodeCharacter{0232}{\=Y} \DeclareUnicodeCharacter{0233}{\=y} \DeclareUnicodeCharacter{0237}{\dotless{j}} \DeclareUnicodeCharacter{02DB}{\ogonek{ }} \DeclareUnicodeCharacter{1E02}{\dotaccent{B}} \DeclareUnicodeCharacter{1E03}{\dotaccent{b}} \DeclareUnicodeCharacter{1E04}{\udotaccent{B}} \DeclareUnicodeCharacter{1E05}{\udotaccent{b}} \DeclareUnicodeCharacter{1E06}{\ubaraccent{B}} \DeclareUnicodeCharacter{1E07}{\ubaraccent{b}} \DeclareUnicodeCharacter{1E0A}{\dotaccent{D}} \DeclareUnicodeCharacter{1E0B}{\dotaccent{d}} \DeclareUnicodeCharacter{1E0C}{\udotaccent{D}} \DeclareUnicodeCharacter{1E0D}{\udotaccent{d}} \DeclareUnicodeCharacter{1E0E}{\ubaraccent{D}} \DeclareUnicodeCharacter{1E0F}{\ubaraccent{d}} \DeclareUnicodeCharacter{1E1E}{\dotaccent{F}} \DeclareUnicodeCharacter{1E1F}{\dotaccent{f}} \DeclareUnicodeCharacter{1E20}{\=G} \DeclareUnicodeCharacter{1E21}{\=g} \DeclareUnicodeCharacter{1E22}{\dotaccent{H}} \DeclareUnicodeCharacter{1E23}{\dotaccent{h}} \DeclareUnicodeCharacter{1E24}{\udotaccent{H}} \DeclareUnicodeCharacter{1E25}{\udotaccent{h}} \DeclareUnicodeCharacter{1E26}{\"H} \DeclareUnicodeCharacter{1E27}{\"h} \DeclareUnicodeCharacter{1E30}{\'K} \DeclareUnicodeCharacter{1E31}{\'k} \DeclareUnicodeCharacter{1E32}{\udotaccent{K}} \DeclareUnicodeCharacter{1E33}{\udotaccent{k}} \DeclareUnicodeCharacter{1E34}{\ubaraccent{K}} \DeclareUnicodeCharacter{1E35}{\ubaraccent{k}} \DeclareUnicodeCharacter{1E36}{\udotaccent{L}} \DeclareUnicodeCharacter{1E37}{\udotaccent{l}} \DeclareUnicodeCharacter{1E3A}{\ubaraccent{L}} \DeclareUnicodeCharacter{1E3B}{\ubaraccent{l}} \DeclareUnicodeCharacter{1E3E}{\'M} \DeclareUnicodeCharacter{1E3F}{\'m} \DeclareUnicodeCharacter{1E40}{\dotaccent{M}} \DeclareUnicodeCharacter{1E41}{\dotaccent{m}} \DeclareUnicodeCharacter{1E42}{\udotaccent{M}} \DeclareUnicodeCharacter{1E43}{\udotaccent{m}} \DeclareUnicodeCharacter{1E44}{\dotaccent{N}} \DeclareUnicodeCharacter{1E45}{\dotaccent{n}} \DeclareUnicodeCharacter{1E46}{\udotaccent{N}} \DeclareUnicodeCharacter{1E47}{\udotaccent{n}} \DeclareUnicodeCharacter{1E48}{\ubaraccent{N}} \DeclareUnicodeCharacter{1E49}{\ubaraccent{n}} \DeclareUnicodeCharacter{1E54}{\'P} \DeclareUnicodeCharacter{1E55}{\'p} \DeclareUnicodeCharacter{1E56}{\dotaccent{P}} \DeclareUnicodeCharacter{1E57}{\dotaccent{p}} \DeclareUnicodeCharacter{1E58}{\dotaccent{R}} \DeclareUnicodeCharacter{1E59}{\dotaccent{r}} \DeclareUnicodeCharacter{1E5A}{\udotaccent{R}} \DeclareUnicodeCharacter{1E5B}{\udotaccent{r}} \DeclareUnicodeCharacter{1E5E}{\ubaraccent{R}} \DeclareUnicodeCharacter{1E5F}{\ubaraccent{r}} \DeclareUnicodeCharacter{1E60}{\dotaccent{S}} \DeclareUnicodeCharacter{1E61}{\dotaccent{s}} \DeclareUnicodeCharacter{1E62}{\udotaccent{S}} \DeclareUnicodeCharacter{1E63}{\udotaccent{s}} \DeclareUnicodeCharacter{1E6A}{\dotaccent{T}} \DeclareUnicodeCharacter{1E6B}{\dotaccent{t}} \DeclareUnicodeCharacter{1E6C}{\udotaccent{T}} \DeclareUnicodeCharacter{1E6D}{\udotaccent{t}} \DeclareUnicodeCharacter{1E6E}{\ubaraccent{T}} \DeclareUnicodeCharacter{1E6F}{\ubaraccent{t}} \DeclareUnicodeCharacter{1E7C}{\~V} \DeclareUnicodeCharacter{1E7D}{\~v} \DeclareUnicodeCharacter{1E7E}{\udotaccent{V}} \DeclareUnicodeCharacter{1E7F}{\udotaccent{v}} \DeclareUnicodeCharacter{1E80}{\`W} \DeclareUnicodeCharacter{1E81}{\`w} \DeclareUnicodeCharacter{1E82}{\'W} \DeclareUnicodeCharacter{1E83}{\'w} \DeclareUnicodeCharacter{1E84}{\"W} \DeclareUnicodeCharacter{1E85}{\"w} \DeclareUnicodeCharacter{1E86}{\dotaccent{W}} \DeclareUnicodeCharacter{1E87}{\dotaccent{w}} \DeclareUnicodeCharacter{1E88}{\udotaccent{W}} \DeclareUnicodeCharacter{1E89}{\udotaccent{w}} \DeclareUnicodeCharacter{1E8A}{\dotaccent{X}} \DeclareUnicodeCharacter{1E8B}{\dotaccent{x}} \DeclareUnicodeCharacter{1E8C}{\"X} \DeclareUnicodeCharacter{1E8D}{\"x} \DeclareUnicodeCharacter{1E8E}{\dotaccent{Y}} \DeclareUnicodeCharacter{1E8F}{\dotaccent{y}} \DeclareUnicodeCharacter{1E90}{\^Z} \DeclareUnicodeCharacter{1E91}{\^z} \DeclareUnicodeCharacter{1E92}{\udotaccent{Z}} \DeclareUnicodeCharacter{1E93}{\udotaccent{z}} \DeclareUnicodeCharacter{1E94}{\ubaraccent{Z}} \DeclareUnicodeCharacter{1E95}{\ubaraccent{z}} \DeclareUnicodeCharacter{1E96}{\ubaraccent{h}} \DeclareUnicodeCharacter{1E97}{\"t} \DeclareUnicodeCharacter{1E98}{\ringaccent{w}} \DeclareUnicodeCharacter{1E99}{\ringaccent{y}} \DeclareUnicodeCharacter{1EA0}{\udotaccent{A}} \DeclareUnicodeCharacter{1EA1}{\udotaccent{a}} \DeclareUnicodeCharacter{1EB8}{\udotaccent{E}} \DeclareUnicodeCharacter{1EB9}{\udotaccent{e}} \DeclareUnicodeCharacter{1EBC}{\~E} \DeclareUnicodeCharacter{1EBD}{\~e} \DeclareUnicodeCharacter{1ECA}{\udotaccent{I}} \DeclareUnicodeCharacter{1ECB}{\udotaccent{i}} \DeclareUnicodeCharacter{1ECC}{\udotaccent{O}} \DeclareUnicodeCharacter{1ECD}{\udotaccent{o}} \DeclareUnicodeCharacter{1EE4}{\udotaccent{U}} \DeclareUnicodeCharacter{1EE5}{\udotaccent{u}} \DeclareUnicodeCharacter{1EF2}{\`Y} \DeclareUnicodeCharacter{1EF3}{\`y} \DeclareUnicodeCharacter{1EF4}{\udotaccent{Y}} \DeclareUnicodeCharacter{1EF8}{\~Y} \DeclareUnicodeCharacter{1EF9}{\~y} \DeclareUnicodeCharacter{2013}{--} \DeclareUnicodeCharacter{2014}{---} \DeclareUnicodeCharacter{2018}{\quoteleft} \DeclareUnicodeCharacter{2019}{\quoteright} \DeclareUnicodeCharacter{201A}{\quotesinglbase} \DeclareUnicodeCharacter{201C}{\quotedblleft} \DeclareUnicodeCharacter{201D}{\quotedblright} \DeclareUnicodeCharacter{201E}{\quotedblbase} \DeclareUnicodeCharacter{2022}{\bullet} \DeclareUnicodeCharacter{2026}{\dots} \DeclareUnicodeCharacter{2039}{\guilsinglleft} \DeclareUnicodeCharacter{203A}{\guilsinglright} \DeclareUnicodeCharacter{20AC}{\euro} \DeclareUnicodeCharacter{2192}{\expansion} \DeclareUnicodeCharacter{21D2}{\result} \DeclareUnicodeCharacter{2212}{\minus} \DeclareUnicodeCharacter{2217}{\point} \DeclareUnicodeCharacter{2261}{\equiv} }% end of \utfeightchardefs % US-ASCII character definitions. \def\asciichardefs{% nothing need be done \relax } % Make non-ASCII characters printable again for compatibility with % existing Texinfo documents that may use them, even without declaring a % document encoding. % \setnonasciicharscatcode \other \message{formatting,} \newdimen\defaultparindent \defaultparindent = 15pt \chapheadingskip = 15pt plus 4pt minus 2pt \secheadingskip = 12pt plus 3pt minus 2pt \subsecheadingskip = 9pt plus 2pt minus 2pt % Prevent underfull vbox error messages. \vbadness = 10000 % Don't be very finicky about underfull hboxes, either. \hbadness = 6666 % Following George Bush, get rid of widows and orphans. \widowpenalty=10000 \clubpenalty=10000 % Use TeX 3.0's \emergencystretch to help line breaking, but if we're % using an old version of TeX, don't do anything. We want the amount of % stretch added to depend on the line length, hence the dependence on % \hsize. We call this whenever the paper size is set. % \def\setemergencystretch{% \ifx\emergencystretch\thisisundefined % Allow us to assign to \emergencystretch anyway. \def\emergencystretch{\dimen0}% \else \emergencystretch = .15\hsize \fi } % Parameters in order: 1) textheight; 2) textwidth; % 3) voffset; 4) hoffset; 5) binding offset; 6) topskip; % 7) physical page height; 8) physical page width. % % We also call \setleading{\textleading}, so the caller should define % \textleading. The caller should also set \parskip. % \def\internalpagesizes#1#2#3#4#5#6#7#8{% \voffset = #3\relax \topskip = #6\relax \splittopskip = \topskip % \vsize = #1\relax \advance\vsize by \topskip \outervsize = \vsize \advance\outervsize by 2\topandbottommargin \pageheight = \vsize % \hsize = #2\relax \outerhsize = \hsize \advance\outerhsize by 0.5in \pagewidth = \hsize % \normaloffset = #4\relax \bindingoffset = #5\relax % \ifpdf \pdfpageheight #7\relax \pdfpagewidth #8\relax % if we don't reset these, they will remain at "1 true in" of % whatever layout pdftex was dumped with. \pdfhorigin = 1 true in \pdfvorigin = 1 true in \fi % \setleading{\textleading} % \parindent = \defaultparindent \setemergencystretch } % @letterpaper (the default). \def\letterpaper{{\globaldefs = 1 \parskip = 3pt plus 2pt minus 1pt \textleading = 13.2pt % % If page is nothing but text, make it come out even. \internalpagesizes{607.2pt}{6in}% that's 46 lines {\voffset}{.25in}% {\bindingoffset}{36pt}% {11in}{8.5in}% }} % Use @smallbook to reset parameters for 7x9.25 trim size. \def\smallbook{{\globaldefs = 1 \parskip = 2pt plus 1pt \textleading = 12pt % \internalpagesizes{7.5in}{5in}% {-.2in}{0in}% {\bindingoffset}{16pt}% {9.25in}{7in}% % \lispnarrowing = 0.3in \tolerance = 700 \hfuzz = 1pt \contentsrightmargin = 0pt \defbodyindent = .5cm }} % Use @smallerbook to reset parameters for 6x9 trim size. % (Just testing, parameters still in flux.) \def\smallerbook{{\globaldefs = 1 \parskip = 1.5pt plus 1pt \textleading = 12pt % \internalpagesizes{7.4in}{4.8in}% {-.2in}{-.4in}% {0pt}{14pt}% {9in}{6in}% % \lispnarrowing = 0.25in \tolerance = 700 \hfuzz = 1pt \contentsrightmargin = 0pt \defbodyindent = .4cm }} % Use @afourpaper to print on European A4 paper. \def\afourpaper{{\globaldefs = 1 \parskip = 3pt plus 2pt minus 1pt \textleading = 13.2pt % % Double-side printing via postscript on Laserjet 4050 % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm. % To change the settings for a different printer or situation, adjust % \normaloffset until the front-side and back-side texts align. Then % do the same for \bindingoffset. You can set these for testing in % your texinfo source file like this: % @tex % \global\normaloffset = -6mm % \global\bindingoffset = 10mm % @end tex \internalpagesizes{673.2pt}{160mm}% that's 51 lines {\voffset}{\hoffset}% {\bindingoffset}{44pt}% {297mm}{210mm}% % \tolerance = 700 \hfuzz = 1pt \contentsrightmargin = 0pt \defbodyindent = 5mm }} % Use @afivepaper to print on European A5 paper. % From romildo@urano.iceb.ufop.br, 2 July 2000. % He also recommends making @example and @lisp be small. \def\afivepaper{{\globaldefs = 1 \parskip = 2pt plus 1pt minus 0.1pt \textleading = 12.5pt % \internalpagesizes{160mm}{120mm}% {\voffset}{\hoffset}% {\bindingoffset}{8pt}% {210mm}{148mm}% % \lispnarrowing = 0.2in \tolerance = 800 \hfuzz = 1.2pt \contentsrightmargin = 0pt \defbodyindent = 2mm \tableindent = 12mm }} % A specific text layout, 24x15cm overall, intended for A4 paper. \def\afourlatex{{\globaldefs = 1 \afourpaper \internalpagesizes{237mm}{150mm}% {\voffset}{4.6mm}% {\bindingoffset}{7mm}% {297mm}{210mm}% % % Must explicitly reset to 0 because we call \afourpaper. \globaldefs = 0 }} % Use @afourwide to print on A4 paper in landscape format. \def\afourwide{{\globaldefs = 1 \afourpaper \internalpagesizes{241mm}{165mm}% {\voffset}{-2.95mm}% {\bindingoffset}{7mm}% {297mm}{210mm}% \globaldefs = 0 }} % @pagesizes TEXTHEIGHT[,TEXTWIDTH] % Perhaps we should allow setting the margins, \topskip, \parskip, % and/or leading, also. Or perhaps we should compute them somehow. % \parseargdef\pagesizes{\pagesizesyyy #1,,\finish} \def\pagesizesyyy#1,#2,#3\finish{{% \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi \globaldefs = 1 % \parskip = 3pt plus 2pt minus 1pt \setleading{\textleading}% % \dimen0 = #1\relax \advance\dimen0 by \voffset % \dimen2 = \hsize \advance\dimen2 by \normaloffset % \internalpagesizes{#1}{\hsize}% {\voffset}{\normaloffset}% {\bindingoffset}{44pt}% {\dimen0}{\dimen2}% }} % Set default to letter. % \letterpaper \message{and turning on texinfo input format.} \def^^L{\par} % remove \outer, so ^L can appear in an @comment % DEL is a comment character, in case @c does not suffice. \catcode`\^^? = 14 % Define macros to output various characters with catcode for normal text. \catcode`\"=\other \def\normaldoublequote{"} \catcode`\$=\other \def\normaldollar{$}%$ font-lock fix \catcode`\+=\other \def\normalplus{+} \catcode`\<=\other \def\normalless{<} \catcode`\>=\other \def\normalgreater{>} \catcode`\^=\other \def\normalcaret{^} \catcode`\_=\other \def\normalunderscore{_} \catcode`\|=\other \def\normalverticalbar{|} \catcode`\~=\other \def\normaltilde{~} % This macro is used to make a character print one way in \tt % (where it can probably be output as-is), and another way in other fonts, % where something hairier probably needs to be done. % % #1 is what to print if we are indeed using \tt; #2 is what to print % otherwise. Since all the Computer Modern typewriter fonts have zero % interword stretch (and shrink), and it is reasonable to expect all % typewriter fonts to have this, we can check that font parameter. % \def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi} % Same as above, but check for italic font. Actually this also catches % non-italic slanted fonts since it is impossible to distinguish them from % italic fonts. But since this is only used by $ and it uses \sl anyway % this is not a problem. \def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi} % Turn off all special characters except @ % (and those which the user can use as if they were ordinary). % Most of these we simply print from the \tt font, but for some, we can % use math or other variants that look better in normal text. \catcode`\"=\active \def\activedoublequote{{\tt\char34}} \let"=\activedoublequote \catcode`\~=\active \def\activetilde{{\tt\char126}} \let~ = \activetilde \chardef\hat=`\^ \catcode`\^=\active \def\activehat{{\tt \hat}} \let^ = \activehat \catcode`\_=\active \def_{\ifusingtt\normalunderscore\_} \let\realunder=_ % Subroutine for the previous macro. \def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em } \catcode`\|=\active \def|{{\tt\char124}} \chardef \less=`\< \catcode`\<=\active \def\activeless{{\tt \less}}\let< = \activeless \chardef \gtr=`\> \catcode`\>=\active \def\activegtr{{\tt \gtr}}\let> = \activegtr \catcode`\+=\active \def+{{\tt \char 43}} \catcode`\$=\active \def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix % used for headline/footline in the output routine, in case the page % breaks in the middle of an @tex block. \def\texinfochars{% \let< = \activeless \let> = \activegtr \let~ = \activetilde \let^ = \activehat \markupsetuplqdefault \markupsetuprqdefault % in principle, all other definitions in \tex have to be undone too. } % If a .fmt file is being used, characters that might appear in a file % name cannot be active until we have parsed the command line. % So turn them off again, and have \everyjob (or @setfilename) turn them on. % \otherifyactive is called near the end of this file. \def\otherifyactive{\catcode`+=\other \catcode`\_=\other} % Used sometimes to turn off (effectively) the active characters even after % parsing them. \def\turnoffactive{% \normalturnoffactive \otherbackslash } \catcode`\@=0 % \backslashcurfont outputs one backslash character in current font, % as in \char`\\. \global\chardef\backslashcurfont=`\\ \global\let\rawbackslashxx=\backslashcurfont % let existing .??s files work % \realbackslash is an actual character `\' with catcode other, and % \doublebackslash is two of them (for the pdf outlines). {\catcode`\\=\other @gdef@realbackslash{\} @gdef@doublebackslash{\\}} % In texinfo, backslash is an active character; it prints the backslash % in fixed width font. \catcode`\\=\active % @ for escape char from now on. % The story here is that in math mode, the \char of \backslashcurfont % ends up printing the roman \ from the math symbol font (because \char % in math mode uses the \mathcode, and plain.tex sets % \mathcode`\\="026E). It seems better for @backslashchar{} to always % print a typewriter backslash, hence we use an explicit \mathchar, % which is the decimal equivalent of "715c (class 7, e.g., use \fam; % ignored family value; char position "5C). We can't use " for the % usual hex value because it has already been made active. @def@normalbackslash{{@tt @ifmmode @mathchar29020 @else @backslashcurfont @fi}} @let@backslashchar = @normalbackslash % @backslashchar{} is for user documents. % On startup, @fixbackslash assigns: % @let \ = @normalbackslash % \rawbackslash defines an active \ to do \backslashcurfont. % \otherbackslash defines an active \ to be a literal `\' character with % catcode other. We switch back and forth between these. @gdef@rawbackslash{@let\=@backslashcurfont} @gdef@otherbackslash{@let\=@realbackslash} % Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of % the literal character `\'. Also revert - to its normal character, in % case the active - from code has slipped in. % {@catcode`- = @active @gdef@normalturnoffactive{% @let-=@normaldash @let"=@normaldoublequote @let$=@normaldollar %$ font-lock fix @let+=@normalplus @let<=@normalless @let>=@normalgreater @let\=@normalbackslash @let^=@normalcaret @let_=@normalunderscore @let|=@normalverticalbar @let~=@normaltilde @markupsetuplqdefault @markupsetuprqdefault @unsepspaces } } % Make _ and + \other characters, temporarily. % This is canceled by @fixbackslash. @otherifyactive % If a .fmt file is being used, we don't want the `\input texinfo' to show up. % That is what \eatinput is for; after that, the `\' should revert to printing % a backslash. % @gdef@eatinput input texinfo{@fixbackslash} @global@let\ = @eatinput % On the other hand, perhaps the file did not have a `\input texinfo'. Then % the first `\' in the file would cause an error. This macro tries to fix % that, assuming it is called before the first `\' could plausibly occur. % Also turn back on active characters that might appear in the input % file name, in case not using a pre-dumped format. % @gdef@fixbackslash{% @ifx\@eatinput @let\ = @normalbackslash @fi @catcode`+=@active @catcode`@_=@active } % Say @foo, not \foo, in error messages. @escapechar = `@@ % These (along with & and #) are made active for url-breaking, so need % active definitions as the normal characters. @def@normaldot{.} @def@normalquest{?} @def@normalslash{/} % These look ok in all fonts, so just make them not special. % @hashchar{} gets its own user-level command, because of #line. @catcode`@& = @other @def@normalamp{&} @catcode`@# = @other @def@normalhash{#} @catcode`@% = @other @def@normalpercent{%} @let @hashchar = @normalhash @c Finally, make ` and ' active, so that txicodequoteundirected and @c txicodequotebacktick work right in, e.g., @w{@code{`foo'}}. If we @c don't make ` and ' active, @code will not get them as active chars. @c Do this last of all since we use ` in the previous @catcode assignments. @catcode`@'=@active @catcode`@`=@active @markupsetuplqdefault @markupsetuprqdefault @c Local variables: @c eval: (add-hook 'write-file-hooks 'time-stamp) @c page-delimiter: "^\\\\message" @c time-stamp-start: "def\\\\texinfoversion{" @c time-stamp-format: "%:y-%02m-%02d.%02H" @c time-stamp-end: "}" @c End: @c vim:sw=2: @ignore arch-tag: e1b36e32-c96e-4135-a41a-0b2efa2ea115 @end ignore nco-5.3.3/autobld/ylwrap000077500000000000000000000143571477164337000152250ustar00rootroot00000000000000#! /bin/sh # ylwrap - wrapper for lex/yacc invocations. scriptversion=2011-08-25.18; # UTC # Copyright (C) 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2005, # 2007, 2009, 2010, 2011 Free Software Foundation, Inc. # # Written by Tom Tromey . # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . case "$1" in '') echo "$0: No files given. Try \`$0 --help' for more information." 1>&2 exit 1 ;; --basedir) basedir=$2 shift 2 ;; -h|--h*) cat <<\EOF Usage: ylwrap [--help|--version] INPUT [OUTPUT DESIRED]... -- PROGRAM [ARGS]... Wrapper for lex/yacc invocations, renaming files as desired. INPUT is the input file OUTPUT is one file PROG generates DESIRED is the file we actually want instead of OUTPUT PROGRAM is program to run ARGS are passed to PROG Any number of OUTPUT,DESIRED pairs may be used. Report bugs to . EOF exit $? ;; -v|--v*) echo "ylwrap $scriptversion" exit $? ;; esac # The input. input="$1" shift case "$input" in [\\/]* | ?:[\\/]*) # Absolute path; do nothing. ;; *) # Relative path. Make it absolute. input="`pwd`/$input" ;; esac pairlist= while test "$#" -ne 0; do if test "$1" = "--"; then shift break fi pairlist="$pairlist $1" shift done # The program to run. prog="$1" shift # Make any relative path in $prog absolute. case "$prog" in [\\/]* | ?:[\\/]*) ;; *[\\/]*) prog="`pwd`/$prog" ;; esac # FIXME: add hostname here for parallel makes that run commands on # other machines. But that might take us over the 14-char limit. dirname=ylwrap$$ do_exit="cd '`pwd`' && rm -rf $dirname > /dev/null 2>&1;"' (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 mkdir $dirname || exit 1 cd $dirname case $# in 0) "$prog" "$input" ;; *) "$prog" "$@" "$input" ;; esac ret=$? if test $ret -eq 0; then set X $pairlist shift first=yes # Since DOS filename conventions don't allow two dots, # the DOS version of Bison writes out y_tab.c instead of y.tab.c # and y_tab.h instead of y.tab.h. Test to see if this is the case. y_tab_nodot="no" if test -f y_tab.c || test -f y_tab.h; then y_tab_nodot="yes" fi # The directory holding the input. input_dir=`echo "$input" | sed -e 's,\([\\/]\)[^\\/]*$,\1,'` # Quote $INPUT_DIR so we can use it in a regexp. # FIXME: really we should care about more than `.' and `\'. input_rx=`echo "$input_dir" | sed 's,\\\\,\\\\\\\\,g;s,\\.,\\\\.,g'` while test "$#" -ne 0; do from="$1" # Handle y_tab.c and y_tab.h output by DOS if test $y_tab_nodot = "yes"; then if test $from = "y.tab.c"; then from="y_tab.c" else if test $from = "y.tab.h"; then from="y_tab.h" fi fi fi if test -f "$from"; then # If $2 is an absolute path name, then just use that, # otherwise prepend `../'. case "$2" in [\\/]* | ?:[\\/]*) target="$2";; *) target="../$2";; esac # We do not want to overwrite a header file if it hasn't # changed. This avoid useless recompilations. However the # parser itself (the first file) should always be updated, # because it is the destination of the .y.c rule in the # Makefile. Divert the output of all other files to a temporary # file so we can compare them to existing versions. if test $first = no; then realtarget="$target" target="tmp-`echo $target | sed s/.*[\\/]//g`" fi # Edit out `#line' or `#' directives. # # We don't want the resulting debug information to point at # an absolute srcdir; it is better for it to just mention the # .y file with no path. # # We want to use the real output file name, not yy.lex.c for # instance. # # We want the include guards to be adjusted too. FROM=`echo "$from" | sed \ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'\ -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'` TARGET=`echo "$2" | sed \ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'\ -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'` sed -e "/^#/!b" -e "s,$input_rx,," -e "s,$from,$2," \ -e "s,$FROM,$TARGET," "$from" >"$target" || ret=$? # Check whether header files must be updated. if test $first = no; then if test -f "$realtarget" && cmp -s "$realtarget" "$target"; then echo "$2" is unchanged rm -f "$target" else echo updating "$2" mv -f "$target" "$realtarget" fi fi else # A missing file is only an error for the first file. This # is a blatant hack to let us support using "yacc -d". If -d # is not specified, we don't want an error when the header # file is "missing". if test $first = yes; then ret=1 fi fi shift shift first=no done else ret=$? fi # Remove the directory. cd .. rm -rf $dirname exit $ret # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: nco-5.3.3/autogen.sh000077500000000000000000000063471477164337000143300ustar00rootroot00000000000000#! /bin/sh # Purpose: Configure NCO for CVS build # If you compile from a released tar-ball, do not run this script # Just run ./configure directly # Copyright (C) 2003--2009 Charlie Zender # License: GNU General Public License (GPL) Version 3 # See http://www.gnu.org/copyleft/gpl.html for full license text # Contributed to NCO by Magnus Hagdorn # Originally from the GIMP project's autogen.sh ACLOCAL=${ACLOCAL-aclocal} AUTOCONF=${AUTOCONF-autoconf} AUTOHEADER=${AUTOHEADER-autoheader} AUTOMAKE=${AUTOMAKE-automake} LIBTOOLIZE=${LIBTOOLIZE-libtoolize} AUTOCONF_REQUIRED_VERSION=2.54 AUTOMAKE_REQUIRED_VERSION=1.9.6 check_version () { VERSION_A=$1 VERSION_B=$2 save_ifs="$IFS" IFS=. set dummy $VERSION_A 0 0 0 MAJOR_A=$2 MINOR_A=$3 MICRO_A=$4 set dummy $VERSION_B 0 0 0 MAJOR_B=$2 MINOR_B=$3 MICRO_B=$4 IFS="$save_ifs" if expr "$MAJOR_A" = "$MAJOR_B" > /dev/null; then if expr "$MINOR_A" \> "$MINOR_B" > /dev/null; then echo "yes (version $VERSION_A)" elif expr "$MINOR_A" = "$MINOR_B" > /dev/null; then if expr "$MICRO_A" \>= "$MICRO_B" > /dev/null; then echo "yes (version $VERSION_A)" else echo "Too old (version $VERSION_A)" DIE=1 fi else echo "Too old (version $VERSION_A)" DIE=1 fi elif expr "$MAJOR_A" \> "$MAJOR_B" > /dev/null; then echo "Major version might be too new ($VERSION_A)" else echo "Too old (version $VERSION_A)" DIE=1 fi } echo echo Checking if required version of automake is installed echo DIE=0 echo -n "checking for autoconf >= $AUTOCONF_REQUIRED_VERSION ... " if ($AUTOCONF --version) < /dev/null > /dev/null 2>&1; then VER=`$AUTOCONF --version | head -n 1 \ | grep -iw autoconf | sed "s/.* \([0-9.]*\)[-a-z0-9]*$/\1/"` check_version $VER $AUTOCONF_REQUIRED_VERSION else echo echo " You must have autoconf installed to compile $PROJECT." echo " Download the appropriate package for your distribution," echo " or get the source tarball at ftp://ftp.gnu.org/pub/gnu/autoconf/" echo DIE=1; fi echo -n "checking for automake >= $AUTOMAKE_REQUIRED_VERSION ... " if ($AUTOMAKE --version) < /dev/null > /dev/null 2>&1; then AUTOMAKE=$AUTOMAKE ACLOCAL=$ACLOCAL elif (automake-1.10 --version) < /dev/null > /dev/null 2>&1; then AUTOMAKE=automake-1.10 ACLOCAL=aclocal-1.10 elif (automake-1.9 --version) < /dev/null > /dev/null 2>&1; then AUTOMAKE=automake-1.9 ACLOCAL=aclocal-1.9 else echo echo " You must have automake $AUTOMAKE_REQUIRED_VERSION or newer installed to compile $PROJECT." echo " Download the appropriate package for your distribution," echo " or get the source tarball at ftp://ftp.gnu.org/pub/gnu/automake/" echo DIE=1 fi if test x$AUTOMAKE != x; then VER=`$AUTOMAKE --version \ | grep automake | sed "s/.* \([0-9.]*\)[-a-z0-9]*$/\1/"` check_version $VER $AUTOMAKE_REQUIRED_VERSION fi if test "$DIE" -eq 1; then echo echo "Please install/upgrade the missing tools and call me again." echo exit 1 fi rm -rf autom4te.cache $ACLOCAL -I m4\ && $AUTOHEADER \ && $AUTOMAKE --foreign --add-missing \ && $AUTOCONF nco-5.3.3/bld/000077500000000000000000000000001477164337000130565ustar00rootroot00000000000000nco-5.3.3/bld/Makefile000066400000000000000000002454311477164337000145270ustar00rootroot00000000000000# $Header$ -*-makefile-*- # Purpose: GNU Makefile for NCO module nco # Requires GNU Make---AT&T Make chokes on GNU syntax # Copyright (C) 1994--present Charlie Zender # License: 3-Clause BSD License # See https://opensource.org/licenses/BSD-3-Clause for full license text # Quickie test copies: # scp ~/nco/bld/Makefile dust.ess.uci.edu:nco/bld # scp ~/nco/bld/Makefile grele.ess.uci.edu:nco/bld # scp ~/nco/bld/Makefile gplogin2.ps.uci.edu:nco/bld # scp ~/nco/bld/Makefile skyglow.ess.uci.edu:nco/bld # Machine build parameters # Source Method Packages Compiler # AppVeyor CI : NCO CMake All else MSVC # andes.olcf.ornl.gov: NCO Makefile All else GCC # cheyenne.ucar.edu : NCO Makefile All else Intel # firn.ess.uci.edu : NCO Configure All else Intel # frazil.ess.uci.edu : NCO Configure All else clang # glace.ess.uci.edu : NCO CMake All else GCC # grele.ess.uci.edu : NCO + netCDF Makefile All else GCC # katabatic.ess.uci.e: NCO CMake All else clang # sastrugi.ess.uci.ed: NCO + netCDF Configure All else clang # spectral.ess.uci.ed: NCO Configure All else clang # Usage (testing): # make tst # Vanilla regression test # make FL_FMT=netcdf4 tst # netCDF4 regression test # make MPI_PRC=3 tst # MPI regression test # make MPI_PRC=3 bm # MPI benchmarks # make THR_NBR=2 tst # OpenMP regression test # make THR_NBR=2 bm # OpenMP benchmarks # make MPI=Y # MPI features (HDF5 and PnetCDF I/O) # make NETCDF4=Y # netCDF4 features # make PNETCDF=Y # PnetCDF features # Usage (Compilation): # cd ~/nco/qt;qmake;make;cd - # Qt # cd ~/nco/bld;make;cd - # Default build # cd ~/nco/bld;make USR_TKN='-DHAVE_NC_RENAME_GRP';cd - # New API # cd ~/nco/bld;make UDUNITS_INC='/usr/include/udunits2';cd - # Fedora build # cd ~/nco/bld;make cln bin_cln;cd - # Clean all dependencies for fresh build # cd ~/nco/bld;make dir all; cd - # Create target directories then build # cd ~/nco/bld;make dbg;cd - # Print make diagnostics # cd ~/nco/bld;make DPKG=Y;cd - # Debian hardening # cd ~/nco/bld;make ESMF=Y;cd - # ESMF regridding # cd ~/nco/bld;make GSL=Y;cd - # GSL support # cd ~/nco/bld;make I18N=Y;cd - # Internationalization # cd ~/nco/bld;make lib_cln;cd - # Clean libraries # cd ~/nco/bld;make MPI=Y;cd - # MPI support # cd ~/nco/bld;make MPI_FAKE=Y;cd - # Spoof MPI support # cd ~/nco/bld;make OMP=Y;cd - # OpenMP support # cd ~/nco/bld;make OPTS=D;cd - # "Debugging": Enough symbols for debugging (default) # cd ~/nco/bld;make OPTS=O;cd - # "Optimize": For production (includes symbols) # cd ~/nco/bld;make OPTS=R;cd - # "Regular": No optimization or debugging # cd ~/nco/bld;make OPTS=X;cd - # "eXtreme": All debugging switches available # cd ~/nco/bld;make sys;cd - # Install in /usr/local (must sudo) # cd ~/nco/bld;make SZ=Y;cd - # Szip support # cd ~/nco/bld;make UDUNITS=Y;cd - # UDUnits support # cd ~/nco/bld;make --jobs=4;cd - # Parallel make # Normal (Linux) developer systems: # cd ~/nco/bld;make cln all ncap2;cd - # New default for most machines # cd ~/nco/bld;make OMP=Y CUDA=Y OPTS=D NETCDF4=Y UDUNITS=Y allinone;cd - # givre # cd ~/nco/bld;make OMP=Y OPTS=D NETCDF4=Y UDUNITS=Y allinone;cd - # givre, neige # cd ~/nco/bld;make OMP=Y OPTS=D NETCDF4=N UDUNITS=Y allinone;cd - # glace, virga # mpi-selector --set openmpi_gcc-1.3.3 # Then use /sopt/netcdf/netcdf3-gcc-serial serial libraries # mpi-selector --set mpich_pgi_1.2.7p1 # After compiling # cd ~/nco/bld;ANTLR_ROOT=/sopt/gfortran_g++ NETCDF_ROOT=/sopt/gfortran_g++ SZ_LIB=/sopt/lib UDUNITS_INC=/sopt/include UDUNITS_LIB=/sopt/lib make OMP=Y OPTS=D NETCDF4=Y SZ=Y UDUNITS=N allinone;cd - # greenplanet gcc # cd ~/nco/bld;ANTLR=/home/pvicente/install/antlr-2.7.7/bin/antlr ANTLR_ROOT=/home/pvicente/install/antlr-2.7.7 NETCDF_ROOT=/home/pvicente/install/netcdf-4.3.0 UDUNITS_INC=/home/pvicente/install/udunits-2.1.24/include UDUNITS_LIB=/home/pvicente/install/udunits-2.1.24/lib make OPTS=D allinone;cd - # greenplanet gcc pedro # cd ~/nco/bld;ANTLR=/sopt/ifort_icpc/bin/antlr ANTLR_ROOT=/sopt/ifort_icpc SZ_LIB=/sopt/lib UDUNITS_INC=/sopt/include UDUNITS_LIB=/sopt/lib make OMP=Y OPTS=D NETCDF4=Y SZ=Y UDUNITS=N allinone;cd - # greenplanet intel # cd ~/nco/bld;ANTLR=/sopt/pgf90_pgcc/bin/antlr ANTLR_ROOT=/sopt/pgf90_pgcc SZ_LIB=/sopt/lib UDUNITS_INC=/sopt/include UDUNITS_LIB=/sopt/lib make OMP=Y OPTS=D NETCDF4=N SZ=Y UDUNITS=N allinone;cd - # greenplanet pgi # cd ~/nco/bld;make OMP=Y OPTS=D NETCDF4=N UDUNITS=Y allinone;cd - # pbs # cd ~/nco/bld;make OMP=Y OPTS=D UDUNITS=Y UBUNTU_440=Y allinone # grele # cd ~/nco/bld;make NETCDF4=N all ncap2;cd - # tephra # cd ~/nco/bld;make OMP=Y OPTS=D NETCDF4=N UDUNITS=N allinone;cd - # silt, clay # cd ~/nco/bld;NETCDF_INC='/usr/include/netcdf-3' NETCDF_LIB='/usr/lib64' make GSL=N OMP=N OPTS=D NETCDF4=N UDUNITS=N allinone;cd - # snow # cd ~/nco/bld;make OMP=N OPTS=D NETCDF4=N UDUNITS=N USR_TKN='-DNEED_NC_INQ_FORMAT' allinone;cd - # snow w/OPeNDAP # cd ~/nco/bld;make OPTS=D USR_TKN='-DNEED_NC_INQ_FORMAT' allinone;cd - # 64-bit ABI on UCI MPC: # cd ~/nco/bld;env ANTLR='/software/antlr/bin/antlr' ANTLR_ROOT='/software/antlr' UDUNITS_INC='/software/udunits/include' UDUNITS_LIB='/software/udunits/lib' make --jobs=1 ABI=64 allinone;cd - # 64-bit ABI on UCI IPCC: # cd ~/nco/bld;env ANTLR='/usr/local/pgi/bin/antlr' ANTLR_ROOT='/usr/local/pgi' make --jobs=1 ABI=64 allinone;cd - # 64-bit ABI netCDF3 on NCAR AIX systems (bluefire): # cd ~/nco/bld;ANTLR='/contrib/antlr-2.7.7/bin/antlr' ANTLR_ROOT='/contrib/antlr-2.7.7' GSL_INC='/contrib/gsl-1.12/include' GSL_LIB='/contrib/gsl-1.12/lib' NETCDF_LIB='/usr/local/lib64/r4i4' UDUNITS_INC='/contrib/udunits-1.12.9/include' UDUNITS_LIB='/contrib/udunits-1.12.9/lib' make --jobs=1 OPTS=D NETCDF4=N UDUNITS=N allinone ABI=64;cd - # 64-bit ABI netCDF4 on NCAR AIX systems (bluefire): # cd ~/nco/bld;ANTLR='/contrib/antlr-2.7.7/bin/antlr' ANTLR_ROOT='/contrib/antlr-2.7.7' CURL_LIB='/contrib/curl/7.21.2/lib' GSL_INC='/contrib/gsl-1.12/include' GSL_LIB='/contrib/gsl-1.12/lib' HDF5_ROOT='/contrib/hdf5-1.8.7_seq' LDFLAGS='-lnetcdf -lhdf5_hl -lhdf5 -lz' NETCDF_ROOT='/contrib/netcdf/4.1.3_seq' SZ_LIB='/contrib/szip/lib' UDUNITS_LIB='/contrib/zlib/lib' make --jobs=1 OPTS=D SZ=Y allinone ABI=64;cd - # 64-bit ABI netCDF4 on NCAR AIX systems (bluefire): # cd ~/bin/AIX;/usr/local/bin/tar cvzf ~/nco-4.4.6.aix53.tar.gz nc*;scp ~/nco-4.4.6.aix53.tar.gz zender,nco@web.sf.net:/home/project-web/nco/htdocs/src # netCDF4 on NCAR Linux cluster systems (mirage): # cd ~/nco/bld;make OPTS=D allinone;cd - # netCDF4 on ORNL Linux cluster systems (titan, rhea.ccs.ornl.gov): # module avail # . ~/.bashrc # module add intel gsl # export LD_LIBRARY_PATH='/sw/redhat6/netcdf/4.1.3/rhel6.4_intel13.1.3/lib:/sw/redhat6/szip/2.1/rhel6.6_gnu4.8.2/lib':${LD_LIBRARY_PATH} # export NETCDF_ROOT='/sw/redhat6/netcdf/4.1.3/rhel6.4_intel13.1.3' # export PATH='/sw/redhat6/netcdf/4.1.3/rhel6.4_intel13.1.3/bin':${PATH} # cd ~/nco/bld;make ANTLR_ROOT=${HOME} NETCDF_ROOT='/sw/redhat6/netcdf/4.1.3/rhel6.4_intel13.1.3' SZ=Y SZ_LIB='/sw/redhat6/szip/2.1/rhel6.6_gnu4.8.2/lib' UDUNITS_INC='/sw/redhat6/udunits/2.1.24/rhel6.4_intel13.1.3/include' UDUNITS_LIB='/sw/redhat6/udunits/2.1.24/rhel6.4_intel13.1.3/lib' OPTS=D allinone;cd - # ncap2: # netCDF4 on NCAR Linux cluster systems (yellowstone): # /ncar/opt/hpss/hsi # Starts HPSS session # export PATH=${PATH}\:/ncar/opt/hpss # GNU (works): # module swap intel gnu;module add gsl;module add netcdf/4.3.0; # export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}\:/glade/apps/opt/udunits/2.1.24/gnu/default/lib # cd ~/nco/bld;make NETCDF_ROOT='/glade/apps/opt/netcdf/4.3.0/gnu/default' UDUNITS_INC='/glade/apps/opt/udunits/2.1.24/gnu/default/include' UDUNITS_LIB='/glade/apps/opt/udunits/2.1.24/gnu/default/lib' OPTS=D allinone;cd - # Intel (works as of 20140129): # module add intel;module add gsl;module add netcdf/4.3.0; # https://www2.cisl.ucar.edu/sites/default/files/Yellowstone_Started_Nov30-2.pdf # module add pnetcdf/1.4.1 # export PATH=${PATH}:/glade/apps/opt/netcdf/4.3.0/intel/12.1.5/bin # needed for ncgen # export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/glade/apps/opt/netcdf/4.3.0/intel/12.1.5/lib # needed to run NCO # cd ~/nco/bld;make NETCDF_ROOT='/glade/apps/opt/netcdf/4.3.0/intel/default' UDUNITS_INC='/glade/apps/opt/udunits/2.1.24/intel/12.1.4/include' UDUNITS_LIB='/glade/apps/opt/udunits/2.1.24/intel/12.1.4/lib' OPTS=D allinone;cd - # Cygwin on Windows Vista systems: # cd ~/nco/bld;ANTLR='antlr' make --jobs=1 GSL=Y OPTS=D NETCDF4=Y UDUNITS=Y allinone;cd - # cd ~/bin/WIN32;tar cvzf ~/nco-4.5.2.win32.cygwin.tar.gz nc* ; scp ~/nco-4.5.2.win32.cygwin.tar.gz zender,nco@web.sf.net:/home/project-web/nco/htdocs/src # Data files to dust # cd ~/nco/data;scp cmip5.nc obs.nc mdl_1.nc mdl_2.nc in_grp*.nc in.nc in_4c.nc dust.ess.uci.edu:/var/www/html/nco # Top-level tokens defining directory structure # These tokens may be over-ridden by environment variables or when invoking make, e.g., make OMP=Y MY_BLD_DIR := ../bld ifndef PVM_ARCH PVM_ARCH := $(shell ${MY_BLD_DIR}/pvmgetarch) endif ifndef MY_BIN_DIR MY_BIN_DIR := ../bin endif ifndef MY_LIB_DIR MY_LIB_DIR := ../lib endif ifndef MY_MAN_DIR MY_MAN_DIR := ../man endif ifndef MY_OBJ_DIR MY_OBJ_DIR := ../obj endif MY_BM_DIR := ../bm MY_DAT_DIR := ../data MY_DBN_DIR := ../debian MY_DOC_DIR := ../doc MY_DPN_DIR := ${MY_OBJ_DIR} MY_SRC_DIR := ../src/nco MY_INC_DIR := ${MY_SRC_DIR} NCO_CXX_SRC_DIR := ${MY_SRC_DIR}/../nco_c++ NCOXX_SRC_DIR := ${MY_SRC_DIR}/../nco++ # Primary tokens which determine build options # Specify non-default when invoking make, e.g. make OMP=Y ifndef ABI # 32- vs. 64-bit ABI: 32=32-bit mode, 64=64-bit mode (default) if available ABI := 64 endif # endif ABI ifndef CCACHE CCACHE := N endif # CCACHE ifndef CNK # Use newer netCDF4.1 chunking API CNK := Y endif # endif CNK ifndef CUDA CUDA := N endif # CUDA ifndef DAP DAP := Y endif # DAP ifndef DBG # Debugging token N=No (default) Y=Yes DBG := N endif # endif DBG ifndef DPKG # Debian hardening tokens DPKG := N endif # endif DPKG ifdef FL_FMT # Pass this netCDF4 argument to nco_bm.pl FL_FMT_SNG := "--fl_fmt=${FL_FMT}" else # endif FL_FMT FL_FMT_SNG := endif # endif FL_FMT ifndef GCC_RCH_ARG GCC_RCH_ARG := endif # endif GCC_RCH_ARG ifndef GSL # Use GSL functionality GSL := Y endif # endif GSL ifndef ICC_RCH_ARG ICC_RCH_ARG := endif # endif ICC_RCH_ARG ifndef I18N I18N := N endif ifndef NCO_YY_PFX NCO_YY_PFX := nco_yy endif ifndef MK_DPN MK_DPN = ${CPP} -M # NB: Recursive expansion required MK_DPN_CXX = ${CXX} -M # NB: Recursive expansion required endif # endif MK_DPN ifndef MPI # MPI MPI := N endif # endif MPI ifndef MPI_FAKE # MPI MPI_FAKE := N endif # endif MPI_FAKE ifndef NCO_BUILDENGINE NCO_BUILDENGINE := Traditional \(nco/bld/Makefile\) endif # NCO_BUILDENGINE ifndef NCO_VRS # Used for RPM building NCO_VRS := $(shell cat ${MY_DOC_DIR}/VERSION) endif ifndef NETCDF4 # netCDF4 support NETCDF4 := Y endif # endif NETCDF4 ifndef NETCDF_ROOT NETCDF_ROOT := /usr/local endif ifndef NETCDF4_ROOT NETCDF4_ROOT := ${NETCDF_ROOT} endif ifndef NETCDF_INC ifdef INC_NCAR NETCDF_INC := ${INC_NCAR} # NCAR module path else # endelse INC_NCAR NETCDF_INC := ${NETCDF_ROOT}/include # Directory containing netcdf.h endif # endif INC_NCAR endif # endif NETCDF_INC ifndef NETCDF_LIB ifdef LIB_NCAR NETCDF_LIB := ${LIB_NCAR} # NCAR module path else # endelse LIB_NCAR NETCDF_LIB := ${NETCDF_ROOT}/lib # Directory containing libnetcdf.a endif # endif LIB_NCAR endif # endif NETCDF_LIB ifndef ${OMP} # OpenMP OMP := N endif # endif OMP ifndef OPTS OPTS := D endif ifndef PGI_RCH_ARG PGI_RCH_ARG := endif # endif PGI_RCH_ARG ifndef PNETCDF # pnetCDF support PNETCDF := N endif # endif PNETCDF ifndef PSC_RCH_ARG PSC_RCH_ARG := endif # endif PSC_RCH_ARG ifndef RPM RPM := N endif # endif RPM ifndef STC # Created statically linked executable STC := N endif ifndef SZ # Link to Szip library SZ := N endif ifndef UDUNITS # Use UDUnits functionality UDUNITS := Y endif ifndef UNAMES UNAMES := $(shell uname -s) endif ifndef USR_TKN USR_TKN := endif # endif USR_TKN ifndef VRS_SNG # VRS_SNG := $(shell date +%Y%m%d) # 20150622 # VRS_SNG := $(shell git describe --abbrev=7 --dirty --always --tags) VRS_SNG := $(shell cat ${MY_DOC_DIR}/VERSION) endif # endif VRS_SNG ifndef ZNETCDF # znetcdf support ZNETCDF := N endif # endif ZNETCDF # Derived-tokens based on primary tokens # These tokens should not be altered by hand # NB: CPP_TKN is recursively expanded variable, define only when components are ready CPP_TKN = ${USR_TKN} -DNCO_BUILDENGINE='${NCO_BUILDENGINE}' -D${PVM_ARCH} -DNO_NETCDF_2 -DNCO_VERSION='${VRS_SNG}' -DHOSTNAME='${HOST}' -DUSER='${USER}' -UNCO_ABORT_ON_ERROR ifndef LFLAGS # Flags for Flex (Lex) LFLAGS := -P${NCO_YY_PFX} endif ifndef YFLAGS # Flags for Bison (Yacc) YFLAGS := -d --name-prefix=${NCO_YY_PFX} endif # Internationalize NCO with i18n features ifeq (${I18N},Y) MY_SHR_DIR := ${HOME}/share MY_ES_DIR := ${MY_SHR_DIR}/locale/es/LC_MESSAGES MY_FR_DIR := ${MY_SHR_DIR}/locale/fr/LC_MESSAGES endif # Message Passing Interface (MPI) ifeq (${MPI_FAKE},Y) # MPI_FAKE instructs make to compile mpnc*.c operators without defining ENABLE_MPI # Resulting executables use UP or SMP code not MPI code # This tests compile, link, execution of MPI mpnc*.c code without using any MPI calls MPI := Y endif # !MPI_FAKE ifdef MPI_PRC # MPI_PRC tells test scripts how many MPI processes to spawn # Pass this MPI argument to nco_bm.pl MPI_PRC_SNG := "--mpi_prc=${MPI_PRC}" # MPI_PRC implies MPI MPI := Y else # !MPI_PRC MPI_PRC_SNG := endif # !MPI_PRC # PnetCDF implies MPI ifeq (${PNETCDF},Y) MPI := Y endif # !PNETCDF LINUX_OR_MACOS := N ifneq (${null},$(findstring LINUX,${PVM_ARCH})) LINUX_OR_MACOS := Y endif ifneq (${null},$(findstring MACOS,${PVM_ARCH})) LINUX_OR_MACOS := Y endif # Decide among the plethora of compilers. Use names like LINUX_CC for historical reasons. ifeq (${LINUX_OR_MACOS},Y) ifndef LINUX_CXX # C++ compiler for Linux LINUX_CXX := g++ #LINUX_CXX := clang #LINUX_CXX := como #LINUX_CXX := icpc #LINUX_CXX := insure #LINUX_CXX := pathCC #LINUX_CXX := pgCC endif # endif LINUX_CXX ifndef LINUX_CC # C compiler for Linux LINUX_CC := gcc -std=c99 -pedantic -D_DEFAULT_SOURCE #LINUX_CC := clang #LINUX_CC := como --c99 #LINUX_CC := icc -std=c99 -D_DEFAULT_SOURCE #LINUX_CC := insure #LINUX_CC := nvcc #LINUX_CC := pathcc -std=c99 #LINUX_CC := pgcc -c9x endif # endif LINUX_CC ifndef LINUX_FC # Fortran compiler for Linux #LINUX_FC := g95 LINUX_FC := gfortran #LINUX_FC := ifort #LINUX_FC := lf95 #LINUX_FC := pathf95 #LINUX_FC := pgf90 endif # endif LINUX_CC endif # endif LINUX_OR_MACOS # OpenMP ifeq (${OMP},Y) ifdef THR_NBR # Pass this OpenMP argument to nco_bm.pl THR_NBR_SNG := "--thr_nbr=${THR_NBR}" else # endif THR_NBR THR_NBR_SNG := endif # endif THR_NBR endif # endif OMP ifeq (${RPM},Y) # rpm command, and thus RPM variables only guaranteed in RedHat Linux # Use recursive expansion so rpm command is not executed on non-RPM systems MDL_RPM_NST_NM = $(shell rpm -qa | grep nco-) # Name of installed package # MDL_RPM_PRV_NM = $(shell rpm -qp foo) # Name of package provided by specified RPM endif # endif RPM ifeq (${PVM_ARCH},WINOS) BNR_SFX := .exe else BNR_SFX := ${null} endif ifeq (${ESMF},Y) # Build ESMF-enabled NCO # Place ESMF block after DAP blocks for both to work together ifdef ESMF_INC ESMF_INC_FLG := -I${ESMF_INC} else ifdef ESMF_ROOT ifeq (${PVM_ARCH},MACOS) ESMF_INC_FLG := -I${ESMF_ROOT}/include/esmf else ESMF_INC_FLG := -I${ESMF_ROOT}/include endif # endif MACOS else ESMF_INC_FLG := -I/usr/local/include endif # endif ESMF_ROOT endif # endif ESMF_INC # 20150319: For some reason, ESMC.h #includes ESMC_VM.h which #includes mpi.h ifeq (${PVM_ARCH},MACOS) # Use stub header for uniprocessor MPI emulation provided by ESMF ESMF_INC_FLG += -I/Users/zender/data/esmf/src/Infrastructure/stubs/mpiuni ESMF_LIB_RT := ${null} ESMF_LIB_LAPACK := -llapack ESMF_LIB_XERCES := -lxerces-c else # endif MACOS # Use real MPI ESMF_INC_FLG += -I/usr/include/openmpi-x86_64 ESMF_LIB_RT := -lrt ESMF_LIB_LAPACK := ${null} ESMF_LIB_XERCES := ${null} endif # endif MACOS ifdef ESMF_LIB ESMF_LIB_FLG := -L${ESMF_LIB} -lesmf ${ESMF_LIB_LAPACK} ${ESMF_LIB_RT} ${ESMF_LIB_XERCES} -lgfortran -ldl -lnetcdff -lnetcdf_c++ else ifdef ESMF_ROOT ESMF_LIB_FLG := -L${ESMF_ROOT}/lib -lesmf ${ESMF_LIB_LAPACK} ${ESMF_LIB_RT} ${ESMF_LIB_XERCES} -lgfortran -ldl -lnetcdff -lnetcdf_c++ else ESMF_LIB_FLG := -L/usr/local/lib -lesmf ${ESMF_LIB_LAPACK} ${ESMF_LIB_RT} ${ESMF_LIB_XERCES} -lgfortran -ldl -lnetcdff -lnetcdf_c++ endif # endif ESMF_ROOT endif # endif ESMF_LIB endif # end if ESMF ifeq (${GSL},Y) # Build GSL-enabled NCO # Place GSL block after DAP blocks for both to work together ifdef GSL_ROOT GSL_CONFIG := ${GSL_ROOT}/bin/gsl-config else GSL_CONFIG := gsl-config endif ifdef GSL_INC GSL_INC_FLG := -I${GSL_INC} else GSL_INC_FLG := $(shell ${GSL_CONFIG} --cflags) endif # endif GSL_INC ifdef GSL_LIB GSL_LIB_FLG := -L${GSL_LIB} -lgsl -lgslcblas else GSL_LIB_FLG := $(shell ${GSL_CONFIG} --libs) endif # endif GSL_LIB ifndef GSL_MAJOR_VERSION # 20161118: Following line is always accurate GSL_MAJOR_VERSION := $(shell ${GSL_CONFIG} --version | cut -c 1 ) endif # endif GSL_MAJOR_VERSION ifndef GSL_MINOR_VERSION # gsl-config --version: 1.16 (old GSL versioning) # gsl-config --version: 2.2.1 (new GSL versioning) # GSL_MINOR_VERSION := $(shell ${GSL_CONFIG} --version ) ifeq (${GSL_MAJOR_VERSION},2) GSL_MINOR_VERSION := $(shell ${GSL_CONFIG} --version | cut -c 3 ) GSL_PATCH_VERSION := $(shell ${GSL_CONFIG} --version | cut -c 5 ) else # !GSL_MAJOR_VERSION GSL_MINOR_VERSION := $(shell ${GSL_CONFIG} --version | sed s/^[1-9]\.// ) GSL_PATCH_VERSION := 0 endif # !GSL_MAJOR_VERSION ifeq (${GSL_MINOR_VERSION},${null}) GSL_MINOR_VERSION := 4 GSL_PATCH_VERSION := 0 endif # end if GSL_MINOR_VERSION endif # endif GSL_PATCH_VERSION ifndef GSL_PATCH_VERSION GSL_PATCH_VERSION := 0 endif # endif GSL_PATCH_VERSION endif # end if GSL ifeq (${SZ},Y) # 20150515: -lsz needed (at least by icc) on rhea ifdef SZ_LIB SZ_LIB_FLG := -L${SZ_LIB} -lsz else SZ_LIB_FLG := -lsz endif # end if SZ_LIB endif # end if SZ ifeq (${UDUNITS},Y) # 20130607: -lexpat needed on .deb systems, not on RPM systems ifdef UDUNITS_INC UDUNITS_INC_FLG := -I${UDUNITS_INC} else UDUNITS_INC_FLG := -I/usr/include/udunits2 endif # endif UDUNITS_INC ifdef UDUNITS_LIB UDUNITS_LIB_FLG := -L${UDUNITS_LIB} -ludunits2 else UDUNITS_LIB_FLG := -ludunits2 endif # end if UDUNITS_LIB endif # end if UDUNITS # At this point we change NETCDF_INC from a directory to a flag NC_CFLAGS := $(shell ${NETCDF_ROOT}/bin/nc-config --cflags) NC_LDFLAGS := $(shell ${NETCDF_ROOT}/bin/nc-config --libs) NCO_LDFLAGS := -L${MY_LIB_DIR} -lnco ifeq (${MPI},Y) # Enable MPI functionality NC_CFLAGS := $(shell /usr/local/parallel/bin/nc-config --cflags) NC_LDFLAGS := $(shell /usr/local/parallel/bin/nc-config --libs) MPI_CFLAGS := -I/usr/include/openmpi-x86_64 MPI_LDFLAGS := -L/usr/lib64/openmpi/lib -lmpi endif # endif MPI ifdef LIB_NCAR NC_LDFLAGS := ${LIB_NCAR} ${NC_LDFLAGS} endif OTHER_CFLAGS := ${ESMF_INC_FLG} ${NC_CFLAGS} ${MPI_CFLAGS} ${GSL_INC_FLG} ${UDUNITS_INC_FLG} OTHER_LDFLAGS := ${NCO_LDFLAGS} ${ESMF_LIB_FLG} ${NC_LDFLAGS} ${MPI_LDFLAGS} ${GSL_LIB_FLG} ${SZ_LIB_FLG} ${UDUNITS_LIB_FLG} # NB: Do NOT add comment lines, e.g., # This is a comma, to character definitions null := space := ${null} ${null} comma := , newline := \n # '/' and '+' appear in filenames ('/' is directory separator) # Operating on these with Perl is problematic since they are special Rx characters # We replace `/' and '+' by non-special Rx's, call perl, then demangle # Unique character(s) to substitute for '/' and '+' before passing to perl Rx slash_rx := cszzsc plus_rx := xdikmj # Unique character(s) to replace by ${slash_rx} before passing to perl regex slash := / plus := + MY_OBJ_DIR_RX := $(subst ${slash},${slash_rx},${MY_OBJ_DIR}) MY_DPN_DIR_RX := $(subst ${slash},${slash_rx},${MY_DPN_DIR}) # Directories to search for source files MDL_PTH := ./ ${MY_SRC_DIR} # Find all C, C++, CUDA files in given directory FIND_FNC = $(wildcard ${dir}/*.cc ${dir}/*.c ${dir}/*.cu) # Assemble source files from all directories SRC_LST = $(foreach dir, ${MDL_PTH},$(FIND_FNC)) # Source file names with directories removed MDL_SRC := $(notdir $(SRC_LST)) # Dependency list for executable MDL_OBJ := $(addprefix ${MY_OBJ_DIR}/,$(addsuffix .o, $(basename ${MDL_SRC}))) # Dependency (make) file for each object file MDL_DPN := $(addprefix ${MY_DPN_DIR}/,$(addsuffix .d, $(basename ${MDL_SRC}))) # VPATH helps make find dependencies (which are not pathname qualified) in *.d file VPATH := $(subst ${space},:,${MDL_PTH}) # Prepend -I to use for compiler argument CPP_PTH := $(foreach dir,${MDL_PTH},-I${dir}) # Variables having to do with binary executables created by module MDL_BIN_TRG := ncap ncatted ncbo ncecat ncflint ncks ncpdq ncra ncrename ncwa # NCO binary targets MDL_BIN_SYM_LNK := ncdiff ncea nces ncrcat # Symbolic links MDL_BIN_SPT := ncclimo ncremap ncz2psx ncchecker # Scripts ifeq (${MPI},Y) # MDL_MPI_TRG := mpncbo mpncecat mpncflint mpncpdq mpncra mpncwa # MPI binary targets MDL_MPI_TRG := # MPI binary targets MDL_MPI_TRG_SMP := ncbo ncecat ncflint ncpdq ncra ncwa # MPI binary targets # MDL_MPI_SYM_LNK := mpncdiff mpncea mpnces mpncrcat # MPI Symbolic links MDL_MPI_SYM_LNK := # MPI Symbolic links MDL_MPI_STB := ${MDL_MPI_TRG} ${MDL_MPI_SYM_LNK} # All MPI files in MY_BIN_DIR MDL_MPI_BIN := $(addprefix ${MY_BIN_DIR}/,${MDL_MPI_TRG}) # mpi_cln removes these files MDL_MPI_OBJ := $(addsuffix .o,$(addprefix ${MY_OBJ_DIR}/,${MDL_MPI_TRG})) # mpi_cln removes these files MDL_BIN_TRG += ${MDL_MPI_TRG} # NCO binary targets MDL_BIN_SYM_LNK += ${MDL_MPI_SYM_LNK} # Symbolic links endif # endif MPI MDL_BIN_STB := ${MDL_BIN_TRG} ${MDL_BIN_SPT} ${MDL_BIN_SYM_LNK} # All NCO files in MY_BIN_DIR MDL_BIN := $(addprefix ${MY_BIN_DIR}/,${MDL_BIN_STB}) # distclean removes these files MDL_SPT_SRC := $(addprefix ${MY_DAT_DIR}/,${MDL_BIN_SPT}) # Variables having to do with header files created by module # List header targets alphabetically by "category": MDL_INC_TRG := # Raw (no functions) MDL_INC_TRG += libnco.h # libnco MDL_INC_SYM_LNK := # Symbolic links MDL_INC_STB = ${MDL_INC_TRG} ${MDL_INC_SYM_LNK} # All header files in ${MY_INC_DIR} MDL_INC = $(addprefix ${MY_INC_DIR}/,${MDL_INC_STB}) # dst_cln removes these files # Variables having to do with NCO data MDL_DAT_STB := 85 86 87 88 89 h0001 h0002 h0003 # Symbolic links to in.nc MDL_DAT_STB := $(addsuffix .nc,${MDL_DAT_STB}) # `make data' creates these files MDL_DAT := $(addprefix ${MY_DAT_DIR}/,${MDL_DAT_STB}) # `make distclean' removes these files # Variables having to do with NCO documentation MDL_DOC_SRC := $(addprefix ../,acinclude.m4 CMakeLists.txt configure.ac configure.eg Makefile.am) $(addprefix ${MY_DOC_DIR}/,nco.texi ANNOUNCE MANIFEST TODO VERSION beta.txt debian.txt dods.sh index.shtml xmp_cesm.html man_end.txt man_srt.txt ncap.txt nco_news.shtml nco_src_frg.txt opendap.sh) $(addprefix ${MY_DBN_DIR}/,changelog compat control copyright files info rules doc-base) # `make tags' includes these files MDL_DOC_TRG := nco.dvi nco.html nco.info nco.pdf nco.ps nco.txt nco.xml # `make doc' creates these files MDL_DOC := $(addprefix ${MY_DOC_DIR}/,${MDL_DOC_TRG}) # `make distclean' removes these files MDL_MAN := $(wildcard ${MY_MAN_DIR}/*.1) MDL_MAN := $(notdir ${MDL_MAN}) MDL_MAN := $(addprefix ${MY_MAN_DIR}/,${MDL_MAN}) # distclean removes these files # Variables having to do with NCO build MDL_BLD_SRC := $(addprefix ${MY_BLD_DIR}/,libnco_tst.c libnco_c++_tst.cc Makefile nco.spec nco_dst.pl) # `make tags' includes these files MDL_BLD_SRC += $(addprefix ${MY_BM_DIR}/,NCO_bm.pm NCO_benchmarks.pm NCO_rgr.pm nco_bm.pl nco_bm.sh mk_bm_plots.pl) # `make tags' includes these files MDL_BLD_SRC += $(addprefix ${MY_DAT_DIR}/,Makefile.am) $(addprefix ${MY_SRC_DIR}/,Makefile.am) $(addprefix ${MY_DOC_DIR}/,Makefile.am) $(addprefix ${NCO_CXX_SRC_DIR}/,Makefile.am) $(addprefix ${NCOXX_SRC_DIR}/,Makefile.am) # `make tags' includes these files # Files, if any, to exclude from tags #TAGS_FILTER_FILES := .//libnco_tst.c .//libnco_c++_tst.cc ../src/nco/lex.${NCO_YY_PFX}.c TAGS_FILTER_FILES := .//libnco_tst.c .//libnco_c++_tst.cc ../bld/lex.${NCO_YY_PFX}.c # TAGS_FILTER_FILES := .//libnco_tst.c .//libnco_c++_tst.cc # Variables having to do with ncap MDL_NCAP_SRC := $(addprefix ${MY_SRC_DIR}/,ncap_lex.l ncap_utl.h) # `make tags' includes these files MDL_NCAP_TRG := ncap_lex.c # `make ncap' creates these files MDL_NCAP := $(addprefix ${MY_SRC_DIR}/,${MDL_NCAP_TRG}) # `make distclean' removes these files # Variables having to do with C++ source and documentation # fxm: auto-generate source code components of C++ lists MDL_CXX_SRC := $(addprefix ${NCOXX_SRC_DIR}/,libnco++.hh Makefile.am Makefile.old ncap2.cc ncap2.hh ncap2_utl.cc NcapVar.cc NcapVar.hh NcapVarVector.cc NcapVarVector.hh NcapVector.hh ncoGrammar.g nco_antlr_pst_prc.pl fmc_cls.cc fmc_cls.hh fmc_all_cls.cc fmc_all_cls.hh fmc_gsl_cls.cc fmc_gsl_cls.hh Invoke.cc Invoke.hh map_srt_tmp.hh nco_gsl.cc nco_gsl.hh prs_cls.cc prs_cls.hh sdo_utl.cc sdo_utl.hh sym_cls.cc sym_cls.hh VarOp.hh vtl_cls.hh) $(addprefix ${NCO_CXX_SRC_DIR}/,INSTALL libnco_c++.hh Makefile.am Makefile.old nco_att.cc nco_att.hh nco_dmn.cc nco_dmn.hh nco_fl.cc nco_fl.hh nco_hgh.cc nco_hgh.hh nco_utl.cc nco_utl.hh nco_var.cc nco_var.hh README TODO tst.cc) # `make tags' includes these files TAGS_FILES := ${MY_SRC_DIR}/*.h $(filter-out ${TAGS_FILTER_FILES},${SRC_LST}) ${MDL_DOC_SRC} ${MDL_MAN} ${MDL_BLD_SRC} ${MDL_CXX_SRC} ${MDL_NCAP_SRC} ${MDL_SPT_SRC} # Redefine default C and C++ pattern rules ${MY_OBJ_DIR}/%.o : %.c ${CC} ${CPPFLAGS} ${CFLAGS} -c $< -o ${MY_OBJ_DIR}/$(notdir $@) ${MY_OBJ_DIR}/%.o : %.cu nvcc -deviceemu ${CPPFLAGS} ${CFLAGS} -c $< -o ${MY_OBJ_DIR}/$(notdir $@) ${MY_OBJ_DIR}/%.o : %.ccxb ${CXX} ${CPPFLAGS} ${CXXFLAGS} -c $< -o ${MY_OBJ_DIR}/$(notdir $@) # Default Fortran pattern rules: CRAY and RS6K must override these rules ${MY_OBJ_DIR}/%.o : %.F ${FC} ${CPPFLAGS} -c ${FFLAGS} -o ${MY_OBJ_DIR}/$(notdir $@) $< ${MY_OBJ_DIR}/%.o : %.f ${FC} -c ${FFLAGS} -o ${MY_OBJ_DIR}/$(notdir $@) $< # Rules for installing header files #${MY_INC_DIR}/%.h : %.h # cp -f -p $(notdir $@) $@ ${MY_INC_DIR}/%.hh : %.hh cp -f -p $(notdir $@) $@ # Rules for installing i18n files # -k_ : Treat underscore as keyword (so "_" is equivalent to "gettext") # --default-domain : Name of program or library # --join-existing : Join messages with existing file %.po : %.c xgettext --default-domain=$* -k_ --join-existing $< ${MY_ES_DIR}/%.mo : %.po # Linux version accepts more arguments than Solaris version # msgfmt --output-file=$@ --statistics $< msgfmt -o $@ $< # Automatically generate a dependency file for each source file # $* is the stem, e.g., f # $@ is the filename of the target, e.g., f.d # Linux gcc may return an extra `.F' on Fortran names, e.g., `hello.F.o: hello.F' # (.F)? gets rid of this extra `.F' ${MY_DPN_DIR}/%.d : %.F # Following command makes, e.g., f.d begin "f.o f.d : f.F ..." # Since f.o is not preceded by ${MY_OBJ_DIR}, objects are not recompiled when sources are touched. # ${MK_DPN} ${CPPFLAGS} $< | perl -p -e 's/$*\.F\.o/$*.o $@/g;' > $@ # Following command makes, e.g., f.d begin "/home/zender/obj/LINUX/f.o f.d : f.F ..." # This works fairly well, but is a hack # First pattern substitutes MY_OBJ_DIR_RX, which has placeholders for slashes # Second pattern substitutes slashes for the placeholders ${MK_DPN} ${CPPFLAGS} $< | perl -p -e 's/$*(\.F)?\.o/${MY_OBJ_DIR_RX}\/$*.o ${MY_DPN_DIR_RX}\/$(notdir $@)/g;s/${slash_rx}/\${slash}/g' > $@ # Following command makes, e.g., f.d begin "${MY_OBJ_DIR}/f.o f.d : f.F ..." # This would be the ideal command but I can't get the dollar sign to show up # ${MK_DPN} ${CPPFLAGS} $< | perl -p -e 's/$*\.F\.o/\${dollar}MY_OBJ_DIR\/$*.o $@/g;' > $@ ${MY_DPN_DIR}/%.d : %.c # ${MK_DPN} ${CPPFLAGS} $< | perl -p -e 's/$*\.o/$*.o $@/g;' > $@ ${MK_DPN} ${CPPFLAGS} $< | perl -p -e 's/$*\.o/${MY_OBJ_DIR_RX}\/$*.o ${MY_DPN_DIR_RX}\/$(notdir $@)/g;s/${slash_rx}/\${slash}/g' > $@ ${MY_DPN_DIR}/%.d : %.cu nvcc -M ${CPPFLAGS} $< | perl -p -e 's/$*\.o/${MY_OBJ_DIR_RX}\/$*.o ${MY_DPN_DIR_RX}\/$(notdir $@)/g;s/${slash_rx}/\${slash}/g' > $@ ${MY_DPN_DIR}/%.d : %.cc # NB: Use ${CXX} rather than ${CPP} on C++ files for now because, e.g., SUNMP cpp does not pre-process .cc files quite correctly # Extra hack to allow C++ filenames to contain '+' character # $(subst ${plus},${plus_rx},${*}) is filename stub with an Rx in place of '+' ${MK_DPN_CXX} ${CXXCPPFLAGS} $< | perl -p -e 's/\${plus}/${plus_rx}/g;s/$(subst ${plus},${plus_rx},${*})\.o/${MY_OBJ_DIR_RX}\/$*.o ${MY_DPN_DIR_RX}\/$(notdir $@)/g;s/${slash_rx}/\${slash}/g;s/${plus_rx}/\${plus}/g' > $@ # First LDFLAGS is for typical C programs with netCDF, math, and networking # Second LDFLAGS, when present, enables C/Fortran linking # Manually define autotools tokens normally defined with HAVE_CONFIG_H in config.h # Initialize OS-specific tokens to empty CPP_TKN_OS := -DHAVE_REGEX_H -DNCO_HAVE_REGEX_FUNCTIONALITY -DHAVE_GETPAGESIZE -DHAVE_GETRUSAGE -DNEED_STRCASESTR # Assume netCDF >= 3.6.1 CPP_TKN_OS += -DHAVE_NC_INQ_FORMAT # Assume netCDF >= 4.3.1 # NC_HAVE_RENAME_GRP replaced HAVE_NC_RENAME_GRP in netCDF 4.9.0 CPP_TKN_OS += -DHAVE_NC_RENAME_GRP -DNC_HAVE_RENAME_GRP # Assume netCDF >= 4.3.2 CPP_TKN_OS += -DHAVE_NC_INQ_PATH # Assume netCDF >= 4.6.1 CPP_TKN_OS += -DHAVE_NC_SET_LOG_LEVEL # Assume netCDF >= 4.4.0, but Ubuntu 4.4.0 (e.g., on grele) fumbled netcdf_mem.h header ifndef UBUNTU_440 CPP_TKN_OS += -DHAVE_NETCDF_MEM_H endif # !grele # gcc 4.7.3 finally includes strcasestr() in string.h iff _GNU_SOURCE token is defined # NB: C++ (or at least g++ 4.7.3) always includes strcasestr()---work around this with tokens in nco_sng_utl.[ch] ifneq (${PVM_ARCH},CRAY) CPP_TKN_OS += -DHAVE_MKSTEMP endif # CRAY ifneq (${null},$(findstring ${PVM_ARCH},FREEBSDLINUXALPHALINUXAMD64LINUXARMMACOSWINOS)) CPP_TKN_OS += -DHAVE_GETOPT_H -DHAVE_GETOPT_LONG endif # !LINUX ifneq (${null},$(findstring ${PVM_ARCH},AIXSGIMP64)) CPP_TKN_OS += -DNEED_GETOPT_LONG endif # !(AIX || SGI) ifeq (${CNK},Y) CPP_TKN_OS += -DHAVE_NEW_CHUNKING_API -DNC_HAVE_NEW_CHUNKING_API endif # !CNK ifeq (${DAP},Y) CPP_TKN_OS += -DENABLE_DAP endif # !DAP ifeq (${ESMF},Y) CPP_TKN_OS += -DENABLE_ESMF endif # !ESMF ifeq (${GSL},Y) CPP_TKN_OS += -DENABLE_GSL -DHAVE_GSL_H endif # !GSL ifeq (${MPI},Y) ifneq (${MPI_FAKE},Y) CPP_TKN_OS += -DENABLE_MPI endif # MPI_FAKE endif # !MPI ifeq (${UDUNITS},Y) CPP_TKN_OS += -DENABLE_UDUNITS -DHAVE_UDUNITS_H -DHAVE_UDUNITS2_H endif # !UDUNITS ifeq (${NETCDF4},Y) CPP_TKN_OS += -DENABLE_NETCDF4 -DHAVE_NETCDF4_H endif # endif NETCDF4 ifeq (${PNETCDF},Y) CPP_TKN_OS += -DENABLE_PNETCDF endif # !PNETCDF # endif PNETCDF # Assume strcasecmp() and strdup() routines are present (Comeau, Pathscale are exceptions) CPP_TKN_OS += # fxm: Define HAVE_LIBINTL, HAVE_LOCALE_H, HAVE_GETTEXT, HAVE_OMP_H # Works on AIX and AIX46K ifneq (${null},$(findstring AIX,${PVM_ARCH})) # 20030804: Always use re-entrant (_r) compilers---Jim Edwards NCAR/IBM CC := xlc_r -qlanglvl=extc99 #CC := gcc -std=c99 -pedantic -D_DEFAULT_SOURCE CXX := xlC_r # CXX := g++ CPP := xlc -c -qlanglvl=extc99 -qsuppress=1501-245 -I/usr/lpp/ppe.poe/include FC := xlf95_r ifneq (${null},$(findstring xl,${CC})) # /usr/include headers must occur before Visual Age headers to prevent xlC pragma warnings # Visual Age compiler headers must occur before g++ headers CPP_TKN_OS += -I/usr/include -I/usr/vacpp/include endif # xlC compilers # Add /usr/local/include for libintl.h explicitly until netCDF is moved there CPPFLAGS := ${CPP_TKN} ${CPP_TKN_OS} ${CPP_PTH} ${OTHER_CFLAGS} -DNEED_LOGF LD := ld # 20020422: -lC links to AIX C++ library which contains float intrinsics cosf()... # -bh:5 suppresses annoying messages from xlC linker WARNING: Duplicate symbol: ... LDFLAGS += -bh:5 ${OTHER_LDFLAGS} -lm -lC LEX := flex LINT := lint YACC := bison # AIX VA Compiler Collection ifneq (${null},$(findstring xl,${CC})) # Visual Age compiler defaults specified in /etc/vac.cfg # Additional switch to fix compiler warnings on csz.c # -qarch=auto : Automatically detect architecture of compiling machine and assume execution on same machine # -qlonglong allow long long integers (and strtoll(), strtoull()) (default on in C not C++). Redundant with -qlanglvl=extc99 # -qmaxmem=num Limit memory used by space intensive optimizations to kilobytes # -qspill=size Size in B of register allocation spill area, mie needs > 1040 B # -qsrcmsg prints transgressing source line with finger # -qsuppress=1501-245 : Suppress RLIM_INFINITY memory message due to ulimits # -qtune=auto : Optimize executable for architecture detected during compilation CFLAGS := -qmaxmem=8192 -qspill=2048 -qsrcmsg -qsuppress=1501-245 FFLAGS := -NS2000 -qfixed=132 -qsrcmsg # -bh:5 suppresses annoying messages from xlC linker WARNING: Duplicate symbol: ... LDFLAGS += -bh:5 -qsuppress=1501-245 #LDFLAGS += -lxlf90 # Required for linking Fortran objects ifeq (${OMP},Y) FC := xlf95_r # -qsmp=noauto : Turn on SMP/OMP code generation but do no automatic parallelization # -qsmp=omp : Use industry standard OMP without IBM extensions OMP_FLG := -qsmp=omp else CPP_DFN += -U_OPENMP FC := xlf95 endif # endif OMP ifeq (${OPTS},O) # -O : -O3 is safe, -O5 is dangerous # -qstrict: Ensure that -O3 optimizations do not alter program semantics # -Q : Inline all appropriate subprograms CFLAGS += -O3 -g -qstrict -Q FFLAGS += -O3 -g -qstrict -Q endif ifeq (${OPTS},D) CFLAGS += -g FFLAGS += -g endif ifeq (${OPTS},X) # -qflttrap generates instructions for floating point exceptions # -qidirfirst uses headers found in -I directories first # -qmakedep creates .d file # -qwarn64 check for possible long-to-integer or pointer-to-integer truncation # -qhalt=e stop compiler if error severity equals or exceeds i, w, e, s, u CFLAGS += -g -qflttrap -qidirfirst -qwarn64 -qcheck=all -qhalt=s FFLAGS += -g endif ifeq (${ABI},64) AR := ar -X 64 CFLAGS += -q64 FFLAGS += -q64 LDFLAGS += -q64 else CPPFLAGS += -D_LARGE_FILES endif # endif ABI # Additional flags for AIX: # -M Generate information to be included in a "make" description file; output goes to .u file # -c Do not send object files to the linkage editor # -P Preprocess but do not compile; output goes to .i file # Using -P causes additional warning messages about lm # Not using -P causes *.o files to be created twice ${MY_DPN_DIR}/%.d : %.c ${MK_DPN} ${CPPFLAGS} $< ;perl -p -e 's/$*\.o/${MY_OBJ_DIR_RX}\/$*.o ${MY_DPN_DIR_RX}\/$(notdir $@)/g;s/${slash_rx}/\${slash}/g' $*.u > $@ ; \ rm -f $*.i $*.o $*.u; ${MY_DPN_DIR}/%.d : %.cc ${MK_DPN_CXX} ${CPPFLAGS} $< ;perl -p -e 's/$*\.o/${MY_OBJ_DIR_RX}\/$*.o ${MY_DPN_DIR_RX}\/$(notdir $@)/g;s/${slash_rx}/\${slash}/g' $*.u > $@ ; \ rm -f $*.i $*.o $*.u; endif # endif AIX VA Compiler Collection # GNU Compiler Collection ifneq (${null},$(findstring gcc,${CC})) CFLAGS := -Wall -Werror=format-security -Wunused ifeq (${OPTS},O) CFLAGS += -O -g ${GCC_RCH_ARG} endif ifeq (${OPTS},D) CFLAGS += -g endif ifeq (${OPTS},R) CFLAGS += endif ifeq (${OPTS},X) CFLAGS += -g -O LDFLAGS += /usr/local/lib/ccmalloc-g++.o -L/usr/local/lib -lccmalloc -ldl endif ifeq (${ABI},64) CC += -maix64 CXX += -maix64 endif # endif ABI CXXFLAGS := ${CFLAGS} endif # endif GNU Compiler Collection # -q64: Select 64-bit compiler mode (required for accessing large files) # -qwarn64: Warn on possible long-to-integer or pointer-to-integer truncation CXXFLAGS := ${CFLAGS} ifeq (${OMP},Y) CFLAGS += ${OMP_FLG} CXXFLAGS += ${OMP_FLG} FFLAGS += ${OMP_FLG} LDFLAGS := ${OMP_FLG} ${LDFLAGS} endif # endif OMP endif # endif AIX ifeq (${PVM_ARCH},ALPHA) ifeq (${OMP},Y) OMP_FLG := -omp endif # endif OMP CXX := cxx CC := cc CFLAGS := ${OMP_FLG} CPP := cpp CPPFLAGS := ${CPP_TKN} ${CPP_TKN_OS} ${CPP_PTH} ${OTHER_CFLAGS} FC := f90 FFLAGS := -r8 -i4 -c ${OMP_FLG} -automatic FIXEDFLAGS := -extend_source ${OMP_FLG} -automatic FREEFLAGS := -DHIDE_SHR_MSG -free LD := ld LDFLAGS += ${OMP_FLG} ${OTHER_LDFLAGS} -lm LEX := flex LINT := lint YACC := bison ifeq (${OPTS},O) CFLAGS += -O2 -g -ansi_alias FFLAGS += -O3 -g -inline speed endif ifeq (${OPTS},D) CFLAGS += -g -check_bounds -check -check_omp FFLAGS += -g3 -C endif ifeq (${OPTS},X) CFLAGS := -g -N 132 FFLAGS := -g -check bounds -check omp_bindings -check overflow -check underflow endif CXXFLAGS := ${CFLAGS} ${MY_OBJ_DIR}/%.o : %.F90 ${FC} -c ${FREEFLAGS} ${FFLAGS} ${CPPFLAGS} -o ${MY_OBJ_DIR}/$(notdir $@) $< ${MY_OBJ_DIR}/%.o : %.F ${FC} -c ${FIXEDFLAGS} ${FFLAGS} ${CPPFLAGS} -o ${MY_OBJ_DIR}/$(notdir $@) $< endif # endif ALPHA ifeq (${PVM_ARCH},CRAY) CXX := CC CC := cc CPP := cpp CPPFLAGS := ${CPP_TKN} ${CPP_TKN_OS} ${CPP_PTH} ${OTHER_CFLAGS} FC := f90 # -F enables macro substitution # -dp enables DOUBLEPRECISION/double FFLAGS := -N 132 -F -dp LD := ld LDFLAGS += ${OTHER_LDFLAGS} -lm LEX := flex LINT := lint YACC := bison ifeq (${OPTS},O) CFLAGS += -h rounddiv -h nofastmd -h nofastmodulus FFLAGS += -O2 -g endif ifeq (${OPTS},D) CFLAGS += -g -h indef -h rounddiv -h nofastmd -h nofastmodulus FFLAGS += -g -ei endif ifeq (${OPTS},X) CFLAGS += -g -h rounddiv -h indef -h bounds -h nofastmd -h nofastmodulus FFLAGS += -g -ei -Rabc endif # 19971021 Added -P to suppress #line # directives on Fortran files ${MY_OBJ_DIR}/%.o : %.F ${CPP} -P ${CPPFLAGS} $< > $(patsubst %.F,%.f,$(notdir $<)) ${FC} -c ${FFLAGS} $(patsubst %.F,%.f,$(notdir $<)) -mv -f $(notdir $@) ${MY_OBJ_DIR} rm -f $(patsubst %.F,%.f,$(notdir $<)) ${MY_OBJ_DIR}/%.o : %.f ${FC} -c ${FFLAGS} $< mv -f $(notdir $@) ${MY_OBJ_DIR} endif # endif CRAY ifeq (${PVM_ARCH},HPPA) CXX := g++ CC := gcc -std=c99 -pedantic -D_DEFAULT_SOURCE CPPFLAGS := ${CPP_TKN} ${CPP_TKN_OS} ${CPP_PTH} ${OTHER_CFLAGS} FC := f77 LD := ld LDFLAGS += ${OTHER_LDFLAGS} -lnsl -lm LEX := flex LINT := lint YACC := bison ifeq (${OPTS},O) CFLAGS += -O2 -g FFLAGS := -fast -eendif endif ifeq (${OPTS},D) CFLAGS += -g FFLAGS := -g -e endif ifeq (${OPTS},X) CFLAGS += -g FFLAGS := -g -e endif endif # endif HPPA # Works on LINUX, LINUXALPHA, LINUXAMD64, LINUXARM, and FREEBSD and MACOS ifneq (${null},$(findstring ${PVM_ARCH},LINUXALPHALINUXAMD64LINUXARMFREEBSDMACOS)) # 20161001 Linux ar with Ubuntu Xenial began using deterministic mode. -U undoes that. # 20161001 GNU ar -s is equivalent to ranlib # ar -D: Operate in deterministic mode (breaks NCO build on Ubuntu) # ar -r: replace existing or insert new file(s) into the archive # ar -s: equivalent to ranlib # ar -U: Do not operate in deterministic mode. This is the inverse of the D modifier, above: added files and the archive index will get their actual UID, GID, timestamp, and file mode values. # ar -U: Unavailable option in RHEL 6 (2010) used on Rhea and Titan # ar -v: be verbose ARFLAGS := rsUv ifneq (${null},$(findstring rhea,${HOSTNAME})) ARFLAGS := rsv else ifneq (${null},$(findstring titan,${HOSTNAME})) ARFLAGS := rsv else ifneq (${null},$(findstring ys,${HOSTNAME})) ARFLAGS := rsv endif # !rhea,titan,yellowstone ifeq (${PVM_ARCH},MACOS) ARFLAGS := rsv endif # !aerosol,firn CXX := ${LINUX_CXX} CC := ${LINUX_CC} CPP := ${CC} # NB: nameser.h needs -Di386, but gcc sends -Di586 (on pentiums) CPP_TKN_OS += -Di386 CPPFLAGS := ${CPP_TKN} ${CPP_TKN_OS} ${CPP_PTH} ${OTHER_CFLAGS} FC := ${LINUX_FC} LD := ld LDFLAGS += ${OTHER_LDFLAGS} -lm ifeq (${PVM_ARCH},MACOS) LDFLAGS += -lresolv endif # endif MACOS LEX := flex LINT := lint YACC := bison # Comeau C Compiler ifeq (${CXX},como) CFLAGS := CPPFLAGS += -DNEED_STRCASECMP CPPFLAGS += -DNEED_STRDUP LDFLAGS := ${COMOROOT}/libcomo/libcomo.a ${LDFLAGS} ifeq (${OPTS},O) CFLAGS += -O -g endif ifeq (${OPTS},D) CFLAGS += -g endif ifeq (${OPTS},R) CFLAGS += endif ifeq (${OPTS},X) CFLAGS += -g endif CXXFLAGS := ${CFLAGS} endif # endif Comeau C Compiler # GNU Compiler Collection or LLVM # 20140204: gcc and clang should receive identical options ifeq (gcc,$(firstword ${CC})) GCC_OR_CLANG := Y endif ifeq (clang,$(firstword ${CC})) GCC_OR_CLANG := Y endif ifeq (${GCC_OR_CLANG},Y) CPPFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE CFLAGS := -Wall -Wuninitialized # Compilation flags for numerical routines recommended by GSL 1.3 manual, p. 397 # Greenplanet has old compiler that lacks -Werror=format-security # CFLAGS += -W -Wmissing-prototypes -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -fno-common -g CFLAGS += -Werror=format-security -W -Wmissing-prototypes -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -fno-common -g # Compilation flags recommended by GSL and others that I like and use: # -D_BSD_SOURCE: Support 4.3 BSD Unix extensions to ANSI C (prevents nameser.h warnings) # -D_POSIX_SOURCE: Support POSIX.1 standard additions to ANSI C (prevents fileno warnings) # -pedantic: Disallow non-ISO constructs (including type long long) (sometimes useful) # -W: Extra warnings, including missing return values, comparison of signed with unsigned # -Wall: Warn about common programming problems # -Wcast-align: Warn if casting pointer to type of different size # -Wcast-qual: Warn if const qualifier removed from pointer # -Werror: Consider warnings as errors # -Werror=format-security: Consider this specific warning as errors (requires gcc > 4.1.2) # -Wmaybe-uninitialized: Warn on uninitialized variables. GCC has many false negatives, clang is better? Available on GCC 4.8.2+. Not available on GCC 4.6.3-. # -Wmissing-prototypes: Warn if missing prototypes # -Wpointer-arith: Warn if pointer arithmetic on types without size, e.g., void # -Wshadow: Warn if local variable has same name as other local variable # -Wsometimes-uninitialized: LLVM/clang uses this but GCC does not # -Wswitch: Warn if switch statement has enumerated index and case label outside enumeration range # -Wuninitialized: Warn on uninitialized variables. GCC has many false negatives, clang is better? # -Wunused: Warn on unused functions, labels, parameters, values, and variables # -Wwrite-strings: Apply const-qualifier to string constants, die if overwritten # -fno-common: Prevent global variables from being simultaneously defined in different files # -g: Put debugging symbols in executable # -pg: Enable profiling, generate gmon.out output files (also needed by linker) # -O3: clang -O4 DNE, highest clang optimization is -O3 # -O4: Turn on optimization so uninitialized variables are flagged. Downside: optimizes-out many debugging symbols # Compilation flags recommended by GSL that I do not like and do not use: # -ansi: Support only strict ANSI C. Equivalent to -std=c89, conflicts with -std=c99 # --no-alias? -fstrict-aliasing # -Waggregate-return: Warn if functions return aggregates like structures or unions # -Wconversion: Warn if converting signed to unsigned. Intended for obsolete, non-prototyped code. Triggers fabsf(), sqrtf(), warnings. # -Wnested-externs: Warn if extern is encountered within function. C only? # -Wstrict-prototypes: Warn if inconsistent prototypes. C only? # -Wtraditional: Warn if constructs differ between traditional and ANSI C. C only? # -Dinline=: inline is not an ANSI keyword, must undefine inline to work with -ansi # -fshort-enums: Make enums as short as possible, ususally non-int. Do not ever invoke this! This breaks ABI and causes subtle problems ifeq (${OMP},Y) ifneq (clang,$(firstword ${CC})) # 20140526 clang does not recognize/utilize -fopenmp OMP_FLG_C := -fopenmp OMP_FLG_F := -fopenmp LDFLAGS += -lgomp -lpthread endif # endif clang endif # endif OMP ifeq (${OPTS},O) ifeq (clang,$(firstword ${CC})) CFLAGS += -O3 -g ${GCC_RCH_ARG} else # endif clang CFLAGS += -O4 -g ${GCC_RCH_ARG} endif # endif clang endif ifeq (${OPTS},D) CFLAGS += -g -Wno-switch endif ifeq (${OPTS},R) CFLAGS += endif ifeq (${OPTS},X) # 20090715: https://wiki.ubuntu.com/CompilerFlags # -D_FORTIFY_SOURCE=2 : Compile-time libc checks, run-time buffer/memory checks # : NB: _FORTIFY_SOURCE macro requires -O switch # -fstack-protector : Enable run-time stack overflow verification # -Wformat-security : Warn about misuse of format strings # -Wl,-z,relro : Read-only relocation table area in final ELF CPPFLAGS += -D_FORTIFY_SOURCE=2 CFLAGS += -g -O -fstack-protector -Wformat-security ifneq (clang,$(firstword ${CC})) # 20150106 clang does not recognize/utilize -z CFLAGS += -Wl,-z,relro endif # endif clang # 20090715: -Werror triggers known nc_put_var?_string() and nco_def_var_chunking() errors # CFLAGS += -g -pg -fno-inline -Werror # CFLAGS += -g -O -pg -fno-inline CFLAGS += -g -pg -fno-inline LDFLAGS += -pg # LDFLAGS += /usr/local/lib/ccmalloc-gcc.o -L/usr/local/lib -lccmalloc -ldl endif ifneq (${null},$(findstring AMD64,${PVM_ARCH})) ifeq (${ABI},64) CFLAGS += -m64 FFLAGS += -m64 LDFLAGS += -m64 endif # endif ABI endif # endif LINUXAMD64 CXXFLAGS := ${CFLAGS} endif # endif GNU Compiler Collection or LLVM # Intel (Kai) C Compiler ifeq (icc,$(firstword ${CC})) # -fast: enable -xP -O3 -ipo -static # -ipo[n]: enable multi-file IP optimizations (between files) # -no-gcc: do not define __GNUC__, __GNUC_MINOR__, and __GNUC_PATCHLEVEL__ macros # -static: prevents linking with shared libraries # -std=c99: Enable C99 support for C programs # -xB: specialize code to run exclusively on Intel Pentium M and compatible Intel processors # -xK: specialize code to run exclusively on Intel Pentium III and compatible Intel processors # -xN: specialize code to run exclusively on Intel Pentium 4 and compatible Intel processors # -xP: specialize code to run exclusively on Intel Pentium 4 processors with SSE3 extensions # -Wall: enable all warnings # -Werror:force warnings to be reported as errors # -w0: display errors (same as -w) # -w1: display warnings and errors (DEFAULT) # -w2: display remarks, warnings, and errors # -wd[,,...] disable diagnostics L1 through LN # warning #274: declaration is not visible outside of function # remark #981: operands are evaluated in unspecified order # remark #810: conversion from "double" to "float" may lose significant bits # remark #1572: floating-point equality and inequality comparisons are unreliable CFLAGS := -w1 -wd274 # Rhea icc 13.1.3 (gcc version 4.4.7 compatibility) requires -D_BSD_SOURCE on files that #include nameser.h, recent transition of gcc 4.9 to -D_DEFAULT_SOURCE does not cut the mustard CPPFLAGS += -no-gcc -D_BSD_SOURCE LDFLAGS += -lsvml OMP_FLG_C := -openmp -openmp_report0 ifeq (${OPTS},O) CFLAGS += -O3 -g ${ICC_RCH_ARG} endif ifeq (${OPTS},D) CFLAGS += -g endif ifeq (${OPTS},R) CFLAGS += endif ifeq (${OPTS},X) CFLAGS += -g -Wall -wd810,981,1572 -inline_debug_info endif CXXFLAGS := ${CFLAGS} endif # endif Intel (Kai) C Compiler # Intel (Kai) Fortran Compiler ifeq (${FC},ifc) # -e95 issues warnings for non-standard fortran # -fpp2 necessary, but not sufficient, for OpenMP FFLAGS := -extend_source -implicitnone -vms -e95 -fpp2 # -lVaxlib needed for iargc_, getarg_ LDFLAGS += -lVaxlib OMP_FLG_C := -openmp ifeq (${PRC},D) FFLAGS += -i4 -r8 -doubletemps else FFLAGS += -i4 endif ifeq (${OPTS},O) FFLAGS += -O2 -g endif ifeq (${OPTS},D) FFLAGS += -g endif ifeq (${OPTS},R) FFLAGS += endif ifeq (${OPTS},X) FFLAGS += -g -C -e95 endif endif # endif Intel (Kai) Fortran Compiler # cd ~;nvcc -o libcuda_add.a -deviceemu -lib simpleTemplates.cu # cd ~;g++ -I/usr/local/cuda/include -c -o test.o test.c # cd ~;g++ -o ~/test test.o libcuda_add.a # NVidia C Compiler ifeq (nvcc,$(firstword ${CC})) CPPFLAGS += # -deviceemu: Emulate CUDA CPU # -lib: build static libraries CFLAGS := -deviceemu -lib ifeq (${OMP},Y) OMP_FLG_C := OMP_FLG_F := LDFLAGS += endif # endif OMP ifeq (${OPTS},O) CFLAGS += -O -g endif ifeq (${OPTS},D) CFLAGS += -g endif ifeq (${OPTS},R) CFLAGS += endif ifeq (${OPTS},X) CFLAGS += -g LDFLAGS += endif ifneq (${null},$(findstring AMD64,${PVM_ARCH})) ifeq (${ABI},64) CFLAGS += FFLAGS += LDFLAGS += endif # endif ABI endif # endif LINUXAMD64 CXXFLAGS := ${CFLAGS} endif # endif NVidia C Compiler # Pathscale (QLogic) C Compiler ifeq (pathcc,$(firstword ${CC})) # pathcc -show-defaults # shows that pathcc automatically sets many hardware-specific options # man -k pathscale for full listing # -O2 = -O: Default optimization # -Ofast = -O3: CFLAGS := CPPFLAGS += -DNEED_STRCASECMP LDFLAGS += OMP_FLG_C := -apo -mp ifeq (${OPTS},O) CFLAGS += -O3 -g ${PSC_RCH_ARG} endif ifeq (${OPTS},D) CFLAGS += -g endif ifeq (${OPTS},R) CFLAGS += -O2 endif ifeq (${OPTS},X) CFLAGS += -g endif CXXFLAGS := ${CFLAGS} endif # end Pathscale (QLogic) C++ Compiler # Portland Group C++ Compiler ifeq (pgcc,$(firstword ${CC})) # Enable Large File Support (LFS) by default CFLAGS := -Mlfs # Pass kludgy PGI identifier to flag for broken C99 designated initializers etc. CPPFLAGS := $(filter-out -DHAVE_C99,${CPPFLAGS}) CPPFLAGS := -DPGI_CC ${CPPFLAGS} LDFLAGS += -Mlfs OMP_FLG_C := -mp ifeq (${OPTS},O) CFLAGS += -fast ${PGI_RCH_ARG} endif ifeq (${OPTS},D) CFLAGS += -g endif ifeq (${OPTS},R) CFLAGS += endif ifeq (${OPTS},X) CFLAGS += -g -Mbounds endif CXXFLAGS := ${CFLAGS} endif # endif Portland Group C++ Compiler # Portland Group Fortran Compiler ifeq (${FC},pgf90) FFLAGS := -Mextend -Mnosecond_underscore -byteswapio -Mrecursive -Mdalign -Ktrap=fp -Mlfs OMP_FLG_F := -mp ifeq (${PRC},D) FFLAGS += -Mr8 -Mi4 endif ifeq (${OPTS},O) FFLAGS += -fast endif ifeq (${OPTS},D) FFLAGS += -g endif ifeq (${OPTS},R) FFLAGS += endif ifeq (${OPTS},X) FFLAGS += -g -Mbounds endif endif # endif Portland Group Fortran Compiler # G77 Fortran compiler ifeq (${FC},g77) FFLAGS := -ffixed-line-length-132 -fno-second-underscore ifeq (${OPTS},O) FFLAGS += -O -g endif ifeq (${OPTS},D) FFLAGS += -g -fdebug-kludge endif ifeq (${OPTS},R) FFLAGS += -fdebug-kludge endif ifeq (${OPTS},X) FFLAGS := -g -O -fdebug-kludge -fbounds-check endif endif # endif G77 Fortran compiler ifeq (${DPKG},Y) CPPFLAGS+=$(shell dpkg-buildflags --get CPPFLAGS) CFLAGS+=$(shell dpkg-buildflags --get CFLAGS) CXXFLAGS+=$(shell dpkg-buildflags --get CXXFLAGS) LDFLAGS+=$(shell dpkg-buildflags --get LDFLAGS) endif # endif OMP ifeq (${OMP},Y) CFLAGS += ${OMP_FLG_C} CXXFLAGS += ${OMP_FLG_C} FFLAGS += ${OMP_FLG_C} # LD behavior assumes C source code LDFLAGS := ${OMP_FLG_C} ${LDFLAGS} endif # endif OMP endif # endif LINUX, LINUXALPHA, LINUXAMD64, LINUXARM, FREEBSD, MACOS # NB: Deprecated as of 201403. Now LINUX* subsumes MACOS ifeq (${PVM_ARCH},MACOSOLD) CXX := ${LINUX_CXX} # NB: -D_POSIX_SOURCE breaks MACOS build in nco_fl_utl.c, nco_mmr.c #CC := cc -std=c99 -pedantic -D_BSD_SOURCE CC := ${LINUX_CC} -std=c99 -pedantic -D_BSD_SOURCE CPP := ${CC} # -fno-common: Allows shared libraries to build CFLAGS := -Wall -Werror=format-security -fno-common CPPFLAGS := ${CPP_TKN} ${CPP_TKN_OS} ${CPP_PTH} ${OTHER_CFLAGS} FC := f90 LD := ld LDFLAGS += ${OTHER_LDFLAGS} -lresolv -lm LEX := flex LINT := lint YACC := bison ifeq (${OPTS},O) CFLAGS += -O endif ifeq (${OPTS},D) CFLAGS += -g endif ifeq (${OPTS},R) CFLAGS += endif ifeq (${OPTS},X) CFLAGS += -g -O LDFLAGS += /usr/local/lib/ccmalloc-gcc.o -L/usr/local/lib -lccmalloc -ldl endif CXXFLAGS := ${CFLAGS} ifeq (${OMP},Y) CFLAGS += ${OMP_FLG} FFLAGS += ${OMP_FLG} LDFLAGS := ${OMP_FLG} ${LDFLAGS} endif # endif OMP endif # endif MACOSOLD ifeq (${PVM_ARCH},NECSX) ifeq (${OMP},Y) OMP_FLG := -Popenmp endif # endif OMP CXX := c++ #CC := c++ -Xa CC := cc CPP := c++ -E #CPP := /usr/lib/cpp CPPFLAGS := ${CPP_TKN} ${CPP_TKN_OS} ${CPP_PTH} ${OTHER_CFLAGS} FC := f90 LD := ld LDFLAGS += ${OTHER_LDFLAGS} -lm LEX := flex LINT := lint YACC := bison ifeq (${OPTS},O) CFLAGS += -h2 -hmath vector -hxint # CFLAGS += -Cvopt -math vector -xint FFLAGS = -Cvopt -f3 endif ifeq (${OPTS},D) CFLAGS += -g FFLAGS = -g -f3 endif ifeq (${OPTS},X) CFLAGS += -g -h0 -hstack=nan # CFLAGS += -Cdebug -init stack=nan FFLAGS = -Cdebug -eR -f3 -Wf"-init stack=nan heap=nan" endif MK_DPN = /usr/local/bin/mkdep.perl /usr/lib/cpp # NECSX try this ${MY_DPN_DIR}/%.d : %.c ${MK_DPN} ${CPPFLAGS} $< | perl -p -e 's/$*\.o/${MY_OBJ_DIR_RX}\/$*.o ${MY_DPN_DIR_RX}\/$(notdir $@)/g;s/${slash_rx}/\${slash}/g' > $@ endif # endif NECSX ifeq (${PVM_ARCH},RS6K) CXX := g++ CC := gcc -std=c99 -pedantic -D_DEFAULT_SOURCE CPP := /lib/cpp -P CPPFLAGS := ${CPP_TKN} ${CPP_TKN_OS} ${CPP_PTH} ${OTHER_CFLAGS} FC := xlf LD := ld LDFLAGS += ${OTHER_LDFLAGS} -lm LEX := flex LINT := lint YACC := bison ifeq (${OPTS},O) CFLAGS += -O2 CPP := ${CPP} ${CPPFLAGS} PREPROCESS.F := ${CPP} ${CPPFLAGS} FFLAGS := -O -g -NS2000 -qfixed=132 endif ifeq (${OPTS},D) CFLAGS += -g CPP := ${CPP} ${CPPFLAGS} PREPROCESS.F := ${CPP} ${CPPFLAGS} FFLAGS := -g -NS2000 -qfixed=132 endif ${MY_OBJ_DIR}/%.o : %.F ${CPP} ${CPPFLAGS} $< ${MY_OBJ_DIR}/$(basename $<).f ${FC} -c ${FFLAGS} -o ${MY_OBJ_DIR}/$(notdir $@) ${MY_OBJ_DIR}/$(basename $<).f ${MY_OBJ_DIR}/%.o : %.f ${FC} -c ${FFLAGS} -o ${MY_OBJ_DIR}/$(notdir $@) $< endif # endif RS6K # SGI6, SGI64, SGIMP64 ifneq (${null},$(findstring SGI,${PVM_ARCH})) ifeq (${OMP},Y) OMP_FLG := -mp -mpio endif # endif OMP CXX := CC -LANG:std CC := cc -c99 # 20000302: -w suppresses warnings which will swamp linker #CXX := g++ -w #CC := gcc -std=c99 -pedantic -D_DEFAULT_SOURCE CPPFLAGS := ${CPP_TKN} ${CPP_TKN_OS} ${CPP_PTH} ${OTHER_CFLAGS} ifdef $(MIPSPRO_SGI) # SGIs like dataproc keep omp.h in special location determined by module MIPSpro CPPFLAGS := -I$(MIPSPRO_SGI)/usr/include ${CPPFLAGS} endif FC := f90 -cpp LD := ld LEX := flex LINT := lint YACC := bison ifeq (${PVM_ARCH},SGI6) GCC_ABI_FLG := -mabi=32 GCC_LDFLAGS_SZ_SPC := ${GCC_ABI_FLG} -mips3 SGI_ABI_FLG := -n32 -mips3 ${OMP_FLG} else # SGI64, SGIMP64 ifeq (${ABI},64) GCC_ABI_FLG := -mabi=64 GCC_LDFLAGS_SZ_SPC := ${GCC_ABI_FLG} -mips4 -L/usr/local/lib/mabi=64 SGI_ABI_FLG := -64 -mips4 ${OMP_FLG} else # ABI=32 GCC_ABI_FLG := -mabi=32 GCC_LDFLAGS_SZ_SPC := ${GCC_ABI_FLG} -mips4 SGI_ABI_FLG := -n32 -mips4 ${OMP_FLG} endif # endif ABI endif # endif SGI64, SGIMP64 ifeq (gcc,$(firstword ${CC})) LDFLAGS += ${GCC_LDFLAGS_SZ_SPC} ${OTHER_LDFLAGS} -lm CFLAGS := ${GCC_ABI_FLG} -Wall -Werror=format-security ifeq (${OPTS},O) CFLAGS += -O2 endif ifeq (${OPTS},R) CFLAGS += endif ifeq (${OPTS},D) CFLAGS += -g endif ifeq (${OPTS},X) CFLAGS += -g -O endif CXXFLAGS := ${CFLAGS} endif # endif CC=gcc ifeq (cc,$(firstword ${CC})) LDFLAGS += ${SGI_ABI_FLG} ${OTHER_LDFLAGS} -lm CFLAGS := ${SGI_ABI_FLG} ifeq (${OPTS},O) CFLAGS += -O2 endif ifeq (${OPTS},R) CFLAGS += endif ifeq (${OPTS},D) CFLAGS += -g endif ifeq (${OPTS},X) CFLAGS += -g -trapuv endif endif # endif CC=cc # Fortran flags FFLAGS := ${SGI_ABI_FLG} -extend_source ifeq (${OPTS},O) FFLAGS := -O2 -g endif ifeq (${OPTS},R) FFLAGS := endif ifeq (${OPTS},D) FFLAGS := -g endif ifeq (${OPTS},X) FFLAGS := -g -check_bounds -trapuv endif # end fortran flags endif # endif SGI6, SGI64, SGIMP64 ifeq (${UNAMES},SunOS) CXX := CC CC:= c99 -D_BSD_SOURCE CFLAGS := CPP := cc -E #CXX := g++ #CC := gcc -std=c99 -pedantic -D_DEFAULT_SOURCE #CFLAGS := -Wall #CPP := cpp CPPFLAGS := ${CPP_TKN} ${CPP_TKN_OS} ${CPP_PTH} ${OTHER_CFLAGS} FC := f90 -DHIDE_SHR_MSG #FFLAGS := -xs -stackvar -e -Qoption f90comp -r8const FFLAGS := -xs -stackvar -e LD := ld LDFLAGS += ${OTHER_LDFLAGS} -lsunmath -lresolv -lsocket -lnsl -lm LEX := flex LINT := lint YACC := bison ifeq (${OPTS},O) CFLAGS += -O2 -g FFLAGS += -fast endif ifeq (${OPTS},D) CFLAGS += -g FFLAGS += -g endif ifeq (${OPTS},X) CFLAGS += -g FFLAGS += -g # NB: 19980601 -C (range-checking) is not supported by Sun f90 ifeq (${FC},f77) FFLAGS += -C endif endif CXXFLAGS := ${CFLAGS} endif # endif SunOS=SUN4SOL2,SUNMP ifeq (${PVM_ARCH},WINOS) CXX := g++ CC := gcc -std=c99 -pedantic -D_DEFAULT_SOURCE # NB: nameser.h needs -Di386, but gcc sends -Di586 (on pentiums) #CPP_TKN_OS += -Di386 -DNEED_STRCASECMP -DNEED_STRDUP -I/usr/include CPP_TKN_OS += -Di386 -DNEED_STRDUP -I/usr/include CPPFLAGS := ${CPP_TKN} ${CPP_TKN_OS} ${CPP_PTH} ${OTHER_CFLAGS} FC := g77 LD := ld LDFLAGS += ${OTHER_LDFLAGS} -lm LEX := flex LINT := lint YACC := bison ifeq (${OPTS},O) CFLAGS += -O -g endif ifeq (${OPTS},D) CFLAGS += -g endif ${MY_OBJ_DIR}/%.o : %.F ${FC} -c ${FFLAGS} ${CPPFLAGS} -o ${MY_OBJ_DIR}/$(notdir $@) $< ${MY_OBJ_DIR}/%.o : %.f ${FC} -c ${FFLAGS} -o ${MY_OBJ_DIR}/$(notdir $@) $< endif # endif WINOS # Resolve nvcc CUDA run-time library functions ifeq (${CUDA},Y) CUDA_FLG_C := CUDA_FLG_F := LDFLAGS += -L/usr/local/cuda/lib -lcudart endif # endif CUDA # Internationalize NCO with i18n features ifeq (${I18N},Y) CPPFLAGS += -DI18N ifneq (${null},$(findstring MACOS,${PVM_ARCH})) LDFLAGS += -lintl endif endif # endif I18N # Default to MPICC, MPICXX to CC, CXX and cross your fingers MPICC := ${CC} MPICXX := ${CXX} # Manipulate CC, CPP, CXX as appropriate for MPI-enabled operators ifeq (${MPI},Y) ifneq (${null},$(findstring xl,${CC})) # NB: AIX is not debugged yet MPICC := $(subst xlc,mpcc,${CC}) MPICXX := $(subst xlC,mpCC,${CXX}) endif # endif AIX VA Compiler Collection ifneq (${null},$(findstring gcc,${CC})) MPICC := $(subst gcc,mpicc,${CC}) MPICXX := $(subst g++,mpicxx,${CXX}) endif # endif GNU Compiler Collection ifeq (icpc,$(firstword ${CXX})) MPICC := $(subst icc,mpicc,${CC}) MPICXX := $(subst icpc,mpicxx,${CXX}) endif # endif Intel (Kai) C++ Compiler ifneq (${null},$(findstring pathcc,${CC})) MPICC := $(subst pathcc,mpicc,${CC}) MPICXX := $(subst pathCC,mpicxx,${CXX}) endif # endif Pathscale (QLogic) Compilers CPP := ${MPICC} endif # endif MPI # Use MPI modifications, if any, to build all objects CC := ${MPICC} CXX := ${MPICXX} # Disable OpenMP on platforms which automatically support it ifneq (${OMP},Y) ifneq (${null},$(findstring SGI,${PVM_ARCH})) CFLAGS := $(filter-out -mp -mpio,${CFLAGS}) LDFLAGS := $(filter-out -mp -mpio,${LDFLAGS}) endif # endif SGI CPPFLAGS += -U_OPENMP endif # endif OMP ifneq (${null},$(findstring LINUX,${PVM_ARCH})) ifeq (${CCACHE},Y) # Prefix CC and CXX with ccache CC := ccache ${CC} CXX := ccache ${CXX} endif # !CCACHE endif # !LINUX ifeq (${STC},Y) # Created statically linked executable LDFLAGS := -static ${LDFLAGS} endif # endif STC # Define CPPCXXFLAGS after making all possible modifications to CPPFLAGS # Add nco_c++ to directory search path CXXCPPFLAGS := ${CPPFLAGS} -I${NCO_CXX_SRC_DIR} # Define any remaining variables libnco := ${MY_LIB_DIR}/libnco # Default targets all: dir lib ${MDL_BIN_TRG} ${MDL_BIN_SPT} data non_ncap: dir lib $(filter-out ncap,${MDL_BIN_TRG}) ${MDL_BIN_SPT} data # .PHONY tells make to remake the following non-file targets .PHONY: all cln dst_cln dbg ${MDL_BIN_TRG} ${MDL_BIN_SPT} # Delete default suffixes---this should increase speed .SUFFIXES: # Define suffixes that matter .SUFFIXES: .cc .c .cu .o .F .d # Delete targets that were not successfully made .DELETE_ON_ERROR: # Target directories which may not exist dir: bin_dir obj_dir lib_dir bin_dir: # Compaq ALPHA complains about -install # -install -d ${MY_BIN_DIR} -mkdir -p ${MY_BIN_DIR} lib_dir: # -install -d ${MY_BIN_DIR} -mkdir -p ${MY_LIB_DIR} obj_dir: # -install -d ${MY_BIN_DIR} -mkdir -p ${MY_OBJ_DIR} # The whole shebang allinone: all nco_c++ nco++ nco_c++: -cd ../src/nco_c++; ${MAKE} -f Makefile.old DBG=${DBG} NETCDF4=${NETCDF4} OMP=${OMP} OPTS=${OPTS} SZ=${SZ} lib dat all nco++: -cd ../src/nco++; ${MAKE} -f Makefile.old CNK=${CNK} DAP=${DAP} DBG=${DBG} GSL=${GSL} MPI=${MPI} NETCDF4=${NETCDF4} OMP=${OMP} OPTS=${OPTS} PNETCDF=${PNETCDF} SZ=${SZ} UDUNITS=${UDUNITS} lib all # Targets in bin mpi: mpi_nco mpinco: mpi_nco mpnco: mpi_nco mpi_nco: ${MDL_MPI_TRG} -rm -f ${MY_BIN_DIR}/mpirun && ln -f -s `which mpirun` ${MY_BIN_DIR}/mpirun mpncbo: ${MY_BIN_DIR}/mpncbo ${MY_BIN_DIR}/mpncbo: ${MY_OBJ_DIR}/mpncbo.o lib ${MPICC} -o $@${BNR_SFX} $< ${LDFLAGS} chmod 755 $@${BNR_SFX} cd ${MY_BIN_DIR}; rm -f mpncdiff; ln -s -f mpncbo mpncdiff # 20050710: icc 8.1 with -axW flag dies compiling ncecat # 20050915: Same problem occurs with MPI_FAKE version of mpncecat ifeq (icc,$(firstword ${LINUX_CC})) ncecat : CFLAGS := $(filter-out -axW,${CFLAGS}) ifeq (${MPI_FAKE},Y) mpncecat : CFLAGS := $(filter-out -axW,${CFLAGS}) endif # !MPI_FAKE endif # endif Intel (Kai) C Compiler mpncecat: ${MY_BIN_DIR}/mpncecat ${MY_BIN_DIR}/mpncecat: ${MY_OBJ_DIR}/mpncecat.o lib ${MPICC} -o $@${BNR_SFX} $< ${LDFLAGS} chmod 755 $@${BNR_SFX} mpncflint: ${MY_BIN_DIR}/mpncflint ${MY_BIN_DIR}/mpncflint: ${MY_OBJ_DIR}/mpncflint.o lib ${MPICC} -o $@${BNR_SFX} $< ${LDFLAGS} chmod 755 $@${BNR_SFX} mpncpdq: ${MY_BIN_DIR}/mpncpdq ${MY_BIN_DIR}/mpncpdq: ${MY_OBJ_DIR}/mpncpdq.o lib ${MPICC} -o $@${BNR_SFX} $< ${LDFLAGS} chmod 755 $@${BNR_SFX} # cd ${MY_BIN_DIR}; rm -f mpncunpack; ln -s -f mpncpdq mpncunpack # cd ${MY_BIN_DIR}; rm -f mpncpack; ln -s -f mpncpdq mpncpack mpncra: ${MY_BIN_DIR}/mpncra ${MY_BIN_DIR}/mpncra: ${MY_OBJ_DIR}/mpncra.o lib ${MPICC} -o $@${BNR_SFX} $< ${LDFLAGS} chmod 755 $@${BNR_SFX} cd ${MY_BIN_DIR}; rm -f mpncea; ln -s -f mpncra mpncea cd ${MY_BIN_DIR}; rm -f mpnces; ln -s -f mpncra mpnces cd ${MY_BIN_DIR}; rm -f mpncrcat; ln -s -f mpncra mpncrcat mpncwa: ${MY_BIN_DIR}/mpncwa ${MY_BIN_DIR}/mpncwa: ${MY_OBJ_DIR}/mpncwa.o ${MY_OBJ_DIR}/ncap_lex.o ${MY_OBJ_DIR}/ncap_utl.o lib ${MPICC} -o $@${BNR_SFX} $< ${MY_OBJ_DIR}/ncap_lex.o ${MY_OBJ_DIR}/ncap_utl.o ${LDFLAGS} chmod 755 $@${BNR_SFX} ncatted: ${MY_BIN_DIR}/ncatted ${MY_BIN_DIR}/ncatted: ${MY_OBJ_DIR}/ncatted.o lib ${CC} -o $@${BNR_SFX} $< ${LDFLAGS} chmod 755 $@${BNR_SFX} ncbo: ${MY_BIN_DIR}/ncbo ${MY_BIN_DIR}/ncbo: ${MY_OBJ_DIR}/ncbo.o lib ${CC} -o $@${BNR_SFX} $< ${LDFLAGS} chmod 755 $@${BNR_SFX} cd ${MY_BIN_DIR}; rm -f ncdiff; ln -s -f ncbo ncdiff ncclimo: ${MY_BIN_DIR}/ncclimo ${MY_BIN_DIR}/ncclimo: ${MY_DAT_DIR}/ncclimo /bin/cp -f ${MY_DAT_DIR}/ncclimo ${MY_BIN_DIR} ncecat: ${MY_BIN_DIR}/ncecat ${MY_BIN_DIR}/ncecat: ${MY_OBJ_DIR}/ncecat.o lib ${CC} -o $@${BNR_SFX} $< ${LDFLAGS} chmod 755 $@${BNR_SFX} ncflint: ${MY_BIN_DIR}/ncflint ${MY_BIN_DIR}/ncflint: ${MY_OBJ_DIR}/ncflint.o lib ${CC} -o $@${BNR_SFX} $< ${LDFLAGS} chmod 755 $@${BNR_SFX} ncks: ${MY_BIN_DIR}/ncks ${MY_BIN_DIR}/ncks: ${MY_OBJ_DIR}/ncks.o lib ${CC} -o $@${BNR_SFX} $< ${LDFLAGS} chmod 755 $@${BNR_SFX} ncpdq: ${MY_BIN_DIR}/ncpdq ${MY_BIN_DIR}/ncpdq: ${MY_OBJ_DIR}/ncpdq.o lib ${CC} -o $@${BNR_SFX} $< ${LDFLAGS} chmod 755 $@${BNR_SFX} cd ${MY_BIN_DIR}; rm -f ncunpack; ln -s -f ncpdq ncunpack cd ${MY_BIN_DIR}; rm -f ncpack; ln -s -f ncpdq ncpack ncra: ${MY_BIN_DIR}/ncra ${MY_BIN_DIR}/ncra: ${MY_OBJ_DIR}/ncra.o lib ${CC} -o $@${BNR_SFX} $< ${LDFLAGS} chmod 755 $@${BNR_SFX} cd ${MY_BIN_DIR}; rm -f ncea; ln -s -f ncra ncea cd ${MY_BIN_DIR}; rm -f nces; ln -s -f ncra nces cd ${MY_BIN_DIR}; rm -f ncrcat; ln -s -f ncra ncrcat ncremap: ${MY_BIN_DIR}/ncremap ${MY_BIN_DIR}/ncremap: ${MY_DAT_DIR}/ncremap /bin/cp -f ${MY_DAT_DIR}/ncremap ${MY_BIN_DIR} ncrename: ${MY_BIN_DIR}/ncrename ${MY_BIN_DIR}/ncrename: ${MY_OBJ_DIR}/ncrename.o lib ${CC} -o $@${BNR_SFX} $< ${LDFLAGS} chmod 755 $@${BNR_SFX} ncwa: ${MY_BIN_DIR}/ncwa ${MY_BIN_DIR}/ncwa: ${MY_OBJ_DIR}/ncwa.o ${MY_OBJ_DIR}/ncap_lex.o ${MY_OBJ_DIR}/ncap_utl.o lib ifeq (${MSVC},TRUE) ${CC} -o $@${BNR_SFX} $< ${LDFLAGS} else ${CC} -o $@${BNR_SFX} $< ${MY_OBJ_DIR}/ncap_lex.o ${MY_OBJ_DIR}/ncap_utl.o ${LDFLAGS} endif chmod 755 $@${BNR_SFX} ncz2psx: ${MY_BIN_DIR}/ncz2psx ${MY_BIN_DIR}/ncz2psx: ${MY_DAT_DIR}/ncz2psx /bin/cp -f ${MY_DAT_DIR}/ncz2psx ${MY_BIN_DIR} ncchecker: ${MY_BIN_DIR}/ncchecker ${MY_BIN_DIR}/ncchecker: ${MY_DAT_DIR}/ncchecker /bin/cp -f ${MY_DAT_DIR}/ncchecker ${MY_BIN_DIR} bin: ${MDL_BIN_TRG} ${MDL_BIN_SPT} binclean: bin_cln bin_cln: rm -f ${MDL_BIN} mpiclean: mpi_cln mpi_cln: rm -f ${MDL_MPI_BIN} ${MDL_MPI_OBJ} mpi_fake_cp: ${MDL_MPI_TRG} - for fl in ${MDL_MPI_TRG_SMP}; do /bin/cp -f ${MY_BIN_DIR}/$$fl ${MY_BIN_DIR}/mp$$fl; done # 20050916 fxm: not sure why simpler substitution method does not work # - for fl in ${MDL_MPI_TRG}; do /bin/cp -f ${MY_BIN_DIR}/$$fl ${MY_BIN_DIR}/$(subst mp,,$$fl); done strip: - printf "Before stripping...\n";ls -l ${MDL_BIN};strip ${MDL_BIN};printf "After stripping...\n";ls -l ${MDL_BIN} # Targets in bld buildclean: bld_cln bld_cln: cd ${MY_BLD_DIR}; rm -f TAGS libtest: libtst libtst: libnco_tst libnco_c++_tst libnco_tst: ${MY_BLD_DIR}/libnco_tst ${MY_BLD_DIR}/libnco_tst: ${MY_BLD_DIR}/libnco_tst.o lib ${CC} -o $@${BNR_SFX} $< ${LDFLAGS} chmod 755 $@${BNR_SFX} libnco_c++_tst: ${MY_BLD_DIR}/libnco_c++_tst ${MY_BLD_DIR}/libnco_c++_tst: ${MY_BLD_DIR}/libnco_c++_tst.o lib ${CXX} -o $@${BNR_SFX} $< ${LDFLAGS} chmod 755 $@${BNR_SFX} rpm: ${MY_BLD_DIR}/nco.spec # Building rpm requires root priveleges, e.g., sudo make NCO_VRS=4.5.2 rpm # Building NCO RPM requires following packages # rpm -q bison flex netcdf-devel libtool automake autoconf udunits udunits-devel curl-devel libxml2 libxml2-devel librx-devel # sudo yum install bison flex netcdf-devel libtool automake autoconf udunits udunits-devel curl-devel libxml2 libxml2-devel librx-devel cd ${DATA}/tmp; \ /bin/rm -fr ${DATA}/tmp/nco*; \ cp -r ${HOME}/nco nco-${NCO_VRS}; \ tar cvzf nco-${NCO_VRS}.tar.gz ./nco-${NCO_VRS}; \ mv ${DATA}/tmp/nco-${NCO_VRS}.tar.gz /usr/src/redhat/SOURCES; \ /bin/rm -f /usr/src/redhat/SPECS/nco-${NCO_VRS}.spec; \ ln -s ${HOME}/nco/bld/nco.spec /usr/src/redhat/SPECS/nco-${NCO_VRS}.spec; \ cd /usr/src/redhat/SPECS; \ rpmbuild -ba --sign nco-${NCO_VRS}.spec; # Crypographically sign RPM packages with GPG: http://fedoranews.org/tchung/gpg # gpg --export -a 'Charlie Zender' > ~/GPG-zender # Export public key from key ring to text file # sudo rpm --import ~/GPG-zender # Import public key to RPM database # rpm -q gpg-pubkey --qf '%{name}-%{version}-%{release} --> %{summary}\n' # Verify list of GPG public keys in RPM database # Verify ~/.rpmmacros file specifies _signature and gpg_name # sudo rpm --addsign /usr/src/redhat/SRPMS/nco-${NCO_VRS}-?.src.rpm /usr/src/redhat/RPMS/i386/nco-${NCO_VRS}-?.i386.rpm # Sign RPM packages # rpm --checksig /usr/src/redhat/SRPMS/nco-${NCO_VRS}-?.src.rpm /usr/src/redhat/RPMS/i386/nco-${NCO_VRS}-?.i386.rpm # Check signatures rpmnet: ${MY_BLD_DIR}/nco.spec # Building rpm requires root priveleges, e.g., sudo make NCO_VRS=3.1.8 rpmnet - if test -f /usr/src/redhat/SOURCES/nco-${NCO_VRS}.tar.gz; then printf "Using existing nco-${NCO_VRS}.tar.gz\n" ; else ${MY_BIN_DIR}/ncks -R -p ftp://dust.ess.uci.edu/pub/zender/nco -l /usr/src/redhat/SOURCES nco-${NCO_VRS}.tar.gz; fi /bin/rm -f /usr/src/redhat/SPECS/nco-${NCO_VRS}.spec; \ cd /usr/src/redhat/SOURCES; \ tar xvzf nco-${NCO_VRS}.tar.gz ./nco-${NCO_VRS}/bld/nco.spec; \ mv ./nco-${NCO_VRS}/bld/nco.spec /usr/src/redhat/SPECS/nco.spec; \ cd /usr/src/redhat/SPECS; \ rpmbuild -ba --sign nco.spec; \ scp /usr/src/redhat/SRPMS/nco-${NCO_VRS}-?.src.rpm /usr/src/redhat/RPMS/i386/nco-${NCO_VRS}-?.i386.rpm zender@dust.ess.uci.edu:/var/www/html/nco/src rpm_cln: rpm --erase ${MDL_RPM_NST_NM} # Targets in bm bench: bm bnch: bm bm: cd ${MY_BM_DIR}; \ env MY_BIN_DIR=${MY_BIN_DIR} ../bm/nco_bm.pl --dbg=0 --bench --udpreport ${FL_FMT_SNG} ${MPI_PRC_SNG} ${THR_NBR_SNG} file: fl fl: cd ${MY_BM_DIR}; \ env MY_BIN_DIR=${MY_BIN_DIR} ../bm/nco_bm.pl --dbg=0 --test_files=A --udpreport ${FL_FMT_SNG} ${MPI_PRC_SNG} ${THR_NBR_SNG} regression: tst rgr: tst test: tst tst: dat cd ${MY_BM_DIR}; \ env MY_BIN_DIR=${MY_BIN_DIR} ../bm/nco_bm.pl --dbg=0 --regress --udpreport ${FL_FMT_SNG} ${MPI_PRC_SNG} ${THR_NBR_SNG} # Targets in dat # ncgen rules to build netCDF4 files must be error-tolerant to build on netCDF3-only installations bug: ${MY_DAT_DIR}/buggy.nc ${MY_DAT_DIR}/buggy.nc: ${MY_DAT_DIR}/buggy.cdl -ncgen -k netCDF-4 -b -o $@ $< dap: data -cd ~/nco/data; scp in.nc in.cdl dust.ess.uci.edu:/var/www/html/dodsdata; scp in.nc in.cdl esmf.ess.uci.edu:/var/www/html/dodsdata; scp in.nc in.cdl esmf.ess.uci.edu:/data/dodsdata data: dat dat: ${MY_DAT_DIR}/cmip5.nc ${MY_DAT_DIR}/obs.nc ${MY_DAT_DIR}/dsm.nc ${MY_DAT_DIR}/hdn.nc ${MY_DAT_DIR}/hdf.hdf ${MY_DAT_DIR}/mdl_1.nc ${MY_DAT_DIR}/mdl_2.nc ${MY_DAT_DIR}/mdl_3.nc ${MY_DAT_DIR}/mrd.nc ${MY_DAT_DIR}/in.nc ${MY_DAT_DIR}/in_4c.nc ${MY_DAT_DIR}/in_grp.nc ${MY_DAT_DIR}/in_4.nc ${MY_DAT_DIR}/in_grp_1.nc ${MY_DAT_DIR}/in_grp_2.nc ${MY_DAT_DIR}/in_grp_3.nc ${MY_DAT_DIR}/in_grp_4.nc ${MY_DAT_DIR}/in_grp_5.nc ${MY_DAT_DIR}/in_grp_6.nc ${MY_DAT_DIR}/in_grp_7.nc ${MY_DAT_DIR}/in_grp_8.nc ${MY_DAT_DIR}/in_rec_zero.nc -for fl in ${MDL_DAT_STB}; do cd ${MY_DAT_DIR}; ln -s -f in.nc $$fl; done ${MY_DAT_DIR}/in.nc: ${MY_DAT_DIR}/in.cdl ncgen -b -o $@ $< ${MY_DAT_DIR}/in_4c.nc: ${MY_DAT_DIR}/in.nc -ncks -O -7 --cnk_dmn time,10 $< $@ # ncgen default chunksize for time = 4 MB produces ~200 MB in_4c.nc file. Avoid that! # -ncgen -k hdf5-nc3 -b -o $@ $< ${MY_DAT_DIR}/in_rec_zero.nc: ${MY_DAT_DIR}/in_rec_zero.cdl ncgen -b -o $@ $< ${MY_DAT_DIR}/in_grp.nc: ${MY_DAT_DIR}/in_grp.cdl -ncgen -k netCDF-4 -b -o $@ $< ${MY_DAT_DIR}/in_4.nc: ${MY_DAT_DIR}/in_4.cdl -ncgen -k netCDF-4 -b -o $@ $< ${MY_DAT_DIR}/in_1.nc: ${MY_DAT_DIR}/in_1.cdl -ncgen -k netCDF-4 -b -o $@ $< ${MY_DAT_DIR}/in_2.nc: ${MY_DAT_DIR}/in_2.cdl -ncgen -k netCDF-4 -b -o $@ $< ${MY_DAT_DIR}/in_grp_1.nc: ${MY_DAT_DIR}/in_grp_1.cdl -ncgen -k netCDF-4 -b -o $@ $< ${MY_DAT_DIR}/in_grp_2.nc: ${MY_DAT_DIR}/in_grp_2.cdl -ncgen -k netCDF-4 -b -o $@ $< ${MY_DAT_DIR}/in_grp_3.nc: ${MY_DAT_DIR}/in_grp_3.cdl -ncgen -k netCDF-4 -b -o $@ $< ${MY_DAT_DIR}/in_grp_4.nc: ${MY_DAT_DIR}/in_grp_4.cdl -ncgen -k netCDF-4 -b -o $@ $< ${MY_DAT_DIR}/in_grp_5.nc: ${MY_DAT_DIR}/in_grp_5.cdl -ncgen -k netCDF-4 -b -o $@ $< ${MY_DAT_DIR}/in_grp_6.nc: ${MY_DAT_DIR}/in_grp_6.cdl -ncgen -k netCDF-4 -b -o $@ $< ${MY_DAT_DIR}/in_grp_7.nc: ${MY_DAT_DIR}/in_grp_7.cdl -ncgen -k netCDF-4 -b -o $@ $< ${MY_DAT_DIR}/in_grp_8.nc: ${MY_DAT_DIR}/in_grp_8.cdl -ncgen -k netCDF-4 -b -o $@ $< ${MY_DAT_DIR}/cmip5.nc: ${MY_DAT_DIR}/cmip5.cdl -ncgen -k netCDF-4 -b -o $@ $< ${MY_DAT_DIR}/hdn.nc: ${MY_DAT_DIR}/hdn.cdl -ncgen -k netCDF-4 -b -o $@ $< ${MY_DAT_DIR}/mrd.nc: ${MY_DAT_DIR}/mrd.cdl -ncgen -k netCDF-4 -b -o $@ $< ${MY_DAT_DIR}/dsm.nc: ${MY_DAT_DIR}/dsm.cdl -ncgen -k netCDF-4 -b -o $@ $< ${MY_DAT_DIR}/obs.nc: ${MY_DAT_DIR}/obs.cdl -ncgen -k netCDF-4 -b -o $@ $< ${MY_DAT_DIR}/hdf.hdf: ${MY_DAT_DIR}/hdf.cdl -hncgen -b -o $@ $< ${MY_DAT_DIR}/mdl_1.nc: ${MY_DAT_DIR}/mdl_1.cdl -ncgen -k netCDF-4 -b -o $@ $< ${MY_DAT_DIR}/mdl_2.nc: ${MY_DAT_DIR}/mdl_2.cdl -ncgen -k netCDF-4 -b -o $@ $< ${MY_DAT_DIR}/mdl_3.nc: ${MY_DAT_DIR}/mdl_3.cdl -ncgen -k netCDF-4 -b -o $@ $< ${MY_DAT_DIR}/snd_ncwa.nc: ${MY_DAT_DIR}/snd_ncwa.cdl -ncgen -k netCDF-4 -b -o $@ $< ${MY_DAT_DIR}/snc_ncwa.nc: ${MY_DAT_DIR}/snc_ncwa.cdl -ncgen -k netCDF-4 -b -o $@ $< ${MY_DAT_DIR}/snd_grp.nc: ${MY_DAT_DIR}/snd_grp.cdl -ncgen -k netCDF-4 -b -o $@ $< ${MY_DAT_DIR}/snc_grp.nc: ${MY_DAT_DIR}/snc_grp.cdl -ncgen -k netCDF-4 -b -o $@ $< ${MY_DAT_DIR}/snc.nc: ${MY_DAT_DIR}/snc.cdl -ncgen -k netCDF-4 -b -o $@ $< ${MY_DAT_DIR}/snd.nc: ${MY_DAT_DIR}/snd.cdl -ncgen -k netCDF-4 -b -o $@ $< ${MY_DAT_DIR}/split.nc: ${MY_DAT_DIR}/split.cdl -ncgen -b -o $@ $< dataclean: dat_cln dat_cln: rm -f ${MDL_DAT} cd ${MY_DAT_DIR}; rm -f foo* tst_ftp: dat - if test -f ${MY_DAT_DIR}/nco_tst.nc; then printf "" ; else ${MY_BIN_DIR}/ncks -q -R -p ftp://dust.ess.uci.edu/pub/zender/nco -l ${MY_DAT_DIR} nco_tst.nc; if [ $? != 0 ]; then printf "WARNING: Unable to retrieve ftp://dust.ess.uci.edu/pub/zender/nco/nco_tst.nc required for self-test, possible problem with getting through your firewall? Manually download and install in directory ../data to continue self test...\n"; fi; fi cd ${MY_BLD_DIR}; \ env MY_BIN_DIR=${MY_BIN_DIR} MY_DAT_DIR=${MY_DAT_DIR} ./nco_tst.pl testclean: tst_cln tst_cln: cd ${MY_DAT_DIR}; rm -f foo* nco_tst.nc # Targets in doc # Each make directive line spawns a separate shell so must use `cd dir;cmd' format doc: ${MY_DOC_DIR}/nco.dvi ${MY_DOC_DIR}/nco.html ${MY_DOC_DIR}/nco.info ${MY_DOC_DIR}/nco.ps ${MY_DOC_DIR}/nco.pdf ${MY_DOC_DIR}/nco.txt ${MY_DOC_DIR}/nco.xml ${MY_DOC_DIR}/nco.dvi: ${MY_DOC_DIR}/nco.texi cd ${MY_DOC_DIR}; texi2dvi --output=$@ $< ${MY_DOC_DIR}/nco.info: ${MY_DOC_DIR}/nco.texi cd ${MY_DOC_DIR}; makeinfo --no-split --output=$@ $< ${MY_DOC_DIR}/nco.html: ${MY_DOC_DIR}/nco.texi cd ${MY_DOC_DIR}; texi2html -monolithic -verbose $< # cd ${MY_DOC_DIR}; makeinfo --html --no-split --output=$@ $< ${MY_DOC_DIR}/nco.ps: ${MY_DOC_DIR}/nco.dvi cd ${MY_DOC_DIR}; dvips -o $@ nco.dvi ${MY_DOC_DIR}/nco.pdf: ${MY_DOC_DIR}/nco.texi cd ${MY_DOC_DIR}; texi2dvi --pdf --output=$@ $< # cd ${MY_DOC_DIR}; ps2pdf -dMaxSubsetPct=100 -dCompatibilityLevel=1.2 -dSubsetFonts=true -dEmbedAllFonts=true nco.ps $@ ${MY_DOC_DIR}/nco.txt: ${MY_DOC_DIR}/nco.texi cd ${MY_DOC_DIR}; makeinfo --no-headers --no-split --output=$@ $< # Neither of these xml formats seems to be viewable ${MY_DOC_DIR}/nco.xml: ${MY_DOC_DIR}/nco.texi cd ${MY_DOC_DIR}; makeinfo --xml --no-split --output=$@ $< # cd ${MY_DOC_DIR}; makeinfo --docbook --no-split --output=$@ $< docclean: doc_cln doc_cln: cd ${MY_DOC_DIR}; rm -f nco.info* nco.dvi nco.html* nco.ps nco.pdf *~ # Targets in dpn depend: dpn dpn: ${MDL_DPN} dpn_cln: rm -f ${MDL_DPN} # Targets in inc include: inc inc: ${MDL_INC} inc_cln: rm -f ${MDL_INC} love: echo "Not war?" # Targets in lib library: lib lib : inc ${libnco}.a ifeq (${PVM_ARCH},MACOS) ranlib ${libnco}.a endif # endif LINUX # If not using glibc, build Sittler's getopt() and getopt_long() functions ifeq (${null},$(findstring ${PVM_ARCH},FREEBSDLINUXALPHALINUXAMD64LINUXARMMACOSWINOS)) ${libnco}.a: ${libnco}.a(${MY_OBJ_DIR}/nco_getopt.o) endif # endif not glibc ${libnco}.a: ${libnco}.a(${MY_OBJ_DIR}/nco_att_utl.o) \ ${libnco}.a(${MY_OBJ_DIR}/nco_aux.o) \ ${libnco}.a(${MY_OBJ_DIR}/nco_bnr.o) \ ${libnco}.a(${MY_OBJ_DIR}/nco_cln_utl.o) \ ${libnco}.a(${MY_OBJ_DIR}/nco_cnf_dmn.o) \ ${libnco}.a(${MY_OBJ_DIR}/nco_cnf_typ.o) \ ${libnco}.a(${MY_OBJ_DIR}/nco_cnk.o) \ ${libnco}.a(${MY_OBJ_DIR}/nco_cnv_arm.o) \ ${libnco}.a(${MY_OBJ_DIR}/nco_cnv_csm.o) \ ${libnco}.a(${MY_OBJ_DIR}/nco_crt.o) \ ${libnco}.a(${MY_OBJ_DIR}/nco_ctl.o) \ ${libnco}.a(${MY_OBJ_DIR}/nco_dbg.o) \ ${libnco}.a(${MY_OBJ_DIR}/nco_dmn_utl.o) \ ${libnco}.a(${MY_OBJ_DIR}/nco_fl_utl.o) \ ${libnco}.a(${MY_OBJ_DIR}/nco_flt.o) \ ${libnco}.a(${MY_OBJ_DIR}/nco_grp_trv.o) \ ${libnco}.a(${MY_OBJ_DIR}/nco_grp_utl.o) \ ${libnco}.a(${MY_OBJ_DIR}/nco_kd.o) \ ${libnco}.a(${MY_OBJ_DIR}/nco_lmt.o) \ ${libnco}.a(${MY_OBJ_DIR}/nco_lst_utl.o) \ ${libnco}.a(${MY_OBJ_DIR}/nco_map.o) \ ${libnco}.a(${MY_OBJ_DIR}/nco_md5.o) \ ${libnco}.a(${MY_OBJ_DIR}/nco_mmr.o) \ ${libnco}.a(${MY_OBJ_DIR}/nco_msa.o) \ ${libnco}.a(${MY_OBJ_DIR}/nco_mss_val.o) \ ${libnco}.a(${MY_OBJ_DIR}/nco_mta.o) \ ${libnco}.a(${MY_OBJ_DIR}/nco_netcdf.o) \ ${libnco}.a(${MY_OBJ_DIR}/nco_omp.o) \ ${libnco}.a(${MY_OBJ_DIR}/nco_pck.o) \ ${libnco}.a(${MY_OBJ_DIR}/nco_ply.o) \ ${libnco}.a(${MY_OBJ_DIR}/nco_ply_lst.o) \ ${libnco}.a(${MY_OBJ_DIR}/nco_ppc.o) \ ${libnco}.a(${MY_OBJ_DIR}/nco_prn.o) \ ${libnco}.a(${MY_OBJ_DIR}/nco_rec_var.o) \ ${libnco}.a(${MY_OBJ_DIR}/nco_rgr.o) \ ${libnco}.a(${MY_OBJ_DIR}/nco_rth_flt.o) \ ${libnco}.a(${MY_OBJ_DIR}/nco_rth_utl.o) \ ${libnco}.a(${MY_OBJ_DIR}/nco_s1d.o) \ ${libnco}.a(${MY_OBJ_DIR}/nco_scl_utl.o) \ ${libnco}.a(${MY_OBJ_DIR}/nco_scm.o) \ ${libnco}.a(${MY_OBJ_DIR}/nco_sld.o) \ ${libnco}.a(${MY_OBJ_DIR}/nco_sng_utl.o) \ ${libnco}.a(${MY_OBJ_DIR}/nco_sph.o) \ ${libnco}.a(${MY_OBJ_DIR}/nco_srm.o) \ ${libnco}.a(${MY_OBJ_DIR}/nco_var_avg.o) \ ${libnco}.a(${MY_OBJ_DIR}/nco_var_lst.o) \ ${libnco}.a(${MY_OBJ_DIR}/nco_var_rth.o) \ ${libnco}.a(${MY_OBJ_DIR}/nco_var_scv.o) \ ${libnco}.a(${MY_OBJ_DIR}/nco_var_utl.o) $(AR) rsv $@ $^ libclean: lib_cln lib_cln: rm -f ${libnco}.* ${libnco}*.* ${libnco}++.a ${libnco}_c++.a # Targets in man man: ${MDL_MAN} cd ../man;sudo cp -f *.1 ${MY_MAN_DIR}/man1 man_cln: rm -f ${MDL_MAN} # Targets in obj object: obj obj: ${MDL_OBJ} objclean: obj_cln obj_cln: rm -f ${MDL_OBJ} # Targets in root autotools: dst_cln - cd ..; aclocal;autoheader;automake --foreign;autoconf ; ./configure --enable-optimize-custom --prefix=${HOME} --bindir=${MY_BIN_DIR} --datadir=${HOME}/nco/data --libdir=${MY_LIB_DIR} --mandir=${HOME}/nco/man ; ${MAKE} install rootclean: root_cln root_cln: - cd ..; rm -f config.h config.guess config.log config.status config.sub libtool Makefile stamp-h1; rm -r -f autom4te.cache conftest # Targets in src src: ${MDL_NCAP} src_cln: rm -f ${MDL_NCAP} # Targets in /usr/local sys: ${MDL_BIN_TRG} ${MDL_BIN_SPT} - cd ${MY_BIN_DIR};sudo /bin/cp -f ${MDL_BIN_TRG} ${MDL_BIN_SPT} ncap2 /usr/local/bin; cd /usr/local/bin; sudo rm -f ncdiff ncea nces ncrcat ncunpack; sudo ln -s -f ncbo ncdiff; sudo ln -s -f ncra ncea; sudo ln -s -f ncra nces; sudo ln -s -f ncra ncrcat; sudo ln -s -f ncpdq ncunpack; sudo ln -s -f ncpdq ncpack; cd ${HOME}/nco/src/nco++; ${MAKE} -f Makefile.old OPTS=${OPTS} $@ sys_cln: - cd /usr/local/bin;rm -f ${MDL_BIN_TRG} ${MDL_BIN_SPT} ${MDL_BIN_SYM_LNK} # Housekeeping clean: cln cln: lib_cln dpn_cln obj_cln src_cln tst_cln cd ${MY_DOC_DIR}; rm -f nco.aux nco.cp nco.cps nco.fn nco.ky nco.log nco.pg nco.toc nco.tp nco.vr debug: dbg dbg: @printf "ABI = ${ABI}\n" @printf "AR = ${AR}\n" @printf "ARFLAGS = ${ARFLAGS}\n" @printf "BNR_SFX = ${BNR_SFX}\n" @printf "CC = ${CC}\n" @printf "CCACHE = ${CCACHE}\n" @printf "CFLAGS = ${CFLAGS}\n" @printf "CNK = ${CNK}\n" @printf "CPP = ${CPP}\n" @printf "CPPFLAGS = ${CPPFLAGS}\n" @printf "CPP_PTH = ${CPP_PTH}\n" @printf "CPP_TKN = ${CPP_TKN}\n" @printf "CURL_LIB = ${CURL_LIB}\n" @printf "CXX = ${CXX}\n" @printf "CXXFLAGS = ${CXXFLAGS}\n" @printf "DAP = ${DAP}\n" @printf "DAP_ROOT = ${DAP_ROOT}\n" @printf "DBG = ${DBG}\n" @printf "FC = ${FC}\n" @printf "FFLAGS = ${FFLAGS}\n" @printf "FL_FMT = ${FL_FMT}\n" @printf "GCC_RCH_ARG = ${GCC_RCH_ARG}\n" @printf "GSL = ${GSL}\n" @printf "GSL_INC_FLG = ${GSL_INC_FLG}\n" @printf "GSL_LIB_FLG = ${GSL_LIB_FLG}\n" @printf "HDF5_ROOT = ${HDF5_ROOT}\n" @printf "HDF5_INC = ${HDF5_INC}\n" @printf "HDF5_LIB = ${HDF5_LIB}\n" @printf "HOST = ${HOST}\n" @printf "HOSTNAME = ${HOSTNAME}\n" @printf "ICC_RCH_ARG = ${ICC_RCH_ARG}\n" @printf "INC_NCAR = ${INC_NCAR}\n" @printf "LAMMPICC = ${LAMMPICC}\n" @printf "LAMMPICXX = ${LAMMPICXX}\n" @printf "LDFLAGS = ${LDFLAGS}\n" @printf "LEX = ${LEX}\n" @printf "LFLAGS = ${LFLAGS}\n" @printf "LIB_NCAR = ${LIB_NCAR}\n" @printf "LINUX_CC = ${LINUX_CC}\n" @printf "LINUX_CXX = ${LINUX_CXX}\n" @printf "MDL_BIN = ${MDL_BIN}\n" @printf "MDL_BIN_SPT = ${MDL_BIN_SPT}\n" @printf "MDL_BIN_SYM_LNK = ${MDL_BIN_SYM_LNK}\n" @printf "MDL_BIN_TRG = ${MDL_BIN_TRG}\n" @printf "MDL_DPN = ${MDL_DPN}\n" @printf "MDL_MAN = ${MDL_MAN}\n" @printf "MDL_MPI_TRG = ${MDL_MPI_TRG}\n" @printf "MDL_OBJ = ${MDL_OBJ}\n" @printf "MDL_PTH = ${MDL_PTH}\n" @printf "MDL_RPM_NST_NM = ${MDL_RPM_NST_NM}\n" @printf "MDL_SRC = ${MDL_SRC}\n" @printf "MPI = ${MPI}\n" @printf "MPICC = ${MPICC}\n" @printf "MPICH_CC = ${MPICH_CC}\n" @printf "MPICH_CXX = ${MPICH_CXX}\n" @printf "MPICXX = ${MPICXX}\n" @printf "MPI_PRC = ${MPI_PRC}\n" @printf "MPI_PRC_SNG = ${MPI_PRC_SNG}\n" @printf "MPI_ROOT = ${MPI_ROOT}\n" @printf "MY_BIN_DIR = ${MY_BIN_DIR}\n" @printf "MY_BLD_DIR = ${MY_BLD_DIR}\n" @printf "MY_BLD_DIR = ${MY_BLD_DIR}\n" @printf "MY_DAT_DIR = ${MY_DAT_DIR}\n" @printf "MY_DOC_DIR = ${MY_DOC_DIR}\n" @printf "MY_DPN_DIR = ${MY_DPN_DIR}\n" @printf "MY_INC_DIR = ${MY_INC_DIR}\n" @printf "MY_LIB_DIR = ${MY_LIB_DIR}\n" @printf "MY_MAN_DIR = ${MY_MAN_DIR}\n" @printf "MY_OBJ_DIR = ${MY_OBJ_DIR}\n" @printf "NCO_LDFLAGS = ${NCO_LDFLAGS}\n" @printf "NCO_VRS = ${NCO_VRS}\n" @printf "NC_CFLAGS = ${NC_CFLAGS}\n" @printf "NC_LDFLAGS = ${NC_LDFLAGS}\n" @printf "NETCDF4 = ${NETCDF4}\n" @printf "NETCDF4_ROOT = ${NETCDF4_ROOT}\n" @printf "NETCDF_INC = ${NETCDF_INC}\n" @printf "NETCDF_LIB = ${NETCDF_LIB}\n" @printf "NETCDF_ROOT = ${NETCDF_ROOT}\n" @printf "OMP = ${OMP}\n" @printf "OPTS = ${OPTS}\n" @printf "OTHER_CFLAGS = ${OTHER_CFLAGS}\n" @printf "OTHER_LDFLAGS = ${OTHER_LDFLAGS}\n" @printf "PGI_RCH_ARG = ${PGI_RCH_ARG}\n" @printf "PNETCDF = ${PNETCDF}\n" @printf "PSC_RCH_ARG = ${PSC_RCH_ARG}\n" @printf "PVM_ARCH = ${PVM_ARCH}\n" @printf "RPM = ${RPM}\n" @printf "SRC_LST = ${SRC_LST}\n" @printf "STC = ${STC}\n" @printf "SZ = ${SZ}\n" @printf "SZ_LIB = ${SZ_LIB}\n" @printf "TAGS_FILES = ${TAGS_FILES}\n" @printf "TAGS_FILTER_FILES = ${TAGS_FILTER_FILES}\n" @printf "THR_NBR = ${THR_NBR}\n" @printf "THR_NBR_SNG = ${THR_NBR_SNG}\n" @printf "UDUNITS = ${UDUNITS}\n" @printf "UDUNITS_INC = ${UDUNITS_INC}\n" @printf "UDUNITS_LIB = ${UDUNITS_LIB}\n" @printf "UDUNITS_INC_FLG = ${UDUNITS_INC_FLG}\n" @printf "UDUNITS_LIB_FLG = ${UDUNITS_LIB_FLG}\n" @printf "VPATH = ${VPATH}\n" @printf "VRS_SNG = ${VRS_SNG}\n" @printf "YACC = ${YACC}\n" @printf "YFLAGS = ${YFLAGS}\n" distclean: dst_cln dst_cln: cln bin_cln dat_cln doc_cln root_cln cd ${MY_BLD_DIR}; rm -f *~ cd ${MY_DAT_DIR}; rm -f buggy.nc cmip5.nc dsm.nc obs.nc hdf.hdf mdl_1.nc mdl_2.nc mdl_3.nc in.nc in_4c.nc in_4.nc in_grp.nc in_grp_1.nc in_grp_2.nc in_grp_3.nc in_grp_4.nc in_grp_5.nc in_grp_6.nc in_grp_7.nc in_grp_8.nc in_rec_zero.nc *~ tags: etags ${TAGS_FILES} # etags ${MY_SRC_DIR}/*.h $(filter-out ${TAGS_FILTER_FILES},${SRC_LST}) ${MDL_DOC_SRC} ${MDL_MAN} ${MDL_BLD_SRC} ${MDL_CXX_SRC} ${MDL_NCAP_SRC} # Reset internal YACC and LEX patterns %.c : %.y %.c : %.l # It is safest to do both YACC and LEX after either file changes # Otherwise only changing one and then switching, e.g., from bison to yacc, can cause problems # NB: Bison has problem when bison.simple declares yyparse() as int yyparse (void); # Solution is to comment out that definition in bison.simple ifeq (${YACC},bison) ${MY_SRC_DIR}/%_yacc.c ${MY_SRC_DIR}/%_yacc.h : ${MY_SRC_DIR}/%_yacc.y ${YACC} ${YFLAGS} --output=$(basename $<).c -d $< #${MY_SRC_DIR}/%_yacc.c ${MY_SRC_DIR}/%_yacc.h : ${MY_SRC_DIR}/%_yacc.y # ${YACC} ${YFLAGS} --file-prefix=$(notdir $($(basename $<))) -d $< #%_yacc.c %_yacc.h : %_yacc.y # ${YACC} ${YFLAGS} --file-prefix=$(notdir $($(basename $<))) -d $< endif ifeq (${YACC},yacc) %.tab.c %.tab.h : %.y ${YACC} ${YFLAGS} $< mv y.tab.c $(basename $<).c mv y.tab.h $(basename $<).h endif %_lex.c : %_lex.l ${LEX} ${LFLAGS} $< mv lex.${NCO_YY_PFX}.c $(basename $<).c # Target-specific variable values syntax TARGET ... : VARIABLE-ASSIGNMENT # Rules begin in leftmost column else interpreted as commands ifneq (${null},$(findstring ${PVM_ARCH},LINUXALPHALINUXAMD64LINUXARMFREEBSD)) ifeq (gcc,$(firstword ${CC})) ${MY_OBJ_DIR}/nco_grp_trv.o : CFLAGS := $(filter-out -Wcast-qual,${CFLAGS}) ${MY_OBJ_DIR}/nco_grp_trv.o : CXXFLAGS := $(filter-out -Wcast-qual,${CXXFLAGS}) endif # endif GCC endif # endif LINUX # ncap, and only ncap, requires AIX system C++ library ifneq (${null},$(findstring AIX,${PVM_ARCH})) ifneq (${null},$(findstring xl,${CC})) # Target-specific variable values syntax TARGET ... : VARIABLE-ASSIGNMENT # Rules begin in leftmost column else interpreted as commands ncap : LDFLAGS += -lC endif # endif AIX VA Compiler Collection endif # endif AIX # For some reason, ncap_lex.c is not remade when I expect it to be, so I explicitly remove the object file every time ncap: ${MY_OBJ_DIR}/ncap_lex.o ${MY_OBJ_DIR}/ncap_utl.o ${libnco}.a ncap2 : -cd ../src/nco++; ${MAKE} -f Makefile.old DAP=${DAP} DBG=${DBG} GSL=${GSL} MPI=${MPI} NETCDF4=${NETCDF4} OMP=${OMP} OPTS=${OPTS} PNETCDF=${PNETCDF} SZ=${SZ} UDUNITS=${UDUNITS} all # /bin/rm -f ${MDL_NCAP} ${MY_OBJ_DIR}/$@_lex.o # Create dependency files only if they will not be immediately deleted INCLUDE_DPN := TRUE GOALS_WHICH_DELETE_DEPENDENCY_FILES := cln clean dir distclean dst_cln dpn_cln tags uninstall ifeq (${null},$(findstring $(MAKECMDGOALS),${GOALS_WHICH_DELETE_DEPENDENCY_FILES})) INCLUDE_DPN := TRUE else INCLUDE_DPN := FALSE endif ifeq (${INCLUDE_DPN},TRUE) -include ${MDL_DPN} endif nco-5.3.3/bld/ddd_mpd.py000077500000000000000000000137101477164337000150300ustar00rootroot00000000000000#!/usr/bin/env python # spawns a ddd session for each one found in mpilistjobs # nco-specific: sends SIGUSR1 to nodeid>0 processes # $Id$ # Usage: # ./ddd_mpd.py # -- spawn ddd sessions for each MPI process found via # mpdlistjobs for a particular MPI job. Before spawning, send SIGUSR1 # to the processes of rank > 0 (the non-manager nodes) to reduce user # tedium. If multiple jobs are found on MPD, prompt user to select # one of jobs. # -- If no jobs owned by the current user are found in mpd, # complain and exit. # # Prefer something else than ddd? Try changing the argument at the # call to mainthing(...). Support hasn't been checked for # command-line arguments other than ddd/gdb, so you may have to hack # spawnDebugger(...) as a short-term solution. # # Please direct feedback to the sourceforge forums for NCO. Thanks, -Daniel from os import environ, getuid, getpid, path, getcwd, popen3 import os class Job: pass def newJob(jid, username, host, pid, sid, rank, path): job = Job() job.jobid = jid job.username = username job.host = host job.pid = pid job.sid = sid job.rank = rank job.pgm = path return job def readJobInfo(jobtext): job = Job() #print "got job ", jobtext lines = jobtext.split("\n") for line in lines: pair = line.split("=") if len(pair) > 1: key,value = pair #print key.strip(),value.strip() exec "job."+key.strip()+"="+"\""+value.strip()+"\"" return job; def readJobListMPD(): joblist = [] jobI, jobO, jobE = popen3("mpdlistjobs") allinfo = jobO.read() for jobtext in allinfo.split("\n\n"): joblist.append(readJobInfo(jobtext)) return joblist def makeSampleJobList(): ## dummy for testing joblist = [] joblist.append(newJob( "21@dirt_3734", "wangd", "dirt", "11931", "11926", "0", "/home/wangd/nco/nco/mpi_bin/mpncwa")) joblist.append(newJob( "21@dirt_3734", "wangd", "dirt", "11929", "11927", "1", "/home/wangd/nco/nco/mpi_bin/mpncwa")) joblist.append(newJob( "21@dirt_3734", "wangd", "dirt", "11930", "11928", "2", "/home/wangd/nco/nco/mpi_bin/mpncwa")) # next two jobs should be culled joblist.append(newJob( "10@dirt_3734", "somebody", "dirt", "112", "110", "0", "/badpath/mpncbo")) joblist.append(newJob( "10@dirt_3734", "somebody", "dirt", "119", "111", "1", "/badpath/mpncbo")) joblist.append(newJob( "24@dirt_3734", "wangd", "dirt", "11951", "11946", "0", "/home/wangd/nco/nco/mpi_bin/mpncbo")) joblist.append(newJob( "24@dirt_3734", "wangd", "dirt", "11949", "11947", "1", "/home/wangd/nco/nco/mpi_bin/mpncbo")) joblist.append(newJob( "24@dirt_3734", "wangd", "dirt", "11950", "11948", "2", "/home/wangd/nco/nco/mpi_bin/mpncbo")) return joblist def cutoutJobs(joblist, jobids, paths): print "There seems to be more than one job in MPD. Which would you like?" pick = "" index = -1 while not pick in jobids: for i in range(len(jobids)): print i,jobids[i], paths[i] print "which would you like(0..",len(jobids)-1,")?", typed = raw_input() try: index = int(typed) except ValueError: pass if index not in range(len(jobids)): print "Sorry, bad choice: ",typed, " Try another." else: pick = jobids[index] print "Chose id:", pick, " path:",paths[index] # remove job objects that do not match joblist = filter((lambda j: j.jobid == pick), joblist) return joblist def spawnDebugger(progname, joblist, debug): shI, shO, shE = popen3("sh") children = filter(lambda j: j.rank != "0", joblist) for c in children: # resume the children first s = "kill -USR1 %s\n" % (c.pid) if not debug: shI.write(s) else: print s, print "Node 0 is pid:",filter(lambda j: j.rank == "0",joblist)[0].pid shI.write("\n") for job in joblist: try: #print job.jobid, job.pid, job.rank, job.pgm dummy = job.pgm dummy = job.pid s = "%s %s %s &\n" % (progname, job.pgm, job.pid) if not debug: shI.write(s) #else: print s, except AttributeError: continue shI.close() print shO.read().strip() print shE.read().strip() def mainthing(dbgprogname): joblist = readJobListMPD() #joblist = makeSampleJobList() # for simple testing # now, go ahead and spawn ddd jobs. # for now, just spit out the command line so we don't have to deal # with the process management. *sigh* ####print len(joblist) jobids = [] paths = [] joblist = filter(lambda j: hasattr(j, "jobid"), joblist) myname = os.popen("whoami").read().strip() joblist = filter(lambda j: j.username == myname, joblist) if len(joblist) < 1: print "No acceptable jobs found." return for job in joblist: ## check to see how many jobs there are if not job.jobid in jobids: jobids.append( job.jobid ) paths.append( job.pgm ) if len(jobids) > 1: joblist = cutoutJobs(joblist, jobids, paths) spawnDebugger(dbgprogname, joblist, False) #False for no debug ## ----------------- ## main program body ## ----------------- mainthing("ddd") # if you like gdb or dbx, you may wish to try something like: # # mainthing ("xterm -e gdb") # # You will probably want to spawn xterms for each gdb to avoid # managing multiple gdb sessions from a single terminal window. nco-5.3.3/bld/libnco_c++_tst.cc000066400000000000000000000026741477164337000161660ustar00rootroot00000000000000/* Purpose: Test NCO library libnco_c++ Usage: cd ~/nco/bld Linux: g++ -I../src/nco_c++ -o libnco_c++_tst libnco_c++_tst.cc -L${MY_LIB_DIR} -lnco_c++ AIX: All at once: xlC_r -bnoquiet -I../src/nco_c++ -I/usr/local/include -o libnco_c++_tst libnco_c++_tst.cc -L${MY_LIB_DIR} -L${NETCDF_LIB} -lnco_c++ -lnetcdf xlC_r -bnoquiet -I../src/nco_c++ -I/usr/local/include -o libnco_c++_tst -Wl,-blibpath:${MY_LIB_DIR}:/usr/lpp/xlopt:/usr/lib/threads:/usr/lib:/lib libnco_c++_tst.cc -L${MY_LIB_DIR} -L${NETCDF_LIB} -lnco_c++ -lnetcdf xlC_r -c -I../src/nco_c++ -I/usr/local/include -o libnco_c++_tst.o libnco_c++_tst.cc xlC_r -bnoquiet -o libnco_c++_tst libnco_c++_tst.o -L${MY_LIB_DIR} -L${NETCDF_LIB} -lnco_c++ -lnetcdf xlC_r -bnoquiet -o libnco_c++_tst libnco_c++_tst.o -L${NETCDF_LIB} -lnco_c++ -lnetcdf ld -o libnco_c++_tst libnco_c++_tst.o -L${MY_LIB_DIR},-lnco_c++ ld -o libnco_c++_tst libnco_c++_tst.o -L${MY_LIB_DIR},-lnco_c++ -L/usr/lpp/xlopt,-lxlopt,-lc libnco_c++_tst.o /lib/crt0_64.o */ #include // Standard C++ I/O streams cout, cin #include // Standard C++ string class #include // netCDF C interface #include // C++ interface to netCDF C library int main() { const nc_type nco_xtyp(nco_get_xtype(static_cast(1.0))); // [enm] External netCDF type std::cout << "INFO External netCDF type of prc_cmp variables will be " << nco_typ_sng(nco_xtyp) << std::endl; } nco-5.3.3/bld/libnco_tst.c000066400000000000000000000022101477164337000153550ustar00rootroot00000000000000/* Purpose: Test NCO library libnco Usage: cd ~/nco/bld Linux: gcc -I../src/nco -o libnco_tst libnco_tst.c -L${MY_LIB_DIR} -lnco AIX: All at once: xlc_r -bnoquiet -I../src/nco -I/usr/local/include -o libnco_tst libnco_tst.c -L${MY_LIB_DIR} -L${NETCDF_LIB} -lnco -lnetcdf xlc_r -bnoquiet -I../src/nco -I/usr/local/include -o libnco_tst -Wl,-blibpath:${MY_LIB_DIR}:/usr/lpp/xlopt:/usr/lib/threads:/usr/lib:/lib libnco_tst.c -L${MY_LIB_DIR} -L${NETCDF_LIB} -lnco -lnetcdf xlc_r -c -I../src/nco -I/usr/local/include -o libnco_tst.o libnco_tst.c xlc_r -bnoquiet -o libnco_tst libnco_tst.o -L${MY_LIB_DIR} -L${NETCDF_LIB} -lnco -lnetcdf xlc_r -bnoquiet -o libnco_tst libnco_tst.o -L${NETCDF_LIB} -lnco -lnetcdf ld -o libnco_tst libnco_tst.o -L${MY_LIB_DIR},-lnco ld -o libnco_tst libnco_tst.o -L${MY_LIB_DIR},-lnco -L/usr/lpp/xlopt,-lxlopt,-lc libnco_tst.o /lib/crt0_64.o */ #include #define MAIN_PROGRAM_FILE #include "libnco.h" /* netCDF Operator (NCO) library */ int main() { const char * const CVS_Id="$Id$"; const char * const CVS_Revision="$Revision$"; (void)copyright_prn(CVS_Id,CVS_Revision); } nco-5.3.3/bld/nco.spec000066400000000000000000000375551477164337000145300ustar00rootroot00000000000000# Fedora RPMs are up-to-date! # http://cvs.fedoraproject.org/viewvc/devel/nco/nco.spec?view=co Name: nco Version: 5.3.3 Release: 1%{?dist} Summary: Programs that manipulate netCDF files Group: Applications/Engineering License: BSD URL: http://nco.sf.net/ # Obtain NCO version 5.3.3-1 tar.gz from Sourceforge using CVS: # cvs -d:pserver:anonymous@nco.cvs.sf.net:/cvsroot/nco login # cvs -z3 -d:pserver:anonymous@nco.cvs.sf.net:/cvsroot/nco co -r nco-5.3.3-1 -d nco-%{version} nco # tar czf nco-%{version}.tar.gz --exclude='nco-5.3.3/debian*' --exclude='.cvsignore' --exclude=ncap_lex.c --exclude='ncap_yacc.[ch]' ./nco-%{version} Source0: nco-%{version}.tar.gz #Patch0: nco_install_C_headers.patch #Patch1: nco_find_udunits-dat.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: automake, autoconf, libtool BuildRequires: netcdf, netcdf-devel BuildRequires: udunits, udunits-devel # Required for ncap, ncwa: BuildRequires: flex # Required for ncap2: BuildRequires: gsl, gsl-devel #BuildRequires: antlr antlr-c++-devel # Following libraries required to DAP-enable NCO: BuildRequires: curl, curl-devel BuildRequires: libxml2, libxml2-devel BuildRequires: libdap, libdap-devel, libnc-dap, libnc-dap-devel %package devel Summary: Development files for NCO Group: Development/Libraries Requires: %{name} = %{version}-%{release} %description NCO is a suite of programs known as operators. The operators are stand-alone, command-line programs executable in a POSIX shell. Operators take one or more netCDF files as input, perform operations (e.g., averaging, hyperslabbing), and produce a netCDF output file. NCO was originally designed to manipulate and analyze climate data, though it works on any netCDF format datasets. %description devel This package contains NCO header files and static libraries. %prep %setup -q #%patch0 -p1 #%patch1 -p1 %build aclocal autoheader automake --foreign autoconf # Explicitly set system netCDF directories to override development netCDF # installations in, e.g., /usr/local export CPPFLAGS=-I%{_includedir}/netcdf-3 # Always put netcdf-3 on path and, for x86_64, add -L/usr/lib64, when present, to correctly resolve 32/64-bit libraries export LDFLAGS="-L%{_libdir}/netcdf-3 %( uname -m | egrep -q '_64$' && [ -d /usr/lib64 ] && echo '-L/usr/lib64' )" export CFLAGS="$RPM_OPT_FLAGS -fPIC" export CXXFLAGS="$RPM_OPT_FLAGS -fpermissive -fPIC" %configure --includedir=%{_includedir}/nco make %{?_smp_mflags} unset CPPFLAGS LDFLAGS CFLAGS CXXFLAGS %install rm -rf ${RPM_BUILD_ROOT} mkdir ${RPM_BUILD_ROOT} mkdir -p ${RPM_BUILD_ROOT}%{_includedir}/nco make install DESTDIR=${RPM_BUILD_ROOT} rm -f ${RPM_BUILD_ROOT}%{_libdir}/*.la rm -f ${RPM_BUILD_ROOT}%{_infodir}/dir rm -f ${RPM_BUILD_ROOT}%{_bindir}/mpnc* %clean rm -rf ${RPM_BUILD_ROOT} %post /sbin/ldconfig /sbin/install-info %{_infodir}/nco.info.gz \ %{_infodir}/dir 2>/dev/null || : %postun /sbin/ldconfig if [ "$1" = 0 ]; then /sbin/install-info --delete %{_infodir}/nco.info.gz \ %{_infodir}/dir 2>/dev/null || : fi %files %defattr(-,root,root,-) %doc doc/README doc/LICENSE doc/rtfm.txt %{_bindir}/* %{_mandir}/*/* %{_infodir}/* %{_libdir}/libnco*[0-9]*.so %files devel %defattr(-,root,root,-) %{_includedir}/nco %{_libdir}/libnco*.a %{_libdir}/libnco.so %{_libdir}/libnco_c++.so # %{_libdir}/libnco++.so %changelog * Fri Mar 28 2025 Charlie Zender - 5.3.3-1 - new upstream 5.3.3 * Wed Feb 05 2025 Charlie Zender - 5.3.2-1 - new upstream 5.3.2 * Sun Jan 12 2025 Charlie Zender - 5.3.1-1 - new upstream 5.3.1 * Mon Dec 23 2024 Charlie Zender - 5.3.0-1 - new upstream 5.3.0 * Fri Oct 18 2024 Charlie Zender - 5.2.9-1 - new upstream 5.2.9 * Mon Sep 02 2024 Charlie Zender - 5.2.8-1 - new upstream 5.2.8 * Tue Jul 23 2024 Charlie Zender - 5.2.7-1 - new upstream 5.2.7 * Thu Jun 20 2024 Charlie Zender - 5.2.6-1 - new upstream 5.2.6 * Wed Jun 19 2024 Charlie Zender - 5.2.5-1 - new upstream 5.2.5 * Mon Apr 15 2024 Charlie Zender - 5.2.4-1 - new upstream 5.2.4 * Wed Apr 03 2024 Charlie Zender - 5.2.3-1 - new upstream 5.2.3 * Fri Mar 22 2024 Charlie Zender - 5.2.2-1 - new upstream 5.2.2 * Sun Feb 18 2024 Charlie Zender - 5.2.1-1 - new upstream 5.2.1 * Fri Feb 16 2024 Charlie Zender - 5.2.0-1 - new upstream 5.2.0 * Tue Nov 07 2023 Charlie Zender - 5.1.9-1 - new upstream 5.1.9 * Sun Sep 17 2023 Charlie Zender - 5.1.8-1 - new upstream 5.1.8 * Wed Jul 26 2023 Charlie Zender - 5.1.7-1 - new upstream 5.1.7 * Fri May 12 2023 Charlie Zender - 5.1.6-1 - new upstream 5.1.6 * Tue Mar 14 2023 Charlie Zender - 5.1.5-1 - new upstream 5.1.5 * Tue Jan 10 2023 Charlie Zender - 5.1.4-1 - new upstream 5.1.4 * Mon Nov 28 2022 Charlie Zender - 5.1.3-1 - new upstream 5.1.3 * Fri Nov 18 2022 Charlie Zender - 5.1.2-1 - new upstream 5.1.2 * Fri Oct 28 2022 Charlie Zender - 5.1.1-1 - new upstream 5.1.1 * Tue Jul 12 2022 Charlie Zender - 5.1.0-1 - new upstream 5.1.0 * Mon May 02 2022 Charlie Zender - 5.0.7-1 - new upstream 5.0.7 * Thu Feb 02 2022 Charlie Zender - 5.0.6-1 - new upstream 5.0.6 * Mon Jan 24 2022 Charlie Zender - 5.0.5-1 - new upstream 5.0.5 * Sat Dec 04 2021 Charlie Zender - 5.0.4-1 - new upstream 5.0.4 * Wed Oct 06 2021 Charlie Zender - 5.0.3-1 - new upstream 5.0.3 * Fri Sep 24 2021 Charlie Zender - 5.0.2-1 - new upstream 5.0.2 * Tue Jul 13 2021 Charlie Zender - 5.0.1-1 - new upstream 5.0.1 * Fri Jun 18 2021 Charlie Zender - 5.0.0-1 - new upstream 5.0.0 * Fri May 14 2021 Charlie Zender - 4.9.9-1 - new upstream 4.9.9 * Sun Mar 21 2021 Charlie Zender - 4.9.8-1 - new upstream 4.9.8 * Sun Dec 27 2020 Charlie Zender - 4.9.7-1 - new upstream 4.9.7 * Mon Nov 30 2020 Charlie Zender - 4.9.6-1 - new upstream 4.9.6 * Wed Sep 23 2020 Charlie Zender - 4.9.5-1 - new upstream 4.9.5 * Fri Sep 04 2020 Charlie Zender - 4.9.4-1 - new upstream 4.9.4 * Sun May 31 2020 Charlie Zender - 4.9.3-1 - new upstream 4.9.3 * Fri Feb 14 2020 Charlie Zender - 4.9.2-1 - new upstream 4.9.2 * Thu Dec 19 2019 Charlie Zender - 4.9.1-1 - new upstream 4.9.1 * Wed Dec 04 2019 Charlie Zender - 4.9.0-1 - new upstream 4.9.0 * Mon Jul 01 2019 Charlie Zender - 4.8.1-1 - new upstream 4.8.1 * Wed May 15 2019 Charlie Zender - 4.8.0-1 - new upstream 4.8.0 * Thu Feb 20 2019 Charlie Zender - 4.7.9-1 - new upstream 4.7.9 * Fri Nov 16 2018 Charlie Zender - 4.7.8-1 - new upstream 4.7.8 * Fri Sep 21 2018 Charlie Zender - 4.7.7-1 - new upstream 4.7.7 * Sat Aug 11 2018 Charlie Zender - 4.7.6-1 - new upstream 4.7.6 * Sun Jun 10 2018 Charlie Zender - 4.7.5-1 - new upstream 4.7.5 * Fri Apr 06 2018 Charlie Zender - 4.7.4-1 - new upstream 4.7.4 * Fri Mar 03 2018 Charlie Zender - 4.7.3-1 - new upstream 4.7.3 * Thu Jan 25 2018 Charlie Zender - 4.7.2-1 - new upstream 4.7.2 * Thu Dec 21 2017 Charlie Zender - 4.7.1-1 - new upstream 4.7.1 * Wed Nov 08 2017 Charlie Zender - 4.7.0-1 - new upstream 4.7.0 * Mon Sep 18 2017 Charlie Zender - 4.6.9-1 - new upstream 4.6.9 * Wed Aug 16 2017 Charlie Zender - 4.6.8-1 - new upstream 4.6.8 * Fri May 26 2017 Charlie Zender - 4.6.7-1 - new upstream 4.6.7 * Fri Apr 21 2017 Charlie Zender - 4.6.6-1 - new upstream 4.6.6 * Wed Mar 15 2017 Charlie Zender - 4.6.5-1 - new upstream 4.6.5 * Tue Feb 07 2017 Charlie Zender - 4.6.4-1 - new upstream 4.6.4 * Fri Dec 23 2016 Charlie Zender - 4.6.3-1 - new upstream 4.6.3 * Thu Nov 16 2016 Charlie Zender - 4.6.2-1 - new upstream 4.6.2 * Sat Aug 06 2016 Charlie Zender - 4.6.1-1 - new upstream 4.6.1 * Thu May 12 2016 Charlie Zender - 4.6.0-1 - new upstream 4.6.0 * Thu Feb 07 2016 Charlie Zender - 4.5.5-1 - new upstream 4.5.5 * Thu Jan 07 2016 Charlie Zender - 4.5.4-1 - new upstream 4.5.4 * Sun Oct 18 2015 Charlie Zender - 4.5.3-1 - new upstream 4.5.3 * Sun Sep 06 2015 Charlie Zender - 4.5.2-1 - new upstream 4.5.2 * Fri Jul 10 2015 Charlie Zender - 4.5.1-1 - new upstream 4.5.1 * Thu Jun 11 2015 Charlie Zender - 4.5.0-1 - new upstream 4.5.0 * Thu May 21 2015 Charlie Zender - 4.4.9-1 - new upstream 4.4.9 * Mon Feb 09 2015 Charlie Zender - 4.4.8-1 - new upstream 4.4.8 * Wed Nov 26 2014 Charlie Zender - 4.4.7-1 - new upstream 4.4.7 * Wed Oct 01 2014 Charlie Zender - 4.4.6-1 - new upstream 4.4.6 * Tue Aug 26 2014 Charlie Zender - 4.4.5-1 - new upstream 4.4.5 * Thu May 29 2014 Charlie Zender - 4.4.4-1 - new upstream 4.4.4 * Thu Apr 02 2014 Charlie Zender - 4.4.3-1 - new upstream 4.4.3 * Thu Feb 20 2014 Charlie Zender - 4.4.2-1 - new upstream 4.4.2 * Thu Jan 29 2014 Charlie Zender - 4.4.1-1 - new upstream 4.4.1 * Thu Jan 09 2014 Charlie Zender - 4.4.0-1 - new upstream 4.4.0 * Wed Dec 06 2013 Charlie Zender - 4.3.9-1 - new upstream 4.3.9 * Wed Nov 06 2013 Charlie Zender - 4.3.8-1 - new upstream 4.3.8 * Thu Oct 17 2013 Charlie Zender - 4.3.7-1 - new upstream 4.3.7 * Fri Sep 27 2013 Charlie Zender - 4.3.6-1 - new upstream 4.3.6 * Fri Sep 20 2013 Charlie Zender - 4.3.5-1 - new upstream 4.3.5 * Thu Aug 01 2013 Charlie Zender - 4.3.4-1 - new upstream 4.3.4 * Wed Jul 24 2013 Charlie Zender - 4.3.3-1 - new upstream 4.3.3 * Fri Jul 05 2013 Charlie Zender - 4.3.2-1 - new upstream 4.3.2 * Wed May 01 2013 Charlie Zender - 4.3.1-1 - new upstream 4.3.1 * Thu Mar 28 2013 Charlie Zender - 4.3.0-1 - new upstream 4.3.0 * Tue Mar 19 2013 Charlie Zender - 4.2.6-1 - new upstream 4.2.6 * Mon Jan 28 2013 Charlie Zender - 4.2.5-1 - new upstream 4.2.5 * Mon Jan 21 2013 Charlie Zender - 4.2.4-1 - new upstream 4.2.4 * Tue Nov 13 2012 Charlie Zender - 4.2.3-1 - new upstream 4.2.3 * Mon Oct 29 2012 Charlie Zender - 4.2.2-1 - new upstream 4.2.2 * Thu Aug 02 2012 Charlie Zender - 4.2.1-1 - new upstream 4.2.1 * Mon Jun 11 2012 Charlie Zender - 4.2.0-1 - new upstream 4.2.0 * Thu Mar 29 2012 Charlie Zender - 4.1.0-1 - new upstream 4.1.0 * Mon Feb 13 2012 Charlie Zender - 4.0.9-1 - new upstream 4.0.9 * Fri Mar 21 2011 Charlie Zender - 4.0.8-1 - new upstream 4.0.8 * Fri Jan 21 2011 Charlie Zender - 4.0.7-1 - new upstream 4.0.7 * Fri Jan 14 2011 Charlie Zender - 4.0.6-1 - new upstream 4.0.6 * Thu Oct 13 2010 Charlie Zender - 4.0.5-1 - new upstream 4.0.5 * Fri Sep 24 2010 Charlie Zender - 4.0.4-1 - new upstream 4.0.4 * Thu Sep 02 2010 Charlie Zender - 4.0.3-1 - new upstream 4.0.3 * Sun Jun 27 2010 Charlie Zender - 4.0.2-1 - new upstream 4.0.2 * Mon Apr 05 2010 Charlie Zender - 4.0.1-1 - new upstream 4.0.1 * Tue Jan 05 2010 Charlie Zender - 4.0.0-1 - new upstream 4.0.0 * Tue Jul 14 2009 Charlie Zender - 3.9.9-1 - new upstream 3.9.9 * Mon Mar 23 2009 Charlie Zender - 3.9.8-1 - new upstream 3.9.8 * Wed Mar 18 2009 Charlie Zender - 3.9.7-1 - new upstream 3.9.7 * Thu Jan 22 2009 Charlie Zender - 3.9.6-1 - new upstream 3.9.6 * Thu Oct 30 2008 Charlie Zender - 3.9.5-2 - buildrequire GSL * Sun May 11 2008 Charlie Zender - 3.9.5-1 - new upstream 3.9.5 * Mon Mar 03 2008 Charlie Zender - 3.9.4-1 - new upstream 3.9.4 * Sat Dec 08 2007 Charlie Zender - 3.9.3-1 - new upstream 3.9.3 * Wed Aug 29 2007 Charlie Zender - 3.9.2-1 - new upstream 3.9.2 * Fri Jun 29 2007 Charlie Zender - 3.9.1-1 - new upstream 3.9.1 * Tue Jun 19 2007 Daniel L. Wang - 3.9.0-1 - fix LDFLAGS to detect lib64 usage (workaround buggy libtool) * Fri May 25 2007 Charlie Zender - 3.9.0-1 - new upstream 3.9.0 * Fri Apr 20 2007 Charlie Zender - 3.2.0-1 - new upstream 3.2.0 (includes rmssdn arithmetic bugfix) * Sat Mar 10 2007 Charlie Zender - 3.1.9-1 - new 3.1.9 to synchronize upstream, debs, and RPMs * Sat Mar 10 2007 Charlie Zender - 3.1.8-1 - clean up nco.spec - verify ncap2 is built and distributed - buildrequire libdap, libdap-devel, libnc-dap, libnc-dap-devel - new upstream 3.1.8 * Sat Nov 11 2006 Charlie Zender - 3.1.7-1 - Merge Fedora nco.spec UDUnits patch into upstream configure.in - new upstream 3.1.7 * Sat Sep 2 2006 Ed Hill - 3.1.5-3 - br bison as well * Sat Sep 2 2006 Ed Hill - 3.1.5-2 - buildrequire flex * Sat Sep 2 2006 Ed Hill - 3.1.5-1 - new upstream 3.1.5 * Fri Apr 21 2006 Ed Hill - 3.1.2-1 - update to new upstream 3.1.2 * Thu Feb 16 2006 Ed Hill - 3.0.2-2 - rebuild for new gcc * Mon Sep 5 2005 Ed Hill - 3.0.2-1 - update to new upstream 3.0.2 * Wed Aug 3 2005 Ed Hill - 3.0.1-4 - remove (hopefully only temporarily) opendap support * Thu Jul 21 2005 Ed Hill - 3.0.1-3 - add LICENSE file * Sat Jul 9 2005 Ed Hill - 3.0.1-2 - add BuildRequires: opendap-devel * Sun Jun 19 2005 Ed Hill - 3.0.1-1 - update to upstream 3.0.1 - comment & fixes for BuildRequires * Sat Apr 23 2005 Ed Hill - 3.0.0-2 - add BuildRequires and fix CXXFLAGS per Tom Callaway - add udunits patch per Tom Callaway * Sat Apr 16 2005 Ed Hill - 3.0.0-1 - update to ver 3.0.0 - devel package fixes per D.M. Kaplan and M. Schwendt - fix info post/postun * Sun Dec 5 2004 Ed Hill - 0:2.9.9-0.fdr.4 - sync with netcdf-3.6.0beta6-0.fdr.0 - split into devel and non-devel * Wed Dec 1 2004 Ed Hill - 0:2.9.9-0.fdr.3 - sync with netcdf-0:3.5.1-0.fdr.11 - added '-fpermissive' for GCC 3.4.2 warnings - added "Provides:nco-devel" for the headers and libs * Mon Oct 4 2004 Ed Hill - 0:2.9.9-0.fdr.2 - Add some of Michael Schwendts suggested INC/LIB path fixes and sync with the netcdf-3.5.1-0.fdr.10 dependency. * Thu Sep 23 2004 Ed Hill - 0:2.9.9-0.fdr.1 - add NETCDF_INC and NETCDF_LIB to work on systems where old versions of netcdf may exist in /usr/local * Wed Sep 8 2004 Ed Hill - 0:2.9.9-0.fdr.0 - updated to ver 2.9.9 * Sat Aug 7 2004 Ed Hill - 0:2.9.8-0.fdr.0 - updated to ver 2.9.8 * Sat Jul 17 2004 Ed Hill - 0:2.9.7-0.fdr.2 - removed unneeded %ifarch * Sat Jul 17 2004 Ed Hill - 0:2.9.7-0.fdr.1 - Add %post,%postun * Sat Jul 17 2004 Ed Hill - 0:2.9.7-0.fdr.0 - Initial working version * Wed Mar 1 2000 Charlie Zender - 1.1.45-1 - Added original nco.spec to bld directory nco-5.3.3/bld/nco_dst.pl000077500000000000000000000503511477164337000150530ustar00rootroot00000000000000#!/usr/bin/perl # Purpose: Perform NCO distributions # Script relies heavily on SSH connectivity between ${HOST}, ${CVSROOT}, and $www_mch # Usage: # Export tagged, public versions # /usr/bin/scp ${DATA}/nco-5.3.2.tar.gz zender,nco@web.sf.net:/home/project-web/nco/htdocs/src # ${HOME}/nco/bld/nco_dst.pl --dbg=2 --bld --cln nco-5.3.2 # Build, do not release on SF # ${HOME}/nco/bld/nco_dst.pl --dbg=2 --bld --cln --sf nco-5.3.2 # Build, release on SF # ${HOME}/nco/bld/nco_dst.pl --dbg=2 --cln --nst_all nco-5.3.2 # Install, do not build # ${HOME}/nco/bld/nco_dst.pl --dbg=2 --bld --cln --nst_all nco-5.3.2 # Build and install # ${HOME}/nco/bld/nco_dst.pl --dbg=2 --cln --acd_cnt nco-5.3.2 # ${HOME}/nco/bld/nco_dst.pl --dbg=2 --cln --acd_prs nco-5.3.2 # ${HOME}/nco/bld/nco_dst.pl --dbg=2 --cln --cgd_cnt nco-5.3.2 # ${HOME}/nco/bld/nco_dst.pl --dbg=2 --cln --cray_prs nco-5.3.2 # ${HOME}/nco/bld/nco_dst.pl --dbg=2 --cln --bbl_cnt nco-5.3.2 # ${HOME}/nco/bld/nco_dst.pl --dbg=2 --cln --blk_cnt nco-5.3.2 # ${HOME}/nco/bld/nco_dst.pl --dbg=2 --cln --dat_cnt nco-5.3.2 # ${HOME}/nco/bld/nco_dst.pl --dbg=2 --cln --ute_prs nco-5.3.2 # Export daily snapshot # ${HOME}/nco/bld/nco_dst.pl --dbg=2 # ${HOME}/nco/bld/nco_dst.pl --dbg=1 --cln --nst # Machines requiring interactive builds # cd ${HOME}/nco;cvs update;cd bld;make;make tst # scp ${HOME}/nco/bld/nco_dst.pl dust.ess.uci.edu:/home/zender/nco/bld/nco_dst.pl BEGIN{ unshift @INC,$ENV{'HOME'}.'/perl'; # Location of csz.pl and DBG.pm HaS98 p. 170 } # end BEGIN my $CVS_Header='$Header$'; # Specify modules use strict; # Protect all namespaces use Getopt::Long; # GNU-style getopt use File::Basename; # For parsing filenames # Personal modules use DBG; # Debugging constants require 'csz.pl'; # Contains date_time() # Set output flushing to help debugging on hard crashes # These options update filehandle after every output statement select((select(STDOUT),$|=1)[0]); # Camel book, p. 110 select((select(STDERR),$|=1)[0]); # Camel book, p. 110 # Timing information my ($lcl_date_time,$srt_usr_tm,$srt_sys_tm,$srt_child_usr_tm,$srt_child_sys_tm); ($lcl_date_time,$srt_usr_tm,$srt_sys_tm,$srt_child_usr_tm,$srt_child_sys_tm)=time_srt(); printf STDOUT ("Start user time %f\n",$srt_usr_tm); # Declare local variables my ($idx,$rcd); my ($prg_nm,$prg_dsc,$prg_vrs,$prg_date); my ($pth_in,$fl_sfx); my ($dst_vrs,$dst_fl,$doc_fl); my ($dst_fl_chg,$dst_fl_deb,$dst_fl_doc,$dst_fl_dsc,$dst_fl_tgz); my ($nco_vrs,$nco_vrs_mjr,$nco_vrs_mnr,$nco_vrs_pch); my ($dly_snp); my ($mk_cmd,$tar_cmd,$rmt_mch); my ($rsh_cmd,$rcp_cmd,$cp_cmd,$rm_cmd,$mkdir_cmd,$cvs_cmd); # Set defaults my $False=0; my $True=1; my $CVS_Date='$Date$'; my $CVS_Id='$Id$'; my $CVS_Revision='$Revision$'; my $CVSROOT='zender@nco.cvs.sf.net:/cvsroot/nco'; # CVS repository my $DATA=$ENV{'DATA'}; my $HOME=$ENV{'HOME'}; my $HOST=$ENV{'HOST'}; my $PVM_ARCH=$ENV{'PVM_ARCH'}; my $bld=$False; # Option bld; Whether to rebuild netCDF distribution my $cp_cmd='cp -p -f'; # Command that behaves like cp my $cvs_cmd='cvs'; # Command that behaves like cvs (Use cvs -t for verbose output) my $data_nm=$ENV{'DATA'}; my $main_trunk_tag='nco'; my $mkdir_cmd='mkdir -p'; # Command that behaves like mkdir my $mdl_sng='nco'; # Base of module name my $rm_cmd='rm -f'; # Command that behaves like rm my $rcp_cmd='scp -p'; # Command that behaves like rcp my $rcp_cmd_no_prs_prm='scp'; # Command that behaves like rcp and does not try to preserve permissions my $rsh_cmd='ssh'; # Command that behaves like rsh my $usr_nm=$ENV{'USER'}; my $vrs_tag=''; my $www_mch='dust.ess.uci.edu'; # WWW machine for package my $www_drc='/var/www/html/nco'; # WWW directory for package my $www_mch_mrr='web.sf.net'; # WWW machine for package mirror my $www_drc_mrr='/home/project-web/nco/htdocs'; # WWW directory for package mirror # Set defaults for command line arguments my $sf=$False; # Release tarball and update SourceForge my $cln=$True; # GNU standard Makefile option `clean' my $dbg_lvl=0; my $dst_cln=$False; # GNU standard Makefile option `distclean' my $nst_all=$False; # Option nst_all; Install version on all machines my $acd_cnt=$False; # Option acd_cnt; Install version in acd contrib my $acd_prs=$False; # Option acd_prs; Install version in acd personal my $bbl_cnt=$False; # Option bbl_cnt; Install version in babyblue contrib my $blk_cnt=$False; # Option blk_cnt; Install version in blackforest contrib my $bls_cnt=$False; # Option bls_cnt; Install version in bluesky contrib my $dat_cnt=$False; # Option dat_cnt; Install version in dataproc contrib my $ute_prs=$False; # Option ute_prs; Install version in ute personal my $cgd_cnt=$False; # Option cgd_cnt; Install version in CGD contrib my $cgd_prs=$False; # Option cgd_prs; Install version in CGD personal my $cray_prs=$False; # Option cray_prs; Install version in Cray personal # Derived fields if($PVM_ARCH =~ m/SUN/){ # See Camel p. 81 for =~ and m// $tar_cmd='gtar'; $mk_cmd='make'; }elsif($PVM_ARCH =~ m/CRAY/){ $tar_cmd='tar'; $mk_cmd='gnumake'; }else{ $tar_cmd='tar'; $mk_cmd='make'; } # endelse if($data_nm eq ''){$data_nm='/data/'.$usr_nm;} my $dst_pth_pfx=$data_nm; # Parent of build directory if($dst_pth_pfx eq $HOME){die "$prg_nm: ERROR \$dst_pth_pfx eq $dst_pth_pfx";} # This could be disastrous if($rm_cmd =~ m/( -r)|( -R)|( --recursive)/){die "$prg_nm: ERROR Dangerous setting \$rm_cmd eq $rm_cmd";} # This would be disastrous # $CVSROOT=':pserver:anonymous@nco.cvs.sf.net:/cvsroot/nco'; # CVS repository $prg_dsc='NCO distribution maker'; # Program description ($prg_nm,$prg_vrs)=$CVS_Id =~ /: (.+).pl,v ([\d.]+)/; # Program name and version $prg_vrs.='*' if length('$Locker$ ') > 12; # Tack '*' if it is not checked in into CVS. ($prg_nm,$pth_in,$fl_sfx)=fileparse($0,''); # $0 is program name Camel p. 136 if(length($CVS_Date) > 6){($prg_date)=unpack '@7 a19',$CVS_Date;}else{$prg_date='Unknown';} # Parse command line arguments: '!' means Boolean, '|' is OR, '=' specifies required argument: 'i' is integer, 'f' is float, 's' is string $rcd=GetOptions( # man Getopt::GetoptLong 'acd_cnt!' => \$acd_cnt, 'acd_prs!' => \$acd_prs, 'bld!' => \$bld, 'sf!' => \$sf, 'bbl_cnt!' => \$bbl_cnt, 'blk_cnt!' => \$blk_cnt, 'cgd_cnt!' => \$cgd_cnt, 'cgd_prs!' => \$cgd_prs, 'clean!' => \$cln, 'cln!' => \$cln, 'cray_prs!' => \$cray_prs, 'dat_cnt!' => \$dat_cnt, 'dbg_lvl=i' => \$dbg_lvl, 'distclean!' => \$dst_cln, 'dst_cln!' => \$dst_cln, 'nst_all!' => \$nst_all, 'ute_prs!' => \$ute_prs, ); # end GetOptions arguments # Parse positional arguments, if present if($#ARGV > 0){die "$prg_nm: ERROR Called with $#ARGV+1 positional arguments, need no more than 1\n";} elsif($#ARGV == 0){$vrs_tag=$ARGV[0];} # Version name is first positional argument, if present. if($nst_all){ $cgd_prs=$True; $cgd_cnt=$True; $acd_prs=$True; $acd_cnt=$True; $ute_prs=$True; $bbl_cnt=$True; $blk_cnt=$True; $dat_cnt=$True; $cray_prs=$True; } # endif # Print initialization state if($dbg_lvl >= 1){print ("$prg_nm: $prg_dsc, version $prg_vrs of $prg_date\n");} # endif dbg if($dbg_lvl >= 2){print ("$prg_nm: \$vrs_tag = $vrs_tag\n");} # endif dbg if($dbg_lvl >= 2){print ("$prg_nm: \$dbg_lvl = $dbg_lvl\n");} # endif dbg if($dbg_lvl >= 2){print ("$prg_nm: \$bld = $bld\n");} # endif dbg if($dbg_lvl >= 2){print ("$prg_nm: \$sf = $sf\n");} # endif dbg if($dbg_lvl >= 2){print ("$prg_nm: \$cln = $cln\n");} # endif dbg if($dbg_lvl >= 2){print ("$prg_nm: \$dst_cln = $dst_cln\n");} # endif dbg if($dbg_lvl >= 2){print ("$prg_nm: \$nst_all = $nst_all\n");} # endif dbg if($dbg_lvl >= 2){print ("$prg_nm: \$mk_cmd = $mk_cmd\n");} # endif dbg if($dbg_lvl >= 2){print ("$prg_nm: \$tar_cmd = $tar_cmd\n");} # endif dbg if($dbg_lvl >= 2){print ("$prg_nm: \$acd_cnt = $acd_cnt\n");} # endif dbg if($dbg_lvl >= 2){print ("$prg_nm: \$acd_prs = $acd_prs\n");} # endif dbg if($dbg_lvl >= 2){print ("$prg_nm: \$cgd_cnt = $cgd_cnt\n");} # endif dbg if($dbg_lvl >= 2){print ("$prg_nm: \$cgd_prs = $cgd_prs\n");} # endif dbg if($dbg_lvl >= 2){print ("$prg_nm: \$cray_prs = $cray_prs\n");} # endif dbg if($dbg_lvl >= 2){print ("$prg_nm: \$bbl_cnt = $bbl_cnt\n");} # endif dbg if($dbg_lvl >= 2){print ("$prg_nm: \$blk_cnt = $blk_cnt\n");} # endif dbg if($dbg_lvl >= 2){print ("$prg_nm: \$dat_cnt = $dat_cnt\n");} # endif dbg if($dbg_lvl >= 2){print ("$prg_nm: \$ute_prs = $ute_prs\n");} # endif dbg if($vrs_tag eq $main_trunk_tag || $vrs_tag eq ''){$dly_snp=$True;}else{$dly_snp=$False;} # NCO is distributed using the `cvs export' command, so version tag to be distributed must be supplied to this script if($dly_snp){ # The version tag is blank or of the form `nco' $nco_vrs=YYYYMMDD(); $dst_vrs=$mdl_sng.'-'.$nco_vrs; }else{ # The version tag is of the form `nco-1_2_0' my ($tag_sng); my ($nco_psn); $tag_sng=$vrs_tag; $tag_sng=~s/_/./g; # Use =~ to bind $tag_sng to s/// Camel p. 81 $nco_vrs=substr($tag_sng,length($mdl_sng)+1,length($tag_sng)-length($mdl_sng)-1); # The +/- 1 accounts for the dash '-' ($nco_vrs_mjr,$nco_vrs_mnr,$nco_vrs_pch)=split(/\./,$nco_vrs); $dst_vrs=$mdl_sng.'-'.$nco_vrs; if($nco_vrs_mjr < 1 || $nco_vrs_mjr > 4){die "$prg_nm: ERROR $nco_vrs_mjr < 1 || $nco_vrs_mjr > 3"}; } # endelse $doc_fl="$HOME/nco/doc/nco.dvi $HOME/nco/doc/nco.html $HOME/nco/doc/nco.ps $HOME/nco/doc/nco.pdf $HOME/nco/doc/nco.txt $HOME/nco/doc/nco.xml"; # Derived documentation $dst_fl=$dst_vrs.'.tar.gz'; # Standard tarball distribution $dst_fl_chg=$mdl_sng.'_'.$nco_vrs.'-1_*.changes'; # Debian changes $dst_fl_deb=$mdl_sng.'_'.$nco_vrs.'-1_*.deb'; # Debian executables and libraries $dst_fl_doc=$mdl_sng.'-doc_'.$nco_vrs.'-1_all.deb'; # Debian documentation (deprecated) $dst_fl_dsc=$mdl_sng.'_'.$nco_vrs.'-1.dsc'; # Debian description $dst_fl_tgz=$mdl_sng.'_'.$nco_vrs.'.orig.tar.gz'; # Debian tarball my $dst_pth_bld=$dst_pth_pfx.'/'.$dst_vrs; # Build directory if($dbg_lvl >= 1){ print STDOUT "$prg_nm: Version to release: $vrs_tag\n"; print STDOUT "$prg_nm: Distribution version: $dst_vrs\n"; print STDOUT "$prg_nm: Distribution file: $dst_fl\n"; print STDOUT "$prg_nm: NCO version: $nco_vrs\n"; print STDOUT "$prg_nm: NCO major version: $nco_vrs_mjr\n"; print STDOUT "$prg_nm: NCO minor version: $nco_vrs_mnr\n"; print STDOUT "$prg_nm: NCO patch version: $nco_vrs_pch\n"; } # end if dbg # Build distribution from scratch if($bld){ cmd_prc("$rm_cmd -r $dst_pth_bld"); # Remove contents of current directory, if any # cmd_prc("$mkdir_cmd $dst_pth_bld"); # Create directory chdir $dst_pth_pfx or die "$prg_nm: ERROR unable to chdir to $dst_pth_pfx: $!\n"; # $! is system error string if($CVSROOT =~ m/pserver/){cmd_prc("$cvs_cmd -d $CVSROOT login");} # Login first if($dly_snp){ cmd_prc("$cvs_cmd -d $CVSROOT export -kkv -D \"1 second ago\" -d $dst_vrs nco"); # Export }else{ cmd_prc("$cvs_cmd -d $CVSROOT export -kkv -r $vrs_tag -d $dst_vrs nco"); # Export } # endelse cmd_prc("printf $nco_vrs > $dst_pth_bld/doc/VERSION"); # Stamp version in VERSION file in exported files cmd_prc("printf $nco_vrs > $HOME/nco/doc/VERSION"); # Stamp version in VERSION file in development directory # cmd_prc("ln -s $dst_pth_bld/bld/nco.spec $dst_pth_bld/bld/nco-$nco_vrs.spec"); # Stamp version in VERSION file # Make sure documentation files are up to date my $bld_pth=$dst_pth_pfx.'/'."$dst_vrs".'/bld'; chdir $bld_pth or die "$prg_nm: ERROR unable to chdir to $bld_pth: $!\n"; # $! is system error string cmd_prc("$mk_cmd doc"); cmd_prc("$mk_cmd clean"); # Set up FTP server chdir $dst_pth_pfx or die "$prg_nm: ERROR unable to chdir to $dst_pth_pfx: $!\n"; # $! is system error string cmd_prc("$cp_cmd $doc_fl ./$dst_vrs/doc"); # Copy derived documentation to source directory cmd_prc("$tar_cmd cvzf $dst_fl --exclude='nco-5.3.2/debian*' --exclude='.cvsignore' --exclude=ncap_lex.c --exclude=ncap_yacc.[ch] ./$dst_vrs"); # Create gzipped tarfile cmd_prc("$rsh_cmd $www_mch $rm_cmd $www_drc/src/$dst_fl"); # Remove any distribution with same name if($dly_snp){cmd_prc("$rsh_cmd $www_mch $rm_cmd -r $www_drc/src/nco-????????.tar.gz");} # Remove previous daily snapshots from WWW server cmd_prc("$rcp_cmd $dst_fl $www_mch:$www_drc/src"); # Copy local tarfile to WWW server cmd_prc("$rcp_cmd $DATA/$dst_fl_chg $DATA/$dst_fl_deb $DATA/$dst_fl_dsc $DATA/$dst_fl_tgz $www_mch:$www_drc/src"); # Copy Debian files to WWW server # Full release procedure (public releases only) includes update Web pages if(!$dly_snp){ cmd_prc("$rsh_cmd $www_mch $rm_cmd $www_drc/nco.tar.gz"); cmd_prc("$rsh_cmd $www_mch \"cd $www_drc; ln -s -f ./src/$dst_fl nco.tar.gz\""); cmd_prc("$rcp_cmd $dst_pth_bld/doc/index.shtml $www_mch:$www_drc"); cmd_prc("$rcp_cmd $dst_pth_bld/doc/nco.png $www_mch:$www_drc"); cmd_prc("$rcp_cmd $dst_pth_bld/doc/nco_news.shtml $www_mch:$www_drc"); cmd_prc("$rcp_cmd $dst_pth_bld/doc/nco.html $dst_pth_bld/doc/nco.info* $dst_pth_bld/doc/nco.dvi $dst_pth_bld/doc/nco.pdf $dst_pth_bld/doc/nco.ps $dst_pth_bld/doc/nco.texi $www_mch:$www_drc"); cmd_prc("$rcp_cmd $dst_pth_bld/doc/README $www_mch:$www_drc"); cmd_prc("$rcp_cmd $dst_pth_bld/doc/TODO $www_mch:$www_drc"); cmd_prc("$rcp_cmd $dst_pth_bld/doc/VERSION $www_mch:$www_drc"); cmd_prc("$rcp_cmd $dst_pth_bld/doc/ChangeLog $www_mch:$www_drc"); } # endif # Update SourceForge mirror # Use rcp_cmd_no_prs_prm because scp appears to quit without notice if too many warnings errors occur copying first files # Usually scp_cmd includes -p switch to preserve permissions and times, but sourceforge server does not allow this # Hence it generates warnings when used with -p, and is not properly updated if($sf){ cmd_prc("$rcp_cmd_no_prs_prm $dst_pth_bld/doc/index.shtml $dst_pth_bld/doc/nco.png $dst_pth_bld/doc/nco_news.shtml $dst_pth_bld/doc/README $dst_pth_bld/doc/TODO $dst_pth_bld/doc/VERSION $dst_pth_bld/doc/ChangeLog $usr_nm,nco\@$www_mch_mrr:$www_drc_mrr"); cmd_prc("$rcp_cmd_no_prs_prm $dst_pth_bld/doc/nco.html $dst_pth_bld/doc/nco.info* $dst_pth_bld/doc/nco.dvi $dst_pth_bld/doc/nco.pdf $dst_pth_bld/doc/nco.ps $dst_pth_bld/doc/nco.ps $dst_pth_bld/doc/nco.texi $usr_nm,nco\@$www_mch_mrr:$www_drc_mrr"); cmd_prc("$rcp_cmd_no_prs_prm $dst_pth_pfx/$dst_fl $usr_nm,nco\@$www_mch_mrr:$www_drc_mrr/src"); # Copy tarball to WWW server # 20140529: Disable Debian copying until .debs built again # cmd_prc("$rcp_cmd_no_prs_prm $dst_pth_pfx/$dst_fl $DATA/$dst_fl_chg $DATA/$dst_fl_deb $DATA/$dst_fl_dsc $DATA/$dst_fl_tgz $usr_nm,nco\@$www_mch_mrr:$www_drc_mrr/src"); # Copy Debian files to WWW server # Shell commands on SourceForge disabled 20081018 # cmd_prc("$rsh_cmd $www_mch_mrr \"cd $www_drc_mrr; ln -s -f ./src/$dst_fl nco.tar.gz\""); } # endif SourceForge # Housekeeping if($cln){cmd_prc("$rm_cmd $dst_pth_pfx/$dst_fl");} # Remove local tarfile if($dst_cln){cmd_prc("$rm_cmd -r $dst_pth_bld");} # Remove local distribution # Sanity check cmd_prc("$rsh_cmd $www_mch ls -l $www_drc"); } # endif bld if($acd_prs){ $rmt_mch='acd.ucar.edu'; print STDOUT "\n$prg_nm: Updating private NCO on $rmt_mch...\n"; cmd_prc("$rsh_cmd $rmt_mch \"cd ~/nco;$cvs_cmd update\""); cmd_prc("$rsh_cmd $rmt_mch \"cd ~/nco/bld;make cln all tst\""); # Unfortunately, sudo does not work at all with rsh # cmd_prc("$rsh_cmd $rmt_mch \"sudo cp /gs/zender/bin/LINUX/nc* /usr/local/bin\""); print STDOUT "$prg_nm: Done updating private NCO binaries on $rmt_mch\n\n"; } # endif acd_prs if($acd_cnt){ $rmt_mch='garcia.acd.ucar.edu'; print STDOUT "\n$prg_nm: Updating private NCO on $rmt_mch...\n"; cmd_prc("$rsh_cmd $rmt_mch \"cd ~/nco;/local/bin/$cvs_cmd update\""); cmd_prc("$rsh_cmd $rmt_mch \"cd ~/nco/bld;/local/bin/gmake cln all tst\""); # Unfortunately, sudo does not work at all with rsh # cmd_prc("$rsh_cmd $rmt_mch \"sudo cp /a1/zender/bin/ALPHA/nc* /usr/local/bin\""); print STDOUT "$prg_nm: Done updating private NCO binaries on $rmt_mch\n\n"; } # endif acd_cnt if($cgd_cnt){ $rmt_mch='sanitas.cgd.ucar.edu'; # $rsh_cmd $rmt_mch 'printf $PVM_ARCH' print STDOUT "\n$prg_nm: Updating contrib NCO on $rmt_mch...\n"; cmd_prc("$rsh_cmd $rmt_mch \"$rm_cmd -r /usr/tmp/$usr_nm/nco*\""); cmd_prc("$rsh_cmd $rmt_mch \"$mkdir_cmd /usr/tmp/$usr_nm/$dst_vrs/obj\""); cmd_prc("$rsh_cmd $rmt_mch \"cd /usr/tmp/$usr_nm;gtar -xvzf nco.tar.gz;rm nco.tar.gz\""); cmd_prc("$rsh_cmd $rmt_mch \"cd /usr/tmp/$usr_nm/$dst_vrs/bld; setenv MY_BIN_DIR /contrib/nco-1.1/bin; setenv MY_LIB_DIR /contrib/nco-1.1/lib; setenv MY_OBJ_DIR /usr/tmp/$usr_nm/$dst_vrs/obj; gmake cln all test\""); print STDOUT "$prg_nm: Done updating contrib NCO on $rmt_mch\n\n"; } # endif cgd_cnt if($dat_cnt){ $rmt_mch='dataproc.ucar.edu'; # $rsh_cmd $rmt_mch 'printf $PVM_ARCH' print STDOUT "\n$prg_nm: Updating contrib NCO on $rmt_mch...\n"; cmd_prc("$rsh_cmd $rmt_mch \"$rm_cmd -r /usr/tmp/$usr_nm/nco*\""); cmd_prc("$rsh_cmd $rmt_mch \"$mkdir_cmd /usr/tmp/$usr_nm/$dst_vrs/obj\""); cmd_prc("$rsh_cmd $rmt_mch \"cd /usr/tmp/$usr_nm;tar -xvzf nco.tar.gz;rm nco.tar.gz\""); cmd_prc("$rsh_cmd $rmt_mch \"cd /usr/tmp/$usr_nm/$dst_vrs/bld; setenv MY_BIN_DIR /contrib/nco-1.1/bin; setenv MY_LIB_DIR /contrib/nco-1.1/lib; setenv MY_OBJ_DIR /usr/tmp/$usr_nm/$dst_vrs/obj; gmake cln all tst\""); print STDOUT "$prg_nm: Done updating contrib NCO on $rmt_mch\n\n"; } # endif dat_cnt if($bbl_cnt){ $rmt_mch='babyblue.ucar.edu'; # $rsh_cmd $rmt_mch 'printf $PVM_ARCH' print STDOUT "\n$prg_nm: Updating contrib NCO on $rmt_mch...\n"; cmd_prc("$rsh_cmd $rmt_mch \"$rm_cmd -r /usr/tmp/$usr_nm/nco*\""); cmd_prc("$rsh_cmd $rmt_mch \"$mkdir_cmd /usr/tmp/$usr_nm/$dst_vrs/obj\""); cmd_prc("$rsh_cmd $rmt_mch \"cd /usr/tmp/$usr_nm;gunzip nco.tar.gz;tar -xvf nco.tar;rm nco.tar\""); cmd_prc("$rsh_cmd $rmt_mch \"cd /usr/tmp/$usr_nm/$dst_vrs/bld; setenv MY_BIN_DIR /home/blackforest/$usr_nm/bin/AIX; setenv MY_LIB_DIR /home/blackforest/$usr_nm/lib/AIX; setenv MY_OBJ_DIR /home/blackforest/$usr_nm/obj/AIX; setenv NETCDF_INC /usr/local/include; setenv NETCDF_LIB /usr/local/lib32/r4i4; gmake cln all tst\""); print STDOUT "$prg_nm: Done updating contrib NCO on $rmt_mch\n\n"; } # endif bbl_cnt if($blk_cnt){ $rmt_mch='blackforest.ucar.edu'; # $rsh_cmd $rmt_mch 'printf $PVM_ARCH' print STDOUT "\n$prg_nm: Updating contrib NCO on $rmt_mch...\n"; cmd_prc("$rsh_cmd $rmt_mch \"$rm_cmd -r /usr/tmp/$usr_nm/nco*\""); cmd_prc("$rsh_cmd $rmt_mch \"$mkdir_cmd /usr/tmp/$usr_nm/$dst_vrs/obj\""); cmd_prc("$rsh_cmd $rmt_mch \"cd /usr/tmp/$usr_nm;gunzip nco.tar.gz;tar -xvf nco.tar;rm nco.tar\""); cmd_prc("$rsh_cmd $rmt_mch \"cd /usr/tmp/$usr_nm/$dst_vrs/bld; setenv MY_BIN_DIR /home/blackforest/$usr_nm/bin/AIX; setenv MY_LIB_DIR /home/blackforest/$usr_nm/lib/AIX; setenv MY_OBJ_DIR /home/blackforest/$usr_nm/obj/AIX; setenv NETCDF_INC /usr/local/include; setenv NETCDF_LIB /usr/local/lib32/r4i4; gmake cln all tst\""); print STDOUT "$prg_nm: Done updating contrib NCO on $rmt_mch\n\n"; } # endif blk_cnt if($ute_prs){ $rmt_mch='utefe.ucar.edu'; # utefe and ute are cross-mounted, utefe is for interactive logins # $rsh_cmd $rmt_mch 'printf $PVM_ARCH' print STDOUT "\n$prg_nm: Updating personal NCO on $rmt_mch...\n"; cmd_prc("$rsh_cmd $rmt_mch \"$rm_cmd -r /usr/tmp/$usr_nm/nco*\""); cmd_prc("$rsh_cmd $rmt_mch \"$mkdir_cmd /usr/tmp/$usr_nm/$dst_vrs/obj\""); cmd_prc("$rsh_cmd $rmt_mch \"cd /usr/tmp/$usr_nm;tar -xvzf nco.tar.gz;rm nco.tar.gz\""); cmd_prc("$rsh_cmd $rmt_mch \"cd /usr/tmp/$usr_nm/$dst_vrs/bld; setenv MY_BIN_DIR /home/ute/$usr_nm/bin/SGIMP64/bin; setenv MY_LIB_DIR /home/ute/$usr_nm/bin/SGIMP64/lib; setenv MY_OBJ_DIR /usr/tmp/$usr_nm/$dst_vrs/obj; gmake cln all tst\""); print STDOUT "$prg_nm: Done updating contrib NCO on $rmt_mch\n\n"; } # endif ute_prs if($cray_prs){ $rmt_mch='ouray.ucar.edu'; print STDOUT "\n$prg_nm: Updating private NCO on $rmt_mch...\n"; cmd_prc("$rsh_cmd $rmt_mch \"$rm_cmd -r /usr/tmp/$usr_nm/nco*\""); cmd_prc("$rsh_cmd $rmt_mch \"$mkdir_cmd /usr/tmp/$usr_nm/$dst_vrs/obj\""); cmd_prc("$rsh_cmd $rmt_mch \"cd /usr/tmp/$usr_nm;gunzip nco.tar.gz;tar -xvf nco.tar;rm nco.tar*\""); cmd_prc("$rsh_cmd $rmt_mch \"cd /usr/tmp/$usr_nm/$dst_vrs/bld; setenv MY_BIN_DIR /home/ouray0/$usr_nm/bin/CRAY; setenv MY_LIB_DIR /usr/tmp/$usr_nm/$dst_vrs/lib; setenv MY_OBJ_DIR /usr/tmp/$usr_nm/$dst_vrs/obj; gnumake cln all tst\""); print STDOUT "$prg_nm: Done updating contrib NCO on $rmt_mch\n\n"; } # endif cray_prs nco-5.3.3/bld/pbuilder-sid000077500000000000000000000016501477164337000153710ustar00rootroot00000000000000#!/bin/sh # Purpose: Use pbuilder to build packages in a chroot environment # Script from Jamin W. Collins BTS: #255165 # Name this script 'pbuilder-woody', 'pbuilder-sid', 'pbuilder-sarge', 'pbuilder-experimental' etc. OPERATION=$1 DISTRIBUTION=`basename $0 | cut -f2 -d '-'` PROCEED=false BASE_DIR="/chroot/pbuilder" case $OPERATION in create|update|build|clean|login|execute|dumpconfig ) PROCEED=true ;; esac if ( $PROCEED == true ) then shift pbuilder $OPERATION --distribution $DISTRIBUTION --debootstrap debootstrap --basetgz $BASE_DIR/$DISTRIBUTION/$DISTRIBUTION-base.tgz --override-config --configfile $BASE_DIR/$DISTRIBUTION/pbuilderrc --buildresult $BASE_DIR/$DISTRIBUTION/result $@ else echo "Invalid command..." echo "Valid commands are:" echo " create" echo " update" echo " build" echo " clean" echo " login" echo " execute" echo " dumpconfig" exit 1 fi nco-5.3.3/bld/pvmgetarch000077500000000000000000000162561477164337000151560ustar00rootroot00000000000000#!/bin/sh # $Id$ # Purpose: Generate PVM architecture string # Usage: # cp ~/sh/pvmgetarch ~/nco/bld/pvmgetarch # cp ~/sh/pvmgetarch ~/aer/pvmgetarch # scp ~/sh/pvmgetarch dust.ess.uci.edu:/var/www/html/dead/pvmgetarch # This is a heuristic thing that may need to be tuned from time # to time. I don't know of a real solution to determining the # machine type. # Notes: # 1. Local people mess with things. # 2. It's good to try a few things for robustness. # 3. Don't use test -x # 08 Apr 1993 Robert Manchek manchek@CS.UTK.EDU. # 24 Aug 1994 last revision # 28 Jul 1995 release 3.3.8 # 20231103: Replace WIN32 with WINOS (since Windows has 64bit now too) # begin section that may need to be tuned ARCH=UNKNOWN # # determine the machine type from scratch # if [ -f /bin/uname -o -f /usr/bin/uname \ -o -f /bin/uname.exe -o -f /usr/bin/uname.exe ]; then if [ -f /bin/uname ]; then os="`/bin/uname -s`" ht="`/bin/uname -m`" ov="`/bin/uname -v`" elif [ -f /usr/bin/uname ]; then os="`/usr/bin/uname -s`" ht="`/usr/bin/uname -m`" ov="`/usr/bin/uname -v`" elif [ -f /bin/uname.exe ]; then os="`/bin/uname.exe -s`" ht="`/bin/uname.exe -m`" ov="`/bin/uname.exe -v`" else os="`/usr/bin/uname.exe -s`" ht="`/usr/bin/uname.exe -m`" ov="`/usr/bin/uname.exe -v`" fi case "$os,$ht" in SunOS,sun3* ) ARCH=SUN3 ;; SunOS,sun4* ) ARCH=SUN4 ;; SunOS,i86pc ) ARCH=X86SOL2 ;; ULTRIX,RISC ) ARCH=PMAX ;; ULTRIX,VAX ) ARCH=UVAX ;; AIX*,* ) ARCH=RS6K ;; *HP*,9000/[2345]* ) ARCH=HP300 ;; *HP*,9000/[78]* ) ARCH=HPPA ;; IRIX,* ) ARCH=SGI ;; IRIX64,* ) ARCH=SGI64 ;; *OSF*,alpha ) ARCH=ALPHA ;; # 20031116 csz++ Implement AMD Linux,x86_64 ) ARCH=LINUXAMD64 ;; # csz-- Linux,alpha ) ARCH=LINUXALPHA ;; CRSOS,smp ) ARCH=CRAYSMP ;; *,paragon ) ARCH=PGON ;; dgux,AViiON ) ARCH=DGAV ;; *,88k ) ARCH=E88K ;; *,mips ) ARCH=MIPS ;; *,CRAY-2 ) ARCH=CRAY2 ;; Linux,i[3456]86 ) ARCH=LINUX ;; Linux,sparc) ARCH=LINUXSPARC ;; BSD/OS,i[3456]86 ) ARCH=BSD386 ;; FreeBSD,i386 ) ARCH=FREEBSD ;; # 20020812 csz++ Implement MACOS Darwin,Power* ) ARCH=MACOS ;; # csz-- # 20100705 csz++ Implement OS X on PC chips Darwin,x86_64 ) ARCH=MACOS ;; # csz-- # 20020812 csz++ deprecate SX3 in favor of NECSX # SUPER-UX,SX-3 ) ARCH=SX3 ;; SUPER-UX,SX-* ) ARCH=NECSX ;; # csz-- uts,* ) ARCH=UTS2 ;; realix,M88* ) ARCH=M88K ;; DomainOS,DN* ) ARCH=APOLLO ;; OS/2,i[3456]86 ) ARCH=OS2 ;; esac fi if [ "$ARCH" = UNKNOWN ]; then if [ -f /bin/arch ]; then case "`/bin/arch`" in ksr1 ) ARCH=KSR1 ;; sun2 ) ARCH=SUN2 ;; sun3 ) ARCH=SUN3 ;; sun4 ) ARCH=SUN4 ;; esac fi fi if [ "$ARCH" = UNKNOWN ]; then if [ -f /usr/etc/RELDEF ]; then ARCH=ATT; fi if [ -f /ultrixboot ]; then if [ -f /pcs750.bin ]; then ARCH=UVAX else ARCH=PMAX fi else if [ -f /pcs750.bin ]; then ARCH=VAX; fi fi if [ -d /usr/alliant ]; then ARCH=AFX8; fi if [ -f /usr/bin/cluster ]; then ARCH=BFLY; fi if [ -d /usr/convex ]; then ARCH=CNVX; fi #++csz # if [ -f /unicos ]; then ARCH=CRAY; fi #--csz if [ -f /hp-ux ]; then ARCH=HP300; fi if [ -f /usr/bin/getcube ]; then ARCH=I860; fi if [ -f /usr/bin/asm56000 ]; then ARCH=NEXT; fi if [ -f /etc/vg ]; then ARCH=RS6K; fi if [ -d /usr/include/caif ]; then ARCH=RT; fi #++csz # Move check for /unicos to after /bin/4d because Ouray=Unicos 10.0.0 has both if [ -f /bin/4d ]; then ARCH=SGI; fi if [ -f /unicos ]; then ARCH=CRAY; fi #--csz if [ -f /dynix ]; then ARCH=SYMM; fi if [ -f /bin/titan ]; then ARCH=TITN; fi if [ -f /netbsd ]; then case "`/usr/bin/machine`" in i386) ARCH=NETBSDI386 ;; amiga) ARCH=NETBSDAMIGA ;; hp300) ARCH=NETBSDHP300 ;; mac68k) ARCH=NETBSDMAC68K ;; pmax) ARCH=NETBSDPMAX ;; sparc) ARCH=NETBSDSPARC ;; sun3) ARCH=NETBSDSUN3 ;; esac elif [ -f /usr/bin/machine ]; then case "`/usr/bin/machine`" in i386 ) ARCH=BSD386 ;; esac fi if [ -f /usr/bin/uxpm ] && /usr/bin/uxpm ; then ARCH=UXPM fi if [ -f /usr/bin/uxpv ] && /usr/bin/uxpv ; then ARCH=UXPV fi fi if [ "$ARCH" = UNKNOWN ]; then if [ -f /bin/uname -o -f /usr/bin/uname ]; then if [ -f /bin/uname ]; then os="`/bin/uname -s`" ht="`/bin/uname -m`" rv="`/bin/uname -r`" else os="`/usr/bin/uname -s`" ht="`/usr/bin/uname -m`" rv="`/usr/bin/uname -r`" fi case "$os,$ht" in #csz++ # CYGWIN*,x86_64) ARCH=WINOS ;; CYGWIN*,* | cygwin*,*) ARCH=WINOS ;; # 20231103: Update to allow MINGW MINGW*,* | ming*,*) ARCH=WINOS ;; #csz-- esac case "$os,$ht" in *,i[3456]86 ) case "$rv" in 4.*) ARCH=UWARE ;; #csz++ # 20020708: Change SCO to WIN32 # *) ARCH=SCO ;; *) ARCH=WINOS ;; #csz-- esac esac fi fi # # update the machine type to derive subclasses # if [ "$ARCH" = SUN4 ]; then rel="`/bin/uname -r`" case "$rel" in 5.* ) ARCH=SUN4SOL2 ;; esac fi if [ "$ARCH" = SUN4SOL2 ]; then #++csz nproc="`/bin/mpstat | /bin/wc -l`" # nproc="`/bin/mpstat | wc -l`" # Omit requirement that PVM_SHMEM be set to return SUNMP # Keep requirement that /bin/mpstat return multiple lines # if [ $nproc -gt 2 -a "$PVM_SHMEM" = ON ]; if [ $nproc -gt 2 ]; #--csz then ARCH=SUNMP; fi fi if [ "$ARCH" = ALPHA ]; then rel="`/usr/bin/uname -r`" case "$rel" in *[34].*) nproc="`/usr/sbin/sizer -p`" if [ $nproc -gt 1 -a "$PVM_SHMEM" = ON ]; then ARCH=ALPHAMP; fi ;; esac fi if [ "$ARCH" = SGI ]; then rel="`/bin/uname -r`" case "$rel" in 5.* ) ARCH=SGI5 ;; 6.* ) ARCH=SGI6 ;; esac fi if [ "$ARCH" = SGI64 ]; then #++csz nproc="`/usr/sbin/mpadmin -n | /bin/wc -w`" # Omit requirement that PVM_SHMEM be set to return SGIMP64 # Do require that /bin/mpadmin return more procs than winterpark # if [ $nproc -gt 1 -a "$PVM_SHMEM" = ON ]; # if [ $nproc -gt 9 ]; # 20020606: Only require 4 processors so utefe qualifies if [ $nproc -gt 4 ]; then ARCH=SGIMP64; fi fi if [ "$ARCH" = SGI5 ]; then nproc="`/usr/sbin/mpadmin -n | /bin/wc -w`" if [ $nproc -gt 1 -a "$PVM_SHMEM" = ON ]; then ARCH=SGIMP; fi fi if [ "$ARCH" = SGI6 ]; then nproc="`/usr/sbin/mpadmin -n | wc -w`" if [ $nproc -gt 1 -a "$PVM_SHMEM" = ON ]; then ARCH=SGIMP6; fi fi if [ "$ARCH" = SUN4 -a -f /dev/cm ]; then ARCH=CM2; fi if [ "$ARCH" = SUN4 -a -f /dev/cmni ]; then ARCH=CM5; fi if [ "$ARCH" = CNVX ]; then if /usr/convex/getsysinfo -f native_default; then ARCH=CNVXN fi fi if [ "$ARCH" = PMAX -a -d /usr/maspar ]; then ARCH=MASPAR; fi if [ "$ARCH" = RS6K ]; then # csz++ # case "$os,$ov" in case "$os" in # AIX*,4 ) nproc="`/usr/sbin/lsdev -C -c processor | wc -l`" AIX ) nproc="`/usr/sbin/lsdev -C -c processor | wc -l`" if [ $nproc -gt 1 -a "$PVM_SHMEM" = ON ]; then ARCH=AIX4MP; else # Make ACD machines (e.g., gss1.acd.ucar.edu) return plain old AIX # ARCH=AIX46K; ARCH=AIX; # csz-- fi ;; esac fi if [ "$ARCH" = HPPA -a -f /bin/sysinfo ]; then ARCH=CSPP; fi if [ "$ARCH" = HPPA ]; then nproc="`/usr/bin/vmstat -n | wc -l`" if [ $nproc -gt 8 -a "$PVM_SHMEM" = ON ]; then ARCH=HPPAMP; fi fi # # ugh, done. # echo $ARCH exit nco-5.3.3/bm/000077500000000000000000000000001477164337000127135ustar00rootroot00000000000000nco-5.3.3/bm/NCO_benchmarks.pm000066400000000000000000000467721477164337000161050ustar00rootroot00000000000000package NCO_benchmarks; # $Header$ # Purpose: library module supporting nco_bm.pl benchmark and regression tests # File contains BENCHMARK code (as opposed to the REGRESSION tests in "NCO_rgr.pm") # Module contains following functions in approximate order of usage: # benchmarks().........Entire set of NCO benchmarks # NB: When adding tests, _be sure to use -O to overwrite files_ # Otherwise, script hangs waiting for interactive response to overwrite queries require 5.6.1 or die "This script requires Perl version >= 5.6.1, stopped"; use English; # WCS96 p. 403 makes incomprehensible Perl errors sort of comprehensible use Cwd 'abs_path'; use warnings; use strict; #use NCO_rgr qw( tst_rgr ); # module that contains tst_rgr() use NCO_bm qw(dbg_msg tst_run $drc_dat @fl_mtd_sct $opr_sng_mpi $opr_nm $dsc_sng $prsrv_fl $srv_sd $dodap ); require Exporter; our @ISA = qw(Exporter); #export functions (top) and variables (bottom) our @EXPORT = qw( benchmarks $srv_sd $dodap $fl_nbr $dbg_lvl $bm $mpi_prc $opr_sng_mpi $omp_flg $fl_fmt $nco_D_flg $fl_out $tw_prt_bm @tst_cmd $opr_nm $dsc_sng $nsr_xpc $fl_cnt %NCO_RC ); use vars qw( $drc_dat $f @fl_mtd_sct $in_pth $in_pth_arg $ipcc_dm_sz $ldz $lnk_fl_nme $MY_BIN_DIR $n $nd $fl_nbr $r $rel_fle $ssdwrap $var_pfx $var_sfx $var_sng @var_sz $wait $tw_prt_bm $srv_sd $opr_nm $dsc_sng $mpi_prc $fl_out $bm $dbg_lvl $dodap $fl_cnt @fl_mtd_sct $fl_fmt $fl_pth %NCO_RC $nco_D_flg $ncwa_scl_tst $notbodi $nsr_xpc $omp_flg $opr_sng_mpi @tst_cmd ); sub benchmarks{ print "\nINFO: Starting Benchmarks now:\n"; # "\t+serverside status = $srv_sd\n\t+dodap = $dodap\n\t+$drc_dat = $drc_dat"; # set up the input path and argument string $in_pth = ""; $in_pth_arg = ""; if ($dodap eq "FALSE") { $in_pth_arg = "-p $drc_dat"; } elsif ($dodap ne "" && $fl_pth =~ /http/ ) { $in_pth_arg = " -p $fl_pth "; } elsif ($dodap eq "") { $in_pth_arg = " -p http://sand.ess.uci.edu/cgi-bin/dods/nph-dods/dodsdata "; } # hardcode for now until we come up with a robut method for doing this if ($srv_sd ne "SSNOTSET") { $in_pth_arg = "-p dodsdata"; } ################### Set up the symlinks ################### if ($bm && $dodap eq "FALSE" && $srv_sd eq "SSNOTSET") { if ($dbg_lvl > 0) {print "\nINFO: Setting up symlinks for test nc files\n";} for (my $fl_idx=0; $fl_idx<$fl_nbr; $fl_idx++) { my $rel_fle = "$drc_dat/$fl_mtd_sct[$fl_idx][2]" . ".nc" ; my $ldz = "0"; # leading zero for #s < 10 if ($dbg_lvl > 0) {print "\tsymlinking $rel_fle\n";} for (my $n=0; $n<32; $n ++) { if ($n>9) {$ldz ="";} my $lnk_fl_nme = "$drc_dat/$fl_mtd_sct[$fl_idx][2]" . "_" . "$ldz" . "$n" . ".nc"; if (-r $rel_fle && -d $drc_dat && -w $drc_dat){ symlink $rel_fle, $lnk_fl_nme; } } } } # The general format for the benchmarks is the same as for the regressions: # #################### begin nces benchmark # $opr_nm='nco_name'; # $dsc_sng = 'unique descriptor string for this benchmark'; # #################### # #usually require the follow test to protect against MPI explosions # if ($mpi_prc == 0 || ($mpi_prc > 0 && $opr_sng_mpi =~ /$opr_nm/)) { # # next, fill the $tst_cmd[] array with the nco commands that you want to test in order. # # You may use as many as you want, with the proviso that the output file variables are # # named uniquely using the ones described in nco_bm.pl: 336-350 (foo...). # # The last nco command is usually an ncks command that examines a single value generated # # from the preceding chain of commands # $tst_cmd[0] = "nces -h -O $fl_fmt $nco_D_flg $omp_flg -n $fl_cnt,2,1 $in_pth_arg stl_5km_00.nc $fl_out"; # if($dbg_lvl > 2){print "entire cmd: $tst_cmd[0]\n";} # $tst_cmd[1] = "ncwa -h -O $fl_fmt $nco_D_flg $omp_flg -y sqrt -a lat,lon $fl_out $fl_out"; # $tst_cmd[2] = "ncks -C -H -s '%f' -v d2_00 $fl_out"; # $tst_cmd[3] = "1.604304"; # $tst_cmd[4] = "NO_SS"; # tst_run(\@tst_cmd); # $#tst_cmd=0; # reset the array # if($dbg_lvl > 0){print "\n[past benchmark stanza - $dsc_sng\n";} # } else {print "Skipping Benchmark [$opr_nm] - not MPI-ready\n";} # # if ($dbg_lvl >= 1) {print "paused - hit return to continue"; $wait = ;} # Note that that the last SERVERSIDE executable nco statement has to end with a '%stdouterr%' to # have it return data. For both benchmarks and regressions, this is added in the # SS_gnarly_pything() sub from tst_run() that handles the SS manipulations. # Also note that in order for Daniel's ssdwrap code to work at least for now, all the files passed in have # to be named differently in order to keep things straight. So we can't name everything $fl_out # (or %tmp_fl_00% and have it work. All output must be named differently in a script for the #script to work correctly. if (0) { # DEBUGGING to skip these } # [DEBUGGING to skip these] down to here #################### begin ncap2 benchmark $opr_nm='ncap2'; $dsc_sng = 'ncap2 long algebraic operation'; ################### dbg_msg(2,"mpi_prc = $mpi_prc\nopr_sng_mpi = $opr_sng_mpi"); if ($mpi_prc == 0 || ($mpi_prc > 0 && $opr_sng_mpi =~ /$opr_nm/)) { # csz 20061024: Changed ncap to ncap2 with 40% speed penalty # Not sure why ncap2 is much slower at long arithmetic expressions $tst_cmd[0] = "ncap2 -h -O $fl_fmt $nco_D_flg -s \"nu_var1[time,lev,lat,lon]=d4_01*d4_02*(d4_03^2)-(d4_05/d4_06)\" -s \"nu_var2[time,lev,lat,lon]=(d4_13/d4_02)*((d4_03^2)-(d4_05/d4_06))\" -s \"nu_var3[time,lat,lon]=(d3_08*d3_01)-(d3_05^3)-(d3_11*d3_16)\" -s \"nu_var4[time,lat,lon]=(d3_08+d3_01)-((d3_05*3)-d3_11-17.33)\" $in_pth_arg gcm_T85.nc %tmp_fl_01%"; $tst_cmd[1] = "ncwa -O $omp_flg -y sqrt -a lat,lon %tmp_fl_01% %tmp_fl_02%"; $tst_cmd[2] = "ncks -C -H -s '%f' -v d2_00 %tmp_fl_02% "; # as noted above, for serverside prep, the final '%stdouterr%' il be added in SS_gnarly_pything() # note that the 2 additions to the list are the expected value and the indicator whether it # can be used as a server side operation: # "NO_SS" sez don't even try. "SS_OK" sez to try IF the --serverside flag is set $tst_cmd[3] = "4.024271"; # $tst_cmd[4] = "NO_SS"; $tst_cmd[4] = "SS_OK"; tst_run(\@tst_cmd); $#tst_cmd=0; # reset the array if($dbg_lvl > 0){print "\n[past benchmark stanza - $dsc_sng]\n";} } else {print "Skipping Benchmark because $opr_nm does not support MPI\n";} if ($dbg_lvl >= 1) {print "paused after ncap2 - hit return to continue"; $wait = ;} #################### begin ncbo benchmark $opr_nm='ncbo'; $dsc_sng = 'ncbo differencing two files'; #################### if ($mpi_prc == 0 || ($mpi_prc > 0 && $opr_sng_mpi =~ /$opr_nm/)) { # if ($dbg_lvl > 0) {print "\nBenchmark: $dsc_sng\n";} $tst_cmd[0] = "ncbo -h -O $fl_fmt $nco_D_flg $omp_flg --op_typ='-' $in_pth_arg gcm_T85.nc gcm_T85_00.nc %tmp_fl_00%"; # $tst_cmd[0] = "ncbo -h -O $fl_fmt $nco_D_flg $omp_flg --op_typ='-' $in_pth_arg stl_sml.nc stl_sml_00.nc %tmp_fl_00%"; # smaller test file if($dbg_lvl > 2){print "entire cmd: $tst_cmd[0]\n";} $tst_cmd[1] = "ncks -C -H -s '%f' -v sleepy %tmp_fl_00% "; # $tst_cmd[1] = "ncks -C -H -s '%f' -v weepy %tmp_fl_00%"; # smaller test file $tst_cmd[2] = "0.000000"; $tst_cmd[3] = "SS_OK"; tst_run(\@tst_cmd); $#tst_cmd=0; # reset the array if($dbg_lvl > 0){print "\n[past benchmark stanza - $dsc_sng]\n";} } else {print "Skipping Benchmark [$opr_nm] - not MPI-ready\n";} if ($dbg_lvl >= 1) {print "paused - hit return to continue"; $wait = ;} #################### begin nces benchmark $opr_nm='nces'; $dsc_sng = 'nces averaging 2^5 files'; #################### if ($mpi_prc == 0 || ($mpi_prc > 0 && $opr_sng_mpi =~ /$opr_nm/)) { if ($dbg_lvl > 0) {print "\nBenchmark: \$fl_fmt = [$fl_fmt], \$nco_D_flg = $nco_D_flg, \$omp_flg = [$omp_flg], \$dsc_sng = $dsc_sng, \$fl_cnt = [$fl_cnt], \n";} $tst_cmd[0] = "nces -h -O $fl_fmt $nco_D_flg $omp_flg -n $fl_cnt,2,1 $in_pth_arg stl_5km_00.nc %tmp_fl_00%"; if($dbg_lvl > 2){print "entire cmd: $tst_cmd[0]\n";} $tst_cmd[1] = "ncwa -h -O $fl_fmt $nco_D_flg $omp_flg -y sqrt -a lat,lon %tmp_fl_00% %tmp_fl_01%"; $tst_cmd[2] = "ncks -C -H -s '%f' -v d2_00 %tmp_fl_01%"; $tst_cmd[3] = "1.604304"; $tst_cmd[4] = "SS_OK"; tst_run(\@tst_cmd); $#tst_cmd=0; # reset the array if($dbg_lvl > 0){print "\n[past benchmark stanza - $dsc_sng\n";} } else {print "Skipping Benchmark [$opr_nm] - not MPI-ready\n";} if ($dbg_lvl >= 1) {print "paused - hit return to continue"; $wait = ;} #################### begin ncecat benchmark $opr_nm='ncecat'; $dsc_sng = 'ncecat joining 2^5 files'; # tms_lng.nc * 32 = 1.51GB #################### if ($mpi_prc == 0 || ($mpi_prc > 0 && $opr_sng_mpi =~ /$opr_nm/)) { # if ($dbg_lvl > 0) {print "\nBenchmark: $dsc_sng, files=$fl_cnt\n";} $tst_cmd[0] = "ncecat -h -O $fl_fmt $nco_D_flg $omp_flg -n $fl_cnt,2,1 $in_pth_arg tms_lng_00.nc %tmp_fl_00%"; $tst_cmd[1] = "ncwa -h -O $fl_fmt $nco_D_flg $omp_flg %tmp_fl_00% %tmp_fl_01%"; $tst_cmd[2] = "ncks -C -H -s '%f' -v PO2 %tmp_fl_01%"; # following required due to shortened length of test under dap. if ($dodap eq "FALSE") { $tst_cmd[3] = "12.759310";} else { $tst_cmd[3] = "18.106375";} $tst_cmd[4] = "SS_OK"; tst_run(\@tst_cmd); $#tst_cmd=0; # reset the array if($dbg_lvl > 0){print "\n[past benchmark stanza - $dsc_sng\n";} } else {print "Skipping Benchmark [$opr_nm] - not MPI-ready\n";} if ($dbg_lvl >= 1) {print "paused - hit return to continue"; $wait = ;} #################### begin ncflint benchmark - needs to be verified and md5/wc sums created. $opr_nm='ncflint'; $dsc_sng = 'ncflint weight-averaging 2 files'; #################### if ($mpi_prc == 0 || ($mpi_prc > 0 && $opr_sng_mpi =~ /$opr_nm/)) { # if ($dbg_lvl > 0) {print "\nBenchmark: $dsc_sng\n";} $tst_cmd[0] = "ncflint -h -O $fl_fmt $nco_D_flg -w '0.5' $in_pth_arg gcm_T85_00.nc gcm_T85_01.nc %tmp_fl_00%"; if($dbg_lvl > 2){print "entire cmd: $tst_cmd[0]\n";} $tst_cmd[1] = "ncwa -h -O $fl_fmt $nco_D_flg $omp_flg -y sqrt -a lat,lon %tmp_fl_00% %tmp_fl_01%"; $tst_cmd[2] = "ncks -C -H -s '%f ' -v d1_00 %tmp_fl_01%"; $tst_cmd[3] = "1.800000 1.800000 1.800000 1.800000 1.800000 1.800000 1.800000 1.800000"; $tst_cmd[4] = "SS_OK"; tst_run(\@tst_cmd); $#tst_cmd=0; # reset the array if($dbg_lvl > 0){print "\n[past benchmark stanza - $dsc_sng\n";} } else {print "Skipping Benchmark [$opr_nm] - not MPI-ready\n";} if ($dbg_lvl >= 1) {print "paused - hit return to continue"; $wait = ;} #################### begin ncpdq benchmark - reversal $opr_nm='ncpdq'; $dsc_sng = 'ncpdq dimension-order reversal'; #################### if ($mpi_prc == 0 || ($mpi_prc > 0 && $opr_sng_mpi =~ /$opr_nm/)) { # if ($dbg_lvl > 0) {print "\nBenchmark: $dsc_sng\n";} #!!WARN - change back to testing the ipcc file after verify # !! this one is buggered by the current ssdwrap $tst_cmd[0] = "ncpdq -h -O $fl_fmt $nco_D_flg $omp_flg -a '-time,-lev,-lat,-lon' $in_pth_arg gcm_T85.nc %tmp_fl_00%"; # ~2m on sand for gcm_T85.nc $tst_cmd[1] = "ncks -C -H -s \"%f\" -v dopey %tmp_fl_00%"; #ipcc $tst_cmd[2] = "0.800000"; $tst_cmd[3] = "SS_OK"; tst_run(\@tst_cmd); $#tst_cmd=0; # reset the array if($dbg_lvl > 0){print "\n[past benchmark stanza - $dsc_sng\n";} } else {print "Skipping Benchmark [$opr_nm] - not MPI-ready\n";} if ($dbg_lvl >= 1) {print "paused - hit return to continue"; $wait = ;} #################### next ncpdq benchmark - re-ordering $opr_nm='ncpdq'; $dsc_sng = 'ncpdq dimension-order re-ordering'; #################### if ($mpi_prc == 0 || ($mpi_prc > 0 && $opr_sng_mpi =~ /$opr_nm/)) { # if ($dbg_lvl > 0) {print "\nBenchmark: $dsc_sng\n";} $tst_cmd[0] = "ncpdq -h -O $fl_fmt $nco_D_flg $omp_flg -a 'lon,time,lev,lat' $in_pth_arg gcm_T85.nc %tmp_fl_00%"; $tst_cmd[1] = "ncks -C -H -s \"%f\" -v dopey %tmp_fl_00%"; #ipcc $tst_cmd[2] = "0.800000"; $tst_cmd[3] = "SS_OK"; tst_run(\@tst_cmd); $#tst_cmd=0; # reset the array if($dbg_lvl > 0){print "\n[past benchmark stanza - $dsc_sng\n";} } else {print "Skipping Benchmark [$opr_nm] - not MPI-ready\n";} if ($dbg_lvl >= 1) {print "paused - hit return to continue"; $wait = ;} #################### next ncpdq benchmark - re-ordering & reversing $opr_nm='ncpdq'; $dsc_sng = 'ncpdq dimension-order re-ordering & reversing'; #################### if ($mpi_prc == 0 || ($mpi_prc > 0 && $opr_sng_mpi =~ /$opr_nm/)) { # if ($dbg_lvl > 0) {print "\nBenchmark: $dsc_sng\n";} $tst_cmd[0] = "ncpdq -h -O $fl_fmt $nco_D_flg $omp_flg -a '-lon,-time,-lev,-lat' $in_pth_arg gcm_T85.nc %tmp_fl_00%"; $tst_cmd[1] = "ncks -C -H -s \"%f\" -v dopey %tmp_fl_00%"; #ipcc $tst_cmd[2] = "0.800000"; $tst_cmd[3] = "SS_OK"; tst_run(\@tst_cmd); $#tst_cmd=0; # reset the array if($dbg_lvl > 0){print "\n[past benchmark stanza - $dsc_sng\n";} } else {print "Skipping Benchmark [$opr_nm] - not MPI-ready\n";} if ($dbg_lvl >= 1) {print "paused - hit return to continue"; $wait = ;} #################### next ncpdq benchmark $opr_nm='ncpdq'; $dsc_sng = 'ncpdq packing a file'; #################### if ($mpi_prc == 0 || ($mpi_prc > 0 && $opr_sng_mpi =~ /$opr_nm/)) { # if ($dbg_lvl > 0) {print "\nBenchmark: $dsc_sng\n";} $tst_cmd[0] = "ncpdq -h -O $fl_fmt $nco_D_flg $omp_flg -P all_new $in_pth_arg gcm_T85.nc %tmp_fl_00%"; $tst_cmd[1] = "ncks -C -H -s \"%f\" -v dopey %tmp_fl_00%"; $tst_cmd[2] = "0.000000"; $tst_cmd[3] = "SS_OK"; tst_run(\@tst_cmd); $#tst_cmd=0; # reset the array if($dbg_lvl > 0){print "\n[past benchmark stanza - $dsc_sng\n";} } else {print "Skipping Benchmark [$opr_nm] - not MPI-ready\n";} if ($dbg_lvl >= 1) {print "paused - hit return to continue"; $wait = ;} #################### begin cz benchmark list #2 $opr_nm='ncra'; $dsc_sng = 'ncra time-averaging 2^5 (i.e. one month) ipcc files'; #################### if ($notbodi) { # too big for bodi if ($mpi_prc == 0 || ($mpi_prc > 0 && $opr_sng_mpi =~ /$opr_nm/)) { # if ($dbg_lvl > 0) {print "\nBenchmark: $dsc_sng\n";} $tst_cmd[0] = "ncra -h -O $fl_fmt $nco_D_flg $omp_flg -n $fl_cnt,2,1 $in_pth_arg gcm_T85_00.nc %tmp_fl_00%"; # ~4m on sand. $tst_cmd[1] = "ncks -C -H -s '%f' -v d1_03 %tmp_fl_00% "; $tst_cmd[2] = "1.800001"; $tst_cmd[3] = "NO_SS_OK"; tst_run(\@tst_cmd); $#tst_cmd=0; # reset the array if($dbg_lvl > 0){print "\n[past benchmark stanza - $dsc_sng\n";} } else {print "Skipping Benchmark [$opr_nm] - not MPI-ready\n";} } if ($dbg_lvl >= 1) {print "paused - hit return to continue"; $wait = ;} # the 1st and last lines of this stanza are commented for testing the benchmarks on the Gb net # but it's incredibly slow - order of several hours even if done on the same machine if ($dodap eq "FALSE") { # only if not being done by remote #################### begin ncrcat benchmark $opr_nm='ncrcat'; $dsc_sng = 'ncrcat joining 2^5 files'; # tms_lng.nc * 32 = 1.51GB #################### if ($mpi_prc == 0 || ($mpi_prc > 0 && $opr_sng_mpi =~ /$opr_nm/)) { # if ($dbg_lvl > 0) {print "\nBenchmark: $dsc_sng\n";} $tst_cmd[0] = "ncrcat -h -O $fl_fmt $nco_D_flg $omp_flg -n 22,2,1 $in_pth_arg tms_lng_00.nc %tmp_fl_00%"; # $tst_cmd[0] = "ncrcat -h -O $fl_fmt $nco_D_flg $omp_flg -n $fl_cnt,2,1 $in_pth_arg tms_lng_00.nc %tmp_fl_00%"; $tst_cmd[1] = "ncwa -h -O $fl_fmt $nco_D_flg $omp_flg %tmp_fl_00% %tmp_fl_01%"; $tst_cmd[2] = "ncks -C -H -s '%f' -v PO2 %tmp_fl_01%"; $tst_cmd[3] = "12.759310"; $tst_cmd[4] = "SS_OK"; tst_run(\@tst_cmd); $#tst_cmd=0; # reset the array if($dbg_lvl > 0){print "\n[past benchmark stanza - $dsc_sng\n";} } else { print "Skipping Benchmark [$opr_nm] - not MPI-ready\n"; } } else { print "\nNB: ncrcat benchmark skipped for OpenDAP test - takes too long.\n\n"; } if ($dbg_lvl >= 1) {print "paused - hit return to continue"; $wait = ;} #################### begin ncwa benchmark list #1a $opr_nm='ncwa'; $dsc_sng = 'ncwa averaging all variables to scalars - stl_5km.nc & sqrt'; #################### if ($mpi_prc == 0 || ($mpi_prc > 0 && $opr_sng_mpi =~ /$opr_nm/)) { # if ($dbg_lvl > 0) {print "\nBenchmark: $dsc_sng\n";} $tst_cmd[0] = "ncwa -h -O $fl_fmt $nco_D_flg $omp_flg -w lat -y sqrt -a lat,lon $in_pth_arg stl_5km.nc %tmp_fl_00%"; $tst_cmd[1] = "ncks -C -H -s '%f' -v d2_02 %tmp_fl_00%"; $tst_cmd[2] = "1.673425"; $tst_cmd[3] = "SS_OK"; tst_run(\@tst_cmd); $#tst_cmd=0; # reset the array if($dbg_lvl > 0){print "\n[past benchmark stanza - $dsc_sng\n";} } else {print "Skipping Benchmark [$opr_nm] - not MPI-ready\n";} if ($dbg_lvl >= 1) {print "paused - hit return to continue"; $wait = ;} printf("paused @ [%s:%d] - hit return to continue\n", __FILE__, __LINE__); my $wait = ; # following fails on numeric cmp but why should the result the same? #################### begin ncwa benchmark list #1b $opr_nm='ncwa'; $dsc_sng = 'ncwa averaging all variables to scalars - stl_5km.nc & rms'; #################### if ($mpi_prc == 0 || ($mpi_prc > 0 && $opr_sng_mpi =~ /$opr_nm/)) { # if ($dbg_lvl > 0) {print "\nBenchmark: $dsc_sng\n";} $tst_cmd[0] = "ncwa -h -O $fl_fmt $nco_D_flg $omp_flg -y rms -w lat -a lat,lon $in_pth_arg stl_5km.nc %tmp_fl_00%"; $tst_cmd[1] = "ncks -C -H -s '%f' -v d2_02 %tmp_fl_00%"; $tst_cmd[2] = "2.800084"; $tst_cmd[3] = "SS_OK"; tst_run(\@tst_cmd); $#tst_cmd=0; # reset the array if($dbg_lvl > 0){print "\n[past benchmark stanza - $dsc_sng\n";} } else {print "Skipping Benchmark [$opr_nm] - not MPI-ready\n";} if ($dbg_lvl >= 1) {print "paused - hit return to continue"; $wait = ;} if ($mpi_prc == 0 || ($mpi_prc > 0 && $opr_sng_mpi =~ /$opr_nm/)) { if ($notbodi) { # ipcc too big for bodi #################### begin ncwa benchmark list #1c $opr_nm = 'ncwa'; $dsc_sng = 'ncwa averaging all variables to scalars - gcm_T85.nc & sqt'; #################### # if ($dbg_lvl > 0) {print "\nBenchmark: $dsc_sng\n";} $tst_cmd[0] = "ncwa -h -O $fl_fmt $nco_D_flg $omp_flg -y sqrt -w lat -a lat,lon $in_pth_arg gcm_T85.nc %tmp_fl_00%"; $tst_cmd[1] = "ncks -C -H -s '%f' -v skanky %tmp_fl_00%"; $tst_cmd[2] = "0.800000"; $tst_cmd[3] = "SS_OK"; tst_run(\@tst_cmd); $#tst_cmd=0; # reset the array } } else {print "Skipping Benchmark [$opr_nm] - not MPI-ready\n";} if ($dbg_lvl >= 1) {print "paused - hit return to continue"; $wait = ;} if ($ncwa_scl_tst) { if ($mpi_prc == 0 || ($mpi_prc > 0 && $opr_sng_mpi =~ /$opr_nm/)) { if ($notbodi) { # ipcc too big for bodi #my @ipcc_dm_sz = (8, 8, 16, 64, 32); # dims for d0-d4 # 3 -v descriptors that should reduce the total size to 1/2, 1/4, 1/8. my @var_sz = (" -v d1_0[0-3] -v d2_0[0-7] -v d3_[0-2][0-9] -v -d3_3[01] -v d4_0[0-9] -v d4_1[0-5]", " -v d1_0[01] -v d2_0[0-3] -v d3_0[0-9] -v d3_1[0-5] -v d4_0[0-3]]", " -v d1_00 -v d2_0[01] -v d3_0[0-7] -v d4_0[01]"); #################### begin ncwa benchmark list #1c $opr_nm='ncwa'; $dsc_sng = 'ncwa averaging at dif var sizes - gcm_T85.nc & sqt'; #################### # make vars in size of 1/2, 1/4, 1/8 of each one. # for (my $r=0; $r<5; $r++) { # my $var_pfx = sprintf("d%d_", $r); # for (my $nd=2; $nd<=8; $nd*2){ # my $var_sfx = sprintf("%2d", $ipcc_dm_sz[$r]); # my $var_sng = # } # } for (my $r=0; $r<2; $r++) { $tst_cmd[0] = "ncwa -h -O $fl_fmt $nco_D_flg $omp_flg $var_sz[$r] -y sqrt -w lat -a lat,lon $in_pth_arg gcm_T85.nc %tmp_fl_00%"; $tst_cmd[1] = "ncks -C -H -s '%f' -v skanky %tmp_fl_00%"; $tst_cmd[2] = "0.800000"; $tst_cmd[3] = "SS_OK"; tst_run(\@tst_cmd); $#tst_cmd=0; # reset the array } } # not bodi } else {print "Skipping Benchmark [$opr_nm] - not MPI-ready\n";} } # and summarize the benchmarks results NCO_bm::rsl_smr_rgr(); } 1; __END__ nco-5.3.3/bm/NCO_bm.pm000066400000000000000000001437201477164337000143550ustar00rootroot00000000000000package NCO_bm; # $Header$ # Purpose: Library for nco_bm.pl benchmark and regression tests # Module contains following functions: # bm_ntl().........initialization, set NCOs to be tested under different conditions # bm_usg().........dumps usage text # bm_vrb().........small fnc() to print to both screen and log # drc_dat_set()....figures out where to write output data # fl_mk()..........creates test files # fl_mtd_ntl().....Initialize meta-data used to create test files # rsl_chk_MD5_wc().checks output via md5/wc validation # rsl_smr_fl_mk()..summarize results of file creation tests # rsl_smr_rgr()....summarize results of both regression and benchmark tests # tst_run()........execute regressions and benchmarks in same format # tst_tm_hrz().....almost ready-to-delete test of HiRes fnc() on Opterons # vrs_sng_get()....create two-part release and date string e.g., "3.0.3 / 20051004" require 5.6.1 or die "This script requires Perl version >= 5.6.1, stopped"; use English; # WCS96 p. 403 makes Perl errors more comprehensible use Cwd 'abs_path'; #use NCO_benchmarks qw($tw_prt_bm); use strict; use NCO_rgr qw ( tst_rgr $dodap $pfx_cmd $pfx_cmd_crr $opr_sng_mpi $opr_nm $dsc_sng $prsrv_fl $fl_out ); # $foo1_fl $foo_fl $foo_tst # module that contains tst_rgr() #use NCO_benchmarks; #module that contains the actual benchmark code # use warnings; require Exporter; our @ISA = qw(Exporter); #export functions (top) and variables (bottom) our @EXPORT = qw ( tst_run dbg_msg drc_dat_set bm_ntl $pfx_cmd $pfx_cmd_crr $drc_dat @fl_mtd_sct $opr_sng_mpi $opr_nm $dsc_sng %NCO_RC $prsrv_fl $srv_sd $hiresfound $dodap $bm $dbg_lvl $sock $udp_rpt $mpi_prc $pfx_mpi $mpi_fk $mpi_upx ); use vars qw( $aix_mpi_nvr_pfx $aix_mpi_sgl_nvr_pfx $bm $dbg_lvl $dodap $dot_fmt $dot_nbr $dot_nbr_min $dot_sng $dsc_fmt $dsc_lng_max $dsc_sng $pfx_fk $hiresfound $md5 $mpi_prc $pfx_mpi $mpi_fk $mpi_upx $MY_BIN_DIR %NCO_RC $nsr_xpc $opr_fmt $opr_lng_max @opr_lst @opr_lst_all @opr_lst_mpi $opr_nm $opr_rgr_mpi $opr_sng_mpi $os_nm $pfx_cmd $pfx_cmd_crr %real_tme $cmd_rsl $spc_fmt $spc_nbr $spc_nbr_min $spc_sng %subbenchmarks %success @sys_tim_arr $sys_time %sys_tme $timed %totbenchmarks @tst_cmd $tst_fmt $tst_id_sng %tst_nbr %usr_tme $wnt_log $timestamp $bm_drc $caseid $cmd_ln $drc_dat @fl_mtd_sct $fl_pth @fl_tmg $md5found %MD5_tbl $nco_D_flg $fl_nbr $pfxd $prsrv_fl $que $server_ip $sock $thr_nbr $dbg_sng $err_sng $tmr_app $udp_rpt %wc_tbl $pfxd $nvr_my_bin_dir $prg_nm $arg_nbr $tw_prt_bm $srv_sd @cmd_lst ); # $fl_out print "\nINFO: Testing for required modules\n"; BEGIN {eval "use Time::HiRes qw(usleep ualarm gettimeofday tv_interval)"; $hiresfound = $@ ? 0 : 1} #$hiresfound = 0; # uncomment to simulate not found if ($hiresfound == 0) { print "\nOoops! Time::HiRes (needed for accurate timing) not found\nContinuing without timing."; } else { print "\tTime::HiRes ... found.\n"; } # $hiresfound # bm_usg - informational blurb for script sub bm_usg { print << 'USAGE'; Usage: nco_bm.pl (options) [list of operators to test from the following list] ncap2 ncatted ncbo ncflint nces ncecat ncks ncpdq ncra ncrcat ncrename ncwa net (default tests all) where (options) are: --usage || -h ...dumps this help --debug {1-3) ...puts the script into debug mode; emits more and (hopefully) more useful info. Also inserts the comparable -D flag into the nco commandline. --caseid {short id string} this string can be used to identity and separate results from different runs. --dap {OPeNDAP url} ...retrieve test files from OPeNDAP server URL --opendap..............ditto. Both take a URL of the form: http://dust.ess.uci.edu/cgi-bin/dods/nph-dods/dodsdata (i.e., URL points points thru the cgi-bin to the data dir) --dust_user.....use this to define a user who CAN log into dust for testing --fl_fmt........sets the file type to test. One of: classic, 64bit, netcdf4, netcdf4_classic --log ..........requests that debug info is logged to 'nco_bm.log' as well as spat to STDOUT. --mpi_prc {#>0}..number of MPI processes to spawn --mpi_fake.......run mpi executable as single process for debugging. --fake_mpi.......ditto --udpreport.....requests that the test results are communicated back to NCO Central to add your test, timing, and build results. NB: This option uses udp port 29659 and may set off firewall alarms if used unless that port is open. --scaling.......Run ncwa benchmarks with 1/2, 1/4, 1/8 of the variables --serverside {server URL}..requests that benchmarks be run on server side points to dust.ess.uci.edu unless alternate URL is given [EXPERIMENTAL] --test_files....Test and excercise file creation script 'ncgen' and the Left Hand Casting ability of ncap. Currently gives the option to test 4 files of increasing size and complexity: 0 - none; skip this section 1 - example long skinny nc ~ 50MB ~few sec 2 - small Satellite data set ~100MB ~several sec 3 - 5km Satellite data set ~300MB ~min 4 - IPCC Daily T85 data set ~ 4GB ~several min A - All --thr_nbr {#>0}....Number of OpenMP threads to use --xdata.........Explicit data path set from command line (overrides DATA environment variable) --regress.......Perform regression tests --benchmark.....Perform benchmarks nco_bm.pl is a semi-automated script for testing the accuracy and robustness of the NCO (netCDF Operators), typically after they are built, using the 'make benchmark' command. This script can also collect benchmark statistics via sending test results to a UDP server. NB: When adding tests, use NCO's '-O' switch to overwrite files. Otherwise, the script hangs waiting for interactive responses. Also, unless history is required, use '-h' to inhibit appending history to file. This script is part of the netCDF Operators package: http://nco.sf.net Copyright 1995--present Charlie Zender USAGE exit(0); } # end bm_usg() # ' <-- to make emacs happy after the USAGE block # Initialize NCOs that need to be tested for particular conditions sub bm_ntl($$){ use vars qw($prg_nm %sym_link %failure); my $bch_flg; # [flg] Batch behavior my $dbg_lvl; # [flg] Debugging level ($bch_flg,$dbg_lvl)=@_; # Enumerate operators to test @opr_lst_all = qw( ncap2 ncdiff ncatted ncbo ncclimo ncflint nces ncecat ncks ncpdq ncra ncrcat ncremap ncrename ncwa net); @opr_lst_mpi = qw( ncbo ncecat ncflint ncpdq ncra ncwa ncpdq ncra ); $opr_sng_mpi = "ncbo ncdiff ncecat ncflint nces ncpdq ncra ncwa "; # ncpdq ncra MPI, but fail bench $opr_rgr_mpi = "ncbo ncdiff ncecat ncflint nces ncpdq ncra ncwa ncrcat"; # need all of them for regression if(scalar @ARGV > 0){@opr_lst=@ARGV;}else{@opr_lst=@opr_lst_all;} if(defined $ENV{'MY_BIN_DIR'} && $ENV{'MY_BIN_DIR'} ne ""){$MY_BIN_DIR=$ENV{'MY_BIN_DIR'}; }else{ # Set and verify MY_BIN_DIR $MY_BIN_DIR=abs_path("../src/nco"); dbg_msg(2,"ENV var 'MY_BIN_DIR' not specified, so using default [$MY_BIN_DIR]."); # if($bch_flg){ # die "unable to continue in batch mode without MY_BIN_DIR\n stopped\n"; # }else{ # !bch_flg # $MY_BIN_DIR=abs_path("../src/nco"); # printf "use $MY_BIN_DIR?\n['y' or specify] "; # my $ans = ; # chomp $ans; # $MY_BIN_DIR = $ans unless (lc($ans) eq "y" || lc($ans) eq ''); # } # !bch_flg } # !$MY_BIN_DIR dbg_msg(1,"$prg_nm: bm_ntl() reports:\n\t \$MY_BIN_DIR = $MY_BIN_DIR, \n\t \@opr_lst = @opr_lst\n\t \$opr_sng_mpi = $opr_sng_mpi\n\t \$opr_rgr_mpi = $opr_rgr_mpi\n"); # Die if this path still does not work if($opr_lst[0] ne 'ncap2'){ die "$MY_BIN_DIR/$opr_lst[0] does not exist\n stopped" unless (-e "$MY_BIN_DIR/$opr_lst[0]" || $opr_lst[0] eq "net"); } # Create symbolic links for testing # If libtool created shared libraries, then point to real executables # in ../src/nco/.libs my $dotlib = ''; # 20170608: Removed at suggestion of Daniel Neumann # $dotlib = ".libs/lt-" if `head -1 $MY_BIN_DIR/ncatted` =~ m/sh/; $sym_link{ncdiff}=$dotlib . "ncbo"; $sym_link{nces}=$dotlib . "ncra"; $sym_link{ncrcat}=$dotlib . "ncra"; foreach(keys %sym_link){ system("cd $MY_BIN_DIR && ln -s -f $sym_link{$_} $_ || (/bin/rm -f $_ && ln -s -f $sym_link{$_} $_)"); } # Go to data directory where tests are actually run my $drc_in_nc = "../data"; chdir $drc_in_nc or die "$OS_ERROR\n stopped"; # Make sure in.nc exists, make it if possible, or die # ncgen is not part of unless (-e "in.nc"){ system("ncgen -o in.nc in.cdl") if (`which ncgen` and -e "in.cdl"); } die "The netCDF file \"in.nc\" is necessary for testing NCO, however, it could not be found in \"$drc_in_nc\". Also, it could not be generated because \"ncgen\" could not be found in your path and/or the file \"$drc_in_nc/in.cdl\" does not exist.\n stopped" unless (-e "in.nc"); #create large files openMP testing if( !(-e "lrg_bm.nc") && (-e "lrg_bm.in") && (-e "$MY_BIN_DIR/ncap2") ){ # make lrg_bm.nc system("$MY_BIN_DIR/ncap2 -C -v -O -t1 -S lrg_bm.in in.nc lrg_bm.nc"); # make lrg_bm1.nc system("$MY_BIN_DIR/ncap2 -C -v -O -t1 -S lrg_bm.in lrg_bm.nc lrg_bm1.nc"); } # Initialize hashes for each operator to test foreach(@opr_lst) { $tst_nbr{$_}=0; $success{$_}=0; $failure{$_}=0; } } # end of bm_ntl() # Output string to either stdout, log, or both sub bm_vrb { my $dbg_lvl = shift; my $wnt_log = shift; my $ts = shift; # my $wnt_log; # why should this be required? if($dbg_lvl > 0){printf ("$ts");} if($wnt_log) {printf (LOG "$ts");} } # end of bm_vrb($dbg_lvl, $wnt_log, informational string to output ) sub fl_mtd_ntl { # Purpose: fl_mtd_ntl() initializes metadata for all test files my $fl_nbr=3; my $idx_stl_5km=0; my $idx_gcm_dly=1; my $idx_tms_lng=2; dbg_msg(1,"fl_mtd_ntl: \$fl_nbr = $fl_nbr"); if ($dbg_lvl > 2) { print "\nWaiting for keypress to proceed.\n"; my $tmp = ; } for (my $i = 0; $i < $fl_nbr; $i++) { $fl_tmg[$i][1] = $fl_tmg[$i][2] = " omitted "; } # $fl_mtd_sct[$idx_gn_xpr][0] = "example gene expression"; # option descriptor # $fl_mtd_sct[$idx_gn_xpr][1] = "~50MB"; # file size # $fl_mtd_sct[$idx_gn_xpr][2] = $fl_tmg[$idx_gn_xpr][0] = "gn_xpr"; # $fl_mtd_sct[$idx_gn_xpr][3] = "\'base[ge_atoms,rep,treat,cell,params]=5.67f\'"; # $fl_mtd_sct[$idx_stl_sml][0] = "Satellite small"; # option descriptor # $fl_mtd_sct[$idx_stl_sml][1] = "~100MB"; # file size # $fl_mtd_sct[$idx_stl_sml][2] = $fl_tmg[$idx_stl_sml][0] = "stl_sml"; # file name root # $fl_mtd_sct[$idx_stl_sml][3] = "\'d2_00[lat,lon]=16.37f;d2_01[lat,lon]=2.8f;d2_02[lat,lon]=3.8f;\'"; $fl_mtd_sct[$idx_stl_5km][0] = "Satellite 5km"; # option descriptor $fl_mtd_sct[$idx_stl_5km][1] = "~300MB"; # file size $fl_mtd_sct[$idx_stl_5km][2] = $fl_tmg[$idx_stl_5km][0] = "stl_5km"; # file name root $fl_mtd_sct[$idx_stl_5km][3] = "\'weepy=1.23456f;d2_00[lat,lon]=2.8f;d2_01[lat,lon]=2.8f;d2_02[lat,lon]=2.8f;d2_03[lat,lon]=2.8f;d2_04[lat,lon]=2.8f;d2_05[lat,lon]=2.8f;d2_06[lat,lon]=2.8f;d2_07[lat,lon]=2.8f;\'"; $fl_mtd_sct[$idx_gcm_dly][0] = "GCM T85"; # option descriptor $fl_mtd_sct[$idx_gcm_dly][1] = "~1.2GB"; # file size $fl_mtd_sct[$idx_gcm_dly][2] = $fl_tmg[$idx_gcm_dly][0] = "gcm_T85"; # file name root $fl_mtd_sct[$idx_gcm_dly][3] = "\'weepy=0.8f;dopey=0.8f;sleepy=0.8f;grouchy=0.8f;sneezy=0.8f;doc=0.8f;wanky=0.8f;skanky=0.8f;d1_00[time]=1.8f;d1_01[time]=1.8f;d1_02[time]=1.8f;d1_03[time]=1.8f;d1_04[time]=1.8f;d1_05[time]=1.8f;d1_06[time]=1.8f;d1_07[time]=1.8f;d2_00[lat,lon]=16.2f;d2_01[lat,lon]=16.2f;d2_02[lat,lon]=16.2f;d2_03[lat,lon]=16.2f;d2_04[lat,lon]=16.2f;d2_05[lat,lon]=16.2f;d2_06[lat,lon]=16.2f;d2_07[lat,lon]=16.2f;d2_08[lat,lon]=16.2f;d2_09[lat,lon]=16.2f;d2_10[lat,lon]=16.2f;d2_11[lat,lon]=16.2f;d2_12[lat,lon]=16.2f;d2_13[lat,lon]=16.2f;d2_14[lat,lon]=16.2f;d2_15[lat,lon]=16.2f;d3_00[time,lat,lon]=64.0f;d3_01[time,lat,lon]=64.0f;d3_02[time,lat,lon]=64.0f;d3_03[time,lat,lon]=64.0f;d3_04[time,lat,lon]=64.0f;d3_05[time,lat,lon]=64.0f;d3_06[time,lat,lon]=64.0f;d3_07[time,lat,lon]=64.0f;d3_08[time,lat,lon]=64.0f;d3_09[time,lat,lon]=64.0f;d3_10[time,lat,lon]=64.0f;d3_11[time,lat,lon]=64.0f;d3_12[time,lat,lon]=64.0f;d3_13[time,lat,lon]=64.0f;d3_14[time,lat,lon]=64.0f;d3_15[time,lat,lon]=64.0f;d3_16[time,lat,lon]=64.0f;d3_17[time,lat,lon]=64.0f;d3_18[time,lat,lon]=64.0f;d3_19[time,lat,lon]=64.0f;d3_20[time,lat,lon]=64.0f;d3_21[time,lat,lon]=64.0f;d3_22[time,lat,lon]=64.0f;d3_23[time,lat,lon]=64.0f;d3_24[time,lat,lon]=64.0f;d3_25[time,lat,lon]=64.0f;d3_26[time,lat,lon]=64.0f;d3_27[time,lat,lon]=64.0f;d3_28[time,lat,lon]=64.0f;d3_29[time,lat,lon]=64.0f;d3_30[time,lat,lon]=64.0f;d3_31[time,lat,lon]=64.0f;d3_32[time,lat,lon]=64.0f;d3_33[time,lat,lon]=64.0f;d3_34[time,lat,lon]=64.0f;d3_35[time,lat,lon]=64.0f;d3_36[time,lat,lon]=64.0f;d3_37[time,lat,lon]=64.0f;d3_38[time,lat,lon]=64.0f;d3_39[time,lat,lon]=64.0f;d3_40[time,lat,lon]=64.0f;d3_41[time,lat,lon]=64.0f;d3_42[time,lat,lon]=64.0f;d3_43[time,lat,lon]=64.0f;d3_44[time,lat,lon]=64.0f;d3_45[time,lat,lon]=64.0f;d3_46[time,lat,lon]=64.0f;d3_47[time,lat,lon]=64.0f;d3_48[time,lat,lon]=64.0f;d3_49[time,lat,lon]=64.0f;d3_50[time,lat,lon]=64.0f;d3_51[time,lat,lon]=64.0f;d3_52[time,lat,lon]=64.0f;d3_53[time,lat,lon]=64.0f;d3_54[time,lat,lon]=64.0f;d3_55[time,lat,lon]=64.0f;d3_56[time,lat,lon]=64.0f;d3_57[time,lat,lon]=64.0f;d3_58[time,lat,lon]=64.0f;d3_59[time,lat,lon]=64.0f;d3_60[time,lat,lon]=64.0f;d3_61[time,lat,lon]=64.0f;d3_62[time,lat,lon]=64.0f;d3_63[time,lat,lon]=64.0f;d4_00[time,lev,lat,lon]=1.1f;d4_01[time,lev,lat,lon]=1.2f;d4_02[time,lev,lat,lon]=1.3f;d4_03[time,lev,lat,lon]=1.4f;d4_04[time,lev,lat,lon]=1.5f;d4_05[time,lev,lat,lon]=1.6f;d4_06[time,lev,lat,lon]=1.7f;d4_07[time,lev,lat,lon]=1.8f;d4_08[time,lev,lat,lon]=1.9f;d4_09[time,lev,lat,lon]=1.11f;d4_10[time,lev,lat,lon]=1.12f;d4_11[time,lev,lat,lon]=1.13f;d4_12[time,lev,lat,lon]=1.14f;d4_13[time,lev,lat,lon]=1.15f;d4_14[time,lev,lat,lon]=1.16f;d4_15[time,lev,lat,lon]=1.17f;d4_16[time,lev,lat,lon]=1.18f;d4_17[time,lev,lat,lon]=1.19f;d4_18[time,lev,lat,lon]=1.21f;d4_19[time,lev,lat,lon]=1.22f;d4_20[time,lev,lat,lon]=1.23f;d4_21[time,lev,lat,lon]=1.24f;d4_22[time,lev,lat,lon]=1.25f;d4_23[time,lev,lat,lon]=1.26f;d4_24[time,lev,lat,lon]=1.27f;d4_25[time,lev,lat,lon]=1.28f;d4_26[time,lev,lat,lon]=1.29f;d4_27[time,lev,lat,lon]=1.312f;d4_28[time,lev,lat,lon]=1.322f;d4_29[time,lev,lat,lon]=1.332f;d4_30[time,lev,lat,lon]=1.342f;d4_31[time,lev,lat,lon]=1.352f;\'"; $fl_mtd_sct[$idx_tms_lng][0] = "Long timeseries"; # option descriptor $fl_mtd_sct[$idx_tms_lng][1] = "~52MB"; # file size $fl_mtd_sct[$idx_tms_lng][2] = $fl_tmg[$idx_tms_lng][0] = "tms_lng"; # file name root $fl_mtd_sct[$idx_tms_lng][3] = "\'time[time]=1.0f;hmdty[time]=98.3f;PO2[time]=18.7f;PCO2[time]=1.92f;PN2[time]=77.4f;w_vel[time]=14.8f;w_dir[time]=321.3f;temp[time]=23.5f;lmbda_260[time]=684.2f\'"; return @fl_tmg; }; # end of fl_mtd_ntl() sub fl_mk { # Purpose: Create files from CDL templates and populate them for benchmarks # Must be called after fl_mtd_ntl() my $idx = shift; my $fl_nbr = 3; $pfx_cmd = "$MY_BIN_DIR"; if ($dbg_lvl > 2) { print "\nWaiting for keypress to proceed.\n"; my $tmp = ; } my $t0; my $elapsed; my $fl_in = my $fl_out = "$drc_dat/$fl_mtd_sct[$idx][2].nc" ; $bm_drc = "../bm"; print "==== Creating $fl_mtd_sct[$idx][0] data file from template in [$bm_drc]\n"; print "Executing: $tmr_app ncgen -b -o $fl_out $bm_drc/$fl_mtd_sct[$idx][2].cdl\n"; if ($hiresfound) {$t0 = [gettimeofday()];} else {$t0 = time;} # File creation now timed system "$tmr_app ncgen -b -o $fl_out $bm_drc/$fl_mtd_sct[$idx][2].cdl"; if ($hiresfound) {$elapsed = tv_interval($t0, [gettimeofday()]);} else {$elapsed = time - $t0;} # log it to common timing array $fl_tmg[$idx][0] = "$fl_mtd_sct[$idx][2]"; # name root $fl_tmg[$idx][1] = $elapsed; # creation time if ($idx == 2) { # tms_lng needs extra massaging # tms_lng ready for ncap'ing if ($dbg_lvl > 0) {print "extra steps for tms_lng - ncecat...\n";} system "$pfx_cmd/ncecat -O -h $fl_in $fl_out"; # inserts a record dimension if ($dbg_lvl > 0) {print "ncpdq...\n";} system "$pfx_cmd/ncpdq -O -h -a time,record $fl_in $fl_out"; # swaps time and 'record' if ($dbg_lvl > 0) {print "ncwa...\n";} system "$pfx_cmd/ncwa -O -h -a record $fl_in $fl_out"; # averages 'record' } print "\n==== Populating $fl_out file.\nTiming results:\n"; if ($hiresfound) {$t0 = [gettimeofday()];} else {$t0 = time;} # csz 20061024: Changed ncap to ncap2 with no speed penalty (double-parsing works) print "Executing: $tmr_app $pfx_cmd_crr/ncap2 -h -O $nco_D_flg -s $fl_mtd_sct[$idx][3] $fl_in $fl_out\n"; system "$tmr_app $pfx_cmd_crr/ncap2 -O -h -s $fl_mtd_sct[$idx][3] $fl_in $fl_out"; if ($hiresfound) {$elapsed = tv_interval($t0, [gettimeofday()]);} else {$elapsed = time - $t0;} $fl_tmg[$idx][2] = $elapsed; # population time print "==========================\nEnd of $fl_mtd_sct[$idx][2] section\n==========================\n"; return @fl_tmg; } # end sub fl_mk # Summarize timing results of file creation tests sub rsl_smr_fl_mk { $fl_nbr = 3; # print " in rsl_smr_fl_mk, \$fl_tmg[1][0] = $fl_tmg[1][0] & \$fl_nbr = $fl_nbr\n"; if ($dbg_lvl > 0){print "Summarizing results of file creation\n";} my $CC = `../src/nco/ncks --compiler`; my $CCinfo = ''; if ($CC =~ /gcc/) {$CCinfo = `gcc --version |grep -i gcc`;} elsif ($CC =~ /xlc/) {$CCinfo = "xlc version ??";} elsif ($CC =~ /icc/) {$CCinfo = "Intel C Compiler version ??";} my $reportstr = ''; my $idstring = `uname -a` . "using: " . $CCinfo; chomp $idstring; my $udp_dat = "File Creation | $timestamp | $idstring | "; $reportstr .= "NCO File Creation Test Result Summary: [$timestamp]\n$idstring\n"; $reportstr .= " Test Total Wallclock Time (s) \n"; $reportstr .= "=====================================================\n"; for (my $fl_idx=0; $fl_idx<$fl_nbr; $fl_idx++) { $reportstr .= sprintf "Creating %15s: %6.4f \n", $fl_tmg[$fl_idx][0], $fl_tmg[$fl_idx][1]; $reportstr .= sprintf "Populating %15s: %6.4f \n", $fl_tmg[$fl_idx][0], $fl_tmg[$fl_idx][2]; $udp_dat .= sprintf "%s : %6.4f : %6.4f",$fl_tmg[$fl_idx][0], $fl_tmg[$fl_idx][1], $fl_tmg[$fl_idx][2]; } $reportstr .= sprintf "\n\n"; print $reportstr; if ($udp_rpt) { $sock->send($udp_dat); if ($dbg_lvl > 0) { print "File Creation: udp stream sent to $server_ip:\n$udp_dat\n";} } # and send it back separately } # end of rsl_smr_fl_mk # drc_dat_set(): figures out where to write data sub drc_dat_set{ $caseid = shift; my $tmp; my $umask = umask; # Does user have $DATA defined in his environment? # Bail with nasty message if it is not readable and writable # if ($caseid ne "") { # $caseid =~ s/[^\w]/_/g; # } if (defined $ENV{'DATA'} && $ENV{'DATA'} ne "") { # then is it readwritable? if (-w $ENV{'DATA'} && -r $ENV{'DATA'}) { if ($que == 0) {print "INFO: Using your environment variable DATA \n\t [$ENV{'DATA'}]\n\t as the root DATA directory for this series of tests.\n";} if ($caseid ne "") { $drc_dat = "$ENV{'DATA'}/nco_bm/$caseid"; my $err = `mkdir -p -m0777 $drc_dat`; if ($err ne "") {die "mkdir err: $drc_dat\n";} } else { # just dump it into nco_bm $drc_dat = "$ENV{'DATA'}/nco_bm"; my $err = `mkdir -p -m0777 $drc_dat`; if ($err ne "") {die "mkdir err: $drc_dat\n";} } } else { die "You have defined a DATA directory ($ENV{'DATA'}) that cannot be written to or read\nfrom or both - please try again.\n stopped"; } } elsif ($que == 0) { $tmp = 'notset'; print "You do not have a \$DATA directory defined and the test files are several GB. \nWhere would you like to write the test data? Data will be placed in the indicated directory,\nunder nco_bm, using the '--caseid' option to set the name of the subdirectory, if any. \n[$ENV{'HOME'}] or specify: "; $tmp = ; chomp $tmp; print "You entered [$tmp] \n"; if ($tmp eq '') { $drc_dat = "$ENV{'HOME'}/nco_bm/$caseid"; # if $caseid not set, then it decays to $ENV{'HOME'}/nco_bm/ if (-e "$drc_dat") { print "$drc_dat already exists - OK to re-use?\n[N/y] "; $tmp = ; chomp $tmp; if ($tmp =~ "[nN]" || $tmp eq '') { die "\nFine - decide what to use and start over again - bye! stopped"; } else { print "\n"; } } else { # have to make it print "Making $drc_dat & continuing\n"; my $err = `mkdir -p -m0777 $drc_dat`; if ($err ne "") {die "mkdir err: $drc_dat\n";} } } else { $drc_dat = "$tmp/nco_bm/$caseid"; # and now test it if (-w $drc_dat && -r $drc_dat) { print "OK - we will use [$drc_dat] to write to.\n\n"; } else { # must make it print "[$drc_dat] doesn't exist - will try to make it.\n"; my $err = `mkdir -p -m0777 $drc_dat`; if ($err ne "") {die "mkdir err: $drc_dat\n";} if (-w $drc_dat && -r $drc_dat) { print "OK - [$drc_dat] is available to write to\n"; } else { die "ERROR - [$drc_dat] could not be made - check this and try again.\n stopped";} } } } else { # que != 0 die "You MUST define a DATA environment variable to run this in a queue\n stopped"; } # !defined $ENV{'DATA'}) } # end drc_dat_set() ######################### subroutine tst_run () ############################## # tst_run() consumes @tst_cmd array and executes them in order ################################################################################# sub tst_run { my %fl_nm_lcl = ( # fl_nm_lcl = local_file_name '%stdouterr%' => "", # stdouterr has to be left to generate stderr '%tmp_fl_00%' => "$drc_dat/tmp_fl_00.nc", # Default replacement for $fl_out '%tmp_fl_01%' => "$drc_dat/tmp_fl_01.nc", '%tmp_fl_02%' => "$drc_dat/tmp_fl_02.nc", '%tmp_fl_03%' => "$drc_dat/tmp_fl_03.nc", '%tmp_fl_04%' => "$drc_dat/tmp_fl_04.nc", '%tmp_fl_05%' => "$drc_dat/tmp_fl_05.nc", # Currently no use for more than 05 '%tmp_fl_06%' => "$drc_dat/tmp_fl_06.nc", '%tmp_fl_07%' => "$drc_dat/tmp_fl_07.nc", '%tmp_fl_08%' => "$drc_dat/tmp_fl_08.nc", '%tmp_fl_09%' => "$drc_dat/tmp_fl_09.nc", '%tmp_fl_10%' => "$drc_dat/tmp_fl_10.nc", '%tmp_fl_11%' => "$drc_dat/tmp_fl_11.nc", '%tmp_fl_12%' => "$drc_dat/tmp_fl_12.nc", ); # If executign on client side, replace special purpose # filenames with names like $fl_nm_lcl{'%tmp_fl_00%'} # fxm: WTF do these vars require this treatment?!?? *dbg_lvl = *main::dbg_lvl; *fl_out = *main::fl_out; *mpi_prc = *main::mpi_prc; if($dbg_lvl > 0){ print "\n\n\n### New tst_run() cycle [$opr_nm: $dsc_sng] ###\n"; if($fl_nm_lcl{'%tmp_fl_00%'} eq ""){ print "fl_out undefined!\n"; } # else { print "\$fl_nm_lcl{'%tmp_fl_00%'} = [$fl_nm_lcl{'%tmp_fl_00%'}] \n";} } # tst_run() requires that regression tests provide expected values # If last element is not SS_OK, tst_run() pops off expected value and # processes commands same as it did previously my $arr_ref = shift; # Pass benchmark()'s @tst_cmd via reference to maintain coherence my @cmd_lst= @$arr_ref; # Dereference to new array name # Clear variables my $ssdwrap_cmd = $dbg_sng = $err_sng = $pfx_mpi = $pfx_fk = ""; my $cmd_rsl_is_nbr = 1; my $xpc_is_nbr = 1; # for extra return value checks # Twiddle $pfx_cmd to allow running mpnc* as non-MPI'd executable if ($mpi_fk) {$pfx_fk = "$MY_BIN_DIR/mp"; } $pfx_cmd = "$MY_BIN_DIR/"; # $pfx_mpi always has mpirun directive # AIX can run naked command as long as environment has been set up # NB: This is for regression testing on interactive node, # not for benchmarking under POE - intercepted and handled at startup # on AIX, non-MPI ops compiled with MPI will atttempt to run MP_PROCS. # To hold them to one process, must add explicit prefix ($aix_mpi_sgl_nvr), added below my $aix = 0; if ($os_nm =~ /AIX/) {$aix = 1;} # yafv for aix if($aix){$pfx_mpi=" $aix_mpi_nvr_pfx $MY_BIN_DIR/mp";} elsif($mpi_upx eq "") { # Assume Linux-like MPI $pfx_mpi = "mpirun -np $mpi_prc $MY_BIN_DIR/mp"; }else{ $pfx_mpi = " ". $mpi_upx . " $MY_BIN_DIR/mp"; } # use user-supplied prefix $pfxd = 1; $timed = 1; my $pwd=`pwd`; chomp $pwd; dbg_msg(1,"\$pwd=$pwd | \$pfx_cmd=$pfx_cmd | \$pfx_mpi=$pfx_mpi | \$pfx_fk=$pfx_fk"); # Delete everything in DAP subdir to force DAP retrieval # $drc_dat has by now been directed to $drc_dat/DAP_DIR # print "DEBUG[tst_run]:\$dodap = [$dodap], \$prsrv_fl = [$prsrv_fl]\n"; if ($dodap ne "FALSE" && !$prsrv_fl) { print "\nWARN: about to unlink everything in $drc_dat ! Continue? [Ny]\n"; my $wait = ; if ($wait !~ /[Yy]/){ die "Make sure of the commandline options!\n";} my $unlink_cnt = unlink <$drc_dat/*>; print "\nINFO: OK - unlinked $unlink_cnt files\n"; } # print "just past unlinking stage \n"; my $wait = ; if($dbg_lvl > 0){ for(my $cmd_idx=0; $cmd_idx <= $#cmd_lst; $cmd_idx++) {print "### cmd_lst[$cmd_idx] = $cmd_lst[$cmd_idx] ###\n";} } # Perform tests of requested operator; default is all if (!defined $tst_nbr{$opr_nm}) { #print "DEBUG: \$tst_nbr{\$opr_nm} not defined - going to exit!\n"; @cmd_lst=(); # Clear test array # and init the timing hashes $real_tme{$opr_nm}=0; $usr_tme{$opr_nm}=0; $sys_tme{$opr_nm}=0; return; }else{ #print "\$tst_nbr{\$opr_nm} = $tst_nbr{$opr_nm}\n"; } # print "DEBUG: for $opr_nm, \$tst_nbr{\$opr_nm} = $tst_nbr{$opr_nm}\n"; $subbenchmarks{$opr_nm} = 0; $tst_nbr{$opr_nm}++; my $cmd_lst_cnt = 0; my $t = 0; my $lst_cmd = @cmd_lst; my $elapsed; $lst_cmd--; dbg_msg(4,"\n nsr_xpc = $nsr_xpc\n dbg_lvl = $dbg_lvl\n wnt_log = $wnt_log\n cmd_lst = @cmd_lst"); &bm_vrb($dbg_lvl, $wnt_log, "\n\n============ New Test ==================\n"); # csz++ $dot_nbr_min=3; # Minimum number of dots between description and "ok" result $dot_sng='.....................................................................'; $dsc_lng_max=80; # Maximum length of description printed $opr_lng_max=7; # Maximum length of operator name $spc_nbr_min=1; # Minimum number of spaces between test ID and description $spc_sng=' '; $dot_nbr=$dot_nbr_min; # Number of dots printed $spc_nbr=$spc_nbr_min; # Number of spaces printed $opr_fmt=sprintf("%%.%ds",$opr_lng_max); if($opr_lng_max-length($opr_nm)>0){$spc_nbr+=$opr_lng_max-length($opr_nm);} $spc_fmt=sprintf("%%.%ds",$spc_nbr); $tst_id_sng=sprintf("$opr_fmt$spc_fmt",$opr_nm,$spc_sng).sprintf("test %02d: ",$tst_nbr{$opr_nm}); if($dsc_lng_max-length($dsc_sng)>0){$dot_nbr+=$dsc_lng_max-length($dsc_sng);} $dsc_fmt=sprintf('%%.%ds',$dsc_lng_max); $dot_fmt=sprintf("%%.%ds",$dot_nbr); $tst_fmt="$tst_id_sng$dsc_fmt$dot_fmt"; printf STDERR ($tst_fmt,$dsc_sng,$dot_sng); # csz-- # SS checks and balances # $ncks_chk = SS_gnarly_pything(\@cmd_lst) my $SS_nsr_xpc = 0; my $SS_OK = 1; if ($cmd_lst[$#cmd_lst] ne "SS_OK") {$SS_OK = 0;} # check on last el whether cmds can be SS'ed if ($SS_OK && $srv_sd ne "SSNOTSET" ) { SS_prepare(); # make sure things are init'ed # Send for processing and get back string or single value to check $SS_nsr_xpc=SS_gnarly_pything(\@cmd_lst); $cmd_rsl=$SS_nsr_xpc; # do this in one step later # and undef the last one to leave the expected value as last value delete $cmd_lst[$#cmd_lst]; $nsr_xpc=$cmd_lst[$#cmd_lst]; # pop last value to provide exepected answer # print "\n##DEBUG:\t$nsr_xpc (expt)\n\t\t$cmd_rsl (SS)\n"; } else { # delete SS value to leave "expected value" as last delete $cmd_lst[$#cmd_lst]; # regardless, pop the next value off to provide the 'expected value' $nsr_xpc = $cmd_lst[$#cmd_lst]; # pop the next value off \ delete $cmd_lst[$#cmd_lst]; # and now the $cmd_lst is the same as it ever was.. #print "\nDEBUG:in tst_run:613, \$mpi_prc=[$mpi_prc] \$pfx_mpi=[$pfx_mpi] \$mpi_fk=[$mpi_fk]\n"; foreach (@cmd_lst){ # print "\nforeach cmd_lst = $_\n"; my $md5_chk = 1; $dbg_sng .= "\nDEBUG: Full commandline for part $cmd_lst_cnt:\n"; if ($_ !~ /foo.nc/) {$md5_chk = 0;} my $opcnt = 0; my $md5_dsc_sng = $dsc_sng . "_$cmd_lst_cnt"; # Substitute real for fake file names (%*%) my $r = 0; my $N = my @L = split; while ($r <= $N) { if ($L[$r] =~ /\%.{8,9}\%/){ $L[$r] = $fl_nm_lcl{$L[$r]};} $r++; } $_ = ""; # zero and then reconstitute $_ for ($r=0; $r<= $N; $r++) {$_ .= $L[$r] . " ";} #print "DEBUG: reconstituted \$_ = $_\n"; # Add $pfx_cmd only to NCO operator commands, not things like 'cut'. foreach my $op (@opr_lst_all) { $pfx_cmd_crr=$pfx_cmd; if ($op eq 'ncap2'){ # 20100915 Hack fix for ncap2 with Chad if (defined $ENV{'MY_BIN_DIR'} && $ENV{'MY_BIN_DIR'} ne ""){ # $pfx_cmd_crr=$ENV{'MY_BIN_DIR'}; $pfx_cmd_crr=$MY_BIN_DIR.'/'; # $pfx_cmd_crr=$pfx_cmd; }else{ $pfx_cmd_crr='../src/nco++'.'/'; # $pfx_cmd_crr=$pfx_cmd; } } # endif ncap2 if ($_ =~ m/$op/ ) { # If op is anywhere in main list if ($mpi_prc > 0 && $opr_sng_mpi =~ /$op/) { $_ = $tmr_app . $pfx_mpi . $_; } # ...and in MPI list... elsif ($mpi_fk && $opr_sng_mpi =~ /$op/) { $_ = $tmr_app . $pfx_fk . $_; } # Fake prefix # Non-MPI applications compiled w/MPI need special prefix to hold them to single process elsif ($aix) {$_ = $tmr_app . $aix_mpi_sgl_nvr_pfx . $pfx_cmd_crr . $_;} else {$_ = $tmr_app . $pfx_cmd_crr . $_; } # Standard prefix dbg_msg(1, "URGENT:before execution, cmd_ln= $_ \n"); last; } } # end of foreach my $op (@opr_lst_all) $dbg_sng .= "DEBUG:$_\n"; # NB: May require ONLY HiRes timing since SERVERSIDE will be hard to do otherwise # timing code using Time::HiRes my $t0; if($hiresfound) {$t0 = [gettimeofday()];} else{$t0 = time;} # Execute command, split off stderr to file 'nco_bm.stderr' $cmd_rsl = `($_) 2> nco_bm.stderr`; # stderr contains timing info, if any # print "\nDEBUG: cmd = $_ \n and \$cmd_rsl = $cmd_rsl\n "; if ($dbg_lvl >= 1) {print "\nDEBUG: result of [$_]\n = [$cmd_rsl]\n";} chomp $cmd_rsl; # # still newlines in $cmd_rsl? -> a multiline result & only want the last one. # if ($cmd_rsl =~/\n/) { # my @rsl_arr = split(/\n/, $cmd_rsl); # $cmd_rsl = $rsl_arr[$#rsl_arr]; # take the last line # if ($dbg_lvl >= 1) {print "\nprocessed multiline \$cmd_rsl = [$cmd_rsl]\n";} # } # # figure out if $cmd_rsl is numeric or alpha # if ($cmd_rsl =~ /-{0,1}\d{0,9}\.{0,1}\d{0,9}/ && # $cmd_rsl !~ /[a-df-zA-DF-Z ,]/) { $cmd_rsl_is_nbr = 1;} # else { #print "DEBUG: \$cmd_rsl is not numeric: $cmd_rsl \n"; # $cmd_rsl_is_nbr = 0; # } # # figure out if $nsr_xpc is numeric or alpha # if ($nsr_xpc =~ /-{0,1}\d{0,9}\.{0,1}\d{0,9}/ && # $nsr_xpc !~ /[a-df-zA-DF-Z ,]/) { $xpc_is_nbr = 1;} # else { #print "DEBUG: \$nsr_xpc is not numeric: $nsr_xpc \n"; # $xpc_is_nbr = 0; # } if ($timed) { $sys_time = `cat nco_bm.stderr`; if ($sys_time ne "") { if ($sys_time =~ /ERR/ ) {last;} $sys_time =~ s/\n/ /g; # print "\$sys_time = [$sys_time]\n"; @sys_tim_arr = split(" ", $sys_time); # [0]real [1]0.00 [2]user [3]0.00 [4]sys [5]0.00 my @rev_sys_tim_arr = reverse @sys_tim_arr; # print"\@revsys_tim_arr = @rev_sys_tim_arr\n"; # this will fail if an error occurs which offsets the time info, so you have to step thru the list until hit 'real' which syncs the array. or do it from the back end. $real_tme{$opr_nm} += $rev_sys_tim_arr[0] + 0; # '+0 forces conversion to a nbr $usr_tme{$opr_nm} += $rev_sys_tim_arr[2] + 0; $sys_tme{$opr_nm} += $rev_sys_tim_arr[4] + 0; } } if($hiresfound) {$elapsed = tv_interval($t0, [gettimeofday()]);} else{$elapsed = time - $t0;} #print "inter benchmark for $opr_nm = $subbenchmarks{$opr_nm} \n"; $subbenchmarks{$opr_nm} += $elapsed; # $tst_idx = $tst_nbr{$opr_nm}-1; if($dbg_lvl > 3){print "\t$opr_nm subtest [$t] took $elapsed seconds\n";} $dbg_sng .= "DEBUG: Result = [$cmd_rsl]\n"; #and here, check results by md5 checksum for each step - insert guts of rsl_chk_MD5_wc() # have to mod the input string - suffix with the cycle# # follow check only if the MD5 module is present, there's a foo.nc to check ($fl_nm_lcl{'%tmp_fl_00%'} = 'foo.nc') # & non-terminal cmd (the terminal command is ncks which is expected to return a single value or string) # dbg_msg(3,"rsl_chk_MD5_wc(): \$md5 = $md5, \$md5_chk = $md5_chk, \$cmd_lst_cnt ($cmd_lst_cnt) < \$lst_cmd ($lst_cmd)"); # if ($md5 && $md5_chk && $cmd_lst_cnt < $lst_cmd) { # dbg_msg(2,"Entering rsl_chk_MD5_wc() with \$fl_nm_lcl{'%tmp_fl_00%'}=$fl_nm_lcl{'%tmp_fl_00%'}"); # rsl_chk_MD5_wc($fl_nm_lcl{'%tmp_fl_00%'}, $md5_dsc_sng); # } # if ($md5_chk == 0 && $dbg_lvl > 0) { $dbg_sng .= "WARN: No MD5/wc check on intermediate file.\n";} # else old-style check has already been done and results are in $cmd_rsl, so process normally $cmd_lst_cnt++; if ($dbg_lvl > 2) { print "\ntst_run: test cycle held - hit to continue\n"; # my $wait = ; } } # end loop: foreach (@cmd_lst) } # end of client side 'else' $dbg_sng.="DEBUG: Total time for $opr_nm [$tst_nbr{$opr_nm}] = $subbenchmarks{$opr_nm} s\n"; $totbenchmarks{$opr_nm}+=$subbenchmarks{$opr_nm}; # Results comparison should not be necessary to validate whole file, # not just a single value. # chomp $cmd_rsl; # Remove trailing newline for easier regex comparison # Still newlines in $cmd_rsl? -> a multiline result & only want the last one. if($cmd_rsl =~/\n/){ my @rsl_arr = split(/\n/, $cmd_rsl); $cmd_rsl = $rsl_arr[$#rsl_arr]; # take the last line if($dbg_lvl >= 1){print "\nprocessed multiline \$cmd_rsl = [$cmd_rsl]\n";} } # Is $cmd_rsl numeric or alpha? if($cmd_rsl =~ /-{0,1}\d{0,9}\.{0,1}\d{0,9}/ && $cmd_rsl !~ /[a-df-zA-DF-Z ,]/) { $cmd_rsl_is_nbr = 1;} else{ #print "DEBUG: \$cmd_rsl is not numeric: $cmd_rsl \n"; $cmd_rsl_is_nbr = 0; } # Is $nsr_xpc numeric or alpha? if($nsr_xpc =~ /-{0,1}\d{0,9}\.{0,1}\d{0,9}/ && $nsr_xpc !~ /[a-df-zA-DF-Z ,]/) { $xpc_is_nbr = 1;} else{ #print "DEBUG: \$nsr_xpc is not numeric: $nsr_xpc \n"; $xpc_is_nbr = 0; } # Compare numeric results if($cmd_rsl_is_nbr && $xpc_is_nbr && length($cmd_rsl)>0){ # && it equals the expected value #print "\n \$nsr_xpc [$nsr_xpc] considered a number\n"; $dbg_sng.="DEBUG: \$nsr_xpc assumed to be numeric: $nsr_xpc & actual \$cmd_rsl = [$cmd_rsl]\n"; if($nsr_xpc == $cmd_rsl){ $success{$opr_nm}++; printf STDERR (" SVn ok\n"); $dbg_sng .= "DEBUG: PASSED (Numeric output)\n"; }elsif(abs($cmd_rsl - $nsr_xpc) < 0.02){ $success{$opr_nm}++; printf STDERR (" SVn prov. ok\n"); $dbg_sng .= "DEBUG: PASSED PROVISIONALLY (Numeric output):[$nsr_xpc vs $cmd_rsl]\n"; }else{ printf STDERR (" FAILED!\n"); &failed($nsr_xpc); my $diff = abs($nsr_xpc - $cmd_rsl); $dbg_sng .= "DEBUG: !!FAILED (Numeric output) [expected: $nsr_xpc vs result: $cmd_rsl]. Difference = $diff.\n"; } }elsif(!$cmd_rsl_is_nbr && !$xpc_is_nbr && length($cmd_rsl)>0){# Compare non-numeric tests dbg_msg(2,"DEBUG: expected value assumed to be alphabetic: $nsr_xpc\n\$cmd_rsl = $cmd_rsl\n"); #print "\n \$nsr_xpc [$nsr_xpc] considered a string\n"; # Compare $cmd_rsl with $nsr_xpc # if ($cmd_rsl =~ $nsr_xpc) { if(substr($cmd_rsl,0,length($nsr_xpc)) eq $nsr_xpc){ $success{$opr_nm}++; printf STDERR (" SVa ok\n"); $dbg_sng .= "DEBUG: PASSED Alphabetic output"; }else{ &failed($nsr_xpc); $dbg_sng .= "DEBUG: !!FAILED Alphabetic output (expected: $nsr_xpc vs result: $cmd_rsl) "; } }else{ # No result at all? print STDERR " !!FAILED\n \$cmd_rsl_is_nbr = $cmd_rsl_is_nbr and \$xpc_is_nbr = $xpc_is_nbr\n"; &failed(); $dbg_sng .= "DEBUG: !!FAILED - No result from [$opr_nm]\n"; } print $err_sng; if($dbg_lvl > 0){print $dbg_sng;} if($wnt_log){print LOG $dbg_sng;} @cmd_lst=(); # Clear test if(!$bm){$prsrv_fl = 0;} # reset so files will be deleted unless doing benchmarks if(-e $fl_nm_lcl{'%tmp_fl_00%'} && -w $fl_nm_lcl{'%tmp_fl_00%'}){unlink $fl_nm_lcl{'%tmp_fl_00%'};} } # end tst_run() #################### # %SSD : a hash/dict that contains (configurable) settings for server-side dap. # %SSD is used as a namespace in lieu of a package namespace. Quick measurements # of accessing by hash show a 2x exec time increase--> # 2 normal var access = 1 hash access, which is small (compare to C/C++ 100x? diff) our %SSD; # Initialize ssd variables. sub SS_init { # no params for SS_init now. use File::Spec; $SSD{"url"} = "http://dust.ess.uci.edu/cgi-bin/dods/nph-dods"; $SSD{"inpathfrom"} = "../data"; # inpathfrom ($in_pth) needs to match $in_pth in NCO_rgr.pm # and NCO_benchmarks.pm $SSD{"inpathto"} = "dodsdata"; # inpathto needs to match the server's path to benchmarking data # temp-script filename -- probably want to munge to prevent conflict $SSD{"tfname"} = File::Spec->catfile(".", "nco_rgr_tmp_4scriptwrap"); # path to scriptwrap.py (or equivalent) $SSD{"scrwrp_pth"} = File::Spec->catfile('..','src','ssdap','scriptwrap.py'); # remember that we got initialized $SSD{"initialized"} = 1; # now do a quick sanity check. if (my $errorstring = SS_sanity_check()) { die "SS sanity check failed.: \n$errorstring\n" ; } } # if SS_OK && the user requests a SS attempt .. # this needs to be functionized to: # - breathe in the cmd_lst, # - replace the fl_out with the %tmp_flile% params (most '$fl_out's -> '%temp_00%' # - change the in_pth arg to look for files in the dodsdata dir (replace -p xxx to -p dodsdata) # - write that block to disk, # - execute the scriptwrap cmd and breathe back in the returned value, currently just the ncks single value # $ncks_chk = SS_gnarly_thing(\@cmd_lst); sub SS_gnarly_pything { my $arr_ref = shift; # now passing in tst_run()'s cmd_lst via a ref to maintain NS separation my $tfname = $SSD{"tfname"}; SS_make_script($tfname, $arr_ref); #print "TF should be done - waiting for action\n"; #my $wait = ;#my $wait = ; # print "\n##SS cmd: $MY_BIN_DIR/scriptwrap.py $tfname $SS_URL\nand waiting for key to tst_run"; my $wait = ; # and finally EXECUTE it # FXM/FIXME : for now, look for scriptwrap.py in src/ssdap dir. my $xpct_val = SS_send_script($tfname, $SSD{"url"}); # and now (unfortunately), write it to disk and then execute the scriptwrap.py to get a value. #unlink "nco_rgr_tmp_4scriptwrap" or die "Can't unlink the temp file: 'nco_rgr_tmp_4scriptwrap'\n"; #print "returned value = $xpct_val \n"; #my $wait = ; return $xpct_val; } # $ncks_chk = SS_gnarly_thing($tfname, \@cmd_lst); sub SS_make_script { my $tfname = shift; # file to write script to. my $arr_ref = shift; # now passing in tst_run()'s cmd_lst via a ref to maintain NS separation my @sscmd_lst= @$arr_ref; # deref the ref to a new array name my $in_pth = $SSD{"inpathfrom"}; my $dodsdata = $SSD{"inpathto"}; # Write out array replacing each $fl_out with the %temp% spec # First command must specify starting datadir, but client may not know it, # so substitute any '-p URL' with '-p %datadir%' which may be escaped at # some level. # Further commands act on %fl_out%, so no '-p' substitution is necessary # Assume that '-p URL' is in first command, but check all commands for '-p' # because of mixed programming model, # Simplest to write to disk and send via pything. # File name can be re-useable: 'nco_regr_temp_4scriptwrap' # NB: Chew off extra bits before processing actual scripts # i.e., as above, ignore last two entries (return value and SS_OK status) # print "MY_BIN_DIR = $MY_BIN_DIR\n"; # print "DATA_DIR = $drc_dat\n"; my $lst_scrt_idx = $#sscmd_lst - 2; # last script index that has content to be sent to the server. local *TF; open(TF, "> $tfname") or die "\nUnable to open temp file '$tfname'.\n"; my $r = 0; my $sscl = ""; # 'server side cmd line' holds the SS version of the individual command lines while ($r <= $lst_scrt_idx) { #print "before chang'g line [$r]:\n$sscmd_lst[$r] \n"; my $skip = 0; local $_; foreach (split (/\s+/, $sscmd_lst[$r])) { if ($skip == 1) { $skip = 0; } elsif (/^\Q$in_pth/) { # this should be more robust s/\Q$in_pth/$dodsdata/; # substitute $in_pth with $dodsdata $sscl .= $_ . " "; } elsif ( /^\-\-mmr_cln/ ) { #don't pass --mmr_cln option to server # until server can gracefully drop this. } else { $sscl .= $_ . " ";} # copy each term over to ss cl } if ($r == $lst_scrt_idx && $sscmd_lst[$r] =~ /ncks/) { $sscl .= " %stdouterr% "; # SS needs this as the final term to return a value. } #print " cmd_ln [$r] munged for SS:\n$sscl \n"; #my $wait = ; # and write it to the temp files print TF "$sscl\n"; $r++; $sscl = ""; } close TF; #print `cat $tfname`; # for debugging. } # SS_send_script($filename, $url) sub SS_send_script { my $fname = shift; my $url = shift; my $scrwrp_pth = $SSD{"scrwrp_pth"}; my $xpct_val = `$scrwrp_pth $fname $url`; return $xpct_val; } # SS_sanity_check() returns an error string on failure; nothing if things are okay. # example: #if (my $errorstring = SS_sanity_check()) { # die "SS sanity check failed.: \n$errorstring\n" ; #} sub SS_sanity_check { local *F; my $fname = $SSD{"tfname"}; open(F, ">$fname") || return "Can't open $fname for writing script file."; print F "ncks --version %stdouterr%\n"; close(F); my $versionblock = SS_send_script($fname, $SSD{"url"}); if ($versionblock =~ m/ncks version/) { return ;} else { return $versionblock; } return "Unhandled code path"; } # call if we haven't been initialized. sub SS_prepare { SS_init() unless $SSD{"initialized"}; } #################### sub failed { $failure{$opr_nm}++; $err_sng .= " ERR: FAILED in $opr_nm test: $dsc_sng\n"; foreach(@cmd_lst) { $err_sng .= " $_\n";} $err_sng .= " ERR::EXPLAIN: Result: [$cmd_rsl] != Expected: [$nsr_xpc]\n\n" ; return; } sub rsl_smr_rgr { my $ansr=''; my $nco_vrs_sng = vrs_sng_get(); my $CC = `$MY_BIN_DIR/ncks --compiler`; my $idstring = ""; my $CCinfo = ''; if ($CC =~ /gcc/) {$CCinfo = `gcc --version |grep -i gcc`;} elsif ($CC =~ /xlc/) {$CCinfo = "xlc version ??";} elsif ($CC =~ /icc/) { my $icc_ver = `icc --version`; chomp $icc_ver; $CCinfo = "Intel C Compiler version $icc_ver"; } chomp $CCinfo; my $idstring = `uname -a`; chomp($idstring); my $reportstr = "\n\n" . $idstring . "; " . $CCinfo . "; " . $timestamp . "\n"; $reportstr .= "\n Test Results Seconds to complete\n"; $reportstr .= " -------------------------- ----------------------------------------\n"; $reportstr .= " Test Success Failure Total WallClock Real User System Diff"; # csz++ # *thr_nbr=*main::thr_nbr; # csz-- if ($thr_nbr > 0) {$reportstr .= " (OpenMP threads = $thr_nbr)\n";} else {$reportstr .= "\n";} my $udp_dat = $idstring . " using: " . $CCinfo . "|" . "NCO ver: $nco_vrs_sng" . "|" . $cmd_ln . "|"; foreach(@opr_lst) { my $total = $success{$_}+$failure{$_}; my $fal_cnt = ''; if ($failure{$_} == 0){ $fal_cnt = " "; } else {$fal_cnt = sprintf "%3d", $failure{$_};} #printf "$_:\tsuccess: $success{$_} of $total\n"; if ($total > 0) { my $io_tm = $real_tme{$_} - $usr_tme{$_} - $sys_tme{$_}; $reportstr .= sprintf "%10s: %3d %3s %3d %6.2f %6.2f %6.2f %6.2f %6.2f\n", $_, $success{$_}, $fal_cnt, $total, $totbenchmarks{$_}, $real_tme{$_}, $usr_tme{$_}, $sys_tme{$_}, $io_tm; $udp_dat .= sprintf "%s %3d %3d %6.2f %6.2f %6.2f %6.2f %6.2f:",$_, $success{$_}, $total, $totbenchmarks{$_},$real_tme{$_}, $usr_tme{$_}, $sys_tme{$_}, $io_tm ; # above line uses whitespace sep, with ':' separating test names. } } $reportstr .= sprintf "\nNB:MD5: test passes MD5 checksum on file(s) May be more than one intermediate file.\nSVx: test passes single terminal value check SVn=numeric, SVa=alphabetic\n"; chdir "../bld"; if ($dbg_lvl == 0) {print $reportstr;} else { &bm_vrb($dbg_lvl, $wnt_log, $reportstr); } my $skp_rpt = $ENV{'NCO_AVOID_BM_REPORT'}; #print "skp_rpt=", $skp_rpt; #print "udp_rpt=", $udp_rpt; if ($skp_rpt == 1){ $udp_rpt = 0; #print "udp_rpt=", $udp_rpt; } if ($udp_rpt == 1 ) { # set either explicitly (1st time) or set in ~/.ncorc after user agreed to it print "\n\nThe log-formatted result from this regression test is:\n$udp_dat\n\n"; print << "REQ_REGR_PACKET"; --== REQUEST for TEST RESULTS ==-- The NCO team would REALLY appreciate it if you would allow us to have the above results of this regression test. If you type 'yes' in response to this question, the results of this regression test will be sent verbatim as above, anonymously, to the NCO dev team via UDP on port 29659. If your institution has a firewall that prohibits this, it will simply fail silently. We want this info so we can fix failures, improve efficiency, mitigate global warming, and bring about world peace. If you DO NOT want to participate in this, type in anything OTHER than [y, Y, yes or YES]. will also decline sending the data. Do you allow the above regression data to be sent back to the NCO dev team? [default is No, y, Y, yes, YES to send it] REQ_REGR_PACKET print "Answer: "; $ansr = ; chomp $ansr; } if ($udp_rpt || $ansr eq "y" || $ansr eq "yes" || $ansr eq "Y" ||$ansr eq "YES") { $sock->send($udp_dat); print "\nUDP Data sent! The NCO dev team thanks you!!\nHave a good one, eh!?\n\n\n"; if ($dbg_lvl > 0) { print "Regression: udp stream sent to $server_ip:\n$udp_dat\n";} # and write this agreement to the ~/.ncorc file so user isn't bothered by this again. if (!-e "~/.ncorc") { #my $HOME = $ENV{'HOME'} open(RC, "> $ENV{'HOME'}/.ncorc") or die "can't create a .ncorc file in home dir!\n"; print RC "udp_report=yes\n"; close RC; } } else { print "\nOK - data NOT sent, thanks for using NCO anyway - bye!\n\n"; } } # end of sub rsl_smr_rgr sub rsl_chk_MD5_wc { # taken substantially from process_tacg_results (in testtacg.pl), hjm dbg_msg(3, "rsl_chk_MD5_wc()::\$fl_pth = $fl_pth"); my $file = shift; # 1st arg my $testtype = shift; # 2nd arg # my $md5found = shift; # 3rd arg my $pfx_cmd = "$MY_BIN_DIR/"; $pfxd = 1; # embed timer command and local bin directory my $cmd_ln = $_; my $return_value = $cmd_rsl; # return value of executing non-terminal commands my $hash = ""; my @wc_lst; my $wc = ""; if ($return_value != 0) { # nco.h:131:#define EXIT_SUCCESS 0 print LOG "NonZero return value = $cmd_ln\n"; } else { # 1st do an ncks dump on the 1st 111111 lines (will cause a sig13 due to the head cmd) system("$pfx_cmd/ncks -P $file |head -111111 > $fl_pth/wc_out"); @wc_lst = split(/\s+/, `wc $fl_pth/wc_out`); $wc = $wc_lst[1] . " " . $wc_lst[2] . " " . $wc_lst[3]; # however we can do an md5 fo the entire output file if ($md5found == 1) { open(FILE, "$file") or die "Can't open $fl_pth/wc_out\n"; binmode(FILE); $hash = Digest::MD5->new->addfile(*FILE)->hexdigest ; } else { $hash = "UNDEFINED"; } print LOG "\n\"$testtype\" => ", "\"$hash\", #MD5\n\"$testtype\" => ", "\"$wc\", #wc\n$cmd_ln\n\n"; } if ($md5found == 1) { if ( $MD5_tbl{$testtype} eq $hash ) { print " MD5"; bm_vrb " MD5"; } else { print " MD5 fail,"; bm_vrb " MD5 fail,"; # test: $testtype\n"; if ($dbg_lvl > 1) {bm_vrb "MD5 sig: $hash should be: $MD5_tbl{$testtype}\n";} if ($wc eq $wc_tbl{$testtype}) { print "WC PASS "; bm_vrb "WC PASS "; } else { print " WC fail,"; bm_vrb " WC fail,"; } my $errfile = "$file" . ".MD5.err"; # will get overwritten; halt test if want to keep it. system("cp $file $errfile"); } } else { if ($wc_tbl{$testtype} eq $wc) { print "passed wc \n"; bm_vrb "passed wc \n"; } else { print " WC fail,";bm_vrb " WC fail,"; my $errfile = "$testtype" . ".wc.err"; print "\n\ncp $fl_pth/out $fl_pth/$errfile\n\n"; system("cp $fl_pth/out $fl_pth/$errfile"); } } return $hash; } # end rsl_chk_MD5_wc() sub wat4inpt{ my $line = shift; my $msg = shift; if ($msg eq "") {$msg = "no additional info"} if ($dbg_lvl > 2) { print "\n\n-------------------------------\nExecution halted near line $line - hit a key to continue.\n[$msg]\n-------------------------------\n"; my $tmp=; } } # end wat4inpt() sub dbg_msg { my $okdbg = shift; my $msg = shift; if ($dbg_lvl >= $okdbg) { print "\nDEBUG[bm:$okdbg]: $msg\n\n"; } } # Grab NCO version and conmogrify it into something like: "3.0.1 / 20051003" # Requires a string variable to absorb returned string sub vrs_sng_get{ my @nco_vrs; my $tmp_sng = `ncks --version 2>&1 | grep version | head -2`; # long string sep by a newline. $tmp_sng =~ s/\n/ /g; my @tmp_lst = split (/\s+/, $tmp_sng); $nco_vrs[0] = $tmp_lst[4]; $nco_vrs[0] =~ s/"//g; $nco_vrs[1] = $tmp_lst[scalar(@tmp_lst) - 1]; # print "NCO release version: $nco_vrs[0], NCO date version: $nco_vrs[1]\n"; $tmp_sng = "$nco_vrs[0]" . "/" . "$nco_vrs[1]"; return $tmp_sng; } # Following two lines required to provide 'true' value at package end 1; __END__ nco-5.3.3/bm/NCO_rgr.pm000066400000000000000000011265231477164337000145540ustar00rootroot00000000000000package NCO_rgr; # $Header$ # Purpose: All REGRESSION tests for NCO operators # BENCHMARKS are coded in "NCO_benchmarks.pm" # NB: When adding tests, _be sure to use -O to overwrite files_ # Otherwise, script hangs waiting for interactive response to overwrite queries require 5.6.1 or die "This script requires Perl version >= 5.6.1, stopped"; use English; # WCS96 p. 403 makes incomprehensible Perl errors sort of comprehensible use Cwd 'abs_path'; use strict; use NCO_bm qw(dbg_msg tst_run $pfx_cmd $pfx_cmd_crr $drc_dat @fl_mtd_sct $opr_sng_mpi $opr_nm $dsc_sng $prsrv_fl $nsr_xpc $srv_sd ); require Exporter; our @ISA = qw(Exporter); our @EXPORT = qw ( tst_rgr $fl_out $dodap $dbg_lvl $pfx_cmd $pfx_cmd_crr $opr_sng_mpi $opr_nm $dsc_sng $prsrv_fl $nsr_xpc $foo1_fl $foo_fl $foo_tst $fl_out_rgn $foo_avg_fl $foo_x_fl $foo_y_fl $foo_yx_fl $foo_xy_fl $foo_xymyx_fl $pth_rmt_scp_tst $omp_flg $nco_D_flg %NCO_RC ); use vars qw( $dodap $dbg_lvl $drc_dat $dsc_sng $dust_usr $fl_fmt $fl_pth $foo1_fl $foo2_fl $foo_avg_fl $foo_fl $foo_tst $foo_x_fl $foo_xy_fl $foo_xymyx_fl $foo_y_fl $foo_yx_fl $mpi_prc $nco_D_flg $localhostname $nsr_xpc $omp_flg $opr_nm $opr_rgr_mpi $fl_out_rgn $fl_out $pth_rmt_scp_tst $prsrv_fl @tst_cmd $HOME $DATA $USER %NCO_RC ); sub tst_rgr { # Tests are organized and laid-out as follows: # Tests are in alphabetical order by operator name # $tst_cmd[] holds command lines for each operator being tested # Last two lines are the expected value and the serverside string, either: # "NO_SS" - No ServerSide allowed or (all regr are NO_SS still) # "SS_OK" - OK to send it ServerSide (request with '--serverside') # $dsc_sng still holds test description line # tst_run() is function which executes each test my $in_pth="../data"; my $in_pth_arg="-p $in_pth"; $prsrv_fl=0; # csz++ # fxm: pass as arguments or use exporter/importer instead? *dbg_lvl=*main::dbg_lvl; *dodap=*main::dodap; *fl_fmt=*main::fl_fmt; *fl_out=*main::fl_out; *localhostname=*main::localhostname; *nco_D_flg=*main::nco_D_flg; *omp_flg=*main::omp_flg; NCO_bm::dbg_msg(1,"in package NCO_rgr, \$dbg_lvl = $dbg_lvl"); NCO_bm::dbg_msg(1,"in package NCO_rgr, \$dodap = $dodap"); NCO_bm::dbg_msg(1,"in package NCO_rgr, \$fl_fmt = $fl_fmt"); NCO_bm::dbg_msg(1,"in package NCO_rgr, \$fl_out = $fl_out"); NCO_bm::dbg_msg(1,"in package NCO_rgr, \$localhostname = $localhostname"); NCO_bm::dbg_msg(1,"in package NCO_rgr, \$nco_D_flg = $nco_D_flg"); NCO_bm::dbg_msg(1,"in package NCO_rgr, \$omp_flg = $omp_flg"); # csz-- # in general, $fl_out -> %tmp_fl_00% # $foo_fl -> %tmp_fl_01% # $foo_tst -> %tmp_fl_02% # $foo_avg_fl -> %tmp_fl_03% # $foo1_fl -> %tmp_fl_01% # $foo2_fl -> %tmp_fl_02% if($dodap ne "FALSE"){ print "DEBUG: in tst_rgr(), \$dodap = $dodap \n"; if($dodap ne "" && $fl_pth =~ /http/) { $in_pth_arg = "-p $fl_pth"; } if($dodap eq "") { $in_pth_arg = "-p http://dust.ess.uci.edu/cgi-bin/dods/nph-dods/dodsdata"; } } NCO_bm::dbg_msg(1,"------------- REGRESSION TESTS STARTED from tst_rgr() -------------"); print "\n"; my $RUN_NETCDF4_TESTS=0; my $RUN_NETCDF4_TESTS_VERSION_GE_431=0; #my $lbr_rcd_cmd=${pfx_cmd}."ncks --lbr_rcd"; my $lbr_rcd_cmd="ncks --lbr_rcd"; system($lbr_rcd_cmd); if($? == -1){ print "failed to execute: ncks --lbr_rcd: $!\n"; }else{ # system() runs command and returns exit status information as 16-bit value # Low 7 bits are signal process died from, if any, and high 8 bits are actual exit value my $exit_value=$? >> 8; # 20150619: nco_ctl.c/nco_exit_lbr_rcd() deducts offset of 300 so rcd < 255 # Verify exit status in shell with "echo $?" # Library 4.3.3 should return $? = 133 and Library 4.9.4 should return $? = 194 $exit_value+=300; # nco_exit_lbr_rcd() returns codes from nco_ctl.c: # 360 (for library 3.x) # 410 (for library 4.1.x) # 430 (for library 4.3.0) # 431 (for library 4.3.1) # 432 (for library 4.3.2) # 433 (for library 4.3.3.x) # 440 (for library 4.4.0) # 441 (for library 4.4.1.x) # 450 (for library 4.5.0) # 451 (for library 4.5.1) (development-only) # 460 (for library 4.6.0.x) # 461 (for library 4.6.1) # 462 (for library 4.6.2) # 463 (for library 4.6.3) # 464 (for library 4.6.4) # 470 (for library 4.7.0) # 471 (for library 4.7.1) # 472 (for library 4.7.2) # 473 (for library 4.7.3) # 474 (for library 4.7.4) # 480 (for library 4.8.0) # 481 (for library 4.8.1) # 482 (for library 4.8.2) # 490 (for library 4.9.0) # 491 (for library 4.9.1) # 492 (for library 4.9.2) # 493 (for library 4.9.3) # 494 (for library 4.9.4) # 500 (for library 4.10.0) # 501 (for library 4.10.1) if($exit_value == 410){print "netCDF version 4.1.x detected\n";} if($exit_value == 431){print "netCDF version 4.3.1 detected\n";} if($exit_value == 432){print "netCDF version 4.3.2 detected\n";} if($exit_value == 433){print "netCDF version 4.3.3 detected\n";} if($exit_value == 440){print "netCDF version 4.4.0 detected\n";} if($exit_value == 441){print "netCDF version 4.4.1 detected\n";} if($exit_value == 450){print "netCDF version 4.5.0 detected\n";} if($exit_value == 451){print "netCDF version 4.5.1 detected\n";} # development-only if($exit_value == 460){print "netCDF version 4.6.0 detected\n";} if($exit_value == 461){print "netCDF version 4.6.1 detected\n";} if($exit_value == 462){print "netCDF version 4.6.2 detected\n";} if($exit_value == 463){print "netCDF version 4.6.3 detected\n";} if($exit_value == 464){print "netCDF version 4.6.4 detected\n";} if($exit_value == 470){print "netCDF version 4.7.0 detected\n";} if($exit_value == 471){print "netCDF version 4.7.1 detected\n";} if($exit_value == 472){print "netCDF version 4.7.2 detected\n";} if($exit_value == 473){print "netCDF version 4.7.3 detected\n";} if($exit_value == 474){print "netCDF version 4.7.4 detected\n";} if($exit_value == 480){print "netCDF version 4.8.0 detected\n";} if($exit_value == 481){print "netCDF version 4.8.1 detected\n";} if($exit_value == 482){print "netCDF version 4.8.2 detected\n";} if($exit_value == 490){print "netCDF version 4.9.0 detected\n";} if($exit_value == 491){print "netCDF version 4.9.1 detected\n";} if($exit_value == 492){print "netCDF version 4.9.2 detected\n";} if($exit_value == 493){print "netCDF version 4.9.3 detected\n";} if($exit_value == 494){print "netCDF version 4.9.4 detected\n";} # 20250215: New convention required to support netCDF library 4.10.0 and beyond # exit_value=300 refers to netCDF library 4.10.0, not 5.0.0 if($exit_value == 500){print "netCDF version 4.10.0 detected\n";} if($exit_value == 501){print "netCDF version 4.10.1 detected\n";} if($exit_value >= 400){$RUN_NETCDF4_TESTS=1;} if($exit_value >= 431){$RUN_NETCDF4_TESTS_VERSION_GE_431=1;} } print "\n"; #################### #### ncclimo tests # #################### $opr_nm="ncclimo"; $USER=$ENV{'USER'}; $DATA=$ENV{'DATA'}; $HOME=$ENV{'HOME'}; if($USER =~ /zender/){ # NB: area variable is not in ACME cube-sphere native output so this answer is not area-weighted # ncclimo -v FSNT,AODVIS -c v2.LR.historical_0101 -s 2013 -e 2014 -i ${DATA}/ne30/raw -o ${DATA}/ne30/clm # ncwa -O ${DATA}/ne30/clm/v2.LR.historical_0101_ANN_201301_201412_climo.nc ~/foo.nc # ncks -H --trd -u -C -v FSNT ~/foo.nc $dsc_sng="ncclimo (depends on input files in ${DATA}/ne30/raw)"; $tst_cmd[0]="ncclimo -P eam -v FSNT,AODVIS -c v2.LR.historical_0101 -s 2013 -e 2014 -i ${DATA}/ne30/raw -o ${DATA}/ne30/clm > ${HOME}/foo.ncclimo"; $tst_cmd[1]="ncwa -O $fl_fmt $nco_D_flg ${DATA}/ne30/clm/v2.LR.historical_0101_ANN_201301_201412_climo.nc %tmp_fl_00%"; $tst_cmd[2]="ncks -O $fl_fmt $nco_D_flg -H --trd -u -C -v FSNT %tmp_fl_00%"; $tst_cmd[3]="FSNT = 240.308 W/m2"; $tst_cmd[4]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array } # !zender #################### ### ncremap tests # #################### $opr_nm="ncremap"; #################### $USER=$ENV{'USER'}; $DATA=$ENV{'DATA'}; $HOME=$ENV{'HOME'}; if($USER eq 'zender'){ # Regridding regression tests # valgrind --leak-check=yes --show-reachable=yes --suppressions=${HOME}/nco/doc/valgrind.txt --tool=memcheck ncks -O -D 5 --map=${DATA}/maps/map_ne30np4_to_fv129x256_aave.150418.nc ${DATA}/ne30/raw/ne30_tst.nc ~/foo.nc > ~/foo 2>&1 # ncks -O -D 5 --map=${DATA}/maps/map_ne30np4_to_fv129x256_aave.150418.nc ${DATA}/ne30/raw/ne30_tst.nc ~/foo.nc # ncwa -O -w area ~/foo.nc ~/foo2.nc # ncks -H --trd -u -C -v FSNT ~/foo2.nc # ncwa -O -y ttl -v area ~/foo.nc ~/foo3.nc # ncks -H --trd -u -C -v area ~/foo3.nc $dsc_sng="ncks regrid FSNT 1D->2D to test conservation (does rsync to dust.ess.uci.edu)"; $tst_cmd[0]="rsync dust.ess.uci.edu:data/maps/map_ne30np4_to_fv129x256_aave.20150901.nc ."; $tst_cmd[1]="rsync dust.ess.uci.edu:data/ne30/raw/ne30_tst.nc ."; $tst_cmd[2]="ncks -O $fl_fmt $nco_D_flg --map=map_ne30np4_to_fv129x256_aave.20150901.nc ne30_tst.nc %tmp_fl_00%"; # my $pwd=`pwd`; chomp $pwd; print $pwd; # $dsc_sng="ncks regrid FSNT to regridding conservation (does wget to dust.ess.uci.edu)"; # $tst_cmd[0]="wget -c -P $drc_dat http://dust.ess.uci.edu/maps/map_ne30np4_to_fv129x256_aave.20150901.nc"; # $tst_cmd[1]="wget -c -P $drc_dat http://dust.ess.uci.edu/ne30/raw/ne30_tst.nc"; # $tst_cmd[2]="ncks -h -O $fl_fmt $nco_D_flg --map=".$drc_dat."/map_ne30np4_to_fv129x256_aave.20150901.nc ".$drc_dat."/ne30_tst.nc %tmp_fl_00%"; $tst_cmd[3]="/bin/cp -f %tmp_fl_00% ne30_2D.nc"; $tst_cmd[4]="ncwa -O $fl_fmt $nco_D_flg -w area %tmp_fl_00% %tmp_fl_01%"; $tst_cmd[5]="ncks -O $fl_fmt $nco_D_flg -H --trd -u -C -v FSNT %tmp_fl_01%"; $tst_cmd[6]="FSNT = 244.124 W/m2"; $tst_cmd[7]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array $dsc_sng="ncks regrid AODVIS 1D->2D to test missing value treatment"; $tst_cmd[0]="ncks -O $fl_fmt $nco_D_flg -H --trd -u -C -v AODVIS %tmp_fl_01%"; $tst_cmd[1]="AODVIS = 0.151705"; $tst_cmd[2]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array $dsc_sng="ncks regrid area 1D->2D to test grid area integral/normalization"; $tst_cmd[0]="ncks -O $fl_fmt $nco_D_flg --map=${drc_dat}/map_ne30np4_to_fv129x256_aave.20150901.nc ${drc_dat}/ne30_tst.nc %tmp_fl_00%"; $tst_cmd[1]="ncwa -O $fl_fmt $nco_D_flg -y ttl -v area %tmp_fl_00% %tmp_fl_02%"; $tst_cmd[2]="ncks -O $fl_fmt $nco_D_flg -H --trd -u -C -v area %tmp_fl_02%"; $tst_cmd[3]="area = 12.5663706144 steradian"; $tst_cmd[4]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array $dsc_sng="ncks regrid FSNT 1D->2D to test bilinear remapping (does rsync to dust.ess.uci.edu)"; $tst_cmd[0]="rsync dust.ess.uci.edu:data/maps/map_ne30np4_to_fv257x512_bilin.20150901.nc ."; $tst_cmd[1]="rsync dust.ess.uci.edu:data/ne30/raw/ne30_tst.nc ."; $tst_cmd[2]="ncks -O $fl_fmt $nco_D_flg --map=map_ne30np4_to_fv257x512_bilin.20150901.nc ne30_tst.nc %tmp_fl_00%"; $tst_cmd[3]="ncwa -O $fl_fmt $nco_D_flg -w gw %tmp_fl_00% %tmp_fl_01%"; $tst_cmd[4]="ncks -O $fl_fmt $nco_D_flg -H --trd -u -C -v FSNT %tmp_fl_01%"; $tst_cmd[5]="FSNT = 244.237 W/m2"; $tst_cmd[6]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array $dsc_sng="ncks regrid FSNT 2D->1D to test conservation (does rsync to dust.ess.uci.edu)"; $tst_cmd[0]="rsync dust.ess.uci.edu:data/maps/map_fv129x256_to_ne30np4_aave.20150901.nc ."; $tst_cmd[1]="ncks -O $fl_fmt $nco_D_flg --map=map_fv129x256_to_ne30np4_aave.20150901.nc ne30_2D.nc %tmp_fl_00%"; $tst_cmd[2]="ncwa -O $fl_fmt $nco_D_flg -w area %tmp_fl_00% %tmp_fl_01%"; $tst_cmd[3]="ncks -O $fl_fmt $nco_D_flg -H --trd -u -C -v FSNT %tmp_fl_01%"; $tst_cmd[4]="FSNT = 244.124 W/m2"; $tst_cmd[5]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array $dsc_sng="ncks regrid FSNT 2D->2D to test conservation (does rsync to dust.ess.uci.edu)"; $tst_cmd[0]="rsync dust.ess.uci.edu:data/maps/map_fv129x256_to_fv257x512_aave.20150901.nc ."; $tst_cmd[1]="rsync dust.ess.uci.edu:data/ne30/rgr/ne30_2D.nc ."; $tst_cmd[2]="ncks -O $fl_fmt $nco_D_flg --map=map_fv129x256_to_fv257x512_aave.20150901.nc ne30_2D.nc %tmp_fl_00%"; $tst_cmd[3]="ncwa -O $fl_fmt $nco_D_flg -w area %tmp_fl_00% %tmp_fl_01%"; $tst_cmd[4]="ncks -O $fl_fmt $nco_D_flg -H --trd -u -C -v FSNT %tmp_fl_01%"; $tst_cmd[5]="FSNT = 244.124 W/m2"; $tst_cmd[6]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array $dsc_sng="ncks regrid FSNT 1D->1D to test identity mapping and conservation (does rsync to dust.ess.uci.edu)"; $tst_cmd[0]="rsync dust.ess.uci.edu:data/maps/map_ne30np4_to_ne30np4_aave.20150603.nc ."; $tst_cmd[1]="rsync dust.ess.uci.edu:data/ne30/raw/ne30_tst.nc ."; $tst_cmd[2]="ncks -O $fl_fmt $nco_D_flg --map=map_ne30np4_to_ne30np4_aave.20150603.nc ne30_tst.nc %tmp_fl_00%"; $tst_cmd[3]="ncwa -O $fl_fmt $nco_D_flg -w area %tmp_fl_00% %tmp_fl_01%"; $tst_cmd[4]="ncks -O $fl_fmt $nco_D_flg -H --trd -u -C -v FSNT %tmp_fl_01%"; $tst_cmd[5]="FSNT = 244.124 W/m2"; $tst_cmd[6]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array # ncks -O --rgr grid=~/foo_grid.nc --rgr latlon=64,128 --rgr lat_typ=gss --rgr lon_typ=Grn_ctr ~/nco/data/in.nc ~/foo.nc # ncks -O -H --trd -u -C -s %18.15f -d grid_size,0 -v grid_center_lat ~/foo_grid.nc # 20151205: using %tmp_fl_00% in arguments like "--rgr grid=%tmp_fl_00%" leads to epic fail, so hard-code filenames that are arguments $dsc_sng="ncks generate T42 gridfile"; $tst_cmd[0]="ncks -O $fl_fmt $nco_D_flg --rgr grid=foo_grid.nc --rgr latlon=64,128 --rgr lat_typ=gss --rgr lon_typ=Grn_ctr $in_pth_arg in.nc %tmp_fl_01%"; $tst_cmd[1]="ncks -O $fl_fmt $nco_D_flg -H --trd -u -C -s %18.15f -d grid_size,0 -v grid_center_lat foo_grid.nc"; $tst_cmd[2]="-87.863798839232629"; $tst_cmd[3]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array # ncks -O -D 1 --rgr skl=~/foo_skl.nc --rgr grid=~/foo_grid.nc --rgr latlon=64,128 --rgr lat_typ=gss --rgr lon_typ=Grn_ctr ~/nco/data/in.nc ~/foo.nc # ncks -O -H --trd -u -C -s %g -d lat,0 -v gw ~/foo_skl.nc $dsc_sng="ncks generate T42-grid skeleton file"; $tst_cmd[0]="ncks -O $fl_fmt $nco_D_flg --rgr skl=foo_skl.nc --rgr grid=foo_grid.nc --rgr latlon=64,128 --rgr lat_typ=gss --rgr lon_typ=Grn_ctr $in_pth_arg in.nc %tmp_fl_02%"; $tst_cmd[1]="ncks -O $fl_fmt $nco_D_flg -H --trd -u -C -s %g -d lat,0 -v gw foo_skl.nc"; $tst_cmd[2]="0.00178328"; $tst_cmd[3]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array # ncks -O --rgr nfr=y --rgr grid=~/foo_grid.nc ~/nco/data/ne30_2D.nc ~/foo.nc # ncks -O -H --trd -u -C -s %8.5f -d grid_size,256 -v grid_center_lat ~/foo_grid.nc # 20151205: using %tmp_fl_00% in arguments like "--rgr grid=%tmp_fl_00%" leads to epic fail, so hard-code filenames that are arguments $dsc_sng="ncks infer 129x256 FV gridfile (does rsync to dust.ess.uci.edu)"; $tst_cmd[0]="rsync dust.ess.uci.edu:data/ne30/rgr/ne30_2D.nc ."; $tst_cmd[1]="ncks -O $fl_fmt $nco_D_flg --rgr nfr=y --rgr grid=foo_grid.nc ne30_2D.nc %tmp_fl_01%"; $tst_cmd[2]="ncks -O $fl_fmt $nco_D_flg -H --trd -u -C -s %8.5f -d grid_size,256 -v grid_center_lat foo_grid.nc"; $tst_cmd[3]="-88.59375"; $tst_cmd[4]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array $dsc_sng="ncremap regrid FSNT 1D->2D to test conservation (depends on rsync to dust.ess.uci.edu)"; $tst_cmd[0]="rsync dust.ess.uci.edu:data/maps/map_ne30np4_to_fv129x256_aave.20150901.nc ."; $tst_cmd[1]="rsync dust.ess.uci.edu:data/ne30/raw/ne30_tst.nc ."; $tst_cmd[2]="ncremap -i ne30_tst.nc -m map_ne30np4_to_fv129x256_aave.20150901.nc -o %tmp_fl_00%"; $tst_cmd[3]="ncwa -O $fl_fmt $nco_D_flg -w area %tmp_fl_00% %tmp_fl_01%"; $tst_cmd[4]="ncks -O $fl_fmt $nco_D_flg -H --trd -u -C -v FSNT %tmp_fl_01%"; $tst_cmd[5]="FSNT = 244.124 W/m2"; $tst_cmd[6]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array # ncremap generate T42 dataset, populate with test field, conservatively regrid to 2x2, verify conservation # ncks -O --rgr skl=${HOME}/skl_t42.nc --rgr grid=${HOME}/grd_t42.nc --rgr latlon=64,128 --rgr lat_typ=gss --rgr lon_typ=Grn_ctr ~/nco/data/in.nc ~/foo.nc # ncks -O --rgr grid=${HOME}/grd_2x2.nc --rgr latlon=90,180 --rgr lat_typ=eqa --rgr lon_typ=Grn_wst ~/nco/data/in.nc ~/foo.nc # ncap2 -O -s 'tst[lat,lon]=1.0f' ~/skl_t42.nc ~/dat_t42.nc # /bin/rm -f ~/map_t42_to_2x2.nc # ncremap -a nco -s ~/grd_t42.nc -g ~/grd_2x2.nc -m ~/map_t42_to_2x2.nc # ncremap -i ~/dat_t42.nc -m ~/map_t42_to_2x2.nc -o ~/dat_2x2.nc # ncwa -O ~/dat_2x2.nc ~/dat_avg.nc # ncks -C -H --trd -v tst ~/dat_avg.nc $dsc_sng="ncremap generate fake T42 dataset, conservatively regrid to 2x2"; $tst_cmd[0]="ncks -O $fl_fmt $nco_D_flg --rgr skl=foo_skl_t42.nc --rgr grid=foo_grd_t42.nc --rgr latlon=64,128 --rgr lat_typ=gss --rgr lon_typ=Grn_ctr $in_pth_arg in.nc %tmp_fl_00%"; $tst_cmd[1]="ncks -O $fl_fmt $nco_D_flg --rgr grid=foo_grd_2x2.nc --rgr latlon=90,180 --rgr lat_typ=eqa --rgr lon_typ=Grn_wst $in_pth_arg in.nc %tmp_fl_00%"; $tst_cmd[2]="ncap2 -O $fl_fmt $nco_D_flg -s 'tst[lat,lon]=1.0f' foo_skl_t42.nc foo_dat_t42.nc"; $tst_cmd[3]="/bin/rm -f foo_map_t42_to_2x2.nc"; $tst_cmd[4]="ncremap -a nco -s foo_grd_t42.nc -g foo_grd_2x2.nc -m foo_map_t42_to_2x2.nc"; $tst_cmd[5]="ncremap -i foo_dat_t42.nc -m foo_map_t42_to_2x2.nc -o foo_dat_2x2.nc"; $tst_cmd[6]="ncwa -O $fl_fmt $nco_D_flg foo_dat_2x2.nc foo_dat_avg.nc"; $tst_cmd[7]="ncks -C -H --trd -v tst foo_dat_avg.nc"; $tst_cmd[8]="tst = 1"; $tst_cmd[9]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array } # !zender #################### #### ncap2 tests #### #################### $opr_nm='ncap2'; #################### # This stanza will not map to the way the SS is done - needs a %stdouterr% added but all the rest of them # have an ncks which triggers this addition from the sub tst_run() -> gnarly_pything. # this stanza also requires a script on the SS. # 20150617: ncap2.in has failed for years because time1 attribute bounds is passed with att_item.val=NULL # This is fixable (at least by Henry). But for now, omit this known-to-fail test. if(0){ $dsc_sng="running ncap2.in script in nco_bm.pl (failure expected)"; $tst_cmd[0]="ncap2 -h -O $fl_fmt $nco_D_flg -v -S ncap2.in $in_pth_arg in.nc %tmp_fl_00% %stdouterr%"; $tst_cmd[1]="ncks -C -H --trd -v b2 --no_blank -s '%d' %tmp_fl_00%"; $tst_cmd[2]="999"; $tst_cmd[3]="NO_SS"; # $tst_cmd[3]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array # printf("paused @ [%s:%d] - hit return to continue\n", __FILE__, __LINE__); my $wait = ; } # endif false # ncap2 #1 # ncap2 -O -v -s 'tpt_mod=tpt%273.0f' ~/nco/data/in.nc ~/foo.nc # ncks -C -H --trd -v tpt_mod -s '%.1f' ~/foo.nc $dsc_sng="Testing float modulo float"; $tst_cmd[0]="ncap2 -h -O $fl_fmt $nco_D_flg -C -v -s 'tpt_mod=tpt%273.0f' $in_pth_arg in.nc %tmp_fl_00%"; $tst_cmd[1]="ncks -C -H --trd -v tpt_mod -s '%.1f ' %tmp_fl_00%"; $tst_cmd[2]="0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 "; $tst_cmd[3]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array # ncap2 #2 $dsc_sng="Testing foo=log(e_flt)^1 (may fail on old AIX TODO ncap57)"; $tst_cmd[0]="ncap2 -h -O $fl_fmt $nco_D_flg -C -v -s 'foo=log(e_flt)^1' $in_pth_arg in.nc %tmp_fl_00%"; $tst_cmd[1]="ncks -C -H --trd -v foo -s '%.6f' %tmp_fl_00%"; $tst_cmd[2]="1.000000"; $tst_cmd[3]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array # ncap2 #3 $dsc_sng="Testing foo=log(e_dbl)^1"; $tst_cmd[0]="ncap2 -h -O $fl_fmt $nco_D_flg -C -v -s 'foo=log(e_dbl)^1' $in_pth_arg in.nc %tmp_fl_00%"; $tst_cmd[1]="ncks -C -H --trd -s '%.12f' %tmp_fl_00%"; $tst_cmd[2]="1.000000000000"; $tst_cmd[3]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array # ncap2 #4 $dsc_sng="Testing foo=4*atan(1)"; $tst_cmd[0]="ncap2 -h -O $fl_fmt $nco_D_flg -C -v -s 'foo=4*atan(1)' $in_pth_arg in.nc %tmp_fl_00%"; $tst_cmd[1]="ncks -C -H --trd -s '%.12f' %tmp_fl_00%"; $tst_cmd[2]="3.141592741013"; $tst_cmd[3]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array # ncap2 #5 # ncap2 -h -O $fl_fmt $nco_D_flg -C -v -s 'foo=erf(1)' ~/nco/data/in.nc ~/foo.nc # ncks -C -H --trd -s '%.12f' ~/foo.nc $dsc_sng="Testing foo=erf(1) (may fail on old AIX TODO ncap57)"; $tst_cmd[0]="ncap2 -h -O $fl_fmt $nco_D_flg -C -v -s 'foo=erf(1)' $in_pth_arg in.nc %tmp_fl_00%"; $tst_cmd[1]="ncks -C -H --trd -s '%.12f' %tmp_fl_00%"; $tst_cmd[2]="0.842700779438"; $tst_cmd[3]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array # ncap2 #6 $dsc_sng="Testing foo=gamma(0.5) (may fail on old AIX TODO ncap57)"; $tst_cmd[0]="ncap2 -h -O $fl_fmt $nco_D_flg -C -v -s 'foo=gamma(0.5)' $in_pth_arg in.nc %tmp_fl_00%"; $tst_cmd[1]="ncks -C -H --trd -s '%.12f' %tmp_fl_00%"; $tst_cmd[2]="1.772453851"; $tst_cmd[3]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array # ncap2 #7 $dsc_sng="Testing foo=sin(pi/2)"; $tst_cmd[0]="ncap2 -h -O $fl_fmt $nco_D_flg -C -v -s 'pi=4*atan(1);foo=sin(pi/2)' $in_pth_arg in.nc %tmp_fl_00%"; $tst_cmd[1]="ncks -C -H --trd -v foo -s '%.12f' %tmp_fl_00%"; $tst_cmd[2]="1.000000000000"; $tst_cmd[3]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array # ncap2 #8 $dsc_sng="Testing foo=cos(pi)"; $tst_cmd[0]="ncap2 -h -O $fl_fmt $nco_D_flg -C -v -s 'pi=4*atan(1);foo=cos(pi)' $in_pth_arg in.nc %tmp_fl_00%"; $tst_cmd[1]="ncks -C -H --trd -v foo -s '%.12f' %tmp_fl_00%"; $tst_cmd[2]="-1.000000000000"; $tst_cmd[3]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array\ # ncap2 #9 $dsc_sng="Casting variable with same name as dimension (ncap81 failed with netCDF4 until netCDF 4.3.x)"; $tst_cmd[0]="ncap2 -h -O $fl_fmt $nco_D_flg -C -v -s 'defdim(\"a\",3);defdim(\"b\",4); a[\$a,\$b]=10;c=a(1,1);' $in_pth_arg in.nc %tmp_fl_00%"; $tst_cmd[1]="ncks -C -H --trd -v c -s '%i' %tmp_fl_00%"; $tst_cmd[2]="10"; $tst_cmd[3]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array # ncap2 #10 $dsc_sng="Casting variable with a single dim of sz=1 (ncap81 failed with netCDF4 until netCDF 4.3.x)"; $tst_cmd[0]="ncap2 -h -O $fl_fmt $nco_D_flg -C -v -s 'defdim(\"a\",1); b[\$a]=10;c=b(0:0);' $in_pth_arg in.nc %tmp_fl_00%"; $tst_cmd[1]="ncwa -h -O $fl_fmt $nco_D_flg -C -a a %tmp_fl_00% %tmp_fl_01%"; $tst_cmd[2]="ncks -C -H --trd -v b -s '%i' %tmp_fl_01%"; $tst_cmd[3]="10"; $tst_cmd[4]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array # ncap2 #11 # ncap2 -O -v -s 'lat_min=min(lat)' ~/nco/data/in.nc ~/foo.nc # ncks -C -H --trd -v lat_min -s '%g' ~/foo.nc $dsc_sng="Verify non-averaging functions min/max on coordinate variables"; $tst_cmd[0]="ncap2 -h -O $fl_fmt $nco_D_flg -v -s 'lat_min=min(lat)' $in_pth_arg in.nc %tmp_fl_00%"; $tst_cmd[1]="ncks -C -H --trd -v lat_min -s '%g' %tmp_fl_00%"; $tst_cmd[2]="-90"; $tst_cmd[3]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array # ncap2 #12 $dsc_sng="Run script to to test GSL functions -FAILS IF NOT linked to GSL lib"; $tst_cmd[0]="ncap2 -h -O $fl_fmt $nco_D_flg -v -S '../data/gsl_sf.in' $in_pth_arg in.nc %tmp_fl_00%"; $tst_cmd[1]="ncks -C -H --trd -v nbr_err_ttl -s '%d' %tmp_fl_00%"; $tst_cmd[2]="0"; $tst_cmd[3]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array # ncap2 #13 # ncap2 -h -O -v -S ~/nco/data/bsc_tst.nco ~/nco/data/in.nc ~/foo.nc # ncks -C -H --trd -v nbr_err_ttl -s '%d' ~/foo.nc $dsc_sng="Run script to to test casting, hyperslabbing and intrinsic functions (Requires GSL)"; $tst_cmd[0]="ncap2 -h -O $fl_fmt $nco_D_flg -v -S '../data/bsc_tst.nco' $in_pth_arg in.nc %tmp_fl_00%"; $tst_cmd[1]="ncks -C -H --trd -v nbr_err_ttl -s '%d' %tmp_fl_00%"; $tst_cmd[2]="0"; $tst_cmd[3]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array # ncap2 #14 # ncap2 -O -v -S ~/nco/data/vpointer-tst.nco ~/nco/data/in.nc ~/foo.nc $dsc_sng="Run script to test conversion of input vars to type NC_DOUBLE using var-pointers"; $tst_cmd[0]="ncap2 -h -O $fl_fmt $nco_D_flg -v -S '../data/vpointer-tst.nco' $in_pth_arg in.nc %tmp_fl_00%"; $tst_cmd[1]="ncks -C -H --trd -v nbr_err -s '%d' %tmp_fl_00%"; $tst_cmd[2]="0"; $tst_cmd[3]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array # ncap2 #15 $dsc_sng="Run script to test udunits code"; $tst_cmd[0]="ncap2 -h -O $fl_fmt $nco_D_flg -v -S '../data/tst-udunits.nco' $in_pth_arg in.nc %tmp_fl_00%"; $tst_cmd[1]="ncks -C -H --trd -v nbr_err -s '%d' %tmp_fl_00%"; $tst_cmd[2]="0"; $tst_cmd[3]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array # ncap2 #16 # ncap2 -h -O -v -S ~/nco/data/string.nco ~/nco/data/in_4.nc ~/foo.nc # ncks -C -H --trd -v nbr_err_ttl -s '%d' ~/foo.nc $dsc_sng="Run script to to test ncap2 NC_STRING handling (failure expected 2017-06-21)"; $tst_cmd[0]="ncap2 -h -O $fl_fmt $nco_D_flg -v -S '../data/string.nco' $in_pth_arg in_4.nc %tmp_fl_00%"; $tst_cmd[1]="ncks -C -H --trd -v nbr_err_ttl -s '%d' %tmp_fl_00%"; $tst_cmd[2]="0"; $tst_cmd[3]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array # ncap2 #17 $dsc_sng="Run script to test sort functions"; $tst_cmd[0]="ncap2 -h -O $fl_fmt $nco_D_flg -v -S '../data/sort.nco' $in_pth_arg in.nc %tmp_fl_00%"; $tst_cmd[1]="ncks -C -H --trd -v nbr_err -s '%d' %tmp_fl_00%"; $tst_cmd[2]="0"; $tst_cmd[3]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array # ncap2 #18 $dsc_sng="Run script to test pack() function"; $tst_cmd[0]="ncap2 -h -O $fl_fmt $nco_D_flg -v -S '../data/pack.nco' $in_pth_arg in.nc %tmp_fl_00%"; $tst_cmd[1]="ncpdq -O -U %tmp_fl_00% %tmp_fl_01%"; $tst_cmd[2]="ncap2 -O -h -C $fl_fmt $nco_D_flg -v -s 'n2=p_three_dmn_var_dbl.total();' %tmp_fl_01% %tmp_fl_02%"; $tst_cmd[3]="ncks -C -H --trd -v n2 -s '%.2f' %tmp_fl_02%"; $tst_cmd[4]="2802.00"; $tst_cmd[5]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array # ncap2 #19 # ncap2 -h -O -v -S ~/nco/data/ncap2_tst.nco ~/nco/data/in.nc ~/foo.nc # ncks -C -H --trd -v nbr_err_ttl -s '%d' ~/foo.nc $dsc_sng="Run self-contained test script"; $tst_cmd[0]="ncap2 -h -O $fl_fmt $nco_D_flg -v -S '../data/ncap2_tst.nco' $in_pth_arg in.nc %tmp_fl_00%"; $tst_cmd[1]="ncks -C -H --trd -v nbr_err_ttl -s '%d' %tmp_fl_00%"; $tst_cmd[2]="0"; $tst_cmd[3]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array # ncap2 #20 # ncap2 -4 -h -O -v -S ~/nco/data/limits.nco ~/nco/data/in.nc ~/foo.nc # ncks -C -H --trd -v nbr_err_ttl -s '%d' ~/foo.nc $dsc_sng="Run test limits script"; $tst_cmd[0]="ncap2 -4 -h -O $fl_fmt $nco_D_flg -v -S '../data/limits.nco' $in_pth_arg in.nc %tmp_fl_00%"; $tst_cmd[1]="ncks -C -H --trd -v nbr_err_ttl -s '%d' %tmp_fl_00%"; $tst_cmd[2]="0"; $tst_cmd[3]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array if($dodap eq "FALSE"){ #################### #### ncatted tests # #################### $opr_nm="ncatted"; #################### #ncatted #1 # ncatted -h -O $nco_D_flg -a units,,m,c,'meter second-1' ~/nco/data/in.nc ~/foo.nc # ncks -C -m --trd -v lev ~/foo.nc | grep units | cut -d ' ' -f 11-12 $dsc_sng="Modify all existing units attributes to meter second-1"; $tst_cmd[0]="ncatted -h -O $nco_D_flg -a units,,m,c,'meter second-1' $in_pth_arg in.nc %tmp_fl_00%"; $tst_cmd[1]="ncks -C -m --trd -v lev %tmp_fl_00% | grep units | cut -d ' ' -f 11-12"; ## daniel:fixme cut/ncks but how to do grep? $tst_cmd[2]="meter second-1"; $tst_cmd[3]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array #printf("paused @ %s:%d - hit return to continue", __FILE__ , __LINE__); my $wait = ; #ncatted #2 $dsc_sng="Change _FillValue attribute from 1.0e36 to 0.0 in netCDF3 file"; $tst_cmd[0]="ncatted -h -O $nco_D_flg -a _FillValue,val_one_mss,m,f,0.0 $in_pth_arg in.nc %tmp_fl_00%"; $tst_cmd[1]="ncks -C -H --trd -s '%g' -d lat,1 -v val_one_mss %tmp_fl_00%"; $tst_cmd[2]="0"; $tst_cmd[3]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array #ncatted #3 $dsc_sng="Create new _FillValue attribute"; $tst_cmd[0]="ncatted -h -O $nco_D_flg -a _FillValue,wgt_one,c,f,200.0 $in_pth_arg in.nc %tmp_fl_00%"; $tst_cmd[1]="ncks -C -H --trd -s '%g' -d lat,1 -v wgt_one %tmp_fl_00%"; $tst_cmd[2]="1"; $tst_cmd[3]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array #ncatted #4 # Fragile: Test fails when command length changes, e.g., on MACOS # ncatted -O --hdr_pad=1000 -a missing_value,val_one_mss,m,f,0.0 ~/nco/data/in.nc ~/foo.nc # ncks -M --trd ~/foo.nc | grep hdr_pad | wc > ~/foo # cut -c 14-15 ~/foo $dsc_sng="Pad header with 1000B extra bytes (expect ERROR on MacOS due to different command-line length)"; $tst_cmd[0]="ncatted -O --hdr_pad=1000 $nco_D_flg -a missing_value,val_one_mss,m,f,0.0 $in_pth_arg in.nc %tmp_fl_00%"; $tst_cmd[1]="ncks -M --trd %tmp_fl_00% | grep hdr_pad | wc > %tmp_fl_01%"; $tst_cmd[2]="cut -c 14-15 %tmp_fl_01%"; ## Daniel:fxm cut/ncks, but how to do grep and wc??? $tst_cmd[3]="27"; $tst_cmd[4]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array #ncatted #5 # ncatted -O $nco_D_flg -a nw1,'^three*',c,i,999 ~/nco/data/in.nc ~/foo.nc # ncap2 -v -C -O -s 'n2=three_dmn_var_int@nw1;' ~/foo.nc ~/foo1.nc # ncks -O -C -H --trd -s '%i' -v n2 ~/foo1.nc $dsc_sng="Variable wildcarding (requires regex)"; $tst_cmd[0]="ncatted -O $nco_D_flg -a nw1,'^three*',c,i,999 $in_pth_arg in.nc %tmp_fl_00%"; $tst_cmd[1]="ncap2 -v -C -O -s 'n2=three_dmn_var_int\@nw1;' %tmp_fl_00% %tmp_fl_01%"; $tst_cmd[2]="ncks -O -C -H --trd -s '%i' -v n2 %tmp_fl_01%"; $tst_cmd[3]="999"; $tst_cmd[4]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array ####################################### #### Group tests (requires netCDF4) ### ####################################### if($RUN_NETCDF4_TESTS == 1){ #4.3.8 #ncatted #6 #ncatted -O -a purpose,rlev,m,c,new_value in_grp_3.nc ~/foo.nc $dsc_sng="(Groups) Modify attribute for variable (input relative name)"; $tst_cmd[0]="ncatted -O $nco_D_flg -a purpose,rlev,m,c,new_value $in_pth_arg in_grp_3.nc %tmp_fl_00%"; $tst_cmd[1]="ncks -m --trd -g g3 -v rlev %tmp_fl_00%"; $tst_cmd[2]="rlev attribute 0: purpose, size = 9 NC_CHAR, value = new_value"; $tst_cmd[3]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array #ncatted #7 $dsc_sng="(Groups) Modify attribute for variable (input absolute name)"; $tst_cmd[0]="ncatted -O $nco_D_flg -a purpose,/g3/rlev,m,c,new_value $in_pth_arg in_grp_3.nc %tmp_fl_00%"; $tst_cmd[1]="ncks -m --trd -g g3 -v rlev %tmp_fl_00%"; $tst_cmd[2]="rlev attribute 0: purpose, size = 9 NC_CHAR, value = new_value"; $tst_cmd[3]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array #ncatted #8 $dsc_sng="(Groups) Modify attribute for group (input relative name)"; $tst_cmd[0]="ncatted -O $nco_D_flg -a g3_group_attribute,group,m,c,new_value $in_pth_arg in_grp_3.nc %tmp_fl_00%"; $tst_cmd[1]="ncks -M --trd %tmp_fl_00% | grep g3_group_attribute"; $tst_cmd[2]="Group attribute 0: g3_group_attribute, size = 9 NC_CHAR, value = new_value"; $tst_cmd[3]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array #ncatted #9 $dsc_sng="(Groups) Variable wildcarding (requires regex)"; $tst_cmd[0]="ncatted -O $nco_D_flg -a nw1,'^three*',c,i,999 $in_pth_arg in_grp.nc %tmp_fl_00%"; $tst_cmd[1]="ncks -m --trd -C -g g10 -v three_dmn_rec_var %tmp_fl_00%"; $tst_cmd[2]="three_dmn_rec_var attribute 1: nw1, size = 1 NC_INT, value = 999"; $tst_cmd[3]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array #ncatted #10 $dsc_sng="(Groups) Edit all variables"; $tst_cmd[0]="ncatted -O $nco_D_flg -a purpose,,m,c,new_value $in_pth_arg in_grp_3.nc %tmp_fl_00%"; $tst_cmd[1]="ncks -m --trd -g g3 -v rlev %tmp_fl_00%"; $tst_cmd[2]="rlev attribute 0: purpose, size = 9 NC_CHAR, value = new_value"; $tst_cmd[3]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array #ncatted #11 # ncatted -h -O -a Conventions,group,m,c,new_value ~/nco/data/in_grp_3.nc ~/foo.nc # ncks -M --trd ~/foo.nc | grep Conventions $dsc_sng="(Groups) Modify global attribute"; $tst_cmd[0]="ncatted -h -O $nco_D_flg -a Conventions,group,m,c,new_value $in_pth_arg in_grp_3.nc %tmp_fl_00%"; $tst_cmd[1]="ncks -M --trd %tmp_fl_00% | grep Conventions"; $tst_cmd[2]="Group attribute 0: Conventions, size = 9 NC_CHAR, value = new_value"; $tst_cmd[3]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array #ncatted #12 # ncatted -h -O -a _FillValue,val_one_mss,m,f,0.0 ~/nco/data/in_grp.nc ~/foo.nc # ncks -C -H --trd -s '%g' -d lat,1 -v val_one_mss ~/foo.nc $dsc_sng="Change _FillValue attribute from 1.0e36 to 0.0 on netCDF4 file"; $tst_cmd[0]="ncatted -h -O $nco_D_flg -a _FillValue,val_one_mss,m,f,0.0 $in_pth_arg in_grp.nc %tmp_fl_00%"; $tst_cmd[1]="ncks -C -H --trd -s '%g' -d lat,1 -v val_one_mss %tmp_fl_00%"; ###TODO 665 $tst_cmd[2]="0"; $tst_cmd[3]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array } # $RUN_NETCDF4_TESTS #ncatted #13 # ncatted -O -a '.?_att$',att_var,o,i,999 ~/nco/data/in.nc ~/foo.nc # ncks -C -m --trd -v att_var ~/foo.nc | grep float_att | cut -d ' ' -f 11 $dsc_sng="Attribute wildcarding (requires regex)"; $tst_cmd[0]="ncatted -O $nco_D_flg -a '.?_att$\',att_var,o,i,999 $in_pth_arg in.nc %tmp_fl_00%"; $tst_cmd[1]="ncks -C -m --trd -v att_var %tmp_fl_00% | grep float_att | cut -d ' ' -f 11"; $tst_cmd[2]="999"; $tst_cmd[3]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array #ncatted #14 # ncatted -O -a ,att_var,d,, ~/nco/data/in.nc ~/foo.nc # ncks -C -m --trd -v att_var ~/foo.nc | wc | cut -d ' ' -f 7 # Count lines of output to verify no attributes remain # 20210713 fails on MacOS with Homebrew due to cut -f X being 1-based not 0-based? $dsc_sng="Delete all attributes (expect ERROR on MacOS due to \"cut\" behavior)"; $tst_cmd[0]="ncatted -O $nco_D_flg -a ,att_var,d,, $in_pth_arg in.nc %tmp_fl_00%"; $tst_cmd[1]="ncks -C -m --trd -v att_var %tmp_fl_00% | wc | cut -d ' ' -f 7"; $tst_cmd[2]="4"; $tst_cmd[3]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array } #dodap # printf("paused @ %s:%d - hit return to continue", __FILE__ , __LINE__); my $wait = ; #################### #### ncbo tests #### #################### $opr_nm="ncbo"; #################### # ncbo #1 $dsc_sng="Difference a packed variable and be sure everything is zero or _FillValue by average whole remainder and comparing to zero.) FAILS with netCDF4"; $tst_cmd[0]="ncbo $omp_flg -h -O $fl_fmt $nco_D_flg -v rec_var_dbl_mss_val_dbl_pck $in_pth_arg in.nc in.nc %tmp_fl_00%";; $tst_cmd[1]="ncwa $omp_flg -h -O $fl_fmt $nco_D_flg %tmp_fl_00% %tmp_fl_03%";; $tst_cmd[2]="ncks -C -H --trd -s '%g' -v rec_var_dbl_mss_val_dbl_pck %tmp_fl_03%"; $tst_cmd[3]="0.0"; $tst_cmd[4]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array - ok # ncbo #2 $dsc_sng="Whole file difference with broadcasting (OK to fail here fxm TODO nco757. Works with --mmr_drt, triggers segfault on OSs like FC Linux which have C-library armor. Harmless Failure caused by free'ing dangling pointer during memory cleanup.)"; $tst_cmd[0]="ncwa $omp_flg -h -O $fl_fmt $nco_D_flg -a time $in_pth_arg in.nc %tmp_fl_03%";; $tst_cmd[1]="ncbo $omp_flg -h -O $fl_fmt $nco_D_flg $in_pth/in.nc %tmp_fl_03% %tmp_fl_00%";; $tst_cmd[2]="ncks -C -H --trd -d time,9 -s '%g' -v rec_var_flt %tmp_fl_00%"; $tst_cmd[3]="4.5"; $tst_cmd[4]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array - ok # ncbo #3 # ncbo -h -O --op_typ='-' -v mss_val_scl -p ~/nco/data in.nc in.nc ~/foo.nc $dsc_sng="difference scalar missing value"; $tst_cmd[0]="ncbo $omp_flg -h -O $fl_fmt $nco_D_flg --op_typ='-' -v mss_val_scl $in_pth_arg in.nc in.nc %tmp_fl_00%"; $tst_cmd[1]="ncks -C -H --trd --no_blank -s '%g' -v mss_val_scl %tmp_fl_00%"; $tst_cmd[2]="1.0e36"; $tst_cmd[3]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array - ok # ncbo #4 $dsc_sng="difference with missing value attribute"; $tst_cmd[0]="ncbo $omp_flg -h -O $fl_fmt $nco_D_flg --op_typ='-' -d lon,1 -v mss_val $in_pth_arg in.nc in.nc %tmp_fl_00%"; $tst_cmd[1]="ncks -C -H --trd --no_blank -s '%g' -v mss_val %tmp_fl_00%"; $tst_cmd[2]=1.0e36; $tst_cmd[3]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array ok # ncbo #5 $dsc_sng="difference without missing value attribute"; $tst_cmd[0]="ncbo $omp_flg -h -O $fl_fmt $nco_D_flg --op_typ='-' -d lon,0 -v no_mss_val $in_pth_arg in.nc in.nc %tmp_fl_00%"; $tst_cmd[1]="ncks -C -H --trd -s '%f' -v no_mss_val %tmp_fl_00%"; $tst_cmd[2]="0"; $tst_cmd[3]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array ok # ncbo #6 $dsc_sng="_FillValues differ between files"; $tst_cmd[0]="ncks -h -O $fl_fmt $nco_D_flg -v mss_val_fst $in_pth_arg in.nc %tmp_fl_00%"; $tst_cmd[1]="ncrename -h -O $nco_D_flg -v mss_val_fst,mss_val %tmp_fl_00%"; $tst_cmd[2]="ncbo -C $omp_flg -h -O $fl_fmt $nco_D_flg -y '-' -v mss_val %tmp_fl_00% ../data/in.nc %tmp_fl_01% 2> %tmp_fl_02%"; $tst_cmd[3]="ncks -C -H --trd --no_blank -s '%f,' -v mss_val %tmp_fl_01%"; $tst_cmd[4]="-999.000000,-999.000000,-999.000000,-999.000000"; $tst_cmd[5]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array ok # ncbo #7 $dsc_sng="_FillValue in one variable (not both variables)"; $tst_cmd[0]="ncrename -h $nco_D_flg -O -v no_mss_val,one_dmn_arr_with_and_without_mss_val $in_pth_arg in.nc %tmp_fl_00%"; $tst_cmd[1]="ncrename -h $nco_D_flg -O -v mss_val,one_dmn_arr_with_and_without_mss_val $in_pth_arg in.nc %tmp_fl_01%"; $tst_cmd[2]="ncbo $omp_flg -h -O $fl_fmt $nco_D_flg -y '-' -v one_dmn_arr_with_and_without_mss_val %tmp_fl_00% %tmp_fl_01% %tmp_fl_02% 2> %tmp_fl_03%"; $tst_cmd[3]="ncks -C -H --trd -d lon,0 -s '%f' -v one_dmn_arr_with_and_without_mss_val %tmp_fl_02%"; $tst_cmd[4]=0.0; $tst_cmd[5]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array ok # ncbo #8 $dsc_sng="ncdiff symbolically linked to ncbo"; $tst_cmd[0]="ncdiff $omp_flg -h -O $fl_fmt $nco_D_flg -d lon,1 -v mss_val $in_pth_arg in.nc in.nc %tmp_fl_00%"; $tst_cmd[1]="ncks -C -H --trd --no_blank -s '%g' -v mss_val %tmp_fl_00%"; $tst_cmd[2]=1.0e36; $tst_cmd[3]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array ok # ncbo #9 $dsc_sng="difference with missing value attribute"; $tst_cmd[0]="ncdiff $omp_flg -h -O $fl_fmt $nco_D_flg -d lon,1 -v mss_val $in_pth_arg in.nc in.nc %tmp_fl_00%"; $tst_cmd[1]="ncks -C -H --trd --no_blank -s '%g' -v mss_val %tmp_fl_00%"; $tst_cmd[2]=1.0e36; $tst_cmd[3]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array ok # ncbo #10 $dsc_sng="Difference without missing value attribute"; $tst_cmd[0]="ncdiff $omp_flg -h -O $fl_fmt $nco_D_flg -d lon,0 -v no_mss_val $in_pth_arg in.nc in.nc %tmp_fl_00%"; $tst_cmd[1]="ncks -C -H --trd -s '%f' -v no_mss_val %tmp_fl_00%"; $tst_cmd[2]="0"; $tst_cmd[3]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array ok # ncbo #11 $dsc_sng="Difference which tests broadcasting and changing variable IDs"; $tst_cmd[0]="ncwa $omp_flg -C -h -O $fl_fmt $nco_D_flg -v rec_var_flt_mss_val_dbl $in_pth_arg in.nc %tmp_fl_03%"; $tst_cmd[1]="ncbo $omp_flg -C -h -O $fl_fmt $nco_D_flg -v rec_var_flt_mss_val_dbl $in_pth/in.nc %tmp_fl_03% %tmp_fl_00%"; $tst_cmd[2]="ncks -C -H --trd -d time,3 -s '%f' -v rec_var_flt_mss_val_dbl %tmp_fl_00%"; $tst_cmd[3]="-1.0"; $tst_cmd[4]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array # ncbo #12 $dsc_sng="Difference which tests 3D broadcasting"; $tst_cmd[0]="ncks -C -O $fl_fmt $nco_D_flg -v three_dmn_var_dbl $in_pth_arg in.nc %tmp_fl_00%"; $tst_cmd[1]="ncap2 -C -O $fl_fmt $nco_D_flg -v -s 'three_dmn_var_dbl[lon]={0.0,1,2,3};' $in_pth_arg in.nc %tmp_fl_01%"; $tst_cmd[2]="ncbo $omp_flg -C -h -O $fl_fmt $nco_D_flg %tmp_fl_00% %tmp_fl_01% %tmp_fl_02%"; $tst_cmd[3]="ncwa $omp_flg -C -h -O $fl_fmt $nco_D_flg -y ttl -v three_dmn_var_dbl %tmp_fl_02% %tmp_fl_03%"; $tst_cmd[4]="ncks -C -H --trd -s '%f' -v three_dmn_var_dbl %tmp_fl_03%"; $tst_cmd[5]="2697"; $tst_cmd[6]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array # ncbo #13 $dsc_sng="Addition + 3D broadcasting+ MSA"; $tst_cmd[0]="ncks -C -O $fl_fmt $nco_D_flg -v three_dmn_var_dbl $in_pth_arg in.nc %tmp_fl_00%"; $tst_cmd[1]="ncap2 -C -O $fl_fmt $nco_D_flg -v -s 'three_dmn_var_dbl[lon]={0.0,1,2,3};' $in_pth_arg in.nc %tmp_fl_01%"; $tst_cmd[2]="ncbo $omp_flg -C -h -O $fl_fmt $nco_D_flg -d time,0,4 -d time,9 -d lon,0 -d lon,3 %tmp_fl_00% %tmp_fl_01% %tmp_fl_02%"; $tst_cmd[3]="ncwa $omp_flg -C -h -O $fl_fmt $nco_D_flg -y ttl -v three_dmn_var_dbl %tmp_fl_02% %tmp_fl_03%"; $tst_cmd[4]="ncks -C -H --trd -s '%f' -v three_dmn_var_dbl %tmp_fl_03%"; $tst_cmd[5]="422"; $tst_cmd[6]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array # ncbo #14 # ncks -O -v three_dmn_rec_var ~/nco/data/in.nc ~/foo.nc # ncbo -O -v three_dmn_rec_var ~/foo.nc ~/foo.nc ~/foo2.nc # ncks -C -H --trd -v three_dmn_rec_var -d time,9,9,1 -d lat,1,1,1 -d lon,3,3,1 ~/foo2.nc $dsc_sng="Copy associated coordinates -v three_dmn_rec_var"; $tst_cmd[0]="ncks -O $fl_fmt $nco_D_flg -v three_dmn_rec_var $in_pth_arg in.nc %tmp_fl_00%"; $tst_cmd[1]="ncbo $omp_flg -O $fl_fmt $nco_D_flg -v three_dmn_rec_var %tmp_fl_00% %tmp_fl_00% %tmp_fl_01%"; $tst_cmd[2]="ncks -C -H --trd -v three_dmn_rec_var -d time,9,9,1 -d lat,1,1,1 -d lon,3,3,1 %tmp_fl_01%"; $tst_cmd[3]="time[9]=10 lat[1]=90 lon[3]=270 three_dmn_rec_var[79]=0"; $tst_cmd[4]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array #ncbo #15 #Operate on files containing same variable in different orders # ncks -O -v time,one ~/nco/data/in.nc ~/foo1.nc # ncks -O -a -v one,time ~/nco/data/in.nc ~/foo2.nc # ncbo -O -p ~ foo1.nc foo2.nc ~/foo3.nc # ncks -C -H --trd -v one ~/foo3.nc $dsc_sng="Concatenate variables with different ID ordering"; $tst_cmd[0]="ncks -h -O $fl_fmt $nco_D_flg -C -v time,one $in_pth_arg in.nc %tmp_fl_00%"; $tst_cmd[1]="ncks -h -O $fl_fmt $nco_D_flg -C -a -v one,time $in_pth_arg in.nc %tmp_fl_01%"; $tst_cmd[2]="ncbo -h -O $fl_fmt $nco_D_flg %tmp_fl_00% %tmp_fl_01% %tmp_fl_02%"; $tst_cmd[3]="ncks -C -H --trd -v one %tmp_fl_02%"; $tst_cmd[4]="one = 0"; $tst_cmd[5]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array ####################################### #### Group tests (requires netCDF4) ### ####################################### if($RUN_NETCDF4_TESTS == 1){ # NCO 4.3.0: added support for groups; ncbo -g #ncbo #16 # ncbo -O -y add -g g4 -v one_dmn_rec_var ~/nco/data/in_grp.nc ~/nco/data/in_grp.nc ~/foo.nc # ncks -C -H --trd -s '%d' -d time,0,0,1 -g g4 -v one_dmn_rec_var ~/foo.nc # /g4/one_dmn_rec_var # time[0]=1 one_dmn_rec_var[0]=2 $dsc_sng="(Groups) Addition -y add -g g4 -v one_dmn_rec_var"; $tst_cmd[0]="ncbo -O $fl_fmt $nco_D_flg -y add -g g4 -v one_dmn_rec_var $in_pth_arg in_grp.nc in_grp.nc %tmp_fl_00%"; $tst_cmd[1]="ncks -C -H --trd -s '%d' -d time,0,0,1 -g g4 -v one_dmn_rec_var %tmp_fl_00%"; $tst_cmd[2]="2"; $tst_cmd[3]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array #ncbo #17 # ncbo -O -y add -g g4 -v one_dmn_rec_var ~/nco/data/in_grp.nc ~/nco/data/in_grp.nc ~/foo.nc # ncks -C -H --trd -s '%d' -d time,0,0,1 -g g4 -v one_dmn_rec_var ~/foo.nc # /g4/one_dmn_rec_var $dsc_sng="(Groups) Addition with limits -d time,1,1,1 -y add -g g4 -v one_dmn_rec_var"; $tst_cmd[0]="ncbo -O $fl_fmt $nco_D_flg -d time,1,1,1 -y add -g g4 -v one_dmn_rec_var $in_pth_arg in_grp.nc in_grp.nc %tmp_fl_00%"; $tst_cmd[1]="ncks -C -H --trd -s '%d' -d time,0,0,1 -g g4 -v one_dmn_rec_var %tmp_fl_00%"; $tst_cmd[2]="4"; $tst_cmd[3]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array #ncbo #18 # ncbo -O -v one_dmn_rec_var ~/nco/data/in_grp.nc ~/nco/data/in_grp.nc ~/foo.nc # ncks -C -H --trd -s '%d' -d time,0,0,1 -g g4 -v one_dmn_rec_var ~/foo.nc # /g4/one_dmn_rec_var $dsc_sng="(Groups) Subtraction -v one_dmn_rec_var"; $tst_cmd[0]="ncbo -O $fl_fmt $nco_D_flg -v one_dmn_rec_var $in_pth_arg in_grp.nc in_grp.nc %tmp_fl_00%"; $tst_cmd[1]="ncks -C -H --trd -s '%d' -d time,1,1,1 -g g4 -v one_dmn_rec_var %tmp_fl_00%"; $tst_cmd[2]="0"; $tst_cmd[3]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array #ncbo #19 # ncbo -O -y mlt -g g4 -v one_dmn_rec_var ~/nco/data/in_grp.nc ~/nco/data/in_grp.nc ~/foo.nc # ncks -C -H --trd -s '%d' -d time,0,0,1 -g g4 -v one_dmn_rec_var ~/foo.nc # /g4/one_dmn_rec_var $dsc_sng="(Groups) Multiplication with limits -d time,2,2,1 -y add -g g4 -v one_dmn_rec_var"; $tst_cmd[0]="ncbo -O $fl_fmt $nco_D_flg -d time,2,2,1 -y mlt -g g4 -v one_dmn_rec_var $in_pth_arg in_grp.nc in_grp.nc %tmp_fl_00%"; $tst_cmd[1]="ncks -C -H --trd -s '%d' -d time,0,0,1 -g g4 -v one_dmn_rec_var %tmp_fl_00%"; $tst_cmd[2]="9"; $tst_cmd[3]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array #ncbo #20 # ncbo -O -y mlt -g g4 -v one_dmn_rec_var ~/nco/data/in_grp.nc ~/nco/data/in_grp.nc ~/foo.nc # ncks -C -H --trd -s '%d' -d time,0,0,1 -g g4 -v one_dmn_rec_var ~/foo.nc # /g4/one_dmn_rec_var $dsc_sng="(Groups) Division with limits -d time,2,2,1 -y add -g g4 -v one_dmn_rec_var"; $tst_cmd[0]="ncbo -O $fl_fmt $nco_D_flg -d time,2,2,1 -y dvd -g g4 -v one_dmn_rec_var $in_pth_arg in_grp.nc in_grp.nc %tmp_fl_00%"; $tst_cmd[1]="ncks -C -H --trd -s '%d' -d time,0,0,1 -g g4 -v one_dmn_rec_var %tmp_fl_00%"; $tst_cmd[2]="1"; $tst_cmd[3]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array # Following tests: Different objects in both files with groups (ensembles, not ensembles) # Absolute match test # Absolute match test # ncbo #21 # ncbo -O in_grp_1.nc in_grp_2.nc ~/foo.nc $dsc_sng="(Groups) Process absolute match variables -v var1 in_grp_1.nc in_grp_2.nc"; $tst_cmd[0]="ncbo -O $fl_fmt $nco_D_flg $in_pth_arg in_grp_1.nc in_grp_2.nc %tmp_fl_00%"; $tst_cmd[1]="ncks -C --trd -v var1 %tmp_fl_00%"; $tst_cmd[2]="lon[3]=4 var1[3]=-1"; $tst_cmd[3]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array # ncbo #22 # ncbo -O -v var1 in_grp_1.nc in_grp_2.nc ~/foo.nc $dsc_sng="(Groups) Process absolute match variables -v var1 in_grp_1.nc in_grp_2.nc"; $tst_cmd[0]="ncbo -O $fl_fmt $nco_D_flg -v var1 $in_pth_arg in_grp_1.nc in_grp_2.nc %tmp_fl_00%"; $tst_cmd[1]="ncks -C --trd %tmp_fl_00%"; $tst_cmd[2]="lon[3]=4 var1[3]=-1"; $tst_cmd[3]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array # ncbo #23 #ncbo -O --op_typ=add mdl_1.nc mdl_2.nc ~/foo.nc #ncks -C --trd -g cesm_01 -v tas1 ~/foo.nc # 544.4 = (file 1 tas1) 272.1 + (file 2 tas1) 272.3 $dsc_sng="(Groups) Process ensembles in both files mdl_1.nc mdl_2.nc"; $tst_cmd[0]="ncbo -O --op_typ=add $fl_fmt $nco_D_flg $in_pth_arg mdl_1.nc mdl_2.nc %tmp_fl_00%"; $tst_cmd[1]="ncks -C --trd -g cesm_01 -v tas1 %tmp_fl_00%"; $tst_cmd[2]="time[3]=4 tas1[3]=544.4"; $tst_cmd[3]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array # ncbo #24 #ncbo -O mdl_1.nc mdl_2.nc ~/foo.nc #ncks --trd -g cesm_01 -v time ~/foo.nc $dsc_sng="(Groups) Process ensembles in both files mdl_1.nc mdl_2.nc (check fixed variables)"; $tst_cmd[0]="ncbo -O $fl_fmt $nco_D_flg $in_pth_arg mdl_1.nc mdl_2.nc %tmp_fl_00%"; $tst_cmd[1]="ncks --trd -g cesm_01 -v time %tmp_fl_00%"; $tst_cmd[2]="time[3]=4"; $tst_cmd[3]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array # ncbo #25 #ncbo -O --op_typ=add mdl_1.nc obs.nc ~/foo.nc #ncks -C --trd -g cesm_01 -v tas1 ~/foo.nc # 544.1 = (file 1 tas1) 272.1 + (file 2 tas1) 273.0 $dsc_sng="(Groups) Process ensembles in file 1 with common variable at root in file 2"; $tst_cmd[0]="ncbo -O --op_typ=add $fl_fmt $nco_D_flg $in_pth_arg mdl_1.nc obs.nc %tmp_fl_00%"; $tst_cmd[1]="ncks -C --trd -g cesm_01 -v tas1 %tmp_fl_00%"; $tst_cmd[2]="time[3]=4 tas1[3]=545.1"; $tst_cmd[3]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array # ncbo #26 #ncbo -O mdl_1.nc obs.nc ~/foo.nc #ncks --trd -g ecmwf_01 -v time $dsc_sng="(Groups) Process ensembles in file 1 with common variable at root in file 2 (check fixed variables)"; $tst_cmd[0]="ncbo -O $fl_fmt $nco_D_flg $in_pth_arg mdl_1.nc obs.nc %tmp_fl_00%"; $tst_cmd[1]="ncks --trd -g ecmwf_01 -v time %tmp_fl_00%"; $tst_cmd[2]="time[3]=4"; $tst_cmd[3]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array # ncbo #ncbo -O --op_typ=add obs.nc mdl_1.nc ~/foo.nc #ncks -C --trd -g cesm_01 -v tas1 ~/foo.nc # 544.1 = (file 1 tas1) 273.0 + (file 2 tas1) 272.1 #FXM ncbo group broadcasting, "time" dimension is created at root because conflicting logic in nco_prc_cmn() uses # both RNK_1_GTR and table flag of file 1 or 2 # result is time[3] instead of time[3]=4 if(0) { $dsc_sng="(Groups) Process ensembles in file 2 with common variable at root in file 1"; $tst_cmd[0]="ncbo -O --op_typ=add $fl_fmt $nco_D_flg $in_pth_arg obs.nc mdl_1.nc %tmp_fl_00%"; $tst_cmd[1]="ncks -C --trd -g cesm_01 -v tas1 %tmp_fl_00%"; $tst_cmd[2]="time[3]=4 tas1[3]=545.1"; $tst_cmd[3]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array } # ncbo #27 #ncbo -O cmip5.nc obs.nc ~/foo.nc #ncks -C --trd -g ecmwf -v tas1 ~/foo.nc # obs.nc tas1=273, cmip5.nc giss tas1=274 $dsc_sng="(Groups) Process relative matches, first file greater (cmip5.nc obs.nc)"; $tst_cmd[0]="ncbo -O $fl_fmt $nco_D_flg $in_pth_arg cmip5.nc obs.nc %tmp_fl_00%"; $tst_cmd[1]="ncks -C --trd -g giss -v tas1 %tmp_fl_00%"; $tst_cmd[2]="time[3]=4 tas1[3]=1"; $tst_cmd[3]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array # ncbo #28 #ncbo -O obs.nc cmip5.nc ~/foo.nc #ncks -C --trd -g ecmwf -v tas1 ~/foo.nc # obs.nc tas1=273, cmip5.nc giss tas1=274 $dsc_sng="(Groups) Process relative matches, second file greater (obs.nc cmip5.nc)"; $tst_cmd[0]="ncbo -O $fl_fmt $nco_D_flg $in_pth_arg obs.nc cmip5.nc %tmp_fl_00%"; $tst_cmd[1]="ncks -C --trd -g giss -v tas1 %tmp_fl_00%"; $tst_cmd[2]="time[3]=4 tas1[3]=-1"; $tst_cmd[3]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array # ncbo #29 #ncbo ensemble with 1 member #ncra -Y ncge -O mdl_3.nc ncge_out.nc #ncbo -O --op_typ=add ncge_out.nc mdl_3.nc ~/foo.nc #ncks -H --trd -C -g cesm_01 -v tas1 ~/foo.nc #ncge_out.nc = #/cesm/tas1 #time[0]=1 tas1[0]=272.15 #mdl_3.nc = #/cesm/cesm_01/tas1 #time[0]=1 tas1[0]=272.1 #result = # 544.25 = 272.15 + 272.1 $dsc_sng="(Groups) Ensemble with 1 member (mdl_3.nc)"; $tst_cmd[0]="ncra -Y ncge -O $fl_fmt $nco_D_flg $in_pth_arg mdl_3.nc %tmp_fl_00%"; $tst_cmd[1]="ncbo --op_typ=add -O $fl_fmt $nco_D_flg %tmp_fl_00% $in_pth/mdl_3.nc %tmp_fl_01%"; $tst_cmd[2]="ncks -H --trd -C -g cesm_01 -v tas1 %tmp_fl_01%"; $tst_cmd[3]="time[3] tas1[3]=544.25"; $tst_cmd[4]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array } # end RUN_NETCDF4_TESTS #################### #### nces tests #### - OK ! #################### $opr_nm='nces'; #################### #nces #01 $tst_cmd[0]="ncra -Y ncfe $omp_flg -h -O $fl_fmt $nco_D_flg -v one_dmn_rec_var -d time,4 $in_pth_arg in.nc in.nc %tmp_fl_00%"; $tst_cmd[1]="ncks -C -H --trd -s '%d' -v one_dmn_rec_var %tmp_fl_00%"; $dsc_sng="ensemble mean of int across two files"; $tst_cmd[2]="5"; $tst_cmd[3]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array #nces #02 $tst_cmd[0]="ncra -Y ncfe $omp_flg -h -O $fl_fmt $nco_D_flg -y ttl -v mss_val_scl $in_pth_arg in.nc in.nc %tmp_fl_00%"; $tst_cmd[1]="ncks -C -H --trd --no_blank -s '%g' -v mss_val_scl %tmp_fl_00%"; $dsc_sng="ensemble sum of missing value across two files"; $tst_cmd[2]="1.0e36"; $tst_cmd[3]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array #nces #03 $tst_cmd[0]="ncra -Y ncfe $omp_flg -h -O $fl_fmt $nco_D_flg -v rec_var_flt_mss_val_flt -d time,0 $in_pth_arg in.nc in.nc %tmp_fl_00%"; $tst_cmd[1]="ncks -C -H --trd --no_blank -s '%g' -v rec_var_flt_mss_val_flt %tmp_fl_00%"; $dsc_sng="ensemble mean with missing values across two files"; $tst_cmd[2]="1.0e36"; $tst_cmd[3]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array #nces #04 $tst_cmd[0]="/bin/rm -f %tmp_fl_00%"; $tst_cmd[1]="ncra -Y ncfe $omp_flg -h -O $fl_fmt $nco_D_flg -y min -v rec_var_flt_mss_val_dbl -d time,1 $in_pth_arg in.nc in.nc %tmp_fl_00%"; $tst_cmd[2]="ncks -C -H --trd -s '%e' -v rec_var_flt_mss_val_dbl %tmp_fl_00%"; $dsc_sng="ensemble min of float across two files"; $tst_cmd[3]="2"; $tst_cmd[4]="NO_SS"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array #nces #05 $tst_cmd[0]="/bin/rm -f %tmp_fl_00%"; $tst_cmd[1]="ncra -Y ncfe $omp_flg -h -O $fl_fmt $nco_D_flg -C -v pck $in_pth_arg in.nc %tmp_fl_00%"; $tst_cmd[2]="ncks -C -H --trd -s '%e' -v pck %tmp_fl_00%"; $dsc_sng="scale factor + add_offset packing/unpacking"; $tst_cmd[3]="3"; $tst_cmd[4]="NO_SS"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array #nces #06 $tst_cmd[0]="/bin/rm -f %tmp_fl_00%"; $tst_cmd[1]="ncra -Y ncfe $omp_flg -h -O $fl_fmt $nco_D_flg -v rec_var_int_mss_val_int $in_pth_arg in.nc in.nc %tmp_fl_00%"; $tst_cmd[2]="ncks -C -H --trd --no_blank -s '%d ' -v rec_var_int_mss_val_int %tmp_fl_00%"; $dsc_sng="ensemble mean of integer with integer missing values across two files"; $tst_cmd[3]="-999 2 3 4 5 6 7 8 -999 -999"; $tst_cmd[4]="NO_SS"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array #nces #07 $tst_cmd[0]="/bin/rm -f %tmp_fl_00%"; $tst_cmd[1]="ncra -Y ncfe $omp_flg -h -O $fl_fmt $nco_D_flg -C -d time,0,2 -d lon,0 -d lon,3 -v three_dmn_var_dbl $in_pth_arg in.nc in.nc %tmp_fl_00%"; $tst_cmd[2]="ncwa $omp_flg -C -h -O $fl_fmt $nco_D_flg -y ttl -v three_dmn_var_dbl %tmp_fl_00% %tmp_fl_01%"; $tst_cmd[3]="ncks -C -H --trd -s '%3.f' -v three_dmn_var_dbl %tmp_fl_01%"; $dsc_sng="ensemble mean of 3D variable across two files with MSA"; $tst_cmd[4]="150"; $tst_cmd[5]="NO_SS"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array #nces #08 $tst_cmd[0]="/bin/rm -f %tmp_fl_00%"; $tst_cmd[1]="ncra -Y ncfe $omp_flg -h -O $fl_fmt $nco_D_flg -C $in_pth_arg lrg_bm.nc lrg_bm1.nc %tmp_fl_00%"; $tst_cmd[2]="ncra -Y ncfe -t 1 -h -O $fl_fmt $nco_D_flg -C $in_pth_arg lrg_bm.nc lrg_bm1.nc %tmp_fl_01%"; $tst_cmd[3]="ncbo -C -h -O %tmp_fl_00% %tmp_fl_01% %tmp_fl_02%"; $tst_cmd[4]="ncwa -t 1 -O -C %tmp_fl_02% %tmp_fl_03% 2>%tmp_fl_05%"; $dsc_sng="Check op with OpenMP"; # $tst_cmd[5]="ncks -C -H --trd -s '%d' -v R %tmp_fl_03%"; $tst_cmd[5]="ncap2 -t 1 -h -v -O -s 'n2= ((fabs(R)<0.01) && (fabs(S)<0.01) && (fabs(T)<0.01) && (fabs(U)<0.01) && (fabs(V)<0.01) && (fabs(W)<0.01) && (fabs(X)<0.01));print(n2)' %tmp_fl_03% %tmp_fl_04%"; $tst_cmd[6]="n2 = 1"; $tst_cmd[7]="NO_SS"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array #nces #09 $tst_cmd[0]="ncra -Y ncfe $omp_flg -h -O $fl_fmt $nco_D_flg -v pck_7 $in_pth_arg in.nc in.nc in.nc %tmp_fl_00%"; $tst_cmd[1]="ncks -C -H --trd -s '%f' -v pck_7 %tmp_fl_00%"; $dsc_sng="Ensemble mean of variable packed with netCDF convention across three files"; $tst_cmd[2]="7"; $tst_cmd[3]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array #nces #10 $tst_cmd[0]="ncra -Y ncfe $omp_flg -h -O $fl_fmt $nco_D_flg --hdf_upk -v pck_7 $in_pth_arg in.nc in.nc in.nc %tmp_fl_00%"; $tst_cmd[1]="ncks -C -H --trd -s '%f' -v pck_7 %tmp_fl_00%"; $dsc_sng="Ensemble mean of variable packed with HDF convention across three files"; $tst_cmd[2]="-8"; $tst_cmd[3]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array ####################################### #### Group tests (requires netCDF4) ### ####################################### if($RUN_NETCDF4_TESTS == 1){ #nces #11 # same as #nces #01 , with group $tst_cmd[0]="ncra -Y ncfe $omp_flg -h -O $fl_fmt $nco_D_flg -g g4 -v one_dmn_rec_var -d time,4 $in_pth_arg in_grp.nc in_grp.nc %tmp_fl_00%"; $tst_cmd[1]="ncks -C -H --trd -s '%d' -g g4 -v one_dmn_rec_var %tmp_fl_00%"; $dsc_sng="(Groups) ensemble mean of int across two files"; $tst_cmd[2]="5"; $tst_cmd[3]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array #nces #12 # 2 groups, each one with a record (part 1) # ncra -Y nces -h -O -g g25g1,g25g2 -v one_dmn_rec_var -d time,4 in_grp_3.nc in_grp_3.nc ~/foo.nc $tst_cmd[0]="ncra -Y ncfe $omp_flg -h -O $fl_fmt $nco_D_flg -g g25g1,g25g2 -v one_dmn_rec_var -d time,4 $in_pth_arg in_grp_3.nc in_grp_3.nc %tmp_fl_00%"; $tst_cmd[1]="ncks -C -H --trd -s '%d' -g g25g1 -v one_dmn_rec_var %tmp_fl_00%"; $dsc_sng="(Groups) 2 groups ensemble mean of int across two files (part 1)"; $tst_cmd[2]="5"; $tst_cmd[3]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array #nces #13 # 2 groups, each one with a record (part 2) # ncra -Y nces -h -O -g g25g1,g25g2 -v one_dmn_rec_var -d time,4 in_grp_3.nc in_grp_3.nc ~/foo.nc $tst_cmd[0]="ncra -Y ncfe $omp_flg -h -O $fl_fmt $nco_D_flg -g g25g1,g25g2 -v one_dmn_rec_var -d time,4 $in_pth_arg in_grp_3.nc in_grp_3.nc %tmp_fl_00%"; $tst_cmd[1]="ncks -C -H --trd -s '%d' -g g25g2 -v one_dmn_rec_var %tmp_fl_00%"; $dsc_sng="(Groups) 2 groups ensemble mean of int across two files (part 2)"; $tst_cmd[2]="5"; $tst_cmd[3]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array } # #### Group File tests #nces #14 # TODO #for i in $(seq -w 0 999) ; do iii=$(printf "%03d" ${i}) ; ln in.nc foo${iii}.nc ; done # TO DO run bash script above by perl $tst_cmd[0]="ncra -Y ncfe $omp_flg -h -O $fl_fmt $nco_D_flg -v dgn_var $in_pth_arg in.nc in.nc in.nc %tmp_fl_00%"; $tst_cmd[1]="ncks --trd %tmp_fl_00%"; $dsc_sng="Test file loop"; $tst_cmd[2]="dgn[0]=73 dgn_var[0]=73"; $tst_cmd[3]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array ####################################### #### Group tests (requires netCDF4) ### ####################################### if($RUN_NETCDF4_TESTS == 1){ #nces #15 # ncra -Y ncge -h -O mdl_1.nc ~/foo.nc # ncks -C --trd -g cesm -v tas1 ~/foo.nc $tst_cmd[0]="ncra -Y ncge $omp_flg -h -O $fl_fmt $nco_D_flg $in_pth_arg mdl_1.nc %tmp_fl_00%"; $tst_cmd[1]="ncks -C --trd -g cesm -v tas1 %tmp_fl_00%"; $dsc_sng="(Groups) 1 file mdl_1.cdl ensemble"; $tst_cmd[2]="time[3]=4 tas1[3]=272.15"; $tst_cmd[3]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array #nces #16 $tst_cmd[0]="ncra -Y ncge $omp_flg -h -O --nsm_sfx=_avg $fl_fmt $nco_D_flg $in_pth_arg mdl_1.nc %tmp_fl_00%"; $tst_cmd[1]="ncks -C --trd -g cesm_avg -v tas1 %tmp_fl_00%"; $dsc_sng="(Groups) 1 file mdl.cdl --nsm_sfx suffix ensemble"; $tst_cmd[2]="time[3]=4 tas1[3]=272.15 "; $tst_cmd[3]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array #nces #17 # ncra -Y ncge -h -O -G /gpe_grp mdl_1.nc ~/foo.nc $tst_cmd[0]="ncra -Y ncge $omp_flg -h -O -G /gpe_grp $fl_fmt $nco_D_flg $in_pth_arg mdl_1.nc %tmp_fl_00%"; $tst_cmd[1]="ncks -C --trd -g /gpe_grp/ecmwf -v tas1 %tmp_fl_00%"; $dsc_sng="(Groups) GPE 1 file mdl_1.cdl ensemble"; $tst_cmd[2]="time[3]=4 tas1[3]=273.15 "; $tst_cmd[3]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array #nces #18 #ncra -Y ncge -O mdl_1.nc mdl_2.nc ~/foo.nc $dsc_sng="(Groups) Two-file ensembles"; $tst_cmd[0]="ncra -Y ncge $omp_flg -h -O $fl_fmt $nco_D_flg $in_pth_arg mdl_1.nc mdl_2.nc %tmp_fl_00%"; $tst_cmd[1]="ncks -C --trd -g ecmwf -v tas1 %tmp_fl_00%"; $tst_cmd[2]="time[3]=4 tas1[3]=273.25"; $tst_cmd[3]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array #nces #19 (check coordinate variables) # ncra -Y ncge -h -O ~/nco/data/mdl_1.nc ~/foo.nc # ncks -g cesm -v time ~/foo.nc # NB: This test succeeds when it fails, i.e., the NCO command fails as it should because the input files do not conform $dsc_sng="(Groups) Ensemble record coordinate variables"; $tst_cmd[0]="ncra -Y ncge $omp_flg -h -O $fl_fmt $nco_D_flg $in_pth_arg mdl_1.nc %tmp_fl_00%"; $tst_cmd[1]="ncks -m --trd --cdl -g cesm -v time %tmp_fl_00% | grep UNLIMITED"; $tst_cmd[2]=" time = UNLIMITED ; // (4 currently)"; $tst_cmd[3]="SS_OK"; NCO_bm::tst_run(\@tst_cmd); $#tst_cmd=0; # Reset array #nces #20 (error checking of ensemble variable dimensions) # ncra -Y ncge -O in_grp_4.nc in_grp_5.nc ~/foo.nc $dsc_sng="(Groups) (expect ERROR, correct behavior is to fail/abort) Die on invalid input since dimensions do not conform between ensemble variables"; $tst_cmd[0]="ncra -Y ncge $omp_flg -h -O $fl_fmt $nco_D_flg $in_pth_arg in_grp_4.nc in_grp_5.nc %tmp_fl_00%"; $tst_cmd[1]="ncge: ERROR Variables do not conform: variable has dimension // ID=1 index [1]: // ID=2 index [0]: // ID=3 index [1]: // ID=4 index [1]: // // group: g3 { dimensions: rlev=3; variables: :g3_group_attribute = "g3_group_attribute"; //coordinate variable (/g3/rlev) float rlev(rlev); rlev:purpose = "Monotonically decreasing coordinate pressure"; float rz(rlev); float scl; data: rz=0,5000,17000; scl=1.3; rlev=1000.,500.,100.; group: g3g1 { variables: float prs(rlev); prs:long_name="reverse pressure"; data: prs=1.0,10.0,100.0; } // end g3g1 } // end g3 // //g5 // group: g5 { // Level 1 dimensions: rlev=3; variables: //coordinate variable (/g5/rlev) float rlev(rlev); data: rlev=10.,5.,1.; group: g5g1 { // Level 2 variables: float rz(rlev); data: rz=1,2,3; } //end g5g1 } // end g5 // //g8 test ncwa in groups // group: g8 { dimensions: lon=2,lev=3,vrt_nbr=2; variables: //coordinate variable (/g8/lon) float lon(lon); //coordinate variable (/g8/lev) float lev(lev); lev:bounds = "lev_bnd"; //coordinate variable (/g8/vrt_nbr) float vrt_nbr(vrt_nbr); float lev_bnd(lev,vrt_nbr); float lev_wgt(lev); data: lon=-180,0; lev=100,500,1000; lev_bnd=0,300,300,750,750,1013.25; vrt_nbr=1,2; lev_wgt=9,2,1; } // end g8 //g16 // Test variables and dimensions in and out of scope // Use case of variable in scope of dimension: // dimension /lon // variable /g1/lon(lon) // Use case of variable NOT in scope of dimension: // variable /lon // dimension /g1/lon // Test dimensions with no associated coordinate variable group: g16 { dimensions: lat=2; lon1=4; // dimension that has a coordinate variable down in scope at /g16/g16g1/lon1(lon1) lon2=4; // dimension that does NOT have a coordinate variable anywhere lon3=4; // dimension that has a coordinate "out of scope" (with group depth greater than the variable that uses the coordinate, g16g3g3) lon4=2; // dimension that has several intermediate "in scope" coordinates lat4=2; variables: float lat1(lat); float lon2_var(lon2); //variable with no associated coordinate variable float blon2; float blat3; data: lat1=0.,1.; lon2_var=0.,1.,2.,3.; blon2=8.0; blat3=3.0; group: g16g1 { dimensions: lat1=2; //dimension that has a variable /lat1 down in *illegal* scope variables: // MSA test -v lon1_var -d lon1,3.0, result is 3. float lon1(lon1); //coordinate variable /g16/g16g1/lon1 that has dimension (/g16/lon1) in scope float lon1_var(lon1); // variable /g16/g16g1/lon1_var that has dimension (/g16/lon1) in scope *and* coordinate (/g16/g16g1/lon1) in scope float blat4; data: lon1=0.,1.,2.,3.; lon1_var=0.,1.,2.,3.; blat4=4.0; } // end g16g1 group: g16g2 { dimensions: variables: //coordinate variable (/g16/lon1) float lon1(lon1); // MSA test -v lon1_var -d lon1,3.0, result is 0.,1.,2.,3. float lon1_var(lon1); // data: lon1=3.,4.,5.,6.; lon1_var=0.,1.,2.,3.; } // end g16g2 group: g16g3 { variables: float lon3_var(lon3); data: lon3_var=0.,1.,2.,3.; group: g16g3g1 { variables: //coordinate "out of scope" (with group depth greater than the variable that uses the coordinate, in g16g3) float lon3(lon3); data: lon3=7.,8.,9.,10.; } // end g16g3g1 } // end g16g3 group: g16g4 { variables: // intermediate "in scope" coordinate float lon4(lon4); float blon3; data: lon4=1.,2.; blon3=8.0; group: g16g4g1 { variables: // intermediate "in scope " coordinate float lon4(lon4); data: lon4=3.,4.; group: g16g4g1g1 { variables: // variable that uses one of the intermediate "in scope" coordinates float blon4; float blat2; float lon4_var(lon4); // check retrieval of bounds var(s) -scope, scope, absolute path, relative path lon4_var:bounds="blon4 blon3 /g16/blon2 ../g16g4g1g1/g16g4g1g1g1/blon1"; data: blon4=10.0; blat2=2.0; lon4_var=0.,1.; group: g16g4g1g1g1 { variables: float lat4_var(lat4); // check retrieval of "coordinate vars" current directory, relative path, absolute path, absolute path lat4_var:coordinates="./blat1 ../blat2 /g16/blat3 /g16/g16g1/blat4"; float blon1; float blat1; data: lat4_var=10.0,11.0; blon1=1.0; blat1=1.0; } // end g16g4g1g1g1 } // end g16g4g1g1 } // end g16g4g1 } // end g16g4 } // end g16 // //g18 // group: g18 { :Conventions = "CF-1.0"; dimensions: time=unlimited; // NB: no coordinate for this dimension gds_crd=8; variables: double lat_gds_1(gds_crd); lat_gds_1:long_name = "Latitude"; lat_gds_1:standard_name = "latitude"; lat_gds_1:units="degree"; lat_gds_1:purpose = "1-D latitude coordinate referred to by geodesic grid variables"; double lon_gds_1(gds_crd); lon_gds_1:long_name = "Longitude"; lon_gds_1:standard_name = "longitude"; lon_gds_1:units="degree"; lon_gds_1:purpose = "1-D longitude coordinate referred to by geodesic grid variables"; float gds_crd(gds_crd); gds_crd:long_name = "Geodesic coordinate"; gds_crd:units = "degree"; gds_crd:purpose = "enumerated coordinate like those that might define points in a geodesic grid"; gds_crd:coordinates = "lat_gds_1 lon_gds_1"; float gds_3dvar(time,gds_crd); gds_3dvar:long_name = "Geodesic variable"; gds_3dvar:units = "meter"; gds_3dvar:coordinates = "lat_gds_1 lon_gds_1"; gds_3dvar:purpose = "Test auxiliary coordinates like those that define geodesic grids"; data: gds_crd=0,1,2,3,4,5,6,7; gds_3dvar=273.1,273.2,273.3,273.4,273.5,273.6,273.7,273.8, 274.1,274.2,274.3,274.4,274.5,274.6,274.7,274.8, 275.1,275.2,275.3,275.4,275.5,274.5,275.7,275.8, 276.1,276.2,276.3,276.4,276.5,276.5,276.7,276.8, 277.1,277.2,277.3,277.4,277.5,277.5,277.7,277.8, 278.1,278.2,278.3,278.4,278.5,278.6,278.7,278.8, 279.1,279.2,279.3,279.4,279.5,279.9,279.7,279.8, 280.1,280.2,280.3,280.4,280.5,280.9,280.7,280.8, 281.1,281.2,281.3,281.4,281.5,281.9,281.7,281.8, 282.1,282.2,282.3,282.4,282.5,282.9,282.7,282.8; lat_gds_1=-90, -30, -30, 0, 0, 30, 30, 90; lon_gds_1= 0, 0, 180, 0, 180, 0, 180, 0; group: g18g1 { //test -X with "lat_gds lon_gds" in scope :Conventions = "CF-1.0"; variables: float gds_3dvar(time,gds_crd); gds_3dvar:long_name = "Geodesic variable"; gds_3dvar:units = "meter"; gds_3dvar:coordinates = "lat_gds_1 lon_gds_1"; gds_3dvar:purpose = "Test auxiliary coordinates like those that define geodesic grids"; data: gds_3dvar=273.1,273.2,273.3,273.4,273.5,273.6,273.7,273.8, 274.1,274.2,274.3,274.4,274.5,274.6,274.7,274.8, 275.1,275.2,275.3,275.4,275.5,274.5,275.7,275.8, 276.1,276.2,276.3,276.4,276.5,276.5,276.7,276.8, 277.1,277.2,277.3,277.4,277.5,277.5,277.7,277.8, 278.1,278.2,278.3,278.4,278.5,278.6,278.7,278.8, 279.1,279.2,279.3,279.4,279.5,279.9,279.7,279.8, 280.1,280.2,280.3,280.4,280.5,280.9,280.7,280.8, 281.1,281.2,281.3,281.4,281.5,281.9,281.7,281.8, 282.1,282.2,282.3,282.4,282.5,282.9,282.7,282.8; group: g18g2 { variables: double lat_gds_2(gds_crd); lat_gds_2:long_name = "Latitude"; lat_gds_2:standard_name = "latitude"; lat_gds_2:units="degree"; lat_gds_2:purpose = "1-D latitude coordinate referred to by geodesic grid variables"; double lon_gds_2(gds_crd); lon_gds_2:long_name = "Longitude"; lon_gds_2:standard_name = "longitude"; lon_gds_2:units="degree"; lon_gds_2:purpose = "1-D longitude coordinate referred to by geodesic grid variables"; data: lat_gds_2=-90, -30, -30, 0, 0, 30, 30, 90; lon_gds_2= 0, 0, 180, 0, 180, 0, 180, 0; } // end g18g2 } // end g18g1 } // end g18 // //g19 test cases for ncpdq; same variables as ncpdq netCDF3 tests // group: g19 { dimensions: lat=2; lev=3; lon=4; time=unlimited; variables: float lat(lat); float lon(lon); float lev(lev); float lev_wgt(lev); double time(time); data: lat=-90,90; lon=0,90,180,270; lev=100,500,1000; lev_wgt=10,2,1; time=1.,2.,3.,4.,5.,6.,7.,8.,9.,10.; group: g19g1 { variables: float two_dmn_var(lat,lev); two_dmn_var:long_name = "two dimensional variable"; two_dmn_var:units = "fraction"; data: two_dmn_var=1.5,5.5,9.5,13.5,17.5,21.5; } // end g19g1 group: g19g2 { variables: float two_dmn_rec_var(time,lev); two_dmn_rec_var:long_name = "two dimensional record variable"; two_dmn_rec_var:units = "watt meter-2"; data: two_dmn_rec_var=1.,2.0,3., 1.,2.1,3., 1.,2.2,3., 1.,2.3,3., 1.,2.4,3., 1.,2.5,3., 1.,2.6,3., 1.,2.7,3., 1.,2.8,3., 1.,2.9,3.; } // end g19g2 group: g19g3 { variables: double three_dmn_var_dbl(time,lat,lon); three_dmn_var_dbl:long_name = "three dimensional record variable of type double"; three_dmn_var_dbl:units = "watt meter-2"; three_dmn_var_dbl:_FillValue = -99.; data: three_dmn_var_dbl= 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16, 17,18,19,20,21,22,23,24, -99,-99,-99,-99,-99,-99,-99,-99, 33,34,35,36,37,38,39,40, 41,42,43,44,45,46,47,48, 49,50,51,52,53,54,55,56, -99,58,59,60,61,62,63,64, 65,66,67,68,69,70,71,72, -99,74,75,76,77,78,79,-99; } // end g19g3 group: g19g4 { variables: short rec_var_dbl_mss_val_dbl_pck(time); rec_var_dbl_mss_val_dbl_pck:long_name = "record variable, double, packed as short, with double missing values"; rec_var_dbl_mss_val_dbl_pck:purpose = "Packed version of rec_var_dbl_mss_val_dbl_upk"; rec_var_dbl_mss_val_dbl_pck:_FillValue = -999s; rec_var_dbl_mss_val_dbl_pck:missing_value = -999.; rec_var_dbl_mss_val_dbl_pck:scale_factor = -9.15541313801785e-05; rec_var_dbl_mss_val_dbl_pck:add_offset = 5.; double upk; upk:long_name = "Unpacked scalar variable"; upk:note = "Unpacked value is 3.0d0, upk=unpack(pck)= 2.0d0*1s + 1.0d0 = 3.0d0. Packing this variable should create an NC_SHORT scalar = 0s with packing attribute add_offset=3.0d and either no scale_factor (ncap) or scale_factor = 0.0d (ncpdq)."; data: upk=3.; rec_var_dbl_mss_val_dbl_pck=-999,32767,21845,10922,0,-10922,-21845,-32767,-999,-999; } // end g19g4 } // end g19 // //g20 test cases for ncwa; same variables as ncwa netCDF3 tests // group: g20 { dimensions: lat=2; variables: float lat(lat); float lat_wgt(lat); data: lat=-90,90; lat_wgt=1.,2.; group: g20g1 { variables: float lat_cpy(lat); float lat_wgt(lat); data: lat_cpy=-90,90; lat_wgt=1.,0.; } // end g20g1 } //g20 // // prototype problem from ACCESS // group: g21 { dimensions: lat=2; lon=4; variables: float lat(lat); lat:units = "degrees_north"; float lon(lon); lon:units = "degrees_east"; float snc(lat,lon); snc:long_name = "Snow Cover"; data: lat=-45,45; lon=0,90,180,270; snc=1,2,3,4,5,6,7,8; } // end g21 // // prototype problem from ACCESS // group: g22 { dimensions: lat=3; lon=3; variables: float lat(lat); lat:units = "degrees_north"; float lon(lon); lon:units = "degrees_east"; float snc(lat,lon); snc:long_name = "Snow Cover"; data: lat=-60,0,60; lon=0,120,240; snc=1,2,3,4,5,6,7,8,9; } // end g22 group: g90 { dimensions: dim90=2; variables: int g9(dim90); data: g9=1,2; } // end g90 // // ncra test case // group: g23 { dimensions: lat=2; lon=3; time=unlimited; variables: float lat(lat); lat:units = "degrees_north"; float lon(lon); lon:units = "degrees_east"; double time(time); float snd(time,lat,lon); snd:long_name = "Snow Depth timeseries"; data: lat=-60,0; lon=0,120,240; time=1,2; snd=1,2,3,4,5,6,7,8,9,10,11,12; } // end g23 // // ncra test case // group: g24 { dimensions: lat=2; lon=3; time=unlimited; variables: float lat(lat); lat:units = "degrees_north"; float lon(lon); lon:units = "degrees_east"; double time(time); float snd(time,lat,lon); snd:long_name = "Snow Depth timeseries"; data: lat=-60,0; lon=0,120,240; time=4; snd=1,2,3,4,5,6; } // end g24 // // ncra test cases // group: g25 { //g25g1, g25g2: same data group: g25g1 { dimensions: time=unlimited; variables: double time(time); int one_dmn_rec_var(time); data: time=1.,2.,3.,4.,5.,6.,7.,8.,9.,10.; one_dmn_rec_var=1,2,3,4,5,6,7,8,9,10; } // end g25g1 group: g25g2 { dimensions: time=unlimited; variables: double time(time); int one_dmn_rec_var(time); data: time=1.,2.,3.,4.,5.,6.,7.,8.,9.,10.; one_dmn_rec_var=1,2,3,4,5,6,7,8,9,10; } // end g25g2 //g25g3: record (time) is not coordinate variable group: g25g3 { dimensions: time=unlimited; variables: int one_dmn_rec_var(time); data: one_dmn_rec_var=1,2,3,4,5,6,7,8,9,10; } // end g25g3 } // end g25 //ncwa: test weight and hyperslab group: g26 { dimensions: lat = 3 ; lon = 3 ; variables: float a(lat, lon) ; a:_FillValue = -999.f ; float gw_lat(lat) ; float gw_lon(lon) ; data: a = 45.123, 2.21029, 67.219, 87.19, 12.8974, 3.98, 20, 22.234, _ ; gw_lat = 0.1, 0.9, 0.9 ; gw_lon = 1, 1, 1 ; } // end g26 group: g27 { //test flatenning with paralell variables: ncks -3 -G : -g /g27g1/ group: g27g1 { dimensions: delta_time_start=2; variables: float delta_time_start(delta_time_start); data: delta_time_start=1,2; } group: g27g2 { dimensions: delta_time_start=1; variables: float delta_time_start(delta_time_start); data: delta_time_start=1; } } // end g27 group: g28 { //test CF extraction ( "delta_time_stop" has a CF attribute to "delta_time_start") dimensions: delta_time_start=1; variables: float delta_time_start(delta_time_start); float delta_time_stop(delta_time_start); delta_time_stop:coordinates = "delta_time_start"; data: delta_time_start=1; delta_time_stop=1; } // end g28 group: g29 { //test standard_name = "longitude" dimensions: time29=unlimited; lat29=2; lon29=2; variables: int time29(time29); int lat29(lat29); lat29:standard_name = "latitude"; lat29:units="degree"; int lon29(lon29); lon29:standard_name = "longitude"; lon29:units="degree"; int var3d(time29,lat29,lon29); data: time29=1; lat29=1,2; lon29=1,2; var3d=1,2,3,4; } // end g29 group: g30 { //test cell_methods attribute group: g30g1 { dimensions: time301=unlimited; variables: float time301(time301); time301:long_name = "time301"; data: time301=1,2; }// end g30g1 group: g30g2 { dimensions: time302=unlimited; variables: float time302(time302); time302:long_name = "time302"; time302:cell_methods = "time302: mean"; data: time302=1,2; }// end g30g2 } // end g30 } // end root group nco-5.3.3/data/in_grp_4.cdl000066400000000000000000000026261477164337000154210ustar00rootroot00000000000000// Purpose: Generate test case for nces average members whose hyperslabs resolve to the same size; pair of files are in_grp_4.cdl and in_grp_5.cdl // Generate netCDF files with: // ncgen -k netCDF-4 -b -o ~/nco/data/in_grp_4.nc ~/nco/data/in_grp_4.cdl netcdf in_grp_4 { group: cesm { group: cesm_01 { dimensions: lat=2; lon=4; time=unlimited; variables: double time(time); float lat(lat); float lon(lon); float three_dmn_rec_var(time,lat,lon); data: lat=-90,90; lon=0,90,180,270; time=1.,2.,3.,4.,5.,6.,7.,8.,9.,10.; three_dmn_rec_var=1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16, 17,18,19,20,21,22,23,24, 25,26,27,28,29,30,31,32, 33,34,35,36,37,38,39,40, 41,42,43,44,45,46,47,48, 49,50,51,52,53,54,55,56, 57,58,59,60,61,62,63,64, 65,66,67,68,69,70,71,72, 73,74,75,76,77,78,79,80; } // cesm_01 group: cesm_02 { dimensions: lat=2; lon=3; time=unlimited; variables: double time(time); float lat(lat); float lon(lon); float three_dmn_rec_var(time,lat,lon); data: lat=-90,90; lon=0,90,180; time=1.,2.,3.,4.,5.,6.; three_dmn_rec_var=1, 2, 3, 4, 5, 6, 7,8,9,10,11,12, 13,14,15,16,17,18, 19,20,21,22,23,24, 25,26,27,28,29,30, 31,32,33,34,35,36; } // cesm_02 } // cesm } // root group nco-5.3.3/data/in_grp_5.cdl000066400000000000000000000026451477164337000154230ustar00rootroot00000000000000// Purpose: Generate test case for nces average members whose hyperslabs resolve to the same size; pair of files are in_grp_4.cdl and in_grp_5.cdl // Generate netCDF files with: // ncgen -k netCDF-4 -b -o ~/nco/data/in_grp_5.nc ~/nco/data/in_grp_5.cdl netcdf in_grp_5 { group: cesm { group: cesm_03 { dimensions: lat=2; lon=3; time=unlimited; variables: double time(time); float lat(lat); float lon(lon); float three_dmn_rec_var(time,lat,lon); data: lat=-90,90; lon=0,90,180,270; time=1.,2.,3.,4.,5.,6.; three_dmn_rec_var=1, 2, 3, 4, 5, 6, 7,8,9,10,11,12, 13,14,15,16,17,18, 19,20,21,22,23,24, 25,26,27,28,29,30, 31,32,33,34,35,36; } // cesm_03 group: cesm_04 { dimensions: lat=2; lon=4; time=unlimited; variables: double time(time); float lat(lat); float lon(lon); float three_dmn_rec_var(time,lat,lon); data: lat=-90,90; lon=0,90,180,270; time=1.,2.,3.,4.,5.,6.,7.,8.,9.,10.; three_dmn_rec_var=1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16, 17,18,19,20,21,22,23,24, 25,26,27,28,29,30,31,32, 33,34,35,36,37,38,39,40, 41,42,43,44,45,46,47,48, 49,50,51,52,53,54,55,56, 57,58,59,60,61,62,63,64, 65,66,67,68,69,70,71,72, 73,74,75,76,77,78,79,80; } // cesm_04 } // cesm } // root group nco-5.3.3/data/in_grp_6.cdl000066400000000000000000000027551477164337000154260ustar00rootroot00000000000000// Purpose: Generate test case for nces ensembles // Generate netCDF files with: // ncgen -k netCDF-4 -b -o ~/nco/data/in_grp_6.nc ~/nco/data/in_grp_6.cdl netcdf in_grp_6 { group: cesm { group: cesm_01 { dimensions: lat=2; lon=4; time=unlimited; variables: double time(time); float lat(lat); float lon(lon); float three_dmn_rec_var(time,lat,lon); data: lat=-90,90; lon=0,90,180,270; time=1.,2.,3.,4.,5.,6.,7.,8.,9.,10.; three_dmn_rec_var=1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16, 17,18,19,20,21,22,23,24, 25,26,27,28,29,30,31,32, 33,34,35,36,37,38,39,40, 41,42,43,44,45,46,47,48, 49,50,51,52,53,54,55,56, 57,58,59,60,61,62,63,64, 65,66,67,68,69,70,71,72, 73,74,75,76,77,78,79,80; } // cesm_01 group: cesm_02 { dimensions: lat=2; lon=4; time=unlimited; variables: double time(time); float lat(lat); float lon(lon); float three_dmn_rec_var(time,lat,lon); data: lat=-90,90; lon=0,90,180,270; time=1.,2.,3.,4.,5.,6.,7.,8.,9.,10.; three_dmn_rec_var=1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16, 17,18,19,20,21,22,23,24, 25,26,27,28,29,30,31,32, 33,34,35,36,37,38,39,40, 41,42,43,44,45,46,47,48, 49,50,51,52,53,54,55,56, 57,58,59,60,61,62,63,64, 65,66,67,68,69,70,71,72, 73,74,75,76,77,78,79,80; } // cesm_02 } // cesm } // root group nco-5.3.3/data/in_grp_7.cdl000066400000000000000000000062031477164337000154170ustar00rootroot00000000000000// Purpose: Generate test case for nces ensembles // Generate netCDF files with: // ncgen -k netCDF-4 -b -o ~/nco/data/in_grp_7.nc ~/nco/data/in_grp_7.cdl // separated from in_grp_3.cdl dur to netCDF 4.1 repeated dimensions IDs bug netcdf in_grp_7 { // //g19 test cases for ncpdq; same variables as ncpdq netCDF3 tests // group: g19 { dimensions: lat=2; lev=3; lon=4; time=unlimited; variables: float lat(lat); float lon(lon); float lev(lev); float lev_wgt(lev); double time(time); data: lat=-90,90; lon=0,90,180,270; lev=100,500,1000; lev_wgt=10,2,1; time=1.,2.,3.,4.,5.,6.,7.,8.,9.,10.; group: g19g1 { variables: float two_dmn_var(lat,lev); two_dmn_var:long_name = "two dimensional variable"; two_dmn_var:units = "fraction"; data: two_dmn_var=1.5,5.5,9.5,13.5,17.5,21.5; group: g19g1g1 { //test full name --cnk_dmn dimensions: lev=3; variables: float two_dmn_var(lat,lev); two_dmn_var:_DeflateLevel=1; data: two_dmn_var=1.5,5.5,9.5,13.5,17.5,21.5; } // end g19g1g1 } // end g19g1 group: g19g2 { variables: float two_dmn_rec_var(time,lev); two_dmn_rec_var:long_name = "two dimensional record variable"; two_dmn_rec_var:units = "watt meter-2"; data: two_dmn_rec_var=1.,2.0,3., 1.,2.1,3., 1.,2.2,3., 1.,2.3,3., 1.,2.4,3., 1.,2.5,3., 1.,2.6,3., 1.,2.7,3., 1.,2.8,3., 1.,2.9,3.; } // end g19g2 group: g19g3 { variables: double three_dmn_var_dbl(time,lat,lon); three_dmn_var_dbl:long_name = "three dimensional record variable of type double"; three_dmn_var_dbl:units = "watt meter-2"; three_dmn_var_dbl:_FillValue = -99.; data: three_dmn_var_dbl= 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16, 17,18,19,20,21,22,23,24, -99,-99,-99,-99,-99,-99,-99,-99, 33,34,35,36,37,38,39,40, 41,42,43,44,45,46,47,48, 49,50,51,52,53,54,55,56, -99,58,59,60,61,62,63,64, 65,66,67,68,69,70,71,72, -99,74,75,76,77,78,79,-99; } // end g19g3 group: g19g4 { variables: short rec_var_dbl_mss_val_dbl_pck(time); rec_var_dbl_mss_val_dbl_pck:long_name = "record variable, double, packed as short, with double missing values"; rec_var_dbl_mss_val_dbl_pck:purpose = "Packed version of rec_var_dbl_mss_val_dbl_upk"; rec_var_dbl_mss_val_dbl_pck:_FillValue = -999s; rec_var_dbl_mss_val_dbl_pck:missing_value = -999.; rec_var_dbl_mss_val_dbl_pck:scale_factor = -9.15541313801785e-05; rec_var_dbl_mss_val_dbl_pck:add_offset = 5.; double upk; upk:long_name = "Unpacked scalar variable"; upk:note = "Unpacked value is 3.0d0, upk=unpack(pck)= 2.0d0*1s + 1.0d0 = 3.0d0. Packing this variable should create an NC_SHORT scalar = 0s with packing attribute add_offset=3.0d and either no scale_factor (ncap) or scale_factor = 0.0d (ncpdq)."; data: upk=3.; rec_var_dbl_mss_val_dbl_pck=-999,32767,21845,10922,0,-10922,-21845,-32767,-999,-999; } // end g19g4 } // end g19 } // root group nco-5.3.3/data/in_grp_8.cdl000066400000000000000000000013521477164337000154200ustar00rootroot00000000000000// -*-C++-*- // Purpose: // ncpdq tests // Generate netCDF files with: // ncgen -k netCDF-4 -b -o ~/nco/data/in_grp_8.nc ~/nco/data/in_grp_8.cdl netcdf in_grp_8 { group: g1 { dimensions: lat=2; lon=3; time=unlimited; variables: float lat(lat); float lon(lon); double time(time); float snd(time,lat,lon); data: lat=0,1; lon=0,1,2; time=0,1; snd=0,1,2,3,4,5,6,7,8,9,10,11; } // end g1 group: g2 { dimensions: lat=2; lon=3; time=unlimited; variables: float lat(lat); float lon(lon); double time(time); float snd(time,lat,lon); data: lat=0,1; lon=0,1,2; time=0,1; snd=0,1,2,3,4,5,6,7,8,9,10,11; } // end g2 } // root group nco-5.3.3/data/in_nomismatch.cdl000066400000000000000000001253351477164337000165530ustar00rootroot00000000000000// -*-c++-mode-*- // Purpose: CDL file to generate netCDF test file for NCO // in_nomismatch.cdl is a modified version of in.cdl // This file contains no variables that trigger the ncgen "_FillValue type mismatch" error // scp ~/nco/data/in_nomismatch.cdl dust.ess.uci.edu:/var/www/html/nco // scp ~/nco/data/in_nomismatch.cdl zender,nco@web.sf.net:/home/project-web/nco/htdocs // Some versions (I have lost track of which) of ncgen are too strict // to build CDL files that violate netCDF metadata guidelines. // The NCO in.cdl file intentionally includes corner cases which do this. // The result is ncgen "_FillValue type mismatch" errors. // The easiest workaround I can think of is to copy the (new) // in_nomismatch.cdl file over the in.cdl file distributed with NCO. // Substitute this file into normal NCO build procedure with: // cd ~;wget http://dust.ess.uci.edu/nco/in_nomismatch.cdl . // cp ~/in_nomismatch.cdl /path/to/nco/data/in.cdl // Usage: // netCDF4: ncgen arguments depend on version: // "-k netCDF-4" for netCDF >= 3.6.3, "-k hdf5" for netCDF < 3.6.3 // "-k netCDF-4 classic model" for netCDF >= 3.6.3, "-k hdf5-nc3" for netCDF < 3.6.3 // /usr/local/bin/ncgen -k netCDF-4 -b -o in_4.nc in_nomismatch.cdl // /usr/local/bin/ncgen -k netCDF-4 -b -o ${HOME}/nco/data/in_4.nc ${HOME}/nco/data/in_nomismatch.cdl // URL: // http://dust.ess.uci.edu/nco/in.nc // http://dust.ess.uci.edu/nco/in_4.nc // netCDF3: // ncgen -b -o in.nc in_nomismatch.cdl // ncgen -b -o ${HOME}/nco/data/in.nc ${HOME}/nco/data/in_nomismatch.cdl // scp ~/nco/data/in_nomismatch.cdl ~/nco/data/in_4.nc dust.ess.uci.edu:nco/data // scp ~/nco/data/in.nc ~/nco/data/in_4.nc dust.ess.uci.edu:/var/www/html/nco // scp ~/nco/data/in.nc ~/nco/data/in_4.nc dust.ess.uci.edu:/data/home/www/html/dodsdata // mswrite -t 365 ~/nco/data/in.nc /ZENDER/tmp/in.nc // mswrite -t 365 ~/nco/data/in.nc /ZENDER/tmp/h0001.nc // mswrite -t 365 ~/nco/data/in.nc /ZENDER/tmp/h0002.nc // mswrite -t 365 ~/nco/data/in.nc /ZENDER/tmp/h0003.nc // mswrite -t 365 ~/nco/data/in.nc /ZENDER/tmp/h0004.nc // msrcp -period 365 ~/nco/data/in.nc mss:/ZENDER/tmp/in.nc // msrcp -period 365 ~/nco/data/in.nc mss:/ZENDER/tmp/h0001.nc // msrcp -period 365 ~/nco/data/in.nc mss:/ZENDER/tmp/h0002.nc // msrcp -period 365 ~/nco/data/in.nc mss:/ZENDER/tmp/h0003.nc // msrcp -period 365 ~/nco/data/in.nc mss:/ZENDER/tmp/h0004.nc // WARNING: Changing values of variables below, especially coordinate variables, affects outcome of nco_tst.pl test script // Other programs, e.g., ~/f/fff.F90, ~/c++/ccc.cc, ~/c/c.c may also break // In particular, do not change number of elements in record coordinate, time, without simultaneously changing number of data in all record variables // My (and NCO's) convention is that the _FillValue, if any, of any packed variable should be of the same type as the expanded variable. Hence _FillValue, add_offset, and scale_factor should all be of the same type. Variables that do not adhere to this convention are not supported. // CDL Data constants: // byte: 'a' // char: "a" // short: 1s // int: 1 (no decimal point) // float: 1.f (decimal point is required, f is required to distinguish from double) // double: 1.0, 1.d, 1.0e-20 (decimal point is required, d is not required) // // NCL usage: // id_in=addfile("/home/zender/nco/data/in.nc","r") // print(id_in) // list_filevars(id_in) netcdf in { dimensions: dgn=1,bnd=2,lat=2,lat_grd=3,lev=3,rlev=3,lon=4,lon_grd=5,char_dmn_lng80=80,char_dmn_lng04=4,fl_dmn=3,lsmlev=6,wvl=2,time_udunits=3;lon_T42=128,lat_T42=64,lat_times_lon=8,gds_crd=8,vrt_nbr=2,lon_cal=10,lat_cal=10,time=unlimited; variables: :Conventions = "CF-1.0"; :history = "History global attribute.\n"; :julian_day = 200000.04; :RCS_Header = "$Header$"; float lat(lat); lat:long_name = "Latitude (typically midpoints)"; lat:units = "degrees_north"; lat:bounds = "lat_bnd"; float lat_bnd(lat,vrt_nbr); lat_bnd:purpose = "Cell boundaries for lat coordinate"; float lat_grd(lat_grd); lat_grd:long_name = "Latitude grid (typically interfaces)"; lat_grd:units = "degrees_north"; float lat_cpy(lat); float lev_cpy(lev); float lat_var(lat); float lat_wgt(lat); float lon_T42(lon_T42); float lat_T42(lat_T42); float lat_1D_rct(lat_times_lon); lat_1D_rct:long_name = "Latitude for 2D rectangular grid stored as 1D arrays"; lat_1D_rct:units = "degrees_north"; float lon_1D_rct(lat_times_lon); lon_1D_rct:long_name = "Longitude for 2D rectangular grid stored as 1D arrays"; lon_1D_rct:units = "degrees_east"; float lat_1D_rrg(lat_times_lon); lat_1D_rrg:long_name = "Latitude for 2D irregular grid stored as 1D arrays"; lat_1D_rrg:units = "degrees_north"; float lon_1D_rrg(lat_times_lon); lon_1D_rrg:long_name = "Longitude for 2D irregular grid stored as 1D arrays"; lon_1D_rrg:units = "degrees_east"; int lat_times_lon(lat_times_lon); lat_times_lon:long_name = "Element index (i.e., C-based storage order) for 2D coordinate grids stored as 1D arrays"; float lat_2D_rct(lat,lon); lat_2D_rct:long_name = "Latitude for 2D rectangular grid stored as 2D array"; lat_2D_rct:units = "degrees_north"; float lon_2D_rct(lat,lon); lon_2D_rct:long_name = "Longitude for 2D rectangular grid stored as 2D array"; lon_2D_rct:units = "degrees_east"; float lat_2D_rrg(lat,lon); lat_2D_rrg:long_name = "Latitude for 2D irregular grid stored as 2D array"; lat_2D_rrg:units = "degrees_north"; float lon_2D_rrg(lat,lon); lon_2D_rrg:long_name = "Longitude for 2D irregular grid stored as 2D array"; lon_2D_rrg:units = "degrees_east"; int lat_times_lon_nbr; lat_times_lon_nbr:long_name = "Number of elements in 2D coordinate grids. Rectangular and irregular test grids have this many total elements. The coordinates and elements are stored as 1D or 2D arrays for grid types 1D and 2D respectively."; float lev(lev); lev:purpose = "Monotonically increasing coordinate pressure"; lev:units = "hybrid_sigma_pressure"; lev:positive = "down"; lev:A_var = "hyam"; lev:B_var = "hybm"; lev:P0_var = "P0"; lev:PS_var = "PS"; lev:bounds = "ilev"; float ilev(lev,vrt_nbr); ilev:purpose = "Cell boundaries for lev coordinate"; float rlev(rlev); rlev:purpose = "Monotonically decreasing coordinate pressure"; float lon(lon); lon:long_name = "Longitude (typically midpoints)"; lon:units = "degrees_east"; double lond(lon); lond:long_name = "Longitude (typically midpoints), double precision"; lond:units = "degrees_east"; float lonf(lon); lonf:long_name = "Longitude (typically midpoints), single precision"; lonf:units = "degrees_east"; float lon_grd(lon_grd); lon_grd:long_name = "Longitude grid (typically interfaces)"; lon_grd:units = "degrees_east"; double time(time); time: long_name = "time"; time: units = "days since 1964-03-12 12:09:00 -9:00"; time: calendar = "gregorian"; time: bounds = "time_bnds"; float time_bnds(time,vrt_nbr); time_bnds:purpose = "Cell boundaries for time coordinate"; double lon_cal(lon_cal); lon_cal: long_name = "lon_cal"; lon_cal: units = "days since 1964-2-28"; lon_cal: calendar = "365_day"; double lat_cal(lat_cal); lat_cal: long_name = "lat_cal"; lat_cal: units = "days since 1964-2-28"; lat_cal: calendar = "360_day"; float lsmlev(lsmlev); lsmlev:purpose = "Homebrew level coordinate for LSM"; lsmlev:long_name = "Soil depth"; lsmlev:units = "meter"; float wvl(wvl); wvl:long_name = "Wavelength"; wvl:units = "meter"; int od(time); float area(lat); area:long_name = "area"; area:units = "meter2"; float hyam(lev); hyam:long_name = "hybrid A coefficient at layer midpoints"; float hybm(lev); hybm:long_name = "hybrid B coefficient at layer midpoints"; float P0; P0:long_name = "reference pressure"; P0:units = "pascal"; float cnv_CF_crd(gds_crd); cnv_CF_crd:long_name = "test CF coordinates conventions"; cnv_CF_crd:coordinates = "lat_gds lon_gds "; cnv_CF_crd:reason = "Test whether coordinates attribute strings that end with a space break after nco_var_lst_crd_ass_add() call to nco_lst_prs_2d()"; float PS(time,lat,lon); PS:long_name = "surface pressure"; PS:units = "pascal"; char fl_dmn(fl_dmn); fl_dmn:long_name = "Character coordinate"; fl_dmn:units = "[chr]"; double lat_gds(gds_crd); lat_gds:long_name = "Latitude"; lat_gds:standard_name = "latitude"; lat_gds:units="degree"; lat_gds:purpose = "1-D latitude coordinate referred to by geodesic grid variables"; double lon_gds(gds_crd); lon_gds:long_name = "Longitude"; lon_gds:standard_name = "longitude"; lon_gds:units="degree"; lon_gds:purpose = "1-D longitude coordinate referred to by geodesic grid variables"; float gds_crd(gds_crd); gds_crd:long_name = "Geodesic coordinate"; gds_crd:units = "degree"; gds_crd:purpose = "enumerated coordinate like those that might define points in a geodesic grid"; gds_crd:coordinates = "lat_gds lon_gds"; float gds_var(gds_crd); gds_var:long_name = "Geodesic variable"; gds_var:units = "meter"; gds_var:purpose = "Test auxiliary coordinates like those that define geodesic grids"; gds_var:coordinates = "lat_gds lon_gds"; float gds_3dvar(time,gds_crd); gds_3dvar:long_name = "Geodesic variable"; gds_3dvar:units = "meter"; gds_3dvar:coordinates = "lat_gds lon_gds"; gds_3dvar:purpose = "Test auxiliary coordinates like those that define geodesic grids"; int nbdate; nbdate:long_name = "base date as 6- or 8-digit integer (YYMMDD or YYYYMMDD)"; int date(time); date:long_name = "current date as 6- or 8-digit integer (YYMMDD or YYYYMMDD)"; float lon_wgt(lon); lon_wgt:long_name = "Gaussian weights"; lon_wgt:purpose = "Gaussian weights which sum to two for n = 4. These weights are all have floor of 0.0 so should cause SIGFPE when applied to integer types in weighted average."; float msk_prt_mss_prt(lon); msk_prt_mss_prt:long_name = "partial mask, partial missing value example"; msk_prt_mss_prt:_FillValue = 1.0e36f; float mss_val(lon); mss_val:long_name = "partial missing value example"; mss_val:_FillValue = 1.0e36f; float mss_val_scl; mss_val_scl:long_name = "scalar missing value"; mss_val_scl:_FillValue = 1.0e36f; float mss_val_fst(lon); mss_val_fst:long_name = "offset partial missing value example"; mss_val_fst:_FillValue = -999.0f; float fll_val(lon); fll_val:long_name = "_FillValue example"; fll_val:_FillValue = -999.0f; float fll_val_mss_val(lon); fll_val_mss_val:long_name = "_FillValue example"; fll_val_mss_val:_FillValue = -999.0f; fll_val_mss_val:missing_value = -999.0f; float nm_spc; nm_spc:long_name = "Variable name with space (invalid)"; float nm_pnd; nm_pnd:long_name = "Variable name with pound symbol (invalid)"; float no_mss_val(lon); no_mss_val:long_name = "no missing value"; float val_one_mss(lat); val_one_mss:long_name = "one regular value, one missing value"; val_one_mss:_FillValue = 1.0e36f; short rec_var_pck_scale_factor_only(time); rec_var_pck_scale_factor_only:long_name = "Array packed with scale factor only"; rec_var_pck_scale_factor_only:note = "Original packed value was 1s..10s with scale_factor = 10.0d no add_offset. Unpacked value should be 10.0 = 10.0d*1s + 0.0d through 100 = 10.0d*1s + 0.0d. Average value should be 55."; rec_var_pck_scale_factor_only:scale_factor = 10.0d; short pck; pck:long_name = "Scalar variable, double, packed as short"; pck:note = "Original packed value was 1s with scale_factor = 2.0d and add_offset = 1.0d. Unpacked value should be 3.0 = 2.0d*1s + 1.0d. NCO algorithms would pack this variable as scale_factor = 0.0d and add_offset = 3.0d."; pck:scale_factor = 2.0d; pck:add_offset = 1.0d; short pck_arr(lon); pck_arr:long_name = "Array variable, double, packed as short"; pck_arr:note = "Packed value is -32767s, 0s, 1s, 32767s, unpacked is same in double"; pck_arr:scale_factor = 1.0d; pck_arr:add_offset = 0.0d; double upk; upk:long_name = "Unpacked scalar variable"; upk:note = "Unpacked value is 3.0d0, upk=unpack(pck)= 2.0d0*1s + 1.0d0 = 3.0d0. Packing this variable should create an NC_SHORT scalar = 0s with packing attribute add_offset=3.0d and either no scale_factor (ncap) or scale_factor = 0.0d (ncpdq)."; double upk_arr(lon); upk_arr:long_name = "Unpacked array"; upk_arr:note = "Unpacked value is -32767.d, 0.d, 1.d, 32767.d, packed is same in short. Packing algorithm should yield an NC_SHORT array = [] with packing attributes scale_factor=1.0d, add_offset=0.0d"; int val_one_int; val_one_int:long_name = "scalar equal to 1"; val_one_int:_FillValue = -99l; int val_one_one_int(lat); val_one_one_int:long_name = "1, 1"; val_one_one_int:_FillValue = -99l; short val_max_max_sht(lat); val_max_max_sht:long_name = "17000, 17000"; val_max_max_sht:_FillValue = -99s; int val_one_mss_int(lat); val_one_mss_int:long_name = "1, mss_val"; val_one_mss_int:_FillValue = -99l; float val_half; val_half:long_name = "Scalar with value 0.5"; val_half:_FillValue = 1.0e36f; float val_half_half(lat); val_half_half:long_name = "0.5,0.5"; val_half_half:_FillValue = 1.0e36f; float wgt_one(lat); wgt_one:long_name = "all values are one"; float mss_val_all(lon); mss_val_all:long_name = "all missing values example"; mss_val_all:_FillValue = 1.0e36f; float scalar_var; scalar_var:long_name = "scalar variable"; scalar_var:units = "fraction"; float float_var; float_var:long_name = "float"; double double_var; double_var:long_name = "double"; double double_var2; double_var2:long_name = "double"; double_var2:_FillValue = 1.0e36; double pi; pi:long_name = "Pi"; pi:units = "fraction"; int int_var; int_var:long_name = "int"; short short_var; short_var:long_name = "short"; char char_var; char_var:long_name = "char"; char char_var_space; char_var_space:long_name = "Character variable with whitespace on ends"; char char_var_nul; char_var_nul:long_name = "Character variable containing one NUL"; char char_var_multinul(lev); char_var_multinul:long_name = "Character variable containing multiple NULs"; char fl_nm(char_dmn_lng80); fl_nm:long_name = "Variable contains a file name"; char fl_nm_arr(fl_dmn,char_dmn_lng80); fl_nm_arr:long_name = "Variable that contains a short array of file names"; fl_nm_arr:units = "[sng]"; char non_nul_trm_char_one_dmn(char_dmn_lng04); non_nul_trm_char_one_dmn:long_name = "Variable contains a one-dimensional array of characters that is not NUL-terminated"; non_nul_trm_char_one_dmn:units = "[chr]"; char non_nul_trm_char_two_dmn(fl_dmn,char_dmn_lng04); non_nul_trm_char_two_dmn:long_name = "Variable contains a two-dimensional array of characters that are not NUL-terminated"; non_nul_trm_char_two_dmn:units = "[chr]"; byte byte_var; byte_var:long_name = "byte"; byte byte_var_neg; byte_var_neg:long_name = "negative byte"; float zero; zero:long_name = "zero"; float one; one:long_name = "one"; float two; two:long_name = "two"; double e_dbl; e_dbl:long_name = "e, natural logarithm base"; float e_flt; e_flt:long_name = "e, natural logarithm base"; float three; three:long_name = "three"; float four; four:long_name = "four"; float negative_one; negative_one:long_name = "negative one"; float lev_var(lev); lev_var:long_name = "lev_var"; float lev_wgt(lev); lev_wgt:long_name = "lev_wgt"; float g; g:long_name = "g"; float dps_dry; dps_dry:long_name = "Dry Deposition"; float dps_wet; dps_wet:long_name = "Wet Deposition"; float dps_ttl; dps_ttl:long_name = "Total Deposition"; float z(lev); z:long_name = "Height"; z:units = "meter"; z:purpose = "Height stored with a monotonically increasing coordinate"; float rz(rlev); rz:long_name = "Height"; rz:units = "meter"; rz:purpose = "Height stored with a monotonically decreasing coordinate"; float one_dmn_var(bnd); int one_dmn_int_val_one(lat); int one_dmn_int_val_two(lat); float att_var; att_var:byte_att = '\000','\001','\002','\177','\200','\201','\376','\377'; att_var:char_att = "Sentence one.\nSentence two.\n"; att_var:short_att = 37s; att_var:int_att = 73l; att_var:float_att = 73.0f,72.0f,71.0f; att_var:double_att = 73.0d; int bnd_var(lev,bnd); bnd_var:byte_att = '\0'; bnd_var:char_att = "Sentence one.\nSentence two.\n"; bnd_var:short_att = 37s; bnd_var:int_att = 73; bnd_var:float_att = 73.f; bnd_var:double_att = 73.d; float three_dmn_var(lat,lev,lon); three_dmn_var:long_name = "three dimensional variable with CCM coordinate convention C=[lat,lev,lon], Fortran=(lon,lev,lat)"; three_dmn_var:units = "fraction"; float three_dmn_var_crd(lev,lat,lon); three_dmn_var_crd:long_name = "three dimensional variable with COORDS coordinate convention C=[lev,lat,lon], Fortran=(lon,lat,lev)"; three_dmn_var_crd:units = "fraction"; float prs_sfc(time,lat,lon); prs_sfc:long_name = "Surface pressure"; prs_sfc:units = "pascal"; float H2O; float H2OH2O; float H2SO4; float H2O_lqd; float H2O_ice; float Q; float Q1; float AQ01; float QQ01; float QA01; float Q01Q; float Q01; float Q02; float Q03; float Q04; float Q05; float Q06; float Q07; float Q08; float Q09; float Q10; float Q11; float Q12; float Q13; float Q14; float Q15; float Q16; float Q17; float Q18; float Q19; float Q20; float Q21; float Q22; float Q23; float Q24; float Q25; float Q26; float Q27; float Q28; float Q29; float Q30; float Q31; float Q32; float Q33; float Q34; float Q35; float Q36; float Q37; float Q38; float Q39; float Q40; float Q41; float Q42; float Q43; float Q44; float Q45; float Q46; float Q47; float Q48; float Q49; float Q50; float Q51; float Q52; float Q53; float Q54; float Q55; float Q56; float Q57; float Q58; float Q59; float Q60; float Q61; float Q62; float Q63; float Q64; float Q65; float Q66; float Q67; float Q68; float Q69; float Q70; float Q71; float Q72; float Q73; float Q74; float Q75; float Q76; float Q77; float Q78; float Q79; float Q80; float Q81; float Q82; float Q83; float Q84; float Q85; float Q86; float Q87; float Q88; float Q89; float Q90; float Q91; float Q92; float Q93; float Q94; float Q95; float Q96; float Q97; float Q98; float Q99; float Q100; float two_dmn_var(lat,lev); two_dmn_var:long_name = "two dimensional variable"; two_dmn_var:units = "fraction"; float var_msk(lat,lon); var_msk:long_name = "Float field for testing masks and wheres"; var_msk:units = "fraction"; float mask(lat,lon); mask:long_name = "Purpose is to mask a variable like ORO"; mask:units = "fraction"; float ORO(lat,lon); ORO:long_name = "Orography, an enumerated yet continuous type: ocean=0.0, land=1.0, sea ice=2.0"; ORO:units = "fraction"; float weight(lat); weight:long_name = "Gaussian weight"; weight:units = "fraction"; float gw(lat); gw:long_name = "gw variable like gw"; gw:units = "fraction"; float gw_T42(lat_T42); gw_T42:long_name = "gw variable like gw_T42"; gw_T42:units = "fraction"; float rec_var_flt(time); rec_var_flt:long_name = "record variable, float"; double rec_var_dbl(time); rec_var_dbl:long_name = "record variable, double"; int one_dmn_rec_var(time); one_dmn_rec_var:long_name = "one dimensional record variable"; one_dmn_rec_var:units = "second"; float one_dmn_rec_var_missing_value(time); one_dmn_rec_var_missing_value:long_name = "One dimensional record variable with missing data indicated by missing_value attribute only. No _FillValue attribute exists."; one_dmn_rec_var_missing_value:missing_value = 1.0e36f; float one_dmn_rec_var__FillValue(time); one_dmn_rec_var__FillValue:long_name = "One dimensional record variable with missing data indicated by _FillValue attribute only. No missing_value attribute exists."; one_dmn_rec_var__FillValue:_FillValue = 1.0e36f; int RDM(time); float tpt(time); tpt:long_name = "Temperature"; tpt:units = "kelvin"; tpt:hieght = "Leave hieght mispelled for NCO User's guide example"; double rec_var_dbl_mss_val_dbl_upk(time); rec_var_dbl_mss_val_dbl_upk:long_name = "record variable, double, with double missing values"; rec_var_dbl_mss_val_dbl_upk:purpose = "This variable is used to generate the packed variable rec_var_dbl_mss_val_dbl_pck, so its _FillValue should not be out of range, i.e., it should be representable by a short. However, the _FillValue should itself be the same type as the unpacked variable, NC_DOUBLE in this case."; rec_var_dbl_mss_val_dbl_upk:_FillValue = -999.; rec_var_dbl_mss_val_dbl_upk:missing_value = -999.; short rec_var_dbl_mss_val_sht_pck(time); rec_var_dbl_mss_val_sht_pck:long_name = "record variable, double, packed as short, with short missing values"; rec_var_dbl_mss_val_sht_pck:purpose = "Packed version of rec_var_dbl_mss_val_sht_upk"; rec_var_dbl_mss_val_sht_pck:_FillValue = -999s; rec_var_dbl_mss_val_sht_pck:missing_value = -999s; rec_var_dbl_mss_val_sht_pck:scale_factor = -9.15541313801785e-05; rec_var_dbl_mss_val_sht_pck:add_offset = 5.; short scl_dbl_pck; scl_dbl_pck:long_name = "scalar variable, double, packed"; scl_dbl_pck:purpose = "Packed version of number with ncdiff subtraction bug"; scl_dbl_pck:scale_factor = -9.15541313801785e-05; scl_dbl_pck:add_offset = 5.; float rec_var_flt_mss_val_flt_all(time); rec_var_flt_mss_val_flt_all:long_name = "record variable, float, with float missing values in every position"; rec_var_flt_mss_val_flt_all:_FillValue = 1.0e36f; float rec_var_flt_mss_val_flt_all_but_one(time); rec_var_flt_mss_val_flt_all_but_one:long_name = "record variable, float, with float missing values in every position but one"; rec_var_flt_mss_val_flt_all_but_one:_FillValue = 1.0e36f; float rec_var_flt_mss_val_flt_all_but_two(time); rec_var_flt_mss_val_flt_all_but_two:long_name = "record variable, float, with float missing values in every position but two"; rec_var_flt_mss_val_flt_all_but_two:_FillValue = 1.0e36f; short rec_var_flt_pck(time); rec_var_flt_pck:long_name = "record variable, float, packed into short"; rec_var_flt_pck:purpose = "Demonstrate that rounding of means of packed data are handled correctly"; rec_var_flt_pck:scale_factor = 0.1f; rec_var_flt_pck:add_offset = 100.0f; short rec_var_dbl_pck(time); rec_var_dbl_pck:long_name = "record variable, double, packed into short"; rec_var_dbl_pck:purpose = "Demonstrate that rounding of means of packed data are handled correctly"; rec_var_dbl_pck:scale_factor = 0.1; rec_var_dbl_pck:add_offset = 100.0; short non_rec_var_flt_pck(lon); non_rec_var_flt_pck:long_name = "regular variable, float, packed into short"; non_rec_var_flt_pck:purpose = "Demonstrate that non-rec dim packed vars are handled correctly"; non_rec_var_flt_pck:scale_factor = 0.1f; non_rec_var_flt_pck:add_offset = 100.0f; float rec_var_flt_mss_val_dbl(time); rec_var_flt_mss_val_dbl:long_name = "record variable, float, with double missing values"; rec_var_flt_mss_val_dbl:_FillValue = 1.0e36f; rec_var_flt_mss_val_dbl:missing_value = 1.0e36f; rec_var_flt_mss_val_dbl:note = "The correct average of this variable is 5.0"; float rec_var_flt_mss_val_int(time); rec_var_flt_mss_val_int:long_name = "record variable, float, with integer missing values"; rec_var_flt_mss_val_int:_FillValue = -999.f; rec_var_flt_mss_val_int:missing_value = -999.f; int rec_var_int_mss_val_int(time); rec_var_int_mss_val_int:long_name = "record variable, integer, with integer missing values"; rec_var_int_mss_val_int:_FillValue = -999; char one_dmn_rec_var_sng(time); one_dmn_rec_var_sng:long_name = "one dimensional record variable of string"; float time_lon(time,lon); time_lon:long_name = "Record variable of longitude coordinate"; char two_dmn_rec_var_sng(time,lev); two_dmn_rec_var_sng:long_name = "two dimensional record variable of string"; float two_dmn_rec_var(time,lev); two_dmn_rec_var:long_name = "two dimensional record variable"; two_dmn_rec_var:units = "watt meter-2"; float three_dmn_rec_var(time,lat,lon); three_dmn_rec_var:long_name = "three dimensional record variable"; three_dmn_rec_var:units = "watt meter-2"; double three_dmn_var_dbl(time,lat,lon); three_dmn_var_dbl:long_name = "three dimensional record variable of type double"; three_dmn_var_dbl:units = "watt meter-2"; three_dmn_var_dbl:_FillValue = -99.; int three_dmn_var_int(time,lat,lon); three_dmn_var_int:long_name = "three dimensional record variable of type int"; three_dmn_var_int:units = "watt meter-2"; three_dmn_var_int:_FillValue = -99; short three_dmn_var_sht(time,lat,lon); three_dmn_var_sht:long_name = "three dimensional record variable"; three_dmn_var_sht:units = "watt meter-2"; three_dmn_var_sht:_FillValue = -99s; int th(time,lat,lon); th:long_name = "three dimensional record variable"; th:units = "watt meter-2"; th:_FillValue = -99; float td(time,dgn); td:long_name = "two dimensional record variable stored in td (time,dgn) order (dgn means degenerate, i.e., of size 1)"; float tx(time,lon); tx:long_name = "two dimensional record variable stored in tx (time,lon) order"; float ty(time,lat); ty:long_name = "two dimensional record variable stored in ty (time,lat) order"; float tz(time,lev); tz:long_name = "two dimensional record variable stored in tz (time,lev) order"; float txyz(time,lon,lat,lev); txyz:long_name = "four dimensional record variable stored in txyz (time,lon,lat,lev) order"; float four_dmn_rec_var(time,lat,lev,lon); four_dmn_rec_var:long_name = "four dimensional record variable"; four_dmn_rec_var:units = "watt meter-2"; // double three_double_dmn(time,lon,lon); double time_udunits(time_udunits); time_udunits:units = "hours since 1900-01-01 00:00:0.0"; time_udunits:delta_t = "0000-00-00 06:00:0.0"; float u(time); u:long_name = "Zonal wind speed"; u:units = "meter second-1"; float v(time); v:long_name = "Meridional wind speed"; v:units = "meter second-1"; float var_1D_rct(lat_times_lon); var_1D_rct:long_name = "Variable for 2D rectangular grid stored as 1D arrays"; float var_1D_rrg(lat_times_lon); var_1D_rrg:long_name = "Variable for 2D irregular grid stored as 1D arrays"; float var_2D_rct(lat,lon); var_2D_rct:long_name = "Variable for 2D rectangular grid stored as 2D array"; float var_2D_rrg(lat,lon); var_2D_rrg:long_name = "Variable for 2D irregular grid stored as 2D array"; float var_nm-dash; var_nm-dash:long_name = "Variable and attribute names include dash characters"; var_nm-dash:att_nm-dash = 1.0e36f; float var_nm.dot; var_nm.dot:long_name = "Variable and attribute names include dot characters"; // 20070102: Periods in attribute names choke OPeNDAP from FC7 RPM TODO nco911 // 20091105: Periods in attribute names choke ncgen from RHEL5 TODO nco911 // var_nm.dot:att_nm.dot = 1.0e36f; float wnd_spd(time,lat,lon); wnd_spd:long_name = "wind speed"; wnd_spd:units = "meter second-1"; wnd_spd:_FillValue = -999.0f; data: att_var=10.; area=10.,10.; bnd_var=1,2,3,4,5,6; byte_var='z'; byte_var_neg=-122; char_var="z"; char_var_multinul="\b\n\0"; char_var_nul='\0'; char_var_space=" "; cnv_CF_crd=273.1,273.2,273.3,273.4,273.5,273.6,273.7,273.8; double_var=10.; double_var2=10.; dps_dry=73; dps_wet=73; dps_ttl=73; e_dbl=2.71828182846; e_flt=2.71828182846; // 20100809: Single quotes around NC_CHAR coordinates required as of 4.1.2-beta1-snapshot2010080820 // 20100809: Double quotes cause "String constant too long" error in ncgen fl_dmn='a','b','3'; fl_nm="/home/zender/nco/data/in.cdl"; float_var=10.; four=4.; g=9.8; gw=10.,10.; gw_T42=-87.863799,-85.096527,-82.312913,-79.525607,-76.736900,-73.947515,-71.157752,-68.367756,-65.577607,-62.787352,-59.997020,-57.206632,-54.416200,-51.625734,-48.835241,-46.044727,-43.254195,-40.463648,-37.673090,-34.882521,-32.091944,-29.301360,-26.510769,-23.720174,-20.929574,-18.138971,-15.348365,-12.557756,-9.767146,-6.976534,-4.185921,-1.395307,1.395307,4.185921,6.976534,9.767146,12.557756,15.348365,18.138971,20.929574,23.720174,26.510769,29.301360,32.091944,34.882521,37.673090,40.463648,43.254195,46.044727,48.835241,51.625734,54.416200,57.206632,59.997020,62.787352,65.577607,68.367756,71.157752,73.947515,76.736900,79.525607,82.312913,85.096527,87.863799; hyam=0.0802583,0.0438226,0.0; hybm=0.0187849,0.457453,0.992528; P0=100000; gds_crd=0,1,2,3,4,5,6,7; gds_var=273.1,273.2,273.3,273.4,273.5,273.6,273.7,273.8; gds_3dvar=273.1,273.2,273.3,273.4,273.5,273.6,273.7,273.8, 274.1,274.2,274.3,274.4,274.5,274.6,274.7,274.8, 275.1,275.2,275.3,275.4,275.5,274.5,275.7,275.8, 276.1,276.2,276.3,276.4,276.5,276.5,276.7,276.8, 277.1,277.2,277.3,277.4,277.5,277.5,277.7,277.8, 278.1,278.2,278.3,278.4,278.5,278.6,278.7,278.8, 279.1,279.2,279.3,279.4,279.5,279.9,279.7,279.8, 280.1,280.2,280.3,280.4,280.5,280.9,280.7,280.8, 281.1,281.2,281.3,281.4,281.5,281.9,281.7,281.8, 282.1,282.2,282.3,282.4,282.5,282.9,282.7,282.8; lat_gds=-90, -30, -30, 0, 0, 30, 30, 90; lon_gds= 0, 0, 180, 0, 180, 0, 180, 0; lat=-90,90; lat_bnd=-90,0,0,90; lat_cal=1.,2.,3.,4.,5.,6.,7.,8.,9.,10.; lon_cal=1.,2.,3.,4.,5.,6.,7.,8.,9.,10.; lat_times_lon=0,1,2,3,4,5,6,7; lat_times_lon_nbr=8; lat_1D_rct=-90, -90, -90, -90, 90, 90, 90, 90; lon_1D_rct= 0, 90, 180, 270, 0, 90, 180, 270; lat_1D_rrg=-90, -30, -30, 0, 0, 30, 30, 90; lon_1D_rrg= 0, 0, 180, 0, 180, 0, 180, 0; lat_2D_rct=-90, -90, -90, -90, 90, 90, 90, 90; lon_2D_rct= 0, 90, 180, 270, 0, 90, 180, 270; lat_2D_rrg=-90, -30, -30, 0, 0, 30, 30, 90; lon_2D_rrg= 0, 0, 180, 0, 180, 0, 180, 0; lat_grd=-90,0,90; lat_cpy=-90,90; lat_var=1.,2.; lat_wgt=1.,2.; // lat_T42=0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63; lat_T42=-88.240089,-85.092445,-82.311981,-79.525253,-76.736732,-73.947418,-71.157700,-68.367722,-65.577576,-62.787331,-59.997005,-57.206619,-54.416191,-51.625729,-48.835236,-46.044724,-43.254192,-40.463646,-37.673088,-34.882519,-32.091942,-29.301357,-26.510769,-23.720173,-20.929573,-18.138969,-15.348364,-12.557755,-9.767145,-6.976533,-4.185921,-1.395307,1.395307,4.185921,6.976533,9.767145,12.557755,15.348364,18.138969,20.929573,23.720173,26.510769,29.301357,32.091942,34.882519,37.673088,40.463646,43.254192,46.044724,48.835236,51.625729,54.416191,57.206619,59.997005,62.787331,65.577576,68.367722,71.157700,73.947418,76.736732,79.525253,82.311981,85.092445,88.240089; lsmlev=0.05,0.1,0.2,0.5,1.0,3.0; lev=100,500,1000; ilev=0,300,300,750,750,1013.25; lev_cpy=100,500,1000; lev_var=100.,500.,1000.; lev_wgt=10,2,1; lon=0,90,180,270; lond=0,90,180,270; lonf=0,90,180,270; lon_grd=-45,45,135,225,315; lon_wgt=0.347855,0.652145,0.652145,0.347855; // lon_T42=0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127; lon_T42=0.000000,2.812500,5.625000,8.437500,11.250000,14.062500,16.875000,19.687500,22.500000,25.312500,28.125000,30.937500,33.750000,36.562500,39.375000,42.187500,45.000000,47.812500,50.625000,53.437500,56.250000,59.062500,61.875000,64.687500,67.500000,70.312500,73.125000,75.937500,78.750000,81.562500,84.375000,87.187500,90.000000,92.812500,95.625000,98.437500,101.250000,104.062500,106.875000,109.687500,112.500000,115.312500,118.125000,120.937500,123.750000,126.562500,129.375000,132.187500,135.000000,137.812500,140.625000,143.437500,146.250000,149.062500,151.875000,154.687500,157.500000,160.312500,163.125000,165.937500,168.750000,171.562500,174.375000,177.187500,180.000000,182.812500,185.625000,188.437500,191.250000,194.062500,196.875000,199.687500,202.500000,205.312500,208.125000,210.937500,213.750000,216.562500,219.375000,222.187500,225.000000,227.812500,230.625000,233.437500,236.250000,239.062500,241.875000,244.687500,247.500000,250.312500,253.125000,255.937500,258.750000,261.562500,264.375000,267.187500,270.000000,272.812500,275.625000,278.437500,281.250000,284.062500,286.875000,289.687500,292.500000,295.312500,298.125000,300.937500,303.750000,306.562500,309.375000,312.187500,315.000000,317.812500,320.625000,323.437500,326.250000,329.062500,331.875000,334.687500,337.500000,340.312500,343.125000,345.937500,348.750000,351.562500,354.375000,357.187500; mask=0.,1.,0.,0.,1.,1.,0.,2.; var_msk=0.,1.,0.,0.,1.,1.,0.,2.; ORO=0.,1.,0.,0.,1.,1.,0.,2.; // mask=0.,0.,0.,0.,0.,0.,0.,0.; // mask=1.,1.,1.,1.,1.,1.,1.,1.; fll_val=73,-999,73,-999; fll_val_mss_val=73,-999,73,-999; msk_prt_mss_prt=0.5,1.0e36,1.5,1.0e36; mss_val=73,1.0e36,73,1.0e36; mss_val_all=1.0e36,1.0e36,1.0e36,1.0e36; mss_val_fst=-999,73,-999,73; mss_val_scl=1.0e36; negative_one=-1.; nm_pnd=1; nm_spc=1; no_mss_val=73,1.0e36,73,1.0e36; non_nul_trm_char_one_dmn='a','b'; non_nul_trm_char_two_dmn="abcd","efgh","ijkm"; one=1.; one_dmn_rec_var=1,2,3,4,5,6,7,8,9,10; one_dmn_rec_var_missing_value=1,2,3,4,5,6,7,8,9,1.0e36; one_dmn_rec_var__FillValue=1,2,3,4,5,6,7,8,9,1.0e36; RDM=1,9,36,84,126,126,84,36,9,1; one_dmn_rec_var_sng="Hello Wor"; one_dmn_var=1.,10.; one_dmn_int_val_one=1,1; one_dmn_int_val_two=2,2; pck=1; rec_var_pck_scale_factor_only=1,2,3,4,5,6,7,8,9,10; pck_arr=-32767,0,1,32767; pi=3.1415926535897932384626433832795029; upk=3.; upk_arr=-32767.,0.,1.,32767.; H2O=1.0; H2OH2O=1.0; H2SO4=1.0; H2O_lqd=1.0; H2O_ice=1.0; Q=1.0e36; Q1=1.0e36; AQ01=1.0e36; QQ01=1.0e36; QA01=1.0e36; Q01Q=1.0e36; Q01=1; Q02=2; Q03=3; Q04=4; Q05=5; Q06=6; Q07=7; Q08=8; Q09=9; Q10=10; Q11=11; Q12=12; Q13=13; Q14=14; Q15=15; Q16=16; Q17=17; Q18=18; Q19=19; Q20=20; Q21=21; Q22=22; Q23=23; Q24=24; Q25=25; Q26=26; Q27=27; Q28=28; Q29=29; Q30=30; Q31=31; Q32=32; Q33=33; Q34=34; Q35=35; Q36=36; Q37=37; Q38=38; Q39=39; Q40=40; Q41=41; Q42=42; Q43=43; Q44=44; Q45=45; Q46=46; Q47=47; Q48=48; Q49=49; Q50=50; Q51=51; Q52=52; Q53=53; Q54=54; Q55=55; Q56=56; Q57=57; Q58=58; Q59=59; Q60=60; Q61=61; Q62=62; Q63=63; Q64=64; Q65=65; Q66=66; Q67=67; Q68=68; Q69=69; Q70=70; Q71=71; Q72=72; Q73=73; Q74=74; Q75=75; Q76=76; Q77=77; Q78=78; Q79=79; Q80=80; Q81=81; Q82=82; Q83=83; Q84=84; Q85=85; Q86=86; Q87=87; Q88=88; Q89=89; Q90=90; Q91=91; Q92=92; Q93=93; Q94=94; Q95=95; Q96=96; Q97=97; Q98=98; Q99=99; Q100=100; non_rec_var_flt_pck=1,2,3,4; rec_var_dbl=1.,2.,3.,4.,5.,6.,7.,8.,9.,10.; rec_var_dbl_mss_val_dbl_upk=-999.,2.,3.,4.,5.,6.,7.,8.,-999.,-999.; rec_var_dbl_mss_val_sht_pck=-999,32767,21845,10922,0,-10922,-21845,-32767,-999,-999; rec_var_dbl_pck=1,2,3,4,5,6,7,8,9,10; rec_var_flt=1.,2.,3.,4.,5.,6.,7.,8.,9.,10.; rec_var_flt_mss_val_dbl=1.0e36,2.,3.,4.,5.,6.,7.,8.,1.0e36,1.0e36; rec_var_flt_mss_val_flt_all=1.0e36,1.0e36,1.0e36,1.0e36,1.0e36,1.0e36,1.0e36,1.0e36,1.0e36,1.0e36; rec_var_flt_mss_val_flt_all_but_one=1.0e36,1.0e36,1.0e36,1.0e36,5.0,1.0e36,1.0e36,1.0e36,1.0e36,1.0e36; rec_var_flt_mss_val_flt_all_but_two=1.0e36,1.0e36,1.0e36,1.0e36,5.0,1.0e36,1.0e36,1.0e36,1.0e36,10.0; rec_var_flt_pck=1,2,3,4,5,6,7,8,9,10; rec_var_int_mss_val_int=-999,2,3,4,5,6,7,8,-999,-999; rlev=1000,500,100; rz=0,5000,17000; scl_dbl_pck=10922; scalar_var=10.; short_var=10; three=3.; three_dmn_var=0.,1.,2.,3.,4.,5.,6.,7.,8.,9.,10.,11.,12.,13.,14.,15.,16.,17.,18.,19.,20.,21.,22.,23.; three_dmn_var_crd=0.,1.,2.,3.,12.,13.,14.,15.,4.,5.,6.,7.,16.,17.,18.,19.,8.,9.,10.,11.,20.,21.,22.,23.; time=1.,2.,3.,4.,5.,6.,7.,8.,9.,10.; time_bnds=0.5,1.5,1.5,2.5,2.5,3.5,3.5,4.5,4.5,5.5,5.5,6.5,6.5,7.5,7.5,8.5,8.5,9.5,9.5,10.5; od=20,22,24,26,28,30,32,34,36,38; tpt=273.1,273.2,273.3,273.4,273.5,273.6,273.7,273.8,273.9,274.0; two=2.; two_dmn_var=1.5,5.5,9.5,13.5,17.5,21.5; u=1.,0.,1.,0.,1.,0.,1.,0.,1.,0.; v=0.,1.,0.,1.,0.,1.,0.,1.,0.,1.; val_half=0.5; val_half_half=0.5,0.5; val_max_max_sht=17000,17000; val_one_int=1; val_one_mss=1.,1.0e36; val_one_mss_int=1,-99; val_one_one_int=1,1; var_nm-dash=1.0; var_nm.dot=1.0; var_1D_rct=0.,1.,0.,0.,1.,1.,0.,2.; var_1D_rrg=0.,1.,0.,0.,1.,1.,0.,2.; var_2D_rct=0.,1.,0.,0.,1.,1.,0.,2.; var_2D_rrg=0.,1.,0.,0.,1.,1.,0.,2.; weight=10.,10.; wgt_one=1.,1.; wvl=0.5e-6,1.0e-6; z=17000,5000,0; zero=0.; // date=640312,640313,640314,640315,640316,640317,640318,640319,640320,640321; date=640224,640225,640226,640227,640228,640301,640302,640303,640304,640305; int_var=10; nbdate=640224; fl_nm_arr="/data/zender/dstccm04/dstccm04_8589_01.nc", "/data/zender/dstccm04/dstccm04_8589_02.nc", "/data/zender/dstccm04/dstccm04_8589_03.nc"; time_lon=0.0,90.0,180.0,270.0, 0.0,90.0,180.0,270.0, 0.0,90.0,180.0,270.0, 0.0,90.0,180.0,270.0, 0.0,90.0,180.0,270.0, 0.0,90.0,180.0,270.0, 0.0,90.0,180.0,270.0, 0.0,90.0,180.0,270.0, 0.0,90.0,180.0,270.0, 0.0,90.0,180.0,270.0; two_dmn_rec_var_sng="abc", "bcd", "cde", "def", "efg", "fgh", "ghi", "hij", "jkl", "klm"; two_dmn_rec_var=1.,2.0,3., 1.,2.1,3., 1.,2.2,3., 1.,2.3,3., 1.,2.4,3., 1.,2.5,3., 1.,2.6,3., 1.,2.7,3., 1.,2.8,3., 1.,2.9,3.; three_dmn_rec_var= 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16, 17,18,19,20,21,22,23,24, 25,26,27,28,29,30,31,32, 33,34,35,36,37,38,39,40, 41,42,43,44,45,46,47,48, 49,50,51,52,53,54,55,56, 57,58,59,60,61,62,63,64, 65,66,67,68,69,70,71,72, 73,74,75,76,77,78,79,80; prs_sfc= 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16, 17,18,19,20,21,22,23,24, 25,26,27,28,29,30,31,32, 33,34,35,36,37,38,39,40, 41,42,43,44,45,46,47,48, 49,50,51,52,53,54,55,56, 57,58,59,60,61,62,63,64, 65,66,67,68,69,70,71,72, 73,74,75,76,77,78,79,80; PS= 101325,101325,101325,101325,101325,101325,101325,101325, 101325,101325,101325,101325,101325,101325,101325,101325, 101325,101325,101325,101325,101325,101325,101325,101325, 101325,101325,101325,101325,101325,101325,101325,101325, 101325,101325,101325,101325,101325,101325,101325,101325, 101325,101325,101325,101325,101325,101325,101325,101325, 101325,101325,101325,101325,101325,101325,101325,101325, 101325,101325,101325,101325,101325,101325,101325,101325, 101325,101325,101325,101325,101325,101325,101325,101325, 101325,101325,101325,101325,101325,101325,101325,101325; three_dmn_var_dbl= 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16, 17,18,19,20,21,22,23,24, -99,-99,-99,-99,-99,-99,-99,-99, 33,34,35,36,37,38,39,40, 41,42,43,44,45,46,47,48, 49,50,51,52,53,54,55,56, -99,58,59,60,61,62,63,64, 65,66,67,68,69,70,71,72, -99,74,75,76,77,78,79,-99; three_dmn_var_int= 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16, -99,-99,-99,-99,-99,-99,-99,-99, 25,26,27,28,29,30,31,32, 33,34,35,36,37,38,39,40, 41,-99,43,44,45,46,47,48, 49,50,51,52,53,54,55,56, -99,58,59,60,-99,62,63,64, 65,-99,67,68,69,70,71,72, -99,74,75,-99,77,78,79,80; three_dmn_var_sht= 1, 2, 3, 4, 5, 6, 7, 8, -99,10,11,12,13,14,15,16, 17,18,19,20,21,22,23,24, 25,26,27,28,29,30,31,32, -99,34,35,-99,37,38,39,40, 41,42,43,44,-99,46,47,48, 49,50,51,52,53,54,55,56, 57,58,59,-99,61,62,63,64, 65,66,67,68,69,70,71,72, -99,-99,-99,-99,-99,-99,-99,-99; th= 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16, 17,18,19,20,21,22,23,24, -99,-99,-99,-99,-99,-99,-99,-99, 33,34,35,36,37,38,39,40, 41,42,43,44,45,46,47,48, 49,50,51,52,53,54,55,56, -99,58,59,60,61,62,63,64, 65,66,67,68,69,70,71,72, -99,74,75,76,77,78,79,-99; four_dmn_rec_var= 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,100,101,102,103,104,105,106,107,108, 109,110,111,112,113,114,115,116,117,118,119,120, 121,122,123,124,125,126,127,128,129,130,131,132, 133,134,135,136,137,138,139,140,141,142,143,144, 145,146,147,148,149,150,151,152,153,154,155,156, 157,158,159,160,161,162,163,164,165,166,167,168, 169,170,171,172,173,174,175,176,177,178,179,180, 181,182,183,184,185,186,187,188,189,190,191,192, 193,194,195,196,197,198,199,200,201,202,203,204, 205,206,207,208,209,210,211,212,213,214,215,216, 217,218,219,220,221,222,223,224,225,226,227,228, 229,230,231,232,233,234,235,236,237,238,239,240; td= 1,2,3,4,5,6,7,8,9,10; tx= 1,2,3,4,5,6,7,8,9,10, 11,12,13,14,15,16,17,18,19,20, 21,22,23,24,25,26,27,28,29,30, 31,32,33,34,35,36,37,38,39,40; ty= 1,2,3,4,5,6,7,8,9,10, 11,12,13,14,15,16,17,18,19,20; tz= 1,2,3,4,5,6,7,8,9,10, 11,12,13,14,15,16,17,18,19,20, 21,22,23,24,25,26,27,28,29,30; txyz= 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,100,101,102,103,104,105,106,107,108, 109,110,111,112,113,114,115,116,117,118,119,120, 121,122,123,124,125,126,127,128,129,130,131,132, 133,134,135,136,137,138,139,140,141,142,143,144, 145,146,147,148,149,150,151,152,153,154,155,156, 157,158,159,160,161,162,163,164,165,166,167,168, 169,170,171,172,173,174,175,176,177,178,179,180, 181,182,183,184,185,186,187,188,189,190,191,192, 193,194,195,196,197,198,199,200,201,202,203,204, 205,206,207,208,209,210,211,212,213,214,215,216, 217,218,219,220,221,222,223,224,225,226,227,228, 229,230,231,232,233,234,235,236,237,238,239,240; // three_double_dmn= 1, 2, 3, 4, 5, 6, 7, 8, // 9,10,11,12,13,14,15,16, // 17,18,19,20,21,22,23,24, // -99,-99,-99,-99,-99,-99,-99,-99, // 33,34,35,36,37,38,39,40, // 41,42,43,44,45,46,47,48, // 49,50,51,52,53,54,55,56, // -99,58,59,60,61,62,63,64, // 65,66,67,68,69,70,71,72, // -99,74,75,76,77,78,79,-99, // 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, // 9.5,10.5,11.5,12.5,13.5,14.5,15.5,16.5, // 17.5,18.5,19.5,20.5,21.5,22.5,23.5,24.5, // -99.5,-99.5,-99.5,-99.5,-99.5,-99.5,-99.5,-99.5, // 33.5,34.5,35.5,36.5,37.5,38.5,39.5,40.5, // 41.5,42.5,43.5,44.5,45.5,46.5,47.5,48.5, // 49.5,50.5,51.5,52.5,53.5,54.5,55.5,56.5, // -99.5,58.5,59.5,60.5,61.5,62.5,63.5,64.5, // 65.5,66.5,67.5,68.5,69.5,70.5,71.5,72.5, // -99.5,74.5,75.5,76.5,77.5,78.5,79.5,-99.5; time_udunits = 876012, 876018, 876024; wnd_spd= -999,0.5,1.5,0.5,1.5,0.5,1.5,0.5, 0.5,-999,0.5,0.5,0.5,0.5,0.5,0.5, 0.5,1.5,-999,1.5,0.5,1.5,0.5,1.5, 0.5,0.5,0.5,-999,0.5,0.5,0.5,0.5, 1.5,1.5,1.5,1.5,-999,1.5,1.5,1.5, 0.5,0.5,0.5,0.5,0.5,-999,0.5,0.5, 2.5,2.5,2.5,2.5,2.5,2.5,-999,2.5, 0.5,0.5,0.5,0.5,0.5,0.5,0.5,-999, 0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5, 0.5,0.5,2.5,0.5,0.5,2.5,0.5,0.5; } nco-5.3.3/data/in_rec_zero.cdl000066400000000000000000000015271477164337000162150ustar00rootroot00000000000000// ncgen -b -o ~/nco/data/in_rec_zero.nc ~/nco/data/in_rec_zero.cdl netcdf in_rec_zero { dimensions: lon = 4 ; time = UNLIMITED ; // (10 currently) variables: float lon(lon) ; lon:long_name = "Latitude" ; lon:units = "degrees_north" ; float one ; one:long_name = "one" ; double time(time) ; time:long_name = "record variable of size zero (no data yet)"; // global attributes: :Conventions = "NCAR-CSM" ; :history = "Thu May 4 17:30:29 2006: ncks -v one,lon,time /home/zender/nco/data/in.nc /home/zender/foo.nc\n", "History global attribute.\n", "" ; :julian_day = 200000.04 ; :RCS_Header = "$Header$" ; data: lon = 0, 90, 180, 270 ; one = 1 ; } nco-5.3.3/data/in_zarr.cdl000066400000000000000000002523131477164337000153640ustar00rootroot00000000000000// -*-C++-*- // Purpose: CDL file to generate NCZarr-compatible test file with only netCDF3 atomic types for NCO // Derived by removing NCZarr incompatibilities from in.cdl // Changes include: // Changing time from NC_UNLIMITED to fixed size 10 // Usage: // netCDF4: ncgen arguments depend on version: // "-k netCDF-4" for netCDF >= 3.6.3, "-k hdf5" for netCDF < 3.6.3 // "-k netCDF-4 classic model" for netCDF >= 3.6.3, "-k hdf5-nc3" for netCDF < 3.6.3 // /usr/local/bin/ncgen -k netCDF-4 -b -o in_zarr.nc in_zarr.cdl // /usr/local/bin/ncgen -k netCDF-4 -b -o ${HOME}/nco/data/in_zarr.nc ${HOME}/nco/data/in_zarr.cdl // /opt/netcdf/bin/ncgen -lb -o "file://${HOME}/in_zarr#mode=nczarr,file" ${HOME}/nco/data/in_zarr.cdl // NB: netCDF-classic files will be enormous unless/until _ChunkSizes attributes added to time // /usr/local/bin/ncgen -k hdf5-nc3 -b -o in_zarrc.nc in_zarr.cdl // /usr/local/bin/ncgen -k hdf5-nc3 -b -o ${HOME}/nco/data/in_zarrc.nc ${HOME}/nco/data/in_zarr.cdl // URL: // http://dust.ess.uci.edu/nco/in_zarr.nc // http://dust.ess.uci.edu/nco/in_zarr.nc // http://thredds-test.ucar.edu/thredds/dodsC/testdods/in_zarr.nc // netCDF3: // ncgen -b -o in_zarr.nc in_zarr.cdl // ncgen -b -o ${HOME}/nco/data/in_zarr.nc ${HOME}/nco/data/in_zarr.cdl // scp ~/nco/data/in_zarr.cdl ~/nco/data/in_4.nc dust.ess.uci.edu:nco/data // scp ~/nco/data/in_zarr.nc ~/nco/data/in_4.nc dust.ess.uci.edu:/var/www/html/nco // scp ~/nco/data/in_zarr.nc ~/nco/data/in_4.nc dust.ess.uci.edu:/var/www/html/dodsdata // mswrite -t 365 ~/nco/data/in_zarr.nc /ZENDER/tmp/in_zarr.nc // mswrite -t 365 ~/nco/data/in_zarr.nc /ZENDER/tmp/h0001.nc // mswrite -t 365 ~/nco/data/in_zarr.nc /ZENDER/tmp/h0002.nc // mswrite -t 365 ~/nco/data/in_zarr.nc /ZENDER/tmp/h0003.nc // mswrite -t 365 ~/nco/data/in_zarr.nc /ZENDER/tmp/h0004.nc // msrcp -period 365 ~/nco/data/in_zarr.nc mss:/ZENDER/tmp/in_zarr.nc // msrcp -period 365 ~/nco/data/in_zarr.nc mss:/ZENDER/tmp/h0001.nc // msrcp -period 365 ~/nco/data/in_zarr.nc mss:/ZENDER/tmp/h0002.nc // msrcp -period 365 ~/nco/data/in_zarr.nc mss:/ZENDER/tmp/h0003.nc // msrcp -period 365 ~/nco/data/in_zarr.nc mss:/ZENDER/tmp/h0004.nc // WARNING: Changing values of variables below, especially coordinate variables, affects outcome of nco_tst.pl test script // Other programs, e.g., ~/f/fff.F90, ~/c++/ccc.cc, ~/c/c.c may also break // In particular, do not change number of elements in record coordinate, time, without simultaneously changing number of data in all record variables // My (and NCO's) convention is that the _FillValue, if any, of any packed variable should be of the same type as the expanded variable. Hence _FillValue, add_offset, and scale_factor should all be of the same type. Variables that do not adhere to this convention are not supported. // Bugs: // Some triggering bugs were moved to buggy.cdl to prevent non-builds // ncgen 4.0.0--4.3.2 crashes on 'l' or 'L' syntax when generating netCDF4-classic (but not netCDF3 or netCDF4) files until 20141010 (NCF-318) // CDL Data constants: // http://www.unidata.ucar.edu/software/netcdf/docs/netcdf/CDL-Syntax.html // byte: 'a' // char: "a" // short: 1s // int: 1 (no decimal point) // long: 1 (_not_ 1l;) (long is synonym for int in netCDF3) // float: 1.f (decimal point is required, f is required to distinguish from double) // double: 1.0, 1.d, 1.0e-20 (decimal point is required, d is not required) // CDL complex types: // roulee:/data/zender/tmp/netcdf-4.2.1/nc_test/ref_tst_diskless2.cdl // NCL usage: // id_in=addfile("/home/zender/nco/data/in.nc","r") // print(id_in) // list_filevars(id_in) netcdf in_zarr { dimensions: dgn=1,bnd=2,lat=2,lat_grd=3,lev=3,rlev=3,ilev=4,lon=4,lon_grd=5,char_dmn_lng80=80,char_dmn_lng26=26,char_dmn_lng04=4,date_dmn=5,fl_dmn=3,lsmlev=6,wvl=2,time_int_udunits=1;time_udunits=3;lon_T42=128,lat_T42=64,lat_times_lon=8,gds_crd=8,gds_ncd=8,lon_cal=10,lat_cal=10,Lon=4,Lat=2,pck_crd=4,vrt_nbr=2,time=10; variables: :Conventions = "CF-1.5"; :history = "History global attribute.\nTextual attributes like history often have embedded newlines like this.\nSuch newlines should serve as linebreaks on the screen to enhance legibility like this.\nFriendly CDL converters print a single NC_CHAR attribute as a comma-separated list of strings where each embedded delimiter marks a linebreak. This makes poetry embedded in CDL much nicer to read (except for the printed literal \\n\'s---those are an eyesore):\n\nA POET by Hafiz\n\nA poet is someone\nWho can pour light into a cup,\nThen raise it to nourish\nYour beautiful parched, holy mouth\n"; :lorem_ipsum = "The Lorem Ipsum attribute demonstrates the legibility of text without embedded linebreaks:\nLorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Lady Gaga amat indueris vestimento laetus. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."; :julian_day = 200000.04; :RCS_Header = "$Header$"; // netCDF3 atomic types: int date_int(date_dmn); date_int:long_name = "Date (as array of ints: YYYY,MM,DD,HH,MM)"; float dgn(dgn); dgn:long_name = "degenerate coordinate (dgn means degenerate, i.e., of size 1)"; float dgn_var(dgn); dgn_var:long_name = "degenerate variable (dgn means degenerate, i.e., of size 1)"; float lat(lat); lat:long_name = "Latitude (typically midpoints)"; lat:units = "degrees_north"; lat:bounds = "lat_bnd"; float lat_bnd(lat,vrt_nbr); lat_bnd:purpose = "Cell boundaries for lat coordinate"; float lat_grd(lat_grd); lat_grd:long_name = "Latitude grid (typically interfaces)"; lat_grd:units = "degrees_north"; float lat_cpy(lat); float lev_cpy(lev); float lat_var(lat); float lat_wgt(lat); float lon_T42(lon_T42); float lat_T42(lat_T42); float lat_1D_rct(lat_times_lon); lat_1D_rct:long_name = "Latitude for 2D rectangular grid stored as 1D arrays"; lat_1D_rct:units = "degrees_north"; float lon_1D_rct(lat_times_lon); lon_1D_rct:long_name = "Longitude for 2D rectangular grid stored as 1D arrays"; lon_1D_rct:units = "degrees_east"; float lat_1D_rrg(lat_times_lon); lat_1D_rrg:long_name = "Latitude for 2D irregular grid stored as 1D arrays"; lat_1D_rrg:units = "degrees_north"; float lon_1D_rrg(lat_times_lon); lon_1D_rrg:long_name = "Longitude for 2D irregular grid stored as 1D arrays"; lon_1D_rrg:units = "degrees_east"; int lat_times_lon(lat_times_lon); lat_times_lon:long_name = "Element index (i.e., C-based storage order) for 2D coordinate grids stored as 1D arrays"; float lat_2D_rct(lat,lon); lat_2D_rct:long_name = "Latitude for 2D rectangular grid stored as 2D array"; lat_2D_rct:units = "degrees_north"; float lon_2D_rct(lat,lon); lon_2D_rct:long_name = "Longitude for 2D rectangular grid stored as 2D array"; lon_2D_rct:units = "degrees_east"; float lat_2D_rrg(lat,lon); lat_2D_rrg:long_name = "Latitude for 2D irregular grid stored as 2D array"; lat_2D_rrg:units = "degrees_north"; float lon_2D_rrg(lat,lon); lon_2D_rrg:long_name = "Longitude for 2D irregular grid stored as 2D array"; lon_2D_rrg:units = "degrees_east"; int lat_times_lon_nbr; lat_times_lon_nbr:long_name = "Number of elements in 2D coordinate grids. Rectangular and irregular test grids have this many total elements. The coordinates and elements are stored as 1D or 2D arrays for grid types 1D and 2D respectively."; float lev(lev); lev:purpose = "Monotonically increasing coordinate pressure"; lev:long_name = "hybrid level at midpoints (1000*(A+B))"; lev:units = "hPa"; lev:positive = "down"; lev:A_var = "hyam"; lev:B_var = "hybm"; lev:P0_var = "P0"; lev:PS_var = "PS"; lev:bounds = "lev_bnd"; lev:standard_name = "atmosphere_hybrid_sigma_pressure_coordinate"; lev:formula_terms = "a: hyam b: hybm p0: P0 ps: PS"; lev:formula_readable = "prs_mdp[time,lat,lon,lev]=P0*hyam+PS*hybm"; float ilev(ilev); ilev:purpose = "Monotonically increasing coordinate pressure"; ilev:long_name = "hybrid level at interfaces (1000*(A+B))"; ilev:units = "hPa"; ilev:positive = "down"; ilev:A_var = "hyai"; ilev:B_var = "hybi"; ilev:P0_var = "P0"; ilev:PS_var = "PS"; ilev:standard_name = "atmosphere_hybrid_sigma_pressure_coordinate"; ilev:formula_terms = "a: hyai b: hybi p0: P0 ps: PS"; ilev:formula_readable = "prs_ntf[time,lat,lon,ilev]=P0*hyai+PS*hybi"; float lev_bnd(lev,vrt_nbr); lev_bnd:purpose = "Cell boundaries for lev coordinate"; float rlev(rlev); rlev:purpose = "Monotonically decreasing coordinate pressure"; float lon(lon); lon:long_name = "Longitude (typically midpoints)"; lon:units = "degrees_east"; double Lon(Lon); Lon:long_name = "Longitude"; Lon:units = "degrees"; Lon:purpose = "Longitude coordinate originally stored as -180 to 180"; Lon:notes = "Longitude = [-180.0,180.0) is not CF-compliant, yet is common"; double LatLon(Lat,Lon); LatLon:long_name = "2D variable originally stored on -180 to 180 longitude grid"; LatLon:units = "fraction"; LatLon:purpose = "Demonstrate remapping of [-180,180) to [0,360) longitude-grid data"; double Lat(Lat); Lat:long_name = "Latitude"; Lat:units = "degrees_north"; Lat:purpose = "Latitude paired with Longitude coordinate originally stored as -180 to 180."; double lond(lon); lond:long_name = "Longitude (typically midpoints), double precision"; lond:units = "degrees_east"; float lonf(lon); lonf:long_name = "Longitude (typically midpoints), single precision"; lonf:units = "degrees_east"; float lon_grd(lon_grd); lon_grd:long_name = "Longitude grid (typically interfaces)"; lon_grd:units = "degrees_east"; double time(time); time:long_name = "time"; time:units = "days since 1964-03-12 12:09:00 -9:00"; time:calendar = "gregorian"; time:bounds = "time_bnds"; time:climatology = "climatology_bounds"; float time_bnds(time,vrt_nbr); time_bnds:purpose = "Cell boundaries for time coordinate"; float climatology_bounds(time,vrt_nbr); climatology_bounds:purpose = "Variable containing CF-compliant climatology bounds for time dimension"; double time_rpt(time); time_rpt:long_name = "A repeating sequence to check compliance of MRO"; time_rpt:purpose = "Sequence is 1,2,3,1,2,3,1,2,3,1. Average of every third element should be the same as the element, e.g., ncra -O --mro -d time,,,3,3 ~/nco/data/in.nc ~/foo.nc;ncks -C -v time_rpt ~/foo.nc"; double lon_cal(lon_cal); lon_cal:long_name = "lon_cal"; lon_cal:units = "days since 1964-2-28"; lon_cal:calendar = "365_day"; double lat_cal(lat_cal); lat_cal:long_name = "lat_cal"; lat_cal:units = "days since 1964-2-28"; lat_cal:calendar = "360_day"; double tm_scn; tm_scn:units = "seconds since 2013-01-01"; double tm_std; tm_std:units = "days since 2013-01-01"; double tm_grg; tm_grg:units = "days since 2013-01-01"; tm_grg:calendar = "gregorian"; // Same as "standard" double tm_jln; tm_jln:units = "days since 2013-01-01"; tm_jln:calendar = "julian"; double tm_360; tm_360:units = "days since 2013-01-01"; tm_360:calendar = "360_day"; double tm_365; tm_365:units = "days since 2013-01-01"; tm_365:calendar = "365_day"; // Same as "noleap" double tm_366; tm_366:units = "days since 2013-01-01"; tm_366:calendar = "366_day"; // Same as "all_leap" float lsmlev(lsmlev); lsmlev:purpose = "Homebrew level coordinate for LSM"; lsmlev:long_name = "Soil depth"; lsmlev:units = "meter"; float wvl(wvl); wvl:long_name = "Wavelength"; wvl:units = "meter"; int od(time); double areacella(lat,lon); areacella:standard_name = "area"; areacella:long_name = "area"; areacella:units = "meter2"; areacella:purpose = "Variable to hold cell areas of 2D fields. Intended to be pointed to by cell_measures attribute of 2D fields. Would have named it plain-old area but too many regression tests already depend on 1D float area below. areacella is name used by ESGF-distributed versions of some CESM simulations anyway, e.g., baseURL: http://cmip-pcmdi.llnl.gov/CMIP5/dataLocation gridspecFile: gridspec_atmos_fx_CCSM4_amip_r0i0p0.nc areacella: areacella_fx_CCSM4_amip_r0i0p0.nc"; float area(lat); area:long_name = "area"; area:units = "meter2"; float area2(lat); area2:long_name = "area version 2"; area2:units = "meter2"; float area_asm(lat); area_asm:long_name = "area asymmetric"; area_asm:units = "meter2"; float hyam(lev); hyam:long_name = "hybrid A coefficient at layer midpoints"; float hybm(lev); hybm:long_name = "hybrid B coefficient at layer midpoints"; float hyai(ilev); hyai:long_name = "hybrid A coefficient at layer interfaces"; float hybi(ilev); hybi:long_name = "hybrid B coefficient at layer interfaces"; float P0; P0:long_name = "reference pressure"; P0:units = "pascal"; float cnv_CF_grd(lat,lon); cnv_CF_grd:long_name = "test CF grid_mapping convention"; cnv_CF_grd:grid_mapping = "albers_conical_equal_area"; cnv_CF_grd:purpose = "Test whether grid_mapping is propagated with coordinate"; char mapping; mapping:geoid = "eigen-6c4" ; mapping:grid_mapping_name = "polar_stereographic" ; mapping:latitude_of_projection_origin = -90. ; mapping:standard_parallel = -71. ; mapping:straight_vertical_longitude_from_pole = 0. ; mapping:semi_major_axis = 6378273. ; mapping:inverse_flattening = 298.27940504282 ; mapping:false_easting = 0. ; mapping:false_northing = 0. ; char albers_conical_equal_area; albers_conical_equal_area:long_name = "Albers Conical Equal Area Projection"; albers_conical_equal_area:purpose = "Test that this grid_mapping is propagated with all associated variables (like cnv_CF_grd)"; albers_conical_equal_area:grid_mapping_name = "albers_conical_equal_area"; albers_conical_equal_area:false_easting = 0.; albers_conical_equal_area:false_northing = 0.; albers_conical_equal_area:latitude_of_projection_origin = 40.; albers_conical_equal_area:longitude_of_central_meridian = -101.; albers_conical_equal_area:standard_parallel = 20., 60.; albers_conical_equal_area:longitude_of_prime_meridian = 0.; albers_conical_equal_area:semi_major_axis = 6378137.; float cnv_CF_crd(gds_crd); cnv_CF_crd:long_name = "test CF coordinates conventions"; cnv_CF_crd:coordinates = "lat_gds lon_gds "; cnv_CF_crd:reason = "Test whether coordinates attribute strings that end with a space break after nco_var_lst_crd_ass_add() call to nco_lst_prs_2d()"; float cnv_CF_ncl(time); cnv_CF_ncl:long_name = "test CF ancillary_variables convention"; cnv_CF_ncl:standard_name = "specific_humidity"; cnv_CF_ncl:ancillary_variables = "cnv_CF_ncl_var_1 cnv_CF_ncl_var_2"; cnv_CF_ncl:purpose = "Main variable that has ancillary variables named cnv_CF_ncl_var_1 and cnv_CF_ncl_var_2"; float cnv_CF_ncl_var_1(time); cnv_CF_ncl_var_1:long_name = "test CF ancillary_variables convention"; cnv_CF_ncl_var_1:standard_name = "specific_humidity standard_error"; cnv_CF_ncl_var_1:purpose = "Ancillary variable for cnv_CF_ncl. Other ancillary variable is cnv_CF_ncl_var_2."; float cnv_CF_ncl_var_2(time); cnv_CF_ncl_var_2:long_name = "test CF ancillary_variables convention"; cnv_CF_ncl_var_2:standard_name = "specific_humidity detection_limit"; cnv_CF_ncl_var_2:purpose = "Ancillary variable for cnv_CF_ncl. Other ancillary variable is cnv_CF_ncl_var_1."; float PS(time,lat,lon); PS:long_name = "surface pressure"; PS:units = "pascal"; char fl_dmn(fl_dmn); fl_dmn:long_name = "Character coordinate"; fl_dmn:units = "[chr]"; double lat_gds(gds_crd); lat_gds:long_name = "Latitude"; lat_gds:standard_name = "latitude"; lat_gds:units="degree"; lat_gds:purpose = "1-D latitude coordinate referred to by geodesic grid variables"; double lon_gds(gds_crd); lon_gds:long_name = "Longitude"; lon_gds:standard_name = "longitude"; lon_gds:units="degree"; lon_gds:purpose = "1-D longitude coordinate referred to by geodesic grid variables"; float gds_crd(gds_crd); gds_crd:long_name = "Geodesic coordinate"; gds_crd:units = "degree"; gds_crd:purpose = "enumerated coordinate like those that might define points in a geodesic grid"; gds_crd:coordinates = "lat_gds lon_gds"; float gds_var(gds_crd); gds_var:long_name = "Geodesic variable"; gds_var:units = "meter"; gds_var:purpose = "Test auxiliary coordinates like those that define geodesic grids"; gds_var:coordinates = "lat_gds lon_gds"; float gds_3dvar(time,gds_crd); gds_3dvar:long_name = "Geodesic variable"; gds_3dvar:units = "meter"; gds_3dvar:coordinates = "lat_gds lon_gds"; gds_3dvar:purpose = "Test auxiliary coordinates like those that define geodesic grids"; float gds_var_ncd(gds_ncd); gds_var_ncd:long_name = "Geodesic variable on non-coordinate grid"; gds_var_ncd:units = "meter"; gds_var_ncd:purpose = "Test auxiliary coordinates like those that define geodesic grids but where underlying dimension is a non-coordinate dimension"; gds_var_ncd:coordinates = "lat_gds_ncd lon_gds_ncd"; double lat_gds_ncd(gds_ncd); lat_gds_ncd:long_name = "Latitude"; lat_gds_ncd:standard_name = "latitude"; lat_gds_ncd:units="degree"; lat_gds_ncd:purpose = "1-D latitude coordinate referred to by \"non-coordinate\" (ncd) geodesic grid variables"; double lon_gds_ncd(gds_ncd); lon_gds_ncd:long_name = "Longitude"; lon_gds_ncd:standard_name = "longitude"; lon_gds_ncd:units="degree"; lon_gds_ncd:purpose = "1-D longitude coordinate referred to by \"non-coordinate\" (ncd) geodesic grid variables"; int nbdate; nbdate:long_name = "base date as 6- or 8-digit integer (YYMMDD or YYYYMMDD)"; int date(time); date:long_name = "current date as 6- or 8-digit integer (YYMMDD or YYYYMMDD)"; float lon_wgt(lon); lon_wgt:long_name = "Gaussian weights"; lon_wgt:purpose = "Gaussian weights which sum to two for n = 4. These weights all have floor of 0.0 so should cause SIGFPE when applied to integer types in weighted average."; float ppc_flt_2D(time,lat); ppc_flt_2D:long_name = "Precision-Preserving Compression, single precision, two dimensional array, negative values"; ppc_flt_2D:purpose = "test --ppc switches"; ppc_flt_2D:original_values="-1.0 -- -20.0"; double ppc_dbl(time); ppc_dbl:long_name = "Precision-Preserving Compression, double precision"; ppc_dbl:purpose = "test --ppc switches"; ppc_dbl:original_values="0.0,0.1,0.12,0.123,0.1234,0.12345,0.123456,0.1234567,0.12345678,0.123456789"; float ppc_flt(time); ppc_flt:long_name = "Precision-Preserving Compression, single precision"; ppc_flt:purpose = "test --ppc switches"; ppc_flt:original_values="0.0,0.1,0.12,0.123,0.1234,0.12345,0.123456,0.1234567,0.12345678,0.123456789"; double ppc_big(time); ppc_big:long_name = "Precision-Preserving Compression, big numbers"; ppc_big:purpose = "test --ppc switches"; ppc_big:original_values="123456789e-10,123456789e-9,123456789e-8,123456789e-7,123456789e-6,123456789e-5,123456789e-4,123456789e-3,123456789e-2,123456789e-1"; float ppc_btg(time); ppc_btg:long_name = "Precision-Preserving Compression, bigger numbers"; ppc_btg:purpose = "test --ppc switches"; ppc_btg:original_values="1234567890e20,1234567890e19,1234567890e18,1234567890e17,1234567890e16,1234567890e15,1234567890e14,1234567890e13,1234567890e12,1234567890e11"; float ppc_btg_scl; ppc_btg_scl:long_name = "Precision-Preserving Compression, bigger numbers, scalar"; ppc_btg_scl:purpose = "test --ppc switches"; ppc_btg_scl:original_value="1234567890e11"; double ppc_hgh(time); ppc_hgh:long_name = "Precision-Preserving Compression, high precision"; ppc_hgh:purpose = "test --ppc switches"; double ppc_hgr(time); ppc_hgr:long_name = "Precision-Preserving Compression, higher precision"; ppc_hgr:purpose = "test --ppc switches"; float ppc_tst(time); ppc_tst:long_name = "Precision-Preserving Compression, single precision tests"; ppc_tst:purpose = "test --ppq"; ppc_tst:original_values="0.0,_,0.1234567,-0.1234567,64,-64,123456789e25,123456789e-25,3.1415926535897932384626433832795029,-3.1415926535897932384626433832795029"; float ppc_dcm(time); ppc_dcm:long_name = "Precision-Preserving Compression, decimal tests"; ppc_dcm:purpose = "test --ppq"; ppc_dcm:original_values="55,155,255,355,455,555,655,755,855,955"; float qnt_flt_tst1(dgn); qnt_flt_tst1:long_name = "Quantization test, single precision"; qnt_flt_tst1:original_values="1.1111111"; double qnt_dbl_tst1(dgn); qnt_dbl_tst1:long_name = "Quantization test, double precision"; qnt_dbl_tst1:original_values="1.111111111111"; float qnt_flt_tst2(lon_grd); qnt_flt_tst2:long_name = "Quantization test, single precision"; qnt_flt_tst2:original_values="1.11111111, 1.0, 9.99999999, 12345.67, .1234567"; double qnt_dbl_tst2(lon_grd); qnt_dbl_tst2:long_name = "Quantization test, double precision"; qnt_dbl_tst2:original_values="1.1111111, 1.0, 9.999999999, 1234567890.12345, 123456789012345.0"; char md5_a; md5_a:long_name = "the letter a"; md5_a:purpose = "String with known MD5 digest"; md5_a:MD5_known_checksum = "0cc175b9c0f1b6a831c399e269772661"; char md5_abc(lev); md5_abc:long_name = "the letters abc"; md5_abc:purpose = "String with known MD5 digest"; md5_abc:MD5_known_checksum = "900150983cd24fb0d6963f7d28e17f72"; float msk_prt_mss_prt(lon); msk_prt_mss_prt:long_name = "partial mask, partial missing value example"; msk_prt_mss_prt:_FillValue = 1.0e36f; float mss_val(lon); mss_val:long_name = "partial missing value example"; mss_val:_FillValue = 1.0e36f; float mss_val_scl; mss_val_scl:long_name = "scalar missing value"; mss_val_scl:_FillValue = 1.0e36f; float mss_val_scl_sml; mss_val_scl_sml:long_name = "scalar missing value"; mss_val_scl_sml:purpose = "Unlike mss_val_scl, mss_val_scl_sml has a missing value that fits within any packed data type range"; mss_val_scl_sml:_FillValue = 1.0e4f; float mss_val_fst(lon); mss_val_fst:long_name = "offset partial missing value example"; mss_val_fst:_FillValue = -999.0f; float fll_val(lon); fll_val:long_name = "_FillValue example"; fll_val:_FillValue = -999.0f; float fll_val_mss_val(lon); fll_val_mss_val:long_name = "_FillValue example"; fll_val_mss_val:_FillValue = -999.0f; fll_val_mss_val:missing_value = -999.0f; float nan_arr(lat); nan_arr:long_name = "Intended for array representation of IEEE NaN"; nan_arr:note = "20120308 Apparently netCDF ncgen chokes on variable names of nan and NaN"; nan_arr:note2 = "20120330 netCDF ncgen on AIX/bluefire chokes on variable/attribute values of nan"; nan_arr:note3 = "20120625 netCDF ncgen on netCDF 4.1.1 on apparently chokes on variable/attribute values of nan"; nan_arr:note4 = "If your NCO build fails because your version of netCDF does not support nan, then cd to the directory that contains the file nco/data/in.cdl and run the command in note5 first and then try to build again"; nan_arr:note5 = "sed -e 's/nan;/1.0f;/' in.cdl > foo.cdl;ncgen -b -o in.nc foo.cdl"; nan_arr:note6 = "It is too troublesome to distribute in.cdl with references to NaNs because users always build with old netCDF versions that do not support it. So just comment out nan's for now."; // nan_arr:_FillValue = nan; nan_arr:_FillValue = 1.0f; float nan_scl; nan_scl:long_name = "Intended for scalar representation of IEEE NaN"; nan_scl:note = "20120308 Apparently netCDF ncgen chokes on variable names of nan and NaN"; nan_scl:note2 = "20120330 netCDF ncgen on AIX/bluefire chokes on variable/attribute values of nan"; nan_scl:note3 = "20120625 netCDF ncgen on netCDF 4.1.1 on apparently chokes on variable/attribute values of nan"; nan_scl:note6 = "It is too troublesome to distribute in.cdl with references to NaNs because users always build with old netCDF versions that do not support it. So just comment out nan's for now."; // nan_scl:_FillValue = nan; nan_scl:_FillValue = 1.0f; float nm_spc; nm_spc:long_name = "Variable name with space (invalid)"; float nm_pnd; nm_pnd:long_name = "Variable name with pound symbol (invalid)"; float no_mss_val(lon); no_mss_val:long_name = "no missing value"; float val_one_mss(lat); val_one_mss:long_name = "one regular value, one missing value"; val_one_mss:_FillValue = 1.0e36f; short rec_var_pck_scale_factor_only(time); rec_var_pck_scale_factor_only:long_name = "Array packed with scale factor only"; rec_var_pck_scale_factor_only:note = "Original packed value was 1s..10s with scale_factor = 10.0d no add_offset. Unpacked value should be 10.0 = 10.0d*1s + 0.0d through 100 = 10.0d*1s + 0.0d. Average value should be 55."; rec_var_pck_scale_factor_only:scale_factor = 10.0d; short pck; pck:long_name = "Scalar variable, double, packed as short"; pck:note = "Original packed value was 1s with scale_factor = 2.0d and add_offset = 1.0d. Unpacked value (netCDF convention) should be 3.0 = 2.0d*1s + 1.0d. Unpacked value (HDF convention) should be 0.0 = 2.0d*(1s-1.0d). NCO algorithms would pack this variable as scale_factor = 0.0d and add_offset = 3.0d."; pck:scale_factor = 2.0d; pck:add_offset = 1.0d; short pck_3; pck_3:long_name = "Scalar variable, double, packed as short"; pck_3:note = "Original packed value was 1s with scale_factor = 2.0d and add_offset = 1.0d. Unpacked value (netCDF convention) should be 3.0 = 2.0d*1s + 1.0d. Unpacked value (HDF convention) should be 0.0 = 2.0d*(1s-1.0d). NCO algorithms would pack this variable as scale_factor = 0.0d and add_offset = 3.0d."; pck_3:scale_factor = 2.0d; pck_3:add_offset = 1.0d; short pck_5; pck_5:long_name = "Scalar variable, double, packed as short"; pck_5:note = "Original packed value was 2s with scale_factor = 2.0d and add_offset = 1.0d. Unpacked value (netCDF convention) should be 5.0 = 2.0d*2s + 1.0d. Unpacked value (HDF convention) should be 2.0 = 2.0d*(2s-1.0d). NCO algorithms would pack this variable as scale_factor = 0.0d and add_offset = 5.0d."; pck_5:scale_factor = 2.0d; pck_5:add_offset = 1.0d; short pck_7; pck_7:long_name = "Scalar variable, double, packed as short"; pck_7:note = "Original packed value was 1s with scale_factor = 4.0d and add_offset = 3.0d. Unpacked value (netCDF convention) should be 7.0 = 4.0d*1s + 3.0d. Unpacked value (HDF convention) should be -8.0 = 4.0d*(1s-3.0d). NCO algorithms would pack this variable as scale_factor = 0.0d and add_offset = 7.0d."; pck_7:scale_factor = 4.0d; pck_7:add_offset = 3.0d; short pck_arr(lon); pck_arr:long_name = "Array variable, double, packed as short"; pck_arr:note = "Packed value is -32767s, 0s, 1s, 32767s, unpacked is same in double"; pck_arr:scale_factor = 1.0d; pck_arr:add_offset = 0.0d; short pck_crd(pck_crd); pck_crd:long_name = "Coordinate array variable, float, packed as short"; pck_crd:note = "Packed value is -32767s, 0s, 1s, 32767s, unpacked is factor of 10 different, offset by 73 in float"; pck_crd:scale_factor = 10.0f; pck_crd:add_offset = 73.0f; double upk; upk:long_name = "Unpacked scalar variable"; upk:note = "Unpacked value is 3.0d0, upk=unpack(pck)= 2.0d0*1s + 1.0d0 = 3.0d0. Packing this variable should create an NC_SHORT scalar = 0s with packing attribute add_offset=3.0d and either no scale_factor (ncap) or scale_factor = 0.0d (ncpdq)."; double upk_arr(lon); upk_arr:long_name = "Unpacked array"; upk_arr:note = "Unpacked value is -32767.d, 0.d, 1.d, 32767.d, packed is same in short. Packing algorithm should yield an NC_SHORT array = [] with packing attributes scale_factor=1.0d, add_offset=0.0d"; float val_eminusten; val_eminusten:long_name = "Floating point number with exponent ending in zero to test sng_trm_trl_zro()"; val_eminusten:att_eminusten = 1.1e-10f; int val_one_int; val_one_int:long_name = "scalar integer equal to 1"; val_one_int:_FillValue = -99l; int val_one_one_int(lat); val_one_one_int:long_name = "1, 1"; val_one_one_int:_FillValue = -99l; short val_max_max_sht(lat); val_max_max_sht:long_name = "17000, 17000"; val_max_max_sht:_FillValue = -99s; int val_one_mss_int(lat); val_one_mss_int:long_name = "1, mss_val"; val_one_mss_int:_FillValue = -99l; float val_half; val_half:long_name = "Scalar with value 0.5"; val_half:_FillValue = 1.0e36f; float val_half_half(lat); val_half_half:long_name = "0.5,0.5"; val_half_half:_FillValue = 1.0e36f; float wgt_one(lat); wgt_one:long_name = "all values are one"; float mss_val_all(lon); mss_val_all:long_name = "all missing values example"; mss_val_all:_FillValue = 1.0e36f; float scalar_var; scalar_var:long_name = "scalar variable"; scalar_var:units = "fraction"; scalar_var:_FillValue = 1.0e36f; float float_var; float_var:long_name = "float"; double double_var; double_var:long_name = "double"; double double_var2; double_var2:long_name = "double"; double_var2:_FillValue = 1.0e36; double pi; pi:long_name = "Pi"; pi:units = "fraction"; double pi_arr_dbl(lat,lon); pi_arr_dbl:long_name = "Pi array double precision"; pi_arr_dbl:units = "fraction"; pi_arr_dbl:original_values = "3.1415926535897932384626433832795029"; float pi_arr_flt(lat,lon); pi_arr_flt:long_name = "Pi array single precision"; pi_arr_flt:units = "fraction"; pi_arr_flt:original_values = "3.14159265"; float pi1(time); pi1:long_name = "Pi array single precision starting at pi incremented by 1.0e-6 each element"; pi1:original_values = "3.1415927, 3.1415937, 3.1415946, 3.1415956, 3.1415966, 3.1415977, 3.1415987, 3.1415997, 3.1416006, 3.1416016"; float pi2(time); pi2:long_name = "Pi array single precision starting at pi incremented by 1.0e-6 each element"; pi2:original_values = "3.1415927, 3.1415937, 3.1415946, 3.1415956, 3.1415966, 3.1415977, 3.1415987, 3.1415997, 3.1416006, 3.1416016"; float pi3(time); pi3:long_name = "Pi array single precision starting at pi incremented by 1.0e-6 each element"; pi3:original_values = "3.1415927, 3.1415937, 3.1415946, 3.1415956, 3.1415966, 3.1415977, 3.1415987, 3.1415997, 3.1416006, 3.1416016"; float pi4(time); pi4:long_name = "Pi array single precision starting at pi incremented by 1.0e-6 each element"; pi4:original_values = "3.1415927, 3.1415937, 3.1415946, 3.1415956, 3.1415966, 3.1415977, 3.1415987, 3.1415997, 3.1416006, 3.1416016"; float pi5(time); pi5:long_name = "Pi array single precision starting at pi incremented by 1.0e-6 each element"; pi5:original_values = "3.1415927, 3.1415937, 3.1415946, 3.1415956, 3.1415966, 3.1415977, 3.1415987, 3.1415997, 3.1416006, 3.1416016"; float pi6(time); pi6:long_name = "Pi array single precision starting at pi incremented by 1.0e-6 each element"; pi6:original_values = "3.1415927, 3.1415937, 3.1415946, 3.1415956, 3.1415966, 3.1415977, 3.1415987, 3.1415997, 3.1416006, 3.1416016"; float pi7(time); pi7:long_name = "Pi array single precision starting at pi incremented by 1.0e-6 each element"; pi7:original_values = "3.1415927, 3.1415937, 3.1415946, 3.1415956, 3.1415966, 3.1415977, 3.1415987, 3.1415997, 3.1416006, 3.1416016"; int int_var; int_var:long_name = "int"; // 20210406: netCDF 4.8.0 no longer supports CDL type "long" as synonym for "int" // Uncomment next line to demonstrate backwards-incompatibility of 4.8.0 //long long_var; int long_var; long_var:long_name = "long"; long_var:purpose = "Variable of CDL type=long, which is deprecated for int. Included to test back-compatibility"; long_var:notes = "This check will fail with netCDF 4.8.0 if CDL type of variable is long not int. This failure with 4.8.0 was fixed in netCDF master within a few weeks and the problem should not be present in subsequent (or prior) netCDF versions."; short short_var; short_var:long_name = "short"; char char_var; char_var:long_name = "char"; char char_var_space; char_var_space:long_name = "Character variable with whitespace on ends"; char char_var_nul; char_var_nul:long_name = "Character variable containing one NUL specified as empty string: \"\""; char char_var_nul_c_format; char_var_nul_c_format:long_name = "Character variable containing one NUL specified in C-format: \'\\0\'"; char char_var_zero; char_var_zero:long_name = "Character variable containing zero"; char char_var_1D_arr(time); char_var_1D_arr:long_name = "char-type 1D variable array"; char char_var_2D_arr(lat,lon); char_var_2D_arr:long_name = "char-type 2D variable array"; // 20131015: This confuses the XML parser. Omit it for now. // char char_var_multinul(lev); // char_var_multinul:long_name = "Character variable containing multiple NULs"; char fl_nm(char_dmn_lng80); fl_nm:long_name = "Variable contains a file name"; char fl_nm_arr(fl_dmn,char_dmn_lng80); fl_nm_arr:long_name = "Variable that contains a short array of file names"; fl_nm_arr:units = "[sng]"; char fl_nm_rec(time,char_dmn_lng80); fl_nm_rec:long_name = "A record variable of file names"; fl_nm_rec:units = "[sng]"; char date_sng(char_dmn_lng26); date_sng:long_name = "A single date string"; date_sng:units = "[sng]"; char date_rec(time,char_dmn_lng26); date_rec:long_name = "A record variable of date strings"; date_rec:units = "[sng]"; char non_nul_trm_char_one_dmn(char_dmn_lng04); non_nul_trm_char_one_dmn:long_name = "Variable contains a one-dimensional array of characters that is not NUL-terminated"; non_nul_trm_char_one_dmn:units = "[chr]"; char non_nul_trm_char_two_dmn(fl_dmn,char_dmn_lng04); non_nul_trm_char_two_dmn:long_name = "Variable contains a two-dimensional array of characters that are not NUL-terminated"; non_nul_trm_char_two_dmn:units = "[chr]"; byte byt_arr(lat,lon); byt_arr:long_name = "byte array"; byte byt_2D(lat,lon); byte byt_3D(lat,lev,lon); byte byt_3D_rec(time,lat,lon); byte byt_bln_3D_rec(time,lat,lon); byte byte_var; byte_var:long_name = "byte"; byte byte_var_neg; byte_var_neg:long_name = "negative byte"; float zero; zero:long_name = "zero"; float ppc_zro_flt(time); ppc_zro_flt:long_name = "array of single precision floating point zeros"; double ppc_zro_dbl(time); ppc_zro_dbl:long_name = "array of double precision floating point zeros"; int ppc_zro_int(time); ppc_zro_int:long_name = "array of integer zeros"; float one; one:long_name = "one"; float two; two:long_name = "two"; double e_dbl; e_dbl:long_name = "e, natural logarithm base"; float e_flt; e_flt:long_name = "e, natural logarithm base"; float three; three:long_name = "three"; float four; four:long_name = "four"; float negative_one; negative_one:long_name = "negative one"; float lev_var(lev); lev_var:long_name = "lev_var"; float lev_wgt(lev); lev_wgt:long_name = "lev_wgt"; float g; g:long_name = "g"; float grv_sfc; grv_sfc:long_name = "Surface gravity on Earth"; grv_sfc:units = "meter second-2"; float vmr_CO2; vmr_CO2:long_name = "Volumetric mixing ratio of CO2"; vmr_CO2:units = "molecule molecule-1"; float mmr_CO2; mmr_CO2:long_name = "Mass mixing ratio of CO2"; mmr_CO2:units = "kilogram kilogram-1"; float dps_dry; dps_dry:long_name = "Dry Deposition"; float dps_wet; dps_wet:long_name = "Wet Deposition"; float dps_ttl; dps_ttl:long_name = "Total Deposition"; float z(lev); z:long_name = "Height"; z:units = "meter"; z:purpose = "Height stored with a monotonically increasing coordinate"; float rz(rlev); rz:long_name = "Height"; rz:units = "meter"; rz:purpose = "Height stored with a monotonically decreasing coordinate"; float one_dmn_var(bnd); int one_dmn_int_val_one(lat); int one_dmn_int_val_two(lat); float att_var(time); att_var:byte_att = '\000','\001','\002','\177','\200','\201','\376','\377'; att_var:char_att = "Sentence one.\nSentence two.\n"; att_var:char_att2 = "Character string containing default XML separator: *|*\n"; att_var:short_att = 37s; att_var:int_att = 73; att_var:float_att = 73.0f,72.0f,71.0f,70.010f,69.0010f,68.010000f,67.01000100f; att_var:double_att = 73.0,72.0,71.0,70.010,69.0010,68.010000,67.01000100; int att_var_jsn; // 20210512: HDF4 ncgen fails on character attributes with whitespace att_var_jsn:char\ att\ with\ whitespace = "cf-json.org "; att_var_jsn:double\ att\ with\ whitespace = 3.14; att_var_jsn:int\ att\ with\ whitespace = 1; att_var_jsn:int_array\ att\ with\ whitespace = 1,2; // Purpose: Test special characters in names // Most special characters need backslash protection int att_var_spc_chr; att_var_spc_chr:space\ in\ name = "foo"; att_var_spc_chr:comma_in_name\, = "foo"; att_var_spc_chr:lt_in_name\< = "foo"; att_var_spc_chr:gt_in_name\> = "foo"; att_var_spc_chr:hash_in_name\# = "foo"; att_var_spc_chr:xclaim_in_name\! = "foo"; att_var_spc_chr:dollar_in_name\$ = "foo"; att_var_spc_chr:ampersand_in_name\& = "foo"; att_var_spc_chr:equals_in_name\= = "foo"; att_var_spc_chr:semicolon_in_name\; = "foo"; att_var_spc_chr:colon_in_name\: = "foo"; att_var_spc_chr:lbrace_in_name\{ = "foo"; att_var_spc_chr:rbrace_in_name\} = "foo"; att_var_spc_chr:lparen_in_name\( = "foo"; att_var_spc_chr:rparen_in_name\) = "foo"; att_var_spc_chr:lbracket_in_name\[ = "foo"; att_var_spc_chr:rbracket_in_name\] = "foo"; att_var_spc_chr:plus_in_name+ = "foo"; // : period_in_name. = "foo"; // Likely to cause DAP server error att_var_spc_chr:hyphen_in_name- = "foo"; att_var_spc_chr:at_in_name@ = "foo"; // Purpose test special chars in char atts int att_sng; att_sng:nul_sng = '\0'; att_sng:empty_sng = ""; att_sng:space_sng = " "; att_sng:zero_sng = "0"; int bnd_var(lev,bnd); bnd_var:byte_att = '\0'; bnd_var:char_att = "Sentence one.\nSentence two.\n"; bnd_var:short_att = 37s; bnd_var:int_att = 73; bnd_var:long_att = 73; bnd_var:float_att = 73.f; bnd_var:double_att = 73.d; float three_dmn_var(lat,lev,lon); three_dmn_var:long_name = "three dimensional variable with CCM coordinate convention C=[lat,lev,lon], Fortran=(lon,lev,lat)"; three_dmn_var:units = "fraction"; float three_dmn_var_crd(lev,lat,lon); three_dmn_var_crd:long_name = "three dimensional variable with COORDS coordinate convention C=[lev,lat,lon], Fortran=(lon,lat,lev)"; three_dmn_var_crd:units = "fraction"; float three_dmn_var_cf(lev,lat,lon); three_dmn_var_cf:long_name = "three dimensional variable with CF \"coordinates\" convention"; three_dmn_var_cf:coordinates = "lat lev lon"; three_dmn_var_cf:units = "fraction"; float three_dmn_var_cf2(lev,lat,lon); three_dmn_var_cf2:long_name = "three dimensional variable with CF \"coordinates\" convention for wrong coordinates"; three_dmn_var_cf2:coordinates = "x y z"; three_dmn_var_cf2:units = "fraction"; float prs_sfc(time,lat,lon); prs_sfc:long_name = "Surface pressure"; prs_sfc:units = "pascal"; float H2O; float H2OH2O; float H2SO4; float H2O_lqd; float H2O_ice; float Q; float Q1; float AQ01; float QQ01; float QA01; float Q01Q; float Q01; float Q02; float Q03; float Q04; float Q05; float Q06; float Q07; float Q08; float Q09; float Q10; float Q11; float Q12; float Q13; float Q14; float Q15; float Q16; float Q17; float Q18; float Q19; float Q20; float Q21; float Q22; float Q23; float Q24; float Q25; float Q26; float Q27; float Q28; float Q29; float Q30; float Q31; float Q32; float Q33; float Q34; float Q35; float Q36; float Q37; float Q38; float Q39; float Q40; float Q41; float Q42; float Q43; float Q44; float Q45; float Q46; float Q47; float Q48; float Q49; float Q50; float Q51; float Q52; float Q53; float Q54; float Q55; float Q56; float Q57; float Q58; float Q59; float Q60; float Q61; float Q62; float Q63; float Q64; float Q65; float Q66; float Q67; float Q68; float Q69; float Q70; float Q71; float Q72; float Q73; float Q74; float Q75; float Q76; float Q77; float Q78; float Q79; float Q80; float Q81; float Q82; float Q83; float Q84; float Q85; float Q86; float Q87; float Q88; float Q89; float Q90; float Q91; float Q92; float Q93; float Q94; float Q95; float Q96; float Q97; float Q98; float Q99; float Q100; float two_dmn_var(lat,lev); two_dmn_var:long_name = "two dimensional variable"; two_dmn_var:units = "fraction"; float var_msk(lat,lon); var_msk:long_name = "Float field for testing masks and wheres"; var_msk:units = "fraction"; float var_mss_nil(lon); var_mss_nil:purpose = "Test mismatched missing values in variables, masks, and weights. Missing no elements."; var_mss_nil:_FillValue = 1.0e36f; float var_mss_0(lon); var_mss_0:purpose = "Test mismatched missing values in variables, masks, and weights. Missing element index 0."; var_mss_0:_FillValue = 1.0e36f; float var_mss_1(lon); var_mss_1:purpose = "Test mismatched missing values in variables, masks, and weights. Missing element index 1."; var_mss_1:_FillValue = 1.0e36f; float var_mss_2(lon); var_mss_2:purpose = "Test mismatched missing values in variables, masks, and weights. Missing element index 2."; var_mss_2:_FillValue = 1.0e36f; float var_mss_3(lon); var_mss_3:purpose = "Test mismatched missing values in variables, masks, and weights. Missing element index 3."; var_mss_3:_FillValue = 1.0e36f; float mask(lat,lon); mask:long_name = "Purpose is to mask a variable like ORO"; mask:units = "fraction"; float ORO(lat,lon); ORO:long_name = "Orography, an enumerated yet continuous type: ocean=0.0, land=1.0, sea ice=2.0"; ORO:units = "fraction"; float orog(lat,lon); orog:long_name = "Orography, an enumerated yet continuous type: ocean=0.0, land=1.0, sea ice=2.0"; orog:units = "fraction"; orog:original_name = "ORO" ; orog:cell_measures = "area: areacella" ; orog:purpose = "Replicate processing of files produced by CESM and distributed on ESGF" ; float orog2(lat,lon); orog2:long_name = "Value of 1 everywhere on latxlon grid"; orog2:units = "fraction"; orog2:purpose = "debug TODO nco1138" ; float orog3(lat,lon); orog3:long_name = "Value of 0 first half, 1 second half on latxlon grid"; orog3:units = "fraction"; orog3:purpose = "debug TODO nco1138" ; float weight(lat); weight:long_name = "Gaussian weight"; weight:units = "fraction"; float gw(lat); gw:long_name = "gw variable like gw"; gw:units = "fraction"; float gw_T42(lat_T42); gw_T42:long_name = "gw variable like gw_T42"; gw_T42:units = "fraction"; float rec_var_flt(time); rec_var_flt:long_name = "record variable, float"; double rec_var_dbl(time); rec_var_dbl:long_name = "record variable, double"; int one_dmn_rec_var(time); one_dmn_rec_var:long_name = "one dimensional record variable"; one_dmn_rec_var:coordinates = "time"; one_dmn_rec_var:units = "kelvin"; double one_dmn_rec_wgt(time); one_dmn_rec_wgt:long_name = "one dimensional record variable weight"; int one_dmn_rec_var_mdn(time); one_dmn_rec_var_mdn:long_name = "one dimensional record variable to test median"; int one_dmn_rec_var_mdn__FillValue(time); one_dmn_rec_var_mdn__FillValue:long_name = "one dimensional record variable to test median with _FillValue"; one_dmn_rec_var_mdn__FillValue:_FillValue = -999; int one_dmn_rec_var_unsorted(time); one_dmn_rec_var_unsorted:long_name = "one dimensional record variable, unsorted"; float one_dmn_rec_var_flt(time); one_dmn_rec_var_flt:long_name = "one dimensional record variable, single precision"; float one_dmn_rec_var_flt_mss(time); one_dmn_rec_var_flt_mss:long_name = "one dimensional record variable, single precision, missing values"; one_dmn_rec_var_flt_mss:_FillValue = 1.0e36f; float one_dmn_rec_var_flt_scl(time); one_dmn_rec_var_flt_scl:long_name = "one dimensional record variable, single precision, scaled"; one_dmn_rec_var_flt_scl:scale_factor = 1.0f; float one_dmn_rec_var_flt_mss_scl(time); one_dmn_rec_var_flt_mss_scl:long_name = "one dimensional record variable, single precision, missing values, scaled"; one_dmn_rec_var_flt_mss_scl:scale_factor = 1.0f; one_dmn_rec_var_flt_mss_scl:_FillValue = 1.0e36f; float one_dmn_rec_var_dbl(time); one_dmn_rec_var_dbl:long_name = "one dimensional record variable, double precision"; one_dmn_rec_var_dbl:units = "second"; float one_dmn_rec_var_missing_value(time); one_dmn_rec_var_missing_value:long_name = "One dimensional record variable with missing data indicated by missing_value attribute only. No _FillValue attribute exists."; one_dmn_rec_var_missing_value:missing_value = 1.0e36f; float one_dmn_rec_var_mss_val(time); one_dmn_rec_var_mss_val:long_name = "One dimensional record variable with all missing data."; one_dmn_rec_var_mss_val:_FillValue = 1.0e36f; float one_dmn_rec_var__FillValue(time); one_dmn_rec_var__FillValue:long_name = "One dimensional record variable with missing data indicated by _FillValue attribute only. No missing_value attribute exists."; one_dmn_rec_var__FillValue:_FillValue = 1.0e36f; float one_dmn_rec_var_unsorted__FillValue(time); one_dmn_rec_var_unsorted__FillValue:long_name = "Unsorted, one dimensional record variable with missing data indicated by _FillValue attribute only. No missing_value attribute exists."; one_dmn_rec_var_unsorted__FillValue:_FillValue = 1.0e36f; float one_dmn_rec_var_mss_val_arr(time); one_dmn_rec_var_mss_val_arr:long_name = "One dimensional record variable with missing data indicated by a _FillValue attribute that is an array. This can be tested with ncrcat. 20120905: ncgen chokes on _FillValue arrays and produces this error: _FillValue: must be a single (possibly compound) value. Deprecate the array for normal use since it prevents ncgen from completing. Uncommment following line when testing for compatibility with software changes."; // one_dmn_rec_var_mss_val_arr:_FillValue = 1.0f,2.0f,3.0f; one_dmn_rec_var_mss_val_arr:_FillValue = 1.0f; int RDM(time); float tpt(time); tpt:long_name = "Temperature"; tpt:units = "kelvin"; tpt:hieght = "Leave hieght mispelled for NCO User's guide example"; double tpt_dbl(time); tpt_dbl:long_name = "Temperature stored as double precision floating point"; tpt_dbl:units = "kelvin"; float tpt_flt(time); tpt_flt:long_name = "Temperature stored as single precision floating point"; tpt_flt:units = "kelvin"; double rec_var_dbl_mss_val_dbl_upk(time); rec_var_dbl_mss_val_dbl_upk:long_name = "record variable, double, with double missing values"; rec_var_dbl_mss_val_dbl_upk:purpose = "This variable is used to generate the packed variable rec_var_dbl_mss_val_dbl_pck, so its _FillValue should not be out of range, i.e., it should be representable by a short. However, the _FillValue should itself be the same type as the unpacked variable, NC_DOUBLE in this case."; rec_var_dbl_mss_val_dbl_upk:_FillValue = -999.; rec_var_dbl_mss_val_dbl_upk:missing_value = -999.; double rec_var_dbl_mss_val_sht_upk(time); rec_var_dbl_mss_val_sht_upk:long_name = "record variable, double, with double missing values"; rec_var_dbl_mss_val_sht_upk:purpose = "This variable is used to generate the packed variable rec_var_dbl_mss_val_sht_pck, so its _FillValue should not be out of range, i.e., it should be representable by a short. However, the _FillValue should itself be the same type as the unpacked variable, NC_DOUBLE in this case."; // Using intended _FillValue type breaks ncgen (with "_FillValue type mismatch")in netCDF 4.1.1 so comment-out for simplicity // rec_var_dbl_mss_val_sht_upk:_FillValue = -999s; rec_var_dbl_mss_val_sht_upk:_FillValue = -999.0; rec_var_dbl_mss_val_sht_upk:missing_value = -999s; short rec_var_dbl_mss_val_dbl_pck(time); rec_var_dbl_mss_val_dbl_pck:long_name = "record variable, double, packed as short, with double missing values"; rec_var_dbl_mss_val_dbl_pck:purpose = "Packed version of rec_var_dbl_mss_val_dbl_upk"; // Using intended _FillValue type breaks ncgen (with "_FillValue type mismatch")in netCDF 4.1.1 so comment-out for simplicity // rec_var_dbl_mss_val_dbl_pck:_FillValue = -999.; rec_var_dbl_mss_val_dbl_pck:_FillValue = -999s; rec_var_dbl_mss_val_dbl_pck:missing_value = -999.; rec_var_dbl_mss_val_dbl_pck:scale_factor = -9.15541313801785e-05; rec_var_dbl_mss_val_dbl_pck:add_offset = 5.; short rec_var_dbl_mss_val_sht_pck(time); rec_var_dbl_mss_val_sht_pck:long_name = "record variable, double, packed as short, with short missing values"; rec_var_dbl_mss_val_sht_pck:purpose = "Packed version of rec_var_dbl_mss_val_sht_upk"; rec_var_dbl_mss_val_sht_pck:_FillValue = -999s; rec_var_dbl_mss_val_sht_pck:missing_value = -999s; rec_var_dbl_mss_val_sht_pck:scale_factor = -9.15541313801785e-05; rec_var_dbl_mss_val_sht_pck:add_offset = 5.; short scl_dbl_pck; scl_dbl_pck:long_name = "scalar variable, double, packed"; scl_dbl_pck:purpose = "Packed version of number with ncdiff subtraction bug"; scl_dbl_pck:scale_factor = -9.15541313801785e-05; scl_dbl_pck:add_offset = 5.; float rec_var_flt_mss_val_flt(time); rec_var_flt_mss_val_flt:long_name = "record variable, float, with float missing values"; rec_var_flt_mss_val_flt:_FillValue = 1.0e36f; float rec_var_flt_mss_val_flt_all(time); rec_var_flt_mss_val_flt_all:long_name = "record variable, float, with float missing values in every position"; rec_var_flt_mss_val_flt_all:_FillValue = 1.0e36f; float rec_var_flt_mss_val_flt_all_but_one(time); rec_var_flt_mss_val_flt_all_but_one:long_name = "record variable, float, with float missing values in every position but one"; rec_var_flt_mss_val_flt_all_but_one:_FillValue = 1.0e36f; float rec_var_flt_mss_val_flt_all_but_two(time); rec_var_flt_mss_val_flt_all_but_two:long_name = "record variable, float, with float missing values in every position but two"; rec_var_flt_mss_val_flt_all_but_two:_FillValue = 1.0e36f; short rec_var_flt_pck(time); rec_var_flt_pck:long_name = "record variable, float, packed into short"; rec_var_flt_pck:purpose = "Demonstrate that rounding of means of packed data are handled correctly"; rec_var_flt_pck:scale_factor = 0.1f; rec_var_flt_pck:add_offset = 100.0f; short rec_var_dbl_pck(time); rec_var_dbl_pck:long_name = "record variable, double, packed into short"; rec_var_dbl_pck:purpose = "Demonstrate that rounding of means of packed data are handled correctly"; rec_var_dbl_pck:scale_factor = 0.1; rec_var_dbl_pck:add_offset = 100.0; short non_rec_var_flt_pck(lon); non_rec_var_flt_pck:long_name = "regular variable, float, packed into short"; non_rec_var_flt_pck:purpose = "Demonstrate that non-rec dim packed vars are handled correctly"; non_rec_var_flt_pck:scale_factor = 0.1f; non_rec_var_flt_pck:add_offset = 100.0f; float rec_var_flt_mss_val_dbl(time); rec_var_flt_mss_val_dbl:long_name = "record variable, float, with double missing values"; rec_var_flt_mss_val_dbl:_FillValue = 1.0e36f; rec_var_flt_mss_val_dbl:missing_value = 1.0e36f; rec_var_flt_mss_val_dbl:note = "The correct average of this variable is 5.0. The correct sum of this variable is 35."; float rec_var_flt_mss_val_int(time); rec_var_flt_mss_val_int:long_name = "record variable, float, with integer missing values"; // Using intended _FillValue type breaks ncgen (with "_FillValue type mismatch")in netCDF 4.1.1 so comment-out for simplicity // rec_var_flt_mss_val_int:_FillValue = -999; rec_var_flt_mss_val_int:_FillValue = -999.0f; rec_var_flt_mss_val_int:missing_value = -999; int rec_var_int_mss_val_int(time); rec_var_int_mss_val_int:long_name = "record variable, integer, with integer missing values"; rec_var_int_mss_val_int:_FillValue = -999; int rec_var_int_mss_val_flt(time); rec_var_int_mss_val_flt:long_name = "record variable, integer, with float missing values"; // Using intended _FillValue type breaks ncgen (with "_FillValue type mismatch")in netCDF 4.1.1 so comment-out for simplicity // rec_var_int_mss_val_flt:_FillValue = -999.0f; rec_var_int_mss_val_flt:_FillValue = -999; rec_var_int_mss_val_flt:missing_value = -999.0f; int rec_var_int_mss_val_dbl(time); rec_var_int_mss_val_dbl:long_name = "record variable, integer, with double missing values"; // Using intended _FillValue type breaks ncgen (with "_FillValue type mismatch")in netCDF 4.1.1 so comment-out for simplicity // rec_var_int_mss_val_dbl:_FillValue = -999.0; rec_var_int_mss_val_dbl:_FillValue = -999; rec_var_int_mss_val_dbl:missing_value = -999.0; int rec_var_dbl_mss_val_dbl_pck_lng(time); rec_var_dbl_mss_val_dbl_pck_lng:long_name = "record variable, double packed as long, with double missing values"; rec_var_dbl_mss_val_dbl_pck_lng:purpose = "although not usual, packing doubles into longs (rather than shorts) offers considerable space savings"; // Using intended _FillValue type breaks ncgen (with "_FillValue type mismatch")in netCDF 4.1.1 so comment-out for simplicity // rec_var_dbl_mss_val_dbl_pck_lng:_FillValue = -999.0; rec_var_dbl_mss_val_dbl_pck_lng:_FillValue = -999; rec_var_dbl_mss_val_dbl_pck_lng:missing_value = -999.0; rec_var_dbl_mss_val_dbl_pck_lng:scale_factor = -9.15541313801785e-05; rec_var_dbl_mss_val_dbl_pck_lng:add_offset = 5.; short rec_var_dbl_mss_val_sht_pck_sht(time); rec_var_dbl_mss_val_sht_pck_sht:long_name = "record variable, double packed as short, with short missing values"; rec_var_dbl_mss_val_sht_pck_sht:_FillValue = -999s; rec_var_dbl_mss_val_sht_pck_sht:scale_factor = -9.15541313801785e-05; rec_var_dbl_mss_val_sht_pck_sht:add_offset = 5.; float rec_var_flt_mss_val_flt_pck_flt(time); rec_var_flt_mss_val_flt_pck_flt:long_name = "record variable, float packed as float, with float missing values"; rec_var_flt_mss_val_flt_pck_flt:purpose = "CESM POP2 ocean model packs SALT, WVEL etc this way"; rec_var_flt_mss_val_flt_pck_flt:_FillValue = -9.96921e+33; rec_var_flt_mss_val_flt_pck_flt:scale_factor = 1000.0; float SALT(time); SALT:long_name = "record variable, float packed as float, with float missing values"; SALT:purpose = "CESM POP2 ocean model packs SALT, WVEL etc this way"; SALT:_FillValue = -9.96921e+33; SALT:scale_factor = 1000.0; char one_dmn_rec_var_sng(time); one_dmn_rec_var_sng:long_name = "one dimensional record variable of string"; one_dmn_rec_var_sng:NB = "20131222: HDF4 ncgen fails on this variable: /usr/bin/hncgen -b -o ~/in.hdf ~/nco/data/in.cdl produces error message that \"string won't fit in this variable\""; float time_lon(time,lon); time_lon:long_name = "Record variable of longitude coordinate"; char two_dmn_rec_var_sng(time,lev); two_dmn_rec_var_sng:long_name = "two dimensional record variable of string"; float two_dmn_rec_var(time,lev); two_dmn_rec_var:long_name = "two dimensional record variable"; two_dmn_rec_var:units = "watt meter-2"; double three_dmn_var_dbl(time,lat,lon); three_dmn_var_dbl:long_name = "three dimensional record variable of type double"; three_dmn_var_dbl:units = "watt meter-2"; three_dmn_var_dbl:_FillValue = -99.; float zg(time,lev,lon); zg:long_name = "three dimensional record variable to demonstrate hyperslab bug"; zg:units = "watt meter-2"; zg:_FillValue = -99.; float three_dmn_rec_var(time,lat,lon); three_dmn_rec_var:long_name = "three dimensional record variable"; three_dmn_rec_var:units = "watt meter-2"; three_dmn_rec_var:_FillValue = -99.; short three_dmn_rec_var_pck(time,lat,lon); three_dmn_rec_var_pck:long_name = "three dimensional record variable"; three_dmn_rec_var_pck:purpose = "should unpack into identical values with three_dmn_rec_var (i.e., 1..80)"; three_dmn_rec_var_pck:units = "watt meter-2"; three_dmn_rec_var_pck:_FillValue = -99.; three_dmn_rec_var_pck:add_offset = 40.5f ; three_dmn_rec_var_pck:scale_factor = -0.001205518f ; int three_dmn_var_int(time,lat,lon); three_dmn_var_int:long_name = "three dimensional record variable of type int"; three_dmn_var_int:units = "watt meter-2"; three_dmn_var_int:_FillValue = -99; short three_dmn_var_sht(time,lat,lon); three_dmn_var_sht:long_name = "three dimensional record variable"; three_dmn_var_sht:units = "watt meter-2"; three_dmn_var_sht:_FillValue = -99s; int th(time,lat,lon); th:long_name = "three dimensional record variable"; th:units = "watt meter-2"; th:_FillValue = -99; float td(time,dgn); td:long_name = "two dimensional record variable stored in td (time,dgn) order (dgn means degenerate, i.e., of size 1)"; float tx(time,lon); tx:long_name = "two dimensional record variable stored in tx (time,lon) order"; float ty(time,lat); ty:long_name = "two dimensional record variable stored in ty (time,lat) order"; float tz(time,lev); tz:long_name = "two dimensional record variable stored in tz (time,lev) order"; float txyz(time,lon,lat,lev); txyz:long_name = "four dimensional record variable stored in txyz (time,lon,lat,lev) order"; float xyz(lon,lat,lev); xyz:long_name = "three dimensional variable stored in xyz (lon,lat,lev) order"; float tyz(time,lat,lev); tyz:long_name = "three dimensional record variable stored in tyz (time,lat,lev) order"; float four_dmn_rec_var(time,lat,lev,lon); four_dmn_rec_var:long_name = "four dimensional record variable"; four_dmn_rec_var:units = "watt meter-2"; four_dmn_rec_var:coordinates = "time lat lev lon"; // double three_double_dmn(time,lon,lon); double time_udunits(time_udunits); time_udunits:units = "hours since 1900-01-01 00:00:0.0"; time_udunits:delta_t = "0000-00-00 06:00:0.0"; time_udunits:purpose = "The dates specified in this variable are ~1999-12-08"; int time_int_udunits(time_int_udunits); time_int_udunits:units = "seconds since 2019-03-12 00:00:00 UTC"; time_int_udunits:purpose = "time coordinate with integer values to test rebasing"; float u(time); u:long_name = "Zonal wind speed"; u:units = "meter second-1"; float v(time); v:long_name = "Meridional wind speed"; v:units = "meter second-1"; float var_1D_rct(lat_times_lon); var_1D_rct:long_name = "Variable for 2D rectangular grid stored as 1D arrays"; float var_1D_rrg(lat_times_lon); var_1D_rrg:long_name = "Variable for 2D irregular grid stored as 1D arrays"; float var_2D_rct(lat,lon); var_2D_rct:long_name = "Variable for 2D rectangular grid stored as 2D array"; float var_2D_rrg(lat,lon); var_2D_rrg:long_name = "Variable for 2D irregular grid stored as 2D array"; float var_nm-dash; var_nm-dash:long_name = "Variable and attribute names include dash characters"; var_nm-dash:att_nm-dash = 1.0e36f; float vld_rng(time); vld_rng:long_name = "Temperature"; vld_rng:purpose = "Array containing _FillValue at some locations, out-of-range values at other locations, and valid data in the remainder"; vld_rng:_FillValue = -999.0f; vld_rng:valid_min = 180.f; vld_rng:valid_max = 360.f; // float var_nm.dot; // var_nm.dot:long_name = "Variable and attribute names include dot characters"; // 20070102: Periods in attribute names choke OPeNDAP from FC7 RPM TODO nco911 // 20091105: Periods in attribute names choke ncgen from RHEL5 TODO nco911 // var_nm.dot:att_nm.dot = 1.0e36f; float wnd_spd(time,lat,lon); wnd_spd:long_name = "wind speed"; wnd_spd:units = "meter second-1"; wnd_spd:_FillValue = -999.0f; data: // netCDF4 atomic types: // None in this file // netCDF3 atomic types: att_var=10.0,10.1,10.20,10.3000,10.40101,10.500001,10.60000001,10.7000001,10.80,10.9900; att_var_jsn=73; att_var_spc_chr=73; att_sng=20; area=10.,10.; area2=20.,5.; area_asm=1.,2.; areacella=1.,1.,2.,2.,3.,3.,4.,4.; bnd_var=1,2,3,4,5,6; byt_arr=0,1,2,3,4,5,6,7; byt_2D=0,1,2,3,4,5,6,7; byt_3D=0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23; byt_3D_rec= 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16, 17,18,19,20,21,22,23,24, 25,26,27,28,29,30,31,32, 33,34,35,36,37,38,39,40, 41,42,43,44,45,46,47,48, 49,50,51,52,53,54,55,56, 57,58,59,60,61,62,63,64, 65,66,67,68,69,70,71,72, 73,74,75,76,77,78,79,80; byt_bln_3D_rec= 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,1, 0,0,0,0,0,0,1,1, 0,0,0,0,0,1,1,1, 0,0,0,0,1,1,1,1, 0,0,0,1,1,1,1,1, 0,0,1,1,1,1,1,1, 0,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,0,1,0,1,0,1,0; byte_var='z'; byte_var_neg=-122; char_var="z"; // 20131015: This confuses the XML parser // char_var_multinul="\b\n\0"; // char_var_multinul='0','\n','\0'; // 20180111: Historically we specified char_var_nul as '\0' // However, ncgen apparently turns '\0' into a zero // "correct" (meaning ncgen-supported) way to specify a scalar NUL character is with "" // As of today we specify char_var_nul as "" and char_var_nul_c_format as '\0' // char_var_nul_c_format indicates what happens when specifying characters in C-format // I think ncgen should support C-format byte codes for characters, though ncgen does not yet do so correctly char_var_nul=""; char_var_nul_c_format='\0'; char_var_zero="0"; char_var_space=" "; char_var_1D_arr="two words"; char_var_2D_arr="one","two"; cnv_CF_grd=1,2,3,4,5,6,7,8; albers_conical_equal_area=""; cnv_CF_crd=273.1,273.2,273.3,273.4,273.5,273.6,273.7,273.8; cnv_CF_ncl=1.,2.,3.,4.,5.,6.,7.,8.,9.,10.; cnv_CF_ncl_var_1=11.,22.,23.,24.,25.,26.,27.,28.,29.,30.; cnv_CF_ncl_var_2=21.,32.,33.,34.,35.,36.,37.,38.,39.,40.; date_int=1964,3,12,12,9; dgn=73; dgn_var=73; double_var=10.; double_var2=10.; dps_dry=73; dps_wet=73; dps_ttl=73; e_dbl=2.71828182846; e_flt=2.71828182846; // 20100809: Single quotes around NC_CHAR coordinates required as of 4.1.2-beta1-snapshot2010080820 // 20100809: Double quotes cause "String constant too long" error in ncgen fl_dmn='a','b','3'; fl_nm="/home/zender/nco/data/in.cdl"; float_var=10.; four=4.; g=9.8; grv_sfc=9.80665; vmr_CO2=400e-6; mmr_CO2=611e-6; gw=10.,10.; gw_T42=-87.863799,-85.096527,-82.312913,-79.525607,-76.736900,-73.947515,-71.157752,-68.367756,-65.577607,-62.787352,-59.997020,-57.206632,-54.416200,-51.625734,-48.835241,-46.044727,-43.254195,-40.463648,-37.673090,-34.882521,-32.091944,-29.301360,-26.510769,-23.720174,-20.929574,-18.138971,-15.348365,-12.557756,-9.767146,-6.976534,-4.185921,-1.395307,1.395307,4.185921,6.976534,9.767146,12.557756,15.348365,18.138971,20.929574,23.720174,26.510769,29.301360,32.091944,34.882521,37.673090,40.463648,43.254195,46.044727,48.835241,51.625734,54.416200,57.206632,59.997020,62.787352,65.577607,68.367756,71.157752,73.947515,76.736900,79.525607,82.312913,85.096527,87.863799; hyam=0.0036,0.0019894,0.0; hyai=0.002255,0.0438226,0.0,0.0; hybm=0.0,0.52,0.992; hybi=0.0,0.457453,0.985,1.0; P0=100000; gds_crd=0,1,2,3,4,5,6,7; gds_var=273.1,273.2,273.3,273.4,273.5,273.6,273.7,273.8; gds_var_ncd=273.1,273.2,273.3,273.4,273.5,273.6,273.7,273.8; gds_3dvar=273.1,273.2,273.3,273.4,273.5,273.6,273.7,273.8, 274.1,274.2,274.3,274.4,274.5,274.6,274.7,274.8, 275.1,275.2,275.3,275.4,275.5,274.5,275.7,275.8, 276.1,276.2,276.3,276.4,276.5,276.5,276.7,276.8, 277.1,277.2,277.3,277.4,277.5,277.5,277.7,277.8, 278.1,278.2,278.3,278.4,278.5,278.6,278.7,278.8, 279.1,279.2,279.3,279.4,279.5,279.9,279.7,279.8, 280.1,280.2,280.3,280.4,280.5,280.9,280.7,280.8, 281.1,281.2,281.3,281.4,281.5,281.9,281.7,281.8, 282.1,282.2,282.3,282.4,282.5,282.9,282.7,282.8; lat_gds=-90, -30, -30, 0, 0, 30, 30, 90; lon_gds= 0, 0, 180, 0, 180, 0, 180, 0; lat_gds_ncd=-90, -30, -30, 0, 0, 30, 30, 90; lon_gds_ncd= 0, 0, 180, 0, 180, 0, 180, 0; lat=-90,90; lat_bnd=-90,0,0,90; lat_cal=1.,2.,3.,4.,5.,6.,7.,8.,9.,10.; lon_cal=1.,2.,3.,4.,5.,6.,7.,8.,9.,10.; lat_times_lon=0,1,2,3,4,5,6,7; lat_times_lon_nbr=8; lat_1D_rct=-90, -90, -90, -90, 90, 90, 90, 90; lon_1D_rct= 0, 90, 180, 270, 0, 90, 180, 270; lat_1D_rrg=-90, -30, -30, 0, 0, 30, 30, 90; lon_1D_rrg= 0, 0, 180, 0, 180, 0, 180, 0; lat_2D_rct=-90, -90, -90, -90, 90, 90, 90, 90; lon_2D_rct= 0, 90, 180, 270, 0, 90, 180, 270; lat_2D_rrg=-90, -30, -30, 0, 0, 30, 30, 90; lon_2D_rrg= 0, 0, 180, 0, 180, 0, 180, 0; lat_grd=-90,0,90; lat_cpy=-90,90; lat_var=1.,2.; lat_wgt=1.,2.; // lat_T42=0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63; lat_T42=-88.240089,-85.092445,-82.311981,-79.525253,-76.736732,-73.947418,-71.157700,-68.367722,-65.577576,-62.787331,-59.997005,-57.206619,-54.416191,-51.625729,-48.835236,-46.044724,-43.254192,-40.463646,-37.673088,-34.882519,-32.091942,-29.301357,-26.510769,-23.720173,-20.929573,-18.138969,-15.348364,-12.557755,-9.767145,-6.976533,-4.185921,-1.395307,1.395307,4.185921,6.976533,9.767145,12.557755,15.348364,18.138969,20.929573,23.720173,26.510769,29.301357,32.091942,34.882519,37.673088,40.463646,43.254192,46.044724,48.835236,51.625729,54.416191,57.206619,59.997005,62.787331,65.577576,68.367722,71.157700,73.947418,76.736732,79.525253,82.311981,85.092445,88.240089; lsmlev=0.05,0.1,0.2,0.5,1.0,3.0; lev=100,500,1000; ilev=50,200,750,1005; lev_bnd=0,300,300,750,750,1013.25; lev_cpy=100,500,1000; lev_var=100.,500.,1000.; lev_wgt=10,2,1; lon=0,90,180,270; Lon=-180,-90,0,90; Lat=-45,45; LatLon=0,1,2,3,4,5,6,7; lond=0,90,180,270; lonf=0,90,180,270; lon_grd=-45,45,135,225,315; lon_wgt=0.347855,0.652145,0.652145,0.347855; // lon_T42=0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127; lon_T42=0.000000,2.812500,5.625000,8.437500,11.250000,14.062500,16.875000,19.687500,22.500000,25.312500,28.125000,30.937500,33.750000,36.562500,39.375000,42.187500,45.000000,47.812500,50.625000,53.437500,56.250000,59.062500,61.875000,64.687500,67.500000,70.312500,73.125000,75.937500,78.750000,81.562500,84.375000,87.187500,90.000000,92.812500,95.625000,98.437500,101.250000,104.062500,106.875000,109.687500,112.500000,115.312500,118.125000,120.937500,123.750000,126.562500,129.375000,132.187500,135.000000,137.812500,140.625000,143.437500,146.250000,149.062500,151.875000,154.687500,157.500000,160.312500,163.125000,165.937500,168.750000,171.562500,174.375000,177.187500,180.000000,182.812500,185.625000,188.437500,191.250000,194.062500,196.875000,199.687500,202.500000,205.312500,208.125000,210.937500,213.750000,216.562500,219.375000,222.187500,225.000000,227.812500,230.625000,233.437500,236.250000,239.062500,241.875000,244.687500,247.500000,250.312500,253.125000,255.937500,258.750000,261.562500,264.375000,267.187500,270.000000,272.812500,275.625000,278.437500,281.250000,284.062500,286.875000,289.687500,292.500000,295.312500,298.125000,300.937500,303.750000,306.562500,309.375000,312.187500,315.000000,317.812500,320.625000,323.437500,326.250000,329.062500,331.875000,334.687500,337.500000,340.312500,343.125000,345.937500,348.750000,351.562500,354.375000,357.187500; ppc_flt_2D= -1,-2,-3,-4,-5,-6,-7,-8,-9,-10, -11,-12,-13,-14,-15,-16,-17,-18,-19,-20; ppc_dbl=0.0,0.1,0.12,0.123,0.1234,0.12345,0.123456,0.1234567,0.12345678,0.123456789; ppc_flt=0.0,0.1,0.12,0.123,0.1234,0.12345,0.123456,0.1234567,0.12345678,0.123456789; ppc_big=123456789e-10,123456789e-9,123456789e-8,123456789e-7,123456789e-6,123456789e-5,123456789e-4,123456789e-3,123456789e-2,123456789e-1; ppc_btg=1234567890e20,1234567890e19,1234567890e18,1234567890e17,1234567890e16,1234567890e15,1234567890e14,1234567890e13,1234567890e12,1234567890e11; ppc_btg_scl=1234567890e11; ppc_hgh=0.00000000000000000000,0.10000000000000000000,0.12000000000000000000,0.123000000000000000000,0.1234000000000000000,0.12345000000000000000,0.123456000000000000000000,0.12345670000000000000000000,0.123456780000000000000,0.123456789000000000000; // 20220731 NCZarr I/O chokes here, apparently ncgen parses 15+ digit mantissas as integers? //ppc_hgr=0.123456789000000000000,0.1234567890100000000000,0.1234567890120000000000,0.12345678901230000000000,0.123456789012340000000,0.12345678901234500000,0.12345678901234560000,0.12345678901234567000,0.12345678901234567800,0.12345678901234567890; ppc_hgr=55,155,255,355,455,555,655,755,855,955; ppc_dcm=55,155,255,355,455,555,655,755,855,955; ppc_tst=0.0,_,0.1234567,-0.1234567,64,-64,123456789e25,123456789e-25,3.1415926535897932384626433832795029,-3.1415926535897932384626433832795029; ppc_zro_flt=0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0; ppc_zro_dbl=0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0; ppc_zro_int=0,0,0,0,0,0,0,0,0,0; qnt_flt_tst1=1.1111111; qnt_dbl_tst1=1.111111111111; qnt_flt_tst2=1.11111111, 1.0, 9.99999999, 12345.67, .1234567; // 20220731 NCZarr I/O chokes here, apparently ncgen parses 15+ digit mantissas as integers? //qnt_dbl_tst2=1.1111111, 1.0, 9.999999999, 1234567890.12345, 123456789012345.0; qnt_dbl_tst2=1.11111111, 1.0, 9.99999999, 12345.67, .1234567; var_msk=0.,1.,0.,0.,1.,1.,0.,2.; var_mss_nil=0.,1.,2.,3.; var_mss_0=_,1.,2.,3.; var_mss_1=0.,_,2.,3.; var_mss_2=0.,1.,_,3.; var_mss_3=0.,1.,2.,_; ORO=0.,1.,0.,0.,1.,1.,0.,2.; orog=0.,1.,0.,0.,1.,1.,0.,2.; orog2=1.,1.,1.,1.,1.,1.,1.,1.; orog3=0.,0.,0.,0.,1.,1.,1.,1.; mask=0.,1.,0.,0.,1.,1.,0.,1.; // mask=0.,0.,0.,0.,0.,0.,0.,0.; // mask=1.,1.,1.,1.,1.,1.,1.,1.; fll_val=73,-999,73,-999; fll_val_mss_val=73,-999,73,-999; md5_a="a"; md5_abc="abc"; msk_prt_mss_prt=0.5,1.0e36,1.5,1.0e36; mss_val=73,1.0e36,73,1.0e36; mss_val_all=1.0e36,1.0e36,1.0e36,1.0e36; mss_val_fst=-999,73,-999,73; mss_val_scl=1.0e36; mss_val_scl_sml=1.0e4; //nan_arr=0,nan; nan_arr=0,73; //nan_scl=nan; nan_scl=1; negative_one=-1.; nm_pnd=1; nm_spc=1; no_mss_val=73,1.0e36,73,1.0e36; non_nul_trm_char_one_dmn='a','b'; non_nul_trm_char_two_dmn="abcd","efgh","ijkm"; one=1.; one_dmn_rec_var=1,2,3,4,5,6,7,8,9,10; one_dmn_rec_wgt=2,1,0,0,0,0,0,0,0,0; one_dmn_rec_var_unsorted=10,4,6,2,8,1,9,7,3,5; one_dmn_rec_var_flt=1,2,3,4,5,6,7,8,9,10; one_dmn_rec_var_flt_mss=_,2,3,4,5,6,7,8,9,_; one_dmn_rec_var_flt_scl=1,2,3,4,5,6,7,8,9,10; // First use of underscore to indicate _FillValue in in.cdl is here in one_dmn_rec_var_flt_mss_scl on 20140916 one_dmn_rec_var_flt_mss_scl=_,2,3,4,5,6,7,8,9,_; one_dmn_rec_var_dbl=1,2,3,4,5,6,7,8,9,10; one_dmn_rec_var_missing_value=1,2,3,4,5,6,7,8,9,1.0e36; one_dmn_rec_var_mss_val=1.0e36,1.0e36,1.0e36,1.0e36,1.0e36,1.0e36,1.0e36,1.0e36,1.0e36,1.0e36; one_dmn_rec_var_mss_val_arr=1,2,3,4,5,6,7,8,9,10; one_dmn_rec_var__FillValue=1,2,3,4,5,6,7,8,9,1.0e36; one_dmn_rec_var_unsorted__FillValue=1.0e36,4,6,2,8,1,9,7,3,5; one_dmn_rec_var_mdn=1,1,2,2,2,2,10,10,10,10; one_dmn_rec_var_mdn__FillValue=1,-999,2,2,-999,-999,10,10,10,-999; RDM=1,9,36,84,126,126,84,36,9,1; one_dmn_rec_var_sng="Hello Worl"; one_dmn_var=1.,10.; one_dmn_int_val_one=1,1; one_dmn_int_val_two=2,2; pck=1; pck_3=1; pck_5=2; pck_7=1; rec_var_pck_scale_factor_only=1,2,3,4,5,6,7,8,9,10; pck_arr=-32767,0,1,32767; pck_crd=-32767,0,1,32767; pi=3.1415926535897932384626433832795029; pi1=3.1415927,3.1415937,3.1415946,3.1415956,3.1415966,3.1415977,3.1415987,3.1415997,3.1416006,3.1416016; pi2=3.1415927,3.1415937,3.1415946,3.1415956,3.1415966,3.1415977,3.1415987,3.1415997,3.1416006,3.1416016; pi3=3.1415927,3.1415937,3.1415946,3.1415956,3.1415966,3.1415977,3.1415987,3.1415997,3.1416006,3.1416016; pi4=3.1415927,3.1415937,3.1415946,3.1415956,3.1415966,3.1415977,3.1415987,3.1415997,3.1416006,3.1416016; pi5=3.1415927,3.1415937,3.1415946,3.1415956,3.1415966,3.1415977,3.1415987,3.1415997,3.1416006,3.1416016; pi6=3.1415927,3.1415937,3.1415946,3.1415956,3.1415966,3.1415977,3.1415987,3.1415997,3.1416006,3.1416016; pi7=3.1415927,3.1415937,3.1415946,3.1415956,3.1415966,3.1415977,3.1415987,3.1415997,3.1416006,3.1416016; pi_arr_dbl=3.1415926535897932384626433832795029,3.1415926535897932384626433832795029,3.1415926535897932384626433832795029,3.1415926535897932384626433832795029,3.1415926535897932384626433832795029,3.1415926535897932384626433832795029,3.1415926535897932384626433832795029,3.1415926535897932384626433832795029; pi_arr_flt=3.1415926535897932384626433832795029,3.1415926535897932384626433832795029,3.1415926535897932384626433832795029,3.1415926535897932384626433832795029,3.1415926535897932384626433832795029,3.1415926535897932384626433832795029,3.1415926535897932384626433832795029,3.1415926535897932384626433832795029; upk=3.; upk_arr=-32767.,0.,1.,32767.; H2O=1.0; H2OH2O=1.0; H2SO4=1.0; H2O_lqd=1.0; H2O_ice=1.0; Q=1.0e36; Q1=1.0e36; AQ01=1.0e36; QQ01=1.0e36; QA01=1.0e36; Q01Q=1.0e36; Q01=1; Q02=2; Q03=3; Q04=4; Q05=5; Q06=6; Q07=7; Q08=8; Q09=9; Q10=10; Q11=11; Q12=12; Q13=13; Q14=14; Q15=15; Q16=16; Q17=17; Q18=18; Q19=19; Q20=20; Q21=21; Q22=22; Q23=23; Q24=24; Q25=25; Q26=26; Q27=27; Q28=28; Q29=29; Q30=30; Q31=31; Q32=32; Q33=33; Q34=34; Q35=35; Q36=36; Q37=37; Q38=38; Q39=39; Q40=40; Q41=41; Q42=42; Q43=43; Q44=44; Q45=45; Q46=46; Q47=47; Q48=48; Q49=49; Q50=50; Q51=51; Q52=52; Q53=53; Q54=54; Q55=55; Q56=56; Q57=57; Q58=58; Q59=59; Q60=60; Q61=61; Q62=62; Q63=63; Q64=64; Q65=65; Q66=66; Q67=67; Q68=68; Q69=69; Q70=70; Q71=71; Q72=72; Q73=73; Q74=74; Q75=75; Q76=76; Q77=77; Q78=78; Q79=79; Q80=80; Q81=81; Q82=82; Q83=83; Q84=84; Q85=85; Q86=86; Q87=87; Q88=88; Q89=89; Q90=90; Q91=91; Q92=92; Q93=93; Q94=94; Q95=95; Q96=96; Q97=97; Q98=98; Q99=99; Q100=100; non_rec_var_flt_pck=1,2,3,4; rec_var_dbl=1.,2.,3.,4.,5.,6.,7.,8.,9.,10.; rec_var_dbl_mss_val_dbl_pck=-999,32767,21845,10922,0,-10922,-21845,-32767,-999,-999; rec_var_dbl_mss_val_dbl_pck_lng=-999,32767,21845,10922,0,-10922,-21845,-32767,-999,-999; rec_var_dbl_mss_val_sht_pck_sht=-999,32767,21845,10922,0,-10922,-21845,-32767,-999,-999; rec_var_flt_mss_val_flt_pck_flt=-9.96921e+33,0.032,0.033,0.034,0.035,0.036,0.037,0.038,-9.96921e+33,-9.96921e+33; SALT=-9.96921e+33,0.032,0.033,0.034,0.035,0.036,0.037,0.038,-9.96921e+33,-9.96921e+33; rec_var_dbl_mss_val_dbl_upk=-999.,2.,3.,4.,5.,6.,7.,8.,-999.,-999.; rec_var_dbl_mss_val_sht_pck=-999,32767,21845,10922,0,-10922,-21845,-32767,-999,-999; rec_var_dbl_mss_val_sht_upk=-999.,2.,3.,4.,5.,6.,7.,8.,-999.,-999.; rec_var_dbl_pck=1,2,3,4,5,6,7,8,9,10; rec_var_flt=1.,2.,3.,4.,5.,6.,7.,8.,9.,10.; rec_var_flt_mss_val_dbl=1.0e36,2.,3.,4.,5.,6.,7.,8.,1.0e36,1.0e36; rec_var_flt_mss_val_flt=1.0e36,2.,3.,4.,5.,6.,7.,8.,1.0e36,1.0e36; rec_var_flt_mss_val_flt_all=1.0e36,1.0e36,1.0e36,1.0e36,1.0e36,1.0e36,1.0e36,1.0e36,1.0e36,1.0e36; rec_var_flt_mss_val_flt_all_but_one=1.0e36,1.0e36,1.0e36,1.0e36,5.0,1.0e36,1.0e36,1.0e36,1.0e36,1.0e36; rec_var_flt_mss_val_flt_all_but_two=1.0e36,1.0e36,1.0e36,1.0e36,5.0,1.0e36,1.0e36,1.0e36,1.0e36,10.0; rec_var_flt_mss_val_int=-999.,2.,3.,4.,5.,6.,7.,8.,-999.,-999.; rec_var_flt_pck=1,2,3,4,5,6,7,8,9,10; rec_var_int_mss_val_dbl=-999,2,3,4,5,6,7,8,-999,-999; rec_var_int_mss_val_flt=-999,2,3,4,5,6,7,8,-999,-999; rec_var_int_mss_val_int=-999,2,3,4,5,6,7,8,-999,-999; rlev=1000,500,100; rz=0,5000,17000; scl_dbl_pck=10922; scalar_var=10.; short_var=10; three=3.; three_dmn_var=0.,1.,2.,3.,4.,5.,6.,7.,8.,9.,10.,11.,12.,13.,14.,15.,16.,17.,18.,19.,20.,21.,22.,23.; three_dmn_var_crd=0.,1.,2.,3.,12.,13.,14.,15.,4.,5.,6.,7.,16.,17.,18.,19.,8.,9.,10.,11.,20.,21.,22.,23.; three_dmn_var_cf=0.,1.,2.,3.,12.,13.,14.,15.,4.,5.,6.,7.,16.,17.,18.,19.,8.,9.,10.,11.,20.,21.,22.,23.; three_dmn_var_cf2=0.,1.,2.,3.,12.,13.,14.,15.,4.,5.,6.,7.,16.,17.,18.,19.,8.,9.,10.,11.,20.,21.,22.,23.; time=1.,2.,3.,4.,5.,6.,7.,8.,9.,10.; time_rpt=1.,2.,3.,1.,2.,3.,1.,2.,3.,1.; time_bnds=0.5,1.5,1.5,2.5,2.5,3.5,3.5,4.5,4.5,5.5,5.5,6.5,6.5,7.5,7.5,8.5,8.5,9.5,9.5,10.5; climatology_bounds=0.5,1.5,1.5,2.5,2.5,3.5,3.5,4.5,4.5,5.5,5.5,6.5,6.5,7.5,7.5,8.5,8.5,9.5,9.5,10.5; tm_scn=59; tm_std=59; tm_grg=59; tm_jln=59; tm_360=59; tm_365=59; tm_366=59; od=20,22,24,26,28,30,32,34,36,38; tpt=273.1,273.2,273.3,273.4,273.5,273.6,273.7,273.8,273.9,274.0; tpt_flt=273.1,273.2,273.3,273.4,273.5,273.6,273.7,273.8,273.9,274.0; tpt_dbl=273.1,273.2,273.3,273.4,273.5,273.6,273.7,273.8,273.9,274.0; two=2.; two_dmn_var=1.5,5.5,9.5,13.5,17.5,21.5; u=1.,0.,1.,0.,1.,0.,1.,0.,1.,0.; v=0.,1.,0.,1.,0.,1.,0.,1.,0.,1.; val_half=0.5; val_half_half=0.5,0.5; val_max_max_sht=17000,17000; val_eminusten=1.1e-10; val_one_int=1; val_one_mss=1.,1.0e36; val_one_mss_int=1,-99; val_one_one_int=1,1; var_nm-dash=1.0; // var_nm.dot=1.0; var_1D_rct=0.,1.,0.,0.,1.,1.,0.,2.; var_1D_rrg=0.,1.,0.,0.,1.,1.,0.,2.; var_2D_rct=0.,1.,0.,0.,1.,1.,0.,2.; var_2D_rrg=0.,1.,0.,0.,1.,1.,0.,2.; weight=10.,10.; wgt_one=1.,1.; wvl=0.5e-6,1.0e-6; z=17000,5000,0; zero=0.; // date=640312,640313,640314,640315,640316,640317,640318,640319,640320,640321; date=640224,640225,640226,640227,640228,640301,640302,640303,640304,640305; int_var=10; long_var=10; nbdate=640224; fl_nm_arr="/data/zender/dstccm04/dstccm04_8589_01.nc", "/data/zender/dstccm04/dstccm04_8589_02.nc", "/data/zender/dstccm04/dstccm04_8589_03.nc"; fl_nm_rec="/data/zender/dstccm04/dstccm04_8589_01.nc", "/data/zender/dstccm04/dstccm04_8589_02.nc", "/data/zender/dstccm04/dstccm04_8589_03.nc", "/data/zender/dstccm04/dstccm04_8589_04.nc", "/data/zender/dstccm04/dstccm04_8589_05.nc", "/data/zender/dstccm04/dstccm04_8589_06.nc", "/data/zender/dstccm04/dstccm04_8589_07.nc", "/data/zender/dstccm04/dstccm04_8589_08.nc", "/data/zender/dstccm04/dstccm04_8589_09.nc", "/data/zender/dstccm04/dstccm04_8589_10.nc"; date_sng="2010-11-01T00:00:00.000000"; date_rec="2010-11-01T00:00:00.000000", "2010-11-01T01:00:00.000000", "2010-11-01T02:00:00.000000", "2010-11-01T03:00:00.000000", "2010-11-01T04:00:00.000000", "2010-11-01T05:00:00.000000", "2010-11-01T06:00:00.000000", "2010-11-01T07:00:00.000000", "2010-11-01T08:00:00.000000", "2010-11-01T09:00:00.000000"; time_lon=0.0,90.0,180.0,270.0, 0.0,90.0,180.0,270.0, 0.0,90.0,180.0,270.0, 0.0,90.0,180.0,270.0, 0.0,90.0,180.0,270.0, 0.0,90.0,180.0,270.0, 0.0,90.0,180.0,270.0, 0.0,90.0,180.0,270.0, 0.0,90.0,180.0,270.0, 0.0,90.0,180.0,270.0; two_dmn_rec_var_sng="abc", "bcd", "cde", "def", "efg", "fgh", "ghi", "hij", "jkl", "klm"; two_dmn_rec_var=1.,2.0,3., 1.,2.1,3., 1.,2.2,3., 1.,2.3,3., 1.,2.4,3., 1.,2.5,3., 1.,2.6,3., 1.,2.7,3., 1.,2.8,3., 1.,2.9,3.; three_dmn_rec_var= 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16, 17,18,19,20,21,22,23,24, 25,26,27,28,29,30,31,32, 33,34,35,36,37,38,39,40, 41,42,43,44,45,46,47,48, 49,50,51,52,53,54,55,56, 57,58,59,60,61,62,63,64, 65,66,67,68,69,70,71,72, 73,74,75,76,77,78,79,80; three_dmn_rec_var_pck= 32766, 31936, 31107, 30277, 29448, 28618, 27789, 26959, 26130, 25300, 24471, 23641, 22812, 21982, 21153, 20323, 19494, 18664, 17835, 17005, 16176, 15346, 14517, 13687, 12858, 12028, 11199, 10369, 9539, 8710, 7880, 7051, 6221, 5392, 4562, 3733, 2903, 2074, 1244, 415, -415, -1244, -2074, -2903, -3733, -4562, -5392, -6221, -7051, -7880, -8710, -9539, -10369, -11199, -12028, -12858, -13687, -14517, -15346, -16176, -17005, -17835, -18664, -19494, -20323, -21153, -21982, -22812, -23641, -24471, -25300, -26130, -26959, -27789, -28618, -29448, -30277, -31107, -31936, -32766 ; prs_sfc= 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16, 17,18,19,20,21,22,23,24, 25,26,27,28,29,30,31,32, 33,34,35,36,37,38,39,40, 41,42,43,44,45,46,47,48, 49,50,51,52,53,54,55,56, 57,58,59,60,61,62,63,64, 65,66,67,68,69,70,71,72, 73,74,75,76,77,78,79,80; PS= 101325,101325,101325,101325,101325,101325,101325,101325, 101325,101325,101325,101325,101325,101325,101325,101325, 101325,101325,101325,101325,101325,101325,101325,101325, 101325,101325,101325,101325,101325,101325,101325,101325, 101325,101325,101325,101325,101325,101325,101325,101325, 101325,101325,101325,101325,101325,101325,101325,101325, 101325,101325,101325,101325,101325,101325,101325,101325, 101325,101325,101325,101325,101325,101325,101325,101325, 101325,101325,101325,101325,101325,101325,101325,101325, 101325,101325,101325,101325,101325,101325,101325,101325; three_dmn_var_dbl= 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16, 17,18,19,20,21,22,23,24, -99,-99,-99,-99,-99,-99,-99,-99, 33,34,35,36,37,38,39,40, 41,42,43,44,45,46,47,48, 49,50,51,52,53,54,55,56, -99,58,59,60,61,62,63,64, 65,66,67,68,69,70,71,72, -99,74,75,76,77,78,79,-99; zg= 1, 2, 3, 4, 5, 6, 7, 8,9,10,11,12, 13,14,15,16,17,18,19,20,21,22,23,24, 25,26,27,28,29,30,31,32,33,34,35,36, 37,38,39,40,41,42,43,44,45,46,47,48, 49,50,51,52,53,54,55,56,57,58,59,60, 61,62,63,64,65,66,67,68,69,70,71,72, 73,74,75,76,77,78,79,80,81,82,83,84, 85,86,87,88,89,90,91,92,93,94,95,96, 97,98,99,100,101,102,103,104,105,106,107,108, 109,110,111,112,113,114,115,116,117,118,119,120; three_dmn_var_int= 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16, -99,-99,-99,-99,-99,-99,-99,-99, 25,26,27,28,29,30,31,32, 33,34,35,36,37,38,39,40, 41,-99,43,44,45,46,47,48, 49,50,51,52,53,54,55,56, -99,58,59,60,-99,62,63,64, 65,-99,67,68,69,70,71,72, -99,74,75,-99,77,78,79,80; three_dmn_var_sht= 1, 2, 3, 4, 5, 6, 7, 8, -99,10,11,12,13,14,15,16, 17,18,19,20,21,22,23,24, 25,26,27,28,29,30,31,32, -99,34,35,-99,37,38,39,40, 41,42,43,44,-99,46,47,48, 49,50,51,52,53,54,55,56, 57,58,59,-99,61,62,63,64, 65,66,67,68,69,70,71,72, -99,-99,-99,-99,-99,-99,-99,-99; th= 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16, 17,18,19,20,21,22,23,24, -99,-99,-99,-99,-99,-99,-99,-99, 33,34,35,36,37,38,39,40, 41,42,43,44,45,46,47,48, 49,50,51,52,53,54,55,56, -99,58,59,60,61,62,63,64, 65,66,67,68,69,70,71,72, -99,74,75,76,77,78,79,-99; four_dmn_rec_var= 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,100,101,102,103,104,105,106,107,108, 109,110,111,112,113,114,115,116,117,118,119,120, 121,122,123,124,125,126,127,128,129,130,131,132, 133,134,135,136,137,138,139,140,141,142,143,144, 145,146,147,148,149,150,151,152,153,154,155,156, 157,158,159,160,161,162,163,164,165,166,167,168, 169,170,171,172,173,174,175,176,177,178,179,180, 181,182,183,184,185,186,187,188,189,190,191,192, 193,194,195,196,197,198,199,200,201,202,203,204, 205,206,207,208,209,210,211,212,213,214,215,216, 217,218,219,220,221,222,223,224,225,226,227,228, 229,230,231,232,233,234,235,236,237,238,239,240; td= 1,2,3,4,5,6,7,8,9,10; tx= 1,2,3,4,5,6,7,8,9,10, 11,12,13,14,15,16,17,18,19,20, 21,22,23,24,25,26,27,28,29,30, 31,32,33,34,35,36,37,38,39,40; ty= 1,2,3,4,5,6,7,8,9,10, 11,12,13,14,15,16,17,18,19,20; tz= 1,2,3,4,5,6,7,8,9,10, 11,12,13,14,15,16,17,18,19,20, 21,22,23,24,25,26,27,28,29,30; tyz= 1,2,3,4,5,6,7,8,9,10, 11,12,13,14,15,16,17,18,19,20, 21,22,23,24,25,26,27,28,29,30, 31,32,33,34,35,36,37,38,39,40, 41,42,43,44,45,46,47,48,49,50, 51,52,53,54,55,56,57,58,59,60; xyz=0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23; txyz= 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,100,101,102,103,104,105,106,107,108, 109,110,111,112,113,114,115,116,117,118,119,120, 121,122,123,124,125,126,127,128,129,130,131,132, 133,134,135,136,137,138,139,140,141,142,143,144, 145,146,147,148,149,150,151,152,153,154,155,156, 157,158,159,160,161,162,163,164,165,166,167,168, 169,170,171,172,173,174,175,176,177,178,179,180, 181,182,183,184,185,186,187,188,189,190,191,192, 193,194,195,196,197,198,199,200,201,202,203,204, 205,206,207,208,209,210,211,212,213,214,215,216, 217,218,219,220,221,222,223,224,225,226,227,228, 229,230,231,232,233,234,235,236,237,238,239,240; // three_double_dmn= 1, 2, 3, 4, 5, 6, 7, 8, // 9,10,11,12,13,14,15,16, // 17,18,19,20,21,22,23,24, // -99,-99,-99,-99,-99,-99,-99,-99, // 33,34,35,36,37,38,39,40, // 41,42,43,44,45,46,47,48, // 49,50,51,52,53,54,55,56, // -99,58,59,60,61,62,63,64, // 65,66,67,68,69,70,71,72, // -99,74,75,76,77,78,79,-99, // 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, // 9.5,10.5,11.5,12.5,13.5,14.5,15.5,16.5, // 17.5,18.5,19.5,20.5,21.5,22.5,23.5,24.5, // -99.5,-99.5,-99.5,-99.5,-99.5,-99.5,-99.5,-99.5, // 33.5,34.5,35.5,36.5,37.5,38.5,39.5,40.5, // 41.5,42.5,43.5,44.5,45.5,46.5,47.5,48.5, // 49.5,50.5,51.5,52.5,53.5,54.5,55.5,56.5, // -99.5,58.5,59.5,60.5,61.5,62.5,63.5,64.5, // 65.5,66.5,67.5,68.5,69.5,70.5,71.5,72.5, // -99.5,74.5,75.5,76.5,77.5,78.5,79.5,-99.5; time_int_udunits = 86400; time_udunits = 876012, 876018, 876024; vld_rng= 273.,-999.,180.,179.,273.,360.,361.,1.0e36,-1.0e36,273.; wnd_spd= -999,0.5,1.5,0.5,1.5,0.5,1.5,0.5, 0.5,-999,0.5,0.5,0.5,0.5,0.5,0.5, 0.5,1.5,-999,1.5,0.5,1.5,0.5,1.5, 0.5,0.5,0.5,-999,0.5,0.5,0.5,0.5, 1.5,1.5,1.5,1.5,-999,1.5,1.5,1.5, 0.5,0.5,0.5,0.5,0.5,-999,0.5,0.5, 2.5,2.5,2.5,2.5,2.5,2.5,-999,2.5, 0.5,0.5,0.5,0.5,0.5,0.5,0.5,-999, 0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5, 0.5,0.5,2.5,0.5,0.5,2.5,0.5,0.5; } // end netcdf nco-5.3.3/data/in_zarr4.cdl000066400000000000000000002670131477164337000154530ustar00rootroot00000000000000// -*-C++-*- // Purpose: CDL file to generate NCZarr-compatible test file with netCDF4 atomic types for NCO // Derived by removing NCZarr incompatibilities from in.cdl // Changes include: // 1. Change time from NC_UNLIMITED to fixed size 10 // 2. Add netCDF4 types from in_4.cdl // 3. Remove all variables and attributes of string type // 4. Make all scalars use degenerate (size = 1) "scalar" dimension as (hopefully) temporary workaround to https://github.com/Unidata/netcdf-c/issues/2485 // 5. 20220827: Eliminate Lat,Lon dimensions // 6. 20220830: Restore variables/attributes of string type after PR #2492 by D. Heimbigner added support for strings // 7. Report regressions in string handling to Unidata // 8. 20220906 Re-test variables/attributes of string type after PR #2497 by D. Heimbigner fixed support for strings. Strings now work as advertised // 9. 20220907 Report "Unmatched untrace: fcn=ncz_get_var_meta expected=NCZ_inq_var_filter_info" issue // 10. Remove degenerate "scalar" dimension which NCZarr now supports // 11. Restore NC_UNLIMITED after PR #2744 by D. Heimbigner added support for unlimited dimensions // 12. Temporarily eliminate NC_UNLIMITED dimension so NCO 5.1.9+ distribution does not break when building with netCDF <= 4.9.2 // Usage: // netCDF4: ncgen arguments depend on version: // "-k netCDF-4" for netCDF >= 3.6.3, "-k hdf5" for netCDF < 3.6.3 // "-k netCDF-4 classic model" for netCDF >= 3.6.3, "-k hdf5-nc3" for netCDF < 3.6.3 // ncgen -k netCDF-4 -b -o in_zarr4.nc in_zarr4.cdl // ncgen -k netCDF-4 -b -o ${HOME}/nco/data/in_zarr4.nc ${HOME}/nco/data/in_zarr4.cdl // ncgen -lb -o "file://${HOME}/in_zarr4#mode=nczarr,file" ${HOME}/nco/data/in_zarr4.cdl // ncks -O -4 "file://${HOME}/in_zarr4#mode=nczarr,file" ~/in_zarr4.nc // URL: // http://dust.ess.uci.edu/nco/in_zarr4.nc // http://dust.ess.uci.edu/nco/in_zarr4.nc // http://thredds-test.ucar.edu/thredds/dodsC/testdods/in_zarr4.nc // netCDF3: // ncgen -b -o in_zarr4.nc in_zarr4.cdl // ncgen -b -o ${HOME}/nco/data/in_zarr4.nc ${HOME}/nco/data/in_zarr4.cdl // scp ~/nco/data/in_zarr4.cdl ~/nco/data/in_4.nc dust.ess.uci.edu:nco/data // scp ~/nco/data/in_zarr4.nc ~/nco/data/in_4.nc dust.ess.uci.edu:/var/www/html/nco // scp ~/nco/data/in_zarr4.nc ~/nco/data/in_4.nc dust.ess.uci.edu:/var/www/html/dodsdata // mswrite -t 365 ~/nco/data/in_zarr4.nc /ZENDER/tmp/in_zarr4.nc // mswrite -t 365 ~/nco/data/in_zarr4.nc /ZENDER/tmp/h0001.nc // mswrite -t 365 ~/nco/data/in_zarr4.nc /ZENDER/tmp/h0002.nc // mswrite -t 365 ~/nco/data/in_zarr4.nc /ZENDER/tmp/h0003.nc // mswrite -t 365 ~/nco/data/in_zarr4.nc /ZENDER/tmp/h0004.nc // msrcp -period 365 ~/nco/data/in_zarr4.nc mss:/ZENDER/tmp/in_zarr4.nc // msrcp -period 365 ~/nco/data/in_zarr4.nc mss:/ZENDER/tmp/h0001.nc // msrcp -period 365 ~/nco/data/in_zarr4.nc mss:/ZENDER/tmp/h0002.nc // msrcp -period 365 ~/nco/data/in_zarr4.nc mss:/ZENDER/tmp/h0003.nc // msrcp -period 365 ~/nco/data/in_zarr4.nc mss:/ZENDER/tmp/h0004.nc // WARNING: Changing values of variables below, especially coordinate variables, affects outcome of nco_tst.pl test script // Other programs, e.g., ~/f/fff.F90, ~/c++/ccc.cc, ~/c/c.c may also break // In particular, do not change number of elements in record coordinate, time, without simultaneously changing number of data in all record variables // My (and NCO's) convention is that the _FillValue, if any, of any packed variable should be of the same type as the expanded variable. Hence _FillValue, add_offset, and scale_factor should all be of the same type. Variables that do not adhere to this convention are not supported. // Bugs: // Some triggering bugs were moved to buggy.cdl to prevent non-builds // ncgen 4.0.0--4.3.2 crashes on 'l' or 'L' syntax when generating netCDF4-classic (but not netCDF3 or netCDF4) files until 20141010 (NCF-318) // CDL Data constants: // http://www.unidata.ucar.edu/software/netcdf/docs/netcdf/CDL-Syntax.html // byte: 'a' // char: "a" // short: 1s // int: 1 (no decimal point) // long: 1 (_not_ 1l;) (long is synonym for int in netCDF3) // float: 1.f (decimal point is required, f is required to distinguish from double) // double: 1.0, 1.d, 1.0e-20 (decimal point is required, d is not required) // CDL complex types: // roulee:/data/zender/tmp/netcdf-4.2.1/nc_test/ref_tst_diskless2.cdl // NCL usage: // id_in=addfile("/home/zender/nco/data/in.nc","r") // print(id_in) // list_filevars(id_in) netcdf in_zarr4 { dimensions: //dgn=1,bnd=2,lat=2,lat_grd=3,lev=3,rlev=3,ilev=4,lon=4,lon_grd=5,char_dmn_lng80=80,char_dmn_lng26=26,char_dmn_lng04=4,date_dmn=5,fl_dmn=3,lsmlev=6,wvl=2,time_int_udunits=1;time_udunits=3;lon_T42=128,lat_T42=64,lat_times_lon=8,gds_crd=8,gds_ncd=8,lon_cal=10,lat_cal=10,Lon=4,Lat=2,pck_crd=4,vrt_nbr=2,time=10; // 20220827: Eliminate Lat,Lon dimensions //dgn=1,bnd=2,lat=2,lat_grd=3,lev=3,rlev=3,ilev=4,lon=4,lon_grd=5,char_dmn_lng80=80,char_dmn_lng26=26,char_dmn_lng04=4,date_dmn=5,fl_dmn=3,lsmlev=6,wvl=2,time_int_udunits=1;time_udunits=3;lon_T42=128,lat_T42=64,lat_times_lon=8,gds_crd=8,gds_ncd=8,lon_cal=10,lat_cal=10,pck_crd=4,vrt_nbr=2,time=10; // 20231019: Restore NC_UNLIMITED dimension //dgn=1,bnd=2,lat=2,lat_grd=3,lev=3,rlev=3,ilev=4,lon=4,lon_grd=5,char_dmn_lng80=80,char_dmn_lng26=26,char_dmn_lng04=4,date_dmn=5,fl_dmn=3,lsmlev=6,wvl=2,time_int_udunits=1;time_udunits=3;lon_T42=128,lat_T42=64,lat_times_lon=8,gds_crd=8,gds_ncd=8,lon_cal=10,lat_cal=10,pck_crd=4,vrt_nbr=2,time=unlimited; // 20231020: Temporarily eliminate NC_UNLIMITED dimension so NCO 5.1.9+ distribution does not break when building with netCDF <= 4.9.2 dgn=1,bnd=2,lat=2,lat_grd=3,lev=3,rlev=3,ilev=4,lon=4,lon_grd=5,char_dmn_lng80=80,char_dmn_lng26=26,char_dmn_lng04=4,date_dmn=5,fl_dmn=3,lsmlev=6,wvl=2,time_int_udunits=1;time_udunits=3;lon_T42=128,lat_T42=64,lat_times_lon=8,gds_crd=8,gds_ncd=8,lon_cal=10,lat_cal=10,pck_crd=4,vrt_nbr=2,time=10; variables: :Conventions = "CF-1.5"; :history = "History global attribute.\nTextual attributes like history often have embedded newlines like this.\nSuch newlines should serve as linebreaks on the screen to enhance legibility like this.\nFriendly CDL converters print a single NC_CHAR attribute as a comma-separated list of strings where each embedded delimiter marks a linebreak. This makes poetry embedded in CDL much nicer to read (except for the printed literal \\n\'s---those are an eyesore):\n\nA POET by Hafiz\n\nA poet is someone\nWho can pour light into a cup,\nThen raise it to nourish\nYour beautiful parched, holy mouth\n"; :lorem_ipsum = "The Lorem Ipsum attribute demonstrates the legibility of text without embedded linebreaks:\nLorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Lady Gaga amat indueris vestimento laetus. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."; :julian_day = 200000.04; :RCS_Header = "$Header$"; string :sng_att = "Test global string attribute"; // 20130723 This is how to specify global string attributes // netCDF4-only atomic types int64 int64_var_max; int64_var_max:long_name = "int64-type variable"; int64 int64_var; int64_var:long_name = "int64-type variable"; string string_var; string_var:long_name = "string-type variable"; string string_var2; string_var2:long_name = "string-type variable with default XML separator"; string string_arr_var(lon); string_arr_var:long_name = "arrays of string-types"; string string_greek(lat,lon); string_greek:long_name = "2D arrayof string-types"; ubyte ubyte_var; ubyte_var:long_name = "ubyte-type variable"; uint uint_var_max; uint_var_max:long_name = "uint-type variable"; uint uint_var; uint_var:long_name = "uint-type variable"; uint64 uint64_var; uint64_var:long_name = "uint64-type variable"; ushort ushort_var; ushort_var:long_name = "ushort-type variable"; // netCDF3 atomic types: int date_int(date_dmn); date_int:long_name = "Date (as array of ints: YYYY,MM,DD,HH,MM)"; float dgn(dgn); dgn:long_name = "degenerate coordinate (dgn means degenerate, i.e., of size 1)"; float dgn_var(dgn); dgn_var:long_name = "degenerate variable (dgn means degenerate, i.e., of size 1)"; float lat(lat); lat:long_name = "Latitude (typically midpoints)"; lat:units = "degrees_north"; lat:bounds = "lat_bnd"; float lat_bnd(lat,vrt_nbr); lat_bnd:purpose = "Cell boundaries for lat coordinate"; float lat_grd(lat_grd); lat_grd:long_name = "Latitude grid (typically interfaces)"; lat_grd:units = "degrees_north"; float lat_cpy(lat); float lev_cpy(lev); float lat_var(lat); float lat_wgt(lat); float lon_T42(lon_T42); float lat_T42(lat_T42); float lat_1D_rct(lat_times_lon); lat_1D_rct:long_name = "Latitude for 2D rectangular grid stored as 1D arrays"; lat_1D_rct:units = "degrees_north"; float lon_1D_rct(lat_times_lon); lon_1D_rct:long_name = "Longitude for 2D rectangular grid stored as 1D arrays"; lon_1D_rct:units = "degrees_east"; float lat_1D_rrg(lat_times_lon); lat_1D_rrg:long_name = "Latitude for 2D irregular grid stored as 1D arrays"; lat_1D_rrg:units = "degrees_north"; float lon_1D_rrg(lat_times_lon); lon_1D_rrg:long_name = "Longitude for 2D irregular grid stored as 1D arrays"; lon_1D_rrg:units = "degrees_east"; int lat_times_lon(lat_times_lon); lat_times_lon:long_name = "Element index (i.e., C-based storage order) for 2D coordinate grids stored as 1D arrays"; float lat_2D_rct(lat,lon); lat_2D_rct:long_name = "Latitude for 2D rectangular grid stored as 2D array"; lat_2D_rct:units = "degrees_north"; float lon_2D_rct(lat,lon); lon_2D_rct:long_name = "Longitude for 2D rectangular grid stored as 2D array"; lon_2D_rct:units = "degrees_east"; float lat_2D_rrg(lat,lon); lat_2D_rrg:long_name = "Latitude for 2D irregular grid stored as 2D array"; lat_2D_rrg:units = "degrees_north"; float lon_2D_rrg(lat,lon); lon_2D_rrg:long_name = "Longitude for 2D irregular grid stored as 2D array"; lon_2D_rrg:units = "degrees_east"; int lat_times_lon_nbr; lat_times_lon_nbr:long_name = "Number of elements in 2D coordinate grids. Rectangular and irregular test grids have this many total elements. The coordinates and elements are stored as 1D or 2D arrays for grid types 1D and 2D respectively."; float lev(lev); lev:purpose = "Monotonically increasing coordinate pressure"; lev:long_name = "hybrid level at midpoints (1000*(A+B))"; lev:units = "hPa"; lev:positive = "down"; lev:A_var = "hyam"; lev:B_var = "hybm"; lev:P0_var = "P0"; lev:PS_var = "PS"; lev:bounds = "lev_bnd"; lev:standard_name = "atmosphere_hybrid_sigma_pressure_coordinate"; lev:formula_terms = "a: hyam b: hybm p0: P0 ps: PS"; lev:formula_readable = "prs_mdp[time,lat,lon,lev]=P0*hyam+PS*hybm"; float ilev(ilev); ilev:purpose = "Monotonically increasing coordinate pressure"; ilev:long_name = "hybrid level at interfaces (1000*(A+B))"; ilev:units = "hPa"; ilev:positive = "down"; ilev:A_var = "hyai"; ilev:B_var = "hybi"; ilev:P0_var = "P0"; ilev:PS_var = "PS"; ilev:standard_name = "atmosphere_hybrid_sigma_pressure_coordinate"; ilev:formula_terms = "a: hyai b: hybi p0: P0 ps: PS"; ilev:formula_readable = "prs_ntf[time,lat,lon,ilev]=P0*hyai+PS*hybi"; float lev_bnd(lev,vrt_nbr); lev_bnd:purpose = "Cell boundaries for lev coordinate"; float rlev(rlev); rlev:purpose = "Monotonically decreasing coordinate pressure"; float lon(lon); lon:long_name = "Longitude (typically midpoints)"; lon:units = "degrees_east"; // 20220827: Lat and Lon dimensions break NCZarr->POSIX writes such as // ncea -O -C -v lon,three_dmn_rec_var,time,time_bnds,climatology_bounds file:///Users/zender/nco/data/h0001#mode=nczarr,file ~/out.nc // Case-insensitive matching of dimension IDs may be at play? // Eliminating Lat/Lon dimensions fixes the issue //double Lon(Lon); double Lon(lon); Lon:long_name = "Longitude"; Lon:units = "degrees"; Lon:purpose = "Longitude coordinate originally stored as -180 to 180"; Lon:notes = "Longitude = [-180.0,180.0) is not CF-compliant, yet is common"; //double LatLon(Lat,Lon); double LatLon(lat,lon); LatLon:long_name = "2D variable originally stored on -180 to 180 longitude grid"; LatLon:units = "fraction"; LatLon:purpose = "Demonstrate remapping of [-180,180) to [0,360) longitude-grid data"; //double Lat(Lat); double Lat(lat); Lat:long_name = "Latitude"; Lat:units = "degrees_north"; Lat:purpose = "Latitude paired with Longitude coordinate originally stored as -180 to 180."; double lond(lon); lond:long_name = "Longitude (typically midpoints), double precision"; lond:units = "degrees_east"; float lonf(lon); lonf:long_name = "Longitude (typically midpoints), single precision"; lonf:units = "degrees_east"; float lon_grd(lon_grd); lon_grd:long_name = "Longitude grid (typically interfaces)"; lon_grd:units = "degrees_east"; double time(time); time:long_name = "time"; time:units = "days since 1964-03-12 12:09:00 -9:00"; time:calendar = "gregorian"; time:bounds = "time_bnds"; time:climatology = "climatology_bounds"; float time_bnds(time,vrt_nbr); time_bnds:purpose = "Cell boundaries for time coordinate"; float climatology_bounds(time,vrt_nbr); climatology_bounds:purpose = "Variable containing CF-compliant climatology bounds for time dimension"; double time_rpt(time); time_rpt:long_name = "A repeating sequence to check compliance of MRO"; time_rpt:purpose = "Sequence is 1,2,3,1,2,3,1,2,3,1. Average of every third element should be the same as the element, e.g., ncra -O --mro -d time,,,3,3 ~/nco/data/in.nc ~/foo.nc;ncks -C -v time_rpt ~/foo.nc"; double lon_cal(lon_cal); lon_cal:long_name = "lon_cal"; lon_cal:units = "days since 1964-2-28"; lon_cal:calendar = "365_day"; double lat_cal(lat_cal); lat_cal:long_name = "lat_cal"; lat_cal:units = "days since 1964-2-28"; lat_cal:calendar = "360_day"; double tm_scn; tm_scn:units = "seconds since 2013-01-01"; double tm_std; tm_std:units = "days since 2013-01-01"; double tm_grg; tm_grg:units = "days since 2013-01-01"; tm_grg:calendar = "gregorian"; // Same as "standard" double tm_jln; tm_jln:units = "days since 2013-01-01"; tm_jln:calendar = "julian"; double tm_360; tm_360:units = "days since 2013-01-01"; tm_360:calendar = "360_day"; double tm_365; tm_365:units = "days since 2013-01-01"; tm_365:calendar = "365_day"; // Same as "noleap" double tm_366; tm_366:units = "days since 2013-01-01"; tm_366:calendar = "366_day"; // Same as "all_leap" float lsmlev(lsmlev); lsmlev:purpose = "Homebrew level coordinate for LSM"; lsmlev:long_name = "Soil depth"; lsmlev:units = "meter"; float wvl(wvl); wvl:long_name = "Wavelength"; wvl:units = "meter"; int od(time); double areacella(lat,lon); areacella:standard_name = "area"; areacella:long_name = "area"; areacella:units = "meter2"; areacella:purpose = "Variable to hold cell areas of 2D fields. Intended to be pointed to by cell_measures attribute of 2D fields. Would have named it plain-old area but too many regression tests already depend on 1D float area below. areacella is name used by ESGF-distributed versions of some CESM simulations anyway, e.g., baseURL: http://cmip-pcmdi.llnl.gov/CMIP5/dataLocation gridspecFile: gridspec_atmos_fx_CCSM4_amip_r0i0p0.nc areacella: areacella_fx_CCSM4_amip_r0i0p0.nc"; float area(lat); area:long_name = "area"; area:units = "meter2"; float area2(lat); area2:long_name = "area version 2"; area2:units = "meter2"; float area_asm(lat); area_asm:long_name = "area asymmetric"; area_asm:units = "meter2"; float hyam(lev); hyam:long_name = "hybrid A coefficient at layer midpoints"; float hybm(lev); hybm:long_name = "hybrid B coefficient at layer midpoints"; float hyai(ilev); hyai:long_name = "hybrid A coefficient at layer interfaces"; float hybi(ilev); hybi:long_name = "hybrid B coefficient at layer interfaces"; float P0; P0:long_name = "reference pressure"; P0:units = "pascal"; float cnv_CF_grd(lat,lon); cnv_CF_grd:long_name = "test CF grid_mapping convention"; cnv_CF_grd:grid_mapping = "albers_conical_equal_area"; cnv_CF_grd:purpose = "Test whether grid_mapping is propagated with coordinate"; char mapping; mapping:geoid = "eigen-6c4" ; mapping:grid_mapping_name = "polar_stereographic" ; mapping:latitude_of_projection_origin = -90. ; mapping:standard_parallel = -71. ; mapping:straight_vertical_longitude_from_pole = 0. ; mapping:semi_major_axis = 6378273. ; mapping:inverse_flattening = 298.27940504282 ; mapping:false_easting = 0. ; mapping:false_northing = 0. ; char albers_conical_equal_area; albers_conical_equal_area:long_name = "Albers Conical Equal Area Projection"; albers_conical_equal_area:purpose = "Test that this grid_mapping is propagated with all associated variables (like cnv_CF_grd)"; albers_conical_equal_area:grid_mapping_name = "albers_conical_equal_area"; albers_conical_equal_area:false_easting = 0.; albers_conical_equal_area:false_northing = 0.; albers_conical_equal_area:latitude_of_projection_origin = 40.; albers_conical_equal_area:longitude_of_central_meridian = -101.; albers_conical_equal_area:standard_parallel = 20., 60.; albers_conical_equal_area:longitude_of_prime_meridian = 0.; albers_conical_equal_area:semi_major_axis = 6378137.; float cnv_CF_crd(gds_crd); cnv_CF_crd:long_name = "test CF coordinates conventions"; cnv_CF_crd:coordinates = "lat_gds lon_gds "; cnv_CF_crd:reason = "Test whether coordinates attribute strings that end with a space break after nco_var_lst_crd_ass_add() call to nco_lst_prs_2d()"; float cnv_CF_ncl(time); cnv_CF_ncl:long_name = "test CF ancillary_variables convention"; cnv_CF_ncl:standard_name = "specific_humidity"; cnv_CF_ncl:ancillary_variables = "cnv_CF_ncl_var_1 cnv_CF_ncl_var_2"; cnv_CF_ncl:purpose = "Main variable that has ancillary variables named cnv_CF_ncl_var_1 and cnv_CF_ncl_var_2"; float cnv_CF_ncl_var_1(time); cnv_CF_ncl_var_1:long_name = "test CF ancillary_variables convention"; cnv_CF_ncl_var_1:standard_name = "specific_humidity standard_error"; cnv_CF_ncl_var_1:purpose = "Ancillary variable for cnv_CF_ncl. Other ancillary variable is cnv_CF_ncl_var_2."; float cnv_CF_ncl_var_2(time); cnv_CF_ncl_var_2:long_name = "test CF ancillary_variables convention"; cnv_CF_ncl_var_2:standard_name = "specific_humidity detection_limit"; cnv_CF_ncl_var_2:purpose = "Ancillary variable for cnv_CF_ncl. Other ancillary variable is cnv_CF_ncl_var_1."; float PS(time,lat,lon); PS:long_name = "surface pressure"; PS:units = "pascal"; char fl_dmn(fl_dmn); fl_dmn:long_name = "Character coordinate"; fl_dmn:units = "[chr]"; double lat_gds(gds_crd); lat_gds:long_name = "Latitude"; lat_gds:standard_name = "latitude"; lat_gds:units="degree"; lat_gds:purpose = "1-D latitude coordinate referred to by geodesic grid variables"; double lon_gds(gds_crd); lon_gds:long_name = "Longitude"; lon_gds:standard_name = "longitude"; lon_gds:units="degree"; lon_gds:purpose = "1-D longitude coordinate referred to by geodesic grid variables"; float gds_crd(gds_crd); gds_crd:long_name = "Geodesic coordinate"; gds_crd:units = "degree"; gds_crd:purpose = "enumerated coordinate like those that might define points in a geodesic grid"; gds_crd:coordinates = "lat_gds lon_gds"; float gds_var(gds_crd); gds_var:long_name = "Geodesic variable"; gds_var:units = "meter"; gds_var:purpose = "Test auxiliary coordinates like those that define geodesic grids"; gds_var:coordinates = "lat_gds lon_gds"; float gds_3dvar(time,gds_crd); gds_3dvar:long_name = "Geodesic variable"; gds_3dvar:units = "meter"; gds_3dvar:coordinates = "lat_gds lon_gds"; gds_3dvar:purpose = "Test auxiliary coordinates like those that define geodesic grids"; float gds_var_ncd(gds_ncd); gds_var_ncd:long_name = "Geodesic variable on non-coordinate grid"; gds_var_ncd:units = "meter"; gds_var_ncd:purpose = "Test auxiliary coordinates like those that define geodesic grids but where underlying dimension is a non-coordinate dimension"; gds_var_ncd:coordinates = "lat_gds_ncd lon_gds_ncd"; double lat_gds_ncd(gds_ncd); lat_gds_ncd:long_name = "Latitude"; lat_gds_ncd:standard_name = "latitude"; lat_gds_ncd:units="degree"; lat_gds_ncd:purpose = "1-D latitude coordinate referred to by \"non-coordinate\" (ncd) geodesic grid variables"; double lon_gds_ncd(gds_ncd); lon_gds_ncd:long_name = "Longitude"; lon_gds_ncd:standard_name = "longitude"; lon_gds_ncd:units="degree"; lon_gds_ncd:purpose = "1-D longitude coordinate referred to by \"non-coordinate\" (ncd) geodesic grid variables"; int nbdate; nbdate:long_name = "base date as 6- or 8-digit integer (YYMMDD or YYYYMMDD)"; int date(time); date:long_name = "current date as 6- or 8-digit integer (YYMMDD or YYYYMMDD)"; float lon_wgt(lon); lon_wgt:long_name = "Gaussian weights"; lon_wgt:purpose = "Gaussian weights which sum to two for n = 4. These weights all have floor of 0.0 so should cause SIGFPE when applied to integer types in weighted average."; float ppc_flt_2D(time,lat); ppc_flt_2D:long_name = "Precision-Preserving Compression, single precision, two dimensional array, negative values"; ppc_flt_2D:purpose = "test --ppc switches"; ppc_flt_2D:original_values="-1.0 -- -20.0"; double ppc_dbl(time); ppc_dbl:long_name = "Precision-Preserving Compression, double precision"; ppc_dbl:purpose = "test --ppc switches"; ppc_dbl:original_values="0.0,0.1,0.12,0.123,0.1234,0.12345,0.123456,0.1234567,0.12345678,0.123456789"; float ppc_flt(time); ppc_flt:long_name = "Precision-Preserving Compression, single precision"; ppc_flt:purpose = "test --ppc switches"; ppc_flt:original_values="0.0,0.1,0.12,0.123,0.1234,0.12345,0.123456,0.1234567,0.12345678,0.123456789"; double ppc_big(time); ppc_big:long_name = "Precision-Preserving Compression, big numbers"; ppc_big:purpose = "test --ppc switches"; ppc_big:original_values="123456789e-10,123456789e-9,123456789e-8,123456789e-7,123456789e-6,123456789e-5,123456789e-4,123456789e-3,123456789e-2,123456789e-1"; float ppc_btg(time); ppc_btg:long_name = "Precision-Preserving Compression, bigger numbers"; ppc_btg:purpose = "test --ppc switches"; ppc_btg:original_values="1234567890e20,1234567890e19,1234567890e18,1234567890e17,1234567890e16,1234567890e15,1234567890e14,1234567890e13,1234567890e12,1234567890e11"; float ppc_btg_scl; ppc_btg_scl:long_name = "Precision-Preserving Compression, bigger numbers, scalar"; ppc_btg_scl:purpose = "test --ppc switches"; ppc_btg_scl:original_value="1234567890e11"; double ppc_hgh(time); ppc_hgh:long_name = "Precision-Preserving Compression, high precision"; ppc_hgh:purpose = "test --ppc switches"; double ppc_hgr(time); ppc_hgr:long_name = "Precision-Preserving Compression, higher precision"; ppc_hgr:purpose = "test --ppc switches"; float ppc_tst(time); ppc_tst:long_name = "Precision-Preserving Compression, single precision tests"; ppc_tst:purpose = "test --ppq"; ppc_tst:original_values="0.0,_,0.1234567,-0.1234567,64,-64,123456789e25,123456789e-25,3.1415926535897932384626433832795029,-3.1415926535897932384626433832795029"; float ppc_dcm(time); ppc_dcm:long_name = "Precision-Preserving Compression, decimal tests"; ppc_dcm:purpose = "test --ppq"; ppc_dcm:original_values="55,155,255,355,455,555,655,755,855,955"; float qnt_flt_tst1(dgn); qnt_flt_tst1:long_name = "Quantization test, single precision"; qnt_flt_tst1:original_values="1.1111111"; double qnt_dbl_tst1(dgn); qnt_dbl_tst1:long_name = "Quantization test, double precision"; qnt_dbl_tst1:original_values="1.111111111111"; float qnt_flt_tst2(lon_grd); qnt_flt_tst2:long_name = "Quantization test, single precision"; qnt_flt_tst2:original_values="1.11111111, 1.0, 9.99999999, 12345.67, .1234567"; double qnt_dbl_tst2(lon_grd); qnt_dbl_tst2:long_name = "Quantization test, double precision"; qnt_dbl_tst2:original_values="1.1111111, 1.0, 9.999999999, 1234567890.12345, 123456789012345.0"; char md5_a; md5_a:long_name = "the letter a"; md5_a:purpose = "String with known MD5 digest"; md5_a:MD5_known_checksum = "0cc175b9c0f1b6a831c399e269772661"; char md5_abc(lev); md5_abc:long_name = "the letters abc"; md5_abc:purpose = "String with known MD5 digest"; md5_abc:MD5_known_checksum = "900150983cd24fb0d6963f7d28e17f72"; float msk_prt_mss_prt(lon); msk_prt_mss_prt:long_name = "partial mask, partial missing value example"; msk_prt_mss_prt:_FillValue = 1.0e36f; float mss_val(lon); mss_val:long_name = "partial missing value example"; mss_val:_FillValue = 1.0e36f; float mss_val_scl; mss_val_scl:long_name = "scalar missing value"; mss_val_scl:_FillValue = 1.0e36f; float mss_val_scl_sml; mss_val_scl_sml:long_name = "scalar missing value"; mss_val_scl_sml:purpose = "Unlike mss_val_scl, mss_val_scl_sml has a missing value that fits within any packed data type range"; mss_val_scl_sml:_FillValue = 1.0e4f; float mss_val_fst(lon); mss_val_fst:long_name = "offset partial missing value example"; mss_val_fst:_FillValue = -999.0f; float fll_val(lon); fll_val:long_name = "_FillValue example"; fll_val:_FillValue = -999.0f; float fll_val_mss_val(lon); fll_val_mss_val:long_name = "_FillValue example"; fll_val_mss_val:_FillValue = -999.0f; fll_val_mss_val:missing_value = -999.0f; float nan_arr(lat); nan_arr:long_name = "Intended for array representation of IEEE NaN"; nan_arr:note = "20120308 Apparently netCDF ncgen chokes on variable names of nan and NaN"; nan_arr:note2 = "20120330 netCDF ncgen on AIX/bluefire chokes on variable/attribute values of nan"; nan_arr:note3 = "20120625 netCDF ncgen on netCDF 4.1.1 on apparently chokes on variable/attribute values of nan"; nan_arr:note4 = "If your NCO build fails because your version of netCDF does not support nan, then cd to the directory that contains the file nco/data/in.cdl and run the command in note5 first and then try to build again"; nan_arr:note5 = "sed -e 's/nan;/1.0f;/' in.cdl > foo.cdl;ncgen -b -o in.nc foo.cdl"; nan_arr:note6 = "It is too troublesome to distribute in.cdl with references to NaNs because users always build with old netCDF versions that do not support it. So just comment out nan's for now."; // nan_arr:_FillValue = nan; nan_arr:_FillValue = 1.0f; float nan_scl; nan_scl:long_name = "Intended for scalar representation of IEEE NaN"; nan_scl:note = "20120308 Apparently netCDF ncgen chokes on variable names of nan and NaN"; nan_scl:note2 = "20120330 netCDF ncgen on AIX/bluefire chokes on variable/attribute values of nan"; nan_scl:note3 = "20120625 netCDF ncgen on netCDF 4.1.1 on apparently chokes on variable/attribute values of nan"; nan_scl:note6 = "It is too troublesome to distribute in.cdl with references to NaNs because users always build with old netCDF versions that do not support it. So just comment out nan's for now."; // nan_scl:_FillValue = nan; nan_scl:_FillValue = 1.0f; float nm_spc; nm_spc:long_name = "Variable name with space (invalid)"; float nm_pnd; nm_pnd:long_name = "Variable name with pound symbol (invalid)"; float no_mss_val(lon); no_mss_val:long_name = "no missing value"; float val_one_mss(lat); val_one_mss:long_name = "one regular value, one missing value"; val_one_mss:_FillValue = 1.0e36f; short rec_var_pck_scale_factor_only(time); rec_var_pck_scale_factor_only:long_name = "Array packed with scale factor only"; rec_var_pck_scale_factor_only:note = "Original packed value was 1s..10s with scale_factor = 10.0d no add_offset. Unpacked value should be 10.0 = 10.0d*1s + 0.0d through 100 = 10.0d*1s + 0.0d. Average value should be 55."; rec_var_pck_scale_factor_only:scale_factor = 10.0d; short pck; pck:long_name = "Scalar variable, double, packed as short"; pck:note = "Original packed value was 1s with scale_factor = 2.0d and add_offset = 1.0d. Unpacked value (netCDF convention) should be 3.0 = 2.0d*1s + 1.0d. Unpacked value (HDF convention) should be 0.0 = 2.0d*(1s-1.0d). NCO algorithms would pack this variable as scale_factor = 0.0d and add_offset = 3.0d."; pck:scale_factor = 2.0d; pck:add_offset = 1.0d; short pck_3; pck_3:long_name = "Scalar variable, double, packed as short"; pck_3:note = "Original packed value was 1s with scale_factor = 2.0d and add_offset = 1.0d. Unpacked value (netCDF convention) should be 3.0 = 2.0d*1s + 1.0d. Unpacked value (HDF convention) should be 0.0 = 2.0d*(1s-1.0d). NCO algorithms would pack this variable as scale_factor = 0.0d and add_offset = 3.0d."; pck_3:scale_factor = 2.0d; pck_3:add_offset = 1.0d; short pck_5; pck_5:long_name = "Scalar variable, double, packed as short"; pck_5:note = "Original packed value was 2s with scale_factor = 2.0d and add_offset = 1.0d. Unpacked value (netCDF convention) should be 5.0 = 2.0d*2s + 1.0d. Unpacked value (HDF convention) should be 2.0 = 2.0d*(2s-1.0d). NCO algorithms would pack this variable as scale_factor = 0.0d and add_offset = 5.0d."; pck_5:scale_factor = 2.0d; pck_5:add_offset = 1.0d; short pck_7; pck_7:long_name = "Scalar variable, double, packed as short"; pck_7:note = "Original packed value was 1s with scale_factor = 4.0d and add_offset = 3.0d. Unpacked value (netCDF convention) should be 7.0 = 4.0d*1s + 3.0d. Unpacked value (HDF convention) should be -8.0 = 4.0d*(1s-3.0d). NCO algorithms would pack this variable as scale_factor = 0.0d and add_offset = 7.0d."; pck_7:scale_factor = 4.0d; pck_7:add_offset = 3.0d; short pck_arr(lon); pck_arr:long_name = "Array variable, double, packed as short"; pck_arr:note = "Packed value is -32767s, 0s, 1s, 32767s, unpacked is same in double"; pck_arr:scale_factor = 1.0d; pck_arr:add_offset = 0.0d; short pck_crd(pck_crd); pck_crd:long_name = "Coordinate array variable, float, packed as short"; pck_crd:note = "Packed value is -32767s, 0s, 1s, 32767s, unpacked is factor of 10 different, offset by 73 in float"; pck_crd:scale_factor = 10.0f; pck_crd:add_offset = 73.0f; double upk; upk:long_name = "Unpacked scalar variable"; upk:note = "Unpacked value is 3.0d0, upk=unpack(pck)= 2.0d0*1s + 1.0d0 = 3.0d0. Packing this variable should create an NC_SHORT scalar = 0s with packing attribute add_offset=3.0d and either no scale_factor (ncap) or scale_factor = 0.0d (ncpdq)."; double upk_arr(lon); upk_arr:long_name = "Unpacked array"; upk_arr:note = "Unpacked value is -32767.d, 0.d, 1.d, 32767.d, packed is same in short. Packing algorithm should yield an NC_SHORT array = [] with packing attributes scale_factor=1.0d, add_offset=0.0d"; float val_eminusten; val_eminusten:long_name = "Floating point number with exponent ending in zero to test sng_trm_trl_zro()"; val_eminusten:att_eminusten = 1.1e-10f; int val_one_int; val_one_int:long_name = "scalar integer equal to 1"; val_one_int:_FillValue = -99l; int val_one_one_int(lat); val_one_one_int:long_name = "1, 1"; val_one_one_int:_FillValue = -99l; short val_max_max_sht(lat); val_max_max_sht:long_name = "17000, 17000"; val_max_max_sht:_FillValue = -99s; int val_one_mss_int(lat); val_one_mss_int:long_name = "1, mss_val"; val_one_mss_int:_FillValue = -99l; float val_half; val_half:long_name = "Scalar with value 0.5"; val_half:_FillValue = 1.0e36f; float val_half_half(lat); val_half_half:long_name = "0.5,0.5"; val_half_half:_FillValue = 1.0e36f; float wgt_one(lat); wgt_one:long_name = "all values are one"; float mss_val_all(lon); mss_val_all:long_name = "all missing values example"; mss_val_all:_FillValue = 1.0e36f; float scalar_var; scalar_var:long_name = "scalar variable"; scalar_var:units = "fraction"; scalar_var:_FillValue = 1.0e36f; float float_var; float_var:long_name = "float"; double double_var; double_var:long_name = "double"; double double_var2; double_var2:long_name = "double"; double_var2:_FillValue = 1.0e36; double pi; pi:long_name = "Pi"; pi:units = "fraction"; double pi_arr_dbl(lat,lon); pi_arr_dbl:long_name = "Pi array double precision"; pi_arr_dbl:units = "fraction"; pi_arr_dbl:original_values = "3.1415926535897932384626433832795029"; float pi_arr_flt(lat,lon); pi_arr_flt:long_name = "Pi array single precision"; pi_arr_flt:units = "fraction"; pi_arr_flt:original_values = "3.14159265"; float pi1(time); pi1:long_name = "Pi array single precision starting at pi incremented by 1.0e-6 each element"; pi1:original_values = "3.1415927, 3.1415937, 3.1415946, 3.1415956, 3.1415966, 3.1415977, 3.1415987, 3.1415997, 3.1416006, 3.1416016"; float pi2(time); pi2:long_name = "Pi array single precision starting at pi incremented by 1.0e-6 each element"; pi2:original_values = "3.1415927, 3.1415937, 3.1415946, 3.1415956, 3.1415966, 3.1415977, 3.1415987, 3.1415997, 3.1416006, 3.1416016"; float pi3(time); pi3:long_name = "Pi array single precision starting at pi incremented by 1.0e-6 each element"; pi3:original_values = "3.1415927, 3.1415937, 3.1415946, 3.1415956, 3.1415966, 3.1415977, 3.1415987, 3.1415997, 3.1416006, 3.1416016"; float pi4(time); pi4:long_name = "Pi array single precision starting at pi incremented by 1.0e-6 each element"; pi4:original_values = "3.1415927, 3.1415937, 3.1415946, 3.1415956, 3.1415966, 3.1415977, 3.1415987, 3.1415997, 3.1416006, 3.1416016"; float pi5(time); pi5:long_name = "Pi array single precision starting at pi incremented by 1.0e-6 each element"; pi5:original_values = "3.1415927, 3.1415937, 3.1415946, 3.1415956, 3.1415966, 3.1415977, 3.1415987, 3.1415997, 3.1416006, 3.1416016"; float pi6(time); pi6:long_name = "Pi array single precision starting at pi incremented by 1.0e-6 each element"; pi6:original_values = "3.1415927, 3.1415937, 3.1415946, 3.1415956, 3.1415966, 3.1415977, 3.1415987, 3.1415997, 3.1416006, 3.1416016"; float pi7(time); pi7:long_name = "Pi array single precision starting at pi incremented by 1.0e-6 each element"; pi7:original_values = "3.1415927, 3.1415937, 3.1415946, 3.1415956, 3.1415966, 3.1415977, 3.1415987, 3.1415997, 3.1416006, 3.1416016"; int int_var; int_var:long_name = "int"; // 20210406: netCDF 4.8.0 no longer supports CDL type "long" as synonym for "int" // Uncomment next line to demonstrate backwards-incompatibility of 4.8.0 //long long_var; int long_var; long_var:long_name = "long"; long_var:purpose = "Variable of CDL type=long, which is deprecated for int. Included to test back-compatibility"; long_var:notes = "This check will fail with netCDF 4.8.0 if CDL type of variable is long not int. This failure with 4.8.0 was fixed in netCDF master within a few weeks and the problem should not be present in subsequent (or prior) netCDF versions."; short short_var; short_var:long_name = "short"; char char_var; char_var:long_name = "char"; char char_var_space; char_var_space:long_name = "Character variable with whitespace on ends"; char char_var_nul; char_var_nul:long_name = "Character variable containing one NUL specified as empty string: \"\""; char char_var_nul_c_format; char_var_nul_c_format:long_name = "Character variable containing one NUL specified in C-format: \'\\0\'"; char char_var_zero; char_var_zero:long_name = "Character variable containing zero"; char char_var_1D_arr(time); char_var_1D_arr:long_name = "char-type 1D variable array"; char char_var_2D_arr(lat,lon); char_var_2D_arr:long_name = "char-type 2D variable array"; // 20131015: This confuses the XML parser. Omit it for now. // char char_var_multinul(lev); // char_var_multinul:long_name = "Character variable containing multiple NULs"; char fl_nm(char_dmn_lng80); fl_nm:long_name = "Variable contains a file name"; char fl_nm_arr(fl_dmn,char_dmn_lng80); fl_nm_arr:long_name = "Variable that contains a short array of file names"; fl_nm_arr:units = "[sng]"; char fl_nm_rec(time,char_dmn_lng80); fl_nm_rec:long_name = "A record variable of file names"; fl_nm_rec:units = "[sng]"; char date_sng(char_dmn_lng26); date_sng:long_name = "A single date string"; date_sng:units = "[sng]"; char date_rec(time,char_dmn_lng26); date_rec:long_name = "A record variable of date strings"; date_rec:units = "[sng]"; char non_nul_trm_char_one_dmn(char_dmn_lng04); non_nul_trm_char_one_dmn:long_name = "Variable contains a one-dimensional array of characters that is not NUL-terminated"; non_nul_trm_char_one_dmn:units = "[chr]"; char non_nul_trm_char_two_dmn(fl_dmn,char_dmn_lng04); non_nul_trm_char_two_dmn:long_name = "Variable contains a two-dimensional array of characters that are not NUL-terminated"; non_nul_trm_char_two_dmn:units = "[chr]"; byte byt_arr(lat,lon); byt_arr:long_name = "byte array"; byte byt_2D(lat,lon); byte byt_3D(lat,lev,lon); byte byt_3D_rec(time,lat,lon); byte byt_bln_3D_rec(time,lat,lon); byte byte_var; byte_var:long_name = "byte"; byte byte_var_neg; byte_var_neg:long_name = "negative byte"; float zero; zero:long_name = "zero"; float ppc_zro_flt(time); ppc_zro_flt:long_name = "array of single precision floating point zeros"; double ppc_zro_dbl(time); ppc_zro_dbl:long_name = "array of double precision floating point zeros"; int ppc_zro_int(time); ppc_zro_int:long_name = "array of integer zeros"; float one; one:long_name = "one"; float two; two:long_name = "two"; double e_dbl; e_dbl:long_name = "e, natural logarithm base"; float e_flt; e_flt:long_name = "e, natural logarithm base"; float three; three:long_name = "three"; float four; four:long_name = "four"; float negative_one; negative_one:long_name = "negative one"; float lev_var(lev); lev_var:long_name = "lev_var"; float lev_wgt(lev); lev_wgt:long_name = "lev_wgt"; float g; g:long_name = "g"; float grv_sfc; grv_sfc:long_name = "Surface gravity on Earth"; grv_sfc:units = "meter second-2"; float vmr_CO2; vmr_CO2:long_name = "Volumetric mixing ratio of CO2"; vmr_CO2:units = "molecule molecule-1"; float mmr_CO2; mmr_CO2:long_name = "Mass mixing ratio of CO2"; mmr_CO2:units = "kilogram kilogram-1"; float dps_dry; dps_dry:long_name = "Dry Deposition"; float dps_wet; dps_wet:long_name = "Wet Deposition"; float dps_ttl; dps_ttl:long_name = "Total Deposition"; float z(lev); z:long_name = "Height"; z:units = "meter"; z:purpose = "Height stored with a monotonically increasing coordinate"; float rz(rlev); rz:long_name = "Height"; rz:units = "meter"; rz:purpose = "Height stored with a monotonically decreasing coordinate"; float one_dmn_var(bnd); int one_dmn_int_val_one(lat); int one_dmn_int_val_two(lat); float att_var(time); att_var:byte_att = '\000','\001','\002','\177','\200','\201','\376','\377'; att_var:char_att = "Sentence one.\nSentence two.\n"; att_var:char_att2 = "Character string containing default XML separator: *|*\n"; att_var:short_att = 37s; att_var:int_att = 73; att_var:float_att = 73.0f,72.0f,71.0f,70.010f,69.0010f,68.010000f,67.01000100f; att_var:double_att = 73.0,72.0,71.0,70.010,69.0010,68.010000,67.01000100; att_var:ubyte_att = 0ub, 1ub, 2ub, 127ub, 128ub, 254ub, 255ub, 0ub; // 20130712: ncgen 4.3.0 translates this to byte att_var:ushort_att = 37us; att_var:uint_att = 73ul; // 20161110: ncgen requires "ul" for uint (a simple "u" is interpretd as uint64) att_var:int64_att = 9223372036854775807ll; // 20130712: ncgen 4.3.0--4.3.3.1 choke on ll, LL suffix for int64 attributes, and translates -l suffixed numbers to NC_UINT64. Bug reported (netCDF #HEX-795132) and fixed in snapshot 20131117 att_var:uint64_att = 18446744073709551615ull; // 20130712: ncgen 4.3.0--4.3.3.1 chokes on ull, ULL suffix for uint64 attributes. 20131120: XML treats unsigned as signed types, so toolsui produces errors when reading maximum uint64 values (though not when reading maximum ubyte, ushort, and uint values) att_var:string_att1 = "20130723: ncgen -k netCDF-4 version 4.0.x converts quoted string to NC_STRING not NC_CHAR. Incompatible with classic behavior."; att_var:string_att2 = "20130712: ncgen -k netCDF-4 version 4.2.x+ converts quoted string to NC_CHAR not NC_STRING. Backwards compatible with classic behavior."; string att_var:string_att3 = "20130723: Prefixing full attribute name with \"string\" causes CDL to produce NC_STRING."; string att_var:string_att4 = "20130723: Arrays of NC_STRING are simply separated by commas.","If there are commas within a string, well, then, be careful. Did we \"jump the shark\"?","This array comprises three elements. Each is a sentence or three long."; string att_var:string_att5 = "20131121: This NC_STRING contains NCO's default XML string separator, *. And it contains multiple sequential copies of that separator, ***. Be sure ncks automatically switches to a different separator, aka the backup separator, the string obtained by removing the two spaces from this:\"* | *\"."; int att_var_jsn; // 20210512: HDF4 ncgen fails on character attributes with whitespace att_var_jsn:char\ att\ with\ whitespace = "cf-json.org "; att_var_jsn:double\ att\ with\ whitespace = 3.14; att_var_jsn:int\ att\ with\ whitespace = 1; att_var_jsn:int_array\ att\ with\ whitespace = 1,2; // Purpose: Test special characters in names // Most special characters need backslash protection int att_var_spc_chr; att_var_spc_chr:space\ in\ name = "foo"; att_var_spc_chr:comma_in_name\, = "foo"; att_var_spc_chr:lt_in_name\< = "foo"; att_var_spc_chr:gt_in_name\> = "foo"; att_var_spc_chr:hash_in_name\# = "foo"; att_var_spc_chr:xclaim_in_name\! = "foo"; att_var_spc_chr:dollar_in_name\$ = "foo"; att_var_spc_chr:ampersand_in_name\& = "foo"; att_var_spc_chr:equals_in_name\= = "foo"; att_var_spc_chr:semicolon_in_name\; = "foo"; att_var_spc_chr:colon_in_name\: = "foo"; att_var_spc_chr:lbrace_in_name\{ = "foo"; att_var_spc_chr:rbrace_in_name\} = "foo"; att_var_spc_chr:lparen_in_name\( = "foo"; att_var_spc_chr:rparen_in_name\) = "foo"; att_var_spc_chr:lbracket_in_name\[ = "foo"; att_var_spc_chr:rbracket_in_name\] = "foo"; att_var_spc_chr:plus_in_name+ = "foo"; // : period_in_name. = "foo"; // Likely to cause DAP server error att_var_spc_chr:hyphen_in_name- = "foo"; att_var_spc_chr:at_in_name@ = "foo"; // Purpose test special chars in char atts int att_sng; att_sng:nul_sng = '\0'; att_sng:empty_sng = ""; att_sng:space_sng = " "; att_sng:zero_sng = "0"; int bnd_var(lev,bnd); bnd_var:byte_att = '\0'; bnd_var:char_att = "Sentence one.\nSentence two.\n"; bnd_var:short_att = 37s; bnd_var:int_att = 73; bnd_var:long_att = 73; bnd_var:float_att = 73.f; bnd_var:double_att = 73.d; float three_dmn_var(lat,lev,lon); three_dmn_var:long_name = "three dimensional variable with CCM coordinate convention C=[lat,lev,lon], Fortran=(lon,lev,lat)"; three_dmn_var:units = "fraction"; float three_dmn_var_crd(lev,lat,lon); three_dmn_var_crd:long_name = "three dimensional variable with COORDS coordinate convention C=[lev,lat,lon], Fortran=(lon,lat,lev)"; three_dmn_var_crd:units = "fraction"; float three_dmn_var_cf(lev,lat,lon); three_dmn_var_cf:long_name = "three dimensional variable with CF \"coordinates\" convention"; three_dmn_var_cf:coordinates = "lat lev lon"; three_dmn_var_cf:units = "fraction"; float three_dmn_var_cf2(lev,lat,lon); three_dmn_var_cf2:long_name = "three dimensional variable with CF \"coordinates\" convention for wrong coordinates"; three_dmn_var_cf2:coordinates = "x y z"; three_dmn_var_cf2:units = "fraction"; float prs_sfc(time,lat,lon); prs_sfc:long_name = "Surface pressure"; prs_sfc:units = "pascal"; float H2O; float H2OH2O; float H2SO4; float H2O_lqd; float H2O_ice; float Q; float Q1; float AQ01; float QQ01; float QA01; float Q01Q; float Q01; float Q02; float Q03; float Q04; float Q05; float Q06; float Q07; float Q08; float Q09; float Q10; float Q11; float Q12; float Q13; float Q14; float Q15; float Q16; float Q17; float Q18; float Q19; float Q20; float Q21; float Q22; float Q23; float Q24; float Q25; float Q26; float Q27; float Q28; float Q29; float Q30; float Q31; float Q32; float Q33; float Q34; float Q35; float Q36; float Q37; float Q38; float Q39; float Q40; float Q41; float Q42; float Q43; float Q44; float Q45; float Q46; float Q47; float Q48; float Q49; float Q50; float Q51; float Q52; float Q53; float Q54; float Q55; float Q56; float Q57; float Q58; float Q59; float Q60; float Q61; float Q62; float Q63; float Q64; float Q65; float Q66; float Q67; float Q68; float Q69; float Q70; float Q71; float Q72; float Q73; float Q74; float Q75; float Q76; float Q77; float Q78; float Q79; float Q80; float Q81; float Q82; float Q83; float Q84; float Q85; float Q86; float Q87; float Q88; float Q89; float Q90; float Q91; float Q92; float Q93; float Q94; float Q95; float Q96; float Q97; float Q98; float Q99; float Q100; float two_dmn_var(lat,lev); two_dmn_var:long_name = "two dimensional variable"; two_dmn_var:units = "fraction"; float var_msk(lat,lon); var_msk:long_name = "Float field for testing masks and wheres"; var_msk:units = "fraction"; float var_mss_nil(lon); var_mss_nil:purpose = "Test mismatched missing values in variables, masks, and weights. Missing no elements."; var_mss_nil:_FillValue = 1.0e36f; float var_mss_0(lon); var_mss_0:purpose = "Test mismatched missing values in variables, masks, and weights. Missing element index 0."; var_mss_0:_FillValue = 1.0e36f; float var_mss_1(lon); var_mss_1:purpose = "Test mismatched missing values in variables, masks, and weights. Missing element index 1."; var_mss_1:_FillValue = 1.0e36f; float var_mss_2(lon); var_mss_2:purpose = "Test mismatched missing values in variables, masks, and weights. Missing element index 2."; var_mss_2:_FillValue = 1.0e36f; float var_mss_3(lon); var_mss_3:purpose = "Test mismatched missing values in variables, masks, and weights. Missing element index 3."; var_mss_3:_FillValue = 1.0e36f; float mask(lat,lon); mask:long_name = "Purpose is to mask a variable like ORO"; mask:units = "fraction"; float ORO(lat,lon); ORO:long_name = "Orography, an enumerated yet continuous type: ocean=0.0, land=1.0, sea ice=2.0"; ORO:units = "fraction"; float orog(lat,lon); orog:long_name = "Orography, an enumerated yet continuous type: ocean=0.0, land=1.0, sea ice=2.0"; orog:units = "fraction"; orog:original_name = "ORO" ; orog:cell_measures = "area: areacella" ; orog:purpose = "Replicate processing of files produced by CESM and distributed on ESGF" ; float orog2(lat,lon); orog2:long_name = "Value of 1 everywhere on latxlon grid"; orog2:units = "fraction"; orog2:purpose = "debug TODO nco1138" ; float orog3(lat,lon); orog3:long_name = "Value of 0 first half, 1 second half on latxlon grid"; orog3:units = "fraction"; orog3:purpose = "debug TODO nco1138" ; float weight(lat); weight:long_name = "Gaussian weight"; weight:units = "fraction"; float gw(lat); gw:long_name = "gw variable like gw"; gw:units = "fraction"; float gw_T42(lat_T42); gw_T42:long_name = "gw variable like gw_T42"; gw_T42:units = "fraction"; float rec_var_flt(time); rec_var_flt:long_name = "record variable, float"; double rec_var_dbl(time); rec_var_dbl:long_name = "record variable, double"; int one_dmn_rec_var(time); one_dmn_rec_var:long_name = "one dimensional record variable"; one_dmn_rec_var:coordinates = "time"; one_dmn_rec_var:units = "kelvin"; double one_dmn_rec_wgt(time); one_dmn_rec_wgt:long_name = "one dimensional record variable weight"; int one_dmn_rec_var_mdn(time); one_dmn_rec_var_mdn:long_name = "one dimensional record variable to test median"; int one_dmn_rec_var_mdn__FillValue(time); one_dmn_rec_var_mdn__FillValue:long_name = "one dimensional record variable to test median with _FillValue"; one_dmn_rec_var_mdn__FillValue:_FillValue = -999; int one_dmn_rec_var_unsorted(time); one_dmn_rec_var_unsorted:long_name = "one dimensional record variable, unsorted"; float one_dmn_rec_var_flt(time); one_dmn_rec_var_flt:long_name = "one dimensional record variable, single precision"; float one_dmn_rec_var_flt_mss(time); one_dmn_rec_var_flt_mss:long_name = "one dimensional record variable, single precision, missing values"; one_dmn_rec_var_flt_mss:_FillValue = 1.0e36f; float one_dmn_rec_var_flt_scl(time); one_dmn_rec_var_flt_scl:long_name = "one dimensional record variable, single precision, scaled"; one_dmn_rec_var_flt_scl:scale_factor = 1.0f; float one_dmn_rec_var_flt_mss_scl(time); one_dmn_rec_var_flt_mss_scl:long_name = "one dimensional record variable, single precision, missing values, scaled"; one_dmn_rec_var_flt_mss_scl:scale_factor = 1.0f; one_dmn_rec_var_flt_mss_scl:_FillValue = 1.0e36f; float one_dmn_rec_var_dbl(time); one_dmn_rec_var_dbl:long_name = "one dimensional record variable, double precision"; one_dmn_rec_var_dbl:units = "second"; float one_dmn_rec_var_missing_value(time); one_dmn_rec_var_missing_value:long_name = "One dimensional record variable with missing data indicated by missing_value attribute only. No _FillValue attribute exists."; one_dmn_rec_var_missing_value:missing_value = 1.0e36f; float one_dmn_rec_var_mss_val(time); one_dmn_rec_var_mss_val:long_name = "One dimensional record variable with all missing data."; one_dmn_rec_var_mss_val:_FillValue = 1.0e36f; float one_dmn_rec_var__FillValue(time); one_dmn_rec_var__FillValue:long_name = "One dimensional record variable with missing data indicated by _FillValue attribute only. No missing_value attribute exists."; one_dmn_rec_var__FillValue:_FillValue = 1.0e36f; float one_dmn_rec_var_unsorted__FillValue(time); one_dmn_rec_var_unsorted__FillValue:long_name = "Unsorted, one dimensional record variable with missing data indicated by _FillValue attribute only. No missing_value attribute exists."; one_dmn_rec_var_unsorted__FillValue:_FillValue = 1.0e36f; float one_dmn_rec_var_mss_val_arr(time); one_dmn_rec_var_mss_val_arr:long_name = "One dimensional record variable with missing data indicated by a _FillValue attribute that is an array. This can be tested with ncrcat. 20120905: ncgen chokes on _FillValue arrays and produces this error: _FillValue: must be a single (possibly compound) value. Deprecate the array for normal use since it prevents ncgen from completing. Uncommment following line when testing for compatibility with software changes."; // one_dmn_rec_var_mss_val_arr:_FillValue = 1.0f,2.0f,3.0f; one_dmn_rec_var_mss_val_arr:_FillValue = 1.0f; int RDM(time); float tpt(time); tpt:long_name = "Temperature"; tpt:units = "kelvin"; tpt:hieght = "Leave hieght mispelled for NCO User's guide example"; double tpt_dbl(time); tpt_dbl:long_name = "Temperature stored as double precision floating point"; tpt_dbl:units = "kelvin"; float tpt_flt(time); tpt_flt:long_name = "Temperature stored as single precision floating point"; tpt_flt:units = "kelvin"; double rec_var_dbl_mss_val_dbl_upk(time); rec_var_dbl_mss_val_dbl_upk:long_name = "record variable, double, with double missing values"; rec_var_dbl_mss_val_dbl_upk:purpose = "This variable is used to generate the packed variable rec_var_dbl_mss_val_dbl_pck, so its _FillValue should not be out of range, i.e., it should be representable by a short. However, the _FillValue should itself be the same type as the unpacked variable, NC_DOUBLE in this case."; rec_var_dbl_mss_val_dbl_upk:_FillValue = -999.; rec_var_dbl_mss_val_dbl_upk:missing_value = -999.; double rec_var_dbl_mss_val_sht_upk(time); rec_var_dbl_mss_val_sht_upk:long_name = "record variable, double, with double missing values"; rec_var_dbl_mss_val_sht_upk:purpose = "This variable is used to generate the packed variable rec_var_dbl_mss_val_sht_pck, so its _FillValue should not be out of range, i.e., it should be representable by a short. However, the _FillValue should itself be the same type as the unpacked variable, NC_DOUBLE in this case."; // Using intended _FillValue type breaks ncgen (with "_FillValue type mismatch")in netCDF 4.1.1 so comment-out for simplicity // rec_var_dbl_mss_val_sht_upk:_FillValue = -999s; rec_var_dbl_mss_val_sht_upk:_FillValue = -999.0; rec_var_dbl_mss_val_sht_upk:missing_value = -999s; short rec_var_dbl_mss_val_dbl_pck(time); rec_var_dbl_mss_val_dbl_pck:long_name = "record variable, double, packed as short, with double missing values"; rec_var_dbl_mss_val_dbl_pck:purpose = "Packed version of rec_var_dbl_mss_val_dbl_upk"; // Using intended _FillValue type breaks ncgen (with "_FillValue type mismatch")in netCDF 4.1.1 so comment-out for simplicity // rec_var_dbl_mss_val_dbl_pck:_FillValue = -999.; rec_var_dbl_mss_val_dbl_pck:_FillValue = -999s; rec_var_dbl_mss_val_dbl_pck:missing_value = -999.; rec_var_dbl_mss_val_dbl_pck:scale_factor = -9.15541313801785e-05; rec_var_dbl_mss_val_dbl_pck:add_offset = 5.; short rec_var_dbl_mss_val_sht_pck(time); rec_var_dbl_mss_val_sht_pck:long_name = "record variable, double, packed as short, with short missing values"; rec_var_dbl_mss_val_sht_pck:purpose = "Packed version of rec_var_dbl_mss_val_sht_upk"; rec_var_dbl_mss_val_sht_pck:_FillValue = -999s; rec_var_dbl_mss_val_sht_pck:missing_value = -999s; rec_var_dbl_mss_val_sht_pck:scale_factor = -9.15541313801785e-05; rec_var_dbl_mss_val_sht_pck:add_offset = 5.; short scl_dbl_pck; scl_dbl_pck:long_name = "scalar variable, double, packed"; scl_dbl_pck:purpose = "Packed version of number with ncdiff subtraction bug"; scl_dbl_pck:scale_factor = -9.15541313801785e-05; scl_dbl_pck:add_offset = 5.; float rec_var_flt_mss_val_flt(time); rec_var_flt_mss_val_flt:long_name = "record variable, float, with float missing values"; rec_var_flt_mss_val_flt:_FillValue = 1.0e36f; float rec_var_flt_mss_val_flt_all(time); rec_var_flt_mss_val_flt_all:long_name = "record variable, float, with float missing values in every position"; rec_var_flt_mss_val_flt_all:_FillValue = 1.0e36f; float rec_var_flt_mss_val_flt_all_but_one(time); rec_var_flt_mss_val_flt_all_but_one:long_name = "record variable, float, with float missing values in every position but one"; rec_var_flt_mss_val_flt_all_but_one:_FillValue = 1.0e36f; float rec_var_flt_mss_val_flt_all_but_two(time); rec_var_flt_mss_val_flt_all_but_two:long_name = "record variable, float, with float missing values in every position but two"; rec_var_flt_mss_val_flt_all_but_two:_FillValue = 1.0e36f; short rec_var_flt_pck(time); rec_var_flt_pck:long_name = "record variable, float, packed into short"; rec_var_flt_pck:purpose = "Demonstrate that rounding of means of packed data are handled correctly"; rec_var_flt_pck:scale_factor = 0.1f; rec_var_flt_pck:add_offset = 100.0f; short rec_var_dbl_pck(time); rec_var_dbl_pck:long_name = "record variable, double, packed into short"; rec_var_dbl_pck:purpose = "Demonstrate that rounding of means of packed data are handled correctly"; rec_var_dbl_pck:scale_factor = 0.1; rec_var_dbl_pck:add_offset = 100.0; short non_rec_var_flt_pck(lon); non_rec_var_flt_pck:long_name = "regular variable, float, packed into short"; non_rec_var_flt_pck:purpose = "Demonstrate that non-rec dim packed vars are handled correctly"; non_rec_var_flt_pck:scale_factor = 0.1f; non_rec_var_flt_pck:add_offset = 100.0f; float rec_var_flt_mss_val_dbl(time); rec_var_flt_mss_val_dbl:long_name = "record variable, float, with double missing values"; rec_var_flt_mss_val_dbl:_FillValue = 1.0e36f; rec_var_flt_mss_val_dbl:missing_value = 1.0e36f; rec_var_flt_mss_val_dbl:note = "The correct average of this variable is 5.0. The correct sum of this variable is 35."; float rec_var_flt_mss_val_int(time); rec_var_flt_mss_val_int:long_name = "record variable, float, with integer missing values"; // Using intended _FillValue type breaks ncgen (with "_FillValue type mismatch")in netCDF 4.1.1 so comment-out for simplicity // rec_var_flt_mss_val_int:_FillValue = -999; rec_var_flt_mss_val_int:_FillValue = -999.0f; rec_var_flt_mss_val_int:missing_value = -999; int rec_var_int_mss_val_int(time); rec_var_int_mss_val_int:long_name = "record variable, integer, with integer missing values"; rec_var_int_mss_val_int:_FillValue = -999; int rec_var_int_mss_val_flt(time); rec_var_int_mss_val_flt:long_name = "record variable, integer, with float missing values"; // Using intended _FillValue type breaks ncgen (with "_FillValue type mismatch")in netCDF 4.1.1 so comment-out for simplicity // rec_var_int_mss_val_flt:_FillValue = -999.0f; rec_var_int_mss_val_flt:_FillValue = -999; rec_var_int_mss_val_flt:missing_value = -999.0f; int rec_var_int_mss_val_dbl(time); rec_var_int_mss_val_dbl:long_name = "record variable, integer, with double missing values"; // Using intended _FillValue type breaks ncgen (with "_FillValue type mismatch")in netCDF 4.1.1 so comment-out for simplicity // rec_var_int_mss_val_dbl:_FillValue = -999.0; rec_var_int_mss_val_dbl:_FillValue = -999; rec_var_int_mss_val_dbl:missing_value = -999.0; int rec_var_dbl_mss_val_dbl_pck_lng(time); rec_var_dbl_mss_val_dbl_pck_lng:long_name = "record variable, double packed as long, with double missing values"; rec_var_dbl_mss_val_dbl_pck_lng:purpose = "although not usual, packing doubles into longs (rather than shorts) offers considerable space savings"; // Using intended _FillValue type breaks ncgen (with "_FillValue type mismatch")in netCDF 4.1.1 so comment-out for simplicity // rec_var_dbl_mss_val_dbl_pck_lng:_FillValue = -999.0; rec_var_dbl_mss_val_dbl_pck_lng:_FillValue = -999; rec_var_dbl_mss_val_dbl_pck_lng:missing_value = -999.0; rec_var_dbl_mss_val_dbl_pck_lng:scale_factor = -9.15541313801785e-05; rec_var_dbl_mss_val_dbl_pck_lng:add_offset = 5.; short rec_var_dbl_mss_val_sht_pck_sht(time); rec_var_dbl_mss_val_sht_pck_sht:long_name = "record variable, double packed as short, with short missing values"; rec_var_dbl_mss_val_sht_pck_sht:_FillValue = -999s; rec_var_dbl_mss_val_sht_pck_sht:scale_factor = -9.15541313801785e-05; rec_var_dbl_mss_val_sht_pck_sht:add_offset = 5.; float rec_var_flt_mss_val_flt_pck_flt(time); rec_var_flt_mss_val_flt_pck_flt:long_name = "record variable, float packed as float, with float missing values"; rec_var_flt_mss_val_flt_pck_flt:purpose = "CESM POP2 ocean model packs SALT, WVEL etc this way"; rec_var_flt_mss_val_flt_pck_flt:_FillValue = -9.96921e+33; rec_var_flt_mss_val_flt_pck_flt:scale_factor = 1000.0; float SALT(time); SALT:long_name = "record variable, float packed as float, with float missing values"; SALT:purpose = "CESM POP2 ocean model packs SALT, WVEL etc this way"; SALT:_FillValue = -9.96921e+33; SALT:scale_factor = 1000.0; char one_dmn_rec_var_sng(time); one_dmn_rec_var_sng:long_name = "one dimensional record variable of string"; one_dmn_rec_var_sng:NB = "20131222: HDF4 ncgen fails on this variable: /usr/bin/hncgen -b -o ~/in.hdf ~/nco/data/in.cdl produces error message that \"string won't fit in this variable\""; float time_lon(time,lon); time_lon:long_name = "Record variable of longitude coordinate"; char two_dmn_rec_var_sng(time,lev); two_dmn_rec_var_sng:long_name = "two dimensional record variable of string"; float two_dmn_rec_var(time,lev); two_dmn_rec_var:long_name = "two dimensional record variable"; two_dmn_rec_var:units = "watt meter-2"; double three_dmn_var_dbl(time,lat,lon); three_dmn_var_dbl:long_name = "three dimensional record variable of type double"; three_dmn_var_dbl:units = "watt meter-2"; three_dmn_var_dbl:_FillValue = -99.; float zg(time,lev,lon); zg:long_name = "three dimensional record variable to demonstrate hyperslab bug"; zg:units = "watt meter-2"; zg:_FillValue = -99.; float three_dmn_rec_var(time,lat,lon); three_dmn_rec_var:long_name = "three dimensional record variable"; three_dmn_rec_var:units = "watt meter-2"; three_dmn_rec_var:_FillValue = -99.; short three_dmn_rec_var_pck(time,lat,lon); three_dmn_rec_var_pck:long_name = "three dimensional record variable"; three_dmn_rec_var_pck:purpose = "should unpack into identical values with three_dmn_rec_var (i.e., 1..80)"; three_dmn_rec_var_pck:units = "watt meter-2"; three_dmn_rec_var_pck:_FillValue = -99.; three_dmn_rec_var_pck:add_offset = 40.5f ; three_dmn_rec_var_pck:scale_factor = -0.001205518f ; int three_dmn_var_int(time,lat,lon); three_dmn_var_int:long_name = "three dimensional record variable of type int"; three_dmn_var_int:units = "watt meter-2"; three_dmn_var_int:_FillValue = -99; short three_dmn_var_sht(time,lat,lon); three_dmn_var_sht:long_name = "three dimensional record variable"; three_dmn_var_sht:units = "watt meter-2"; three_dmn_var_sht:_FillValue = -99s; int th(time,lat,lon); th:long_name = "three dimensional record variable"; th:units = "watt meter-2"; th:_FillValue = -99; float td(time,dgn); td:long_name = "two dimensional record variable stored in td (time,dgn) order (dgn means degenerate, i.e., of size 1)"; float tx(time,lon); tx:long_name = "two dimensional record variable stored in tx (time,lon) order"; float ty(time,lat); ty:long_name = "two dimensional record variable stored in ty (time,lat) order"; float tz(time,lev); tz:long_name = "two dimensional record variable stored in tz (time,lev) order"; float txyz(time,lon,lat,lev); txyz:long_name = "four dimensional record variable stored in txyz (time,lon,lat,lev) order"; float xyz(lon,lat,lev); xyz:long_name = "three dimensional variable stored in xyz (lon,lat,lev) order"; float tyz(time,lat,lev); tyz:long_name = "three dimensional record variable stored in tyz (time,lat,lev) order"; float four_dmn_rec_var(time,lat,lev,lon); four_dmn_rec_var:long_name = "four dimensional record variable"; four_dmn_rec_var:units = "watt meter-2"; four_dmn_rec_var:coordinates = "time lat lev lon"; // double three_double_dmn(time,lon,lon); double time_udunits(time_udunits); time_udunits:units = "hours since 1900-01-01 00:00:0.0"; time_udunits:delta_t = "0000-00-00 06:00:0.0"; time_udunits:purpose = "The dates specified in this variable are ~1999-12-08"; int time_int_udunits(time_int_udunits); time_int_udunits:units = "seconds since 2019-03-12 00:00:00 UTC"; time_int_udunits:purpose = "time coordinate with integer values to test rebasing"; float u(time); u:long_name = "Zonal wind speed"; u:units = "meter second-1"; float v(time); v:long_name = "Meridional wind speed"; v:units = "meter second-1"; float var_1D_rct(lat_times_lon); var_1D_rct:long_name = "Variable for 2D rectangular grid stored as 1D arrays"; float var_1D_rrg(lat_times_lon); var_1D_rrg:long_name = "Variable for 2D irregular grid stored as 1D arrays"; float var_2D_rct(lat,lon); var_2D_rct:long_name = "Variable for 2D rectangular grid stored as 2D array"; float var_2D_rrg(lat,lon); var_2D_rrg:long_name = "Variable for 2D irregular grid stored as 2D array"; float var_nm-dash; var_nm-dash:long_name = "Variable and attribute names include dash characters"; var_nm-dash:att_nm-dash = 1.0e36f; float vld_rng(time); vld_rng:long_name = "Temperature"; vld_rng:purpose = "Array containing _FillValue at some locations, out-of-range values at other locations, and valid data in the remainder"; vld_rng:_FillValue = -999.0f; vld_rng:valid_min = 180.f; vld_rng:valid_max = 360.f; // float var_nm.dot; // var_nm.dot:long_name = "Variable and attribute names include dot characters"; // 20070102: Periods in attribute names choke OPeNDAP from FC7 RPM TODO nco911 // 20091105: Periods in attribute names choke ncgen from RHEL5 TODO nco911 // var_nm.dot:att_nm.dot = 1.0e36f; float wnd_spd(time,lat,lon); wnd_spd:long_name = "wind speed"; wnd_spd:units = "meter second-1"; wnd_spd:_FillValue = -999.0f; data: // netCDF4-specific atomic types: int64_var_max=9223372036854775807; int64_var=73; string_var="If you prick us, do we not bleed? If you tickle us, do we not laugh? If you poison us, do we not die? And if you wrong us, shall we not revenge?"; string_arr_var="20130723: Arrays of NC_STRING are simply separated by commas.","If there are commas within a string, well, then, be careful. Did we \"jump the shark\"?","This array comprises three sentences.","Woops, I mean four."; string_greek="alpha","beta","gamma","delta","epsilon","zeta","theta","iota"; string_var2="20131121: This NC_STRING contains NCO's default XML string separator, *. And it contains multiple sequential copies of that separator, ***. Be sure ncks automatically switches to a different separator, aka the backup separator, the string obtained by removing the two spaces from this:\"* | *\". As of 20131121, ncks handles this correctly, yet toolsui breaks when trying to input the ncks-generated NcML. Appears to be a toolsui bug."; ubyte_var='z'; uint_var_max=4294967295; uint_var=73; // uint64_var = 18446744073709551615; // 20131120: XML treats unsigned as signed types, so toolsui produces errors when reading maximum uint64 values (though not when reading maxium ubyte, ushort, and uint values) uint64_var=0; ushort_var=65535; // None in this file // netCDF3 atomic types: att_var=10.0,10.1,10.20,10.3000,10.40101,10.500001,10.60000001,10.7000001,10.80,10.9900; att_var_jsn=73; att_var_spc_chr=73; att_sng=20; area=10.,10.; area2=20.,5.; area_asm=1.,2.; areacella=1.,1.,2.,2.,3.,3.,4.,4.; bnd_var=1,2,3,4,5,6; byt_arr=0,1,2,3,4,5,6,7; byt_2D=0,1,2,3,4,5,6,7; byt_3D=0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23; byt_3D_rec= 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16, 17,18,19,20,21,22,23,24, 25,26,27,28,29,30,31,32, 33,34,35,36,37,38,39,40, 41,42,43,44,45,46,47,48, 49,50,51,52,53,54,55,56, 57,58,59,60,61,62,63,64, 65,66,67,68,69,70,71,72, 73,74,75,76,77,78,79,80; byt_bln_3D_rec= 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,1, 0,0,0,0,0,0,1,1, 0,0,0,0,0,1,1,1, 0,0,0,0,1,1,1,1, 0,0,0,1,1,1,1,1, 0,0,1,1,1,1,1,1, 0,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,0,1,0,1,0,1,0; byte_var='z'; byte_var_neg=-122; char_var="z"; // 20131015: This confuses the XML parser // char_var_multinul="\b\n\0"; // char_var_multinul='0','\n','\0'; // 20180111: Historically we specified char_var_nul as '\0' // However, ncgen apparently turns '\0' into a zero // "correct" (meaning ncgen-supported) way to specify a scalar NUL character is with "" // As of today we specify char_var_nul as "" and char_var_nul_c_format as '\0' // char_var_nul_c_format indicates what happens when specifying characters in C-format // I think ncgen should support C-format byte codes for characters, though ncgen does not yet do so correctly char_var_nul=""; char_var_nul_c_format='\0'; char_var_zero="0"; char_var_space=" "; char_var_1D_arr="two words"; char_var_2D_arr="one","two"; cnv_CF_grd=1,2,3,4,5,6,7,8; albers_conical_equal_area=""; cnv_CF_crd=273.1,273.2,273.3,273.4,273.5,273.6,273.7,273.8; cnv_CF_ncl=1.,2.,3.,4.,5.,6.,7.,8.,9.,10.; cnv_CF_ncl_var_1=11.,22.,23.,24.,25.,26.,27.,28.,29.,30.; cnv_CF_ncl_var_2=21.,32.,33.,34.,35.,36.,37.,38.,39.,40.; date_int=1964,3,12,12,9; dgn=73; dgn_var=73; double_var=10.; double_var2=10.; dps_dry=73; dps_wet=73; dps_ttl=73; e_dbl=2.71828182846; e_flt=2.71828182846; // 20100809: Single quotes around NC_CHAR coordinates required as of 4.1.2-beta1-snapshot2010080820 // 20100809: Double quotes cause "String constant too long" error in ncgen fl_dmn='a','b','3'; fl_nm="/home/zender/nco/data/in.cdl"; float_var=10.; four=4.; g=9.8; grv_sfc=9.80665; vmr_CO2=400e-6; mmr_CO2=611e-6; gw=10.,10.; gw_T42=-87.863799,-85.096527,-82.312913,-79.525607,-76.736900,-73.947515,-71.157752,-68.367756,-65.577607,-62.787352,-59.997020,-57.206632,-54.416200,-51.625734,-48.835241,-46.044727,-43.254195,-40.463648,-37.673090,-34.882521,-32.091944,-29.301360,-26.510769,-23.720174,-20.929574,-18.138971,-15.348365,-12.557756,-9.767146,-6.976534,-4.185921,-1.395307,1.395307,4.185921,6.976534,9.767146,12.557756,15.348365,18.138971,20.929574,23.720174,26.510769,29.301360,32.091944,34.882521,37.673090,40.463648,43.254195,46.044727,48.835241,51.625734,54.416200,57.206632,59.997020,62.787352,65.577607,68.367756,71.157752,73.947515,76.736900,79.525607,82.312913,85.096527,87.863799; hyam=0.0036,0.0019894,0.0; hyai=0.002255,0.0438226,0.0,0.0; hybm=0.0,0.52,0.992; hybi=0.0,0.457453,0.985,1.0; P0=100000; gds_crd=0,1,2,3,4,5,6,7; gds_var=273.1,273.2,273.3,273.4,273.5,273.6,273.7,273.8; gds_var_ncd=273.1,273.2,273.3,273.4,273.5,273.6,273.7,273.8; gds_3dvar=273.1,273.2,273.3,273.4,273.5,273.6,273.7,273.8, 274.1,274.2,274.3,274.4,274.5,274.6,274.7,274.8, 275.1,275.2,275.3,275.4,275.5,274.5,275.7,275.8, 276.1,276.2,276.3,276.4,276.5,276.5,276.7,276.8, 277.1,277.2,277.3,277.4,277.5,277.5,277.7,277.8, 278.1,278.2,278.3,278.4,278.5,278.6,278.7,278.8, 279.1,279.2,279.3,279.4,279.5,279.9,279.7,279.8, 280.1,280.2,280.3,280.4,280.5,280.9,280.7,280.8, 281.1,281.2,281.3,281.4,281.5,281.9,281.7,281.8, 282.1,282.2,282.3,282.4,282.5,282.9,282.7,282.8; lat_gds=-90, -30, -30, 0, 0, 30, 30, 90; lon_gds= 0, 0, 180, 0, 180, 0, 180, 0; lat_gds_ncd=-90, -30, -30, 0, 0, 30, 30, 90; lon_gds_ncd= 0, 0, 180, 0, 180, 0, 180, 0; lat=-90,90; lat_bnd=-90,0,0,90; lat_cal=1.,2.,3.,4.,5.,6.,7.,8.,9.,10.; lon_cal=1.,2.,3.,4.,5.,6.,7.,8.,9.,10.; lat_times_lon=0,1,2,3,4,5,6,7; lat_times_lon_nbr=8; lat_1D_rct=-90, -90, -90, -90, 90, 90, 90, 90; lon_1D_rct= 0, 90, 180, 270, 0, 90, 180, 270; lat_1D_rrg=-90, -30, -30, 0, 0, 30, 30, 90; lon_1D_rrg= 0, 0, 180, 0, 180, 0, 180, 0; lat_2D_rct=-90, -90, -90, -90, 90, 90, 90, 90; lon_2D_rct= 0, 90, 180, 270, 0, 90, 180, 270; lat_2D_rrg=-90, -30, -30, 0, 0, 30, 30, 90; lon_2D_rrg= 0, 0, 180, 0, 180, 0, 180, 0; lat_grd=-90,0,90; lat_cpy=-90,90; lat_var=1.,2.; lat_wgt=1.,2.; // lat_T42=0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63; lat_T42=-88.240089,-85.092445,-82.311981,-79.525253,-76.736732,-73.947418,-71.157700,-68.367722,-65.577576,-62.787331,-59.997005,-57.206619,-54.416191,-51.625729,-48.835236,-46.044724,-43.254192,-40.463646,-37.673088,-34.882519,-32.091942,-29.301357,-26.510769,-23.720173,-20.929573,-18.138969,-15.348364,-12.557755,-9.767145,-6.976533,-4.185921,-1.395307,1.395307,4.185921,6.976533,9.767145,12.557755,15.348364,18.138969,20.929573,23.720173,26.510769,29.301357,32.091942,34.882519,37.673088,40.463646,43.254192,46.044724,48.835236,51.625729,54.416191,57.206619,59.997005,62.787331,65.577576,68.367722,71.157700,73.947418,76.736732,79.525253,82.311981,85.092445,88.240089; lsmlev=0.05,0.1,0.2,0.5,1.0,3.0; lev=100,500,1000; ilev=50,200,750,1005; lev_bnd=0,300,300,750,750,1013.25; lev_cpy=100,500,1000; lev_var=100.,500.,1000.; lev_wgt=10,2,1; lon=0,90,180,270; Lon=-180,-90,0,90; Lat=-45,45; LatLon=0,1,2,3,4,5,6,7; lond=0,90,180,270; lonf=0,90,180,270; lon_grd=-45,45,135,225,315; lon_wgt=0.347855,0.652145,0.652145,0.347855; // lon_T42=0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127; lon_T42=0.000000,2.812500,5.625000,8.437500,11.250000,14.062500,16.875000,19.687500,22.500000,25.312500,28.125000,30.937500,33.750000,36.562500,39.375000,42.187500,45.000000,47.812500,50.625000,53.437500,56.250000,59.062500,61.875000,64.687500,67.500000,70.312500,73.125000,75.937500,78.750000,81.562500,84.375000,87.187500,90.000000,92.812500,95.625000,98.437500,101.250000,104.062500,106.875000,109.687500,112.500000,115.312500,118.125000,120.937500,123.750000,126.562500,129.375000,132.187500,135.000000,137.812500,140.625000,143.437500,146.250000,149.062500,151.875000,154.687500,157.500000,160.312500,163.125000,165.937500,168.750000,171.562500,174.375000,177.187500,180.000000,182.812500,185.625000,188.437500,191.250000,194.062500,196.875000,199.687500,202.500000,205.312500,208.125000,210.937500,213.750000,216.562500,219.375000,222.187500,225.000000,227.812500,230.625000,233.437500,236.250000,239.062500,241.875000,244.687500,247.500000,250.312500,253.125000,255.937500,258.750000,261.562500,264.375000,267.187500,270.000000,272.812500,275.625000,278.437500,281.250000,284.062500,286.875000,289.687500,292.500000,295.312500,298.125000,300.937500,303.750000,306.562500,309.375000,312.187500,315.000000,317.812500,320.625000,323.437500,326.250000,329.062500,331.875000,334.687500,337.500000,340.312500,343.125000,345.937500,348.750000,351.562500,354.375000,357.187500; ppc_flt_2D= -1,-2,-3,-4,-5,-6,-7,-8,-9,-10, -11,-12,-13,-14,-15,-16,-17,-18,-19,-20; ppc_dbl=0.0,0.1,0.12,0.123,0.1234,0.12345,0.123456,0.1234567,0.12345678,0.123456789; ppc_flt=0.0,0.1,0.12,0.123,0.1234,0.12345,0.123456,0.1234567,0.12345678,0.123456789; ppc_big=123456789e-10,123456789e-9,123456789e-8,123456789e-7,123456789e-6,123456789e-5,123456789e-4,123456789e-3,123456789e-2,123456789e-1; ppc_btg=1234567890e20,1234567890e19,1234567890e18,1234567890e17,1234567890e16,1234567890e15,1234567890e14,1234567890e13,1234567890e12,1234567890e11; ppc_btg_scl=1234567890e11; ppc_hgh=0.00000000000000000000,0.10000000000000000000,0.12000000000000000000,0.123000000000000000000,0.1234000000000000000,0.12345000000000000000,0.123456000000000000000000,0.12345670000000000000000000,0.123456780000000000000,0.123456789000000000000; // 20220731 NCZarr I/O chokes here, apparently ncgen parses 15+ digit mantissas as integers? 20220819 that problem was fixed sometime before today, extended decimals now work fine ppc_hgr=0.123456789000000000000,0.1234567890100000000000,0.1234567890120000000000,0.12345678901230000000000,0.123456789012340000000,0.12345678901234500000,0.12345678901234560000,0.12345678901234567000,0.12345678901234567800,0.12345678901234567890; ppc_dcm=55,155,255,355,455,555,655,755,855,955; ppc_tst=0.0,_,0.1234567,-0.1234567,64,-64,123456789e25,123456789e-25,3.1415926535897932384626433832795029,-3.1415926535897932384626433832795029; ppc_zro_flt=0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0; ppc_zro_dbl=0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0; ppc_zro_int=0,0,0,0,0,0,0,0,0,0; qnt_flt_tst1=1.1111111; qnt_dbl_tst1=1.111111111111; qnt_flt_tst2=1.11111111, 1.0, 9.99999999, 12345.67, .1234567; // 20220731 NCZarr I/O chokes here, apparently ncgen parses 15+ digit mantissas as integers? 20220819 that problem was fixed sometime before today, extended decimals now work fine qnt_dbl_tst2=1.1111111, 1.0, 9.999999999, 1234567890.12345, 123456789012345.0; var_msk=0.,1.,0.,0.,1.,1.,0.,2.; var_mss_nil=0.,1.,2.,3.; var_mss_0=_,1.,2.,3.; var_mss_1=0.,_,2.,3.; var_mss_2=0.,1.,_,3.; var_mss_3=0.,1.,2.,_; ORO=0.,1.,0.,0.,1.,1.,0.,2.; orog=0.,1.,0.,0.,1.,1.,0.,2.; orog2=1.,1.,1.,1.,1.,1.,1.,1.; orog3=0.,0.,0.,0.,1.,1.,1.,1.; mask=0.,1.,0.,0.,1.,1.,0.,1.; // mask=0.,0.,0.,0.,0.,0.,0.,0.; // mask=1.,1.,1.,1.,1.,1.,1.,1.; fll_val=73,-999,73,-999; fll_val_mss_val=73,-999,73,-999; md5_a="a"; md5_abc="abc"; msk_prt_mss_prt=0.5,1.0e36,1.5,1.0e36; mss_val=73,1.0e36,73,1.0e36; mss_val_all=1.0e36,1.0e36,1.0e36,1.0e36; mss_val_fst=-999,73,-999,73; mss_val_scl=1.0e36; mss_val_scl_sml=1.0e4; //nan_arr=0,nan; nan_arr=0,73; //nan_scl=nan; nan_scl=1; negative_one=-1.; nm_pnd=1; nm_spc=1; no_mss_val=73,1.0e36,73,1.0e36; non_nul_trm_char_one_dmn='a','b'; non_nul_trm_char_two_dmn="abcd","efgh","ijkm"; one=1.; one_dmn_rec_var=1,2,3,4,5,6,7,8,9,10; one_dmn_rec_wgt=2,1,0,0,0,0,0,0,0,0; one_dmn_rec_var_unsorted=10,4,6,2,8,1,9,7,3,5; one_dmn_rec_var_flt=1,2,3,4,5,6,7,8,9,10; one_dmn_rec_var_flt_mss=_,2,3,4,5,6,7,8,9,_; one_dmn_rec_var_flt_scl=1,2,3,4,5,6,7,8,9,10; // First use of underscore to indicate _FillValue in in.cdl is here in one_dmn_rec_var_flt_mss_scl on 20140916 one_dmn_rec_var_flt_mss_scl=_,2,3,4,5,6,7,8,9,_; one_dmn_rec_var_dbl=1,2,3,4,5,6,7,8,9,10; one_dmn_rec_var_missing_value=1,2,3,4,5,6,7,8,9,1.0e36; one_dmn_rec_var_mss_val=1.0e36,1.0e36,1.0e36,1.0e36,1.0e36,1.0e36,1.0e36,1.0e36,1.0e36,1.0e36; one_dmn_rec_var_mss_val_arr=1,2,3,4,5,6,7,8,9,10; one_dmn_rec_var__FillValue=1,2,3,4,5,6,7,8,9,1.0e36; one_dmn_rec_var_unsorted__FillValue=1.0e36,4,6,2,8,1,9,7,3,5; one_dmn_rec_var_mdn=1,1,2,2,2,2,10,10,10,10; one_dmn_rec_var_mdn__FillValue=1,-999,2,2,-999,-999,10,10,10,-999; RDM=1,9,36,84,126,126,84,36,9,1; one_dmn_rec_var_sng="Hello Worl"; one_dmn_var=1.,10.; one_dmn_int_val_one=1,1; one_dmn_int_val_two=2,2; pck=1; pck_3=1; pck_5=2; pck_7=1; rec_var_pck_scale_factor_only=1,2,3,4,5,6,7,8,9,10; pck_arr=-32767,0,1,32767; pck_crd=-32767,0,1,32767; pi=3.1415926535897932384626433832795029; pi1=3.1415927,3.1415937,3.1415946,3.1415956,3.1415966,3.1415977,3.1415987,3.1415997,3.1416006,3.1416016; pi2=3.1415927,3.1415937,3.1415946,3.1415956,3.1415966,3.1415977,3.1415987,3.1415997,3.1416006,3.1416016; pi3=3.1415927,3.1415937,3.1415946,3.1415956,3.1415966,3.1415977,3.1415987,3.1415997,3.1416006,3.1416016; pi4=3.1415927,3.1415937,3.1415946,3.1415956,3.1415966,3.1415977,3.1415987,3.1415997,3.1416006,3.1416016; pi5=3.1415927,3.1415937,3.1415946,3.1415956,3.1415966,3.1415977,3.1415987,3.1415997,3.1416006,3.1416016; pi6=3.1415927,3.1415937,3.1415946,3.1415956,3.1415966,3.1415977,3.1415987,3.1415997,3.1416006,3.1416016; pi7=3.1415927,3.1415937,3.1415946,3.1415956,3.1415966,3.1415977,3.1415987,3.1415997,3.1416006,3.1416016; pi_arr_dbl=3.1415926535897932384626433832795029,3.1415926535897932384626433832795029,3.1415926535897932384626433832795029,3.1415926535897932384626433832795029,3.1415926535897932384626433832795029,3.1415926535897932384626433832795029,3.1415926535897932384626433832795029,3.1415926535897932384626433832795029; pi_arr_flt=3.1415926535897932384626433832795029,3.1415926535897932384626433832795029,3.1415926535897932384626433832795029,3.1415926535897932384626433832795029,3.1415926535897932384626433832795029,3.1415926535897932384626433832795029,3.1415926535897932384626433832795029,3.1415926535897932384626433832795029; upk=3.; upk_arr=-32767.,0.,1.,32767.; H2O=1.0; H2OH2O=1.0; H2SO4=1.0; H2O_lqd=1.0; H2O_ice=1.0; Q=1.0e36; Q1=1.0e36; AQ01=1.0e36; QQ01=1.0e36; QA01=1.0e36; Q01Q=1.0e36; Q01=1; Q02=2; Q03=3; Q04=4; Q05=5; Q06=6; Q07=7; Q08=8; Q09=9; Q10=10; Q11=11; Q12=12; Q13=13; Q14=14; Q15=15; Q16=16; Q17=17; Q18=18; Q19=19; Q20=20; Q21=21; Q22=22; Q23=23; Q24=24; Q25=25; Q26=26; Q27=27; Q28=28; Q29=29; Q30=30; Q31=31; Q32=32; Q33=33; Q34=34; Q35=35; Q36=36; Q37=37; Q38=38; Q39=39; Q40=40; Q41=41; Q42=42; Q43=43; Q44=44; Q45=45; Q46=46; Q47=47; Q48=48; Q49=49; Q50=50; Q51=51; Q52=52; Q53=53; Q54=54; Q55=55; Q56=56; Q57=57; Q58=58; Q59=59; Q60=60; Q61=61; Q62=62; Q63=63; Q64=64; Q65=65; Q66=66; Q67=67; Q68=68; Q69=69; Q70=70; Q71=71; Q72=72; Q73=73; Q74=74; Q75=75; Q76=76; Q77=77; Q78=78; Q79=79; Q80=80; Q81=81; Q82=82; Q83=83; Q84=84; Q85=85; Q86=86; Q87=87; Q88=88; Q89=89; Q90=90; Q91=91; Q92=92; Q93=93; Q94=94; Q95=95; Q96=96; Q97=97; Q98=98; Q99=99; Q100=100; non_rec_var_flt_pck=1,2,3,4; rec_var_dbl=1.,2.,3.,4.,5.,6.,7.,8.,9.,10.; rec_var_dbl_mss_val_dbl_pck=-999,32767,21845,10922,0,-10922,-21845,-32767,-999,-999; rec_var_dbl_mss_val_dbl_pck_lng=-999,32767,21845,10922,0,-10922,-21845,-32767,-999,-999; rec_var_dbl_mss_val_sht_pck_sht=-999,32767,21845,10922,0,-10922,-21845,-32767,-999,-999; rec_var_flt_mss_val_flt_pck_flt=-9.96921e+33,0.032,0.033,0.034,0.035,0.036,0.037,0.038,-9.96921e+33,-9.96921e+33; SALT=-9.96921e+33,0.032,0.033,0.034,0.035,0.036,0.037,0.038,-9.96921e+33,-9.96921e+33; rec_var_dbl_mss_val_dbl_upk=-999.,2.,3.,4.,5.,6.,7.,8.,-999.,-999.; rec_var_dbl_mss_val_sht_pck=-999,32767,21845,10922,0,-10922,-21845,-32767,-999,-999; rec_var_dbl_mss_val_sht_upk=-999.,2.,3.,4.,5.,6.,7.,8.,-999.,-999.; rec_var_dbl_pck=1,2,3,4,5,6,7,8,9,10; rec_var_flt=1.,2.,3.,4.,5.,6.,7.,8.,9.,10.; rec_var_flt_mss_val_dbl=1.0e36,2.,3.,4.,5.,6.,7.,8.,1.0e36,1.0e36; rec_var_flt_mss_val_flt=1.0e36,2.,3.,4.,5.,6.,7.,8.,1.0e36,1.0e36; rec_var_flt_mss_val_flt_all=1.0e36,1.0e36,1.0e36,1.0e36,1.0e36,1.0e36,1.0e36,1.0e36,1.0e36,1.0e36; rec_var_flt_mss_val_flt_all_but_one=1.0e36,1.0e36,1.0e36,1.0e36,5.0,1.0e36,1.0e36,1.0e36,1.0e36,1.0e36; rec_var_flt_mss_val_flt_all_but_two=1.0e36,1.0e36,1.0e36,1.0e36,5.0,1.0e36,1.0e36,1.0e36,1.0e36,10.0; rec_var_flt_mss_val_int=-999.,2.,3.,4.,5.,6.,7.,8.,-999.,-999.; rec_var_flt_pck=1,2,3,4,5,6,7,8,9,10; rec_var_int_mss_val_dbl=-999,2,3,4,5,6,7,8,-999,-999; rec_var_int_mss_val_flt=-999,2,3,4,5,6,7,8,-999,-999; rec_var_int_mss_val_int=-999,2,3,4,5,6,7,8,-999,-999; rlev=1000,500,100; rz=0,5000,17000; scl_dbl_pck=10922; scalar_var=10.; short_var=10; three=3.; three_dmn_var=0.,1.,2.,3.,4.,5.,6.,7.,8.,9.,10.,11.,12.,13.,14.,15.,16.,17.,18.,19.,20.,21.,22.,23.; three_dmn_var_crd=0.,1.,2.,3.,12.,13.,14.,15.,4.,5.,6.,7.,16.,17.,18.,19.,8.,9.,10.,11.,20.,21.,22.,23.; three_dmn_var_cf=0.,1.,2.,3.,12.,13.,14.,15.,4.,5.,6.,7.,16.,17.,18.,19.,8.,9.,10.,11.,20.,21.,22.,23.; three_dmn_var_cf2=0.,1.,2.,3.,12.,13.,14.,15.,4.,5.,6.,7.,16.,17.,18.,19.,8.,9.,10.,11.,20.,21.,22.,23.; time=1.,2.,3.,4.,5.,6.,7.,8.,9.,10.; time_rpt=1.,2.,3.,1.,2.,3.,1.,2.,3.,1.; time_bnds=0.5,1.5,1.5,2.5,2.5,3.5,3.5,4.5,4.5,5.5,5.5,6.5,6.5,7.5,7.5,8.5,8.5,9.5,9.5,10.5; climatology_bounds=0.5,1.5,1.5,2.5,2.5,3.5,3.5,4.5,4.5,5.5,5.5,6.5,6.5,7.5,7.5,8.5,8.5,9.5,9.5,10.5; tm_scn=59; tm_std=59; tm_grg=59; tm_jln=59; tm_360=59; tm_365=59; tm_366=59; od=20,22,24,26,28,30,32,34,36,38; tpt=273.1,273.2,273.3,273.4,273.5,273.6,273.7,273.8,273.9,274.0; tpt_flt=273.1,273.2,273.3,273.4,273.5,273.6,273.7,273.8,273.9,274.0; tpt_dbl=273.1,273.2,273.3,273.4,273.5,273.6,273.7,273.8,273.9,274.0; two=2.; two_dmn_var=1.5,5.5,9.5,13.5,17.5,21.5; u=1.,0.,1.,0.,1.,0.,1.,0.,1.,0.; v=0.,1.,0.,1.,0.,1.,0.,1.,0.,1.; val_half=0.5; val_half_half=0.5,0.5; val_max_max_sht=17000,17000; val_eminusten=1.1e-10; val_one_int=1; val_one_mss=1.,1.0e36; val_one_mss_int=1,-99; val_one_one_int=1,1; var_nm-dash=1.0; // var_nm.dot=1.0; var_1D_rct=0.,1.,0.,0.,1.,1.,0.,2.; var_1D_rrg=0.,1.,0.,0.,1.,1.,0.,2.; var_2D_rct=0.,1.,0.,0.,1.,1.,0.,2.; var_2D_rrg=0.,1.,0.,0.,1.,1.,0.,2.; weight=10.,10.; wgt_one=1.,1.; wvl=0.5e-6,1.0e-6; z=17000,5000,0; zero=0.; // date=640312,640313,640314,640315,640316,640317,640318,640319,640320,640321; date=640224,640225,640226,640227,640228,640301,640302,640303,640304,640305; int_var=10; long_var=10; nbdate=640224; fl_nm_arr="/data/zender/dstccm04/dstccm04_8589_01.nc", "/data/zender/dstccm04/dstccm04_8589_02.nc", "/data/zender/dstccm04/dstccm04_8589_03.nc"; fl_nm_rec="/data/zender/dstccm04/dstccm04_8589_01.nc", "/data/zender/dstccm04/dstccm04_8589_02.nc", "/data/zender/dstccm04/dstccm04_8589_03.nc", "/data/zender/dstccm04/dstccm04_8589_04.nc", "/data/zender/dstccm04/dstccm04_8589_05.nc", "/data/zender/dstccm04/dstccm04_8589_06.nc", "/data/zender/dstccm04/dstccm04_8589_07.nc", "/data/zender/dstccm04/dstccm04_8589_08.nc", "/data/zender/dstccm04/dstccm04_8589_09.nc", "/data/zender/dstccm04/dstccm04_8589_10.nc"; date_sng="2010-11-01T00:00:00.000000"; date_rec="2010-11-01T00:00:00.000000", "2010-11-01T01:00:00.000000", "2010-11-01T02:00:00.000000", "2010-11-01T03:00:00.000000", "2010-11-01T04:00:00.000000", "2010-11-01T05:00:00.000000", "2010-11-01T06:00:00.000000", "2010-11-01T07:00:00.000000", "2010-11-01T08:00:00.000000", "2010-11-01T09:00:00.000000"; time_lon=0.0,90.0,180.0,270.0, 0.0,90.0,180.0,270.0, 0.0,90.0,180.0,270.0, 0.0,90.0,180.0,270.0, 0.0,90.0,180.0,270.0, 0.0,90.0,180.0,270.0, 0.0,90.0,180.0,270.0, 0.0,90.0,180.0,270.0, 0.0,90.0,180.0,270.0, 0.0,90.0,180.0,270.0; two_dmn_rec_var_sng="abc", "bcd", "cde", "def", "efg", "fgh", "ghi", "hij", "jkl", "klm"; two_dmn_rec_var=1.,2.0,3., 1.,2.1,3., 1.,2.2,3., 1.,2.3,3., 1.,2.4,3., 1.,2.5,3., 1.,2.6,3., 1.,2.7,3., 1.,2.8,3., 1.,2.9,3.; three_dmn_rec_var= 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16, 17,18,19,20,21,22,23,24, 25,26,27,28,29,30,31,32, 33,34,35,36,37,38,39,40, 41,42,43,44,45,46,47,48, 49,50,51,52,53,54,55,56, 57,58,59,60,61,62,63,64, 65,66,67,68,69,70,71,72, 73,74,75,76,77,78,79,80; three_dmn_rec_var_pck= 32766, 31936, 31107, 30277, 29448, 28618, 27789, 26959, 26130, 25300, 24471, 23641, 22812, 21982, 21153, 20323, 19494, 18664, 17835, 17005, 16176, 15346, 14517, 13687, 12858, 12028, 11199, 10369, 9539, 8710, 7880, 7051, 6221, 5392, 4562, 3733, 2903, 2074, 1244, 415, -415, -1244, -2074, -2903, -3733, -4562, -5392, -6221, -7051, -7880, -8710, -9539, -10369, -11199, -12028, -12858, -13687, -14517, -15346, -16176, -17005, -17835, -18664, -19494, -20323, -21153, -21982, -22812, -23641, -24471, -25300, -26130, -26959, -27789, -28618, -29448, -30277, -31107, -31936, -32766 ; prs_sfc= 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16, 17,18,19,20,21,22,23,24, 25,26,27,28,29,30,31,32, 33,34,35,36,37,38,39,40, 41,42,43,44,45,46,47,48, 49,50,51,52,53,54,55,56, 57,58,59,60,61,62,63,64, 65,66,67,68,69,70,71,72, 73,74,75,76,77,78,79,80; PS= 101325,101325,101325,101325,101325,101325,101325,101325, 101325,101325,101325,101325,101325,101325,101325,101325, 101325,101325,101325,101325,101325,101325,101325,101325, 101325,101325,101325,101325,101325,101325,101325,101325, 101325,101325,101325,101325,101325,101325,101325,101325, 101325,101325,101325,101325,101325,101325,101325,101325, 101325,101325,101325,101325,101325,101325,101325,101325, 101325,101325,101325,101325,101325,101325,101325,101325, 101325,101325,101325,101325,101325,101325,101325,101325, 101325,101325,101325,101325,101325,101325,101325,101325; three_dmn_var_dbl= 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16, 17,18,19,20,21,22,23,24, -99,-99,-99,-99,-99,-99,-99,-99, 33,34,35,36,37,38,39,40, 41,42,43,44,45,46,47,48, 49,50,51,52,53,54,55,56, -99,58,59,60,61,62,63,64, 65,66,67,68,69,70,71,72, -99,74,75,76,77,78,79,-99; zg= 1, 2, 3, 4, 5, 6, 7, 8,9,10,11,12, 13,14,15,16,17,18,19,20,21,22,23,24, 25,26,27,28,29,30,31,32,33,34,35,36, 37,38,39,40,41,42,43,44,45,46,47,48, 49,50,51,52,53,54,55,56,57,58,59,60, 61,62,63,64,65,66,67,68,69,70,71,72, 73,74,75,76,77,78,79,80,81,82,83,84, 85,86,87,88,89,90,91,92,93,94,95,96, 97,98,99,100,101,102,103,104,105,106,107,108, 109,110,111,112,113,114,115,116,117,118,119,120; three_dmn_var_int= 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16, -99,-99,-99,-99,-99,-99,-99,-99, 25,26,27,28,29,30,31,32, 33,34,35,36,37,38,39,40, 41,-99,43,44,45,46,47,48, 49,50,51,52,53,54,55,56, -99,58,59,60,-99,62,63,64, 65,-99,67,68,69,70,71,72, -99,74,75,-99,77,78,79,80; three_dmn_var_sht= 1, 2, 3, 4, 5, 6, 7, 8, -99,10,11,12,13,14,15,16, 17,18,19,20,21,22,23,24, 25,26,27,28,29,30,31,32, -99,34,35,-99,37,38,39,40, 41,42,43,44,-99,46,47,48, 49,50,51,52,53,54,55,56, 57,58,59,-99,61,62,63,64, 65,66,67,68,69,70,71,72, -99,-99,-99,-99,-99,-99,-99,-99; th= 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16, 17,18,19,20,21,22,23,24, -99,-99,-99,-99,-99,-99,-99,-99, 33,34,35,36,37,38,39,40, 41,42,43,44,45,46,47,48, 49,50,51,52,53,54,55,56, -99,58,59,60,61,62,63,64, 65,66,67,68,69,70,71,72, -99,74,75,76,77,78,79,-99; four_dmn_rec_var= 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,100,101,102,103,104,105,106,107,108, 109,110,111,112,113,114,115,116,117,118,119,120, 121,122,123,124,125,126,127,128,129,130,131,132, 133,134,135,136,137,138,139,140,141,142,143,144, 145,146,147,148,149,150,151,152,153,154,155,156, 157,158,159,160,161,162,163,164,165,166,167,168, 169,170,171,172,173,174,175,176,177,178,179,180, 181,182,183,184,185,186,187,188,189,190,191,192, 193,194,195,196,197,198,199,200,201,202,203,204, 205,206,207,208,209,210,211,212,213,214,215,216, 217,218,219,220,221,222,223,224,225,226,227,228, 229,230,231,232,233,234,235,236,237,238,239,240; td= 1,2,3,4,5,6,7,8,9,10; tx= 1,2,3,4,5,6,7,8,9,10, 11,12,13,14,15,16,17,18,19,20, 21,22,23,24,25,26,27,28,29,30, 31,32,33,34,35,36,37,38,39,40; ty= 1,2,3,4,5,6,7,8,9,10, 11,12,13,14,15,16,17,18,19,20; tz= 1,2,3,4,5,6,7,8,9,10, 11,12,13,14,15,16,17,18,19,20, 21,22,23,24,25,26,27,28,29,30; tyz= 1,2,3,4,5,6,7,8,9,10, 11,12,13,14,15,16,17,18,19,20, 21,22,23,24,25,26,27,28,29,30, 31,32,33,34,35,36,37,38,39,40, 41,42,43,44,45,46,47,48,49,50, 51,52,53,54,55,56,57,58,59,60; xyz=0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23; txyz= 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,100,101,102,103,104,105,106,107,108, 109,110,111,112,113,114,115,116,117,118,119,120, 121,122,123,124,125,126,127,128,129,130,131,132, 133,134,135,136,137,138,139,140,141,142,143,144, 145,146,147,148,149,150,151,152,153,154,155,156, 157,158,159,160,161,162,163,164,165,166,167,168, 169,170,171,172,173,174,175,176,177,178,179,180, 181,182,183,184,185,186,187,188,189,190,191,192, 193,194,195,196,197,198,199,200,201,202,203,204, 205,206,207,208,209,210,211,212,213,214,215,216, 217,218,219,220,221,222,223,224,225,226,227,228, 229,230,231,232,233,234,235,236,237,238,239,240; // three_double_dmn= 1, 2, 3, 4, 5, 6, 7, 8, // 9,10,11,12,13,14,15,16, // 17,18,19,20,21,22,23,24, // -99,-99,-99,-99,-99,-99,-99,-99, // 33,34,35,36,37,38,39,40, // 41,42,43,44,45,46,47,48, // 49,50,51,52,53,54,55,56, // -99,58,59,60,61,62,63,64, // 65,66,67,68,69,70,71,72, // -99,74,75,76,77,78,79,-99, // 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, // 9.5,10.5,11.5,12.5,13.5,14.5,15.5,16.5, // 17.5,18.5,19.5,20.5,21.5,22.5,23.5,24.5, // -99.5,-99.5,-99.5,-99.5,-99.5,-99.5,-99.5,-99.5, // 33.5,34.5,35.5,36.5,37.5,38.5,39.5,40.5, // 41.5,42.5,43.5,44.5,45.5,46.5,47.5,48.5, // 49.5,50.5,51.5,52.5,53.5,54.5,55.5,56.5, // -99.5,58.5,59.5,60.5,61.5,62.5,63.5,64.5, // 65.5,66.5,67.5,68.5,69.5,70.5,71.5,72.5, // -99.5,74.5,75.5,76.5,77.5,78.5,79.5,-99.5; time_int_udunits = 86400; time_udunits = 876012, 876018, 876024; vld_rng= 273.,-999.,180.,179.,273.,360.,361.,1.0e36,-1.0e36,273.; wnd_spd= -999,0.5,1.5,0.5,1.5,0.5,1.5,0.5, 0.5,-999,0.5,0.5,0.5,0.5,0.5,0.5, 0.5,1.5,-999,1.5,0.5,1.5,0.5,1.5, 0.5,0.5,0.5,-999,0.5,0.5,0.5,0.5, 1.5,1.5,1.5,1.5,-999,1.5,1.5,1.5, 0.5,0.5,0.5,0.5,0.5,-999,0.5,0.5, 2.5,2.5,2.5,2.5,2.5,2.5,-999,2.5, 0.5,0.5,0.5,0.5,0.5,0.5,0.5,-999, 0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5, 0.5,0.5,2.5,0.5,0.5,2.5,0.5,0.5; } // end netcdf nco-5.3.3/data/limits.nco000066400000000000000000000020271477164337000152310ustar00rootroot00000000000000// $Header$ -*-C++-*- // Purpose: Test parsing of naked numbers min/max /* Usage: ncap2 -4 -O -v -S ~/nco/data/limits.nco ~/nco/data/in_4.nc ~/foo.nc ncks ~/foo.nc | /bin/more */ // Check methods first // Count number of errors nbr_err=0; nbr_err_ttl=0; { byte_max=127b; byte_min= -128b; if( -byte_max -1 != -128b ) { print("ERROR: byte 1 min\n"); nbr_err++; } if( -byte_max -1 != byte_min ) { print("ERROR: byte 2 min\n"); nbr_err++; } short_max=32767s; if( -short_max -1 != -32768s ) { print("ERROR: short min\n"); nbr_err++; } int_max=2147483647l; if( -int_max -1 != -2147483648l ) { print("ERROR: int min\n"); nbr_err++; } llong_max=9223372036854775807ll; if( -llong_max -1 != -9223372036854775808ll ) { print("ERROR: llong min\n"); nbr_err++; } print("RESULTS block 1 Num errors="); print(nbr_err,"%d"); nbr_err_ttl+=nbr_err; nbr_err=0; } // Results summany print("RESULTS SUMMARY: total errors=");print(nbr_err_ttl,"%d"); nco-5.3.3/data/lrg_bm.in000066400000000000000000000023361477164337000150240ustar00rootroot00000000000000// Script for creating Large nc file for // testing OpenMp threading. // one is 1 always in in.nc if(one == 1){ print("First Run\n"); defdim("west_east",120); defdim("south_north",100); defdim("bottom_top",10); // Create synthetic variables // short R[time,south_north,west_east,bottom_top]=time.short(); R( :,:,:,::2)=48s; R( ::4,8:89:2,:,::3)=33s; // int S[time,south_north,west_east]=100; S(:,0:30:8,:)=-100; S(0:9,::2,::3)=23; // int T[time,south_north,west_east]=10; T(:,0:30:8,:)=5; T(0:9,::2,::3)=1; T.set_miss(1); //float U[time,south_north,west_east]=time.float(); U(:,:,::3)=10.1f; U( ::10,:,::20)=20.2f; //float V[time,south_north,west_east]=time.float()/9.99f; V( :,:,::4)=4.4f; V( ::10,:,::8)=8.1f; // double W[time,south_north,west_east,bottom_top]=time/100.0; W( :,:,:,::2)=0.23d; W( ::4,8:89,:,0:8:3)=0.44d; W.set_miss(0.44d); //double X[time,south_north,west_east,bottom_top]=time/100.0; X( :,:,:,::2)=37.5d; X( ::4,8:89:2,:,::3)=3.3124d; } if(one==0) { print("Second run\n"); R++; where(S >22) S=-22; S+=100; T*=100; T(0:4,0:4,:)=999; where(U>20) U=888f; U(:,:20,::4)=8.2f; V/=0.99; V( ::10,:,::4)=1.1f; W*=0.99; W( :,:,:30,::4)=0.001; X-=2.001; X( ::4,8:89:10,:,::3)=2.71828; } one=0;nco-5.3.3/data/lz4.cdl000066400000000000000000000037261477164337000144330ustar00rootroot00000000000000// -*-C++-*- // Purpose: Test netCDF filters with LZ4 compression // Generate and test netCDF file (CCR with LZ4 must be installed and loadable) with: // ncgen -k netCDF-4 -b -o ~/nco/data/lz4.nc ~/nco/data/lz4.cdl // ncdump -h -s ~/nco/data/lz4.nc // ncks --hdn ~/nco/data/lz4.nc netcdf lz4 { dimensions: dim0 = 4 ; dim1 = 4 ; dim2 = 4 ; dim3 = 4 ; variables: float var(dim0, dim1, dim2, dim3) ; var:_Storage = "chunked" ; var:_ChunkSizes = 4, 4, 4, 4 ; // var:_Filter = "307,9" ; // BZIP2, Level 9 var:_Filter = "32004,9" ; // LZ4, Level 9 // var:_Filter = "47987,4" ; // DigitRound, NSD 4 var:_NoFill = "true" ; var:_FillValue = 255.0f ; data: // ncap2 -O -v -s 'defdim("dmn",256);val=array(0,1,$dmn);print(val)' ~/foo.nc;ncks -s "%d, " ~/foo.nc var = 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255; } nco-5.3.3/data/map_file_stats.nco000066400000000000000000000022251477164337000167220ustar00rootroot00000000000000// check the totals in a map file // usage: ncap2 -v -O -S map_file_checker.nco map_in.nc tot.nc pi=3.14159265358979323844; a=1; a@area_ttl=area_a.ttl(); a@mask_ttl=mask_a.ttl().int();; a@frac_ttl=frac_a.ttl(); a@frac_min=frac_a.min(); a@frac_max=frac_a.max(); a@frac_rms=(frac_a-1.0).rms(); b=1; b@area_ttl=area_b.ttl(); b@mask_ttl=mask_b.ttl(); b@frac_ttl=frac_b.ttl(); b@frac_min=frac_b.min(); b@frac_max=frac_b.max(); b@frac_rms=(frac_b-1.0).rms(); s=1; s@S_ttl=S.ttl(); print("map file statistics\n"); print(a@area_ttl,"area_a total=%.15g steradians"); print(a@area_ttl / 4.0 / pi *100.0, " ( %.15f%% )\n"); print(a@mask_ttl, "mask_a total=%d\n"); print(a@frac_ttl, "frac_a total=%.15f "); print(a@frac_min, "min=%.15f "); print(a@frac_max, "max=%.15f "); print(a@frac_rms, "rms=%.15f\n"); print("\n"); print(b@area_ttl,"area_b total=%.15g steradians"); print(b@area_ttl / 4.0 / pi *100.0, " ( %.15f%% )\n"); print(b@mask_ttl, "mask_b total=%d\n"); print(b@frac_ttl, "frac_b total=%.15f "); print(b@frac_min, "min=%.15f "); print(b@frac_max, "max=%.15f "); print(b@frac_rms, "rms=%.15f\n"); print("\n"); print(s@S_ttl,"S weights total=%.15f\n"); nco-5.3.3/data/mdl_1.cdl000066400000000000000000000051521477164337000147110ustar00rootroot00000000000000// -*-C++-*- // Generate netCDF file with: // ncgen -k netCDF-4 -b -o ~/nco/data/mdl_1.nc ~/nco/data/mdl_1.cdl netcdf mdl_1 { :Conventions = "CF-1.5"; group: cesm { group: cesm_01 { :Conventions = "CF-1.5"; :history = "yada yada yada"; :Scenario = "Historical"; :Model = "CESM"; :Realization = "1"; dimensions: time=unlimited; variables: float tas1(time); tas1:long_name = "surface air temperature"; float tas2(time); double time(time); time:long_name = "time"; time:units = "days since 1964-03-12 12:09:00 -9:00"; float gw(time); //test CF fixed variables (using time as dimension, usually dimension is lat) data: tas1=272.1,272.1,272.1,272.1; tas2=272.1,272.1,272.1,272.1; time=1.,2.,3.,4.; gw=1.,1.,1.,1.; } // cesm_01 group: cesm_02 { :Conventions = "CF-1.5"; :history = "yada yada yada"; :Scenario = "Historical"; :Model = "CESM"; :Realization = "2"; dimensions: time=unlimited; variables: float tas1(time); tas1:long_name = "surface air temperature"; float tas2(time); double time(time); time:long_name = "time"; time:units = "days since 1964-03-12 12:09:00 -9:00"; float gw(time); data: tas1=272.2,272.2,272.2,272.2; tas2=272.2,272.2,272.2,272.2; time=1.,2.,3.,4.; gw=2.,2.,2.,2.; } // cesm_02 } // cesm group: ecmwf { group: ecmwf_01 { :Conventions = "CF-1.5"; :history = "yada yada yada"; :Scenario = "Historical"; :Model = "ECMWF"; :Realization = "1"; dimensions: time=unlimited; variables: float tas1(time); tas1:long_name = "surface air temperature"; float tas2(time); double time(time); time:long_name = "time"; time:units = "days since 1964-03-12 12:09:00 -9:00"; data: tas1=273.1,273.1,273.1,273.1; tas2=273.1,273.1,273.1,273.1; time=1.,2.,3.,4.; } // ecmwf_01 group: ecmwf_02 { :Conventions = "CF-1.5"; :history = "yada yada yada"; :Scenario = "Historical"; :Model = "ECMWF"; :Realization = "2"; dimensions: time=unlimited; variables: float tas1(time); tas1:long_name = "surface air temperature"; float tas2(time); double time(time); time:long_name = "time"; time:units = "days since 1964-03-12 12:09:00 -9:00"; data: tas1=273.2,273.2,273.2,273.2; tas2=273.2,273.2,273.2,273.2; time=1.,2.,3.,4.; } // ecmwf_02 } // ecmwf } // root group nco-5.3.3/data/mdl_2.cdl000066400000000000000000000027101477164337000147070ustar00rootroot00000000000000// -*-C++-*- // Generate netCDF file with: // ncgen -k netCDF-4 -b -o ~/nco/data/mdl_2.nc ~/nco/data/mdl_2.cdl netcdf mdl_2 { group: cesm { group: cesm_03 { :Conventions = "CF-1.5"; :history = "yada yada yada"; :Scenario = "Historical"; :Model = "CESM"; :Realization = "1"; dimensions: time=4; variables: float tas1(time); float tas2(time); double time(time); data: tas1=272.3,272.3,272.3,272.3; tas2=272.3,272.3,272.3,272.3; time=1.,2.,3.,4.; } // cesm_03 } // cesm group: ecmwf { group: ecmwf_03 { :Conventions = "CF-1.5"; :history = "yada yada yada"; :Scenario = "Historical"; :Model = "ECMWF"; :Realization = "1"; dimensions: time=4; variables: float tas1(time); float tas2(time); double time(time); data: tas1=273.3,273.3,273.3,273.3; tas2=273.3,273.3,273.3,273.3; time=1.,2.,3.,4.; } // ecmwf_03 group: ecmwf_04 { :Conventions = "CF-1.5"; :history = "yada yada yada"; :Scenario = "Historical"; :Model = "ECMWF"; :Realization = "2"; dimensions: time=4; variables: float tas1(time); float tas2(time); double time(time); data: tas1=273.4,273.4,273.4,273.4; tas2=273.4,273.4,273.4,273.4; time=1.,2.,3.,4.; } // ecmwf_04 } // ecmwf } // root group nco-5.3.3/data/mdl_3.cdl000066400000000000000000000026651477164337000147210ustar00rootroot00000000000000// -*-C++-*- // Generate netCDF file with: // ncgen -k netCDF-4 -b -o ~/nco/data/mdl_3.nc ~/nco/data/mdl_3.cdl netcdf mdl_3 { group: cesm { group: cesm_01 { :Conventions = "CF-1.5"; :history = "yada yada yada"; :Scenario = "Historical"; :Model = "CESM"; :Realization = "1"; dimensions: time=unlimited; variables: float tas1(time); float tas2(time); double time(time); data: tas1=272.1,272.1,272.1,272.1; tas2=272.1,272.1,272.1,272.1; time=1.,2.,3.,4.; } // cesm_01 group: cesm_02 { :Conventions = "CF-1.5"; :history = "yada yada yada"; :Scenario = "Historical"; :Model = "CESM"; :Realization = "2"; dimensions: time=unlimited; variables: float tas1(time); float tas2(time); double time(time); data: tas1=272.2,272.2,272.2,272.2; tas2=272.2,272.2,272.2,272.2; time=1.,2.,3.,4.; } // cesm_02 } // cesm group: ecmwf { group: ecmwf_01 { :Conventions = "CF-1.5"; :history = "yada yada yada"; :Scenario = "Historical"; :Model = "ECMWF"; :Realization = "1"; dimensions: time=unlimited; variables: float tas1(time); float tas2(time); double time(time); data: tas1=273.1,273.1,273.1,273.1; tas2=273.1,273.1,273.1,273.1; time=1.,2.,3.,4.; } // ecmwf_01 } // ecmwf } // root group nco-5.3.3/data/mlt_rcd.cdl000066400000000000000000000006661477164337000153460ustar00rootroot00000000000000// -*-C++-*- // Purpose: CDL file to test multiple record dimensions // Usage: // ncgen -k netCDF-4 -b -o ~/nco/data/mlt_rcd.nc ~/nco/data/mlt_rcd.cdl // ncrcat -O -p ~/nco/data mlt_rcd.nc mlt_rcd.nc ~/foo.nc netcdf mlt_rcd { dimensions: time1=unlimited; time2=unlimited; time3=unlimited; variables: int var1(time1); int var2(time2); int var3(time3); data: var1=1; var2=2,2; var3=3,3,3; } // end root group nco-5.3.3/data/mrd.cdl000066400000000000000000000012661477164337000145010ustar00rootroot00000000000000// -*-C++-*- // Purpose: Test Multiple Record Dimensions // Generate netCDF file with: // ncgen -k netCDF-4 -b -o ~/nco/data/mrd.nc ~/nco/data/mrd.cdl // Reproduce bug 20140815: ncrcat (not ncks) fails on variables with multiple record dimensions reported by rmla 20140619 // ncrcat -O -d parameter,0,0 -d time,1,1 -d run,0,1 -d step,0,1 -d number,0,1 -d ngr,0,1 ${DATA}/hdf/71355.ecmf.1.nc ~/mrd.nc // ncrcat -O -h -d time,0 ~/nco/data/mrd.nc ~/foo.nc // ncdump ~/foo.nc netcdf mrd { dimensions: time = UNLIMITED ; // (2 currently) step = UNLIMITED ; // (2 currently) variables: int var_mrd(time, step) ; int time(time) ; data: var_mrd = {1, 2}, {3, 4} ; time = 1, 2 ; } nco-5.3.3/data/ncap.in000066400000000000000000000175341477164337000145110ustar00rootroot00000000000000// $Header$ -*-C-*- // Purpose: ncap2 netCDF Arithmetic Processor Demonstration/Test Script // Adopted from an ncap (=ncap1) Demonstration/Test Script deprecated in 201803 /* Format of valid ncap2 script: Syntax is C-like, and C++ comments also valid Mathematical expressions use forward algebraic notation Statements in scripts are terminated with semi-colons Command-line definitions should omit semi-colons, e.g., -s "foo=bar" Whitespace (blank lines, tabs) is ignored Nested files allowed with #include file syntax */ //#include ncap.in2 /* Usage: ncap2 -O -D 1 -v -S ${HOME}/nco/data/ncap.in ${HOME}/nco/data/in.nc ${HOME}/nco/data/foo.nc ncap2 -O -D 1 -d lat,0 -d lon,0 -d lev,0 -s "a9=three_dmn_var" ${HOME}/nco/data/in.nc ${HOME}/nco/data/foo.nc ncap2 -O -D 1 -v -s "upk=pck*pck@scale_factor+pck@add_offset" ${HOME}/nco/data/in.nc ${HOME}/nco/data/foo.nc ncap2 -O -D 1 -v -s "upk=pck" ${HOME}/nco/data/in.nc ${HOME}/nco/data/foo.nc ncap2 -O -D 1 -v -s "pck=pack(three_dmn_var)" ${HOME}/nco/data/in.nc ${HOME}/nco/data/foo.nc ncap2 -O -D 1 -s "prs_mdp[time,lat,lon,lev]=P0*hyam+hybm*PS" ${HOME}/nco/data/in.nc ${HOME}/nco/data/foo.nc ncks -H -m ${HOME}/nco/data/foo.nc | m */ /* ncap2 is a handy attribute editor: Define new attribute: ncap2 -O -v -s "one@new=2*att_var@double_att;one@test=two@long_name;" in.nc foo.nc Re-define existing attribute in terms of itself: ncap2 -O -v -s "att_var@double_att=att_var@double_att^2.0" in.nc foo.nc Computation is performed at highest precision of RHS expression: ncap2 -O -v -s "one@new=att_var@short_att * att_var@double_att - att_var@double_att" in.nc foo.nc Use math functions (default result is of type double): ncap2 -O -v -s "one@new=cos(1.0e-4) - 1" in.nc foo.nc Result is now of type float: ncap2 -O -v -s "one@new=cos(1.0e-4f)^2+sin(1.0e-4f)^2" in.nc foo.nc Assign string to attribute (use \" to escape quote from shell): ncap2 -O -v -s "one@new=\"hello world\"" in.nc foo.nc Add strings, and use C escape characters: ncap2 -O -v -s "one@new=\"Hello\t\"+\"World\n\"" in.nc foo.nc Set an attribute equal to a 0-dimensional variable: ncap2 -O -v -s "one@new=one" in.c foo.nc Set an attribute equal to a 1-dimensional variable: ncap2 -O -v -s "one@new=mss_val" in.nc foo.nc /* The ncap2 operators works with netCDF variables and attributes Multiply an existing co-ordinate variable by 20: ncap2 -O -v -s "lat=20*lat" in.nc foo.nc Average variables of mixed types (result is of type double): ncap2 -O -v -s "average=(three_dmn_rec_var+three_dmn_var_dbl+three_dmn_var_int)/3" in.nc foo.nc Take log (to base e) of absolute value of variable: ncap2 -O -v -s "abslog=log(abs(three_dmn_var_dbl))" in.nc foo.nc The available maths functions are: acos(), asin(), atan(), cos(), exp(), erf(), erfc(), gamma(), log(), log10(), sin(), sqrt(), tan(); If argument precision is "less" than type float then result is type float If argument is type double then result is also double This also applies to pow() function, e.g, pow(var1,3.5) or var1^3.5, e.g., ncap2 -O -v -s "modulus=pow(sin(three_dmn_rec_var),2)+cos(three_dmn_rec_var)^2 - 1" in.nc foo.nc */ /* Modulus operator % can also be used with attributes and variables Attributes are converted to variable's type prior to operation Result of modulus is of type float: ncap2 -O -v -s "mod=three_dmn_rec_var % 4.0" in.nc foo.nc Result of modulus is of type int: ncap2 -O -v -s "testa=three_dmn_var_int % 1.0f" in.nc foo.nc Unary +/- signs work intuitively with attributes and variables: ncap2 -O -v -s "sign=-three_dmn_rec_var" in.nc foo.nc */ /* Packing and unpacking: Manual unpacking is relatively straightforward but works only with -D 3 because automatic unpacking is now default on ncap2. It is now broken because ncap_var_write() tries to write bogus attributes automatically because pck_ram is set in pck_dsk_inq() ncap2 -D 3 -O -v -s "upk=pck*pck@scale_factor+pck@add_offset" -s "upk_arr=pck_arr*pck_arr@scale_factor+pck_arr@add_offset" ${HOME}/nco/data/in.nc ${HOME}/nco/data/foo.nc Automatic unpacking works for scalars, not for arrays ncap2 -D 1 -O -v -s "upk=pck" -s "upk_arr=pck_arr" ${HOME}/nco/data/in.nc ${HOME}/nco/data/foo.nc Automatic packing does not yet work ncap2 -D 1 -O -v -s "pck=pack(ORO)" ${HOME}/nco/data/in.nc ${HOME}/nco/data/foo.nc ncap2 -D 1 -O -v -s "pck=pack(upk)" -s "pck_arr=pack(upk_arr)" ${HOME}/nco/data/in.nc ${HOME}/nco/data/foo.nc ncap2 -D 1 -O -v -s "pck=pack(pck)" -s "pck_arr=pack(pck_arr)" ${HOME}/nco/data/in.nc ${HOME}/nco/data/foo.nc ncap2 -D 1 -O -v -s "upk=unpack(pack(unpack(pack(pck))))" -s "upk_arr=unpack(pack(unpack(pack(pck_arr))))" ${HOME}/nco/data/in.nc ${HOME}/nco/data/foo.nc ncks -H -m ${HOME}/nco/data/foo.nc | m ncks -H -v pck,pck_arr -m ${HOME}/nco/data/foo.nc | m ncks -H -v upk,upk_arr -m ${HOME}/nco/data/foo.nc | m */ // Charlie's Tests: // p=hyam*PO+hybm*PS a2=(1*(three_dmn_var-three_dmn_var+1)-1)^1; a3[lat,lon,lev]=one; a4[lat,lon,lev]=1.0f-one; a5=time; a6=time+one_dmn_rec_var; prs_mdp[time,lat,lon,lev]=P0*hyam+hybm*PS; // Works because prs_mdp in LHS cast //prs_mdp=P0*hyam+hybm*PS; // Fails because prs_mdp dimension ordering is ambiguous //prs_mdp=(four_dmn_rec_var-four_dmn_rec_var+1)*P0*hyam+(four_dmn_rec_var-four_dmn_rec_var+1)*hybm*PS; // Works because prs_mdp is typecast on RHS a7=erf(1.0); a8=erfc(1.0); a9[time,lat,lev]=3.141d; // Henry's tests: one@one=10+30; one@two=sin(3.141/2); one@three=cos(3.1415926)+one@one+one@two; // Redefine attributes one@one=23/4; one@two=one@one+one@two; one@eight=25.0%4.99; one@nine=1.e10; one@ten=val_half_half@_FillValue%1000; /* Standard netCDF postfix operators are used to typecast attributes/numbers floats and doubles must include decimal point or exponent to be recognized */ one@byte=10b; one@short=10s; one@float=100.e2f; one@double=2e3; /* Type conversion follows C rules: expression is converted to highest type Following expression is of type float: */ one@add=one@byte+one@short/one@float; // Can create 0 dimensional variables (scalars) nine=10000e2f; one=10; two=4; val_half_half@_FillValue=21; // Can use modulus operator with attributes and variables twenty=four_dmn_rec_var % 8; twentyone=sin(twenty)^2+cos(twenty)^2; twentytwo=10*9; twentythree=1.0e9%2; twentyfour=two_dmn_var@units; twentyfive=three_dmn_var_dbl/4; twentysix=pck; /* Below multiplication is of individual elements in variables AND NOT a matrix multiplication. Resulting matrix is of type double. */ twentyseven=three_dmn_var_int * three_dmn_var_dbl; // Function atostr() evaluates an attribute and stores the result as a string twenty@one=atostr(1.e10); twenty@two=atostr(1/7.0); // Function atostr() accepts an optional C-format twenty@three=atostr(1/7.0,"\t%15f\n"); // Add two strings together twenty@four="Hello"+"\t World\n"; // Put a 0 or 1 dimensional variable into an attribute twenty@five=fl_nm; twenty@six=mss_val; twenty@seven=one; //Put an attribute/number into a variable thirty=1.e19f; thirtyone=one@one; // With a string ONLY the first char is put into variable thirtytwo="Hello world"; // use varibles defined in output thirtythree=twentyfive*4.001; // Use UNARY -/+ and brackets three=(-two_dmn_var+5)^3; testa=pow(sin(four_dmn_rec_var),2)+cos(four_dmn_rec_var)^2; /* Conversion functions are available for variables AND attributes Standard C type conversion rules are used Converting "down" produces interesting results! byte(),char(),short(), int(), float(), and double() */ // Convert float to byte ex_byte=byte(two_dmn_var); // Convert int to short ex_short=short(three_dmn_var_int/5); // Convert short to float ex_float=float(three_dmn_var_sht); // Convert float to double ex_double=double(weight); // Convert attribute to double bnd_var@att_double=double(bnd_var@float_att); // Convert double attribute to int bnd_var@att_int=double(4*bnd_var@float_att); nco-5.3.3/data/ncap.in2000066400000000000000000000002451477164337000145620ustar00rootroot00000000000000// $Header$ -*-C-*- // Purpose: ncap script #include'd by ncap.in to demonstrate file nesting a1 = one; a1@a1 = global@history; a1@julian_day = global@julian_day; nco-5.3.3/data/ncap2.in000066400000000000000000000143161477164337000145660ustar00rootroot00000000000000// $Header$ -*-C++-*- // Purpose: Sample input script for ncap2 /* Usage: ncap2 -O -v -S ~/nco/data/ncap2.in ~/nco/data/in.nc ~/foo.nc ncks ~/foo.nc | /bin/more */ a1=three_dmn_var_dbl+three_dmn_var_int; a2=sin(three_dmn_var_dbl)^2.0 + cos(three_dmn_var_dbl)^2.0; if(a2 > 0.99) a3=1.00; a4[$time,$lat,$lon]=time*2; a1@one=four; a5=a1@one; // check if thens if( 0 ) a6=0; else {{ a7=1; a8=2; }} if(1) {a9=1; a10=2;} if( 0.0 ) a6=0; else if(0) {a11=1; a12=2;} else if( 3>2) a13=3; // check dangling else if(1) if(0) a14=1; else a15=1; a20[$time]=666; a21[$time,$lat]=a1@one; //Check casting a22[time,lat,lon,lev]=P0*hyam+hybm*PS; // Works because prs_mdp in LHS cast b2=999; b2@one=2222.0d; b2@zero=three_dmn_var_dbl@_FillValue; b2@two=sin(3.14); b2@three=cos(3.14); b2@four=!sin(3.14); b3=b2@zero; // Check bare numbers are being parsed OK c1@byte=10b; c1@short=20s; c1@int=30; c1@int2=23L; c1@int3=24l; c1@float=40f; c1@double=50d; c1@double2=25.; c1@exp=21e2; c1@exp2=21.1e10f; c1@exp3=2e-2d; c1@exp4=2.e3; c1@zero=0.0; c1@zero1=.0; c1@zero2=0.0e2; c1=four*c1@byte; d1=three_dmn_var_int*c1@double; // put var "into" an attributte d1@one=three_dmn_var_dbl; // Multiply two attributes one sz=1 d1@two=d1@one*c1@int; // multiply attribute and var of the same size ! e1=d1@one*three_dmn_var_int; // check global attributtes // Read global e1@test=global@history; // write global global@test=999; global@test2=global@Conventions; // Mask examples --grab only values <= 20 from three_dmn_var_dbl mask_out= (three_dmn_var_dbl <= 20) *three_dmn_var_dbl; // check var/att casting; e1@test=three_dmn_var_int; e1@test2=e1@test*c1@int; e1@three=10d; // plain numbers are created as vars -- // mixed expression -resultant type=double e1@four=1.001d*e1@three; // resultant expression resultant type=int e1@five=e1@three*199; e1@six=e1@three*e1@three; // below op not done -- att must conform to var //e1@seven=e1@test*100; // below op valid att size= var size e1@eight=e1@test*three_dmn_var_dbl; //e2[time]=0.99; e2=11111.0; //Check hyperslabbing //Create some vars th=three_dmn_var_dbl; f1[$time,$lat]=666; f2[$time,$lat,$lon]=time*2; f3[$lon]=time(3); time1=time; // hyperslab with RHS a scalar f2(9,:,:)=.99; f2(7,,)=.77; f2(5,::,0)=.55; f2(1,:,::2)=1111; f4=th(0,0,0)+th(9,1,3); time1(0:4)=.4444; time1(5:9)=.5555; // Create attributes and derive attributes from variables f2@one=time(::3); f2@two=1000.0; f2@three=f2@one*f2@two; // hyperlslab on the LHS & RHS // Empty brackets indicate the entire variable // is to be hyperslabbed. f3()=time1(0:6:2); th(9,,)=th(2,,); // Check attribute propagation // LHS-variable inherits attributes from left-most RHS-variable g1=999.00; g1@a=10; g1@b=20.0; g1@c=30.0; // Above attributes are copied to g2 g2=g1; // g3 will get attributes for rz // 20110318: NB triggers regression failure TODO nco111 g3=rz*four; // Check attribute propagation with mod and pow g4= (g1@c * g1@a) % 2.0 ^ three_dmn_var_dbl; // Check att propagation with a LHS hyperslab g4(2,0,0)=987654.0; // Check attribute inheritance // z in output should inherit atts from z in input // z=1000; // Attribute string handling h1=10.0; h1@units="microns"; h1@long_name="Tesla\t"; // variable string handling // Create a variable string (currently painful) h2[char_dmn_lng04]="a"; // string is now "aaa" h2()="hell"; // string is now "hell" // hyperslab a variable string; h3=two_dmn_rec_var_sng; h3(1,0:2)="ccc"; h4=fl_nm; h4(6:11)="henrys"; // If hyperslabbing a var in the input // then the var is first copied to output e.g weight(0)=weight(0)+10; // Increment and decrement operators // Deceptively complex expression // time is read from the input file // its elements are incremented by one and then the result is // written to the output file and subsequently then assigned to i2 // i2 is then written to file i2=++time; // time in the output is now decremented by one // and ALL elements of of i2 & i3 are equal i3=time--; if(i2==i3) i2@equal=1; else i2@equal=0; // can string together operators i4=i5=i6=0; // below the result is i4=10, i5=10,i6=0 i4+=i5+=i6+10; // below the result is i4=80 i5=8 i6=2 i4*=i5-=i6=2; // can use assign in an if then i7=0,0,0,0,0,0,0,0,0,0 if( 0==(i7=i3-i2) ) i7@equals=1; else i7@equals=0; // all elements of i7 now 10 i7()=10; // all elements of i7 now 11 i7+=1; // ternary operator -similar to the one in C // in below attribute is assigned the string "true" i7@test = ( i7 >9 ? "true" : "false"); i8=0; // Side effects j1=0; // Unlike C there is no short circuiting with AND/OR // so in the below statement the result is that // j1=1 and j1@bool is undeclared if(0 && j1++) j1@bool="true"; // similarly after below j1=0 j1@bool is still undeclared if( 1 || --j1 ) j1@bool="true"; j2=10; j3=1; // There are no side effects with the ternary operator, e.g., // the result is that j2=10, j3=2, j4=2. j4= (i7<9 ? ++j2 : ++j3); // Defining Dimensions // use the defdim function. Dimensions in the input file CANNOT // be redefined in the output. Dimensions are imutable and // once defined in cannot be redefined // (NB: defdim should return a bool value indicating success or failure) defdim("x",1); defdim("y",4); defdim("z",9); // LHS Cast a new variable with new dimensions k1[$x,$y,$z]=1.01d; // Dimension size can be used in an expression by postfixing it with "size" e.g., if($x.size==1 && $y.size < 5 && $z.size==9) k1@max=9; // k1@size=$x.size*$y.size*$z.size; // hyperlsab with dim values k1(0,0,0:($z.size-3))=2.01d; // k2=4.0; k3=k2+=10; // // quoting of vars/atts/dims ie names which contain '.' or '-' defdim("a--list.A",10); defdim("a..---",20); 'b..m1'['$a--list.A']=100.1; 'b..m1'(0)=90.1; 'b..m1@c--lost'=23; var_double=1.0; var_float=1.0f; var_int=1; var_short=1s; var_byte=1b; var_char[char_dmn_lng04]="Hell"; /* Following lines _require_ netCDF4: Uncommenting them in ncap2.in is not recommended since we cannot assume that ncap2 was built with netCDF4 */ /* var_ubyte=1ub; var_ushort=1us; var_uint=1u; var_int64=1ll; var_uint64=1ull; */ // function reverse m1=three_dmn_var_sht; // reverse the data -- can specify positional args as well m2=m1.reverse($0,$2); m3=m1.reverse($lon); // permute dims --nb for permute MUST specify all dims // record dim must be the first dim in list m4=m1.permute($0,$2,$1); m5=a22.permute($time,$lev,$lon,$lat); nco-5.3.3/data/ncap2_tst.nco000066400000000000000000000341741477164337000156350ustar00rootroot00000000000000// $Header$ -*-C++-*- // Purpose: Test script for ncap2 /* Usage: ncap2 -O -v -S ~/nco/data/ncap2_tst.nco ~/nco/data/in.nc ~/foo.nc ncks ~/foo.nc | /bin/more */ // Check methods first // Count number of errors nbr_err=0; nbr_err_ttl=0; { a1=three_dmn_var_dbl.avg(); a2=three_dmn_var_dbl.avgsqr(); a3=three_dmn_var_dbl.max(); a4=three_dmn_var_dbl.min(); a5=three_dmn_var_dbl.rmssdn(); a6=three_dmn_var_dbl.total(); // Join operands together b1=three_dmn_var_dbl.avg($0).total(); b2=three_dmn_var_dbl.avgsqr($1).rmssdn(); b3=three_dmn_var_dbl.max($2).min(); b4=three_dmn_var_dbl.min($0).max(); b5=three_dmn_var_dbl.rmssdn($1).avgsqr(); b6=three_dmn_var_dbl.total($2).avg(); // Check that total handles missing values correctly // two missing values b10[time]={1,2,3,4,5,6,7,8,9,1}; b10.set_miss(1L); // all missing values b11[time]=1s; b11.set_miss(1s); // various missing values b12=three_dmn_var_dbl; // set all values to 2.0 b12=2.0; b12.set_miss(1.0); // sprinkle a few missing values about b12(:,:,0:1)=1.0; if(fabs(a1-40.609d) > 0.01){ print("ERROR: a1:method test\n"); nbr_err++; } if(fabs(a1-40.609d) > 0.01){ print("ERROR: a1:method test\n"); nbr_err++; } if(fabs(a2-2208.145d) > 0.01){ print("ERROR: a2:method test\n"); nbr_err++; } if(a3 != 79L){ print("ERROR: a3:method test\n"); nbr_err++; } if(a4 != 1L){ print("ERROR: a4:method test\n"); nbr_err++; } if(fabs(a5-47.336d) > 0.01){ print("ERROR: a5:method test\n"); nbr_err++; } if(a6 != 2802L){ print("ERROR: a6:method test\n"); nbr_err++; } if(fabs(b1-322.714d) > 0.01){ print("ERROR: b1:method test\n"); nbr_err++; } if(fabs(b2-3095.591d) > 0.01){ print("ERROR: b2:method test\n"); nbr_err++; } if(b3 != 4L){ print("ERROR: b3:method test\n"); nbr_err++; } if(b4 != 8L){ print("ERROR: b4:method test\n"); nbr_err++; } if(fabs(b5-4149.576d) > 0.01){ print("ERROR: b5:method test\n"); nbr_err++; } if(fabs(b6-155.667d) > 0.01){ print("ERROR: b6:method test\n"); nbr_err++; } if(b10.total() != 44L){ print("ERROR: b10:method test\n"); nbr_err++; } // b11 should be full of missing vales if(!b11.total().missing()){ print("ERROR: b11:method test\n"); nbr_err++; } if(fabs(b12.total() -80.0d) > 0.01){ print("ERROR: b12:method test\n"); nbr_err++; } print("RESULTS block a,b: Num errors="); print(nbr_err,"%d"); nbr_err_ttl+=nbr_err; nbr_err=0; } // End Method test // Scott's wind speed test { bin_nbr=3; defdim("bin",bin_nbr); // [nbr] Bin dimension wnd_min[bin]={0,1,2}; // [m s-1] Minimum speed wnd_max[bin]={1,2,3}; // [m s-1] Maximum speed results[lat,lon,bin]={ 7, 1, 1, 6, 2, 1, 5, 2, 2, 6, 2, 1, 7, 1, 1, 5, 2, 2, 7, 2, 0, 6, 2, 1 }; // Regular Vars bin_cnt[lat,lon,bin]=0s; // [nbr] Wind speeds in bin bin_flg[time,lat,lon]=0s; // [flg] Wind speed within current bin set_miss(bin_cnt,wnd_spd@_FillValue); for(bin_idx=0;bin_idx= wnd_min(bin_idx) && wnd_spd < wnd_max(bin_idx)); bin_cnt(:,:,bin_idx)=bin_flg.total($time); // [nbr] Wind speeds in bin } if((bin_cnt-results).total() !=0){ print("ERROR: c1:Scotts test - regular vars\n"); nbr_err++; } // Repeat exercise with RAM vars *bin_ram_cnt[lat,lon,bin]=0s; *bin_ram_flg[time,lat,lon]=0s; set_miss(bin_ram_cnt,wnd_spd@_FillValue); for(bin_idx=0;bin_idx= wnd_min(bin_idx) && wnd_spd < wnd_max(bin_idx)); bin_ram_cnt(:,:,bin_idx)=bin_ram_flg.total($time); } if((bin_ram_cnt-results).total() !=0){ print("ERROR: c2:Scotts test - ram vars\n"); nbr_err++; } ram_delete(bin_ram_cnt); ram_delete(bin_ram_flg); print("RESULTS block c: Num errors="); print(nbr_err,"%d"); nbr_err_ttl+=nbr_err; nbr_err=0; } // End Scott's Test // More RAM var Testing { *d1[$time,$lat,$lon]=three_dmn_var_dbl; // Value list on RHS d1(0,0,:)={10d,20d,30d,40d}; // Attribute on RHS d1@n1={2d,4d,8d,16d}; d1(0,1,:)=d1@n1; // Scalar on RHS d1(:,:,3)=88.0; // RAM Var on RHS *d2[$lon]={1d,4d,9d,16d}; d1(2,0,:)=d2; ram_write(d1); if(fabs(d1.total()-3800d) > 0.01){ print("ERROR: d1:ram test\n"); nbr_err++; } //Repeat exersise with ints; *d3[$time,$lat,$lon]=three_dmn_var_int; // Value list on RHS d3(0,0,:)={9,11,13,15}; // Attribute on RHS d3@n1={2,4,8,16}; d3(0,1,:)=d1@n1; // Scalar on RHS d3(:,:,3)=100L; // RAM Var on RHS *d4[$lon]={1,3,27,81}; d3(2,0,:)=d4; // Regular var On RHS d5[$lon]={1,2,3,4}; d3(8,1,:)=d5; if(d3.total() !=3716L){ print("ERROR: d3:ram test\n"); nbr_err++; } print("RESULTS block d: Num errors="); print(nbr_err,"%d"); nbr_err_ttl+=nbr_err; nbr_err=0; ram_delete(d3); ram_delete(d4); } // Test LHS casting - Regular var { // Var on RHS e1[$time]=time; // Value list on RHS // nb type on RHS is the type of first member e2[$lon]={1f,2s,3L,4}; // Attribute on RHS e3@tst={5,25,50,100}; e3[$lon]=e3@tst; // Bare number on RHS e4[$lon]=99d; // Real-life casting e5[time,lat,lon,lev]=P0*hyam+hybm*PS; if(fabs(e1.avg()-5.5d) > 0.01){ print("ERROR: e1: LHS cast test\n"); nbr_err++; } if(fabs(e2.avgsqr()-7.5f) > 0.01){ print("ERROR: e2: LHS cast test\n"); nbr_err++; } if(e3.rmssdn() != 66L){ print("ERROR: e3: LHS cast test\n"); nbr_err++; } if(fabs(e4.total()-396d)>0.01){ print("ERROR: e4: LHS cast test\n"); nbr_err++; } if(fabs(e5.min()-360f) > 0.001f || fabs(e5.avg()-51254.11f) > 0.01f){ print("ERROR: e5: LHS cast test\n"); nbr_err++; } print("RESULTS block e: Num errors="); print(nbr_err,"%d"); nbr_err_ttl+=nbr_err; nbr_err=0; } // Check var/att/dim quoting { 'u---u'=10L; 'v...v'=20L; 'w...w'='u---u'*'v...v'; 'u---u@kill'=10L; 'v...v@o.one'=30L; f1='v...v@o.one' *100; f2='u---u'+40; defdim("t..t",5); f3['$lon','$lat','$t..t']=1.1d; f4='$t..t'.size; if(f1 !=3000L){ print("ERROR: f1: ID quoting\n"); nbr_err++; } if(f2 != 50L){ print("ERROR: f2: ID quoting\n"); nbr_err++; } if(fabs(f3.total()-44.0) > 0.01){ print("ERROR: f3: ID quoting\n"); nbr_err++; } if(f4 != 5L){ print("ERROR: f4: ID quoting\n"); nbr_err++; } print("RESULTS block f: Num errors="); print(nbr_err,"%d"); nbr_err_ttl+=nbr_err; nbr_err=0; } //end ID quoting // Check Loops { *idx=0L; *jdx=0L; *g1=0; *g2=0.0; while(idx++ <20){ jdx=0; while(jdx++<10){ if(jdx>5) continue; g1+=jdx; } if(idx==12) break; } if(g1 !=180L){ print("ERROR: g1: LHS loop test\n"); nbr_err++; } for(idx=0 ; idx<10 ; idx++){ for(jdx=10.0 ; jdx<15.0; jdx++) g2+=(idx+jdx); } if(fabs(g2-825d)>0.01){ print("ERROR: g2: LHS loop test\n"); nbr_err++; } ram_write(g2); ram_delete(idx); ram_delete(jdx); ram_delete(g1); print("RESULTS block g: Num errors="); print(nbr_err,"%d"); nbr_err_ttl+=nbr_err; nbr_err=0; } // Check missing value functions and masking { h1=txyz; // Change all values less than 20 or greater than 80 to 2; *hmask= h1<20 || h1>80; h1=hmask*2 +!hmask*h1; change_miss(h1,2f); h2=h1.total($time,$2).max(); h3=h1.avgsqr($x,$3).min(); // check get_miss method h4=fll_val.get_miss(); if(fabs(h2-315f)>0.01){ print("ERROR: h2: masking test\n"); nbr_err++; } if(fabs(h3-420.5f)>0.01){ print("ERROR: h3: masking test\n"); nbr_err++; } if(fabs(h4-(-999.0f))>0.01){ print("ERROR: h4: get_miss() test\n"); nbr_err++; } // ram_delete(hmask); print("RESULTS block h: Num errors="); print(nbr_err,"%d"); nbr_err_ttl+=nbr_err; nbr_err=0; } // Check hyperslab normalization // NB: This is where a limit in a hyperslab collapses to a single index // or the slab specified is equal to all the indices in the dimension // e.g., three_dmn_var_dbl(1,:,:), three_dmn_var_dbl(0:9,:,1), three_dmn_var_dbl(:,0,:) { i1=three_dmn_var_int(0,:,:)+three_dmn_var_int(1,:,:).reverse($lat,$lon); i2=three_dmn_var_int(0,0,0)+three_dmn_var_int(1,1,3); // NB: RHS is cast correctly i3[$time,$lat,$lon]=three_dmn_var_int(1,:,:); i4=i3.avg($time); //nb i4 has dims $lat,$lon // Check that missing value is preserved in a hyperslab i5=three_dmn_var_sht(:,:,:); // Check size of an un-normalizable hyperslab i5@size=three_dmn_var_sht(0,:,0:1).size(); // Check min and max i6=three_dmn_var_sht(:,1,3); if(fabs(i1.avg()-17L)>0.001){ print("ERROR: i1: hyperslab normalization test \n"); nbr_err++; } if(i2 != 17L){ print("ERROR: i2: hyperslab normalization test \n"); nbr_err++; } if(i4.min()!=9 || i4.max()!=16){ print("ERROR: i3: hyperslab normalization test \n"); nbr_err++; } if(i5.total()-three_dmn_var_sht.total() !=0){ print("ERROR: i5: hyperslab normalization test \n"); nbr_err++; } if(i5@size-4 !=0){ print("ERROR: i5a: hyperslab size test \n"); nbr_err++; } if(i6.min()!=8 || i6.max()!=72){ print("ERROR: i6: hyperslab min/max test \n"); nbr_err++; } print("RESULTS block i: Num errors="); print(nbr_err,"%d"); nbr_err_ttl+=nbr_err; nbr_err=0; } // Check "where" structure { // start simple j1=time; where(time > 6) j1=10; elsewhere j1=5; j1_ttl=j1.total(); if(fabs(j1_ttl-70.0)>0.01){ print("ERROR: j1: simple where test\n"); nbr_err++; } j2=three_dmn_var_int; j3[$time,lat,lon]=1; j4=three_dmn_var_dbl; where(three_dmn_var_dbl >40){ j2=j3; j4=10.0; } elsewhere{ j3=-1.0; j4=j3; } j2_ttl=j3.total(); j4_ttl=j4.total(); // nb j2 type integer if(j2_ttl+6L != 0){ print("ERROR: j2: where test with blocks\n"); nbr_err++; } if(fabs(j4_ttl-327d)> 0.01){ print("ERROR: j4: where test with blocks\n"); nbr_err++; } // try missing value equal to NC_FILL_INT j5=time.int(); j5.set_miss(-2147483647L); where(j5 > 3L) j5=-2147483647L; if(fabs(j5.total().float() - 6f) > 0.01){ print("ERROR: j5: where test with NC_FILL_INT\n"); nbr_err++; } print("RESULTS block j: Num errors="); print(nbr_err,"%d"); nbr_err_ttl+=nbr_err; nbr_err=0; } // Check if /else construct { k1=0; k2=0; k3=0; k4=0; k5=0; k6=time.int(); k7=0; if(one == 0){k1=10;}else{k1=5;} if(k1!=5){ print("ERROR: k1: if/else test with blocks\n"); nbr_err++; } if(0){k2=1;} else if(1) k2=10; if(k2 != 10){ print("ERROR: k2: if/else test with blocks\n"); nbr_err++; } if(one == 0) k3=1; else if(one == 0) k3=2; else k3=3; if(k3 != 3){ print("ERROR: k3: if/else test with blocks\n"); nbr_err++; } if(one==0) {k4=1; } else{if(one==0) k4=2; else k4=3; } if(k4 != 3){ print("ERROR: k4: if/else test with blocks\n"); nbr_err++; } // dangling else if(four == 0) k5=1; else if(one==0) k5=2; else k5=3; if(k5 != 3){ print("ERROR: k5: if/else test with blocks\n"); nbr_err++; } if(four == 4) where(time > 5) k6=10; elsewhere k6=1; if(k6.total() != 55){ print("ERROR: k6: if/else test with blocks\n"); nbr_err++; } if(one == 1){k7=7;}else{k7=-7;} if(k7 != 7){ print("ERROR: k7: if/else test with blocks\n"); nbr_err++; } print("RESULTS block k: Num errors="); print(nbr_err,"%d"); nbr_err_ttl+=nbr_err; nbr_err=0; } // Check irregular hyperslabs on RHS { m1=three_dmn_var_int(:,0,0:1).max(); //74 m2=three_dmn_var_int(:,0,0:1).min(); //1 m3=three_dmn_var_int(0:1,0,0:1).total(); //22 m4=three_dmn_var_dbl; m4(:,0,0:1)=4*three_dmn_var_int(:,0,0:1); // hyperslab with an attribute on RHS m5=three_dmn_var_dbl; m5@tst1=three_dmn_var_int(:,0,0:1); m5(:,0,0:1)=m5@tst1; // hyperslab with a RAM var on RHS m6=three_dmn_var_dbl; *m6a=three_dmn_var_int; m6(:,0,0:1)=4*m6a(:,0,0:1); // hyperslab a RAM var *m7=three_dmn_var_int; m8=m7(0:1,0,0:1).total(); //22 ram_delete(m7); ram_delete(m6a); if(m1 != 74L){ print("ERROR: m1: Irregular hyperslab test \n"); nbr_err++; } if(m2 != 1L){ print("ERROR: m2: Irregular hyperslab test \n"); nbr_err++; } if(m3 != 22L){ print("ERROR: m3: Irregular hyperslab test \n"); nbr_err++; } if(fabs(m4.total() -4141.0d) > 0.01d){ print("ERROR: m4: Irregular hyperslab test \n"); nbr_err++; } if(fabs(m5.total() -2710.0d) > 0.01d){ print("ERROR: m5: Irregular hyperslab test \n"); nbr_err++; } if(fabs(m6.total() -4141.0d) > 0.01d){ print("ERROR: m6: Irregular hyperslab test \n"); nbr_err++; } if(m8 != 22L){ print("ERROR: m8: Irregular hyperslab test RAM var\n"); nbr_err++; } print("RESULTS block m: Num errors="); print(nbr_err,"%d"); nbr_err_ttl+=nbr_err; nbr_err=0; } // Check sorting functions // At present only two sort functions: sort(var_exp,&sort_map), dsort(var_exp,sort_map) { // Check basic sort n1[lat,lon]={200L,100,3,8,-10,-5,0,-9L}; n1_st=n1.sort(); // Create map from first row of elements sort(n1(0,:),&n1_map); n2[lat,lon]={-1.0,0.0,2.0,3.0,10.0,20.0,30.0,40.0}; n2=remap(n2,n1_map); // Create map larger variable n3=remap(three_dmn_var_dbl,n1_map); if(n1.min() != n1_st(0,0) || n1.max()!=n1_st(1,3)){ print("ERROR: n1: Basic sort test\n"); nbr_err++; } *n_tmp[lon]={3,2,0,1L}; if(n1_map != n_tmp){ print("ERROR: n2: Create mapping sort test\n"); nbr_err++; } ram_delete(n_tmp); if(n2(0,0) != 2.0 || n2(1,3) != 10.0){ print("ERROR: n3: Apply mapping sort test\n"); nbr_err++; } if(n3(9,1,0) != 79.0 || n3(9,1,3) != 77.0){ print("ERROR: n4: Apply mapping sort test\n"); nbr_err++; } print("RESULTS block n: Num errors="); print(nbr_err,"%d"); nbr_err_ttl+=nbr_err; nbr_err=0; } // Results summany print("RESULTS SUMMARY: total errors=");print(nbr_err_ttl,"%d"); nco-5.3.3/data/nccf000077500000000000000000000211261477164337000140670ustar00rootroot00000000000000#!/bin/sh # Purpose: CF-check netCDF3/netCDF4/HDF4/HDF5 files # Dismember them first if necessary or requested # Dismembering places each input file group in separate netCDF3 output file # Described in NCO User Guide at http://nco.sf.net/nco.html#nccf # Originally incarnated as ncdismember in NCO 4.3.6, September 2013 # Re-incarnated with getopt as nccf in NCO 4.5.1, July 2015 # Requirements: NCO 4.3.x+, UNIX shell utilities awk, grep, sed # Optional: Decker CFchecker https://bitbucket.org/mde_/cfchecker # Currently handles three checkers: # NERC http://puma.nerc.ac.uk/cgi-bin/cf-checker.pl # Decker checker cf # IOOS checker (unsupported): https://data.ioos.us/compliance # JPL MCC checker (unsupported, based on IOOS): http://podaac-uat.jpl.nasa.gov/mcc # Usage: # nccf -c cf_chk -f fl_in -i drc_in -o drc_out -n nco_opt -v cf_vrs # where fl_in is input file/URL to check/dismember, drc_in/out are # input and output directories, respectively # CF-compliance check is performed by default, unless -c 'no' is given # Default checker is Decker's cfchecker installed locally # Specify cf_chk=nerc for smallified uploads to NERC checker # Option cf_vrs is CF version to check # Option nco_opt passes straight-through to ncks # Arguments must not use shell expansion/globbing # NB: nccf does not clean-up output directory, so user must # chmod a+x ~/sh/nccf # Examples: # nccf ~/nco/data/mdl_1.nc /data/zender/tmp # nccf http://dust.ess.uci.edu/nco/mdl_1.nc /tmp # nccf http://thredds-test.ucar.edu/thredds/dodsC/testdods/foo.nc /tmp # nccf ~/nco/data/mdl_1.nc /data/zender/nco/tmp cf # nccf ~/nco/data/mdl_1.nc /data/zender/nco/tmp nerc # nccf ~/nco/data/mdl_1.nc /data/zender/nco/tmp cf 1.3 # nccf ~/nco/data/mdl_1.nc /data/zender/nco/tmp cf 1.5 --fix_rec_dmn=all # Set script name spt_nm=`basename ${0}` # [sng] Script name # Set fonts for legibility fnt_nrm=`tput sgr0` # Normal fnt_bld=`tput bold` # Bold fnt_rvr=`tput smso` # Reverse # Command-line argument defaults fl_in="${HOME}/nco/data/mdl_1.nc" # [sng] Input file to dismember/check drc_in='' # [sng] Input directory drc_out="${DATA}/nco/tmp" # [sng] Output directory #cf_chk='dck' # [sng] Checker cf_chk='nerc' # [sng] Checker cf_flg='Yes' # [flg] CF-check files? cf_vrs='1.5' # [sng] Compliance-check this CF version (e.g., '1.5') opt='' # [flg] Additional ncks options (e.g., '--fix_rec_dmn=all') # Use single quotes to pass multiple arguments to opt=${5} # Otherwise arguments would be seen as ${5}, ${6}, ${7} ... function fnc_usg_prn { # Print usage printf "\nQuick documentation for ${fnt_bld}${spt_nm}${fnt_nrm} (read script for more thorough explanation)\n\n" printf "${fnt_rvr}Basic usage:${fnt_nrm} ${fnt_bld}$spt_nm -c cf_chk -f fl_in -o drc_out${fnt_nrm}\n\n" echo "Command-line options:" echo "${fnt_rvr}-c${fnt_nrm} ${fnt_bld}cf_chk${fnt_nrm} CF checker to use (empty means none) (default ${fnt_bld}${cf_chk}${fnt_nrm})" echo "${fnt_rvr}-d${fnt_nrm} ${fnt_bld}dbg_lvl${fnt_nrm} Debugging level (default ${fnt_bld}${dbg_lvl}${fnt_nrm})" echo "${fnt_rvr}-f${fnt_nrm} ${fnt_bld}fl_in${fnt_nrm} Input file (default ${fnt_bld}${fl_in}${fnt_nrm})" echo "${fnt_rvr}-i${fnt_nrm} ${fnt_bld}drc_in${fnt_nrm} Input directory ${fnt_bld}drc_in${fnt_nrm} (default ${fnt_bld}${drc_in}${fnt_nrm})" echo "${fnt_rvr}-n${fnt_nrm} ${fnt_bld}nco_opt${fnt_nrm} NCO options (empty means none) (default ${fnt_bld}${nco_opt}${fnt_nrm})" echo "${fnt_rvr}-o${fnt_nrm} ${fnt_bld}drc_out${fnt_nrm} Output directory (default ${fnt_bld}${drc_out}${fnt_nrm})" echo "${fnt_rvr}-v${fnt_nrm} ${fnt_bld}cf_vrs${fnt_nrm} Version of CF to use (default ${fnt_bld}${cf_vrs}${fnt_nrm})" printf "\n" printf "Examples: ${fnt_bld}$spt_nm -c ${caseid} -s ${yyyy_srt} -e ${yyyy_end} -i ${drc_in} -o ${drc_out} ${fnt_nrm}\n" printf "\n\n" exit 1 } # end fnc_usg_prn() # Check argument number and complain accordingly arg_nbr=$# #echo -e \\n"dbg: Number of arguments: ${arg_nbr}" if [ ${arg_nbr} -eq 0 ]; then fnc_usg_prn fi # !arg_nbr # Parse command-line options: cmd_ln="${@}" while getopts :c:d:f:hi:n:o::v: OPT; do case ${OPT} in c) cf_chk=${OPTARG} ;; # Checker to use d) dbg_lvl=${OPTARG} ;; # Debugging level f) fl_in=${OPTARG} ;; # Input file i) drc_in=${OPTARG} ;; # Input directory n) nco_opt=${OPTARG} ;; # NCO options o) drc_out=${OPTARG} ;; # Output directory v) cf_vrs=${OPTARG} ;; # CF Version h) fnc_usg_prn ;; # Help \?) # Unrecognized option echo -e \\n"Option -${fnt_bld}$OPTARG${fnt_nrm} not allowed." fnc_usg_prn ;; esac done shift $((OPTIND-1)) # Advance one argument # Derived variables chk_dck='n' chk_nrc='n' if [ ${cf_chk} = 'nerc' ]; then chk_nrc='y' fi # chk_nrc if [ ${cf_chk} != '0' ] && [ ${cf_chk} != 'nerc' ]; then chk_dck='y' hash cfchecker 2>/dev/null || { echo >&2 "Local cfchecker command not found, will smallify and upload to NERC checker instead"; chk_nrc='y'; chk_dck='n'; } fi # !cf_chk # Print initial state if [ ${dbg_lvl} -ge 1 ]; then printf "dbg: chk_dck = ${chk_dck}\n" printf "dbg: chk_nerc = ${chk_nerc}\n" printf "dbg: cf_chk = ${cf_chk}\n" printf "dbg: cf_flg = ${cf_flg}\n" printf "dbg: cf_vrs = ${cf_vrs}\n" printf "dbg: dbg_lvl = ${dbg_lvl}\n" printf "dbg: drc_in = ${drc_in}\n" printf "dbg: drc_out = ${drc_out}\n" printf "dbg: mdl_nm = ${mdl_nm}\n" printf "dbg: nco_opt = ${nco_opt}\n" fi # !dbg # Human-readable summary echo "Checking and/or dismembering file ${fl_in}" if [ ${dbg_lvl} -ge 1 ]; then printf "${spt_nm} invoked with command:\n" echo "${spt_nm} ${cmd_ln}" fi # !dbg date_srt=$(date +"%s") printf "Started at `date`.\n" # Prepare and move-to output directory fl_stb=$(basename ${fl_in}) drc_out=${drc_out}/${fl_stb} mkdir -p ${drc_out} cd ${drc_out} # Obtain group list grp_lst=`ncks --cdl -m ${fl_in} | grep '// group' | awk '{$1=$2=$3="";sub(/^ */,"",$0);print}'` IFS=$'\n' # Change Internal-Field-Separator from to for grp_in in ${grp_lst} ; do # Replace slashes by dots for output group filenames grp_out=`echo ${grp_in} | sed 's/\///' | sed 's/\//./g'` if [ "${grp_out}" = '' ]; then grp_out='root' ; fi # Tell older NCO/netCDF if HDF4 with --hdf4 switch (signified by .hdf/.HDF suffix) hdf4=`echo ${fl_in} | awk '{if(match(tolower($1),".hdf$")) hdf4="--hdf4"; print hdf4}'` # Flatten to netCDF3, anchor, no history, no temporary file, padding, HDF4 flag, options cmd="ncks -O -3 -G : -g ${grp_in}/ -h --no_tmp_fl --hdr_pad=40 ${hdf4} ${opt} ${fl_in} ${drc_out}/${grp_out}.nc" # Use eval in case ${opt} contains multiple arguments separated by whitespace eval ${cmd} if [ ${chk_dck} = 'y' ]; then # Decker checker needs Conventions <= 1.6 no_bck_sls=`echo ${drc_out}/${grp_out} | sed 's/\\\ / /g'` ncatted -h -a Conventions,global,o,c,CF-${cf_vrs} ${no_bck_sls}.nc else # !chk_dck echo ${drc_out}/${grp_out}.nc fi # !chk_dck done if [ ${chk_dck} = 'y' ]; then echo 'Decker CFchecker reports CF-compliance of each group in flat netCDF3 format' cfchecker -c ${cf_vrs} *.nc fi if [ ${chk_nrc} = 'y' ]; then # Smallification and NERC upload from qdcf script by Phil Rasch (PJR) echo 'Using remote CFchecker http://puma.nerc.ac.uk/cgi-bin/cf-checker.pl' cf_lcn='http://puma.nerc.ac.uk/cgi-bin/cf-checker.pl' for fl in ${drc_out}/*.nc ; do fl_sml=${fl} cf_out=${fl%.nc}.html dmns=`ncdump -h ${fl_in} | sed -n -e '/dimensions/,/variables/p' | grep = | sed -e 's/=.*//'` hyp_sml='' for dmn in ${dmns}; do dmn_lc=`echo ${dmn} | tr "[:upper:]" "[:lower:]"` if [ ${dmn_lc} = 'lat' ] || [ ${dmn_lc} = 'latitude' ] || [ ${dmn_lc} = 'lon' ] || [ ${dmn_lc} = 'longitude' ] || [ ${dmn_lc} = 'time' ]; then hyp_sml=`echo ${hyp_sml}" -d ${dmn},0"` fi # !dmn_lc done # Create small version of input file by sampling only first element of lat, lon, time ncks -O ${hyp_sml} ${fl} ${fl_sml} # Send small file to NERC checker curl --form cfversion=1.6 --form upload=@${fl_sml} --form press="Check%20file" ${cf_lcn} -o ${cf_out} # Strip most HTML to improve readability cat ${cf_out} | sed -e "s/<[^>]*>//g" -e "/DOCTYPE/,/\]\]/d" -e "s/CF-Convention//g" -e "s/Output of//g" -e "s/Compliance Checker//g" -e "s/Check another//g" -e "s/CF-Checker follows//g" -e "s/Received//g" -e "s/for NetCDF//g" -e "s/NetCDF format//g" -e "s/against CF version 1//g" -e "s/\.\.\.//g" echo "Full NERC compliance-check log for ${fl} in ${cf_out}" done fi # !nerc date_end=$(date +"%s") printf "Completed climatology generation for model-run ${caseid} at `date`.\n" date_dff=$((date_end-date_srt)) echo "Elapsed time $((date_dff/60))m$((date_dff % 60))s" exit 0 nco-5.3.3/data/ncchecker000077500000000000000000000625471477164337000151170ustar00rootroot00000000000000#!/usr/bin/env bash # Purpose: Check data file against DIWG (and, eventually, other) recommendations # Copyright (C) 2023--present Charlie Zender, ... (Contribuing DIWG members---Add your names!) # 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 3-Clause BSD License for more details. # Prerequisites: Bash, NCO # Script could use other shells, e.g., dash (Debian default) after rewriting function definitions and loops # Debug with 'bash -x ncchecker --dbg=dbg_lvl' where 0 <= dbg_lvl <= 5 # Insta-install: # scp ~/diwg/ncchecker dust.ess.uci.edu:bin # scp dust.ess.uci.edu:bin/ncchecker ${MY_BIN_DIR} # Set script name, directory, PID, run directory drc_pwd=${PWD} # Security: Explicitly unset IFS before wordsplitting, so Bash uses default IFS= unset IFS # Set these before 'module' command which can overwrite ${BASH_SOURCE[0]} # NB: dash supports $0 syntax, not ${BASH_SOURCE[0]} syntax # http://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-stored-in spt_src="${BASH_SOURCE[0]}" [[ -z "${spt_src}" ]] && spt_src="${0}" # Use ${0} when BASH_SOURCE is unavailable (e.g., dash) while [ -h "${spt_src}" ]; do # Recursively resolve ${spt_src} until file is no longer a symlink drc_spt="$( cd -P "$( dirname "${spt_src}" )" && pwd )" spt_src="$(readlink "${spt_src}")" [[ ${spt_src} != /* ]] && spt_src="${drc_spt}/${spt_src}" # If ${spt_src} was relative symlink, resolve it relative to path where symlink file was located done cmd_ln="${spt_src} ${@}" drc_spt="$( cd -P "$( dirname "${spt_src}" )" && pwd )" spt_nm=$(basename ${spt_src}) # [sng] Script name (unlike $0, ${BASH_SOURCE[0]} works well with 'source